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

Unified Diff: compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java

Issue 11280135: Issue 6836. Using undeclared identifier in static context is now warning. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
Index: compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
diff --git a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
index 5f72504ecb22c849447c6b534aeb029f6a4dca5d..42db89c56887ab0b2a8bae0314227f8635623fc1 100644
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
@@ -4534,23 +4534,29 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
}
/**
- * If "unknown" is separate identifier, it is handled as "this.unknown", but "this" is not
- * accessible in static context.
* <p>
- * http://code.google.com/p/dart/issues/detail?id=3084
+ * http://code.google.com/p/dart/issues/detail?id=6836
*/
public void test_unresolvedIdentifier_inStatic_notPropertyAccess() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
"process(x) {}",
+ "",
+ "class A {",
+ " static foo() {",
+ " unknown = 0;",
+ " }",
+ "}",
+ "",
"main() {",
" unknown = 0;",
" process(unknown);",
"}");
assertErrors(
libraryResult.getErrors(),
- errEx(ResolverErrorCode.CANNOT_BE_RESOLVED, 4, 3, 7),
- errEx(ResolverErrorCode.CANNOT_BE_RESOLVED, 5, 11, 7));
+ errEx(TypeErrorCode.CANNOT_BE_RESOLVED, 6, 5, 7),
+ errEx(TypeErrorCode.CANNOT_BE_RESOLVED, 11, 3, 7),
+ errEx(TypeErrorCode.CANNOT_BE_RESOLVED, 12, 11, 7));
}
/**
@@ -5690,7 +5696,7 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
assertErrors(result.getErrors(),
errEx(ResolverErrorCode.NOT_GENERATIVE_SUPER_CONSTRUCTOR, 8, 9, 13));
}
-
+
/**
* <p>
* http://code.google.com/p/dart/issues/detail?id=6718
@@ -5706,4 +5712,15 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
assertErrors(result.getErrors(),
errEx(ResolverErrorCode.INITIALIZER_ONLY_IN_GENERATIVE_CONSTRUCTOR, 4, 9, 15));
}
+
+ public void test_variableReferencesItselfInInitializer() throws Exception {
+ AnalyzeLibraryResult result = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "main() {",
+ " var x = x;",
+ "}",
+ "");
+ assertErrors(result.getErrors(),
+ errEx(ResolverErrorCode.VARIABLE_REFERENCES_SAME_NAME_IN_INITIALIZER, 3, 11, 1));
+ }
}

Powered by Google App Engine
This is Rietveld 408576698