Add a test for uses of the default List constructor

Change-Id: I3b1452186e00f930d5da7c64f3a64f08cd6f4589
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101066
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
diff --git a/tests/language_2/nnbd/static_errors/default_list_constructor_test.dart b/tests/language_2/nnbd/static_errors/default_list_constructor_test.dart
new file mode 100644
index 0000000..7263438
--- /dev/null
+++ b/tests/language_2/nnbd/static_errors/default_list_constructor_test.dart
@@ -0,0 +1,22 @@
+// 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.
+
+// SharedOptions=--enable-experiment=non-nullable
+
+import 'opted_out_library.dart';
+
+// Test that it is an error to call the default List constructor with a length
+// argument and a type argument which is potentially non-nullable.
+main() {
+  var a = new List<int>(3); //# 01: compile-time error
+  var b = new List<String?>(3);
+  List<C> c = List(5); //# 02: compile-time error
+  consumeListOfStringStar(new List(3)); //# 03: compile-time error
+}
+
+class A<T> {
+  var l = new List<T>(3); //# 04: compile-time error
+}
+
+class C {}
diff --git a/tests/language_2/nnbd/static_errors/opted_out_library.dart b/tests/language_2/nnbd/static_errors/opted_out_library.dart
new file mode 100644
index 0000000..fefacf5
--- /dev/null
+++ b/tests/language_2/nnbd/static_errors/opted_out_library.dart
@@ -0,0 +1,3 @@
+// @dart=2.3
+
+void consumeListOfStringStar(List<String> l) {}