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

Unified Diff: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/NonErrorResolverTest.java

Issue 18010002: Report errors for invalid annotations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/NonErrorResolverTest.java
diff --git a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/NonErrorResolverTest.java b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/NonErrorResolverTest.java
index bd6c20d51f87a34536eb924f005378c42903cc85..5f69fdd810b05f5a8353ea86e77561a04c6509cc 100644
--- a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/NonErrorResolverTest.java
+++ b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/NonErrorResolverTest.java
@@ -981,6 +981,47 @@ public class NonErrorResolverTest extends ResolverTestCase {
verify(source);
}
+ public void test_invalidAnnotation_constantVariable() throws Exception {
+ Source source = addSource(createSource(//
+ "const C = 0;",
+ "@C",
+ "main() {",
+ "}"));
+ resolve(source);
+ assertNoErrors();
+ verify(source);
+ }
+
+ public void test_invalidAnnotation_importWithPrefix_constantVariable() throws Exception {
+ addSource("/lib.dart", createSource(//
+ "library lib;",
+ "const C = 0;"));
+ Source source = addSource(createSource(//
+ "import 'lib.dart' as p;",
+ "@p.C",
+ "main() {",
+ "}"));
+ resolve(source);
+ assertNoErrors();
+ verify(source);
+ }
+
+ public void test_invalidAnnotation_importWithPrefix_constConstructor() throws Exception {
+ addSource("/lib.dart", createSource(//
+ "library lib;",
+ "class A {",
+ " const A.named(int p);",
+ "}"));
+ Source source = addSource(createSource(//
+ "import 'lib.dart' as p;",
+ "@p.A.named(42)",
+ "main() {",
+ "}"));
+ resolve(source);
+ assertNoErrors();
+ verify(source);
+ }
+
public void test_invalidAssignment() throws Exception {
Source source = addSource(createSource(//
"f() {",
@@ -2097,7 +2138,7 @@ public class NonErrorResolverTest extends ResolverTestCase {
public void test_staticAccessToInstanceMember_annotation() throws Exception {
Source source = addSource(createSource(//
"class A {",
- " A.name() {}",
+ " const A.name();",
"}",
"@A.name()",
"main() {",

Powered by Google App Engine
This is Rietveld 408576698