blob: 5faad62e2525a59b578f08308cfea327a8496185 [file] [log] [blame]
library test /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:24:12: Error: The argument type 'num' can't be assigned to the parameter type 'int'.
// printInt(myMax(1, 2));
// ^
//
// pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:28:32: Error: The argument type 'double' can't be assigned to the parameter type 'int'.
// /*@typeArgs=int*/ max(1, 2.0));
// ^
//
// pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:30:32: Error: The argument type 'double' can't be assigned to the parameter type 'int'.
// /*@typeArgs=int*/ min(1, 2.0));
// ^
//
// pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:37:34: Error: The argument type 'String' can't be assigned to the parameter type 'int'.
// printInt(/*@typeArgs=int*/ min("hi", "there"));
// ^
//
// pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:37:40: Error: The argument type 'String' can't be assigned to the parameter type 'int'.
// printInt(/*@typeArgs=int*/ min("hi", "there"));
// ^
//
import self as self;
import "dart:core" as core;
import "dart:math" as math;
import "dart:math";
static method printInt(core::int x) void
return core::print(x);
static method printDouble(core::double x) void
return core::print(x);
static method myMax(core::num x, core::num y) core::num
return math::max<core::num>(x, y);
static method f() dynamic {
self::printInt(math::max<core::int>(1, 2));
self::printInt(math::min<core::int>(1, 2));
self::printDouble(math::max<core::double>(1.0, 2.0));
self::printDouble(math::min<core::double>(1.0, 2.0));
self::printInt(invalid-expression "pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:24:12: Error: The argument type 'num' can't be assigned to the parameter type 'int'.
printInt(myMax(1, 2));
^" in self::myMax(1, 2) as{TypeError,ForNonNullableByDefault} core::int);
self::printInt(self::myMax(1, 2) as{ForNonNullableByDefault} core::int);
self::printInt(math::max<core::int>(1, invalid-expression "pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:28:32: Error: The argument type 'double' can't be assigned to the parameter type 'int'.
/*@typeArgs=int*/ max(1, 2.0));
^" in 2.0 as{TypeError,ForNonNullableByDefault} core::int));
self::printInt(math::min<core::int>(1, invalid-expression "pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:30:32: Error: The argument type 'double' can't be assigned to the parameter type 'int'.
/*@typeArgs=int*/ min(1, 2.0));
^" in 2.0 as{TypeError,ForNonNullableByDefault} core::int));
self::printDouble(math::max<core::double>(1.0, 2.0));
self::printDouble(math::min<core::double>(1.0, 2.0));
self::printInt(math::min<core::int>(invalid-expression "pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:37:34: Error: The argument type 'String' can't be assigned to the parameter type 'int'.
printInt(/*@typeArgs=int*/ min(\"hi\", \"there\"));
^" in "hi" as{TypeError,ForNonNullableByDefault} core::int, invalid-expression "pkg/front_end/testcases/inference/generic_methods_dart_math_min_max.dart:37:40: Error: The argument type 'String' can't be assigned to the parameter type 'int'.
printInt(/*@typeArgs=int*/ min(\"hi\", \"there\"));
^" in "there" as{TypeError,ForNonNullableByDefault} core::int));
}
static method main() dynamic {}