Fixed Issue #465: New tests for overriding added.
diff --git a/LanguageFeatures/nnbd/override_checking_A03_opted_in_lib.dart b/LanguageFeatures/nnbd/override_checking_A03_opted_in_lib.dart
new file mode 100644
index 0000000..e7e14b2
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A03_opted_in_lib.dart
@@ -0,0 +1,82 @@
+/*
+ * 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.
+ */
+/**
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+// Requirements=nnbd-strong
+
+import "../../Utils/expect.dart";
+
+class OPTED_NULLABLE_ARGS {
+ void test_int (int? i ) { Expect.isNull(i); }
+ void test_object (Object? o ) { Expect.isNull(o); }
+ void test_function(Function? f) { Expect.isNull(f); }
+}
+
+class OPTED_NONNULLABLE_ARGS {
+ void test_int (int i ) { Expect.isNull(i); }
+ void test_object (Object o ) { Expect.isNull(o); }
+ void test_function(Function f) { Expect.isNull(f); }
+}
+
+void testme() {}
+
+class OPTED_NULLABLE_FIELD {
+ int? i;
+ Object? o;
+ Function? f;
+}
+
+class OPTED_NONNULLABLE_FIELD {
+ int i = 1;
+ Object o = 1;
+ Function f = testme;
+}
+
+class OPTED_NULLABLE_GETTER {
+ int? get getInt => null;
+ Object? get getObject => null;
+ Function? get getFunction => null;
+}
+
+class OPTED_NONNULLABLE_GETTER {
+ int get getInt => 1;
+ Object get getObject => 1;
+ Function get getFunction => testme;
+}
+
+class OPTED_NULLABLE_SETTER {
+ void set setInt (int? i) { Expect.isNull(i); }
+ void set setObject (Object? o) { Expect.isNull(o); }
+ void set setFunction(Function? f) { Expect.isNull(f); }
+}
+
+class OPTED_NONNULLABLE_SETTER {
+ void set setInt (int i ) { Expect.isNull(i); }
+ void set setObject (Object o ) { Expect.isNull(o); }
+ void set setFunction (Function f) { Expect.isNull(f); }
+}
+
+class OPTED_NULLABLE_RETURN {
+ int? getInt() => null;
+ Object? getObject() => null;
+ Function? getFunction() => null;
+}
+
+class OPTED_NONNULLABLE_RETURN {
+ int getInt() => 1;
+ Object getObject() => 1;
+ Function getFunction() => testme;
+}
+
+class OPTED_NONNULLABLE_INT <T extends int > {}
+class OPTED_NONNULLABLE_OBJECT <T extends Object > {}
+class OPTED_NONNULLABLE_FUNCTION<T extends Function> {}
+
+class OPTED_NULLABLE_INT <T extends int?> {}
+class OPTED_NULLABLE_OBJECT <T extends Object?> {}
+class OPTED_NULLABLE_FUNCTION<T extends Function?> {}
diff --git a/LanguageFeatures/nnbd/override_checking_A03_opted_out_lib.dart b/LanguageFeatures/nnbd/override_checking_A03_opted_out_lib.dart
new file mode 100644
index 0000000..ee9f605
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A03_opted_out_lib.dart
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+/**
+ * @author iarkh@unipro.ru
+ */
+// @dart=2.6
+// SharedOptions=--enable-experiment=non-nullable
+// Requirements=nnbd-strong
+
+import "override_checking_A03_opted_in_lib.dart";
+
+class LEGACY_ARGS_1 extends OPTED_NULLABLE_ARGS implements OPTED_NONNULLABLE_ARGS {}
+class LEGACY_ARGS_2 extends OPTED_NONNULLABLE_ARGS implements OPTED_NULLABLE_ARGS {}
+
+class LEGACY_FIELDS_1 extends OPTED_NULLABLE_FIELD implements OPTED_NONNULLABLE_FIELD {}
+class LEGACY_FIELDS_2 extends OPTED_NONNULLABLE_FIELD implements OPTED_NULLABLE_FIELD {}
+
+class LEGACY_GETTER_1 extends OPTED_NULLABLE_GETTER implements OPTED_NONNULLABLE_GETTER {}
+class LEGACY_GETTER_2 extends OPTED_NONNULLABLE_GETTER implements OPTED_NULLABLE_GETTER {}
+
+class LEGACY_SETTER_1 extends OPTED_NULLABLE_SETTER implements OPTED_NONNULLABLE_SETTER {}
+class LEGACY_SETTER_2 extends OPTED_NONNULLABLE_SETTER implements OPTED_NULLABLE_SETTER {}
+
+class LEGACY_RETURN_1 extends OPTED_NULLABLE_RETURN implements OPTED_NONNULLABLE_RETURN {}
+class LEGACY_RETURN_2 extends OPTED_NONNULLABLE_RETURN implements OPTED_NULLABLE_RETURN {}
+
+class LEGACY_INT_1<T extends int> extends OPTED_NONNULLABLE_INT<T> implements OPTED_NULLABLE_INT<T> {}
+class LEGACY_INT_2<T extends int> extends OPTED_NULLABLE_INT<T> implements OPTED_NONNULLABLE_INT<T> {}
+
+class LEGACY_OBJECT_1<T extends Object> extends OPTED_NONNULLABLE_OBJECT<T> implements OPTED_NULLABLE_OBJECT<T> {}
+class LEGACY_OBJECT_2<T extends Object> extends OPTED_NULLABLE_OBJECT<T> implements OPTED_NONNULLABLE_OBJECT<T> {}
+
+class LEGACY_FUNCTION_1<T extends Function> extends OPTED_NONNULLABLE_FUNCTION<T> implements OPTED_NULLABLE_FUNCTION<T> {}
+class LEGACY_FUNCTION_2<T extends Function> extends OPTED_NULLABLE_FUNCTION<T> implements OPTED_NONNULLABLE_FUNCTION<T> {}
diff --git a/LanguageFeatures/nnbd/override_checking_A03_t01.dart b/LanguageFeatures/nnbd/override_checking_A03_t01.dart
new file mode 100644
index 0000000..2590bd9
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A03_t01.dart
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+/**
+ * @assertion Members inherited in a class in an opted-in library, which are
+ * inherited via a class or mixin defined in a legacy library are viewed with
+ * their erased legacy signature, even if they were original defined in an
+ * opted-in library. Note that if a class which is defined in a legacy library
+ * inherits a member with the same name from multiple super-interfaces, then
+ * error checking is done as usual using the legacy typing rules which ignore
+ * nullability. This means that it is valid for a legacy class to inherit the
+ * same member signature with contradictory nullability information. For the
+ * purposes of member lookup within a legacy library, nullability information is
+ * ignored, and so it is valid to simply erase the nullability information
+ * within the legacy library. When referenced from an opted-in library, the same
+ * erasure is performed, and the member is seen at its legacy type.
+ *
+ * We use legacy subtyping when checking inherited member signature coherence in
+ * classes because opted out libraries may bring together otherwise incompatible
+ * member signatures without causing an error.
+ *
+ * @description Check that legacy class can inherit the same method with
+ * parameter from two opted in classes with contradictory nullability
+ * information.
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+// Requirements=nnbd-strong
+
+import "override_checking_A03_opted_out_lib.dart";
+
+main() {
+ LEGACY_ARGS_1 x1 = LEGACY_ARGS_1();
+ x1.test_int (null);
+ x1.test_object (null);
+ x1.test_function(null);
+
+ LEGACY_ARGS_2 x2 = LEGACY_ARGS_2();
+ x2.test_int (null);
+ x2.test_object (null);
+ x2.test_function(null);
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A03_t02.dart b/LanguageFeatures/nnbd/override_checking_A03_t02.dart
new file mode 100644
index 0000000..df0f977
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A03_t02.dart
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+/**
+ * @assertion Members inherited in a class in an opted-in library, which are
+ * inherited via a class or mixin defined in a legacy library are viewed with
+ * their erased legacy signature, even if they were original defined in an
+ * opted-in library. Note that if a class which is defined in a legacy library
+ * inherits a member with the same name from multiple super-interfaces, then
+ * error checking is done as usual using the legacy typing rules which ignore
+ * nullability. This means that it is valid for a legacy class to inherit the
+ * same member signature with contradictory nullability information. For the
+ * purposes of member lookup within a legacy library, nullability information is
+ * ignored, and so it is valid to simply erase the nullability information
+ * within the legacy library. When referenced from an opted-in library, the same
+ * erasure is performed, and the member is seen at its legacy type.
+ *
+ * We use legacy subtyping when checking inherited member signature coherence in
+ * classes because opted out libraries may bring together otherwise incompatible
+ * member signatures without causing an error.
+ *
+ * @description Check that legacy class can inherit the same method with
+ * parameter from two opted in classes with contradictory nullability
+ * information.
+ *
+ * Issue 40414
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+// Requirements=nnbd-strong
+
+import "../../Utils/expect.dart";
+import "override_checking_A03_opted_out_lib.dart";
+
+class A extends LEGACY_ARGS_2 {
+ void test_int (int? i) { Expect.isNull(i); }
+ void test_object (Object? o) { Expect.isNull(o); }
+ void test_function(Function? f) { Expect.isNull(f); }
+}
+
+main() {
+ A a = A();
+ a.test_int (null);
+ a.test_object (null);
+ a.test_function(null);
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A03_t03.dart b/LanguageFeatures/nnbd/override_checking_A03_t03.dart
new file mode 100644
index 0000000..de40880
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A03_t03.dart
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+/**
+ * @assertion Members inherited in a class in an opted-in library, which are
+ * inherited via a class or mixin defined in a legacy library are viewed with
+ * their erased legacy signature, even if they were original defined in an
+ * opted-in library. Note that if a class which is defined in a legacy library
+ * inherits a member with the same name from multiple super-interfaces, then
+ * error checking is done as usual using the legacy typing rules which ignore
+ * nullability. This means that it is valid for a legacy class to inherit the
+ * same member signature with contradictory nullability information. For the
+ * purposes of member lookup within a legacy library, nullability information is
+ * ignored, and so it is valid to simply erase the nullability information
+ * within the legacy library. When referenced from an opted-in library, the same
+ * erasure is performed, and the member is seen at its legacy type.
+ *
+ * We use legacy subtyping when checking inherited member signature coherence in
+ * classes because opted out libraries may bring together otherwise incompatible
+ * member signatures without causing an error.
+ *
+ * @description Check that legacy class can inherit the same field from two
+ * opted in classes with contradictory nullability information.
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+// Requirements=nnbd-strong
+
+import "../../Utils/expect.dart";
+import "override_checking_A03_opted_out_lib.dart";
+
+main() {
+ LEGACY_FIELDS_1 x1 = LEGACY_FIELDS_1();
+ Expect.isNull(x1.i);
+ Expect.isNull(x1.o);
+ Expect.isNull(x1.f);
+
+ LEGACY_FIELDS_2 x2 = LEGACY_FIELDS_2();
+ x2.i = null;
+ Expect.isNull(x2.i);
+ x2.o = null;
+ Expect.isNull(x2.o);
+ x2.f = null;
+ Expect.isNull(x2.f);
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A03_t04.dart b/LanguageFeatures/nnbd/override_checking_A03_t04.dart
new file mode 100644
index 0000000..5990959
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A03_t04.dart
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+/**
+ * @assertion Members inherited in a class in an opted-in library, which are
+ * inherited via a class or mixin defined in a legacy library are viewed with
+ * their erased legacy signature, even if they were original defined in an
+ * opted-in library. Note that if a class which is defined in a legacy library
+ * inherits a member with the same name from multiple super-interfaces, then
+ * error checking is done as usual using the legacy typing rules which ignore
+ * nullability. This means that it is valid for a legacy class to inherit the
+ * same member signature with contradictory nullability information. For the
+ * purposes of member lookup within a legacy library, nullability information is
+ * ignored, and so it is valid to simply erase the nullability information
+ * within the legacy library. When referenced from an opted-in library, the same
+ * erasure is performed, and the member is seen at its legacy type.
+ *
+ * We use legacy subtyping when checking inherited member signature coherence in
+ * classes because opted out libraries may bring together otherwise incompatible
+ * member signatures without causing an error.
+ *
+ * @description Check that legacy class can inherit the same field from two
+ * opted in classes with contradictory nullability information.
+ *
+ * Issue 40414
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+// Requirements=nnbd-strong
+
+import "../../Utils/expect.dart";
+import "override_checking_A03_opted_out_lib.dart";
+
+class A extends LEGACY_FIELDS_2 {
+ int? i;
+ Object? o;
+ Function? f;
+}
+
+main() {
+ A a = A();
+ Expect.isNull(a.i);
+ Expect.isNull(a.o);
+ Expect.isNull(a.f);
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A03_t05.dart b/LanguageFeatures/nnbd/override_checking_A03_t05.dart
new file mode 100644
index 0000000..1575f86
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A03_t05.dart
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+/**
+ * @assertion Members inherited in a class in an opted-in library, which are
+ * inherited via a class or mixin defined in a legacy library are viewed with
+ * their erased legacy signature, even if they were original defined in an
+ * opted-in library. Note that if a class which is defined in a legacy library
+ * inherits a member with the same name from multiple super-interfaces, then
+ * error checking is done as usual using the legacy typing rules which ignore
+ * nullability. This means that it is valid for a legacy class to inherit the
+ * same member signature with contradictory nullability information. For the
+ * purposes of member lookup within a legacy library, nullability information is
+ * ignored, and so it is valid to simply erase the nullability information
+ * within the legacy library. When referenced from an opted-in library, the same
+ * erasure is performed, and the member is seen at its legacy type.
+ *
+ * We use legacy subtyping when checking inherited member signature coherence in
+ * classes because opted out libraries may bring together otherwise incompatible
+ * member signatures without causing an error.
+ *
+ * @description Check that legacy class can inherit the same getter from two
+ * opted in classes with contradictory nullability information.
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+// Requirements=nnbd-strong
+
+import "../../Utils/expect.dart";
+import "override_checking_A03_opted_out_lib.dart";
+import "override_checking_A03_opted_in_lib.dart";
+
+main() {
+ LEGACY_GETTER_1 x1 = LEGACY_GETTER_1();
+ Expect.isNull(x1.getInt);
+ Expect.isNull(x1.getObject);
+ Expect.isNull(x1.getFunction);
+
+ LEGACY_GETTER_2 x2 = LEGACY_GETTER_2();
+ Expect.equals(1, x2.getInt);
+ Expect.equals(1, x2.getObject);
+ Expect.equals(testme, x2.getFunction);
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A03_t06.dart b/LanguageFeatures/nnbd/override_checking_A03_t06.dart
new file mode 100644
index 0000000..e895444
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A03_t06.dart
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+/**
+ * @assertion Members inherited in a class in an opted-in library, which are
+ * inherited via a class or mixin defined in a legacy library are viewed with
+ * their erased legacy signature, even if they were original defined in an
+ * opted-in library. Note that if a class which is defined in a legacy library
+ * inherits a member with the same name from multiple super-interfaces, then
+ * error checking is done as usual using the legacy typing rules which ignore
+ * nullability. This means that it is valid for a legacy class to inherit the
+ * same member signature with contradictory nullability information. For the
+ * purposes of member lookup within a legacy library, nullability information is
+ * ignored, and so it is valid to simply erase the nullability information
+ * within the legacy library. When referenced from an opted-in library, the same
+ * erasure is performed, and the member is seen at its legacy type.
+ *
+ * We use legacy subtyping when checking inherited member signature coherence in
+ * classes because opted out libraries may bring together otherwise incompatible
+ * member signatures without causing an error.
+ *
+ * @description Check that legacy class can inherit the same getter from two
+ * opted in classes with contradictory nullability information.
+ *
+ * @Issue 40414
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+
+import "../../Utils/expect.dart";
+import "override_checking_A03_opted_out_lib.dart";
+
+class A extends LEGACY_GETTER_2 {
+ int? get getInt => null;
+ Object? get getObject => null;
+ Function? get getFunction => null;
+}
+
+main() {
+ A a = A();
+ Expect.isNull(a.getInt);
+ Expect.isNull(a.getObject);
+ Expect.isNull(a.getFunction);
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A03_t07.dart b/LanguageFeatures/nnbd/override_checking_A03_t07.dart
new file mode 100644
index 0000000..93fc723
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A03_t07.dart
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+/**
+ * @assertion Members inherited in a class in an opted-in library, which are
+ * inherited via a class or mixin defined in a legacy library are viewed with
+ * their erased legacy signature, even if they were original defined in an
+ * opted-in library. Note that if a class which is defined in a legacy library
+ * inherits a member with the same name from multiple super-interfaces, then
+ * error checking is done as usual using the legacy typing rules which ignore
+ * nullability. This means that it is valid for a legacy class to inherit the
+ * same member signature with contradictory nullability information. For the
+ * purposes of member lookup within a legacy library, nullability information is
+ * ignored, and so it is valid to simply erase the nullability information
+ * within the legacy library. When referenced from an opted-in library, the same
+ * erasure is performed, and the member is seen at its legacy type.
+ *
+ * We use legacy subtyping when checking inherited member signature coherence in
+ * classes because opted out libraries may bring together otherwise incompatible
+ * member signatures without causing an error.
+ *
+ * @description Check that legacy class can inherit the same setter from two
+ * opted in classes with contradictory nullability information.
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+// Requirements=nnbd-strong
+
+import "override_checking_A03_opted_out_lib.dart";
+
+main() {
+ LEGACY_SETTER_1 x1 = LEGACY_SETTER_1();
+ x1.setInt = null;
+ x1.setObject = null;
+ x1.setFunction = null;
+
+ LEGACY_SETTER_2 x2 = LEGACY_SETTER_2();
+ x2.setInt = null;
+ x2.setObject = null;
+ x2.setFunction = null;
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A03_t08.dart b/LanguageFeatures/nnbd/override_checking_A03_t08.dart
new file mode 100644
index 0000000..4de776d
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A03_t08.dart
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+/**
+ * @assertion Members inherited in a class in an opted-in library, which are
+ * inherited via a class or mixin defined in a legacy library are viewed with
+ * their erased legacy signature, even if they were original defined in an
+ * opted-in library. Note that if a class which is defined in a legacy library
+ * inherits a member with the same name from multiple super-interfaces, then
+ * error checking is done as usual using the legacy typing rules which ignore
+ * nullability. This means that it is valid for a legacy class to inherit the
+ * same member signature with contradictory nullability information. For the
+ * purposes of member lookup within a legacy library, nullability information is
+ * ignored, and so it is valid to simply erase the nullability information
+ * within the legacy library. When referenced from an opted-in library, the same
+ * erasure is performed, and the member is seen at its legacy type.
+ *
+ * We use legacy subtyping when checking inherited member signature coherence in
+ * classes because opted out libraries may bring together otherwise incompatible
+ * member signatures without causing an error.
+ *
+ * @description Check that legacy class can inherit the same setter from two
+ * opted in classes with contradictory nullability information.
+ *
+ * Issue 40414
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+// Requirements=nnbd-strong
+
+import "../../Utils/expect.dart";
+import "override_checking_A03_opted_out_lib.dart";
+
+class A extends LEGACY_SETTER_2 {
+ void set setInt (int? i) { Expect.isNull(i); }
+ void set setObject (Object? o) { Expect.isNull(o); }
+ void set setFunction(Function? f) { Expect.isNull(f); }
+}
+
+main() {
+ A a = A();
+ a.setInt = null;
+ a.setObject = null;
+ a.setFunction = null;
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A03_t09.dart b/LanguageFeatures/nnbd/override_checking_A03_t09.dart
new file mode 100644
index 0000000..4b23e86
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A03_t09.dart
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+/**
+ * @assertion Members inherited in a class in an opted-in library, which are
+ * inherited via a class or mixin defined in a legacy library are viewed with
+ * their erased legacy signature, even if they were original defined in an
+ * opted-in library. Note that if a class which is defined in a legacy library
+ * inherits a member with the same name from multiple super-interfaces, then
+ * error checking is done as usual using the legacy typing rules which ignore
+ * nullability. This means that it is valid for a legacy class to inherit the
+ * same member signature with contradictory nullability information. For the
+ * purposes of member lookup within a legacy library, nullability information is
+ * ignored, and so it is valid to simply erase the nullability information
+ * within the legacy library. When referenced from an opted-in library, the same
+ * erasure is performed, and the member is seen at its legacy type.
+ *
+ * We use legacy subtyping when checking inherited member signature coherence in
+ * classes because opted out libraries may bring together otherwise incompatible
+ * member signatures without causing an error.
+ *
+ * @description Check that legacy class can inherit the same method with return
+ * value from two opted in classes with contradictory nullability information.
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+// Requirements=nnbd-strong
+
+import "../../Utils/expect.dart";
+import "override_checking_A03_opted_out_lib.dart";
+import "override_checking_A03_opted_in_lib.dart";
+
+main() {
+ LEGACY_RETURN_1 x1 = LEGACY_RETURN_1();
+ Expect.isNull(x1.getInt());
+ Expect.isNull(x1.getObject());
+ Expect.isNull(x1.getFunction());
+
+ LEGACY_RETURN_2 x2 = LEGACY_RETURN_2();
+ Expect.equals(1, x2.getInt());
+ Expect.equals(1, x2.getObject());
+ Expect.equals(testme, x2.getFunction());
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A03_t10.dart b/LanguageFeatures/nnbd/override_checking_A03_t10.dart
new file mode 100644
index 0000000..9084810
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A03_t10.dart
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+/**
+ * @assertion Members inherited in a class in an opted-in library, which are
+ * inherited via a class or mixin defined in a legacy library are viewed with
+ * their erased legacy signature, even if they were original defined in an
+ * opted-in library. Note that if a class which is defined in a legacy library
+ * inherits a member with the same name from multiple super-interfaces, then
+ * error checking is done as usual using the legacy typing rules which ignore
+ * nullability. This means that it is valid for a legacy class to inherit the
+ * same member signature with contradictory nullability information. For the
+ * purposes of member lookup within a legacy library, nullability information is
+ * ignored, and so it is valid to simply erase the nullability information
+ * within the legacy library. When referenced from an opted-in library, the same
+ * erasure is performed, and the member is seen at its legacy type.
+ *
+ * We use legacy subtyping when checking inherited member signature coherence in
+ * classes because opted out libraries may bring together otherwise incompatible
+ * member signatures without causing an error.
+ *
+ * @description Check that legacy class can inherit the same method with return
+ * value from two opted in classes with contradictory nullability information.
+ *
+ * @Issue 40414
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+// Requirements=nnbd-strong
+
+import "../../Utils/expect.dart";
+import "override_checking_A03_opted_out_lib.dart";
+
+class A extends LEGACY_RETURN_2 {
+ int? getInt() => null;
+ Object? getObject() => null;
+ Function? getFunction() => null;
+}
+
+main() {
+ A a = A();
+ Expect.isNull(a.getInt());
+ Expect.isNull(a.getObject());
+ Expect.isNull(a.getFunction());
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A03_t11.dart b/LanguageFeatures/nnbd/override_checking_A03_t11.dart
new file mode 100644
index 0000000..5564836
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A03_t11.dart
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+/**
+ * @assertion Members inherited in a class in an opted-in library, which are
+ * inherited via a class or mixin defined in a legacy library are viewed with
+ * their erased legacy signature, even if they were original defined in an
+ * opted-in library. Note that if a class which is defined in a legacy library
+ * inherits a member with the same name from multiple super-interfaces, then
+ * error checking is done as usual using the legacy typing rules which ignore
+ * nullability. This means that it is valid for a legacy class to inherit the
+ * same member signature with contradictory nullability information. For the
+ * purposes of member lookup within a legacy library, nullability information is
+ * ignored, and so it is valid to simply erase the nullability information
+ * within the legacy library. When referenced from an opted-in library, the same
+ * erasure is performed, and the member is seen at its legacy type.
+ *
+ * We use legacy subtyping when checking inherited member signature coherence in
+ * classes because opted out libraries may bring together otherwise incompatible
+ * member signatures without causing an error.
+ *
+ * @description Check that generic legacy class can inherit two opted in classes
+ * with type parameters with contradictory nullability information.
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+// Requirements=nnbd-strong
+
+import "override_checking_A03_opted_out_lib.dart";
+
+main() {
+ LEGACY_INT_1();
+ LEGACY_INT_2();
+ LEGACY_INT_1<int?>();
+ LEGACY_INT_1<int>();
+ LEGACY_INT_2<int?>();
+ LEGACY_INT_2<int>();
+ LEGACY_INT_1<Null>();
+ LEGACY_INT_2<Null>();
+
+ LEGACY_OBJECT_1();
+ LEGACY_OBJECT_2();
+ LEGACY_OBJECT_1<Object?>();
+ LEGACY_OBJECT_1<Object>();
+ LEGACY_OBJECT_2<Object?>();
+ LEGACY_OBJECT_2<Object>();
+ LEGACY_OBJECT_1<Null>();
+ LEGACY_OBJECT_2<Null>();
+
+ LEGACY_FUNCTION_1();
+ LEGACY_FUNCTION_2();
+ LEGACY_FUNCTION_1<Function?>();
+ LEGACY_FUNCTION_1<Function>();
+ LEGACY_FUNCTION_2<Function?>();
+ LEGACY_FUNCTION_2<Function>();
+ LEGACY_FUNCTION_1<Null>();
+ LEGACY_FUNCTION_2<Null>();
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A03_t12.dart b/LanguageFeatures/nnbd/override_checking_A03_t12.dart
new file mode 100644
index 0000000..b71341e
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A03_t12.dart
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+/**
+ * @assertion Members inherited in a class in an opted-in library, which are
+ * inherited via a class or mixin defined in a legacy library are viewed with
+ * their erased legacy signature, even if they were original defined in an
+ * opted-in library. Note that if a class which is defined in a legacy library
+ * inherits a member with the same name from multiple super-interfaces, then
+ * error checking is done as usual using the legacy typing rules which ignore
+ * nullability. This means that it is valid for a legacy class to inherit the
+ * same member signature with contradictory nullability information. For the
+ * purposes of member lookup within a legacy library, nullability information is
+ * ignored, and so it is valid to simply erase the nullability information
+ * within the legacy library. When referenced from an opted-in library, the same
+ * erasure is performed, and the member is seen at its legacy type.
+ *
+ * We use legacy subtyping when checking inherited member signature coherence in
+ * classes because opted out libraries may bring together otherwise incompatible
+ * member signatures without causing an error.
+ *
+ * @description Check that generic legacy class can inherit two opted in classes
+ * with type parameters with contradictory nullability information.
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+// Requirements=nnbd-strong
+
+import "override_checking_A03_opted_out_lib.dart";
+
+class I1<T extends int?> extends LEGACY_INT_2<T> {}
+class I2<T extends int> extends LEGACY_INT_2<T> {}
+class I3<T extends Null> extends LEGACY_INT_2<T> {}
+
+class O1<T extends Object?> extends LEGACY_OBJECT_2<T> {}
+class O2<T extends Object > extends LEGACY_OBJECT_2<T> {}
+class O3<T extends Null > extends LEGACY_OBJECT_2<T> {}
+
+class F1<T extends Function?> extends LEGACY_FUNCTION_2<T> {}
+class F2<T extends Function > extends LEGACY_FUNCTION_2<T> {}
+class F3<T extends Null > extends LEGACY_FUNCTION_2<T> {}
+
+main() {
+ I1();
+ I2();
+ I3();
+
+ I1<int>();
+ I1<int?>();
+ I1<Null>();
+ I2<int>();
+ I3<Null>();
+
+ O1();
+ O2();
+ O3();
+
+ O1<Object>();
+ O1<Object?>();
+ O1<Null>();
+ O2<Object>();
+ O3<Null>();
+
+ F1();
+ F2();
+ F3();
+
+ F1<Function>();
+ F1<Function?>();
+ F1<Null>();
+
+ F2<Function>();
+ F3<Null>();
+}