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

Unified Diff: pkg/analyzer/test/generated/resolver_test.dart

Issue 652833002: Fix constant evaluation in the presence of nonexistent fields. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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: pkg/analyzer/test/generated/resolver_test.dart
diff --git a/pkg/analyzer/test/generated/resolver_test.dart b/pkg/analyzer/test/generated/resolver_test.dart
index 951466c9539d3ae17f7dc5b6f17722eb0ebb2432..11995f9bce290ec5e5590be0323e4069b2287359 100644
--- a/pkg/analyzer/test/generated/resolver_test.dart
+++ b/pkg/analyzer/test/generated/resolver_test.dart
@@ -2727,6 +2727,18 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
verify([source]);
}
+ void test_initializerForNonExistent_const() {
+ // Check that the absence of a matching field doesn't cause a
+ // crash during constant evaluation.
+ Source source = addSource(EngineTestCase.createSource([
+ "class A {",
+ " const A() : x = 'foo';",
+ "}",
+ "A a = const A();"]));
+ resolve(source);
+ assertErrors(source, [CompileTimeErrorCode.INITIALIZER_FOR_NON_EXISTANT_FIELD]);
+ }
+
void test_initializerForNonExistant_initializer() {
Source source = addSource(EngineTestCase.createSource(["class A {", " A() : x = 0 {}", "}"]));
resolve(source);

Powered by Google App Engine
This is Rietveld 408576698