#460. NNBD null-promotion tests fixed, renamed and wrong ones deleted
diff --git a/LanguageFeatures/nnbd/Null_promotion_A01_t06.dart b/LanguageFeatures/nnbd/Null_promotion_A01_t06.dart
deleted file mode 100644
index 35ed286..0000000
--- a/LanguageFeatures/nnbd/Null_promotion_A01_t06.dart
+++ /dev/null
@@ -1,62 +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 A check of the form [e == null] or of the form [e is Null] where
- * [e] has static type [T] promotes the type of [e] to [Null] in the [true]
- * continuation, and to [NonNull(T)] in the [false] continuation.
- *
- * @description Check that [e] is promoted to [NonNull(T)] in the [false]
- * condition.
- * @author iarkh@unipro.ru
- * @author sgrekhov@unipro.ru
- */
-// SharedOptions=--enable-experiment=non-nullable
-
-class A {
- foo() {}
-}
-
-class B<T> {
- bar() {}
-}
-
-main() {
- A? a = new A();
- if (a == null) {
- } else {
- a = null;
-// ^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
- }
-
- B? b1 = new B();
- if (b1 == null) {
- } else {
- b1 = null;
-// ^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
- }
-
- B<int>? b2 = new B<int>();
- if (b2 == null) {
- } else {
- b2 = null;
-// ^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
- }
-
- int? i = 42;
- if (i == null) {
- } else {
- i = null;
-// ^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
- }
-}
diff --git a/LanguageFeatures/nnbd/Null_promotion_A02_t01.dart b/LanguageFeatures/nnbd/Null_promotion_A02_t01.dart
deleted file mode 100644
index 8ad2012..0000000
--- a/LanguageFeatures/nnbd/Null_promotion_A02_t01.dart
+++ /dev/null
@@ -1,50 +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 A check of the form [e != null] or of the form [e is T] where [e]
- * has static type [T?] promotes the type of [e] to [T] in the [true]
- * continuation, and to [Null] in the [false] continuation.
- *
- * @description Check that type of [e] is promoted to [T] in the [true]
- * condition.
- * @author iarkh@unipro.ru
- */
-// SharedOptions=--enable-experiment=non-nullable,nonfunction-type-aliases
-
-import "../../Utils/expect.dart";
-
-class A {}
-class B<T> {}
-
-typedef AA = A;
-typedef AAA = A?;
-
-void checkme(var x, var expectedType) {
- Expect.isTrue(x != null);
- Expect.isTrue(x is expectedType);
-}
-
-main() {
- A ? a = A();
- checkme(a, A);
-
- B ? b1 = B();
- checkme(b1, B);
-
- B<int> ? b2 = B<int>();
- checkme(b2, B);
-
- Object ? o = 12345;
- checkme(o, Object);
-
- AA ? aa = A();
- checkme(aa, AA);
- checkme(aa, A);
-
- AAA aaa = A();
- checkme(aaa, AAA);
- checkme(aaa, A);
-}
diff --git a/LanguageFeatures/nnbd/Null_promotion_A02_t02.dart b/LanguageFeatures/nnbd/Null_promotion_A02_t02.dart
deleted file mode 100644
index 6496f2d..0000000
--- a/LanguageFeatures/nnbd/Null_promotion_A02_t02.dart
+++ /dev/null
@@ -1,55 +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 A check of the form [e != null] or of the form [e is T] where [e]
- * has static type [T?] promotes the type of [e] to [T] in the [true]
- * continuation, and to [Null] in the [false] continuation.
- *
- * @description Check that type of [e] is promoted to [Null] in the [false]
- * condition.
- * @author iarkh@unipro.ru
- */
-// SharedOptions=--enable-experiment=non-nullable,nonfunction-type-aliases
-
-import "../../Utils/expect.dart";
-
-class A {}
-class B<T> {}
-
-typedef AA = A;
-typedef AAA = A?;
-
-void checkme(var x, var expectedType) {
- Expect.isFalse(x != null);
- Expect.isFalse(x is expectedType);
-}
-
-main() {
- Expect.isFalse(null != null);
-
- A ? a = null;
- checkme(a, A);
-
- B? b1 = null;
- checkme(b1, B);
-
- B<int> ? b2 = null;
- checkme(b2, B);
-
- dynamic ? d = null;
- checkme(d, dynamic);
-
- Object ? o = null;
- checkme(o, Object);
-
- AA ? aa = null;
- checkme(aa, AA);
- checkme(aa, A);
-
- AAA aaa = null;
- checkme(aaa, AAA);
- checkme(aaa, A);
-}
diff --git a/LanguageFeatures/nnbd/Null_promotion_A03_t01.dart b/LanguageFeatures/nnbd/Null_promotion_A03_t01.dart
deleted file mode 100644
index c90731d..0000000
--- a/LanguageFeatures/nnbd/Null_promotion_A03_t01.dart
+++ /dev/null
@@ -1,38 +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 The static type of an expression [e!] is [NonNull(T)] where [T] is
- * the static type of [e].
- *
- * @description Check that [e!] is [NonNull(T)] if [e] is of static type [T}.
- * @author iarkh@unipro.ru
- */
-// SharedOptions=--enable-experiment=non-nullable,nonfunction-type-aliases
-
-import "../../Utils/expect.dart";
-
-class A {}
-class B<T> {}
-
-typedef AA = A;
-typedef AAA = A?;
-
-main() {
- A a = A();
- Expect.isTrue(a! is NonNull(A));
-
- B b1 = B();
- Expect.isTrue(b1! is NonNull(B));
-
- B<int> b2 = B<int>();
- Expect.isTrue(b2! is NonNull(B<int>));
-
- AA aa = AA();
- Expect.isTrue(aa! is NonNull(AA));
-
- AAA aaa = AAA();
- Expect.isTrue(aaa! is NonNull(AAA));
-}
diff --git a/LanguageFeatures/nnbd/Null_promotion_A04_t01.dart b/LanguageFeatures/nnbd/Null_promotion_A04_t01.dart
deleted file mode 100644
index b7713c3..0000000
--- a/LanguageFeatures/nnbd/Null_promotion_A04_t01.dart
+++ /dev/null
@@ -1,20 +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 The NonNull function defines the null-promoted version of a type,
- * and is defined as follows.
- * NonNull(Null) = Never
- *
- * @description Check that NonNull(Null) = Never.
- * @author iarkh@unipro.ru
- */
-// SharedOptions=--enable-experiment=non-nullable
-
-import "../../Utils/expect.dart";
-
-main() {
- Expect.isTrue(NonNull(int) == int);
-}
diff --git a/LanguageFeatures/nnbd/Null_promotion_A01_t01.dart b/LanguageFeatures/nnbd/null_promotion_A01_t01.dart
similarity index 100%
rename from LanguageFeatures/nnbd/Null_promotion_A01_t01.dart
rename to LanguageFeatures/nnbd/null_promotion_A01_t01.dart
diff --git a/LanguageFeatures/nnbd/Null_promotion_A01_t02.dart b/LanguageFeatures/nnbd/null_promotion_A01_t02.dart
similarity index 100%
rename from LanguageFeatures/nnbd/Null_promotion_A01_t02.dart
rename to LanguageFeatures/nnbd/null_promotion_A01_t02.dart
diff --git a/LanguageFeatures/nnbd/null_promotion_A01_t03.dart b/LanguageFeatures/nnbd/null_promotion_A01_t03.dart
new file mode 100644
index 0000000..cda52f2
--- /dev/null
+++ b/LanguageFeatures/nnbd/null_promotion_A01_t03.dart
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+ * for details. All rights reserved. Use of this source code is governed by a
+ * BSD-style license that can be found in the LICENSE file.
+ */
+/**
+ * @assertion A check of the form [e == null] or of the form [e is Null] where
+ * [e] has static type [T] promotes the type of [e] to [Null] in the [true]
+ * continuation, and to [NonNull(T)] in the [false] continuation.
+ *
+ * @description Check that [e] is promoted to [Null] in the [true] condition.
+ * Test type aliases
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable,nonfunction-type-aliases
+
+class A {
+ foo() {}
+}
+
+typedef AAlias1 = A?
+typedef AAlias2 = AAlias1?
+
+dynamic init() => null;
+
+main() {
+ AAlias1 a1 = init();
+ if (a1 is Null) {
+ a1.foo();
+// ^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ }
+
+ if (a1 == null) {
+ a1.foo();
+// ^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ }
+
+ AAlias2? a2 = init();
+ if (a2 is Null) {
+ a2.foo();
+// ^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ }
+
+ if (a2 == null) {
+ a2.foo();
+// ^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ }
+}
diff --git a/LanguageFeatures/nnbd/null_promotion_A01_t04.dart b/LanguageFeatures/nnbd/null_promotion_A01_t04.dart
new file mode 100644
index 0000000..daa752b
--- /dev/null
+++ b/LanguageFeatures/nnbd/null_promotion_A01_t04.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 A check of the form [e == null] or of the form [e is Null] where
+ * [e] has static type [T] promotes the type of [e] to [Null] in the [true]
+ * continuation, and to [NonNull(T)] in the [false] continuation.
+ *
+ * @description Check that [e] is promoted to [Null] in the [true] condition.
+ * Test pre-NNBD legacy types
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+import "legacy_library_lib.dart";
+
+dynamic init() => null;
+
+main() {
+ A a = init();
+ if (a is Null) {
+ a.foo();
+// ^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ }
+
+ if (a == null) {
+ a.foo();
+// ^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ }
+}
diff --git a/LanguageFeatures/nnbd/null_promotion_A01_t05.dart b/LanguageFeatures/nnbd/null_promotion_A01_t05.dart
new file mode 100644
index 0000000..d020f99
--- /dev/null
+++ b/LanguageFeatures/nnbd/null_promotion_A01_t05.dart
@@ -0,0 +1,53 @@
+/*
+ * 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 A check of the form [e == null] or of the form [e is Null] where
+ * [e] has static type [T] promotes the type of [e] to [Null] in the [true]
+ * continuation, and to [NonNull(T)] in the [false] continuation.
+ *
+ * @description Check that [e] is promoted to [Null] in the [true] condition.
+ * Test pre-NNBD legacy types and type aliases
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable,nonfunction-type-aliases
+import "legacy_library_lib.dart";
+import "legacy_library_aliases_lib.dart" as legacy;
+
+dynamic init() => null;
+
+typedef AAlias = A;
+
+main() {
+ AAlias a1 = init();
+ if (a1 is Null) {
+ a1.foo();
+// ^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ }
+
+ if (a1 == null) {
+ a1.foo();
+// ^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ }
+
+ legacy.AAlias a2 = init();
+ if (a2 is Null) {
+ a2.bar();
+// ^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ }
+
+ if (a2 == null) {
+ a2.bar();
+// ^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ }
+}
diff --git a/LanguageFeatures/nnbd/null_promotion_A02_t01.dart b/LanguageFeatures/nnbd/null_promotion_A02_t01.dart
new file mode 100644
index 0000000..393cf39
--- /dev/null
+++ b/LanguageFeatures/nnbd/null_promotion_A02_t01.dart
@@ -0,0 +1,62 @@
+/*
+ * 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 A check of the form [e != null] or of the form [e is T] where [e]
+ * has static type [T?] promotes the type of [e] to [T] in the [true]
+ * continuation, and to [Null] in the [false] continuation.
+ *
+ * @description Check that type of [e] is promoted to [Null] in the [false]
+ * condition. Test [e != null] expression
+ * @author iarkh@unipro.ru
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+
+class A {
+ foo() {}
+}
+
+class B<T> {
+ bar() {}
+}
+
+main() {
+ A? a = new A();
+ if (a != null) {
+ } else {
+ a.foo();
+// ^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ }
+
+ B? b1 = new B();
+ if (b1 != null) {
+ } else {
+ b1.bar();
+// ^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ }
+
+ B<int>? b2 = new B<int>();
+ if (b2 != null) {
+ } else {
+ b2.bar();
+// ^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ }
+
+ int? i = 42;
+ if (i != null) {
+ } else {
+ i.isOdd;
+// ^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ }
+}
diff --git a/LanguageFeatures/nnbd/null_promotion_A02_t02.dart b/LanguageFeatures/nnbd/null_promotion_A02_t02.dart
new file mode 100644
index 0000000..113cc1a
--- /dev/null
+++ b/LanguageFeatures/nnbd/null_promotion_A02_t02.dart
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+ * for details. All rights reserved. Use of this source code is governed by a
+ * BSD-style license that can be found in the LICENSE file.
+ */
+/**
+ * @assertion A check of the form [e != null] or of the form [e is T] where [e]
+ * has static type [T?] promotes the type of [e] to [T] in the [true]
+ * continuation, and to [Null] in the [false] continuation.
+ *
+ * @description Check that type of [e] is promoted to [T] in the [true]
+ * condition. Test [e is T] expression
+ * @author iarkh@unipro.ru
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+
+class A {
+ foo() {}
+}
+
+class B<T> {
+ bar() {}
+}
+
+main() {
+ A? a = new A();
+ if (a is A) {
+ a.foo();
+ }
+
+ B? b1 = new B();
+ if (b1 is B) {
+ b1.bar();
+ }
+
+ B<int>? b2 = new B<int>();
+ if (b2 is B<int>()) {
+ b2.bar();
+ }
+
+ int? i = 42;
+ if (i is int) {
+ i.isOdd;
+ }
+}
diff --git a/LanguageFeatures/nnbd/null_promotion_A02_t03.dart b/LanguageFeatures/nnbd/null_promotion_A02_t03.dart
new file mode 100644
index 0000000..efa3373
--- /dev/null
+++ b/LanguageFeatures/nnbd/null_promotion_A02_t03.dart
@@ -0,0 +1,43 @@
+/*
+ * 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 A check of the form [e != null] or of the form [e is T] where [e]
+ * has static type [T?] promotes the type of [e] to [T] in the [true]
+ * continuation, and to [Null] in the [false] continuation.
+ *
+ * @description Check that type of [e] is promoted to [Null] in the [false]
+ * condition. Test [e != null] expression. Test type aliases
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable,nonfunction-type-aliases
+
+class A {
+ foo() {}
+}
+
+typedef AAlias1 = A?
+typedef AAlias2 = AAlias1?
+
+main() {
+ AAlias1 a1 = new A();
+ if (a1 != null) {
+ } else {
+ a1.foo();
+// ^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ }
+
+ AAlias2? a2 = init();
+
+ if (a2 != null) {
+ } else {
+ a2.foo();
+// ^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ }
+}
diff --git a/LanguageFeatures/nnbd/null_promotion_A02_t04.dart b/LanguageFeatures/nnbd/null_promotion_A02_t04.dart
new file mode 100644
index 0000000..2aeef83
--- /dev/null
+++ b/LanguageFeatures/nnbd/null_promotion_A02_t04.dart
@@ -0,0 +1,51 @@
+/*
+ * 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 A check of the form [e != null] or of the form [e is T] where [e]
+ * has static type [T?] promotes the type of [e] to [T] in the [true]
+ * continuation, and to [Null] in the [false] continuation.
+ *
+ * @description Check that type of [e] is promoted to [T] in the [true]
+ * condition. Test [e is T] expression. Test type aliases
+ * @author iarkh@unipro.ru
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable,nonfunction-type-aliases
+
+class A {
+ foo() {}
+}
+
+class B<T> {
+ bar() {}
+}
+
+typedef AAlias = A?;
+typedef BAlias1 = B?;
+typedef BAlias2 = B<int>?;
+typedef IntAlias = int?;
+
+main() {
+ AAlias a = new A();
+ if (a is A) {
+ a.foo();
+ }
+
+ BAlias1 b1 = new B();
+ if (b1 is B) {
+ b1.bar();
+ }
+
+ BAlias2 b2 = new B<int>();
+ if (b2 is B<int>()) {
+ b2.bar();
+ }
+
+ IntAlias i = 42;
+ if (i is int) {
+ i.isOdd;
+ }
+}
diff --git a/LanguageFeatures/nnbd/null_promotion_A02_t05.dart b/LanguageFeatures/nnbd/null_promotion_A02_t05.dart
new file mode 100644
index 0000000..9c0b1ed
--- /dev/null
+++ b/LanguageFeatures/nnbd/null_promotion_A02_t05.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 A check of the form [e != null] or of the form [e is T] where [e]
+ * has static type [T?] promotes the type of [e] to [T] in the [true]
+ * continuation, and to [Null] in the [false] continuation.
+ *
+ * @description Check that type of [e] is promoted to [Null] in the [false]
+ * condition. Test [e != null] expression. Test pre-NNBD legacy types
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+import "legacy_library_lib.dart";
+
+main() {
+ A a = new A();
+
+ if (a != null) {
+ } else {
+ a.foo();
+// ^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ }
+}
diff --git a/LanguageFeatures/nnbd/null_promotion_A02_t06.dart b/LanguageFeatures/nnbd/null_promotion_A02_t06.dart
new file mode 100644
index 0000000..8e23b32
--- /dev/null
+++ b/LanguageFeatures/nnbd/null_promotion_A02_t06.dart
@@ -0,0 +1,41 @@
+/*
+ * 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 A check of the form [e != null] or of the form [e is T] where [e]
+ * has static type [T?] promotes the type of [e] to [T] in the [true]
+ * continuation, and to [Null] in the [false] continuation.
+ *
+ * @description Check that type of [e] is promoted to [Null] in the [false]
+ * condition. Test [e != null] expression. Test pre-NNBD legacy types and type
+ * aliases
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+import "legacy_library_lib.dart";
+import "legacy_library_aliases_lib.dart" as aliases;
+
+typedef AAlias = A;
+
+main() {
+ AAlias a = new A();
+
+ if (a != null) {
+ } else {
+ a.foo();
+// ^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ }
+
+ aliases.AAlias a2 = aliases.A();
+ if (a2 != null) {
+ } else {
+ a2.bar();
+// ^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ }
+}