Fixed Issue #465: tests for overriding with NNBD re-named and corrected. New tests added.
diff --git a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t01.dart b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t01.dart
index de516e7..1cd28e6 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t01.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t01.dart
@@ -24,25 +24,11 @@
void test() {}
class A extends LEGACY_ARGS {
- void test_int(int? i) {
- Expect.equals(1, i);
- }
-
- void test_object(Object? i) {
- Expect.equals(1, i);
- }
-
- void test_dynamic(dynamic i) {
- Expect.equals(1, i);
- }
-
- void test_function(Function? i) {
- Expect.equals(test, i);
- }
-
- void test_futureOr(FutureOr? i) {
- Expect.equals(1, i);
- }
+ void test_int(int? i) { Expect.equals(1, i); }
+ void test_object(Object? i) { Expect.equals(1, i); }
+ void test_dynamic(dynamic i) { Expect.equals(1, i); }
+ void test_function(Function? i) { Expect.equals(test, i); }
+ void test_futureOr(FutureOr? i) { Expect.equals(1, i); }
}
main() {
diff --git a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t02.dart b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t02.dart
index 6d92b05..efdef7d 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t02.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t02.dart
@@ -22,29 +22,12 @@
import "override_checking_legacy_lib.dart";
class A extends LEGACY_ARGS {
- void test_int(int? i) {
- Expect.isNull(i);
- }
-
- void test_object(Object? i) {
- Expect.isNull(i);
- }
-
- void test_dynamic(dynamic i) {
- Expect.isNull(i);
- }
-
- void test_function(Function? i) {
- Expect.isNull(i);
- }
-
- void test_futureOr(FutureOr? i) {
- Expect.isNull(i);
- }
-
- void test_null(Null i) {
- Expect.isNull(i);
- }
+ void test_int(int? i) { Expect.isNull(i); }
+ void test_object(Object? i) { Expect.isNull(i); }
+ void test_dynamic(dynamic i) { Expect.isNull(i); }
+ void test_function(Function? i) { Expect.isNull(i); }
+ void test_futureOr(FutureOr? i) { Expect.isNull(i); }
+ void test_null(Null i) { Expect.isNull(i); }
}
main() {
diff --git a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t03.dart b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t03.dart
index 39542e7..c54cf65 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t03.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t03.dart
@@ -9,33 +9,28 @@
* libraries in the super-interface chain, since a legacy library is permitted
* to override otherwise incompatible signatures for a method.
*
- * @description Check that compiler error is thrown if opted-in class extends
- * legacy class and child migrated method with non-nullable parameter overrides
- * legacy method which parameter is nullable.
+ * @description Check that if opted-in class extends legacy class child
+ * migrated method with non-nullable parameter can override legacy method.
*
* @author iarkh@unipro.ru
*/
// SharedOptions=--enable-experiment=non-nullable
import "override_checking_legacy_lib.dart";
+import "../../Utils/expect.dart";
class A extends LEGACY_ARGS {
- void test_int(int i) {}
-// ^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
-
- void test_object(Object i) {}
-// ^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
-
- void test_function(Function i) {}
-// ^^^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
+ void test_int(int i) { Expect.equals(1, i); }
+ void test_object(Object i) { Expect.equals(1, i); }
+ void test_function(Function i) { Expect.equals(testme, i); }
}
-main() {}
+void testme() {}
+
+main() {
+ A a = A();
+
+ a.test_int(1);
+ a.test_object(1);
+ a.test_function(testme);
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t04.dart b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t04.dart
index 7840a24..cb63015 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t04.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t04.dart
@@ -21,9 +21,7 @@
import "override_checking_legacy_lib.dart";
class A extends LEGACY_ARGS {
- void test_futureOr(FutureOr i) {
- Expect.equals(1, i);
- }
+ void test_futureOr(FutureOr i) { Expect.equals(1, i); }
}
main() {
diff --git a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t05.dart b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t05.dart
index 6ba24bf..fc8c655 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t05.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t05.dart
@@ -21,9 +21,7 @@
import "override_checking_legacy_lib.dart";
class A extends LEGACY_ARGS {
- void test_futureOr(FutureOr i) {
- Expect.isNull(i);
- }
+ void test_futureOr(FutureOr i) { Expect.isNull(i); }
}
main() {
diff --git a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t06.dart b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t06.dart
index 19a95b5..0defe30 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t06.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t06.dart
@@ -24,25 +24,11 @@
void test() {}
class A implements LEGACY_ARGS {
- void test_int(int? i) {
- Expect.equals(1, i);
- }
-
- void test_object(Object? i) {
- Expect.equals(1, i);
- }
-
- void test_dynamic(dynamic i) {
- Expect.equals(1, i);
- }
-
- void test_function(Function? i) {
- Expect.equals(test, i);
- }
-
- void test_futureOr(FutureOr? i) {
- Expect.equals(1, i);
- }
+ void test_int(int? i) { Expect.equals(1, i); }
+ void test_object(Object? i) { Expect.equals(1, i); }
+ void test_dynamic(dynamic i) { Expect.equals(1, i); }
+ void test_function(Function? i) { Expect.equals(test, i); }
+ void test_futureOr(FutureOr? i) { Expect.equals(1, i); }
void test_null(Null i) {}
}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t07.dart b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t07.dart
index f2eac7a..9511c71 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t07.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t07.dart
@@ -21,29 +21,12 @@
import "override_checking_legacy_lib.dart";
class A implements LEGACY_ARGS {
- void test_int(int? i) {
- Expect.isNull(i);
- }
-
- void test_object(Object? i) {
- Expect.isNull(i);
- }
-
- void test_dynamic(dynamic i) {
- Expect.isNull(i);
- }
-
- void test_function(Function? i) {
- Expect.isNull(i);
- }
-
- void test_futureOr(FutureOr? i) {
- Expect.isNull(i);
- }
-
- void test_null(Null i) {
- Expect.isNull(i);
- }
+ void test_int(int? i) { Expect.isNull(i); }
+ void test_object(Object? i) { Expect.isNull(i); }
+ void test_dynamic(dynamic i) { Expect.isNull(i); }
+ void test_function(Function? i) { Expect.isNull(i); }
+ void test_futureOr(FutureOr? i) { Expect.isNull(i); }
+ void test_null(Null i) { Expect.isNull(i); }
}
main() {
diff --git a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t08.dart b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t08.dart
index 97b8fd9..81c278c 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t08.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t08.dart
@@ -19,26 +19,24 @@
import "dart:async";
import "override_checking_legacy_lib.dart";
+import "../../Utils/expect.dart";
class A implements LEGACY_ARGS {
- void test_int(int i) {}
-// ^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
+ void test_int(int i) { Expect.equals(1, i); }
+ void test_object(Object i) { Expect.equals(1, i); }
+ void test_function(Function i) { Expect.equals(testme, i); }
- void test_object(Object i) {}
-// ^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- void test_function(Function i) {}
-// ^^^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- void test_dynamic(dynamic i) {}
+ void test_dynamic(dynamic i) {}
void test_futureOr(FutureOr i) {}
- void test_null(Null i) {}
+ void test_null(Null i) {}
}
-main() {}
+void testme() {}
+
+main() {
+ A a = A();
+
+ a.test_int(1);
+ a.test_object(1);
+ a.test_function(testme);
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t09.dart b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t09.dart
index c306b89..cd30a9a 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t09.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t09.dart
@@ -21,15 +21,13 @@
import "override_checking_legacy_lib.dart";
class A implements LEGACY_ARGS {
- void test_futureOr(FutureOr i) {
- Expect.equals(1, i);
- }
+ void test_futureOr(FutureOr i) { Expect.equals(1, i); }
- void test_int(int? i) {}
- void test_object(Object? i) {}
- void test_dynamic(dynamic i) {}
+ void test_int(int? i) {}
+ void test_object(Object? i) {}
+ void test_dynamic(dynamic i) {}
void test_function(Function? i) {}
- void test_null(Null i) {}
+ void test_null(Null i) {}
}
main() {
diff --git a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t10.dart b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t10.dart
index 3949c82..dfe129d 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t10.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t10.dart
@@ -21,9 +21,7 @@
import "override_checking_legacy_lib.dart";
class A implements LEGACY_ARGS {
- void test_futureOr(FutureOr i) {
- Expect.isNull(i);
- }
+ void test_futureOr(FutureOr i) { Expect.isNull(i); }
void test_int(int? i) {}
void test_object(Object? i) {}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t11.dart b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t11.dart
index 7a05872..a1769e5 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t11.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t11.dart
@@ -24,25 +24,11 @@
void test() {}
class A with LEGACY_ARGS {
- void test_int(int? i) {
- Expect.equals(1, i);
- }
-
- void test_object(Object? i) {
- Expect.equals(1, i);
- }
-
- void test_dynamic(dynamic i) {
- Expect.equals(1, i);
- }
-
- void test_function(Function? i) {
- Expect.equals(test, i);
- }
-
- void test_futureOr(FutureOr? i) {
- Expect.equals(1, i);
- }
+ void test_int(int? i) { Expect.equals(1, i); }
+ void test_object(Object? i) { Expect.equals(1, i); }
+ void test_dynamic(dynamic i) { Expect.equals(1, i); }
+ void test_function(Function? i) { Expect.equals(test, i); }
+ void test_futureOr(FutureOr? i) { Expect.equals(1, i); }
}
main() {
diff --git a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t12.dart b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t12.dart
index feeefec..722cd99 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t12.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t12.dart
@@ -22,29 +22,12 @@
import "override_checking_legacy_lib.dart";
class A with LEGACY_ARGS {
- void test_int(int? i) {
- Expect.isNull(i);
- }
-
- void test_object(Object? i) {
- Expect.isNull(i);
- }
-
- void test_dynamic(dynamic i) {
- Expect.isNull(i);
- }
-
- void test_function(Function? i) {
- Expect.isNull(i);
- }
-
- void test_futureOr(FutureOr? i) {
- Expect.isNull(i);
- }
-
- void test_null(Null i) {
- Expect.isNull(i);
- }
+ void test_int(int? i) { Expect.isNull(i); }
+ void test_object(Object? i) { Expect.isNull(i); }
+ void test_dynamic(dynamic i) { Expect.isNull(i); }
+ void test_function(Function? i) { Expect.isNull(i); }
+ void test_futureOr(FutureOr? i) { Expect.isNull(i); }
+ void test_null(Null i) { Expect.isNull(i); }
}
main() {
diff --git a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t13.dart b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t13.dart
index 14a232a..3ae1496 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t13.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t13.dart
@@ -9,33 +9,28 @@
* libraries in the super-interface chain, since a legacy library is permitted
* to override otherwise incompatible signatures for a method.
*
- * @description Check that compiler error is thrown if opted-in class is a mixin
- * with legacy class and child migrated method with non-nullable parameter
- * overrides legacy method which parameter is nullable.
+ * @description Check that if opted-in class is a mixin with legacy class, child
+ * migrated method with non-nullable parameter can override legacy method.
*
* @author iarkh@unipro.ru
*/
// SharedOptions=--enable-experiment=non-nullable
import "override_checking_legacy_lib.dart";
+import "../../Utils/expect.dart";
class A with LEGACY_ARGS {
- void test_int(int i) {}
-// ^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
-
- void test_object(Object i) {}
-// ^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
-
- void test_function(Function i) {}
-// ^^^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
+ void test_int(int i) { Expect.equals(1, i); }
+ void test_object(Object i) { Expect.equals(1, i); }
+ void test_function(Function i) { Expect.equals(testme, i); }
}
-main() {}
+void testme() {}
+
+main() {
+ A a = A();
+
+ a.test_int(1);
+ a.test_object(1);
+ a.test_function(testme);
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t14.dart b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t14.dart
index b13c53e..fb5ab23 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t14.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t14.dart
@@ -21,9 +21,7 @@
import "override_checking_legacy_lib.dart";
class A with LEGACY_ARGS {
- void test_futureOr(FutureOr i) {
- Expect.equals(1, i);
- }
+ void test_futureOr(FutureOr i) { Expect.equals(1, i); }
}
main() {
diff --git a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t15.dart b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t15.dart
index 46b9309..eaa3d61 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t15.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t15.dart
@@ -21,9 +21,7 @@
import "override_checking_legacy_lib.dart";
class A with LEGACY_ARGS {
- void test_futureOr(FutureOr i) {
- Expect.isNull(i);
- }
+ void test_futureOr(FutureOr i) { Expect.isNull(i); }
}
main() {
diff --git a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t16.dart b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t16.dart
index bc5a6a2..de2c8cb 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t16.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t16.dart
@@ -33,26 +33,11 @@
}
class A implements B, LEGACY_ARGS {
- void test_int(int? i) {
- Expect.equals(1, i);
- }
-
- void test_object(Object? i) {
- Expect.equals(1, i);
- }
-
- void test_dynamic(dynamic i) {
- Expect.equals(1, i);
- }
-
- void test_function(Function? i) {
- Expect.equals(test, i);
- }
-
- void test_futureOr(FutureOr? i) {
- Expect.equals(1, i);
- }
-
+ void test_int(int? i) { Expect.equals(1, i); }
+ void test_object(Object? i) { Expect.equals(1, i); }
+ void test_dynamic(dynamic i) { Expect.equals(1, i); }
+ void test_function(Function? i) { Expect.equals(test, i); }
+ void test_futureOr(FutureOr? i) { Expect.equals(1, i); }
void test_null(Null i) {}
}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t17.dart b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t17.dart
index 48900c0..da56fb7 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t17.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t17.dart
@@ -32,29 +32,12 @@
}
class A implements B, LEGACY_ARGS {
- void test_int(int? i) {
- Expect.isNull(i);
- }
-
- void test_object(Object? i) {
- Expect.isNull(i);
- }
-
- void test_dynamic(dynamic i) {
- Expect.isNull(i);
- }
-
- void test_function(Function? i) {
- Expect.isNull(i);
- }
-
- void test_futureOr(FutureOr? i) {
- Expect.isNull(i);
- }
-
- void test_null(Null i) {
- Expect.isNull(i);
- }
+ void test_int(int? i) { Expect.isNull(i); }
+ void test_object(Object? i) { Expect.isNull(i); }
+ void test_dynamic(dynamic i) { Expect.isNull(i); }
+ void test_function(Function? i) { Expect.isNull(i); }
+ void test_futureOr(FutureOr? i) { Expect.isNull(i); }
+ void test_null(Null i) { Expect.isNull(i); }
}
main() {
@@ -65,4 +48,5 @@
a.test_dynamic(null);
a.test_function(null);
a.test_futureOr(null);
+ a.test_null(null);
}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t18.dart b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t18.dart
index b92e73e..a618aea 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t18.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t18.dart
@@ -9,15 +9,16 @@
* libraries in the super-interface chain, since a legacy library is permitted
* to override otherwise incompatible signatures for a method.
*
- * @description Check that compiler error is thrown if opted-in class implements
- * two classes with some method, the first class is legacy and given method in
- * the second class has argument of nullable type.
+ * @description Check that if opted-in class implements two classes with some
+ * method and the first class is legacy, child opted in method in the second
+ * class can have argument 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";
abstract class B {
@@ -27,26 +28,21 @@
}
class A implements B, LEGACY_ARGS {
-
- void test_int(int i) {}
-// ^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
-void test_object(Object i) {}
-// ^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- void test_function(Function i) {}
-// ^^^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
+ void test_int(int i) { Expect.equals(1, i); }
+ void test_object(Object i) { Expect.equals(1, i); }
+ void test_function(Function i) { Expect.equals(testme, i); }
void test_futureOr(FutureOr i) {}
- void test_dynamic(dynamic i) {}
- void test_null(Null i) {}
+ void test_dynamic(dynamic i) {}
+ void test_null(Null i) {}
}
-main() {}
+void testme() {}
+
+main() {
+ A a = A();
+
+ a.test_int(1);
+ a.test_object(1);
+ a.test_function(testme);
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t19.dart b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t19.dart
index 5724e27..8512a06 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t19.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t19.dart
@@ -28,15 +28,13 @@
class A implements B, LEGACY_ARGS {
- void test_futureOr(FutureOr? i) {
- Expect.equals(1, i);
- }
+ void test_futureOr(FutureOr? i) { Expect.equals(1, i); }
- void test_int(int? i) {}
- void test_object(Object? i) {}
- void test_dynamic(dynamic i) {}
+ void test_int(int? i) {}
+ void test_object(Object? i) {}
+ void test_dynamic(dynamic i) {}
void test_function(Function? i) {}
- void test_null(Null i) {}
+ void test_null(Null i) {}
}
main() {
diff --git a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t20.dart b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t20.dart
index 3ef88e7..2b234f4 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_ARGS_t20.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_ARGS_t20.dart
@@ -28,15 +28,13 @@
class A implements B, LEGACY_ARGS {
- void test_futureOr(FutureOr? i) {
- Expect.isNull(i);
- }
+ void test_futureOr(FutureOr? i) { Expect.isNull(i); }
- void test_int(int? i) {}
- void test_object(Object? i) {}
- void test_dynamic(dynamic i) {}
+ void test_int(int? i) {}
+ void test_object(Object? i) {}
+ void test_dynamic(dynamic i) {}
void test_function(Function? i) {}
- void test_null(Null i) {}
+ void test_null(Null i) {}
}
main() {
diff --git a/LanguageFeatures/nnbd/override_checking_A02_FIELD_t02.dart b/LanguageFeatures/nnbd/override_checking_A02_FIELD_t02.dart
index 317e4df..c2eab4c 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_FIELD_t02.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_FIELD_t02.dart
@@ -10,8 +10,7 @@
* to override otherwise incompatible signatures for a method.
*
* @description Check that if opted-in class extends legacy class, opted-in
- * field of non-nullable type cannot override legacy field, compile time error
- * is thrown in this case.
+ * field of non-nullable type can override legacy field.
*
* @author iarkh@unipro.ru
*/
@@ -19,92 +18,23 @@
import "dart:async";
import "override_checking_legacy_lib.dart";
-
-class A1 extends LEGACY_FIELD {
- int i;
-// ^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- Object o;
-// ^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- Function func;
-// ^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- FutureOr<int> fi;
-// ^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- FutureOr<Function> ff;
-// ^^
-// [analyzer] unspecified
-// [cfe] unspecified
-}
-
-class A2 extends LEGACY_FIELD {
- int i = null;
-// ^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- Object o = null;
-// ^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- Function func = null;
-// ^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- FutureOr<int> fi = null;
-// ^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- FutureOr<Function> ff = null;
-// ^^
-// [analyzer] unspecified
-// [cfe] unspecified
-}
+import "../../Utils/expect.dart";
void testme() {}
-class A3 extends LEGACY_FIELD {
+class A extends LEGACY_FIELD {
int i = 1;
-// ^
-// [analyzer] unspecified
-// [cfe] unspecified
-
Object o = "";
-// ^
-// [analyzer] unspecified
-// [cfe] unspecified
-
Function func = testme;
-// ^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
FutureOr<int> fi = 12345;
-// ^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
FutureOr<Function> ff = testme;
-// ^^
-// [analyzer] unspecified
-// [cfe] unspecified
}
main() {
- A1();
- A2();
- A3();
+ A a = A();
+ Expect.equals(1, a.i);
+ Expect.equals("", a.o);
+ Expect.equals(testme, a.func);
+ Expect.equals(12345, a.fi);
+ Expect.equals(testme, a.ff);
}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_FIELD_t04.dart b/LanguageFeatures/nnbd/override_checking_A02_FIELD_t04.dart
index f5e9251..8eed77c 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_FIELD_t04.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_FIELD_t04.dart
@@ -10,8 +10,7 @@
* to override otherwise incompatible signatures for a method.
*
* @description Check that if opted-in class implements legacy class, opted-in
- * field of non-nullable type cannot override legacy field, compile time error
- * is thrown in this case.
+ * field of non-nullable type can override legacy field.
*
* @author iarkh@unipro.ru
*/
@@ -19,98 +18,16 @@
import "dart:async";
import "override_checking_legacy_lib.dart";
-
-class A1 implements LEGACY_FIELD {
- int i;
-// ^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- Object o;
-// ^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- Function func;
-// ^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- FutureOr<int> fi;
-// ^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- FutureOr<Function> ff;
-// ^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- dynamic d;
- Null n;
- FutureOr f;
- void v;
-}
-
-class A2 implements LEGACY_FIELD {
- int i = null;
-// ^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- Object o = null;
-// ^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- Function func = null;
-// ^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- FutureOr<int> fi = null;
-// ^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- FutureOr<Function> ff = null;
-// ^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- dynamic d = null;
- Null n = null;
- FutureOr f = null;
- void v = null;
-}
+import "../../Utils/expect.dart";
void testme() {}
-class A3 implements LEGACY_FIELD {
+class A implements LEGACY_FIELD {
int i = 1;
-// ^
-// [analyzer] unspecified
-// [cfe] unspecified
-
Object o = "";
-// ^
-// [analyzer] unspecified
-// [cfe] unspecified
-
Function func = testme;
-// ^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
FutureOr<int> fi = 12345;
-// ^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
FutureOr<Function> ff = testme;
-// ^^
-// [analyzer] unspecified
-// [cfe] unspecified
dynamic d = 1;
Null n = null;
@@ -119,7 +36,10 @@
}
main() {
- A1();
- A2();
- A3();
+ A a = A();
+ Expect.equals(1, a.i);
+ Expect.equals("", a.o);
+ Expect.equals(testme, a.func);
+ Expect.equals(12345, a.fi);
+ Expect.equals(testme, a.ff);
}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_FIELD_t06.dart b/LanguageFeatures/nnbd/override_checking_A02_FIELD_t06.dart
index c2d9ea0..fe0b619 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_FIELD_t06.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_FIELD_t06.dart
@@ -10,8 +10,7 @@
* to override otherwise incompatible signatures for a method.
*
* @description Check that if opted-in class is a mixin with legacy class,
- * opted-in field of non-nullable type cannot override legacy field, compile
- * time error is thrown in this case.
+ * opted-in field of non-nullable type can override legacy field.
*
* @author iarkh@unipro.ru
*/
@@ -19,92 +18,23 @@
import "dart:async";
import "override_checking_legacy_lib.dart";
-
-class A1 with LEGACY_FIELD {
- int i;
-// ^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- Object o;
-// ^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- Function func;
-// ^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- FutureOr<int> fi;
-// ^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- FutureOr<Function> ff;
-// ^^
-// [analyzer] unspecified
-// [cfe] unspecified
-}
-
-class A2 with LEGACY_FIELD {
- int i = null;
-// ^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- Object o = null;
-// ^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- Function func = null;
-// ^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- FutureOr<int> fi = null;
-// ^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- FutureOr<Function> ff = null;
-// ^^
-// [analyzer] unspecified
-// [cfe] unspecified
-}
+import "../../Utils/expect.dart";
void testme() {}
-class A3 with LEGACY_FIELD {
+class A with LEGACY_FIELD {
int i = 1;
-// ^
-// [analyzer] unspecified
-// [cfe] unspecified
-
Object o = "";
-// ^
-// [analyzer] unspecified
-// [cfe] unspecified
-
Function func = testme;
-// ^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
FutureOr<int> fi = 12345;
-// ^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
FutureOr<Function> ff = testme;
-// ^^
-// [analyzer] unspecified
-// [cfe] unspecified
}
main() {
- A1();
- A2();
- A3();
+ A a = A();
+ Expect.equals(1, a.i);
+ Expect.equals("", a.o);
+ Expect.equals(testme, a.func);
+ Expect.equals(12345, a.fi);
+ Expect.equals(testme, a.ff);
}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_FIELD_t08.dart b/LanguageFeatures/nnbd/override_checking_A02_FIELD_t08.dart
index bc90403..feb82b4 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_FIELD_t08.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_FIELD_t08.dart
@@ -10,8 +10,8 @@
* to override otherwise incompatible signatures for a method.
*
* @description Check that if opted-in class implements two classes (one is
- * legacy) with some field, opted-in field of non-nullable type cannot override
- * legacy field, compile time error is thrown in this case.
+ * legacy) with some field, opted-in field of non-nullable type can override
+ * legacy field.
*
* @author iarkh@unipro.ru
*/
@@ -19,110 +19,25 @@
import "dart:async";
import "override_checking_legacy_lib.dart";
-
-abstract class AA {
- int? i;
- Object? o;
- dynamic d;
- Function? func;
- Null n;
- FutureOr? f;
- FutureOr<int>? fi;
- FutureOr<Function>? ff;
- void v;
-}
-
-class A1 implements LEGACY_FIELD, AA {
- int i;
-// ^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- Object o;
-// ^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- Function func;
-// ^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- FutureOr<int> fi;
-// ^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- FutureOr<Function> ff;
-// ^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- dynamic d;
- Null n;
- FutureOr f;
- void v;
-}
-
-class A2 implements LEGACY_FIELD, AA {
- int i = null;
-// ^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- Object o = null;
-// ^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- Function func = null;
-// ^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- FutureOr<int> fi = null;
-// ^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- FutureOr<Function> ff = null;
-// ^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- dynamic d = null;
- Null n = null;
- FutureOr f = null;
- void v = null;
-}
+import "../../Utils/expect.dart";
void testme() {}
+void testme1() {}
-class A3 implements LEGACY_FIELD, AA {
+abstract class AA {
+ int i = -1;
+ Object o = 5;
+ Function func = testme1;
+ FutureOr<int> fi = 2;
+ FutureOr<Function> ff = testme1;
+}
+
+class A implements LEGACY_FIELD, AA {
int i = 1;
-// ^
-// [analyzer] unspecified
-// [cfe] unspecified
-
Object o = "";
-// ^
-// [analyzer] unspecified
-// [cfe] unspecified
-
Function func = testme;
-// ^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
FutureOr<int> fi = 12345;
-// ^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
FutureOr<Function> ff = testme;
-// ^^
-// [analyzer] unspecified
-// [cfe] unspecified
dynamic d = 1;
Null n = null;
@@ -131,7 +46,10 @@
}
main() {
- A1();
- A2();
- A3();
+ A a = A();
+ Expect.equals(1, a.i);
+ Expect.equals("", a.o);
+ Expect.equals(testme, a.func);
+ Expect.equals(12345, a.fi);
+ Expect.equals(testme, a.ff);
}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_FIELD_t09.dart b/LanguageFeatures/nnbd/override_checking_A02_FIELD_t09.dart
new file mode 100644
index 0000000..bc057f2
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A02_FIELD_t09.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.
+ */
+/**
+ * @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, opted-in
+ * field of non-nullable type cannot be [Null] or unassigned, compile time error
+ * is thrown in this case.
+ *
+ * @Issue 39678
+ *
+ * @author iarkh@unipro.ru
+*/
+// SharedOptions=--enable-experiment=non-nullable
+
+import "dart:async";
+import "override_checking_legacy_lib.dart";
+
+class A1 extends LEGACY_FIELD {
+ int i;
+// ^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ Object o;
+// ^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ Function func;
+// ^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ FutureOr<int> fi;
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ FutureOr<Function> ff;
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+class A2 extends LEGACY_FIELD {
+ int i = null;
+// ^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ Object o = null;
+// ^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ Function func = null;
+// ^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ FutureOr<int> fi = null;
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ FutureOr<Function> ff = null;
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+main() {
+ A1();
+ A2();
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_FIELD_t10.dart b/LanguageFeatures/nnbd/override_checking_A02_FIELD_t10.dart
new file mode 100644
index 0000000..30c52a4
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A02_FIELD_t10.dart
@@ -0,0 +1,92 @@
+/*
+ * 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, opted-in
+ * field of non-nullable type cannot be [Null] or unassigned, compile time error
+ * is thrown in this case.
+ *
+ * @Issue 39678
+ *
+ * @author iarkh@unipro.ru
+*/
+// SharedOptions=--enable-experiment=non-nullable
+
+import "dart:async";
+import "override_checking_legacy_lib.dart";
+
+class A1 implements LEGACY_FIELD {
+ int i;
+// ^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ Object o;
+// ^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ Function func;
+// ^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ FutureOr<int> fi;
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ FutureOr<Function> ff;
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ dynamic d;
+ Null n;
+ FutureOr f;
+ void v;
+}
+
+class A2 implements LEGACY_FIELD {
+ int i = null;
+// ^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ Object o = null;
+// ^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ Function func = null;
+// ^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ FutureOr<int> fi = null;
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ FutureOr<Function> ff = null;
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ dynamic d = null;
+ Null n = null;
+ FutureOr f = null;
+ void v = null;
+}
+
+main() {
+ A1();
+ A2();
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_FIELD_t11.dart b/LanguageFeatures/nnbd/override_checking_A02_FIELD_t11.dart
new file mode 100644
index 0000000..4e4df05
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A02_FIELD_t11.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.
+ */
+/**
+ * @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,
+ * opted-in field of non-nullable type cannot be [Null] or unassigned, compile
+ * time error is thrown in this case.
+ *
+ * @Issue 39678
+ *
+ * @author iarkh@unipro.ru
+*/
+// SharedOptions=--enable-experiment=non-nullable
+
+import "dart:async";
+import "override_checking_legacy_lib.dart";
+
+class A1 with LEGACY_FIELD {
+ int i;
+// ^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ Object o;
+// ^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ Function func;
+// ^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ FutureOr<int> fi;
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ FutureOr<Function> ff;
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+class A2 with LEGACY_FIELD {
+ int i = null;
+// ^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ Object o = null;
+// ^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ Function func = null;
+// ^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ FutureOr<int> fi = null;
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ FutureOr<Function> ff = null;
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+main() {
+ A1();
+ A2();
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_FIELD_t12.dart b/LanguageFeatures/nnbd/override_checking_A02_FIELD_t12.dart
new file mode 100644
index 0000000..6e87e80
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A02_FIELD_t12.dart
@@ -0,0 +1,102 @@
+/*
+ * 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) with some field, opted-in field of non-nullable type cannot override
+ * legacy field, compile time error is thrown in this case.
+ *
+ * @Issue 39678
+ *
+ * @author iarkh@unipro.ru
+*/
+// SharedOptions=--enable-experiment=non-nullable
+
+import "dart:async";
+import "override_checking_legacy_lib.dart";
+
+void testme() {}
+
+abstract class AA {
+ int i = -1;
+ Object o = 5;
+ Function func = testme;
+ FutureOr<int> fi = -1;
+ FutureOr<Function> ff = testme;
+}
+
+class A1 implements LEGACY_FIELD, AA {
+ int i;
+// ^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ Object o;
+// ^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ Function func;
+// ^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ FutureOr<int> fi;
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ FutureOr<Function> ff;
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ dynamic d;
+ Null n;
+ FutureOr f;
+ void v;
+}
+
+class A2 implements LEGACY_FIELD, AA {
+ int i = null;
+// ^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ Object o = null;
+// ^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ Function func = null;
+// ^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ FutureOr<int> fi = null;
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ FutureOr<Function> ff = null;
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ dynamic d = null;
+ Null n = null;
+ FutureOr f = null;
+ void v = null;
+}
+
+main() {
+ A1();
+ A2();
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t01.dart b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t01.dart
index 3f21d5e..093e86e 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t01.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t01.dart
@@ -21,13 +21,8 @@
import "override_checking_legacy_lib.dart";
class A extends LEGACY_REQUIRED_ARGS {
- void test_default({required int? i}) {
- Expect.equals(1, i);
- }
-
- void test_nondefault({required int? i}) {
- Expect.equals(1, i);
- }
+ void test_default({required int? i}) { Expect.equals(1, i); }
+ void test_nondefault({required int? i}) { Expect.equals(1, i); }
}
main() {
diff --git a/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t03.dart b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t03.dart
index 0985941..01eb667 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t03.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t03.dart
@@ -21,13 +21,8 @@
import "override_checking_legacy_lib.dart";
class A implements LEGACY_REQUIRED_ARGS {
- void test_default({required int? i}) {
- Expect.equals(1, i);
- }
-
- void test_nondefault({required int? i}) {
- Expect.equals(1, i);
- }
+ void test_default({required int? i}) { Expect.equals(1, i); }
+ void test_nondefault({required int? i}) { Expect.equals(1, i); }
}
main() {
diff --git a/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t05.dart b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t05.dart
index d15f75c..7fa470c 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t05.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t05.dart
@@ -21,13 +21,8 @@
import "override_checking_legacy_lib.dart";
class A with LEGACY_REQUIRED_ARGS {
- void test_default({required int? i}) {
- Expect.equals(1, i);
- }
-
- void test_nondefault({required int? i}) {
- Expect.equals(1, i);
- }
+ void test_default({required int? i}) { Expect.equals(1, i); }
+ void test_nondefault({required int? i}) { Expect.equals(1, i); }
}
main() {
diff --git a/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t07.dart b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t07.dart
index fcea360..bf9e4b9 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t07.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t07.dart
@@ -26,13 +26,8 @@
}
class A implements B, LEGACY_REQUIRED_ARGS {
- void test_default({required int? i}) {
- Expect.equals(1, i);
- }
-
- void test_nondefault({required int? i}) {
- Expect.equals(1, i);
- }
+ void test_default({required int? i}) { Expect.equals(1, i); }
+ void test_nondefault({required int? i}) { Expect.equals(1, i); }
}
main() {
diff --git a/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t08.dart b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t08.dart
index 0f3f351..1efe137 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t08.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t08.dart
@@ -20,7 +20,7 @@
import "override_checking_legacy_lib.dart";
abstract class B {
- void test_default({required int? i}) {}
+ void test_default({required int? i}) {}
void test_nondefault({required int? i}) {}
}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t15.dart b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t15.dart
index 567ab6b..66c3c80 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t15.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t15.dart
@@ -19,11 +19,10 @@
*/
// SharedOptions=--enable-experiment=non-nullable
-import "../../Utils/expect.dart";
import "override_checking_legacy_lib.dart";
abstract class B {
- void test_default({required int i}) {}
+ void test_default({required int i}) {}
void test_nondefault({required int i}) {}
}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t16.dart b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t16.dart
index 6834de9..95e2eb9 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t16.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t16.dart
@@ -21,7 +21,7 @@
import "override_checking_legacy_lib.dart";
abstract class B {
- void test_default({required int i}) {}
+ void test_default({required int i}) {}
void test_nondefault({required int i}) {}
}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t13.dart b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t13.dart
index 74bd4cd..27ba7bb 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t13.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t13.dart
@@ -9,14 +9,15 @@
* 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, migrated
- * method with [Never] return value can override legacy method.
+ * @description Check that if opted-in class extends legacy class, child
+ * migrated method can have [Never] return value.
*
* @author iarkh@unipro.ru
*/
// SharedOptions=--enable-experiment=non-nullable
import "override_checking_legacy_lib.dart";
+import "../../Utils/expect.dart";
class A extends LEGACY_RETURN {
Never getInt() => throw "It's impossible!";
@@ -30,5 +31,14 @@
}
main() {
- A();
+ A a = A();
+
+ Expect.throws(() { a.getInt(); });
+ Expect.throws(() { a.getObject(); });
+ Expect.throws(() { a.getDynamic(); });
+ Expect.throws(() { a.getFunction(); });
+ Expect.throws(() { a.getNull(); });
+ Expect.throws(() { a.getFutureOr(); });
+ Expect.throws(() { a.getFutureOrInt(); });
+ Expect.throws(() { a.getFutureOrFunction(); });
}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t14.dart b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t14.dart
index b44661e..7ac57f4 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t14.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t14.dart
@@ -9,17 +9,17 @@
* 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.
+ * @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";
+import "../../Utils/expect.dart";
-class A extends LEGACY_RETURN {
+class A with LEGACY_RETURN {
Never getInt() => throw "It's impossible!";
Never getObject() => throw "It's impossible!";
Never getDynamic() => throw "It's impossible!";
@@ -33,43 +33,12 @@
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
+ Expect.throws(() { a.getInt(); });
+ Expect.throws(() { a.getObject(); });
+ Expect.throws(() { a.getDynamic(); });
+ Expect.throws(() { a.getFunction(); });
+ Expect.throws(() { a.getNull(); });
+ Expect.throws(() { a.getFutureOr(); });
+ Expect.throws(() { a.getFutureOrInt(); });
+ Expect.throws(() { a.getFutureOrFunction(); });
}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t15.dart b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t15.dart
index 5d876a6..e0b92fa 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t15.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t15.dart
@@ -9,16 +9,17 @@
* 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, migrated
- * method with [Never] return value can override legacy method.
+ * @description Check that if opted-in class is a mixin with legacy class, child
+ * migrated method can have [Never] return value.
*
* @author iarkh@unipro.ru
*/
// SharedOptions=--enable-experiment=non-nullable
import "override_checking_legacy_lib.dart";
+import "../../Utils/expect.dart";
-class A implements LEGACY_RETURN {
+class A with LEGACY_RETURN {
Never getInt() => throw "It's impossible!";
Never getObject() => throw "It's impossible!";
Never getDynamic() => throw "It's impossible!";
@@ -30,5 +31,14 @@
}
main() {
- A();
+ A a = A();
+
+ Expect.throws(() { a.getInt(); });
+ Expect.throws(() { a.getObject(); });
+ Expect.throws(() { a.getDynamic(); });
+ Expect.throws(() { a.getFunction(); });
+ Expect.throws(() { a.getNull(); });
+ Expect.throws(() { a.getFutureOr(); });
+ Expect.throws(() { a.getFutureOrInt(); });
+ Expect.throws(() { a.getFutureOrFunction(); });
}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t16.dart b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t16.dart
index 0343e52..35b7636 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t16.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t16.dart
@@ -9,17 +9,29 @@
* 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.
+ * @description Check that if opted-in class implements two classes (one is
+ * legacy), child migrated method can have [Never] return value.
*
* @author iarkh@unipro.ru
*/
// SharedOptions=--enable-experiment=non-nullable
+import "dart:async";
import "override_checking_legacy_lib.dart";
+import "../../Utils/expect.dart";
-class A implements LEGACY_RETURN {
+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!";
@@ -33,43 +45,12 @@
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
+ Expect.throws(() { a.getInt(); });
+ Expect.throws(() { a.getObject(); });
+ Expect.throws(() { a.getDynamic(); });
+ Expect.throws(() { a.getFunction(); });
+ Expect.throws(() { a.getNull(); });
+ Expect.throws(() { a.getFutureOr(); });
+ Expect.throws(() { a.getFutureOrInt(); });
+ Expect.throws(() { a.getFutureOrFunction(); });
}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t17.dart b/LanguageFeatures/nnbd/override_checking_A02_RETURN_t17.dart
deleted file mode 100644
index a3c1049..0000000
--- a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t17.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 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
deleted file mode 100644
index bf86233..0000000
--- a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t18.dart
+++ /dev/null
@@ -1,75 +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 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
deleted file mode 100644
index affe857..0000000
--- a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t19.dart
+++ /dev/null
@@ -1,46 +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 "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
deleted file mode 100644
index c4cf300..0000000
--- a/LanguageFeatures/nnbd/override_checking_A02_RETURN_t20.dart
+++ /dev/null
@@ -1,87 +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
-
-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_SETTER_t01.dart b/LanguageFeatures/nnbd/override_checking_A02_SETTER_t01.dart
index e0c985e..b68fabd 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_SETTER_t01.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_SETTER_t01.dart
@@ -23,36 +23,14 @@
void testme() {}
class A extends LEGACY_SETTER {
- void set setInt(int? i) {
- Expect.equals(1, i);
- }
-
- void set setObject(Object? o) {
- Expect.equals(1, o);
- }
-
- void set setDynamic(dynamic? d) {
- Expect.equals(1, d);
- }
-
- void set setNull(Null? n) {
- Expect.isNull(n);
- }
-
- void set setFunction(Function? f) {
- Expect.equals(testme, f);
- }
- void set setFutureOr(FutureOr? f) {
- Expect.equals(1, f);
- }
-
- void set setFutureOrInt(FutureOr<int>? f) {
- Expect.equals(1, f);
- }
-
- void set setFutureOrFunction(FutureOr<Function>? f) {
- Expect.equals(testme, f);
- }
+ void set setInt(int? i) { Expect.equals(1, i); }
+ void set setObject(Object? o) { Expect.equals(1, o); }
+ void set setDynamic(dynamic? d) { Expect.equals(1, d); }
+ void set setNull(Null? n) { Expect.isNull(n); }
+ void set setFunction(Function? f) { Expect.equals(testme, f); }
+ void set setFutureOr(FutureOr? f) { Expect.equals(1, f); }
+ void set setFutureOrInt(FutureOr<int>? f) { Expect.equals(1, f); }
+ void set setFutureOrFunction(FutureOr<Function>? f) { Expect.equals(testme, f); }
}
main() {
diff --git a/LanguageFeatures/nnbd/override_checking_A02_SETTER_t02.dart b/LanguageFeatures/nnbd/override_checking_A02_SETTER_t02.dart
index 61a3684..27ae828 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_SETTER_t02.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_SETTER_t02.dart
@@ -21,37 +21,14 @@
import "override_checking_legacy_lib.dart";
class A extends LEGACY_SETTER {
- void set setInt(int? i) {
- Expect.isNull(i);
- }
-
- void set setObject(Object? o) {
- Expect.isNull(o);
- }
-
- void set setDynamic(dynamic d) {
- Expect.isNull(d);
- }
-
- void set setNull(Null n) {
- Expect.isNull(n);
- }
-
- void set setFunction(Function? f) {
- Expect.isNull(f);
- }
-
- void set setFutureOr(FutureOr f) {
- Expect.isNull(f);
- }
-
- void set setFutureOrInt(FutureOr<int>? f) {
- Expect.isNull(f);
- }
-
- void set setFutureOrFunction(FutureOr<Function>? f) {
- Expect.isNull(f);
- }
+ void set setInt(int? i) { Expect.isNull(i); }
+ void set setObject(Object? o) { Expect.isNull(o); }
+ void set setDynamic(dynamic d) { Expect.isNull(d); }
+ void set setNull(Null n) { Expect.isNull(n); }
+ void set setFunction(Function? f) { Expect.isNull(f); }
+ void set setFutureOr(FutureOr f) { Expect.isNull(f); }
+ void set setFutureOrInt(FutureOr<int>? f) { Expect.isNull(f); }
+ void set setFutureOrFunction(FutureOr<Function>? f) { Expect.isNull(f); }
}
main() {
diff --git a/LanguageFeatures/nnbd/override_checking_A02_SETTER_t03.dart b/LanguageFeatures/nnbd/override_checking_A02_SETTER_t03.dart
index cac3350..b6eda98 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_SETTER_t03.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_SETTER_t03.dart
@@ -10,8 +10,7 @@
* to override otherwise incompatible signatures for a method.
*
* @description Check that if opted-in class extends legacy class, opted-in
- * setter cannot have non-nullable argument and compile error is thrown in this
- * case.
+ * setter can have non-nullable argument.
*
* @author iarkh@unipro.ru
*/
@@ -19,39 +18,24 @@
import "dart:async";
import "override_checking_legacy_lib.dart";
+import "../../Utils/expect.dart";
+
+void testme() {}
class A extends LEGACY_SETTER {
- void set setInt(int i) {}
-// ^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
-
- void set setObject(Object o) {}
-// ^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- void set setFunction(Function f) {}
-// ^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- void set setFutureOrInt(FutureOr<int> f) {}
-// ^^^^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- void set setFutureOrFunction(FutureOr<Function> f) {}
-// ^^^^^^^^^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- void set setDynamic(dynamic d) {}
- void set setNull(Null n) {}
- void set setFutureOr(FutureOr f) {}
+ void set setInt(int? i) { Expect.equals(1, i); }
+ void set setObject(Object? o) { Expect.equals(1, o); }
+ void set setFunction(Function? f) { Expect.equals(testme, f); }
+ void set setFutureOrInt(FutureOr<int>? f) { Expect.equals(1, f); }
+ void set setFutureOrFunction(FutureOr<Function>? f) { Expect.equals(testme, f); }
}
main() {
- A();
+ A a = A();
+
+ a.setInt = 1;
+ a.setObject = 1;
+ a.setFunction = testme;
+ a.setFutureOrInt = 1;
+ a.setFutureOrFunction = testme;
}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_SETTER_t04.dart b/LanguageFeatures/nnbd/override_checking_A02_SETTER_t04.dart
index b86d7fc..a8d5563 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_SETTER_t04.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_SETTER_t04.dart
@@ -23,36 +23,14 @@
void testme() {}
class A implements LEGACY_SETTER {
- void set setInt(int? i) {
- Expect.equals(1, i);
- }
-
- void set setObject(Object? o) {
- Expect.equals(1, o);
- }
-
- void set setDynamic(dynamic? d) {
- Expect.equals(1, d);
- }
-
- void set setNull(Null? n) {
- Expect.isNull(n);
- }
-
- void set setFunction(Function? f) {
- Expect.equals(testme, f);
- }
- void set setFutureOr(FutureOr? f) {
- Expect.equals(1, f);
- }
-
- void set setFutureOrInt(FutureOr<int>? f) {
- Expect.equals(1, f);
- }
-
- void set setFutureOrFunction(FutureOr<Function>? f) {
- Expect.equals(testme, f);
- }
+ void set setInt(int? i) { Expect.equals(1, i); }
+ void set setObject(Object? o) { Expect.equals(1, o); }
+ void set setDynamic(dynamic? d) { Expect.equals(1, d); }
+ void set setNull(Null? n) { Expect.isNull(n); }
+ void set setFunction(Function? f) { Expect.equals(testme, f); }
+ void set setFutureOr(FutureOr? f) { Expect.equals(1, f); }
+ void set setFutureOrInt(FutureOr<int>? f) { Expect.equals(1, f); }
+ void set setFutureOrFunction(FutureOr<Function>? f) { Expect.equals(testme, f); }
}
main() {
diff --git a/LanguageFeatures/nnbd/override_checking_A02_SETTER_t05.dart b/LanguageFeatures/nnbd/override_checking_A02_SETTER_t05.dart
index cfc0011..0308332 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_SETTER_t05.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_SETTER_t05.dart
@@ -21,36 +21,14 @@
import "override_checking_legacy_lib.dart";
class A implements LEGACY_SETTER {
- void set setInt(int? i) {
- Expect.isNull(i);
- }
-
- void set setObject(Object? o) {
- Expect.isNull(o);
- }
-
- void set setDynamic(dynamic d) {
- Expect.isNull(d);
- }
-
- void set setNull(Null n) {
- Expect.isNull(n);
- }
-
- void set setFunction(Function? f) {
- Expect.isNull(f);
- }
- void set setFutureOr(FutureOr f) {
- Expect.isNull(f);
- }
-
- void set setFutureOrInt(FutureOr<int>? f) {
- Expect.isNull(f);
- }
-
- void set setFutureOrFunction(FutureOr<Function>? f) {
- Expect.isNull(f);
- }
+ void set setInt(int? i) { Expect.isNull(i); }
+ void set setObject(Object? o) { Expect.isNull(o); }
+ void set setDynamic(dynamic d) { Expect.isNull(d); }
+ void set setNull(Null n) { Expect.isNull(n); }
+ void set setFunction(Function? f) { Expect.isNull(f); }
+ void set setFutureOr(FutureOr f) { Expect.isNull(f); }
+ void set setFutureOrInt(FutureOr<int>? f) { Expect.isNull(f); }
+ void set setFutureOrFunction(FutureOr<Function>? f) { Expect.isNull(f); }
}
main() {
diff --git a/LanguageFeatures/nnbd/override_checking_A02_SETTER_t06.dart b/LanguageFeatures/nnbd/override_checking_A02_SETTER_t06.dart
index 3b508b6..0fbf503 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_SETTER_t06.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_SETTER_t06.dart
@@ -10,7 +10,7 @@
* to override otherwise incompatible signatures for a method.
*
* @description Check that if opted-in class implements legacy class, child
- * opted-in setter cannot have non-nullable argument.
+ * opted-in setter can have non-nullable argument.
*
* @author iarkh@unipro.ru
*/
@@ -18,39 +18,28 @@
import "dart:async";
import "override_checking_legacy_lib.dart";
+import "../../Utils/expect.dart";
+
+void testme() {}
class A implements LEGACY_SETTER {
- void set setInt(int i) {}
-// ^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
+ void set setInt(int? i) { Expect.equals(1, i); }
+ void set setObject(Object? o) { Expect.equals(1, o); }
+ void set setFunction(Function? f) { Expect.equals(testme, f); }
+ void set setFutureOrInt(FutureOr<int>? f) { Expect.equals(1, f); }
+ void set setFutureOrFunction(FutureOr<Function>? f) { Expect.equals(testme, f); }
-
- void set setObject(Object o) {}
-// ^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- void set setFunction(Function f) {}
-// ^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- void set setFutureOrInt(FutureOr<int> f) {}
-// ^^^^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- void set setFutureOrFunction(FutureOr<Function> f) {}
-// ^^^^^^^^^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- void set setDynamic(dynamic d) {}
- void set setNull(Null n) {}
+ void set setDynamic(dynamic d) {}
+ void set setNull(Null n) {}
void set setFutureOr(FutureOr f) {}
}
main() {
- A();
+ A a = A();
+
+ a.setInt = 1;
+ a.setObject = 1;
+ a.setFunction = testme;
+ a.setFutureOrInt = 1;
+ a.setFutureOrFunction = testme;
}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_SETTER_t07.dart b/LanguageFeatures/nnbd/override_checking_A02_SETTER_t07.dart
index 52e0acc..0e3a118 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_SETTER_t07.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_SETTER_t07.dart
@@ -23,36 +23,14 @@
void testme() {}
class A with LEGACY_SETTER {
- void set setInt(int? i) {
- Expect.equals(1, i);
- }
-
- void set setObject(Object? o) {
- Expect.equals(1, o);
- }
-
- void set setDynamic(dynamic? d) {
- Expect.equals(1, d);
- }
-
- void set setNull(Null? n) {
- Expect.isNull(n);
- }
-
- void set setFunction(Function? f) {
- Expect.equals(testme, f);
- }
- void set setFutureOr(FutureOr? f) {
- Expect.equals(1, f);
- }
-
- void set setFutureOrInt(FutureOr<int>? f) {
- Expect.equals(1, f);
- }
-
- void set setFutureOrFunction(FutureOr<Function>? f) {
- Expect.equals(testme, f);
- }
+ void set setInt(int? i) { Expect.equals(1, i); }
+ void set setObject(Object? o) { Expect.equals(1, o); }
+ void set setDynamic(dynamic? d) { Expect.equals(1, d); }
+ void set setNull(Null? n) { Expect.isNull(n); }
+ void set setFunction(Function? f) { Expect.equals(testme, f); }
+ void set setFutureOr(FutureOr? f) { Expect.equals(1, f); }
+ void set setFutureOrInt(FutureOr<int>? f) { Expect.equals(1, f); }
+ void set setFutureOrFunction(FutureOr<Function>? f) { Expect.equals(testme, f); }
}
main() {
diff --git a/LanguageFeatures/nnbd/override_checking_A02_SETTER_t08.dart b/LanguageFeatures/nnbd/override_checking_A02_SETTER_t08.dart
index 9b1ee2c..a25cc1d 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_SETTER_t08.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_SETTER_t08.dart
@@ -21,37 +21,14 @@
import "override_checking_legacy_lib.dart";
class A with LEGACY_SETTER {
- void set setInt(int? i) {
- Expect.isNull(i);
- }
-
- void set setObject(Object? o) {
- Expect.isNull(o);
- }
-
- void set setDynamic(dynamic d) {
- Expect.isNull(d);
- }
-
- void set setNull(Null n) {
- Expect.isNull(n);
- }
-
- void set setFunction(Function? f) {
- Expect.isNull(f);
- }
-
- void set setFutureOr(FutureOr f) {
- Expect.isNull(f);
- }
-
- void set setFutureOrInt(FutureOr<int>? f) {
- Expect.isNull(f);
- }
-
- void set setFutureOrFunction(FutureOr<Function>? f) {
- Expect.isNull(f);
- }
+ void set setInt(int? i) { Expect.isNull(i); }
+ void set setObject(Object? o) { Expect.isNull(o); }
+ void set setDynamic(dynamic d) { Expect.isNull(d); }
+ void set setNull(Null n) { Expect.isNull(n); }
+ void set setFunction(Function? f) { Expect.isNull(f); }
+ void set setFutureOr(FutureOr f) { Expect.isNull(f); }
+ void set setFutureOrInt(FutureOr<int>? f) { Expect.isNull(f); }
+ void set setFutureOrFunction(FutureOr<Function>? f) { Expect.isNull(f); }
}
main() {
diff --git a/LanguageFeatures/nnbd/override_checking_A02_SETTER_t09.dart b/LanguageFeatures/nnbd/override_checking_A02_SETTER_t09.dart
index d5d348b..5838373 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_SETTER_t09.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_SETTER_t09.dart
@@ -10,7 +10,7 @@
* to override otherwise incompatible signatures for a method.
*
* @description Check that if opted-in class is a mixin with legacy class, child
- * opted-in setter cannot have non-nullable argument.
+ * opted-in setter can have non-nullable argument.
*
* @author iarkh@unipro.ru
*/
@@ -18,39 +18,24 @@
import "dart:async";
import "override_checking_legacy_lib.dart";
+import "../../Utils/expect.dart";
+
+void testme() {}
class A with LEGACY_SETTER {
- void set setInt(int i) {}
-// ^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
-
- void set setObject(Object o) {}
-// ^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- void set setFunction(Function f) {}
-// ^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- void set setFutureOrInt(FutureOr<int> f) {}
-// ^^^^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- void set setFutureOrFunction(FutureOr<Function> f) {}
-// ^^^^^^^^^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- void set setDynamic(dynamic d) {}
- void set setNull(Null n) {}
- void set setFutureOr(FutureOr f) {}
+ void set setInt(int? i) { Expect.equals(1, i); }
+ void set setObject(Object? o) { Expect.equals(1, o); }
+ void set setFunction(Function? f) { Expect.equals(testme, f); }
+ void set setFutureOrInt(FutureOr<int>? f) { Expect.equals(1, f); }
+ void set setFutureOrFunction(FutureOr<Function>? f) { Expect.equals(testme, f); }
}
main() {
- A();
+ A a = A();
+
+ a.setInt = 1;
+ a.setObject = 1;
+ a.setFunction = testme;
+ a.setFutureOrInt = 1;
+ a.setFutureOrFunction = testme;
}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_SETTER_t10.dart b/LanguageFeatures/nnbd/override_checking_A02_SETTER_t10.dart
index 214fa60..79101ac 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_SETTER_t10.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_SETTER_t10.dart
@@ -35,37 +35,14 @@
}
class A implements AA, LEGACY_SETTER {
- void set setInt(int? i) {
- Expect.equals(1, i);
- }
-
- void set setObject(Object? o) {
- Expect.equals(1, o);
- }
-
- void set setDynamic(dynamic? d) {
- Expect.equals(1, d);
- }
-
- void set setNull(Null? n) {
- Expect.isNull(n);
- }
-
- void set setFunction(Function? f) {
- Expect.equals(testme, f);
- }
-
- void set setFutureOr(FutureOr? f) {
- Expect.equals(1, f);
- }
-
- void set setFutureOrInt(FutureOr<int>? f) {
- Expect.equals(1, f);
- }
-
- void set setFutureOrFunction(FutureOr<Function>? f) {
- Expect.equals(testme, f);
- }
+ void set setInt(int? i) { Expect.equals(1, i); }
+ void set setObject(Object? o) { Expect.equals(1, o); }
+ void set setDynamic(dynamic? d) { Expect.equals(1, d); }
+ void set setNull(Null? n) { Expect.isNull(n); }
+ void set setFunction(Function? f) { Expect.equals(testme, f); }
+ void set setFutureOr(FutureOr? f) { Expect.equals(1, f); }
+ void set setFutureOrInt(FutureOr<int>? f) { Expect.equals(1, f); }
+ void set setFutureOrFunction(FutureOr<Function>? f) { Expect.equals(testme, f); }
}
main() {
diff --git a/LanguageFeatures/nnbd/override_checking_A02_SETTER_t11.dart b/LanguageFeatures/nnbd/override_checking_A02_SETTER_t11.dart
index dc8d7fa..a464a2d 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_SETTER_t11.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_SETTER_t11.dart
@@ -35,37 +35,14 @@
}
class A implements AA, LEGACY_SETTER {
- void set setInt(int? i) {
- Expect.isNull(i);
- }
-
- void set setObject(Object? o) {
- Expect.isNull(o);
- }
-
- void set setDynamic(dynamic d) {
- Expect.isNull(d);
- }
-
- void set setNull(Null n) {
- Expect.isNull(n);
- }
-
- void set setFunction(Function? f) {
- Expect.isNull(f);
- }
-
- void set setFutureOr(FutureOr f) {
- Expect.isNull(f);
- }
-
- void set setFutureOrInt(FutureOr<int>? f) {
- Expect.isNull(f);
- }
-
- void set setFutureOrFunction(FutureOr<Function>? f) {
- Expect.isNull(f);
- }
+ void set setInt(int? i) { Expect.isNull(i); }
+ void set setObject(Object? o) { Expect.isNull(o); }
+ void set setDynamic(dynamic d) { Expect.isNull(d); }
+ void set setNull(Null n) { Expect.isNull(n); }
+ void set setFunction(Function? f) { Expect.isNull(f); }
+ void set setFutureOr(FutureOr f) { Expect.isNull(f); }
+ void set setFutureOrInt(FutureOr<int>? f) { Expect.isNull(f); }
+ void set setFutureOrFunction(FutureOr<Function>? f) { Expect.isNull(f); }
}
main() {
diff --git a/LanguageFeatures/nnbd/override_checking_A02_SETTER_t12.dart b/LanguageFeatures/nnbd/override_checking_A02_SETTER_t12.dart
index 639402a..a7d140f 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_SETTER_t12.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_SETTER_t12.dart
@@ -19,6 +19,9 @@
import "dart:async";
import "override_checking_legacy_lib.dart";
+import "../../Utils/expect.dart";
+
+void testme() {}
abstract class AA {
void set setInt(int? i);
@@ -32,37 +35,23 @@
}
class A implements AA, LEGACY_SETTER {
- void set setInt(int i) {}
-// ^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
+ void set setInt(int? i) { Expect.equals(1, i); }
+ void set setObject(Object? o) { Expect.equals(1, o); }
+ void set setFunction(Function? f) { Expect.equals(testme, f); }
+ void set setFutureOrInt(FutureOr<int>? f) { Expect.equals(1, f); }
+ void set setFutureOrFunction(FutureOr<Function>? f) { Expect.equals(testme, f); }
-
- void set setObject(Object o) {}
-// ^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- void set setFunction(Function f) {}
-// ^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- void set setFutureOrInt(FutureOr<int> f) {}
-// ^^^^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- void set setFutureOrFunction(FutureOr<Function> f) {}
-// ^^^^^^^^^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- void set setDynamic(dynamic d) {}
- void set setNull(Null n) {}
+ void set setDynamic(dynamic d) {}
+ void set setNull(Null n) {}
void set setFutureOr(FutureOr f) {}
}
main() {
- A();
+ A a = A();
+
+ a.setInt = 1;
+ a.setObject = 1;
+ a.setFunction = testme;
+ a.setFutureOrInt = 1;
+ a.setFutureOrFunction = testme;
}