Index: dart/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/NonErrorResolverTest.java |
=================================================================== |
--- dart/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/NonErrorResolverTest.java (revision 29808) |
+++ dart/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/NonErrorResolverTest.java (working copy) |
@@ -1362,8 +1362,35 @@ |
verify(source); |
} |
- public void test_invalidAnnotation_constantVariable() throws Exception { |
+ public void test_invalidAnnotation_constantVariable_field() throws Exception { |
Source source = addSource(createSource(// |
+ "@A.C", |
+ "class A {", |
+ " static const C = 0;", |
+ "}")); |
+ resolve(source); |
+ assertNoErrors(source); |
+ verify(source); |
+ } |
+ |
+ public void test_invalidAnnotation_constantVariable_field_importWithPrefix() throws Exception { |
+ addSource("/lib.dart", createSource(// |
+ "library lib;", |
+ "class A {", |
+ " static const C = 0;", |
+ "}")); |
+ Source source = addSource(createSource(// |
+ "import 'lib.dart' as p;", |
+ "@p.A.C", |
+ "main() {", |
+ "}")); |
+ resolve(source); |
+ assertNoErrors(source); |
+ verify(source); |
+ } |
+ |
+ public void test_invalidAnnotation_constantVariable_topLevel() throws Exception { |
+ Source source = addSource(createSource(// |
"const C = 0;", |
"@C", |
"main() {", |
@@ -1373,7 +1400,7 @@ |
verify(source); |
} |
- public void test_invalidAnnotation_importWithPrefix_constantVariable() throws Exception { |
+ public void test_invalidAnnotation_constantVariable_topLevel_importWithPrefix() throws Exception { |
addSource("/lib.dart", createSource(// |
"library lib;", |
"const C = 0;")); |
@@ -1387,10 +1414,26 @@ |
verify(source); |
} |
- public void test_invalidAnnotation_importWithPrefix_constConstructor() throws Exception { |
+ public void test_invalidAnnotation_constConstructor_importWithPrefix() throws Exception { |
addSource("/lib.dart", createSource(// |
"library lib;", |
"class A {", |
+ " const A(int p);", |
+ "}")); |
+ Source source = addSource(createSource(// |
+ "import 'lib.dart' as p;", |
+ "@p.A(42)", |
+ "main() {", |
+ "}")); |
+ resolve(source); |
+ assertNoErrors(source); |
+ verify(source); |
+ } |
+ |
+ public void test_invalidAnnotation_constConstructor_named_importWithPrefix() throws Exception { |
+ addSource("/lib.dart", createSource(// |
+ "library lib;", |
+ "class A {", |
" const A.named(int p);", |
"}")); |
Source source = addSource(createSource(// |
@@ -2586,7 +2629,6 @@ |
public void test_proxy_annotation_prefixed() throws Exception { |
Source source = addSource(createSource(// |
"library L;", |
- "import 'meta.dart';", |
"@proxy", |
"class A {}", |
"f(A a) {", |
@@ -2597,10 +2639,6 @@ |
" a++;", |
" ++a;", |
"}")); |
- addSource("/meta.dart", createSource(// |
- "library meta;", |
- "const proxy = const _Proxy();", |
- "class _Proxy { const _Proxy(); }")); |
resolve(source); |
assertNoErrors(source); |
} |
@@ -2608,7 +2646,6 @@ |
public void test_proxy_annotation_prefixed2() throws Exception { |
Source source = addSource(createSource(// |
"library L;", |
- "import 'meta.dart';", |
"@proxy", |
"class A {}", |
"class B {", |
@@ -2621,10 +2658,6 @@ |
" ++a;", |
" }", |
"}")); |
- addSource("/meta.dart", createSource(// |
- "library meta;", |
- "const proxy = const _Proxy();", |
- "class _Proxy { const _Proxy(); }")); |
resolve(source); |
assertNoErrors(source); |
} |
@@ -2632,7 +2665,6 @@ |
public void test_proxy_annotation_prefixed3() throws Exception { |
Source source = addSource(createSource(// |
"library L;", |
- "import 'meta.dart';", |
"class B {", |
" f(A a) {", |
" a.m();", |
@@ -2645,10 +2677,6 @@ |
"}", |
"@proxy", |
"class A {}")); |
- addSource("/meta.dart", createSource(// |
- "library meta;", |
- "const proxy = const _Proxy();", |
- "class _Proxy { const _Proxy(); }")); |
resolve(source); |
assertNoErrors(source); |
} |
@@ -2656,7 +2684,6 @@ |
public void test_proxy_annotation_simple() throws Exception { |
Source source = addSource(createSource(// |
"library L;", |
- "import 'meta.dart';", |
"@proxy", |
"class B {", |
" m() {", |
@@ -2666,10 +2693,6 @@ |
" var y = this + this;", |
" }", |
"}")); |
- addSource("/meta.dart", createSource(// |
- "library meta;", |
- "const proxy = const _Proxy();", |
- "class _Proxy { const _Proxy(); }")); |
resolve(source); |
assertNoErrors(source); |
} |
@@ -3281,6 +3304,19 @@ |
verify(source); |
} |
+ public void test_typePromotion_parentheses() throws Exception { |
+ Source source = addSource(createSource(// |
+ "main(Object p) {", |
+ " (p is String) ? p.length : 0;", |
+ " (p) is String ? p.length : 0;", |
+ " ((p)) is String ? p.length : 0;", |
+ " ((p) is String) ? p.length : 0;", |
+ "}")); |
+ resolve(source); |
+ assertNoErrors(source); |
+ verify(source); |
+ } |
+ |
public void test_typeType_class() throws Exception { |
Source source = addSource(createSource(// |
"class C {}", |