Fixed Issue #465: tests for overriding with NNBD re-named and corrected. New tests added.
diff --git a/LanguageFeatures/nnbd/override_checking_A02_NEVER_ARGS_t01.dart b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t21.dart
similarity index 100%
rename from LanguageFeatures/nnbd/override_checking_A02_NEVER_ARGS_t01.dart
rename to LanguageFeatures/nnbd/override_checking_A02_ARGS_t21.dart
diff --git a/LanguageFeatures/nnbd/override_checking_A02_NEVER_ARGS_t02.dart b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t22.dart
similarity index 100%
rename from LanguageFeatures/nnbd/override_checking_A02_NEVER_ARGS_t02.dart
rename to LanguageFeatures/nnbd/override_checking_A02_ARGS_t22.dart
diff --git a/LanguageFeatures/nnbd/override_checking_A02_NEVER_ARGS_t03.dart b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t23.dart
similarity index 100%
rename from LanguageFeatures/nnbd/override_checking_A02_NEVER_ARGS_t03.dart
rename to LanguageFeatures/nnbd/override_checking_A02_ARGS_t23.dart
diff --git a/LanguageFeatures/nnbd/override_checking_A02_NEVER_ARGS_t04.dart b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t24.dart
similarity index 100%
rename from LanguageFeatures/nnbd/override_checking_A02_NEVER_ARGS_t04.dart
rename to LanguageFeatures/nnbd/override_checking_A02_ARGS_t24.dart
diff --git a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t01.dart b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t01.dart
new file mode 100644
index 0000000..96b0119
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t01.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 In a migrated library, override checking must check that an
+ * override is consistent with all overridden methods from other migrated
+ * libraries in the super-interface chain, since a legacy library is permitted
+ * to override otherwise incompatible signatures for a method.
+ *
+ * @description Check that if opted-in class extends legacy class, child
+ * opted-in method can return non-null value of the nullable type.
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+
+import "dart:async";
+import "../../Utils/expect.dart";
+import "override_checking_legacy_lib.dart";
+
+void testme() {}
+
+class A extends LEGACY_RETURN {
+ int? getInt() => 1;
+ Object? getObject() => 1;
+ dynamic? getDynamic() => 1;
+ Function? getFunction() => testme;
+ Null? getNull() => null;
+ FutureOr? getFutureOr() => 1;
+ FutureOr<int>? getFutureOrInt() => 1;
+ FutureOr<Function>? getFutureOrFunction() => testme;
+}
+
+main() {
+ A a = A();
+ Expect.equals(1, a.getInt());
+ Expect.equals(1, a.getObject());
+ Expect.equals(1, a.getDynamic());
+ Expect.equals(testme, a.getFunction());
+ Expect.isNull(a.getNull());
+ Expect.equals(1, a.getFutureOr());
+ Expect.equals(1, a.getFutureOrInt());
+ Expect.equals(testme, a.getFutureOrFunction());
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t02.dart b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t02.dart
new file mode 100644
index 0000000..5b88630
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t02.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 In a migrated library, override checking must check that an
+ * override is consistent with all overridden methods from other migrated
+ * libraries in the super-interface chain, since a legacy library is permitted
+ * to override otherwise incompatible signatures for a method.
+ *
+ * @description Check that if opted-in class extends legacy class, child
+ * opted-in method can return [null].
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+
+import "dart:async";
+import "../../Utils/expect.dart";
+import "override_checking_legacy_lib.dart";
+
+class A extends LEGACY_RETURN {
+ int? getInt() => null;
+ Object? getObject() => null;
+ dynamic getDynamic() => null;
+ Function? getFunction() => null;
+ Null getNull() => null;
+ FutureOr getFutureOr() => null;
+ FutureOr<int>? getFutureOrInt() => null;
+ FutureOr<Function>? getFutureOrFunction() => null;
+}
+
+main() {
+ A a = A();
+
+ Expect.isNull(a.getInt());
+ Expect.isNull(a.getObject());
+ Expect.isNull(a.getDynamic());
+ Expect.isNull(a.getFunction());
+ Expect.isNull(a.getNull());
+ Expect.isNull(a.getFutureOr());
+ Expect.isNull(a.getFutureOrInt());
+ Expect.isNull(a.getFutureOrFunction());
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_t13.dart b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t03.dart
similarity index 64%
rename from LanguageFeatures/nnbd/override_checking_A02_t13.dart
rename to LanguageFeatures/nnbd/override_checking_A02_RETURN_t03.dart
index dba02f2..558a969 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_t13.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t03.dart
@@ -16,13 +16,25 @@
*/
// SharedOptions=--enable-experiment=non-nullable
-import "override_checking_legacy_lib.dart";
+import "dart:async";
import "../../Utils/expect.dart";
+import "override_checking_legacy_lib.dart";
-class A1 extends A {
- int test_return_nullable() => 2;
+void testme() {}
+
+class A extends LEGACY_RETURN {
+ int getInt() => 1;
+ Object getObject() => 1;
+ Function getFunction() => testme;
+ FutureOr<int> getFutureOrInt() => 1;
+ FutureOr<Function> getFutureOrFunction() => testme;
}
main() {
- Expect.equals(2, A1().test_return_nullable());
+ A a = A();
+ Expect.equals(1, a.getInt());
+ Expect.equals(1, a.getObject());
+ Expect.equals(testme, a.getFunction());
+ Expect.equals(1, a.getFutureOrInt());
+ Expect.equals(testme, a.getFutureOrFunction());
}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t04.dart b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t04.dart
new file mode 100644
index 0000000..b80f17a
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t04.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 In a migrated library, override checking must check that an
+ * override is consistent with all overridden methods from other migrated
+ * libraries in the super-interface chain, since a legacy library is permitted
+ * to override otherwise incompatible signatures for a method.
+ *
+ * @description Check that if opted-in class implements legacy class, child
+ * opted-in method can return non-null value of nullable type.
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+
+import "dart:async";
+import "../../Utils/expect.dart";
+import "override_checking_legacy_lib.dart";
+
+void testme() {}
+
+class A implements LEGACY_RETURN {
+ int? getInt() => 1;
+ Object? getObject() => 1;
+ dynamic? getDynamic() => 1;
+ Function? getFunction() => testme;
+ Null? getNull() => null;
+ FutureOr? getFutureOr() => 1;
+ FutureOr<int>? getFutureOrInt() => 1;
+ FutureOr<Function>? getFutureOrFunction() => testme;
+}
+
+main() {
+ A a = A();
+ Expect.equals(1, a.getInt());
+ Expect.equals(1, a.getObject());
+ Expect.equals(1, a.getDynamic());
+ Expect.equals(testme, a.getFunction());
+ Expect.isNull(a.getNull());
+ Expect.equals(1, a.getFutureOr());
+ Expect.equals(1, a.getFutureOrInt());
+ Expect.equals(testme, a.getFutureOrFunction());
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t05.dart b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t05.dart
new file mode 100644
index 0000000..90ed933
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t05.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 In a migrated library, override checking must check that an
+ * override is consistent with all overridden methods from other migrated
+ * libraries in the super-interface chain, since a legacy library is permitted
+ * to override otherwise incompatible signatures for a method.
+ *
+ * @description Check that if opted-in class implements legacy class, child
+ * opted-in method can return [null].
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+
+import "dart:async";
+import "../../Utils/expect.dart";
+import "override_checking_legacy_lib.dart";
+
+class A implements LEGACY_RETURN {
+ int? getInt() => null;
+ Object? getObject() => null;
+ dynamic getDynamic() => null;
+ Function? getFunction() => null;
+ Null getNull() => null;
+ FutureOr getFutureOr() => null;
+ FutureOr<int>? getFutureOrInt() => null;
+ FutureOr<Function>? getFutureOrFunction() => null;
+}
+
+main() {
+ A a = A();
+
+ Expect.isNull(a.getInt());
+ Expect.isNull(a.getObject());
+ Expect.isNull(a.getDynamic());
+ Expect.isNull(a.getFunction());
+ Expect.isNull(a.getNull());
+ Expect.isNull(a.getFutureOr());
+ Expect.isNull(a.getFutureOrInt());
+ Expect.isNull(a.getFutureOrFunction());
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t06.dart b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t06.dart
new file mode 100644
index 0000000..0129bb3
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t06.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 In a migrated library, override checking must check that an
+ * override is consistent with all overridden methods from other migrated
+ * libraries in the super-interface chain, since a legacy library is permitted
+ * to override otherwise incompatible signatures for a method.
+ *
+ * @description Check that if opted-in class implements legacy class, return
+ * value type of the child opted-in method can be non-nullable.
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+
+import "dart:async";
+import "../../Utils/expect.dart";
+import "override_checking_legacy_lib.dart";
+
+void testme() {}
+
+class A implements LEGACY_RETURN {
+ int getInt() => 1;
+ Object getObject() => 1;
+ Function getFunction() => testme;
+ FutureOr<int> getFutureOrInt() => 1;
+ FutureOr<Function> getFutureOrFunction() => testme;
+
+ dynamic getDynamic() => 1;
+ Null getNull() => null;
+ FutureOr getFutureOr() => 1;
+}
+
+main() {
+ A a = A();
+ Expect.equals(1, a.getInt());
+ Expect.equals(1, a.getObject());
+ Expect.equals(testme, a.getFunction());
+ Expect.equals(1, a.getFutureOrInt());
+ Expect.equals(testme, a.getFutureOrFunction());
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t07.dart b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t07.dart
new file mode 100644
index 0000000..81e3e75
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t07.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 In a migrated library, override checking must check that an
+ * override is consistent with all overridden methods from other migrated
+ * libraries in the super-interface chain, since a legacy library is permitted
+ * to override otherwise incompatible signatures for a method.
+ *
+ * @description Check that if opted-in class is a mixin with legacy class, child
+ * opted-in method can return non-null value of the nullable type.
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+
+import "dart:async";
+import "../../Utils/expect.dart";
+import "override_checking_legacy_lib.dart";
+
+void testme() {}
+
+class A with LEGACY_RETURN {
+ int? getInt() => 1;
+ Object? getObject() => 1;
+ dynamic? getDynamic() => 1;
+ Function? getFunction() => testme;
+ Null? getNull() => null;
+ FutureOr? getFutureOr() => 1;
+ FutureOr<int>? getFutureOrInt() => 1;
+ FutureOr<Function>? getFutureOrFunction() => testme;
+}
+
+main() {
+ A a = A();
+ Expect.equals(1, a.getInt());
+ Expect.equals(1, a.getObject());
+ Expect.equals(1, a.getDynamic());
+ Expect.equals(testme, a.getFunction());
+ Expect.isNull(a.getNull());
+ Expect.equals(1, a.getFutureOr());
+ Expect.equals(1, a.getFutureOrInt());
+ Expect.equals(testme, a.getFutureOrFunction());
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t08.dart b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t08.dart
new file mode 100644
index 0000000..00d4a16
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t08.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 In a migrated library, override checking must check that an
+ * override is consistent with all overridden methods from other migrated
+ * libraries in the super-interface chain, since a legacy library is permitted
+ * to override otherwise incompatible signatures for a method.
+ *
+ * @description Check that if opted-in class is a mixin with legacy class, child
+ * opted-in method can return [null].
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+
+import "dart:async";
+import "../../Utils/expect.dart";
+import "override_checking_legacy_lib.dart";
+
+class A with LEGACY_RETURN {
+ int? getInt() => null;
+ Object? getObject() => null;
+ dynamic getDynamic() => null;
+ Function? getFunction() => null;
+ Null getNull() => null;
+ FutureOr getFutureOr() => null;
+ FutureOr<int>? getFutureOrInt() => null;
+ FutureOr<Function>? getFutureOrFunction() => null;
+}
+
+main() {
+ A a = A();
+
+ Expect.isNull(a.getInt());
+ Expect.isNull(a.getObject());
+ Expect.isNull(a.getDynamic());
+ Expect.isNull(a.getFunction());
+ Expect.isNull(a.getNull());
+ Expect.isNull(a.getFutureOr());
+ Expect.isNull(a.getFutureOrInt());
+ Expect.isNull(a.getFutureOrFunction());
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_t47.dart b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t09.dart
similarity index 60%
rename from LanguageFeatures/nnbd/override_checking_A02_t47.dart
rename to LanguageFeatures/nnbd/override_checking_A02_RETURN_t09.dart
index f8f086e..6eb52d1 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_t47.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t09.dart
@@ -10,19 +10,31 @@
* to override otherwise incompatible signatures for a method.
*
* @description Check that if opted-in class is a mixin with legacy class, child
- * opted-in method can return non-nullable value.
+ * opted-in method return value can jave non-nullable type.
*
* @author iarkh@unipro.ru
*/
// SharedOptions=--enable-experiment=non-nullable
+import "dart:async";
import "../../Utils/expect.dart";
import "override_checking_legacy_lib.dart";
-class A1 with A {
- int test_return_nullable() => 2;
+void testme() {}
+
+class A with LEGACY_RETURN {
+ int getInt() => 1;
+ Object getObject() => 1;
+ Function getFunction() => testme;
+ FutureOr<int> getFutureOrInt() => 1;
+ FutureOr<Function> getFutureOrFunction() => testme;
}
main() {
- Expect.equals(2, A1().test_return_nullable());
+ A a = A();
+ Expect.equals(1, a.getInt());
+ Expect.equals(1, a.getObject());
+ Expect.equals(testme, a.getFunction());
+ Expect.equals(1, a.getFutureOrInt());
+ Expect.equals(testme, a.getFutureOrFunction());
}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t10.dart b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t10.dart
new file mode 100644
index 0000000..988d8b5
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t10.dart
@@ -0,0 +1,57 @@
+/*
+ * 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 In a migrated library, override checking must check that an
+ * override is consistent with all overridden methods from other migrated
+ * libraries in the super-interface chain, since a legacy library is permitted
+ * to override otherwise incompatible signatures for a method.
+ *
+ * @description Check that if opted-in class implements two classes (one is
+ * legacy), child opted-in method can return non-null value of the nullable type.
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+
+import "dart:async";
+import "../../Utils/expect.dart";
+import "override_checking_legacy_lib.dart";
+
+void testme() {}
+
+abstract class AA {
+ int? getInt();
+ Object? getObject();
+ dynamic? getDynamic();
+ Function? getFunction();
+ Null? getNull();
+ FutureOr? getFutureOr();
+ FutureOr<int>? getFutureOrInt();
+ FutureOr<Function>? getFutureOrFunction();
+}
+
+class A implements AA, LEGACY_RETURN {
+ int? getInt() => 1;
+ Object? getObject() => 1;
+ dynamic? getDynamic() => 1;
+ Function? getFunction() => testme;
+ Null? getNull() => null;
+ FutureOr? getFutureOr() => 1;
+ FutureOr<int>? getFutureOrInt() => 1;
+ FutureOr<Function>? getFutureOrFunction() => testme;
+}
+
+main() {
+ A a = A();
+ Expect.equals(1, a.getInt());
+ Expect.equals(1, a.getObject());
+ Expect.equals(1, a.getDynamic());
+ Expect.equals(testme, a.getFunction());
+ Expect.isNull(a.getNull());
+ Expect.equals(1, a.getFutureOr());
+ Expect.equals(1, a.getFutureOrInt());
+ Expect.equals(testme, a.getFutureOrFunction());
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t11.dart b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t11.dart
new file mode 100644
index 0000000..c2eb845
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t11.dart
@@ -0,0 +1,56 @@
+/*
+ * 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 In a migrated library, override checking must check that an
+ * override is consistent with all overridden methods from other migrated
+ * libraries in the super-interface chain, since a legacy library is permitted
+ * to override otherwise incompatible signatures for a method.
+ *
+ * @description Check that if opted-in class implements two classes (one is
+ * legacy), child opted-in method can return [null].
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+
+import "dart:async";
+import "../../Utils/expect.dart";
+import "override_checking_legacy_lib.dart";
+
+abstract class AA {
+ int? getInt();
+ Object? getObject();
+ dynamic? getDynamic();
+ Function? getFunction();
+ Null? getNull();
+ FutureOr? getFutureOr();
+ FutureOr<int>? getFutureOrInt();
+ FutureOr<Function>? getFutureOrFunction();
+}
+
+class A implements LEGACY_RETURN, AA {
+ int? getInt() => null;
+ Object? getObject() => null;
+ dynamic getDynamic() => null;
+ Function? getFunction() => null;
+ Null getNull() => null;
+ FutureOr getFutureOr() => null;
+ FutureOr<int>? getFutureOrInt() => null;
+ FutureOr<Function>? getFutureOrFunction() => null;
+}
+
+main() {
+ A a = A();
+
+ Expect.isNull(a.getInt());
+ Expect.isNull(a.getObject());
+ Expect.isNull(a.getDynamic());
+ Expect.isNull(a.getFunction());
+ Expect.isNull(a.getNull());
+ Expect.isNull(a.getFutureOr());
+ Expect.isNull(a.getFutureOrInt());
+ Expect.isNull(a.getFutureOrFunction());
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t12.dart b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t12.dart
new file mode 100644
index 0000000..cbd3862
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t12.dart
@@ -0,0 +1,52 @@
+/*
+ * 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 In a migrated library, override checking must check that an
+ * override is consistent with all overridden methods from other migrated
+ * libraries in the super-interface chain, since a legacy library is permitted
+ * to override otherwise incompatible signatures for a method.
+ *
+ * @description Check that if opted-in class implements two classes (one is
+ * legacy), child opted-in method return value can have non-nullable type.
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+
+import "dart:async";
+import "../../Utils/expect.dart";
+import "override_checking_legacy_lib.dart";
+
+void testme() {}
+
+abstract class AA {
+ int? getInt();
+ Object? getObject();
+ Function? getFunction();
+ FutureOr<int>? getFutureOrInt();
+ FutureOr<Function>? getFutureOrFunction();
+}
+
+class A implements AA, LEGACY_RETURN {
+ int getInt() => 1;
+ Object getObject() => 1;
+ Function getFunction() => testme;
+ FutureOr<int> getFutureOrInt() => 1;
+ FutureOr<Function> getFutureOrFunction() => testme;
+
+ dynamic getDynamic() => 1;
+ Null getNull() => null;
+ FutureOr getFutureOr() => 1;
+}
+
+main() {
+ A a = A();
+ Expect.equals(1, a.getInt());
+ Expect.equals(1, a.getObject());
+ Expect.equals(testme, a.getFunction());
+ Expect.equals(1, a.getFutureOrInt());
+ Expect.equals(testme, a.getFutureOrFunction());
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_t16.dart b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t13.dart
similarity index 61%
rename from LanguageFeatures/nnbd/override_checking_A02_t16.dart
rename to LanguageFeatures/nnbd/override_checking_A02_RETURN_t13.dart
index 3e75e47..74bd4cd 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_t16.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t13.dart
@@ -18,11 +18,17 @@
import "override_checking_legacy_lib.dart";
-class A1 extends A {
- Never test_return_never() => throw "It's impossible!";
+class A extends LEGACY_RETURN {
+ Never getInt() => throw "It's impossible!";
+ Never getObject() => throw "It's impossible!";
+ Never getDynamic() => throw "It's impossible!";
+ Never getFunction() => throw "It's impossible!";
+ Never getNull() => throw "It's impossible!";
+ Never getFutureOr() => throw "It's impossible!";
+ Never getFutureOrInt() => throw "It's impossible!";
+ Never getFutureOrFunction() => throw "It's impossible!";
}
main() {
- A1();
+ A();
}
-
diff --git a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t14.dart b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t14.dart
new file mode 100644
index 0000000..b44661e
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t14.dart
@@ -0,0 +1,75 @@
+/*
+ * 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 In a migrated library, override checking must check that an
+ * override is consistent with all overridden methods from other migrated
+ * libraries in the super-interface chain, since a legacy library is permitted
+ * to override otherwise incompatible signatures for a method.
+ *
+ * @description Check that if opted-in class extends legacy class, child
+ * migrated method with [Never] return value cannot be called and compile error
+ * is thrown in this case.
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+
+import "override_checking_legacy_lib.dart";
+
+class A extends LEGACY_RETURN {
+ Never getInt() => throw "It's impossible!";
+ Never getObject() => throw "It's impossible!";
+ Never getDynamic() => throw "It's impossible!";
+ Never getFunction() => throw "It's impossible!";
+ Never getNull() => throw "It's impossible!";
+ Never getFutureOr() => throw "It's impossible!";
+ Never getFutureOrInt() => throw "It's impossible!";
+ Never getFutureOrFunction() => throw "It's impossible!";
+}
+
+main() {
+ A a = A();
+
+ a.getInt();
+// ^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getObject();
+// ^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getDynamic();
+// ^^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getFunction();
+// ^^^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getNull();
+// ^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getFutureOr();
+// ^^^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getFutureOrInt();
+// ^^^^^^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getFutureOrFunction();
+// ^^^^^^^^^^^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_t33.dart b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t15.dart
similarity index 61%
rename from LanguageFeatures/nnbd/override_checking_A02_t33.dart
rename to LanguageFeatures/nnbd/override_checking_A02_RETURN_t15.dart
index 5872bd4..5d876a6 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_t33.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t15.dart
@@ -18,12 +18,17 @@
import "override_checking_legacy_lib.dart";
-class A1 implements A {
- Never test_return_never() => throw "It's impossible!";
- int? test_return_nullable() { return 1; }
+class A implements LEGACY_RETURN {
+ Never getInt() => throw "It's impossible!";
+ Never getObject() => throw "It's impossible!";
+ Never getDynamic() => throw "It's impossible!";
+ Never getFunction() => throw "It's impossible!";
+ Never getNull() => throw "It's impossible!";
+ Never getFutureOr() => throw "It's impossible!";
+ Never getFutureOrInt() => throw "It's impossible!";
+ Never getFutureOrFunction() => throw "It's impossible!";
}
main() {
- A1();
+ A();
}
-
diff --git a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t16.dart b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t16.dart
new file mode 100644
index 0000000..0343e52
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t16.dart
@@ -0,0 +1,75 @@
+/*
+ * 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 In a migrated library, override checking must check that an
+ * override is consistent with all overridden methods from other migrated
+ * libraries in the super-interface chain, since a legacy library is permitted
+ * to override otherwise incompatible signatures for a method.
+ *
+ * @description Check that if opted-in class implements legacy class, child
+ * migrated method with [Never] return value cannot be called and compile error
+ * is thrown in this case.
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+
+import "override_checking_legacy_lib.dart";
+
+class A implements LEGACY_RETURN {
+ Never getInt() => throw "It's impossible!";
+ Never getObject() => throw "It's impossible!";
+ Never getDynamic() => throw "It's impossible!";
+ Never getFunction() => throw "It's impossible!";
+ Never getNull() => throw "It's impossible!";
+ Never getFutureOr() => throw "It's impossible!";
+ Never getFutureOrInt() => throw "It's impossible!";
+ Never getFutureOrFunction() => throw "It's impossible!";
+}
+
+main() {
+ A a = A();
+
+ a.getInt();
+// ^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getObject();
+// ^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getDynamic();
+// ^^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getFunction();
+// ^^^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getNull();
+// ^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getFutureOr();
+// ^^^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getFutureOrInt();
+// ^^^^^^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getFutureOrFunction();
+// ^^^^^^^^^^^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t17.dart b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t17.dart
new file mode 100644
index 0000000..a3c1049
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t17.dart
@@ -0,0 +1,34 @@
+/*
+ * 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 In a migrated library, override checking must check that an
+ * override is consistent with all overridden methods from other migrated
+ * libraries in the super-interface chain, since a legacy library is permitted
+ * to override otherwise incompatible signatures for a method.
+ *
+ * @description Check that if opted-in class is a mixin with legacy class,
+ * migrated method with [Never] return value can override legacy method.
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+
+import "override_checking_legacy_lib.dart";
+
+class A with LEGACY_RETURN {
+ Never getInt() => throw "It's impossible!";
+ Never getObject() => throw "It's impossible!";
+ Never getDynamic() => throw "It's impossible!";
+ Never getFunction() => throw "It's impossible!";
+ Never getNull() => throw "It's impossible!";
+ Never getFutureOr() => throw "It's impossible!";
+ Never getFutureOrInt() => throw "It's impossible!";
+ Never getFutureOrFunction() => throw "It's impossible!";
+}
+
+main() {
+ A();
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t18.dart b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t18.dart
new file mode 100644
index 0000000..bf86233
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t18.dart
@@ -0,0 +1,75 @@
+/*
+ * 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 In a migrated library, override checking must check that an
+ * override is consistent with all overridden methods from other migrated
+ * libraries in the super-interface chain, since a legacy library is permitted
+ * to override otherwise incompatible signatures for a method.
+ *
+ * @description Check that if opted-in class ia a mixin with legacy class, child
+ * migrated method with [Never] return value cannot be called and compile error
+ * is thrown in this case.
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+
+import "override_checking_legacy_lib.dart";
+
+class A with LEGACY_RETURN {
+ Never getInt() => throw "It's impossible!";
+ Never getObject() => throw "It's impossible!";
+ Never getDynamic() => throw "It's impossible!";
+ Never getFunction() => throw "It's impossible!";
+ Never getNull() => throw "It's impossible!";
+ Never getFutureOr() => throw "It's impossible!";
+ Never getFutureOrInt() => throw "It's impossible!";
+ Never getFutureOrFunction() => throw "It's impossible!";
+}
+
+main() {
+ A a = A();
+
+ a.getInt();
+// ^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getObject();
+// ^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getDynamic();
+// ^^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getFunction();
+// ^^^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getNull();
+// ^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getFutureOr();
+// ^^^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getFutureOrInt();
+// ^^^^^^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getFutureOrFunction();
+// ^^^^^^^^^^^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t19.dart b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t19.dart
new file mode 100644
index 0000000..affe857
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t19.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 In a migrated library, override checking must check that an
+ * override is consistent with all overridden methods from other migrated
+ * libraries in the super-interface chain, since a legacy library is permitted
+ * to override otherwise incompatible signatures for a method.
+ *
+ * @description Check that if opted-in class implements two classes (one is
+ * legacy), migrated method with [Never] return value can override legacy method.
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+
+import "dart:async";
+import "override_checking_legacy_lib.dart";
+
+abstract class AA {
+ int? getInt();
+ Object? getObject();
+ dynamic getDynamic();
+ Function? getFunction();
+ Null getNull();
+ FutureOr getFutureOr();
+ FutureOr<int>? getFutureOrInt();
+ FutureOr<Function>? getFutureOrFunction();
+}
+
+class A implements AA, LEGACY_RETURN {
+ Never getInt() => throw "It's impossible!";
+ Never getObject() => throw "It's impossible!";
+ Never getDynamic() => throw "It's impossible!";
+ Never getFunction() => throw "It's impossible!";
+ Never getNull() => throw "It's impossible!";
+ Never getFutureOr() => throw "It's impossible!";
+ Never getFutureOrInt() => throw "It's impossible!";
+ Never getFutureOrFunction() => throw "It's impossible!";
+}
+
+main() {
+ A();
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t20.dart b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t20.dart
new file mode 100644
index 0000000..c4cf300
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t20.dart
@@ -0,0 +1,87 @@
+/*
+ * 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 In a migrated library, override checking must check that an
+ * override is consistent with all overridden methods from other migrated
+ * libraries in the super-interface chain, since a legacy library is permitted
+ * to override otherwise incompatible signatures for a method.
+ *
+ * @description Check that if opted-in class implements two classes (one is
+ * legacy), child migrated method with [Never] return value cannot be called and
+ * compile error is thrown in this case.
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+
+import "dart:async";
+import "override_checking_legacy_lib.dart";
+
+abstract class AA {
+ int? getInt();
+ Object? getObject();
+ dynamic getDynamic();
+ Function? getFunction();
+ Null getNull();
+ FutureOr getFutureOr();
+ FutureOr<int>? getFutureOrInt();
+ FutureOr<Function>? getFutureOrFunction();
+}
+
+class A implements AA, LEGACY_RETURN {
+ Never getInt() => throw "It's impossible!";
+ Never getObject() => throw "It's impossible!";
+ Never getDynamic() => throw "It's impossible!";
+ Never getFunction() => throw "It's impossible!";
+ Never getNull() => throw "It's impossible!";
+ Never getFutureOr() => throw "It's impossible!";
+ Never getFutureOrInt() => throw "It's impossible!";
+ Never getFutureOrFunction() => throw "It's impossible!";
+}
+
+main() {
+ A a = A();
+
+ a.getInt();
+// ^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getObject();
+// ^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getDynamic();
+// ^^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getFunction();
+// ^^^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getNull();
+// ^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getFutureOr();
+// ^^^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getFutureOrInt();
+// ^^^^^^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ a.getFutureOrFunction();
+// ^^^^^^^^^^^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_t12.dart b/LanguageFeatures/nnbd/override_checking_A02_t12.dart
deleted file mode 100644
index 006a8c2..0000000
--- a/LanguageFeatures/nnbd/override_checking_A02_t12.dart
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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 In a migrated library, override checking must check that an
- * override is consistent with all overridden methods from other migrated
- * libraries in the super-interface chain, since a legacy library is permitted
- * to override otherwise incompatible signatures for a method.
- *
- * @description Check that if opted-in class extends legacy class, child
- * opted-in method can return nullable value.
- *
- * @author iarkh@unipro.ru
- */
-// SharedOptions=--enable-experiment=non-nullable
-
-import "../../Utils/expect.dart";
-import "override_checking_legacy_lib.dart";
-
-class A1 extends A {
- int? test_return_nullable() => 2;
-}
-
-class A2 extends A {
- int? test_return_nullable() => null;
-}
-
-main() {
- Expect.equals(2, A1().test_return_nullable());
- Expect.isNull(A2().test_return_nullable());
-}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_t17.dart b/LanguageFeatures/nnbd/override_checking_A02_t17.dart
deleted file mode 100644
index 3162563..0000000
--- a/LanguageFeatures/nnbd/override_checking_A02_t17.dart
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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 In a migrated library, override checking must check that an
- * override is consistent with all overridden methods from other migrated
- * libraries in the super-interface chain, since a legacy library is permitted
- * to override otherwise incompatible signatures for a method.
- *
- * @description Check that if opted-in class extends legacy class, child
- * migrated method with [Never] return value cannot be called and compile error
- * is thrown in this case.
- *
- * @author iarkh@unipro.ru
- */
-// SharedOptions=--enable-experiment=non-nullable
-
-import "override_checking_legacy_lib.dart";
-
-class A1 extends A {
- Never test_return_never() => throw "It's impossible!";
-}
-
-main() {
- A1 a = A1();
- a.test_return_never();
-// ^^^^^^^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
-}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_t29.dart b/LanguageFeatures/nnbd/override_checking_A02_t29.dart
deleted file mode 100644
index 23a35d6..0000000
--- a/LanguageFeatures/nnbd/override_checking_A02_t29.dart
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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 In a migrated library, override checking must check that an
- * override is consistent with all overridden methods from other migrated
- * libraries in the super-interface chain, since a legacy library is permitted
- * to override otherwise incompatible signatures for a method.
- *
- * @description Check that if opted-in class implements legacy class, child
- * opted-in method can return nullable value.
- *
- * @author iarkh@unipro.ru
- */
-// SharedOptions=--enable-experiment=non-nullable
-
-import "../../Utils/expect.dart";
-import "override_checking_legacy_lib.dart";
-
-class A1 implements A {
- int? test_return_nullable() => 2;
- Null test_return_never() => null;
-}
-
-class A2 implements A {
- int? test_return_nullable() => null;
- Null test_return_never() => null;
-}
-
-main() {
- Expect.equals(2, A1().test_return_nullable());
- Expect.isNull(A2().test_return_nullable());
-}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_t30.dart b/LanguageFeatures/nnbd/override_checking_A02_t30.dart
deleted file mode 100644
index 412dc4f..0000000
--- a/LanguageFeatures/nnbd/override_checking_A02_t30.dart
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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 In a migrated library, override checking must check that an
- * override is consistent with all overridden methods from other migrated
- * libraries in the super-interface chain, since a legacy library is permitted
- * to override otherwise incompatible signatures for a method.
- *
- * @description Check that if opted-in class implements legacy class, child
- * opted-in method can return non-nullable value.
- *
- * @author iarkh@unipro.ru
- */
-// SharedOptions=--enable-experiment=non-nullable
-
-import "override_checking_legacy_lib.dart";
-import "../../Utils/expect.dart";
-
-class A1 implements A {
- int test_return_nullable() => 2;
- Null test_return_never() => null;
-}
-
-main() {
- Expect.equals(2, A1().test_return_nullable());
-}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_t34.dart b/LanguageFeatures/nnbd/override_checking_A02_t34.dart
deleted file mode 100644
index 84c6cf6..0000000
--- a/LanguageFeatures/nnbd/override_checking_A02_t34.dart
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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 In a migrated library, override checking must check that an
- * override is consistent with all overridden methods from other migrated
- * libraries in the super-interface chain, since a legacy library is permitted
- * to override otherwise incompatible signatures for a method.
- *
- * @description Check that if opted-in class implements legacy class, child
- * migrated method with [Never] return value cannot be called and compile error
- * is thrown in this case.
- *
- * @author iarkh@unipro.ru
- */
-// SharedOptions=--enable-experiment=non-nullable
-
-import "override_checking_legacy_lib.dart";
-
-class A1 implements A {
- Never test_return_never() => throw "It's impossible!";
- int? test_return_nullable() { return 1; }
-}
-
-main() {
- A1 a = A1();
- a.test_return_never();
-// ^^^^^^^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
-}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_t46.dart b/LanguageFeatures/nnbd/override_checking_A02_t46.dart
deleted file mode 100644
index 4006503..0000000
--- a/LanguageFeatures/nnbd/override_checking_A02_t46.dart
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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 In a migrated library, override checking must check that an
- * override is consistent with all overridden methods from other migrated
- * libraries in the super-interface chain, since a legacy library is permitted
- * to override otherwise incompatible signatures for a method.
- *
- * @description Check that if opted-in class is a mixin with legacy class, child
- * opted-in method can return nullable value.
- *
- * @author iarkh@unipro.ru
- */
-// SharedOptions=--enable-experiment=non-nullable
-
-import "../../Utils/expect.dart";
-import "override_checking_legacy_lib.dart";
-
-class A1 with A {
- int? test_return_nullable() => 2;
-}
-
-class A2 with A {
- int? test_return_nullable() => null;
-}
-
-main() {
- Expect.equals(2, A1().test_return_nullable());
- Expect.isNull(A2().test_return_nullable());
-}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_t50.dart b/LanguageFeatures/nnbd/override_checking_A02_t50.dart
deleted file mode 100644
index 2ffed75..0000000
--- a/LanguageFeatures/nnbd/override_checking_A02_t50.dart
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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 In a migrated library, override checking must check that an
- * override is consistent with all overridden methods from other migrated
- * libraries in the super-interface chain, since a legacy library is permitted
- * to override otherwise incompatible signatures for a method.
- *
- * @description Check that if opted-in class implements two classes (one is
- * legacy), migrated method with [Never] return value can override legacy method.
- *
- * @author iarkh@unipro.ru
- */
-// SharedOptions=--enable-experiment=non-nullable
-
-import "override_checking_legacy_lib.dart";
-
-class A1 with A {
- Never test_return_never() => throw "It's impossible!";
-}
-
-main() {
- A1();
-}
-
diff --git a/LanguageFeatures/nnbd/override_checking_A02_t51.dart b/LanguageFeatures/nnbd/override_checking_A02_t51.dart
deleted file mode 100644
index 040c390..0000000
--- a/LanguageFeatures/nnbd/override_checking_A02_t51.dart
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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 In a migrated library, override checking must check that an
- * override is consistent with all overridden methods from other migrated
- * libraries in the super-interface chain, since a legacy library is permitted
- * to override otherwise incompatible signatures for a method.
- *
- * @description Check that if opted-in class ia a mixin with legacy class, child
- * migrated method with [Never] return value cannot be called and compile error
- * is thrown in this case.
- *
- * @author iarkh@unipro.ru
- */
-// SharedOptions=--enable-experiment=non-nullable
-
-import "override_checking_legacy_lib.dart";
-
-class A1 with A {
- Never test_return_never() => throw "It's impossible!";
-}
-
-main() {
- A1 a = A1();
- a.test_return_never();
-// ^^^^^^^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
-}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_t63.dart b/LanguageFeatures/nnbd/override_checking_A02_t63.dart
deleted file mode 100644
index e470cfe..0000000
--- a/LanguageFeatures/nnbd/override_checking_A02_t63.dart
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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 In a migrated library, override checking must check that an
- * override is consistent with all overridden methods from other migrated
- * libraries in the super-interface chain, since a legacy library is permitted
- * to override otherwise incompatible signatures for a method.
- *
- * @description Check that if opted-in class implements two classes (one is
- * legacy), child opted-in method can return nullable value.
- *
- * @author iarkh@unipro.ru
- */
-// SharedOptions=--enable-experiment=non-nullable
-
-import "../../Utils/expect.dart";
-import "override_checking_legacy_lib.dart";
-
-abstract class B1 {
- int? test_return_nullable();
-}
-
-abstract class B2 {
- int test_return_nullable();
-}
-
-class A1 implements A, B1 {
- int? test_return_nullable() => null;
- Null test_return_never() => null;
-}
-
-class A2 implements A, B2 {
- int test_return_nullable() => 2;
- Null test_return_never() => null;
-}
-
-main() {
- Expect.isNull(A1().test_return_nullable());
- Expect.equals(2, A2().test_return_nullable());
-}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_t64.dart b/LanguageFeatures/nnbd/override_checking_A02_t64.dart
deleted file mode 100644
index 8dc6a5b..0000000
--- a/LanguageFeatures/nnbd/override_checking_A02_t64.dart
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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 In a migrated library, override checking must check that an
- * override is consistent with all overridden methods from other migrated
- * libraries in the super-interface chain, since a legacy library is permitted
- * to override otherwise incompatible signatures for a method.
- *
- * @description Check that if opted-in class implements two classes (one is
- * legacy), child opted-in method can return non-nullable value.
- *
- * @author iarkh@unipro.ru
- */
-// SharedOptions=--enable-experiment=non-nullable
-
-import "../../Utils/expect.dart";
-import "override_checking_legacy_lib.dart";
-
-abstract class B1 {
- int? test_return_nullable();
-}
-
-abstract class B2 {
- int test_return_nullable();
-}
-
-class A1 implements A, B1 {
- int test_return_nullable() => 1;
- Null test_return_never() => null;
-}
-
-class A2 implements A, B2 {
- int test_return_nullable() => 2;
- Null test_return_never() => null;
-}
-
-main() {
- Expect.equals(1, A1().test_return_nullable());
- Expect.equals(2, A2().test_return_nullable());
-}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_t67.dart b/LanguageFeatures/nnbd/override_checking_A02_t67.dart
deleted file mode 100644
index c375c44..0000000
--- a/LanguageFeatures/nnbd/override_checking_A02_t67.dart
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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 In a migrated library, override checking must check that an
- * override is consistent with all overridden methods from other migrated
- * libraries in the super-interface chain, since a legacy library is permitted
- * to override otherwise incompatible signatures for a method.
- *
- * @description Check that if opted-in class implements two classes (one is
- * legacy), migrated method with [Never] return value can override legacy method.
- *
- * @author iarkh@unipro.ru
- */
-// SharedOptions=--enable-experiment=non-nullable
-
-import "override_checking_legacy_lib.dart";
-
-abstract class B {
- Never test_return_never();
-}
-
-class A1 implements A {
- Never test_return_never() => throw "It's impossible!";
- int? test_return_nullable() => 1;
-}
-
-main() {
- A1();
-}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_t68.dart b/LanguageFeatures/nnbd/override_checking_A02_t68.dart
deleted file mode 100644
index a1d5909..0000000
--- a/LanguageFeatures/nnbd/override_checking_A02_t68.dart
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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 In a migrated library, override checking must check that an
- * override is consistent with all overridden methods from other migrated
- * libraries in the super-interface chain, since a legacy library is permitted
- * to override otherwise incompatible signatures for a method.
- *
- * @description Check that if opted-in class implements two classes (one is
- * legacy), child migrated method with [Never] return value cannot be called and
- * compile error is thrown in this case.
- *
- * @author iarkh@unipro.ru
- */
-// SharedOptions=--enable-experiment=non-nullable
-
-abstract class B {
- Never test_return_never();
-}
-
-class A1 implements A {
- Never test_return_never() => throw "It's impossible!";
- int? test_return_nullable() => 1;
-}
-
-main() {
- A1 a = A1();
- a.test_return_never();
-// ^^^^^^^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
-}
diff --git a/LanguageFeatures/nnbd/override_checking_legacy_lib.dart b/LanguageFeatures/nnbd/override_checking_legacy_lib.dart
index c8bf929..367521d 100644
--- a/LanguageFeatures/nnbd/override_checking_legacy_lib.dart
+++ b/LanguageFeatures/nnbd/override_checking_legacy_lib.dart
@@ -93,16 +93,47 @@
void set setFutureOrFunction(FutureOr<Function> f) { Expect.fail("This method should be overriden"); }
}
-class A {
- int test_return_nullable() {
+class LEGACY_RETURN {
+ int getInt() {
Expect.fail("This method should be overriden");
return -1;
}
- Null test_return_never() {
+ Object getObject() {
+ Expect.fail("This method should be overriden");
+ return -1;
+ }
+
+ dynamic getDynamic() {
+ Expect.fail("This method should be overriden");
+ return -1;
+ }
+
+ Function getFunction() {
+ Expect.fail("This method should be overriden");
+ return null;
+ }
+
+ Null getNull() {
+ Expect.fail("This method should be overriden");
+ return null;
+ }
+
+ FutureOr getFutureOr() {
+ Expect.fail("This method should be overriden");
+ return -1;
+ }
+
+ FutureOr<int> getFutureOrInt() {
+ Expect.fail("This method should be overriden");
+ return -1;
+ }
+
+ FutureOr<Function> getFutureOrFunction() {
Expect.fail("This method should be overriden");
return null;
}
}
+class A {}
class D<X extends A> {}