[cfe] Fix missing comma between type parameters in function types

Change-Id: I90f7d1665a93414ed89799b3f564fdb7d2114e20
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119324
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Auto-Submit: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
This commit is contained in:
Aske Simon Christensen
2019-09-30 13:44:59 +00:00
committed by commit-bot@chromium.org
parent 343723cdff
commit 0a5f736c68
6 changed files with 77 additions and 0 deletions
@@ -178,6 +178,7 @@ class TypeLabeler implements DartTypeVisitor<void>, ConstantVisitor<void> {
result.add(" extends ");
param.bound.accept(this);
}
first = false;
}
result.add(">");
}
@@ -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 extends num, B extends num>(A a, B b) => a + b;
test() {
int x = add;
}
main() {
if (add(1,2) < 3) test();
}
@@ -0,0 +1,10 @@
library;
import self as self;
import "dart:core" as core;
static method add<A extends core::num* = core::num*, B extends core::num* = core::num*>(self::add::A* a, self::add::B* b) → core::num*
;
static method test() → dynamic
;
static method main() → dynamic
;
@@ -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 extends num, B extends num>(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<A extends core::num* = core::num*, B extends core::num* = core::num*>(self::add::A* a, self::add::B* b) → core::num*
return a.{core::num::+}(b);
static method test() → dynamic {
core::int* x = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/general/generic_function_type_in_message.dart:8:11: Error: A value of type 'num Function<A extends num, B extends num>(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<core::int*, core::int*>(1, 2).{core::num::<}(3))
self::test();
}
constants {
#C1 = tearoff self::add
}
@@ -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 extends num, B extends num>(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<A extends core::num* = core::num*, B extends core::num* = core::num*>(self::add::A* a, self::add::B* b) → core::num*
return a.{core::num::+}(b);
static method test() → dynamic {
core::int* x = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/general/generic_function_type_in_message.dart:8:11: Error: A value of type 'num Function<A extends num, B extends num>(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<core::int*, core::int*>(1, 2).{core::num::<}(3))
self::test();
}
constants {
#C1 = tearoff self::add
}
@@ -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