#464. Added tests for legacy type fields
diff --git a/LanguageFeatures/nnbd/import_legacy_lib_A01_t01.dart b/LanguageFeatures/nnbd/import_legacy_lib_A01_t01.dart
new file mode 100644
index 0000000..a5c2e33
--- /dev/null
+++ b/LanguageFeatures/nnbd/import_legacy_lib_A01_t01.dart
@@ -0,0 +1,27 @@
+/*
+ * 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 The type system is extended with a notion of a legacy type
+ * operator. For every type T, there is an additional type T* which is the
+ * legacy version of the type. There is no surface syntax for legacy types, and
+ * implementations should display the legacy type T* in the same way that they
+ * would display the type T, except in so far as it is useful to communicate to
+ * programmers for the purposes of error messages that the type originates in
+ * unmigrated code.
+ *
+ * @description Check that all fields of legacy type T* are nullable
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+import "legacy_library_lib.dart";
+
+main() {
+ A? a1 = new A();
+ a1.text = null;
+
+ A a2 = new A();
+ a2.text = null;
+}
diff --git a/LanguageFeatures/nnbd/import_legacy_lib_A01_t02.dart b/LanguageFeatures/nnbd/import_legacy_lib_A01_t02.dart
new file mode 100644
index 0000000..862566c
--- /dev/null
+++ b/LanguageFeatures/nnbd/import_legacy_lib_A01_t02.dart
@@ -0,0 +1,28 @@
+/*
+ * 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 The type system is extended with a notion of a legacy type
+ * operator. For every type T, there is an additional type T* which is the
+ * legacy version of the type. There is no surface syntax for legacy types, and
+ * implementations should display the legacy type T* in the same way that they
+ * would display the type T, except in so far as it is useful to communicate to
+ * programmers for the purposes of error messages that the type originates in
+ * unmigrated code.
+ *
+ * @description Check that all fields of legacy type T* are nullable. Test
+ * generics
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+import "legacy_library_lib.dart";
+
+main() {
+ A? a = null;
+
+ C<A?> c = new C(a);
+ c.x = new A();
+ c.x = null;
+}
diff --git a/LanguageFeatures/nnbd/import_legacy_lib_A01_t03.dart b/LanguageFeatures/nnbd/import_legacy_lib_A01_t03.dart
new file mode 100644
index 0000000..0b4641e
--- /dev/null
+++ b/LanguageFeatures/nnbd/import_legacy_lib_A01_t03.dart
@@ -0,0 +1,30 @@
+/*
+ * 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 The type system is extended with a notion of a legacy type
+ * operator. For every type T, there is an additional type T* which is the
+ * legacy version of the type. There is no surface syntax for legacy types, and
+ * implementations should display the legacy type T* in the same way that they
+ * would display the type T, except in so far as it is useful to communicate to
+ * programmers for the purposes of error messages that the type originates in
+ * unmigrated code.
+ *
+ * @description Check that all fields of legacy type T* are nullable. Test
+ * generics
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+import "legacy_library_lib.dart";
+
+main() {
+ A a = new A();
+
+ C<A> c = new C(a);
+ c.x = null;
+// ^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
diff --git a/LanguageFeatures/nnbd/import_legacy_lib_A01_t04.dart b/LanguageFeatures/nnbd/import_legacy_lib_A01_t04.dart
new file mode 100644
index 0000000..a8dbf02
--- /dev/null
+++ b/LanguageFeatures/nnbd/import_legacy_lib_A01_t04.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 The type system is extended with a notion of a legacy type
+ * operator. For every type T, there is an additional type T* which is the
+ * legacy version of the type. There is no surface syntax for legacy types, and
+ * implementations should display the legacy type T* in the same way that they
+ * would display the type T, except in so far as it is useful to communicate to
+ * programmers for the purposes of error messages that the type originates in
+ * unmigrated code.
+ *
+ * @description Check that all fields of legacy type T* are nullable. Test
+ * the case when opted in class extends legacy one
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+import "legacy_library_lib.dart";
+
+class B extends A {
+}
+
+main() {
+ B b = new B();
+
+ C<B> c = new C(b);
+ c.x = null;
+// ^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
diff --git a/LanguageFeatures/nnbd/import_legacy_lib_A01_t05.dart b/LanguageFeatures/nnbd/import_legacy_lib_A01_t05.dart
new file mode 100644
index 0000000..ab661fd
--- /dev/null
+++ b/LanguageFeatures/nnbd/import_legacy_lib_A01_t05.dart
@@ -0,0 +1,30 @@
+/*
+ * 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 The type system is extended with a notion of a legacy type
+ * operator. For every type T, there is an additional type T* which is the
+ * legacy version of the type. There is no surface syntax for legacy types, and
+ * implementations should display the legacy type T* in the same way that they
+ * would display the type T, except in so far as it is useful to communicate to
+ * programmers for the purposes of error messages that the type originates in
+ * unmigrated code.
+ *
+ * @description Check that all fields of legacy type T* are nullable. Test
+ * the case when opted in class extends legacy one
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+import "legacy_library_lib.dart";
+
+class B extends A {
+}
+
+main() {
+ B? b = new B();
+
+ C<B?> c = new C(b);
+ c.x = null;
+}
diff --git a/LanguageFeatures/nnbd/import_legacy_lib_A01_t06.dart b/LanguageFeatures/nnbd/import_legacy_lib_A01_t06.dart
new file mode 100644
index 0000000..38f5311
--- /dev/null
+++ b/LanguageFeatures/nnbd/import_legacy_lib_A01_t06.dart
@@ -0,0 +1,26 @@
+/*
+ * 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 The type system is extended with a notion of a legacy type
+ * operator. For every type T, there is an additional type T* which is the
+ * legacy version of the type. There is no surface syntax for legacy types, and
+ * implementations should display the legacy type T* in the same way that they
+ * would display the type T, except in so far as it is useful to communicate to
+ * programmers for the purposes of error messages that the type originates in
+ * unmigrated code.
+ *
+ * @description Check that all fields of legacy type T* are nullable. Test mixin
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+import "legacy_library_lib.dart";
+
+class B extends A with Mx {}
+
+main() {
+ B b = new B();
+ b.iMx = null;
+}
diff --git a/LanguageFeatures/nnbd/import_legacy_lib_A01_t07.dart b/LanguageFeatures/nnbd/import_legacy_lib_A01_t07.dart
new file mode 100644
index 0000000..2b10352
--- /dev/null
+++ b/LanguageFeatures/nnbd/import_legacy_lib_A01_t07.dart
@@ -0,0 +1,29 @@
+/*
+ * 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 The type system is extended with a notion of a legacy type
+ * operator. For every type T, there is an additional type T* which is the
+ * legacy version of the type. There is no surface syntax for legacy types, and
+ * implementations should display the legacy type T* in the same way that they
+ * would display the type T, except in so far as it is useful to communicate to
+ * programmers for the purposes of error messages that the type originates in
+ * unmigrated code.
+ *
+ * @description Check that all fields of legacy type T* are nullable.
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+import "legacy_library_lib.dart";
+
+class B extends A with Mx {
+}
+
+main() {
+ B b = new B();
+ C<B> c = new C(b);
+ c.x.text = null;
+ c.x.iMx = null;
+}
diff --git a/LanguageFeatures/nnbd/import_legacy_lib_A01_t08.dart b/LanguageFeatures/nnbd/import_legacy_lib_A01_t08.dart
new file mode 100644
index 0000000..1aa7649
--- /dev/null
+++ b/LanguageFeatures/nnbd/import_legacy_lib_A01_t08.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 The type system is extended with a notion of a legacy type
+ * operator. For every type T, there is an additional type T* which is the
+ * legacy version of the type. There is no surface syntax for legacy types, and
+ * implementations should display the legacy type T* in the same way that they
+ * would display the type T, except in so far as it is useful to communicate to
+ * programmers for the purposes of error messages that the type originates in
+ * unmigrated code.
+ *
+ * @description Check that all fields of legacy type T* are nullable.
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+import "legacy_library_lib.dart";
+
+class B extends A with Mx {
+ String bStr = "Lily was here";
+}
+
+main() {
+ B b = new B();
+ C<B> c = new C(b);
+ c.x.text = null;
+ c.x.iMx = null;
+ c.x.bStr = null;
+// ^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
diff --git a/LanguageFeatures/nnbd/import_legacy_lib_A01_t09.dart b/LanguageFeatures/nnbd/import_legacy_lib_A01_t09.dart
new file mode 100644
index 0000000..374f669
--- /dev/null
+++ b/LanguageFeatures/nnbd/import_legacy_lib_A01_t09.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 The type system is extended with a notion of a legacy type
+ * operator. For every type T, there is an additional type T* which is the
+ * legacy version of the type. There is no surface syntax for legacy types, and
+ * implementations should display the legacy type T* in the same way that they
+ * would display the type T, except in so far as it is useful to communicate to
+ * programmers for the purposes of error messages that the type originates in
+ * unmigrated code.
+ *
+ * @description Check that all fields of legacy type T* are nullable.
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+import "legacy_library_lib.dart";
+
+class MyMx {
+ String sMx = "Let it be";
+}
+
+class B extends A with MyMx {
+}
+
+main() {
+ B b = new B();
+ C<B> c = new C(b);
+ c.x.text = null;
+ c.x.sMx = null;
+// ^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
diff --git a/LanguageFeatures/nnbd/import_legacy_lib_A01_t10.dart b/LanguageFeatures/nnbd/import_legacy_lib_A01_t10.dart
new file mode 100644
index 0000000..197954e
--- /dev/null
+++ b/LanguageFeatures/nnbd/import_legacy_lib_A01_t10.dart
@@ -0,0 +1,30 @@
+/*
+ * 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 The type system is extended with a notion of a legacy type
+ * operator. For every type T, there is an additional type T* which is the
+ * legacy version of the type. There is no surface syntax for legacy types, and
+ * implementations should display the legacy type T* in the same way that they
+ * would display the type T, except in so far as it is useful to communicate to
+ * programmers for the purposes of error messages that the type originates in
+ * unmigrated code.
+ *
+ * @description Check that all fields of legacy type T* are nullable.
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+import "legacy_library_lib.dart";
+
+class B extends A with Mxn {
+}
+
+main() {
+ B b = new B();
+ C<B> c = new C(b);
+ c.x.text = null;
+ c.x.text = null;
+ c.x.sMxn = null;
+}
diff --git a/LanguageFeatures/nnbd/import_legacy_lib_A02_t01.dart b/LanguageFeatures/nnbd/import_legacy_lib_A02_t01.dart
new file mode 100644
index 0000000..f51b011
--- /dev/null
+++ b/LanguageFeatures/nnbd/import_legacy_lib_A02_t01.dart
@@ -0,0 +1,26 @@
+/*
+ * 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 The type system is extended with a notion of a legacy type
+ * operator. For every type T, there is an additional type T* which is the
+ * legacy version of the type. There is no surface syntax for legacy types, and
+ * implementations should display the legacy type T* in the same way that they
+ * would display the type T, except in so far as it is useful to communicate to
+ * programmers for the purposes of error messages that the type originates in
+ * unmigrated code.
+ *
+ * @description Check that all variables, declared in a legacy library are
+ * nullable
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+import "legacy_library_lib.dart";
+
+main() {
+ iLegacy = null;
+ sLegacy = null;
+ aLegacy = null;
+}
diff --git a/LanguageFeatures/nnbd/legacy_library_lib.dart b/LanguageFeatures/nnbd/legacy_library_lib.dart
index 773388e..96acf29 100644
--- a/LanguageFeatures/nnbd/legacy_library_lib.dart
+++ b/LanguageFeatures/nnbd/legacy_library_lib.dart
@@ -10,7 +10,7 @@
// SharedOptions=--enable-experiment=non-nullable
library legacy_library_lib;
-class A {
+class A implements AMx {
void foo() {}
String test() => "Lily was here";
String text = "Let it be";
@@ -26,8 +26,24 @@
class M {
}
+class Mx {
+ int iMx = 42;
+}
+
+class AMx {
+ String text = "No woman, no cry";
+}
+
+mixin Mxn on AMx {
+ String sMxn = "Show must go on";
+}
+
abstract class I {}
class Const {
const Const();
}
+
+int iLegacy = 42;
+String sLegacy = "Yesterday, All my troubles seemed so far away";
+A aLegacy = new A();