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

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

Issue 9169013: Issue 1099: Compile time error for RHS this access in initializer (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Failing JUnit opt test Created 8 years, 11 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: compiler/javatests/com/google/dart/compiler/resolver/NegativeResolverTest.java
diff --git a/compiler/javatests/com/google/dart/compiler/resolver/NegativeResolverTest.java b/compiler/javatests/com/google/dart/compiler/resolver/NegativeResolverTest.java
index 85e5240710eb20d89e07fe1e1cdee5269e845a02..ca20d652504dbab6396373808095fa75925a00d6 100644
--- a/compiler/javatests/com/google/dart/compiler/resolver/NegativeResolverTest.java
+++ b/compiler/javatests/com/google/dart/compiler/resolver/NegativeResolverTest.java
@@ -1074,4 +1074,18 @@ public class NegativeResolverTest extends CompilerTestCase {
"class MyClass implements Map<Object, Dynamic> {",
"}"));
}
+
+ public void testInitializerReferenceToThis() throws Exception {
+ checkSourceErrors(
+ makeCode(
+ "class A {",
+ " var x, y;",
+ " A.one(z) : x = z, y = this.x;",
+ " A.two(this.x) : y = (() { return this; });",
+ " A.three(this.x) : y = this.x;",
+ "}"),
+ errEx(ResolverErrorCode.THIS_IN_INITIALIZER_AS_EXPRESSION, 3, 25, 4),
+ errEx(ResolverErrorCode.THIS_IN_INITIALIZER_AS_EXPRESSION, 4, 36, 4),
+ errEx(ResolverErrorCode.THIS_IN_INITIALIZER_AS_EXPRESSION, 5, 25, 4));
+ }
}
« no previous file with comments | « compiler/javatests/com/google/dart/compiler/backend/js/testConstructorOptTest.dart ('k') | tests/co19/co19-compiler.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698