Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Unified Diff: tests/language/call_constructor_on_unresolvable_class_test.dart

Issue 10868069: Throw a runtime error when trying to call a constructor of a class that could not be resolved. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/language/call_constructor_on_unresolvable_class_test.dart
diff --git a/tests/language/call_constructor_on_unresolvable_class_test.dart b/tests/language/call_constructor_on_unresolvable_class_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..a5b59489289714210e9b3b3e803dcc7a39075a6d
--- /dev/null
+++ b/tests/language/call_constructor_on_unresolvable_class_test.dart
@@ -0,0 +1,25 @@
+// Copyright (c) 2012, 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.
+
+// Check that calling a constructor of a class that cannot be resolved causes
+// a runtime error.
+
+never() => false;
ngeoffray 2012/08/24 15:43:48 This will be inlined and the code below line 12 wi
karlklose 2012/08/28 09:09:15 Done.
+
+main() {
+ if (never()) {
+ // These should not produce errors because the calls are never executed.
+ new A(); /// 01: static type warning
+ new A.foo(); /// 02: static type warning
+ new library.A(); /// 03: static type warning
+ }
+
+ new A(); /// 04: runtime error
+ new A.foo(); /// 05: runtime error
+ new library.A(); /// 06: runtime error
+ try { /// 07: runtime error
+ new A(); /// 07: continued
+ } catch (e) { /// 07: continued
+ } /// 07: continued
+}

Powered by Google App Engine
This is Rietveld 408576698