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

Unified Diff: compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java

Issue 8633015: Allow initializing a field in a superclass in a const constructor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes to lookupField Created 9 years, 1 month 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
« no previous file with comments | « compiler/java/com/google/dart/compiler/resolver/Resolver.java ('k') | tests/language/language.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java
diff --git a/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java b/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java
index 9c85d71723fc9ceb46dec1620eaa12d291ef2d2b..45929ed95dffbcade837d8b3684af4d0dff99a4b 100644
--- a/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java
+++ b/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java
@@ -851,4 +851,49 @@ public class ResolverTest extends ResolverTestCase {
" }",
"}"));
}
+
+ public void testParameterMatchField1() {
+ resolveAndTest(Joiner.on("\n").join(
+ "class Object {}",
+ "class int {}",
+ "class A {",
+ " int a;",
+ " const A(this.a);",
+ "}"));
+ }
+
+ public void testParameterMatchField2() {
+ resolveAndTest(Joiner.on("\n").join(
+ "class Object {}",
+ "class int {}",
+ "class A {",
+ " int a;",
+ "}",
+ "class B extends A {",
+ " const B(this.a);",
+ "}"));
+ }
+
+ public void testParameterMatchField3() {
+ resolveAndTest(Joiner.on("\n").join(
+ "class Object {}",
+ "class int {}",
+ "class A {",
+ " int a;",
+ "}",
+ "class B extends A {",
+ "}",
+ "class C extends B {",
+ " const C(this.a);",
+ "}"));
+ }
+
+ public void testParameterNotMatchField() {
+ resolveAndTest(Joiner.on("\n").join(
+ "class Object {}",
+ "class A {",
+ " const A(this.a);",
+ "}"),
+ ResolverErrorCode.PARAMETER_NOT_MATCH_FIELD);
+ }
}
« no previous file with comments | « compiler/java/com/google/dart/compiler/resolver/Resolver.java ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698