#389. More NNBD static errors tests added
diff --git a/LanguageFeatures/nnbd/static_errors_A11_t01.dart b/LanguageFeatures/nnbd/static_errors_A11_t01.dart
index 1badc50..9e2a686 100644
--- a/LanguageFeatures/nnbd/static_errors_A11_t01.dart
+++ b/LanguageFeatures/nnbd/static_errors_A11_t01.dart
@@ -16,9 +16,12 @@
// SharedOptions=--enable-experiment=non-nullable
class A {
void test() {}
+ int operator[](int index) => 0;
}
main() {
A? a = null;
a?.test();
+ a ?.. test();
+ a?.[0];
}
diff --git a/LanguageFeatures/nnbd/static_errors_A13_t01.dart b/LanguageFeatures/nnbd/static_errors_A13_t01.dart
new file mode 100644
index 0000000..d46f07c
--- /dev/null
+++ b/LanguageFeatures/nnbd/static_errors_A13_t01.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 It is an error to call a method, setter, or getter on a receiver
+ * of static type Never (including via a null aware operator).
+ *
+ * @description Check that it is an error to call a method, setter, or getter on
+ * a receiver of static type Never (including via a null aware operator).
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+class A {
+ void set setter(int v) {}
+ int operator[](int index) => 0;
+}
+
+void test(var x) {
+ if (x is Never) {
+ x.toString(); //# 01: compile-time error
+ x.runtimeType; //# 02: compile-time error
+ x.setter = 42; //# 03: compile-time error
+
+ x?.toString(); //# 04: compile-time error
+ x?.runtimeType; //# 05: compile-time error
+ x?.setter = 42; //# 06: compile-time error
+
+ x?..toString(); //# 07: compile-time error
+ x?..runtimeType; //# 08: compile-time error
+ x?..setter = 42; //# 09: compile-time error
+
+ x?.[0]; //# 10: compile-time error
+ }
+}
+
+main() {
+ A? a = null;
+ test(a);
+}
diff --git a/LanguageFeatures/nnbd/static_errors_A14_t01.dart b/LanguageFeatures/nnbd/static_errors_A14_t01.dart
new file mode 100644
index 0000000..81ac72b
--- /dev/null
+++ b/LanguageFeatures/nnbd/static_errors_A14_t01.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 It is an error to apply an expression of type Never in the
+ * function position of a function call.
+ *
+ * @description Check that it is an error to apply an expression of type Never
+ * in the function position of a function call.
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+class A {
+}
+
+void test(var x) {
+ if (x is Never) {
+ x(); //# 01: compile-time error
+ x(1); //# 02: compile-time error
+ x("1"); //# 03: compile-time error
+ }
+}
+
+main() {
+ A? a = null;
+ test(a);
+}
diff --git a/LanguageFeatures/nnbd/static_errors_A15_t01.dart b/LanguageFeatures/nnbd/static_errors_A15_t01.dart
new file mode 100644
index 0000000..37da053
--- /dev/null
+++ b/LanguageFeatures/nnbd/static_errors_A15_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 It is an error if the static type of e in the expression throw e
+ * is not assignable to Object
+ *
+ * @description Check that it is an error if the static type of e in the
+ * expression throw e is not assignable to Object
+ * @compile-error
+ * @author sgrekhov@unipro.ru
+ */
+// SharedOptions=--enable-experiment=non-nullable
+class A {
+}
+
+void test(var x) {
+ if (!(x is Object)) {
+ throw x;
+ }
+}
+
+main() {
+ A? a = null;
+ test(a);
+}