blob: 8a877f1be8119f6a8378032371dba38d3d1426c2 [file] [log] [blame]
library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_out.dart:19:5: Error: The return type of the method 'SubOutOut.nullableBad' is 'T', which does not match the return type, 'int', of the overridden method, 'SuperOut.nullableBad'.
// Change to a subtype of 'int'.
// T nullableBad<T>(T t) => null;
// ^
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_out.dart:12:7: Context: This is the overridden method ('nullableBad').
// int nullableBad<T>(T t) => 1;
// ^
//
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_out.dart:20:5: Error: The return type of the method 'SubOutOut.nonNullableBad' is 'T', which does not match the return type, 'int', of the overridden method, 'SuperOut.nonNullableBad'.
// Change to a subtype of 'int'.
// T nonNullableBad<T>(T t) => t;
// ^
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_out.dart:13:7: Context: This is the overridden method ('nonNullableBad').
// int nonNullableBad<T>(T t) => 2;
// ^
//
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_out.dart:26:5: Error: The return type of the method 'SubInOut.nullableBad' is 'T', which does not match the return type, 'int', of the overridden method, 'SuperIn.nullableBad'.
// Change to a subtype of 'int'.
// T nullableBad<T>(T t) => null;
// ^
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_in.dart:10:8: Context: This is the overridden method ('nullableBad').
// int? nullableBad<T>(T t) => 1;
// ^
//
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_out.dart:27:5: Error: The return type of the method 'SubInOut.nonNullableBad' is 'T', which does not match the return type, 'int', of the overridden method, 'SuperIn.nonNullableBad'.
// Change to a subtype of 'int'.
// T nonNullableBad<T>(T t) => t;
// ^
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_in.dart:11:7: Context: This is the overridden method ('nonNullableBad').
// int nonNullableBad<T>(T t) => 2;
// ^
//
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_out.dart:33:17: Error: A value of type 'double' can't be assigned to a variable of type 'int Function()'.
// nullableVar = nonNullableVar;
// ^
//
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_out.dart:34:20: Error: A value of type 'int Function()' can't be assigned to a variable of type 'double'.
// nonNullableVar = nullableVar;
// ^
//
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_out.dart:35:15: Error: A value of type 'int Function()' can't be assigned to a variable of type 'String'.
// legacyVar = nullableVar;
// ^
//
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_out.dart:36:17: Error: A value of type 'String' can't be assigned to a variable of type 'int Function()'.
// nullableVar = legacyVar;
// ^
//
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_out.dart:37:20: Error: A value of type 'String' can't be assigned to a variable of type 'double'.
// nonNullableVar = legacyVar;
// ^
//
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_out.dart:38:15: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
// legacyVar = nonNullableVar;
// ^
//
import self as self;
import "dart:core" as core;
import "messages_with_types_opt_in.dart" as mes;
import "org-dartlang-testcase:///messages_with_types_opt_in.dart";
class SuperOut extends core::Object {
synthetic constructor •() self::SuperOut*
: super core::Object::•()
;
method nullableSame() core::String*
return "foo";
method nonNullableSame() core::String*
return "bar";
method nullableBad<T extends core::Object* = dynamic>(self::SuperOut::nullableBad::T* t) core::int*
return 1;
method nonNullableBad<T extends core::Object* = dynamic>(self::SuperOut::nonNullableBad::T* t) core::int*
return 2;
abstract member-signature get _identityHashCode() core::int*; -> core::Object::_identityHashCode
abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) core::bool*; -> core::Object::_instanceOf
abstract member-signature method _simpleInstanceOf(dynamic type) core::bool*; -> core::Object::_simpleInstanceOf
abstract member-signature method _simpleInstanceOfTrue(dynamic type) core::bool*; -> core::Object::_simpleInstanceOfTrue
abstract member-signature method _simpleInstanceOfFalse(dynamic type) core::bool*; -> core::Object::_simpleInstanceOfFalse
abstract member-signature operator ==(dynamic other) core::bool*; -> core::Object::==
abstract member-signature get hashCode() core::int*; -> core::Object::hashCode
abstract member-signature method toString() core::String*; -> core::Object::toString
abstract member-signature method noSuchMethod(core::Invocation* invocation) dynamic; -> core::Object::noSuchMethod
abstract member-signature get runtimeType() core::Type*; -> core::Object::runtimeType
}
class SubOutOut extends self::SuperOut {
synthetic constructor •() self::SubOutOut*
: super self::SuperOut::•()
;
method nullableSame() core::String*
return "foo";
method nonNullableSame() core::String*
return "bar";
method nullableBad<T extends core::Object* = dynamic>(self::SubOutOut::nullableBad::T* t) self::SubOutOut::nullableBad::T*
return null;
method nonNullableBad<T extends core::Object* = dynamic>(self::SubOutOut::nonNullableBad::T* t) self::SubOutOut::nonNullableBad::T*
return t;
}
class SubInOut extends mes::SuperIn {
synthetic constructor •() self::SubInOut*
: super mes::SuperIn::•()
;
method nullableSame() core::String*
return "foo";
method nonNullableSame() core::String*
return "bar";
method nullableBad<T extends core::Object* = dynamic>(self::SubInOut::nullableBad::T* t) self::SubInOut::nullableBad::T*
return null;
method nonNullableBad<T extends core::Object* = dynamic>(self::SubInOut::nonNullableBad::T* t) self::SubInOut::nonNullableBad::T*
return t;
abstract member-signature get _identityHashCode() core::int*; -> core::Object::_identityHashCode
abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) core::bool*; -> core::Object::_instanceOf
abstract member-signature method _simpleInstanceOf(dynamic type) core::bool*; -> core::Object::_simpleInstanceOf
abstract member-signature method _simpleInstanceOfTrue(dynamic type) core::bool*; -> core::Object::_simpleInstanceOfTrue
abstract member-signature method _simpleInstanceOfFalse(dynamic type) core::bool*; -> core::Object::_simpleInstanceOfFalse
abstract member-signature operator ==(dynamic other) core::bool*; -> core::Object::==
abstract member-signature get hashCode() core::int*; -> core::Object::hashCode
abstract member-signature method toString() core::String*; -> core::Object::toString
abstract member-signature method noSuchMethod(core::Invocation* invocation) dynamic; -> core::Object::noSuchMethod
abstract member-signature get runtimeType() core::Type*; -> core::Object::runtimeType
}
static field core::String* legacyVar = "legacy";
static method testOptOut() dynamic {
mes::nullableVar = invalid-expression "pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_out.dart:33:17: Error: A value of type 'double' can't be assigned to a variable of type 'int Function()'.
nullableVar = nonNullableVar;
^" in mes::nonNullableVar as{TypeError} () →? core::int;
mes::nonNullableVar = invalid-expression "pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_out.dart:34:20: Error: A value of type 'int Function()' can't be assigned to a variable of type 'double'.
nonNullableVar = nullableVar;
^" in mes::nullableVar as{TypeError} core::double;
self::legacyVar = invalid-expression "pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_out.dart:35:15: Error: A value of type 'int Function()' can't be assigned to a variable of type 'String'.
legacyVar = nullableVar;
^" in mes::nullableVar as{TypeError} core::String*;
mes::nullableVar = invalid-expression "pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_out.dart:36:17: Error: A value of type 'String' can't be assigned to a variable of type 'int Function()'.
nullableVar = legacyVar;
^" in self::legacyVar as{TypeError} () →? core::int;
mes::nonNullableVar = invalid-expression "pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_out.dart:37:20: Error: A value of type 'String' can't be assigned to a variable of type 'double'.
nonNullableVar = legacyVar;
^" in self::legacyVar as{TypeError} core::double;
self::legacyVar = invalid-expression "pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_out.dart:38:15: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
legacyVar = nonNullableVar;
^" in mes::nonNullableVar as{TypeError} core::String*;
}
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_in.dart:17:6: Error: The return type of the method 'SubInIn.nullableBad' is 'T?', which does not match the return type, 'int?', of the overridden method, 'SuperIn.nullableBad'.
// Change to a subtype of 'int?'.
// T? nullableBad<T>(T t) => null;
// ^
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_in.dart:10:8: Context: This is the overridden method ('nullableBad').
// int? nullableBad<T>(T t) => 1;
// ^
//
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_in.dart:18:5: Error: The return type of the method 'SubInIn.nonNullableBad' is 'T', which does not match the return type, 'int', of the overridden method, 'SuperIn.nonNullableBad'.
// Change to a subtype of 'int'.
// T nonNullableBad<T>(T t) => t;
// ^
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_in.dart:11:7: Context: This is the overridden method ('nonNullableBad').
// int nonNullableBad<T>(T t) => 2;
// ^
//
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_in.dart:24:6: Error: The return type of the method 'SubOutIn.nullableBad' is 'T?', which does not match the return type, 'int', of the overridden method, 'SuperOut.nullableBad'.
// Change to a subtype of 'int'.
// T? nullableBad<T>(T t) => null;
// ^
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_out.dart:12:7: Context: This is the overridden method ('nullableBad').
// int nullableBad<T>(T t) => 1;
// ^
//
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_in.dart:25:5: Error: The return type of the method 'SubOutIn.nonNullableBad' is 'T', which does not match the return type, 'int', of the overridden method, 'SuperOut.nonNullableBad'.
// Change to a subtype of 'int'.
// T nonNullableBad<T>(T t) => t;
// ^
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_out.dart:13:7: Context: This is the overridden method ('nonNullableBad').
// int nonNullableBad<T>(T t) => 2;
// ^
//
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_in.dart:32:17: Error: A value of type 'double' can't be assigned to a variable of type 'int Function()?'.
// nullableVar = nonNullableVar;
// ^
//
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_in.dart:33:20: Error: A value of type 'int Function()?' can't be assigned to a variable of type 'double'.
// nonNullableVar = nullableVar;
// ^
//
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_in.dart:34:15: Error: A value of type 'int Function()?' can't be assigned to a variable of type 'String'.
// legacyVar = nullableVar;
// ^
//
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_in.dart:35:17: Error: A value of type 'String' can't be assigned to a variable of type 'int Function()?'.
// nullableVar = legacyVar;
// ^
//
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_in.dart:36:20: Error: A value of type 'String' can't be assigned to a variable of type 'double'.
// nonNullableVar = legacyVar;
// ^
//
// pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_in.dart:37:15: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
// legacyVar = nonNullableVar;
// ^
//
import self as mes;
import "dart:core" as core;
import "messages_with_types_opt_out.dart" as self;
import "org-dartlang-testcase:///messages_with_types_opt_out.dart";
class SuperIn extends core::Object {
synthetic constructor •() mes::SuperIn
: super core::Object::•()
;
method nullableSame() core::String?
return "foo";
method nonNullableSame() core::String
return "bar";
method nullableBad<T extends core::Object? = dynamic>(mes::SuperIn::nullableBad::T% t) core::int?
return 1;
method nonNullableBad<T extends core::Object? = dynamic>(mes::SuperIn::nonNullableBad::T% t) core::int
return 2;
}
class SubInIn extends mes::SuperIn {
synthetic constructor •() mes::SubInIn
: super mes::SuperIn::•()
;
method nullableSame() core::String?
return "foo";
method nonNullableSame() core::String
return "bar";
method nullableBad<T extends core::Object? = dynamic>(mes::SubInIn::nullableBad::T% t) mes::SubInIn::nullableBad::T?
return null;
method nonNullableBad<T extends core::Object? = dynamic>(mes::SubInIn::nonNullableBad::T% t) mes::SubInIn::nonNullableBad::T%
return t;
}
class SubOutIn extends self::SuperOut {
synthetic constructor •() mes::SubOutIn
: super self::SuperOut::•()
;
method nullableSame() core::String?
return "foo";
method nonNullableSame() core::String
return "bar";
method nullableBad<T extends core::Object? = dynamic>(mes::SubOutIn::nullableBad::T% t) mes::SubOutIn::nullableBad::T?
return null;
method nonNullableBad<T extends core::Object? = dynamic>(mes::SubOutIn::nonNullableBad::T% t) mes::SubOutIn::nonNullableBad::T%
return t;
}
static field () →? core::int nullableVar = () core::int => 3;
static field core::double nonNullableVar = 4.0;
static method testOptIn() dynamic {
mes::nullableVar = invalid-expression "pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_in.dart:32:17: Error: A value of type 'double' can't be assigned to a variable of type 'int Function()?'.
nullableVar = nonNullableVar;
^" in mes::nonNullableVar as{TypeError,ForNonNullableByDefault} () →? core::int;
mes::nonNullableVar = invalid-expression "pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_in.dart:33:20: Error: A value of type 'int Function()?' can't be assigned to a variable of type 'double'.
nonNullableVar = nullableVar;
^" in mes::nullableVar as{TypeError,ForNonNullableByDefault} core::double;
self::legacyVar = invalid-expression "pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_in.dart:34:15: Error: A value of type 'int Function()?' can't be assigned to a variable of type 'String'.
legacyVar = nullableVar;
^" in mes::nullableVar as{TypeError,ForNonNullableByDefault} core::String*;
mes::nullableVar = invalid-expression "pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_in.dart:35:17: Error: A value of type 'String' can't be assigned to a variable of type 'int Function()?'.
nullableVar = legacyVar;
^" in self::legacyVar as{TypeError,ForNonNullableByDefault} () →? core::int;
mes::nonNullableVar = invalid-expression "pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_in.dart:36:20: Error: A value of type 'String' can't be assigned to a variable of type 'double'.
nonNullableVar = legacyVar;
^" in self::legacyVar as{TypeError,ForNonNullableByDefault} core::double;
self::legacyVar = invalid-expression "pkg/front_end/testcases/nnbd_mixed/messages_with_types_opt_in.dart:37:15: Error: A value of type 'double' can't be assigned to a variable of type 'String'.
legacyVar = nonNullableVar;
^" in mes::nonNullableVar as{TypeError,ForNonNullableByDefault} core::String*;
}