diff --git a/pkg/front_end/lib/src/fasta/kernel/type_labeler.dart b/pkg/front_end/lib/src/fasta/kernel/type_labeler.dart index 45d027579b0..0bb51ac842b 100644 --- a/pkg/front_end/lib/src/fasta/kernel/type_labeler.dart +++ b/pkg/front_end/lib/src/fasta/kernel/type_labeler.dart @@ -178,6 +178,7 @@ class TypeLabeler implements DartTypeVisitor, ConstantVisitor { result.add(" extends "); param.bound.accept(this); } + first = false; } result.add(">"); } diff --git a/pkg/front_end/testcases/general/generic_function_type_in_message.dart b/pkg/front_end/testcases/general/generic_function_type_in_message.dart new file mode 100644 index 00000000000..e4eaf3694be --- /dev/null +++ b/pkg/front_end/testcases/general/generic_function_type_in_message.dart @@ -0,0 +1,13 @@ +// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +num add(A a, B b) => a + b; + +test() { + int x = add; +} + +main() { + if (add(1,2) < 3) test(); +} diff --git a/pkg/front_end/testcases/general/generic_function_type_in_message.dart.outline.expect b/pkg/front_end/testcases/general/generic_function_type_in_message.dart.outline.expect new file mode 100644 index 00000000000..c236efd9d07 --- /dev/null +++ b/pkg/front_end/testcases/general/generic_function_type_in_message.dart.outline.expect @@ -0,0 +1,10 @@ +library; +import self as self; +import "dart:core" as core; + +static method add(self::add::A* a, self::add::B* b) → core::num* + ; +static method test() → dynamic + ; +static method main() → dynamic + ; diff --git a/pkg/front_end/testcases/general/generic_function_type_in_message.dart.strong.expect b/pkg/front_end/testcases/general/generic_function_type_in_message.dart.strong.expect new file mode 100644 index 00000000000..e9469d131f0 --- /dev/null +++ b/pkg/front_end/testcases/general/generic_function_type_in_message.dart.strong.expect @@ -0,0 +1,26 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/general/generic_function_type_in_message.dart:8:11: Error: A value of type 'num Function(A, B)' can't be assigned to a variable of type 'int'. +// int x = add; +// ^ +// +import self as self; +import "dart:core" as core; + +static method add(self::add::A* a, self::add::B* b) → core::num* + return a.{core::num::+}(b); +static method test() → dynamic { + core::int* x = let final #t1 = invalid-expression "pkg/front_end/testcases/general/generic_function_type_in_message.dart:8:11: Error: A value of type 'num Function(A, B)' can't be assigned to a variable of type 'int'. + int x = add; + ^" in (#C1) as{TypeError} core::int*; +} +static method main() → dynamic { + if(self::add(1, 2).{core::num::<}(3)) + self::test(); +} + +constants { + #C1 = tearoff self::add +} diff --git a/pkg/front_end/testcases/general/generic_function_type_in_message.dart.strong.transformed.expect b/pkg/front_end/testcases/general/generic_function_type_in_message.dart.strong.transformed.expect new file mode 100644 index 00000000000..e9469d131f0 --- /dev/null +++ b/pkg/front_end/testcases/general/generic_function_type_in_message.dart.strong.transformed.expect @@ -0,0 +1,26 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/general/generic_function_type_in_message.dart:8:11: Error: A value of type 'num Function(A, B)' can't be assigned to a variable of type 'int'. +// int x = add; +// ^ +// +import self as self; +import "dart:core" as core; + +static method add(self::add::A* a, self::add::B* b) → core::num* + return a.{core::num::+}(b); +static method test() → dynamic { + core::int* x = let final #t1 = invalid-expression "pkg/front_end/testcases/general/generic_function_type_in_message.dart:8:11: Error: A value of type 'num Function(A, B)' can't be assigned to a variable of type 'int'. + int x = add; + ^" in (#C1) as{TypeError} core::int*; +} +static method main() → dynamic { + if(self::add(1, 2).{core::num::<}(3)) + self::test(); +} + +constants { + #C1 = tearoff self::add +} diff --git a/pkg/front_end/testcases/text_serialization.status b/pkg/front_end/testcases/text_serialization.status index eea648f53c6..eed274df11f 100644 --- a/pkg/front_end/testcases/text_serialization.status +++ b/pkg/front_end/testcases/text_serialization.status @@ -160,6 +160,7 @@ general/function_type_is_check: TextSerializationFailure # Was: Pass general/function_type_recovery: TextSerializationFailure # Was: Pass general/functions: TextSerializationFailure # Was: Pass general/future_or_test: TextSerializationFailure # Was: Pass +general/generic_function_type_in_message: TextSerializationFailure general/having_part_with_part_and_annotation: TextSerializationFailure general/having_part_with_parts_and_annotation: TextSerializationFailure general/hello: TextSerializationFailure # Was: Pass