#458. Null-aware operators tests added
diff --git a/LanguageFeatures/nnbd/legacy_library_aliases_lib.dart b/LanguageFeatures/nnbd/legacy_library_aliases_lib.dart
index 7bb986e..8b782ea 100644
--- a/LanguageFeatures/nnbd/legacy_library_aliases_lib.dart
+++ b/LanguageFeatures/nnbd/legacy_library_aliases_lib.dart
@@ -6,7 +6,7 @@
/**
* @author sgrekhov@unipro.ru
*/
-// @dart=2.5
+// @dart=2.4
// SharedOptions=--enable-experiment=non-nullable,nonfunction-type-aliases
library legacy_library_aliases_lib;
diff --git a/LanguageFeatures/nnbd/legacy_library_lib.dart b/LanguageFeatures/nnbd/legacy_library_lib.dart
index 4ae001b..3ec7332 100644
--- a/LanguageFeatures/nnbd/legacy_library_lib.dart
+++ b/LanguageFeatures/nnbd/legacy_library_lib.dart
@@ -6,13 +6,16 @@
/**
* @author sgrekhov@unipro.ru
*/
-// @dart=2.5
+// @dart=2.4
// SharedOptions=--enable-experiment=non-nullable
library legacy_library_lib;
class A {
void foo() {}
+ String test() => "Lily was here";
+ String text = "Let it be";
int operator[](int index) => index;
+ void operator[]=(int index, var value) => value;
}
class C<X extends A> {
diff --git a/LanguageFeatures/nnbd/null_aware_operator_A01_t01.dart b/LanguageFeatures/nnbd/null_aware_operator_A01_t01.dart
index 17df51e..32c3de1 100644
--- a/LanguageFeatures/nnbd/null_aware_operator_A01_t01.dart
+++ b/LanguageFeatures/nnbd/null_aware_operator_A01_t01.dart
@@ -15,17 +15,17 @@
import "../../Utils/expect.dart";
class A {
- String test() => "Lily was here";
+ String test = "Lily was here";
}
main() {
A? a = null;
- Expect.isNull(a?.test());
+ Expect.isNull(a?.test);
a = new A();
- Expect.equals("Lily was here", a?.test());
+ Expect.equals("Lily was here", a?.test);
String? s = null;
- Expect.isNull(s?.toString());
+ Expect.isNull(s?.hashCode );
s = "Let it be";
- Expect.equals("Let it be", s?.toString());
+ Expect.isNotNull(s?.hashCode );
}
diff --git a/LanguageFeatures/nnbd/null_aware_operator_A01_t02.dart b/LanguageFeatures/nnbd/null_aware_operator_A01_t02.dart
index 171ec91..c0bb60e 100644
--- a/LanguageFeatures/nnbd/null_aware_operator_A01_t02.dart
+++ b/LanguageFeatures/nnbd/null_aware_operator_A01_t02.dart
@@ -9,22 +9,22 @@
*
* @description Check that a property access e?.f translates to:
* SHORT[EXP(e), fn[x] => x.f]
- * @static-warning
+ * @static-warning
* @author sgrekhov@unipro.ru
*/
// SharedOptions=--enable-experiment=non-nullable
import "../../Utils/expect.dart";
class A {
- String test() => "Lily was here";
+ String test = "Lily was here";
}
main() {
A a = Never;
- Expect.isNotNull(a?.toString()); /// static type warning
+ Expect.isNotNull(a?.hashCode); /// static type warning
a = new A();
- Expect.equals("Lily was here", a?.test()); /// static type warning
+ Expect.equals("Lily was here", a?.test); /// static type warning
String s = "Let it be";
- Expect.equals("Let it be", s?.toString()); /// static type warning
+ Expect.isNotNull(s?.hashCode); /// static type warning
}
diff --git a/LanguageFeatures/nnbd/null_aware_operator_A01_t03.dart b/LanguageFeatures/nnbd/null_aware_operator_A01_t03.dart
new file mode 100644
index 0000000..c9cc344
--- /dev/null
+++ b/LanguageFeatures/nnbd/null_aware_operator_A01_t03.dart
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+ * for details. All rights reserved. Use of this source code is governed by a
+ * BSD-style license that can be found in the LICENSE file.
+ */
+/**
+ * @assertion A property access e?.f translates to:
+ * SHORT[EXP(e), fn[x] => x.f]
+ *
+ * @description Check that a property access e?.f translates to:
+ * SHORT[EXP(e), fn[x] => x.f]. Test type aliases
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable,nonfunction-type-aliases
+import "../../Utils/expect.dart";
+
+class A {
+ String test = "Lily was here";
+}
+
+typedef AAlias1 = A?;
+typedef AAlias2 = A;
+typedef StringAlias1 = String?;
+typedef StringAlias2 = String;
+
+main() {
+ AAlias1 a1 = null;
+ Expect.isNull(a1?.test);
+ a1 = new A();
+ Expect.equals("Lily was here", a1?.test);
+
+ StringAlias1 s = null;
+ Expect.isNull(s?.hashCode);
+ s = "Let it be";
+ Expect.isNotNull(s?.hashCode);
+
+ AAlias2 a2 = Never;
+ Expect.isNotNull(a2?.hashCode); /// static type warning
+ a2 = new A();
+ Expect.equals("Lily was here", a2?.test); /// static type warning
+
+ StringAlias2 s2 = "Let it be";
+ Expect.isNotNull(s2?.hashCode); /// static type warning
+}
diff --git a/LanguageFeatures/nnbd/null_aware_operator_A01_t04.dart b/LanguageFeatures/nnbd/null_aware_operator_A01_t04.dart
new file mode 100644
index 0000000..81ad38a
--- /dev/null
+++ b/LanguageFeatures/nnbd/null_aware_operator_A01_t04.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 A property access e?.f translates to:
+ * SHORT[EXP(e), fn[x] => x.f]
+ *
+ * @description Check that a property access e?.f translates to:
+ * SHORT[EXP(e), fn[x] => x.f]. Test legacy pre-NNBD types
+ * @static-warning
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+import "../../Utils/expect.dart";
+import "legacy_library_lib.dart";
+
+main() {
+ A? a1 = null;
+ Expect.isNull(a1?.text);
+ a1 = new A();
+ Expect.equals("Let it be", a1?.text);
+
+ A a2 = Never;
+ Expect.isNotNull(a2?.hashCode); /// static type warning
+ a2 = new A();
+ Expect.equals("Let it be", a2?.text); /// static type warning
+}
diff --git a/LanguageFeatures/nnbd/null_aware_operator_A03_t01.dart b/LanguageFeatures/nnbd/null_aware_operator_A03_t01.dart
new file mode 100644
index 0000000..17df51e
--- /dev/null
+++ b/LanguageFeatures/nnbd/null_aware_operator_A03_t01.dart
@@ -0,0 +1,31 @@
+/*
+ * 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 property access e?.f translates to:
+ * SHORT[EXP(e), fn[x] => x.f]
+ *
+ * @description Check that a property access e?.f translates to:
+ * SHORT[EXP(e), fn[x] => x.f]
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+import "../../Utils/expect.dart";
+
+class A {
+ String test() => "Lily was here";
+}
+
+main() {
+ A? a = null;
+ Expect.isNull(a?.test());
+ a = new A();
+ Expect.equals("Lily was here", a?.test());
+
+ String? s = null;
+ Expect.isNull(s?.toString());
+ s = "Let it be";
+ Expect.equals("Let it be", s?.toString());
+}
diff --git a/LanguageFeatures/nnbd/null_aware_operator_A03_t02.dart b/LanguageFeatures/nnbd/null_aware_operator_A03_t02.dart
new file mode 100644
index 0000000..29f6f7a
--- /dev/null
+++ b/LanguageFeatures/nnbd/null_aware_operator_A03_t02.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 A property access e?.f translates to:
+ * SHORT[EXP(e), fn[x] => x.f]
+ *
+ * @description Check that a property access e?.f translates to:
+ * SHORT[EXP(e), fn[x] => x.f]
+ * @static-warning
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+import "../../Utils/expect.dart";
+
+class A {
+ String test() => "Lily was here";
+}
+
+main() {
+ A a = Never;
+ Expect.isNotNull(a?.toString()); /// static type warning
+ a = new A();
+ Expect.equals("Lily was here", a?.test()); /// static type warning
+
+ String s = "Let it be";
+ Expect.equals("Let it be", s?.toString()); /// static type warning
+}
diff --git a/LanguageFeatures/nnbd/null_aware_operator_A03_t03.dart b/LanguageFeatures/nnbd/null_aware_operator_A03_t03.dart
new file mode 100644
index 0000000..e298856
--- /dev/null
+++ b/LanguageFeatures/nnbd/null_aware_operator_A03_t03.dart
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+ * for details. All rights reserved. Use of this source code is governed by a
+ * BSD-style license that can be found in the LICENSE file.
+ */
+/**
+ * @assertion A property access e?.f translates to:
+ * SHORT[EXP(e), fn[x] => x.f]
+ *
+ * @description Check that a property access e?.f translates to:
+ * SHORT[EXP(e), fn[x] => x.f]. Test type aliases
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable,nonfunction-type-aliases
+import "../../Utils/expect.dart";
+
+class A {
+ String test() => "Lily was here";
+}
+
+typedef AAlias1 = A?;
+typedef AAlias2 = A;
+typedef StringAlias1 = String?;
+typedef StringAlias2 = String;
+
+main() {
+ AAlias1 a1 = null;
+ Expect.isNull(a1?.test());
+ a1 = new A();
+ Expect.equals("Lily was here", a1?.test());
+
+ StringAlias1 s = null;
+ Expect.isNull(s?.toString());
+ s = "Let it be";
+ Expect.equals("Let it be", s?.toString());
+
+ AAlias2 a2 = Never;
+ Expect.isNotNull(a2?.toString()); /// static type warning
+ a2 = new A();
+ Expect.equals("Lily was here", a2?.test()); /// static type warning
+
+ StringAlias2 s2 = "Let it be";
+ Expect.equals("Let it be", s2?.toString()); /// static type warning
+}
diff --git a/LanguageFeatures/nnbd/null_aware_operator_A03_t04.dart b/LanguageFeatures/nnbd/null_aware_operator_A03_t04.dart
new file mode 100644
index 0000000..ee752cf
--- /dev/null
+++ b/LanguageFeatures/nnbd/null_aware_operator_A03_t04.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 A property access e?.f translates to:
+ * SHORT[EXP(e), fn[x] => x.f]
+ *
+ * @description Check that a property access e?.f translates to:
+ * SHORT[EXP(e), fn[x] => x.f]. Test legacy pre-NNBD types
+ * @static-warning
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+import "../../Utils/expect.dart";
+import "legacy_library_lib.dart";
+
+main() {
+ A? a1 = null;
+ Expect.isNull(a1?.test());
+ a1 = new A();
+ Expect.equals("Lily was here", a1?.test());
+
+ A a2 = Never;
+ Expect.isNotNull(a2?.toString()); /// static type warning
+ a2 = new A();
+ Expect.equals("Lily was here", a2?.test()); /// static type warning
+}
diff --git a/LanguageFeatures/nnbd/null_aware_operator_A06_t01.dart b/LanguageFeatures/nnbd/null_aware_operator_A06_t01.dart
new file mode 100644
index 0000000..16f2403
--- /dev/null
+++ b/LanguageFeatures/nnbd/null_aware_operator_A06_t01.dart
@@ -0,0 +1,31 @@
+/*
+ * 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 If e1 translates to F then e1?.[e2] translates to:
+ * SHORT[EXP(e1), fn[x] => x[EXP(e2)]]
+ *
+ * @description Check that if e1 translates to F then e1?.[e2] translates to:
+ * SHORT[EXP(e1), fn[x] => x[EXP(e2)]]
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+import "../../Utils/expect.dart";
+
+class A {
+ int operator[](int index) => index;
+}
+
+main() {
+ A? a = null;
+ Expect.isNull(a?.[42]);
+ a = new A();
+ Expect.equals(42, a?.[42]);
+
+ List<String>? list = null;
+ Expect.isNull(list?.[42]);
+ list = ["Lily", "was", "here"];
+ Expect.equals("Lily", list?.[0]);
+}
diff --git a/LanguageFeatures/nnbd/null_aware_operator_A06_t02.dart b/LanguageFeatures/nnbd/null_aware_operator_A06_t02.dart
new file mode 100644
index 0000000..758d26d
--- /dev/null
+++ b/LanguageFeatures/nnbd/null_aware_operator_A06_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 If e1 translates to F then e1?.[e2] translates to:
+ * SHORT[EXP(e1), fn[x] => x[EXP(e2)]]
+ *
+ * @description Check that if e1 translates to F then e1?.[e2] translates to:
+ * SHORT[EXP(e1), fn[x] => x[EXP(e2)]]
+ * @static-warning
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+import "../../Utils/expect.dart";
+
+class A {
+ int operator[](int index) => index;
+}
+
+main() {
+ A a = new A();
+ Expect.equals(42, a?.[42]); /// static type warning
+
+ List<String> list = ["Lily", "was", "here"];
+ Expect.equals("Lily", list?.[0]); /// static type warning
+}
diff --git a/LanguageFeatures/nnbd/null_aware_operator_A06_t03.dart b/LanguageFeatures/nnbd/null_aware_operator_A06_t03.dart
new file mode 100644
index 0000000..7d50249
--- /dev/null
+++ b/LanguageFeatures/nnbd/null_aware_operator_A06_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 If e1 translates to F then e1?.[e2] translates to:
+ * SHORT[EXP(e1), fn[x] => x[EXP(e2)]]
+ *
+ * @description Check that if e1 translates to F then e1?.[e2] translates to:
+ * SHORT[EXP(e1), fn[x] => x[EXP(e2)]]. Test type aliases
+ * @static-warning
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable,nonfunction-type-aliases
+import "../../Utils/expect.dart";
+
+class A {
+ int operator[](int index) => index;
+}
+
+typedef AAlias1 = A?;
+typedef AAlias2 = A;
+typedef ListAlias1 = List<String>?;
+typedef ListAlias2 = List<String>;
+
+main() {
+ AAlias1 a1 = null;
+ Expect.isNull(a1?.[42]);
+ a1 = new A();
+ Expect.equals(42, a1?.[42]);
+
+ AAlias2 a2 = new A();
+ Expect.equals(42, a2?.[42]); /// static type warning
+
+ ListAlias1 list1 = null;
+ Expect.isNull(list1?.[42]);
+ list1 = ["Lily", "was", "here"];
+ Expect.equals("Lily", list1?.[0]);
+
+ ListAlias list2 = ["Let", "it", "be"];
+ Expect.equals("Let", list2?.[0]); /// static type warning
+}
diff --git a/LanguageFeatures/nnbd/null_aware_operator_A06_t04.dart b/LanguageFeatures/nnbd/null_aware_operator_A06_t04.dart
new file mode 100644
index 0000000..b559ecd
--- /dev/null
+++ b/LanguageFeatures/nnbd/null_aware_operator_A06_t04.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 If e1 translates to F then e1?.[e2] translates to:
+ * SHORT[EXP(e1), fn[x] => x[EXP(e2)]]
+ *
+ * @description Check that if e1 translates to F then e1?.[e2] translates to:
+ * SHORT[EXP(e1), fn[x] => x[EXP(e2)]]. Test legacy pre-NNBD types
+ * @static-warning
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable,nonfunction-type-aliases
+import "../../Utils/expect.dart";
+import "legacy_library_lib.dart";
+
+main() {
+ A? a1 = null;
+ Expect.isNull(a1?.[42]);
+ a1 = new A();
+ Expect.equals(42, a1?.[42]);
+
+ A a2 = new A();
+ Expect.equals(42, a2?.[42]); /// static type warning
+}
diff --git a/LanguageFeatures/nnbd/null_aware_operator_A08_t01.dart b/LanguageFeatures/nnbd/null_aware_operator_A08_t01.dart
new file mode 100644
index 0000000..b91084c
--- /dev/null
+++ b/LanguageFeatures/nnbd/null_aware_operator_A08_t01.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 assignment e1?.f = e2 translates to:
+ * SHORT[EXP(e1), fn[x] => x.f = EXP(e2)]
+ *
+ * @description Check that a property access e?.f translates to:
+ * SHORT[EXP(e), fn[x] => x.f]
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+import "../../Utils/expect.dart";
+
+class A {
+ String test = "No woman";
+}
+
+main() {
+ A? a = null;
+ Expect.isNull(a?.test = "no cry");
+ Expect.isNull(a);
+ a = new A();
+ Expect.equals("no cry", a?.test = "no cry");
+ Expect.equals("no cry", a?.test);
+}
diff --git a/LanguageFeatures/nnbd/null_aware_operator_A08_t02.dart b/LanguageFeatures/nnbd/null_aware_operator_A08_t02.dart
new file mode 100644
index 0000000..a13cd65
--- /dev/null
+++ b/LanguageFeatures/nnbd/null_aware_operator_A08_t02.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 assignment e1?.f = e2 translates to:
+ * SHORT[EXP(e1), fn[x] => x.f = EXP(e2)]
+ *
+ * @description Check that a property access e?.f translates to:
+ * SHORT[EXP(e), fn[x] => x.f]
+ * @static-warning
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+import "../../Utils/expect.dart";
+
+class A {
+ String test = "No woman";
+}
+
+main() {
+ A a = new A();
+ Expect.equals("no cry", a?.test = "no cry"); /// static type warning
+ Expect.equals("no cry", a.test);
+}
diff --git a/LanguageFeatures/nnbd/null_aware_operator_A08_t03.dart b/LanguageFeatures/nnbd/null_aware_operator_A08_t03.dart
new file mode 100644
index 0000000..0df3070
--- /dev/null
+++ b/LanguageFeatures/nnbd/null_aware_operator_A08_t03.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 assignment e1?.f = e2 translates to:
+ * SHORT[EXP(e1), fn[x] => x.f = EXP(e2)]
+ *
+ * @description Check that a property access e?.f translates to:
+ * SHORT[EXP(e), fn[x] => x.f]. Test type aliases
+ * @static-warning
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable,nonfunction-type-aliases
+import "../../Utils/expect.dart";
+
+class A {
+ String test = "No woman";
+}
+
+typedef AAlias1 = A?;
+typedef AAlias2 = A;
+
+main() {
+ AAlias1 a1 = null;
+ Expect.isNull(a1?.test = "no cry");
+ Expect.isNull(a1);
+ a1 = new A();
+ Expect.equals("no cry", a1?.test = "no cry");
+ Expect.equals("no cry", a1?.test);
+
+ AAlias2 a2 = new A();
+ Expect.equals("no cry", a2?.test = "no cry"); /// static type warning
+ Expect.equals("no cry", a2.test);
+}
diff --git a/LanguageFeatures/nnbd/null_aware_operator_A08_t04.dart b/LanguageFeatures/nnbd/null_aware_operator_A08_t04.dart
new file mode 100644
index 0000000..d984e56
--- /dev/null
+++ b/LanguageFeatures/nnbd/null_aware_operator_A08_t04.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 assignment e1?.f = e2 translates to:
+ * SHORT[EXP(e1), fn[x] => x.f = EXP(e2)]
+ *
+ * @description Check that a property access e?.f translates to:
+ * SHORT[EXP(e), fn[x] => x.f]. Test legacy pre-NNBD types
+ * @static-warning
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+import "../../Utils/expect.dart";
+import "legacy_library_lib.dart";
+
+main() {
+ A? a1 = null;
+ Expect.isNull(a1?.text = "Lily was here");
+ Expect.isNull(a1);
+ a1 = new A();
+ Expect.equals("Lily was here", a1?.test = "Lily was here");
+ Expect.equals("Lily was here", a1?.test);
+
+ A a2 = new A();
+ Expect.equals("Lily was here", a2?.test = "Lily was here"); /// static type warning
+ Expect.equals("Lily was here", a2.test);
+}
diff --git a/LanguageFeatures/nnbd/null_aware_operator_A12_t01.dart b/LanguageFeatures/nnbd/null_aware_operator_A12_t01.dart
new file mode 100644
index 0000000..cadde47
--- /dev/null
+++ b/LanguageFeatures/nnbd/null_aware_operator_A12_t01.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 If e1 translates to F then e1?.[e2] = e3 translates to:
+ * SHORT[EXP(e1), fn[x] => x[EXP(e2)] = EXP(e3)]
+ *
+ * @description Check that if e1 translates to F then e1?.[e2] = e3 translates
+ * to: SHORT[EXP(e1), fn[x] => x[EXP(e2)] = EXP(e3)]
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+import "../../Utils/expect.dart";
+
+class A {
+ List _list;
+ dynamic operator[](int index) => _list[index];
+
+ A(int length) {
+ _list = new List(length);
+ }
+}
+
+main() {
+ A? a = null;
+ Expect.isNull(a?.[42] = 13);
+ Expect.isNull(a);
+ a = new A(3);
+ Expect.equals(42, a?.[0] = 42);
+ Expect.equals(42, a1[0]);
+
+ List<String>? list = null;
+ Expect.isNull(list?.[42] = 42);
+ list = ["Lily", "was", "here"];
+ Expect.equals("Leeloo", list?.[0] = "Leeloo");
+ Expect.equals("Leeloo", list[0]);
+}
diff --git a/LanguageFeatures/nnbd/null_aware_operator_A12_t02.dart b/LanguageFeatures/nnbd/null_aware_operator_A12_t02.dart
new file mode 100644
index 0000000..819dcd5
--- /dev/null
+++ b/LanguageFeatures/nnbd/null_aware_operator_A12_t02.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 If e1 translates to F then e1?.[e2] = e3 translates to:
+ * SHORT[EXP(e1), fn[x] => x[EXP(e2)] = EXP(e3)]
+ *
+ * @description Check that if e1 translates to F then e1?.[e2] = e3 translates
+ * to: SHORT[EXP(e1), fn[x] => x[EXP(e2)] = EXP(e3)]
+ * @static-warning
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+import "../../Utils/expect.dart";
+
+class A {
+ List _list;
+ dynamic operator[](int index) => _list[index];
+
+ A(int length) {
+ _list = new List(length);
+ }
+}
+
+main() {
+ A a = new A(3);
+ Expect.equals(42, a?.[0] = 42); /// static type warning
+
+ List<String> list = ["Lily", "was", "here"];
+ Expect.equals("Leeloo", list?.[0] = "Leeloo"); /// static type warning
+ Expect.equals("Leeloo", list[0]);
+}
diff --git a/LanguageFeatures/nnbd/null_aware_operator_A12_t03.dart b/LanguageFeatures/nnbd/null_aware_operator_A12_t03.dart
new file mode 100644
index 0000000..00c80af
--- /dev/null
+++ b/LanguageFeatures/nnbd/null_aware_operator_A12_t03.dart
@@ -0,0 +1,40 @@
+/*
+ * 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 If e1 translates to F then e1?.[e2] = e3 translates to:
+ * SHORT[EXP(e1), fn[x] => x[EXP(e2)] = EXP(e3)]
+ *
+ * @description Check that if e1 translates to F then e1?.[e2] = e3 translates
+ * to: SHORT[EXP(e1), fn[x] => x[EXP(e2)] = EXP(e3)]. Test type aliases
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable,nonfunction-type-aliases
+import "../../Utils/expect.dart";
+
+class A {
+ List _list;
+ dynamic operator[](int index) => _list[index];
+
+ A(int length) {
+ _list = new List(length);
+ }
+}
+
+typedef AAlias1 = A?;
+typedef AAlias2 = A;
+
+main() {
+ AAlias1 a1 = null;
+ Expect.isNull(a1?.[42] = 13);
+ Expect.isNull(a1);
+ a1 = new A(3);
+ Expect.equals(42, a1?.[0] = 42);
+ Expect.equals(42, a1[0]);
+
+ AAlias2 a2 = new A(3);
+ Expect.equals(42, a2?.[0] = 42); /// static type warning
+ Expect.equals(42, a2[0]);
+}
diff --git a/LanguageFeatures/nnbd/null_aware_operator_A12_t04.dart b/LanguageFeatures/nnbd/null_aware_operator_A12_t04.dart
new file mode 100644
index 0000000..13ac095
--- /dev/null
+++ b/LanguageFeatures/nnbd/null_aware_operator_A12_t04.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 If e1 translates to F then e1?.[e2] = e3 translates to:
+ * SHORT[EXP(e1), fn[x] => x[EXP(e2)] = EXP(e3)]
+ *
+ * @description Check that if e1 translates to F then e1?.[e2] = e3 translates
+ * to: SHORT[EXP(e1), fn[x] => x[EXP(e2)] = EXP(e3)]. Test legacy pre-NNBD types
+ * @static-warning
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+import "../../Utils/expect.dart";
+import "legacy_library_lib.dart";
+
+main() {
+ A? a1 = null;
+ Expect.isNull(a1?.[42] = 13);
+ a1 = new A();
+ Expect.equals(13, a1?.[42] = 13);
+
+ A a2 = new A();
+ Expect.equals(13, a2[42] = 13); /// static type warning
+
+}
\ No newline at end of file