blob: 4bf9d54f271677f6ff052de54a2344e6f3d8ff54 [file] [log] [blame]
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/type_constraint_solving_closures_in_upper_and_lower_bounds.dart:15:14: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
// String s = x; // Should be an error, `T` should be int.
// ^
//
import self as self;
import "dart:core" as core;
class C<X extends core::Object? = dynamic> extends core::Object {
constructor •((self::C::X%) void x) self::C<self::C::X%>
: super core::Object::•()
;
}
static method check<T extends core::Object? = dynamic>(self::C<core::List<self::check::T%>> f) self::check::T% {
return let Null #t1 = null in #t1 == null ?{self::check::T%} #t1 as{ForNonNullableByDefault} self::check::T% : #t1{self::check::T%};
}
static method test() void {
core::int x = self::check<core::int>(new self::C::•<core::List<core::int>>((core::List<core::int> x) void {}));
core::String s = invalid-expression "pkg/front_end/testcases/nnbd/type_constraint_solving_closures_in_upper_and_lower_bounds.dart:15:14: Error: A value of type 'int' can't be assigned to a variable of type 'String'.
String s = x; // Should be an error, `T` should be int.
^" in x as{TypeError,ForNonNullableByDefault} core::String;
}
static method main() dynamic {}
Extra constant evaluation status:
Evaluated: EqualsNull @ org-dartlang-testcase:///type_constraint_solving_closures_in_upper_and_lower_bounds.dart:10:3 -> BoolConstant(true)
Evaluated: VariableGet @ org-dartlang-testcase:///type_constraint_solving_closures_in_upper_and_lower_bounds.dart:10:15 -> NullConstant(null)
Evaluated: VariableGet @ org-dartlang-testcase:///type_constraint_solving_closures_in_upper_and_lower_bounds.dart:10:3 -> NullConstant(null)
Extra constant evaluation: evaluated: 9, effectively constant: 3