Files
sdk/pkg/front_end/testcases/general/function_invocation_bounds.dart.weak.transformed.expect
T
Johnni Winther 3c2dfd7975 [cfe] Check bounds on function invocation
Closes #45464

Change-Id: I0fb3abf66c2119147ddd9413792e6f5dc151c31c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193660
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-03-31 16:33:49 +00:00

52 lines
2.0 KiB
Plaintext

library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/general/function_invocation_bounds.dart:18:3: Error: 'F' isn't a type.
// F g = local;
// ^
//
// pkg/front_end/testcases/general/function_invocation_bounds.dart:9:8: Error: Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'T' on 'local'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// local("");
// ^
//
// pkg/front_end/testcases/general/function_invocation_bounds.dart:10:8: Error: Type argument 'String' doesn't conform to the bound 'num' of the type variable 'T' on 'local'.
// Try changing type arguments so that they conform to the bounds.
// local<String>(throw '');
// ^
//
// pkg/front_end/testcases/general/function_invocation_bounds.dart:14:4: Error: Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'T' on 'call'.
// Try specifying type arguments explicitly so that they conform to the bounds.
// f("");
// ^
//
// pkg/front_end/testcases/general/function_invocation_bounds.dart:15:4: Error: Type argument 'String' doesn't conform to the bound 'num' of the type variable 'T' on 'call'.
// Try changing type arguments so that they conform to the bounds.
// f<String>(throw '');
// ^
//
import self as self;
import "dart:core" as core;
typedef G<invariant T extends core::Object? = dynamic> = (T%) → T%;
static method test() → dynamic {
function local<T extends core::num = core::num>(T t) → T
return t;
local.call<core::String>("");
local.call<core::String>(throw "");
local.call<core::int>(0);
local.call<core::int>(throw "");
<T extends core::num = core::num>(T) → T f = local;
f.call<core::String>("");
f.call<core::String>(throw "");
f.call<core::int>(0);
f.call<core::int>(throw "");
invalid-type g = local;
g.call("");
g.call<core::String>(throw "");
g.call(0);
g.call<core::int>(throw "");
}
static method main() → dynamic {}