Fixed Issue #516: expected result for the tests which check methods with required arguments updated.
diff --git a/LanguageFeatures/nnbd/exports_A01_opted_in_lib.dart b/LanguageFeatures/nnbd/exports_A01_opted_in_lib.dart
index ae3a2d6..009a817 100644
--- a/LanguageFeatures/nnbd/exports_A01_opted_in_lib.dart
+++ b/LanguageFeatures/nnbd/exports_A01_opted_in_lib.dart
@@ -50,17 +50,17 @@
// Generic classes with nullable type parameter:
-class GENERIC_NULLABLE <T extends dynamic> { dynamic getParamType() => T; }
-class GENERIC_NULLABLE_INT <T extends int?> { dynamic getParamType() => T; }
-class GENERIC_NULLABLE_OBJECT <T extends Object?> { dynamic getParamType() => T; }
+class GENERIC_NULLABLE <T extends dynamic > { dynamic getParamType() => T; }
+class GENERIC_NULLABLE_INT <T extends int? > { dynamic getParamType() => T; }
+class GENERIC_NULLABLE_OBJECT <T extends Object? > { dynamic getParamType() => T; }
class GENERIC_NULLABLE_FUNCTION<T extends Function?> { dynamic getParamType() => T; }
-class GENERIC_NULL <T extends Null> { dynamic getParamType() => T; }
-class GENERIC_FUTUREOR <T extends FutureOr> { dynamic getParamType() => T; }
+class GENERIC_NULL <T extends Null > { dynamic getParamType() => T; }
+class GENERIC_FUTUREOR <T extends FutureOr > { dynamic getParamType() => T; }
// Generic classes with non-nullable type parameter:
-class GENERIC_NONNULLABLE_INT <T extends int> { dynamic getParamType() => T; }
-class GENERIC_NONNULLABLE_OBJECT <T extends Object> { dynamic getParamType() => T; }
+class GENERIC_NONNULLABLE_INT <T extends int > { dynamic getParamType() => T; }
+class GENERIC_NONNULLABLE_OBJECT <T extends Object > { dynamic getParamType() => T; }
class GENERIC_NONNULLABLE_FUNCTION<T extends Function> { dynamic getParamType() => T; }
class GENERIC_NEVER<T extends Never> { dynamic getParamType() => T; }
@@ -101,16 +101,16 @@
// Generic functions:
-void testGenericDynamic <T extends dynamic> () { Expect.equals(Null, T); }
-void testGenericNullableInt <T extends int?> () { Expect.equals(Null, T); }
+void testGenericDynamic <T extends dynamic >() { Expect.equals(Null, T); }
+void testGenericNullableInt <T extends int? >() { Expect.equals(Null, T); }
void testGenericNullableFunction<T extends Function?>() { Expect.equals(Null, T); }
-void testGenericNullableObject <T extends Object?> () { Expect.equals(Null, T); }
-void testGenericNull <T extends Null> () { Expect.equals(Null, T); }
-void testGenericFutureOr <T extends FutureOr> () { Expect.equals(Null, T); }
+void testGenericNullableObject <T extends Object? >() { Expect.equals(Null, T); }
+void testGenericNull <T extends Null >() { Expect.equals(Null, T); }
+void testGenericFutureOr <T extends FutureOr >() { Expect.equals(Null, T); }
-void testGenericInt <T extends int> () {}
+void testGenericInt <T extends int >() {}
void testGenericFunction<T extends Function>() {}
-void testGenericObject <T extends Object> () {}
+void testGenericObject <T extends Object >() {}
void testGenericNever<T extends Never>() {}
@@ -152,41 +152,41 @@
// Generic function typedefs like
// [typedef <typeIdentifier> <typeParameters> = <functionType>].
-typedef g_def <T extends dynamic> = void Function();
-typedef g_nullable_int_def <T extends int?> = void Function();
-typedef g_nullable_object_def <T extends Object?> = void Function();
+typedef g_def <T extends dynamic > = void Function();
+typedef g_nullable_int_def <T extends int? > = void Function();
+typedef g_nullable_object_def <T extends Object? > = void Function();
typedef g_nullable_function_def<T extends Function?> = void Function();
-typedef g_null_def <T extends Null> = void Function();
-typedef g_futureOr_def <T extends FutureOr> = void Function();
+typedef g_null_def <T extends Null > = void Function();
+typedef g_futureOr_def <T extends FutureOr > = void Function();
-typedef g_int_def <T extends int> = void Function();
-typedef g_object_def <T extends Object> = void Function();
+typedef g_int_def <T extends int > = void Function();
+typedef g_object_def <T extends Object > = void Function();
typedef g_function_def<T extends Function> = void Function();
typedef g_never_def<T extends Never> = void Function();
-typedef g_def_dynamic_arg <T extends dynamic> = void Function(T);
-typedef g_def_nullable_int_arg <T extends int?> = void Function(T);
-typedef g_def_nullable_object_arg <T extends Object?> = void Function(T);
+typedef g_def_dynamic_arg <T extends dynamic > = void Function(T);
+typedef g_def_nullable_int_arg <T extends int? > = void Function(T);
+typedef g_def_nullable_object_arg <T extends Object? > = void Function(T);
typedef g_def_nullable_function_arg<T extends Function?> = void Function(T);
-typedef g_def_null_arg <T extends Null> = void Function(T);
-typedef g_def_futureOr_arg <T extends FutureOr> = void Function(T);
+typedef g_def_null_arg <T extends Null > = void Function(T);
+typedef g_def_futureOr_arg <T extends FutureOr > = void Function(T);
-typedef g_def_int_arg <T extends int> = void Function(T);
-typedef g_def_object_arg <T extends Object> = void Function(T);
+typedef g_def_int_arg <T extends int > = void Function(T);
+typedef g_def_object_arg <T extends Object > = void Function(T);
typedef g_def_function_arg<T extends Function> = void Function(T);
typedef g_def_never_arg<T extends Never> = void Function(T);
-typedef g_def_getDynamic <T extends dynamic> = T Function();
-typedef g_def_getNullableInt <T extends int?> = T Function();
-typedef g_def_getNullableObject <T extends Object?> = T Function();
+typedef g_def_getDynamic <T extends dynamic > = T Function();
+typedef g_def_getNullableInt <T extends int? > = T Function();
+typedef g_def_getNullableObject <T extends Object? > = T Function();
typedef g_def_getNullableFunction<T extends Function?> = T Function();
-typedef g_def_getNull <T extends Null> = T Function();
-typedef g_def_getFutureOr <T extends FutureOr> = T Function();
+typedef g_def_getNull <T extends Null > = T Function();
+typedef g_def_getFutureOr <T extends FutureOr > = T Function();
-typedef g_def_getInt <T extends int> = T Function();
-typedef g_def_getObject <T extends Object> = T Function();
+typedef g_def_getInt <T extends int > = T Function();
+typedef g_def_getObject <T extends Object > = T Function();
typedef g_def_getFunction<T extends Function> = T Function();
typedef g_def_getNever<T extends Never> = T Function();
@@ -228,41 +228,41 @@
// Generic Function typedefs like
// [typedef <type> <identifier> <formalParameterPart>].
-typedef g_def1 <T extends dynamic> = void Function();
-typedef g_nullable_int_def1 <T extends int?> = void Function();
-typedef g_nullable_object_def1 <T extends Object?> = void Function();
+typedef g_def1 <T extends dynamic > = void Function();
+typedef g_nullable_int_def1 <T extends int? > = void Function();
+typedef g_nullable_object_def1 <T extends Object? > = void Function();
typedef g_nullable_function_def1<T extends Function?> = void Function();
-typedef g_null_def1 <T extends Null> = void Function();
-typedef g_futureOr_def1 <T extends FutureOr> = void Function();
+typedef g_null_def1 <T extends Null > = void Function();
+typedef g_futureOr_def1 <T extends FutureOr > = void Function();
-typedef g_int_def1 <T extends int> = void Function();
-typedef g_object_def1 <T extends Object> = void Function();
+typedef g_int_def1 <T extends int > = void Function();
+typedef g_object_def1 <T extends Object > = void Function();
typedef g_function_def1<T extends Function> = void Function();
typedef g_never_def1<T extends Never> = void Function();
-typedef g_def1_dynamic_arg <T extends dynamic> = void Function(T);
-typedef g_def1_nullable_int_arg <T extends int?> = void Function(T);
-typedef g_def1_nullable_object_arg <T extends Object?> = void Function(T);
+typedef g_def1_dynamic_arg <T extends dynamic > = void Function(T);
+typedef g_def1_nullable_int_arg <T extends int? > = void Function(T);
+typedef g_def1_nullable_object_arg <T extends Object? > = void Function(T);
typedef g_def1_nullable_function_arg<T extends Function?> = void Function(T);
-typedef g_def1_null_arg <T extends Null> = void Function(T);
-typedef g_def1_futureOr_arg <T extends FutureOr> = void Function(T);
+typedef g_def1_null_arg <T extends Null > = void Function(T);
+typedef g_def1_futureOr_arg <T extends FutureOr > = void Function(T);
-typedef g_def1_int_arg <T extends int> = void Function(T);
-typedef g_def1_object_arg <T extends Object> = void Function(T);
+typedef g_def1_int_arg <T extends int > = void Function(T);
+typedef g_def1_object_arg <T extends Object > = void Function(T);
typedef g_def1_function_arg<T extends Function> = void Function(T);
typedef g_def1_never_arg<T extends Never> = void Function(T);
-typedef g_def1_getDynamic <T extends dynamic> = T Function();
-typedef g_def1_getNullableInt <T extends int?> = T Function();
-typedef g_def1_getNullableObject <T extends Object?> = T Function();
+typedef g_def1_getDynamic <T extends dynamic > = T Function();
+typedef g_def1_getNullableInt <T extends int? > = T Function();
+typedef g_def1_getNullableObject <T extends Object? > = T Function();
typedef g_def1_getNullableFunction<T extends Function?> = T Function();
-typedef g_def1_getNull <T extends Null> = T Function();
-typedef g_def1_getFutureOr <T extends FutureOr> = T Function();
+typedef g_def1_getNull <T extends Null > = T Function();
+typedef g_def1_getFutureOr <T extends FutureOr > = T Function();
-typedef g_def1_getInt <T extends int> = T Function();
-typedef g_def1_getObject <T extends Object> = T Function();
+typedef g_def1_getInt <T extends int > = T Function();
+typedef g_def1_getObject <T extends Object > = T Function();
typedef g_def1_getFunction<T extends Function> = T Function();
typedef g_def1_getNever<T extends Never> = T Function();
diff --git a/LanguageFeatures/nnbd/override_checking_A01_opted_in_futureor_lib.dart b/LanguageFeatures/nnbd/override_checking_A01_opted_in_futureor_lib.dart
index 3841bf2..d78ebe8 100644
--- a/LanguageFeatures/nnbd/override_checking_A01_opted_in_futureor_lib.dart
+++ b/LanguageFeatures/nnbd/override_checking_A01_opted_in_futureor_lib.dart
@@ -17,6 +17,6 @@
import "dart:async";
-class OPTED_FUTUREOR<T extends FutureOr> {}
-class OPTED_FUTUREOR_INT<T extends FutureOr<int>> {}
+class OPTED_FUTUREOR <T extends FutureOr > {}
+class OPTED_FUTUREOR_INT <T extends FutureOr<int> > {}
class OPTED_FUTUREOR_FUTUREOR<T extends FutureOr<FutureOr>> {}
diff --git a/LanguageFeatures/nnbd/override_checking_A01_opted_in_lib.dart b/LanguageFeatures/nnbd/override_checking_A01_opted_in_lib.dart
index d4a0982..e5ad5c6 100644
--- a/LanguageFeatures/nnbd/override_checking_A01_opted_in_lib.dart
+++ b/LanguageFeatures/nnbd/override_checking_A01_opted_in_lib.dart
@@ -15,18 +15,18 @@
import "../../Utils/expect.dart";
class OPTED_NULLABLE_ARGS {
- void test_int(int? i) { Expect.fail("This method should be overriden"); }
- void test_object(Object? o) { Expect.fail("This method should be overriden"); }
- void test_dynamic(dynamic i) { Expect.fail("This method should be overriden"); }
+ void test_int (int? i ) { Expect.fail("This method should be overriden"); }
+ void test_object (Object? o ) { Expect.fail("This method should be overriden"); }
+ void test_dynamic (dynamic i ) { Expect.fail("This method should be overriden"); }
void test_function(Function? f) { Expect.fail("This method should be overriden"); }
- void test_null(Null n) { Expect.fail("This method should be overriden"); }
- void test_futureOr(FutureOr i) { Expect.fail("This method should be overriden"); }
+ void test_null (Null n ) { Expect.fail("This method should be overriden"); }
+ void test_futureOr(FutureOr i ) { Expect.fail("This method should be overriden"); }
}
class OPTED_NONNULLABLE_ARGS {
- void test_int(int i) { Expect.fail("This method should be overriden"); }
- void test_object(Object o) { Expect.fail("This method should be overriden"); }
- void test_function(Function f) { Expect.fail("This method should be overriden"); }
+ void test_int (int i ) { Expect.fail("This method should be overriden"); }
+ void test_object (Object o ) { Expect.fail("This method should be overriden"); }
+ void test_function(Function f ) { Expect.fail("This method should be overriden"); }
void test_futureOr(FutureOr<int> i) { Expect.fail("This method should be overriden"); }
}
@@ -35,26 +35,26 @@
}
class OPTED_REQUIRED_ARGS {
- void test_required_nonnullable({required int i}) { Expect.fail("This method should be overriden"); }
- void test_required_nullable({required int? i}) { Expect.fail("This method should be overriden"); }
+ void test_required_nonnullable({required int i}) { Expect.fail("This method should be overriden"); }
+ void test_required_nullable ({required int? i}) { Expect.fail("This method should be overriden"); }
}
class OPTED_NULLABLE_FIELD {
- int? i;
- Object? o;
- dynamic d;
+ int? i;
+ Object? o;
+ dynamic d;
Function? f;
- Null n;
- FutureOr fo;
- void v;
+ Null n;
+ FutureOr fo;
+ void v;
}
void testme() {}
class OPTED_NONNULLABLE_FIELD {
- int i = 0;
- Object o = 0;
- Function f = testme;
+ int i = 0;
+ Object o = 0;
+ Function f = testme;
FutureOr<int> fi = 0;
}
@@ -63,18 +63,18 @@
}
class OPTED_NULLABLE_GETTER {
- int? get getInt => throw("This method should be overriden");
- Object? get getObject => throw("This method should be overriden");
- dynamic get getDynamic => throw("This method should be overriden");
+ int? get getInt => throw("This method should be overriden");
+ Object? get getObject => throw("This method should be overriden");
+ dynamic get getDynamic => throw("This method should be overriden");
Function? get getFunction => throw("This method should be overriden");
- Null get getNull => throw("This method should be overriden");
- FutureOr get getFutureOr => throw("This method should be overriden");
+ Null get getNull => throw("This method should be overriden");
+ FutureOr get getFutureOr => throw("This method should be overriden");
}
class OPTED_NONNULLABLE_GETTER {
- int get getInt => throw("This method should be overriden");
- Object get getObject => throw("This method should be overriden");
- Function get getFunction => throw("This method should be overriden");
+ int get getInt => throw("This method should be overriden");
+ Object get getObject => throw("This method should be overriden");
+ Function get getFunction => throw("This method should be overriden");
FutureOr<int> get getFutureOrInt => throw("This method should be overriden");
}
@@ -83,18 +83,18 @@
}
class OPTED_NULLABLE_SETTER {
- void set setInt(int? i) { Expect.fail("This method should be overriden"); }
- void set setObject(Object? o) { Expect.fail("This method should be overriden"); }
- void set setDynamic(dynamic d) { Expect.fail("This method should be overriden"); }
+ void set setInt (int? i) { Expect.fail("This method should be overriden"); }
+ void set setObject (Object? o) { Expect.fail("This method should be overriden"); }
+ void set setDynamic (dynamic d) { Expect.fail("This method should be overriden"); }
void set setFunction(Function? f) { Expect.fail("This method should be overriden"); }
- void set setNull(Null n) { Expect.fail("This method should be overriden"); }
- void set setFutureOr(FutureOr f) { Expect.fail("This method should be overriden"); }
+ void set setNull (Null n) { Expect.fail("This method should be overriden"); }
+ void set setFutureOr(FutureOr f) { Expect.fail("This method should be overriden"); }
}
class OPTED_NONNULLABLE_SETTER {
- void set setInt(int i) { Expect.fail("This method should be overriden"); }
- void set setObject(Object o) { Expect.fail("This method should be overriden"); }
- void set setFunction(Function f) { Expect.fail("This method should be overriden"); }
+ void set setInt (int i ) { Expect.fail("This method should be overriden"); }
+ void set setObject (Object o ) { Expect.fail("This method should be overriden"); }
+ void set setFunction (Function f ) { Expect.fail("This method should be overriden"); }
void set setFutureOrInt(FutureOr<int> i) { Expect.fail("This method should be overriden"); }
}
@@ -103,18 +103,18 @@
}
class OPTED_NULLABLE_RETURN {
- int? getInt() => throw("This method should be overriden");
- Object? getObject() => throw("This method should be overriden");
- dynamic getDynamic() => throw("This method should be overriden");
+ int? getInt() => throw("This method should be overriden");
+ Object? getObject() => throw("This method should be overriden");
+ dynamic getDynamic() => throw("This method should be overriden");
Function? getFunction() => throw("This method should be overriden");
- Null getNull() => throw("This method should be overriden");
- FutureOr getFutureOr() => throw("This method should be overriden");
+ Null getNull() => throw("This method should be overriden");
+ FutureOr getFutureOr() => throw("This method should be overriden");
}
class OPTED_NONNULLABLE_RETURN {
- int getInt() => throw("This method should be overriden");
- Object getObject() => throw("This method should be overriden");
- Function getFunction() => throw("This method should be overriden");
+ int getInt() => throw("This method should be overriden");
+ Object getObject() => throw("This method should be overriden");
+ Function getFunction() => throw("This method should be overriden");
FutureOr<int> getFutureOrInt() => throw("This method should be overriden");
}
@@ -122,15 +122,15 @@
Never getNever() => throw("This method should be overriden");
}
-class OPTED_NONNULLABLE_INT<T extends int> {}
-class OPTED_NONNULLABLE_OBJECT<T extends Object> {}
+class OPTED_NONNULLABLE_INT <T extends int > {}
+class OPTED_NONNULLABLE_OBJECT <T extends Object > {}
class OPTED_NONNULLABLE_FUNCTION<T extends Function> {}
-class OPTED_NULLABLE<T> {}
-class OPTED_DYNAMIC<T extends dynamic> {}
-class OPTED_NULLABLE_INT<T extends int?> {}
-class OPTED_NULLABLE_OBJECT<T extends Object?> {}
+class OPTED_NULLABLE <T> {}
+class OPTED_DYNAMIC <T extends dynamic> {}
+class OPTED_NULLABLE_INT <T extends int?> {}
+class OPTED_NULLABLE_OBJECT <T extends Object?> {}
class OPTED_NULLABLE_FUNCTION<T extends Function?> {}
-class OPTED_NULL<T extends Null> {}
+class OPTED_NULL <T extends Null> {}
class OPTED_NEVER<T extends Never> {}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t10.dart b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t10.dart
index 57f09e3..b5acf71 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t10.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t10.dart
@@ -10,8 +10,8 @@
* to override otherwise incompatible signatures for a method.
*
* @description Check that if opted-in class extends legacy class, migrated
- * method with non-required non-nullable parameter cannot override legacy method
- * with named parameter (which is nullable) with default value.
+ * non-abstract method with non-required non-nullable parameter cannot override
+ * legacy method with named parameter (which is nullable) with default value.
*
* @author iarkh@unipro.ru
*/
@@ -19,20 +19,13 @@
// Requirements=nnbd-strong
import "override_checking_A02_legacy_lib.dart";
-class A1 extends LEGACY_REQUIRED_ARGS {
+class A extends LEGACY_REQUIRED_ARGS {
void test_default({int i}) {}
// ^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
}
-abstract class A2 extends LEGACY_REQUIRED_ARGS {
- void test_default({int i});
-// ^^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-}
-
main() {
- A1().test_default(i: 1);
+ A().test_default(i: 1);
}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t12.dart b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t12.dart
index 6704a0f..0dec1d8 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t12.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t12.dart
@@ -19,7 +19,7 @@
// Requirements=nnbd-strong
import "override_checking_A02_legacy_lib.dart";
-class A1 implements LEGACY_REQUIRED_ARGS {
+class A implements LEGACY_REQUIRED_ARGS {
void test_default({int i}) {}
// ^^^^^^^^^^^^
// [analyzer] unspecified
@@ -31,18 +31,6 @@
// [cfe] unspecified
}
-abstract class A2 implements LEGACY_REQUIRED_ARGS {
- void test_default({int i});
-// ^^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-
- void test_nondefault({int i}) {}
-// ^^^^^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-}
-
main() {
- A1().test_default(i: 1);
+ A().test_default(i: 1);
}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t14.dart b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t14.dart
index 16d4aad..d011e41 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t14.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t14.dart
@@ -19,20 +19,13 @@
// Requirements=nnbd-strong
import "override_checking_A02_legacy_lib.dart";
-class A1 with LEGACY_REQUIRED_ARGS {
+class A with LEGACY_REQUIRED_ARGS {
void test_default({int i}) {}
// ^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
}
-abstract class A2 with LEGACY_REQUIRED_ARGS {
- void test_default({int i});
-// ^^^^^^^^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
-}
-
main() {
- A1().test_default(i: 1);
+ A().test_default(i: 1);
}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t21.dart b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t21.dart
new file mode 100644
index 0000000..d1a988e
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t21.dart
@@ -0,0 +1,33 @@
+/*
+ * 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, migrated
+ * non-abstract method with non-required non-nullable parameter cannot override
+ * legacy method with named parameter (which is nullable) with default value.
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+// Requirements=nnbd-strong
+import "override_checking_A02_legacy_lib.dart";
+
+abstract class A extends LEGACY_REQUIRED_ARGS {
+ void test_default({int i}) {}
+// ^^^^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+class B extends A {}
+
+main() {
+ B().test_default(i: 1);
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t22.dart b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t22.dart
new file mode 100644
index 0000000..63a4431
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t22.dart
@@ -0,0 +1,36 @@
+/*
+ * 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, migrated
+ * abstract method with non-required non-nullable parameter can override legacy
+ * method with named parameter (which is nullable) with default value.
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+// Requirements=nnbd-strong
+
+import "../../Utils/expect.dart";
+import "override_checking_A02_legacy_lib.dart";
+
+abstract class A extends LEGACY_REQUIRED_ARGS {
+ void test_default({int i});
+}
+
+class B extends A {
+ void test_default({int i = 1}) {
+ Expect.equals(1, i);
+ }
+}
+
+main() {
+ B().test_default();
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t23.dart b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t23.dart
new file mode 100644
index 0000000..d49d66b
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t23.dart
@@ -0,0 +1,39 @@
+/*
+ * 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, migrated
+ * non-abstract method with non-required non-nullable parameter cannot override
+ * legacy method with named parameter (which is nullable) with default value.
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+// Requirements=nnbd-strong
+
+import "override_checking_A02_legacy_lib.dart";
+
+abstract class A implements LEGACY_REQUIRED_ARGS {
+ void test_default({int i}) {}
+// ^^^^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ void test_nondefault({int i}) {};
+// ^^^^^^^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+class B extends A {}
+
+main() {
+ B().test_default(i: 1);
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t24.dart b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t24.dart
new file mode 100644
index 0000000..a9974a2
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t24.dart
@@ -0,0 +1,36 @@
+/*
+ * 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, migrated
+ * abstract method with non-required non-nullable parameter can override legacy
+ * method with named parameter (which is nullable) with default value.
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+// Requirements=nnbd-strong
+
+import "../../Utils/expect.dart";
+import "override_checking_A02_legacy_lib.dart";
+
+abstract class A implements LEGACY_REQUIRED_ARGS {
+ void test_default({int i});
+ void test_nondefault({int i});
+}
+
+class B extends A {
+ void test_default ({int i = 1}) { Expect.equals(1, i); }
+ void test_nondefault({int i}) {}
+}
+
+main() {
+ B().test_default();
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t25.dart b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t25.dart
new file mode 100644
index 0000000..4282dd5
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t25.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 non-abstract method with non-required non-nullable parameter cannot
+ * override legacy method with named parameter (which is nullable) with default
+ * value.
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+// Requirements=nnbd-strong
+import "override_checking_A02_legacy_lib.dart";
+
+abstract class A with LEGACY_REQUIRED_ARGS {
+ void test_default({int i}) {}
+// ^^^^^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+class B extends A {}
+
+main() {
+ B().test_default(i: 1);
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t26.dart b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t26.dart
new file mode 100644
index 0000000..dfef818
--- /dev/null
+++ b/LanguageFeatures/nnbd/override_checking_A02_REQ_ARGS_t26.dart
@@ -0,0 +1,35 @@
+/*
+ * 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 abstract method with non-required non-nullable parameter can
+ * override legacy method with named parameter (which is nullable) with default
+ * value.
+ *
+ * @author iarkh@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+// Requirements=nnbd-strong
+
+import "../../Utils/expect.dart";
+import "override_checking_A02_legacy_lib.dart";
+
+abstract class A with LEGACY_REQUIRED_ARGS {
+ void test_default({int i});
+}
+
+class B extends A {
+ void test_default({int i = 1}) { Expect.equals(1, i); }
+}
+
+main() {
+ B().test_default();
+}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_legacy_futureor_lib.dart b/LanguageFeatures/nnbd/override_checking_A02_legacy_futureor_lib.dart
index 2144c52..2d3d5a2 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_legacy_futureor_lib.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_legacy_futureor_lib.dart
@@ -17,8 +17,8 @@
import "dart:async";
-class LEGACY_CLASS_FUTUREOR<T extends FutureOr> {}
+class LEGACY_CLASS_FUTUREOR <T extends FutureOr > {}
class LEGACY_CLASS_FUTUREORFUTUREOR<T extends FutureOr<FutureOr>> {}
-class LEGACY_CLASS_FUTUREORINT<T extends FutureOr<int>> {}
+class LEGACY_CLASS_FUTUREORINT <T extends FutureOr<int> > {}
class LEGACY_CLASS_FUTUREORFUNCTION<T extends FutureOr<Function>> {}
diff --git a/LanguageFeatures/nnbd/override_checking_A02_legacy_lib.dart b/LanguageFeatures/nnbd/override_checking_A02_legacy_lib.dart
index b148a1f..583b0f4 100644
--- a/LanguageFeatures/nnbd/override_checking_A02_legacy_lib.dart
+++ b/LanguageFeatures/nnbd/override_checking_A02_legacy_lib.dart
@@ -15,66 +15,66 @@
import "../../Utils/expect.dart";
class LEGACY_ARGS {
- void test_int(int i) { Expect.fail("This method should be overriden"); }
- void test_object(Object o) { Expect.fail("This method should be overriden"); }
- void test_dynamic(dynamic i) { Expect.fail("This method should be overriden"); }
+ void test_int (int i ) { Expect.fail("This method should be overriden"); }
+ void test_object (Object o ) { Expect.fail("This method should be overriden"); }
+ void test_dynamic (dynamic i ) { Expect.fail("This method should be overriden"); }
void test_function(Function f) { Expect.fail("This method should be overriden"); }
- void test_null(Null n) { Expect.fail("This method should be overriden"); }
+ void test_null (Null n ) { Expect.fail("This method should be overriden"); }
void test_futureOr(FutureOr i) { Expect.fail("This method should be overriden"); }
}
class LEGACY_REQUIRED_ARGS {
- void test_default({int i = 1}) { Expect.fail("This method should be overriden"); }
- void test_nondefault({int i}) { Expect.fail("This method should be overriden"); }
+ void test_default ({int i = 1}) { Expect.fail("This method should be overriden"); }
+ void test_nondefault({int i }) { Expect.fail("This method should be overriden"); }
}
class LEGACY_FIELD {
- int i;
- Object o;
- dynamic d;
- Function func;
- Null n;
- FutureOr f;
- FutureOr<int> fi;
+ int i;
+ Object o;
+ dynamic d;
+ Function func;
+ Null n;
+ FutureOr f;
+ FutureOr<int> fi;
FutureOr<Function> ff;
- void v;
+ void v;
}
class LEGACY_GETTER {
- int get getInt => throw("This method should be overriden");
- Object get getObject => throw("This method should be overriden");
- dynamic get getDynamic => throw("This method should be overriden");
- Function get getFunction => throw("This method should be overriden");
- Null get getNull => throw("This method should be overriden");
- FutureOr get getFutureOr => throw("This method should be overriden");
- FutureOr<int> get getFutureOrInt => throw("This method should be overriden");
+ int get getInt => throw("This method should be overriden");
+ Object get getObject => throw("This method should be overriden");
+ dynamic get getDynamic => throw("This method should be overriden");
+ Function get getFunction => throw("This method should be overriden");
+ Null get getNull => throw("This method should be overriden");
+ FutureOr get getFutureOr => throw("This method should be overriden");
+ FutureOr<int> get getFutureOrInt => throw("This method should be overriden");
FutureOr<Function> get getFutureOrFunction => throw("This method should be overriden");
}
class LEGACY_SETTER {
- void set setInt(int i) { Expect.fail("This method should be overriden"); }
- void set setObject(Object o) { Expect.fail("This method should be overriden"); }
- void set setDynamic(dynamic d) { Expect.fail("This method should be overriden"); }
- void set setNull(Null n) { Expect.fail("This method should be overriden"); }
- void set setFunction(Function f) { Expect.fail("This method should be overriden"); }
- void set setFutureOr(FutureOr f) { Expect.fail("This method should be overriden"); }
- void set setFutureOrInt(FutureOr<int> i) { Expect.fail("This method should be overriden"); }
+ void set setInt (int i) { Expect.fail("This method should be overriden"); }
+ void set setObject (Object o) { Expect.fail("This method should be overriden"); }
+ void set setDynamic (dynamic d) { Expect.fail("This method should be overriden"); }
+ void set setNull (Null n) { Expect.fail("This method should be overriden"); }
+ void set setFunction (Function f) { Expect.fail("This method should be overriden"); }
+ void set setFutureOr (FutureOr f) { Expect.fail("This method should be overriden"); }
+ void set setFutureOrInt (FutureOr<int> i) { Expect.fail("This method should be overriden"); }
void set setFutureOrFunction(FutureOr<Function> f) { Expect.fail("This method should be overriden"); }
}
class LEGACY_RETURN {
- int getInt() => throw("This method should be overriden");
- Object getObject() => throw("This method should be overriden");
- dynamic getDynamic() => throw("This method should be overriden");
- Function getFunction() => throw("This method should be overriden");
- Null getNull() => throw("This method should be overriden");
- FutureOr getFutureOr() => throw("This method should be overriden");
- FutureOr<int> getFutureOrInt() => throw("This method should be overriden");
+ int getInt() => throw("This method should be overriden");
+ Object getObject() => throw("This method should be overriden");
+ dynamic getDynamic() => throw("This method should be overriden");
+ Function getFunction() => throw("This method should be overriden");
+ Null getNull() => throw("This method should be overriden");
+ FutureOr getFutureOr() => throw("This method should be overriden");
+ FutureOr<int> getFutureOrInt() => throw("This method should be overriden");
FutureOr<Function> getFutureOrFunction() => throw("This method should be overriden");
}
-class LEGACY_CLASS<T> {}
-class LEGACY_CLASS_INT<T extends int> {}
-class LEGACY_CLASS_OBJECT<T extends Object> {}
-class LEGACY_CLASS_FUNCTION<T extends Function> {}
-class LEGACY_CLASS_NULL<T extends Null> {}
+class LEGACY_CLASS <T extends dynamic > {}
+class LEGACY_CLASS_INT <T extends int > {}
+class LEGACY_CLASS_OBJECT <T extends Object > {}
+class LEGACY_CLASS_FUNCTION<T extends Function> {}
+class LEGACY_CLASS_NULL <T extends Null > {}