| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 | 3 |
| 4 library engine.resolver_test; | 4 library engine.resolver_test; |
| 5 | 5 |
| 6 import 'package:analyzer/src/generated/java_core.dart'; | 6 import 'package:analyzer/src/generated/java_core.dart'; |
| 7 import 'package:analyzer/src/generated/java_junit.dart'; | 7 import 'package:analyzer/src/generated/java_junit.dart'; |
| 8 import 'package:analyzer/src/generated/source_io.dart'; | 8 import 'package:analyzer/src/generated/source_io.dart'; |
| 9 import 'package:analyzer/src/generated/error.dart'; | 9 import 'package:analyzer/src/generated/error.dart'; |
| 10 import 'package:analyzer/src/generated/scanner.dart'; | 10 import 'package:analyzer/src/generated/scanner.dart'; |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 void test_is_subclass() { | 438 void test_is_subclass() { |
| 439 Source source = addSource(EngineTestCase.createSource([ | 439 Source source = addSource(EngineTestCase.createSource([ |
| 440 "class A {}", | 440 "class A {}", |
| 441 "class B extends A {", | 441 "class B extends A {", |
| 442 " B m() => this;", | 442 " B m() => this;", |
| 443 "}", | 443 "}", |
| 444 "A f(A p) {", | 444 "A f(A p) {", |
| 445 " if (p is B) {", | 445 " if (p is B) {", |
| 446 " return p.m();", | 446 " return p.m();", |
| 447 " }", | 447 " }", |
| 448 " return p;", |
| 448 "}"])); | 449 "}"])); |
| 449 LibraryElement library = resolve(source); | 450 LibraryElement library = resolve(source); |
| 450 assertNoErrors(source); | 451 assertNoErrors(source); |
| 451 CompilationUnit unit = resolveCompilationUnit(source, library); | 452 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 452 FunctionDeclaration function = unit.declarations[2] as FunctionDeclaration; | 453 FunctionDeclaration function = unit.declarations[2] as FunctionDeclaration; |
| 453 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; | 454 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; |
| 454 IfStatement ifStatement = body.block.statements[0] as IfStatement; | 455 IfStatement ifStatement = body.block.statements[0] as IfStatement; |
| 455 ReturnStatement statement = (ifStatement.thenStatement as Block).statements[
0] as ReturnStatement; | 456 ReturnStatement statement = (ifStatement.thenStatement as Block).statements[
0] as ReturnStatement; |
| 456 MethodInvocation invocation = statement.expression as MethodInvocation; | 457 MethodInvocation invocation = statement.expression as MethodInvocation; |
| 457 JUnitTestCase.assertNotNull(invocation.methodName.propagatedElement); | 458 JUnitTestCase.assertNotNull(invocation.methodName.propagatedElement); |
| 458 } | 459 } |
| 459 | 460 |
| 460 void test_is_while() { | 461 void test_is_while() { |
| 461 Source source = addSource(EngineTestCase.createSource([ | 462 Source source = addSource(EngineTestCase.createSource([ |
| 462 "class A {}", | 463 "class A {}", |
| 463 "A f(var p) {", | 464 "A f(var p) {", |
| 464 " while (p is A) {", | 465 " while (p is A) {", |
| 465 " return p;", | 466 " return p;", |
| 466 " }", | 467 " }", |
| 468 " return p;", |
| 467 "}"])); | 469 "}"])); |
| 468 LibraryElement library = resolve(source); | 470 LibraryElement library = resolve(source); |
| 469 assertNoErrors(source); | 471 assertNoErrors(source); |
| 470 verify([source]); | 472 verify([source]); |
| 471 CompilationUnit unit = resolveCompilationUnit(source, library); | 473 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 472 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; | 474 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 473 InterfaceType typeA = classA.element.type; | 475 InterfaceType typeA = classA.element.type; |
| 474 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 476 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 475 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; | 477 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; |
| 476 WhileStatement whileStatement = body.block.statements[0] as WhileStatement; | 478 WhileStatement whileStatement = body.block.statements[0] as WhileStatement; |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1198 " switch(s) {", | 1200 " switch(s) {", |
| 1199 " case('1') : return 1;", | 1201 " case('1') : return 1;", |
| 1200 " default: return 0;", | 1202 " default: return 0;", |
| 1201 " }", | 1203 " }", |
| 1202 "}"])); | 1204 "}"])); |
| 1203 resolve(source); | 1205 resolve(source); |
| 1204 assertNoErrors(source); | 1206 assertNoErrors(source); |
| 1205 verify([source]); | 1207 verify([source]); |
| 1206 } | 1208 } |
| 1207 | 1209 |
| 1210 void test_commentReference_beforeFunction_blockBody() { |
| 1211 String code = EngineTestCase.createSource(["/// [p]", "foo(int p) {", "}"]); |
| 1212 Source source = addSource(code); |
| 1213 resolve(source); |
| 1214 assertNoErrors(source); |
| 1215 verify([source]); |
| 1216 CompilationUnit unit = analysisContext.parseCompilationUnit(source); |
| 1217 SimpleIdentifier ref = EngineTestCase.findNode(unit, code, "p]", SimpleIdent
ifier); |
| 1218 EngineTestCase.assertInstanceOf(ParameterElement, ref.staticElement); |
| 1219 } |
| 1220 |
| 1221 void test_commentReference_beforeFunction_expressionBody() { |
| 1222 String code = EngineTestCase.createSource(["/// [p]", "foo(int p) => null;"]
); |
| 1223 Source source = addSource(code); |
| 1224 resolve(source); |
| 1225 assertNoErrors(source); |
| 1226 verify([source]); |
| 1227 CompilationUnit unit = analysisContext.parseCompilationUnit(source); |
| 1228 SimpleIdentifier ref = EngineTestCase.findNode(unit, code, "p]", SimpleIdent
ifier); |
| 1229 EngineTestCase.assertInstanceOf(ParameterElement, ref.staticElement); |
| 1230 } |
| 1231 |
| 1232 void test_commentReference_beforeMethod() { |
| 1233 String code = EngineTestCase.createSource([ |
| 1234 "abstract class A {", |
| 1235 " /// [p1]", |
| 1236 " ma(int p1) {}", |
| 1237 " /// [p2]", |
| 1238 " mb(int p2);", |
| 1239 "}"]); |
| 1240 Source source = addSource(code); |
| 1241 resolve(source); |
| 1242 assertNoErrors(source); |
| 1243 verify([source]); |
| 1244 CompilationUnit unit = analysisContext.parseCompilationUnit(source); |
| 1245 { |
| 1246 SimpleIdentifier ref = EngineTestCase.findNode(unit, code, "p1]", SimpleId
entifier); |
| 1247 EngineTestCase.assertInstanceOf(ParameterElement, ref.staticElement); |
| 1248 } |
| 1249 { |
| 1250 SimpleIdentifier ref = EngineTestCase.findNode(unit, code, "p2]", SimpleId
entifier); |
| 1251 EngineTestCase.assertInstanceOf(ParameterElement, ref.staticElement); |
| 1252 } |
| 1253 } |
| 1254 |
| 1255 void test_commentReference_class() { |
| 1256 String code = EngineTestCase.createSource(["/// [foo]", "class A {", " foo(
) {}", "}"]); |
| 1257 Source source = addSource(code); |
| 1258 resolve(source); |
| 1259 assertNoErrors(source); |
| 1260 verify([source]); |
| 1261 CompilationUnit unit = analysisContext.parseCompilationUnit(source); |
| 1262 SimpleIdentifier ref = EngineTestCase.findNode(unit, code, "foo]", SimpleIde
ntifier); |
| 1263 EngineTestCase.assertInstanceOf(MethodElement, ref.staticElement); |
| 1264 } |
| 1265 |
| 1208 void test_concreteClassWithAbstractMember() { | 1266 void test_concreteClassWithAbstractMember() { |
| 1209 Source source = addSource(EngineTestCase.createSource(["abstract class A {",
" m();", "}"])); | 1267 Source source = addSource(EngineTestCase.createSource(["abstract class A {",
" m();", "}"])); |
| 1210 resolve(source); | 1268 resolve(source); |
| 1211 assertNoErrors(source); | 1269 assertNoErrors(source); |
| 1212 verify([source]); | 1270 verify([source]); |
| 1213 } | 1271 } |
| 1214 | 1272 |
| 1215 void test_conflictingInstanceGetterAndSuperclassMember_instance() { | 1273 void test_conflictingInstanceGetterAndSuperclassMember_instance() { |
| 1216 Source source = addSource(EngineTestCase.createSource([ | 1274 Source source = addSource(EngineTestCase.createSource([ |
| 1217 "class A {", | 1275 "class A {", |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1744 " final int x;", | 1802 " final int x;", |
| 1745 " A(this.x);", | 1803 " A(this.x);", |
| 1746 " A.named() : this (42);", | 1804 " A.named() : this (42);", |
| 1747 "}"])); | 1805 "}"])); |
| 1748 resolve(source); | 1806 resolve(source); |
| 1749 assertNoErrors(source); | 1807 assertNoErrors(source); |
| 1750 verify([source]); | 1808 verify([source]); |
| 1751 } | 1809 } |
| 1752 | 1810 |
| 1753 void test_functionDeclaration_scope_returnType() { | 1811 void test_functionDeclaration_scope_returnType() { |
| 1754 Source source = addSource(EngineTestCase.createSource(["int f(int) {}"])); | 1812 Source source = addSource(EngineTestCase.createSource(["int f(int) { return
0; }"])); |
| 1755 resolve(source); | 1813 resolve(source); |
| 1756 assertNoErrors(source); | 1814 assertNoErrors(source); |
| 1757 verify([source]); | 1815 verify([source]); |
| 1758 } | 1816 } |
| 1759 | 1817 |
| 1760 void test_functionDeclaration_scope_signature() { | 1818 void test_functionDeclaration_scope_signature() { |
| 1761 Source source = addSource(EngineTestCase.createSource(["const app = 0;", "f(
@app int app) {}"])); | 1819 Source source = addSource(EngineTestCase.createSource(["const app = 0;", "f(
@app int app) {}"])); |
| 1762 resolve(source); | 1820 resolve(source); |
| 1763 assertNoErrors(source); | 1821 assertNoErrors(source); |
| 1764 verify([source]); | 1822 verify([source]); |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2003 } | 2061 } |
| 2004 | 2062 |
| 2005 void test_inconsistentMethodInheritance_accessors_typeParameter2() { | 2063 void test_inconsistentMethodInheritance_accessors_typeParameter2() { |
| 2006 Source source = addSource(EngineTestCase.createSource([ | 2064 Source source = addSource(EngineTestCase.createSource([ |
| 2007 "abstract class A<E> {", | 2065 "abstract class A<E> {", |
| 2008 " E get x {return 1;}", | 2066 " E get x {return 1;}", |
| 2009 "}", | 2067 "}", |
| 2010 "class B<E> {", | 2068 "class B<E> {", |
| 2011 " E get x {return 1;}", | 2069 " E get x {return 1;}", |
| 2012 "}", | 2070 "}", |
| 2013 "class C<E> extends A<E> implements B<E> {", | 2071 "class C<E> extends A<E> implements B<E> {}"])); |
| 2014 "}"])); | |
| 2015 resolve(source); | 2072 resolve(source); |
| 2016 assertNoErrors(source); | 2073 assertNoErrors(source); |
| 2017 verify([source]); | 2074 verify([source]); |
| 2018 } | 2075 } |
| 2019 | 2076 |
| 2020 void test_inconsistentMethodInheritance_accessors_typeParameters_diamond() { | 2077 void test_inconsistentMethodInheritance_accessors_typeParameters_diamond() { |
| 2021 Source source = addSource(EngineTestCase.createSource([ | 2078 Source source = addSource(EngineTestCase.createSource([ |
| 2022 "abstract class F<E> extends B<E> {}", | 2079 "abstract class F<E> extends B<E> {}", |
| 2023 "class D<E> extends F<E> {", | 2080 "class D<E> extends F<E> {", |
| 2024 " external E get g;", | 2081 " external E get g;", |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2223 resolve(source); | 2280 resolve(source); |
| 2224 assertNoErrors(source); | 2281 assertNoErrors(source); |
| 2225 verify([source]); | 2282 verify([source]); |
| 2226 } | 2283 } |
| 2227 | 2284 |
| 2228 void test_invalidAssignment_compoundAssignment() { | 2285 void test_invalidAssignment_compoundAssignment() { |
| 2229 Source source = addSource(EngineTestCase.createSource([ | 2286 Source source = addSource(EngineTestCase.createSource([ |
| 2230 "class byte {", | 2287 "class byte {", |
| 2231 " int _value;", | 2288 " int _value;", |
| 2232 " byte(this._value);", | 2289 " byte(this._value);", |
| 2233 " byte operator +(int val) {}", | 2290 " byte operator +(int val) { return this; }", |
| 2234 "}", | 2291 "}", |
| 2235 "", | 2292 "", |
| 2236 "void main() {", | 2293 "void main() {", |
| 2237 " byte b = new byte(52);", | 2294 " byte b = new byte(52);", |
| 2238 " b += 3;", | 2295 " b += 3;", |
| 2239 "}"])); | 2296 "}"])); |
| 2240 resolve(source); | 2297 resolve(source); |
| 2241 assertNoErrors(source); | 2298 assertNoErrors(source); |
| 2242 verify([source]); | 2299 verify([source]); |
| 2243 } | 2300 } |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2483 assertNoErrors(source); | 2540 assertNoErrors(source); |
| 2484 verify([source]); | 2541 verify([source]); |
| 2485 } | 2542 } |
| 2486 | 2543 |
| 2487 void test_invalidOverrideReturnType_returnType_void() { | 2544 void test_invalidOverrideReturnType_returnType_void() { |
| 2488 Source source = addSource(EngineTestCase.createSource([ | 2545 Source source = addSource(EngineTestCase.createSource([ |
| 2489 "class A {", | 2546 "class A {", |
| 2490 " void m() {}", | 2547 " void m() {}", |
| 2491 "}", | 2548 "}", |
| 2492 "class B extends A {", | 2549 "class B extends A {", |
| 2493 " int m() {}", | 2550 " int m() { return 0; }", |
| 2494 "}"])); | 2551 "}"])); |
| 2495 resolve(source); | 2552 resolve(source); |
| 2496 assertNoErrors(source); | 2553 assertNoErrors(source); |
| 2497 verify([source]); | 2554 verify([source]); |
| 2498 } | 2555 } |
| 2499 | 2556 |
| 2500 void test_invalidReferenceToThis_constructor() { | 2557 void test_invalidReferenceToThis_constructor() { |
| 2501 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
", " var v = this;", " }", "}"])); | 2558 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
", " var v = this;", " }", "}"])); |
| 2502 resolve(source); | 2559 resolve(source); |
| 2503 assertNoErrors(source); | 2560 assertNoErrors(source); |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2834 verify([source]); | 2891 verify([source]); |
| 2835 } | 2892 } |
| 2836 | 2893 |
| 2837 void test_newWithUndefinedConstructorDefault() { | 2894 void test_newWithUndefinedConstructorDefault() { |
| 2838 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", "}", "f() {", " new A();", "}"])); | 2895 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", "}", "f() {", " new A();", "}"])); |
| 2839 resolve(source); | 2896 resolve(source); |
| 2840 assertNoErrors(source); | 2897 assertNoErrors(source); |
| 2841 verify([source]); | 2898 verify([source]); |
| 2842 } | 2899 } |
| 2843 | 2900 |
| 2844 void test_nonAbstractClassInheritsAbstractMemberOne_abstractOverridesConcrete_
accessor() { | |
| 2845 Source source = addSource(EngineTestCase.createSource([ | |
| 2846 "class A {", | |
| 2847 " int get g => 0;", | |
| 2848 "}", | |
| 2849 "abstract class B extends A {", | |
| 2850 " int get g;", | |
| 2851 "}", | |
| 2852 "class C extends B {", | |
| 2853 "}"])); | |
| 2854 resolve(source); | |
| 2855 assertNoErrors(source); | |
| 2856 verify([source]); | |
| 2857 } | |
| 2858 | |
| 2859 void test_nonAbstractClassInheritsAbstractMemberOne_abstractOverridesConcrete_
method() { | |
| 2860 Source source = addSource(EngineTestCase.createSource([ | |
| 2861 "class A {", | |
| 2862 " m(p) {}", | |
| 2863 "}", | |
| 2864 "abstract class B extends A {", | |
| 2865 " m(p);", | |
| 2866 "}", | |
| 2867 "class C extends B {", | |
| 2868 "}"])); | |
| 2869 resolve(source); | |
| 2870 assertNoErrors(source); | |
| 2871 verify([source]); | |
| 2872 } | |
| 2873 | |
| 2874 void test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod_accessor() { | 2901 void test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod_accessor() { |
| 2875 Source source = addSource(EngineTestCase.createSource([ | 2902 Source source = addSource(EngineTestCase.createSource([ |
| 2876 "abstract class A {", | 2903 "abstract class A {", |
| 2877 " int get g;", | 2904 " int get g;", |
| 2878 "}", | 2905 "}", |
| 2879 "class B extends A {", | 2906 "class B extends A {", |
| 2880 " noSuchMethod(v) => '';", | 2907 " noSuchMethod(v) => '';", |
| 2881 "}"])); | 2908 "}"])); |
| 2882 resolve(source); | 2909 resolve(source); |
| 2883 assertNoErrors(source); | 2910 assertNoErrors(source); |
| (...skipping 1543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4427 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_Obje
ct); | 4454 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_Obje
ct); |
| 4428 }); | 4455 }); |
| 4429 _ut.test('test_caseExpressionTypeImplementsEquals_String', () { | 4456 _ut.test('test_caseExpressionTypeImplementsEquals_String', () { |
| 4430 final __test = new NonErrorResolverTest(); | 4457 final __test = new NonErrorResolverTest(); |
| 4431 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_Stri
ng); | 4458 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_Stri
ng); |
| 4432 }); | 4459 }); |
| 4433 _ut.test('test_caseExpressionTypeImplementsEquals_int', () { | 4460 _ut.test('test_caseExpressionTypeImplementsEquals_int', () { |
| 4434 final __test = new NonErrorResolverTest(); | 4461 final __test = new NonErrorResolverTest(); |
| 4435 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_int)
; | 4462 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_int)
; |
| 4436 }); | 4463 }); |
| 4464 _ut.test('test_commentReference_beforeFunction_blockBody', () { |
| 4465 final __test = new NonErrorResolverTest(); |
| 4466 runJUnitTest(__test, __test.test_commentReference_beforeFunction_blockBo
dy); |
| 4467 }); |
| 4468 _ut.test('test_commentReference_beforeFunction_expressionBody', () { |
| 4469 final __test = new NonErrorResolverTest(); |
| 4470 runJUnitTest(__test, __test.test_commentReference_beforeFunction_express
ionBody); |
| 4471 }); |
| 4472 _ut.test('test_commentReference_beforeMethod', () { |
| 4473 final __test = new NonErrorResolverTest(); |
| 4474 runJUnitTest(__test, __test.test_commentReference_beforeMethod); |
| 4475 }); |
| 4476 _ut.test('test_commentReference_class', () { |
| 4477 final __test = new NonErrorResolverTest(); |
| 4478 runJUnitTest(__test, __test.test_commentReference_class); |
| 4479 }); |
| 4437 _ut.test('test_concreteClassWithAbstractMember', () { | 4480 _ut.test('test_concreteClassWithAbstractMember', () { |
| 4438 final __test = new NonErrorResolverTest(); | 4481 final __test = new NonErrorResolverTest(); |
| 4439 runJUnitTest(__test, __test.test_concreteClassWithAbstractMember); | 4482 runJUnitTest(__test, __test.test_concreteClassWithAbstractMember); |
| 4440 }); | 4483 }); |
| 4441 _ut.test('test_conflictingInstanceGetterAndSuperclassMember_instance', ()
{ | 4484 _ut.test('test_conflictingInstanceGetterAndSuperclassMember_instance', ()
{ |
| 4442 final __test = new NonErrorResolverTest(); | 4485 final __test = new NonErrorResolverTest(); |
| 4443 runJUnitTest(__test, __test.test_conflictingInstanceGetterAndSuperclassM
ember_instance); | 4486 runJUnitTest(__test, __test.test_conflictingInstanceGetterAndSuperclassM
ember_instance); |
| 4444 }); | 4487 }); |
| 4445 _ut.test('test_conflictingStaticGetterAndInstanceSetter_thisClass', () { | 4488 _ut.test('test_conflictingStaticGetterAndInstanceSetter_thisClass', () { |
| 4446 final __test = new NonErrorResolverTest(); | 4489 final __test = new NonErrorResolverTest(); |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5031 runJUnitTest(__test, __test.test_newWithAbstractClass_factory); | 5074 runJUnitTest(__test, __test.test_newWithAbstractClass_factory); |
| 5032 }); | 5075 }); |
| 5033 _ut.test('test_newWithUndefinedConstructor', () { | 5076 _ut.test('test_newWithUndefinedConstructor', () { |
| 5034 final __test = new NonErrorResolverTest(); | 5077 final __test = new NonErrorResolverTest(); |
| 5035 runJUnitTest(__test, __test.test_newWithUndefinedConstructor); | 5078 runJUnitTest(__test, __test.test_newWithUndefinedConstructor); |
| 5036 }); | 5079 }); |
| 5037 _ut.test('test_newWithUndefinedConstructorDefault', () { | 5080 _ut.test('test_newWithUndefinedConstructorDefault', () { |
| 5038 final __test = new NonErrorResolverTest(); | 5081 final __test = new NonErrorResolverTest(); |
| 5039 runJUnitTest(__test, __test.test_newWithUndefinedConstructorDefault); | 5082 runJUnitTest(__test, __test.test_newWithUndefinedConstructorDefault); |
| 5040 }); | 5083 }); |
| 5041 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_abstractOverrides
Concrete_accessor', () { | |
| 5042 final __test = new NonErrorResolverTest(); | |
| 5043 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_abstractOverridesConcrete_accessor); | |
| 5044 }); | |
| 5045 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_abstractOverrides
Concrete_method', () { | |
| 5046 final __test = new NonErrorResolverTest(); | |
| 5047 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_abstractOverridesConcrete_method); | |
| 5048 }); | |
| 5049 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod_acce
ssor', () { | 5084 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod_acce
ssor', () { |
| 5050 final __test = new NonErrorResolverTest(); | 5085 final __test = new NonErrorResolverTest(); |
| 5051 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_noSuchMethod_accessor); | 5086 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_noSuchMethod_accessor); |
| 5052 }); | 5087 }); |
| 5053 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod_meth
od', () { | 5088 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod_meth
od', () { |
| 5054 final __test = new NonErrorResolverTest(); | 5089 final __test = new NonErrorResolverTest(); |
| 5055 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_noSuchMethod_method); | 5090 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_noSuchMethod_method); |
| 5056 }); | 5091 }); |
| 5057 _ut.test('test_nonBoolExpression_functionType', () { | 5092 _ut.test('test_nonBoolExpression_functionType', () { |
| 5058 final __test = new NonErrorResolverTest(); | 5093 final __test = new NonErrorResolverTest(); |
| (...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5978 resolve(source); | 6013 resolve(source); |
| 5979 assertErrors(source, [StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER
]); | 6014 assertErrors(source, [StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER
]); |
| 5980 verify([source]); | 6015 verify([source]); |
| 5981 } | 6016 } |
| 5982 | 6017 |
| 5983 void test_invalidAssignment_compoundAssignment() { | 6018 void test_invalidAssignment_compoundAssignment() { |
| 5984 Source source = addSource(EngineTestCase.createSource([ | 6019 Source source = addSource(EngineTestCase.createSource([ |
| 5985 "class byte {", | 6020 "class byte {", |
| 5986 " int _value;", | 6021 " int _value;", |
| 5987 " byte(this._value);", | 6022 " byte(this._value);", |
| 5988 " int operator +(int val) {}", | 6023 " int operator +(int val) { return 0; }", |
| 5989 "}", | 6024 "}", |
| 5990 "", | 6025 "", |
| 5991 "void main() {", | 6026 "void main() {", |
| 5992 " byte b = new byte(52);", | 6027 " byte b = new byte(52);", |
| 5993 " b += 3;", | 6028 " b += 3;", |
| 5994 "}"])); | 6029 "}"])); |
| 5995 resolve(source); | 6030 resolve(source); |
| 5996 assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]); | 6031 assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]); |
| 5997 verify([source]); | 6032 verify([source]); |
| 5998 } | 6033 } |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6199 resolve(source); | 6234 resolve(source); |
| 6200 assertErrors(source, [StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); | 6235 assertErrors(source, [StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); |
| 6201 verify([source]); | 6236 verify([source]); |
| 6202 } | 6237 } |
| 6203 | 6238 |
| 6204 void test_returnOfInvalidType_expressionFunctionBody_localFunction() { | 6239 void test_returnOfInvalidType_expressionFunctionBody_localFunction() { |
| 6205 Source source = addSource(EngineTestCase.createSource([ | 6240 Source source = addSource(EngineTestCase.createSource([ |
| 6206 "class A {", | 6241 "class A {", |
| 6207 " String m() {", | 6242 " String m() {", |
| 6208 " int f() => '0';", | 6243 " int f() => '0';", |
| 6244 " return '0';", |
| 6209 " }", | 6245 " }", |
| 6210 "}"])); | 6246 "}"])); |
| 6211 resolve(source); | 6247 resolve(source); |
| 6212 assertErrors(source, [StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); | 6248 assertErrors(source, [StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); |
| 6213 verify([source]); | 6249 verify([source]); |
| 6214 } | 6250 } |
| 6215 | 6251 |
| 6216 void test_returnOfInvalidType_expressionFunctionBody_method() { | 6252 void test_returnOfInvalidType_expressionFunctionBody_method() { |
| 6217 Source source = addSource(EngineTestCase.createSource(["class A {", " int f
() => '0';", "}"])); | 6253 Source source = addSource(EngineTestCase.createSource(["class A {", " int f
() => '0';", "}"])); |
| 6218 resolve(source); | 6254 resolve(source); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 6239 resolve(source); | 6275 resolve(source); |
| 6240 assertErrors(source, [StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); | 6276 assertErrors(source, [StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); |
| 6241 verify([source]); | 6277 verify([source]); |
| 6242 } | 6278 } |
| 6243 | 6279 |
| 6244 void test_returnOfInvalidType_localFunction() { | 6280 void test_returnOfInvalidType_localFunction() { |
| 6245 Source source = addSource(EngineTestCase.createSource([ | 6281 Source source = addSource(EngineTestCase.createSource([ |
| 6246 "class A {", | 6282 "class A {", |
| 6247 " String m() {", | 6283 " String m() {", |
| 6248 " int f() { return '0'; }", | 6284 " int f() { return '0'; }", |
| 6285 " return '0';", |
| 6249 " }", | 6286 " }", |
| 6250 "}"])); | 6287 "}"])); |
| 6251 resolve(source); | 6288 resolve(source); |
| 6252 assertErrors(source, [StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); | 6289 assertErrors(source, [StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); |
| 6253 verify([source]); | 6290 verify([source]); |
| 6254 } | 6291 } |
| 6255 | 6292 |
| 6256 void test_returnOfInvalidType_method() { | 6293 void test_returnOfInvalidType_method() { |
| 6257 Source source = addSource(EngineTestCase.createSource(["class A {", " int f
() { return '0'; }", "}"])); | 6294 Source source = addSource(EngineTestCase.createSource(["class A {", " int f
() { return '0'; }", "}"])); |
| 6258 resolve(source); | 6295 resolve(source); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6302 resolve(source); | 6339 resolve(source); |
| 6303 assertErrors(source, [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUND
S]); | 6340 assertErrors(source, [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUND
S]); |
| 6304 verify([source]); | 6341 verify([source]); |
| 6305 } | 6342 } |
| 6306 | 6343 |
| 6307 void test_typeArgumentNotMatchingBounds_functionReturnType() { | 6344 void test_typeArgumentNotMatchingBounds_functionReturnType() { |
| 6308 Source source = addSource(EngineTestCase.createSource([ | 6345 Source source = addSource(EngineTestCase.createSource([ |
| 6309 "class A {}", | 6346 "class A {}", |
| 6310 "class B {}", | 6347 "class B {}", |
| 6311 "class G<E extends A> {}", | 6348 "class G<E extends A> {}", |
| 6312 "G<B> f() {}"])); | 6349 "G<B> f() { return null; }"])); |
| 6313 resolve(source); | 6350 resolve(source); |
| 6314 assertErrors(source, [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUND
S]); | 6351 assertErrors(source, [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUND
S]); |
| 6315 verify([source]); | 6352 verify([source]); |
| 6316 } | 6353 } |
| 6317 | 6354 |
| 6318 void test_typeArgumentNotMatchingBounds_functionTypeAlias() { | 6355 void test_typeArgumentNotMatchingBounds_functionTypeAlias() { |
| 6319 Source source = addSource(EngineTestCase.createSource([ | 6356 Source source = addSource(EngineTestCase.createSource([ |
| 6320 "class A {}", | 6357 "class A {}", |
| 6321 "class B {}", | 6358 "class B {}", |
| 6322 "class G<E extends A> {}", | 6359 "class G<E extends A> {}", |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6358 assertErrors(source, [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUND
S]); | 6395 assertErrors(source, [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUND
S]); |
| 6359 verify([source]); | 6396 verify([source]); |
| 6360 } | 6397 } |
| 6361 | 6398 |
| 6362 void test_typeArgumentNotMatchingBounds_methodReturnType() { | 6399 void test_typeArgumentNotMatchingBounds_methodReturnType() { |
| 6363 Source source = addSource(EngineTestCase.createSource([ | 6400 Source source = addSource(EngineTestCase.createSource([ |
| 6364 "class A {}", | 6401 "class A {}", |
| 6365 "class B {}", | 6402 "class B {}", |
| 6366 "class G<E extends A> {}", | 6403 "class G<E extends A> {}", |
| 6367 "class C {", | 6404 "class C {", |
| 6368 " G<B> m() {}", | 6405 " G<B> m() { return null; }", |
| 6369 "}"])); | 6406 "}"])); |
| 6370 resolve(source); | 6407 resolve(source); |
| 6371 assertErrors(source, [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUND
S]); | 6408 assertErrors(source, [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUND
S]); |
| 6372 verify([source]); | 6409 verify([source]); |
| 6373 } | 6410 } |
| 6374 | 6411 |
| 6375 void test_typeArgumentNotMatchingBounds_new() { | 6412 void test_typeArgumentNotMatchingBounds_new() { |
| 6376 Source source = addSource(EngineTestCase.createSource([ | 6413 Source source = addSource(EngineTestCase.createSource([ |
| 6377 "class A {}", | 6414 "class A {}", |
| 6378 "class B {}", | 6415 "class B {}", |
| (...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7321 verify([source]); | 7358 verify([source]); |
| 7322 } | 7359 } |
| 7323 | 7360 |
| 7324 void fail_isNotInt() { | 7361 void fail_isNotInt() { |
| 7325 Source source = addSource(EngineTestCase.createSource(["var v = 1 is! int;"]
)); | 7362 Source source = addSource(EngineTestCase.createSource(["var v = 1 is! int;"]
)); |
| 7326 resolve(source); | 7363 resolve(source); |
| 7327 assertErrors(source, [HintCode.IS_NOT_INT]); | 7364 assertErrors(source, [HintCode.IS_NOT_INT]); |
| 7328 verify([source]); | 7365 verify([source]); |
| 7329 } | 7366 } |
| 7330 | 7367 |
| 7368 void fail_missingReturn_function() { |
| 7369 Source source = addSource(EngineTestCase.createSource(["int f() {}"])); |
| 7370 resolve(source); |
| 7371 assertErrors(source, [HintCode.MISSING_RETURN]); |
| 7372 verify([source]); |
| 7373 } |
| 7374 |
| 7375 void fail_missingReturn_method() { |
| 7376 Source source = addSource(EngineTestCase.createSource(["class A {", " int m
() {}", "}"])); |
| 7377 resolve(source); |
| 7378 assertErrors(source, [HintCode.MISSING_RETURN]); |
| 7379 verify([source]); |
| 7380 } |
| 7381 |
| 7331 void fail_overrideEqualsButNotHashCode() { | 7382 void fail_overrideEqualsButNotHashCode() { |
| 7332 Source source = addSource(EngineTestCase.createSource(["class A {", " bool
operator ==(x) {}", "}"])); | 7383 Source source = addSource(EngineTestCase.createSource(["class A {", " bool
operator ==(x) {}", "}"])); |
| 7333 resolve(source); | 7384 resolve(source); |
| 7334 assertErrors(source, [HintCode.OVERRIDE_EQUALS_BUT_NOT_HASH_CODE]); | 7385 assertErrors(source, [HintCode.OVERRIDE_EQUALS_BUT_NOT_HASH_CODE]); |
| 7335 verify([source]); | 7386 verify([source]); |
| 7336 } | 7387 } |
| 7337 | 7388 |
| 7338 void test_deadCode_deadBlock_conditionalElse() { | 7389 void test_deadCode_deadBlock_conditionalElse() { |
| 7339 Source source = addSource(EngineTestCase.createSource(["f() {", " true ? 1
: 2;", "}"])); | 7390 Source source = addSource(EngineTestCase.createSource(["f() {", " true ? 1
: 2;", "}"])); |
| 7340 resolve(source); | 7391 resolve(source); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7562 "}"])); | 7613 "}"])); |
| 7563 resolve(source); | 7614 resolve(source); |
| 7564 assertErrors(source, [HintCode.DEAD_CODE]); | 7615 assertErrors(source, [HintCode.DEAD_CODE]); |
| 7565 verify([source]); | 7616 verify([source]); |
| 7566 } | 7617 } |
| 7567 | 7618 |
| 7568 void test_deprecatedAnnotationUse_assignment() { | 7619 void test_deprecatedAnnotationUse_assignment() { |
| 7569 Source source = addSource(EngineTestCase.createSource([ | 7620 Source source = addSource(EngineTestCase.createSource([ |
| 7570 "class A {", | 7621 "class A {", |
| 7571 " @deprecated", | 7622 " @deprecated", |
| 7572 " A operator+(A a) {}", | 7623 " A operator+(A a) { return a; }", |
| 7573 "}", | 7624 "}", |
| 7574 "f(A a) {", | 7625 "f(A a) {", |
| 7575 " A b;", | 7626 " A b;", |
| 7576 " a += b;", | 7627 " a += b;", |
| 7577 "}"])); | 7628 "}"])); |
| 7578 resolve(source); | 7629 resolve(source); |
| 7579 assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]); | 7630 assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]); |
| 7580 verify([source]); | 7631 verify([source]); |
| 7581 } | 7632 } |
| 7582 | 7633 |
| (...skipping 2675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10258 check_constEvalTypeNum_withParameter_binary("p * ''"); | 10309 check_constEvalTypeNum_withParameter_binary("p * ''"); |
| 10259 check_constEvalTypeNum_withParameter_binary("p / ''"); | 10310 check_constEvalTypeNum_withParameter_binary("p / ''"); |
| 10260 check_constEvalTypeNum_withParameter_binary("p ~/ ''"); | 10311 check_constEvalTypeNum_withParameter_binary("p ~/ ''"); |
| 10261 check_constEvalTypeNum_withParameter_binary("p > ''"); | 10312 check_constEvalTypeNum_withParameter_binary("p > ''"); |
| 10262 check_constEvalTypeNum_withParameter_binary("p < ''"); | 10313 check_constEvalTypeNum_withParameter_binary("p < ''"); |
| 10263 check_constEvalTypeNum_withParameter_binary("p >= ''"); | 10314 check_constEvalTypeNum_withParameter_binary("p >= ''"); |
| 10264 check_constEvalTypeNum_withParameter_binary("p <= ''"); | 10315 check_constEvalTypeNum_withParameter_binary("p <= ''"); |
| 10265 check_constEvalTypeNum_withParameter_binary("p % ''"); | 10316 check_constEvalTypeNum_withParameter_binary("p % ''"); |
| 10266 } | 10317 } |
| 10267 | 10318 |
| 10268 void test_constEvalTypeNum_plus_String() { | |
| 10269 Source source = addSource("const C = 'a' + 'b';"); | |
| 10270 resolve(source); | |
| 10271 assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_TYPE_NUM]); | |
| 10272 verify([source]); | |
| 10273 } | |
| 10274 | |
| 10275 void test_constFormalParameter_fieldFormalParameter() { | 10319 void test_constFormalParameter_fieldFormalParameter() { |
| 10276 Source source = addSource(EngineTestCase.createSource(["class A {", " var x
;", " A(const this.x) {}", "}"])); | 10320 Source source = addSource(EngineTestCase.createSource(["class A {", " var x
;", " A(const this.x) {}", "}"])); |
| 10277 resolve(source); | 10321 resolve(source); |
| 10278 assertErrors(source, [CompileTimeErrorCode.CONST_FORMAL_PARAMETER]); | 10322 assertErrors(source, [CompileTimeErrorCode.CONST_FORMAL_PARAMETER]); |
| 10279 verify([source]); | 10323 verify([source]); |
| 10280 } | 10324 } |
| 10281 | 10325 |
| 10282 void test_constFormalParameter_simpleFormalParameter() { | 10326 void test_constFormalParameter_simpleFormalParameter() { |
| 10283 Source source = addSource(EngineTestCase.createSource(["f(const x) {}"])); | 10327 Source source = addSource(EngineTestCase.createSource(["f(const x) {}"])); |
| 10284 resolve(source); | 10328 resolve(source); |
| (...skipping 2810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13095 runJUnitTest(__test, __test.test_constEvalTypeBool_binary_leftTrue); | 13139 runJUnitTest(__test, __test.test_constEvalTypeBool_binary_leftTrue); |
| 13096 }); | 13140 }); |
| 13097 _ut.test('test_constEvalTypeInt_binary', () { | 13141 _ut.test('test_constEvalTypeInt_binary', () { |
| 13098 final __test = new CompileTimeErrorCodeTest(); | 13142 final __test = new CompileTimeErrorCodeTest(); |
| 13099 runJUnitTest(__test, __test.test_constEvalTypeInt_binary); | 13143 runJUnitTest(__test, __test.test_constEvalTypeInt_binary); |
| 13100 }); | 13144 }); |
| 13101 _ut.test('test_constEvalTypeNum_binary', () { | 13145 _ut.test('test_constEvalTypeNum_binary', () { |
| 13102 final __test = new CompileTimeErrorCodeTest(); | 13146 final __test = new CompileTimeErrorCodeTest(); |
| 13103 runJUnitTest(__test, __test.test_constEvalTypeNum_binary); | 13147 runJUnitTest(__test, __test.test_constEvalTypeNum_binary); |
| 13104 }); | 13148 }); |
| 13105 _ut.test('test_constEvalTypeNum_plus_String', () { | |
| 13106 final __test = new CompileTimeErrorCodeTest(); | |
| 13107 runJUnitTest(__test, __test.test_constEvalTypeNum_plus_String); | |
| 13108 }); | |
| 13109 _ut.test('test_constEval_newInstance_constConstructor', () { | 13149 _ut.test('test_constEval_newInstance_constConstructor', () { |
| 13110 final __test = new CompileTimeErrorCodeTest(); | 13150 final __test = new CompileTimeErrorCodeTest(); |
| 13111 runJUnitTest(__test, __test.test_constEval_newInstance_constConstructor)
; | 13151 runJUnitTest(__test, __test.test_constEval_newInstance_constConstructor)
; |
| 13112 }); | 13152 }); |
| 13113 _ut.test('test_constEval_propertyExtraction_targetNotConst', () { | 13153 _ut.test('test_constEval_propertyExtraction_targetNotConst', () { |
| 13114 final __test = new CompileTimeErrorCodeTest(); | 13154 final __test = new CompileTimeErrorCodeTest(); |
| 13115 runJUnitTest(__test, __test.test_constEval_propertyExtraction_targetNotC
onst); | 13155 runJUnitTest(__test, __test.test_constEval_propertyExtraction_targetNotC
onst); |
| 13116 }); | 13156 }); |
| 13117 _ut.test('test_constFormalParameter_fieldFormalParameter', () { | 13157 _ut.test('test_constFormalParameter_fieldFormalParameter', () { |
| 13118 final __test = new CompileTimeErrorCodeTest(); | 13158 final __test = new CompileTimeErrorCodeTest(); |
| (...skipping 1839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14958 variable.type = classA.type; | 14998 variable.type = classA.type; |
| 14959 target.staticElement = variable; | 14999 target.staticElement = variable; |
| 14960 target.staticType = classA.type; | 15000 target.staticType = classA.type; |
| 14961 PrefixedIdentifier identifier = ASTFactory.identifier(target, ASTFactory.ide
ntifier3(getterName)); | 15001 PrefixedIdentifier identifier = ASTFactory.identifier(target, ASTFactory.ide
ntifier3(getterName)); |
| 14962 resolveNode(identifier, []); | 15002 resolveNode(identifier, []); |
| 14963 JUnitTestCase.assertSame(getter, identifier.staticElement); | 15003 JUnitTestCase.assertSame(getter, identifier.staticElement); |
| 14964 JUnitTestCase.assertSame(getter, identifier.identifier.staticElement); | 15004 JUnitTestCase.assertSame(getter, identifier.identifier.staticElement); |
| 14965 _listener.assertNoErrors(); | 15005 _listener.assertNoErrors(); |
| 14966 } | 15006 } |
| 14967 | 15007 |
| 15008 void test_visitPrefixedIdentifier_staticClassMember_getter() { |
| 15009 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 15010 String propName = "b"; |
| 15011 PropertyAccessorElement getter = ElementFactory.getterElement(propName, fals
e, _typeProvider.intType); |
| 15012 PropertyAccessorElement setter = ElementFactory.setterElement(propName, fals
e, _typeProvider.intType); |
| 15013 classA.accessors = <PropertyAccessorElement> [getter, setter]; |
| 15014 SimpleIdentifier target = ASTFactory.identifier3("A"); |
| 15015 target.staticElement = classA; |
| 15016 target.staticType = classA.type; |
| 15017 PrefixedIdentifier identifier = ASTFactory.identifier(target, ASTFactory.ide
ntifier3(propName)); |
| 15018 resolveNode(identifier, []); |
| 15019 JUnitTestCase.assertSame(getter, identifier.staticElement); |
| 15020 JUnitTestCase.assertSame(getter, identifier.identifier.staticElement); |
| 15021 _listener.assertNoErrors(); |
| 15022 } |
| 15023 |
| 15024 void test_visitPrefixedIdentifier_staticClassMember_method() { |
| 15025 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 15026 String propName = "m"; |
| 15027 PropertyAccessorElement setter = ElementFactory.setterElement(propName, fals
e, _typeProvider.intType); |
| 15028 classA.accessors = <PropertyAccessorElement> [setter]; |
| 15029 MethodElement method = ElementFactory.methodElement("m", _typeProvider.intTy
pe, []); |
| 15030 classA.methods = <MethodElement> [method]; |
| 15031 SimpleIdentifier target = ASTFactory.identifier3("A"); |
| 15032 target.staticElement = classA; |
| 15033 target.staticType = classA.type; |
| 15034 PrefixedIdentifier identifier = ASTFactory.identifier(target, ASTFactory.ide
ntifier3(propName)); |
| 15035 ASTFactory.assignmentExpression(identifier, TokenType.EQ, ASTFactory.nullLit
eral()); |
| 15036 resolveNode(identifier, []); |
| 15037 JUnitTestCase.assertSame(method, identifier.staticElement); |
| 15038 JUnitTestCase.assertSame(method, identifier.identifier.staticElement); |
| 15039 _listener.assertNoErrors(); |
| 15040 } |
| 15041 |
| 15042 void test_visitPrefixedIdentifier_staticClassMember_setter() { |
| 15043 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 15044 String propName = "b"; |
| 15045 PropertyAccessorElement getter = ElementFactory.getterElement(propName, fals
e, _typeProvider.intType); |
| 15046 PropertyAccessorElement setter = ElementFactory.setterElement(propName, fals
e, _typeProvider.intType); |
| 15047 classA.accessors = <PropertyAccessorElement> [getter, setter]; |
| 15048 SimpleIdentifier target = ASTFactory.identifier3("A"); |
| 15049 target.staticElement = classA; |
| 15050 target.staticType = classA.type; |
| 15051 PrefixedIdentifier identifier = ASTFactory.identifier(target, ASTFactory.ide
ntifier3(propName)); |
| 15052 ASTFactory.assignmentExpression(identifier, TokenType.EQ, ASTFactory.nullLit
eral()); |
| 15053 resolveNode(identifier, []); |
| 15054 JUnitTestCase.assertSame(setter, identifier.staticElement); |
| 15055 JUnitTestCase.assertSame(setter, identifier.identifier.staticElement); |
| 15056 _listener.assertNoErrors(); |
| 15057 } |
| 15058 |
| 14968 void test_visitPrefixExpression() { | 15059 void test_visitPrefixExpression() { |
| 14969 InterfaceType numType = _typeProvider.numType; | 15060 InterfaceType numType = _typeProvider.numType; |
| 14970 SimpleIdentifier operand = ASTFactory.identifier3("i"); | 15061 SimpleIdentifier operand = ASTFactory.identifier3("i"); |
| 14971 operand.staticType = numType; | 15062 operand.staticType = numType; |
| 14972 PrefixExpression expression = ASTFactory.prefixExpression(TokenType.PLUS_PLU
S, operand); | 15063 PrefixExpression expression = ASTFactory.prefixExpression(TokenType.PLUS_PLU
S, operand); |
| 14973 resolveNode(expression, []); | 15064 resolveNode(expression, []); |
| 14974 JUnitTestCase.assertEquals(getMethod(numType, "+"), expression.staticElement
); | 15065 JUnitTestCase.assertEquals(getMethod(numType, "+"), expression.staticElement
); |
| 14975 _listener.assertNoErrors(); | 15066 _listener.assertNoErrors(); |
| 14976 } | 15067 } |
| 14977 | 15068 |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15340 runJUnitTest(__test, __test.test_visitPrefixExpression); | 15431 runJUnitTest(__test, __test.test_visitPrefixExpression); |
| 15341 }); | 15432 }); |
| 15342 _ut.test('test_visitPrefixedIdentifier_dynamic', () { | 15433 _ut.test('test_visitPrefixedIdentifier_dynamic', () { |
| 15343 final __test = new ElementResolverTest(); | 15434 final __test = new ElementResolverTest(); |
| 15344 runJUnitTest(__test, __test.test_visitPrefixedIdentifier_dynamic); | 15435 runJUnitTest(__test, __test.test_visitPrefixedIdentifier_dynamic); |
| 15345 }); | 15436 }); |
| 15346 _ut.test('test_visitPrefixedIdentifier_nonDynamic', () { | 15437 _ut.test('test_visitPrefixedIdentifier_nonDynamic', () { |
| 15347 final __test = new ElementResolverTest(); | 15438 final __test = new ElementResolverTest(); |
| 15348 runJUnitTest(__test, __test.test_visitPrefixedIdentifier_nonDynamic); | 15439 runJUnitTest(__test, __test.test_visitPrefixedIdentifier_nonDynamic); |
| 15349 }); | 15440 }); |
| 15441 _ut.test('test_visitPrefixedIdentifier_staticClassMember_getter', () { |
| 15442 final __test = new ElementResolverTest(); |
| 15443 runJUnitTest(__test, __test.test_visitPrefixedIdentifier_staticClassMemb
er_getter); |
| 15444 }); |
| 15445 _ut.test('test_visitPrefixedIdentifier_staticClassMember_method', () { |
| 15446 final __test = new ElementResolverTest(); |
| 15447 runJUnitTest(__test, __test.test_visitPrefixedIdentifier_staticClassMemb
er_method); |
| 15448 }); |
| 15449 _ut.test('test_visitPrefixedIdentifier_staticClassMember_setter', () { |
| 15450 final __test = new ElementResolverTest(); |
| 15451 runJUnitTest(__test, __test.test_visitPrefixedIdentifier_staticClassMemb
er_setter); |
| 15452 }); |
| 15350 _ut.test('test_visitPropertyAccess_getter_identifier', () { | 15453 _ut.test('test_visitPropertyAccess_getter_identifier', () { |
| 15351 final __test = new ElementResolverTest(); | 15454 final __test = new ElementResolverTest(); |
| 15352 runJUnitTest(__test, __test.test_visitPropertyAccess_getter_identifier); | 15455 runJUnitTest(__test, __test.test_visitPropertyAccess_getter_identifier); |
| 15353 }); | 15456 }); |
| 15354 _ut.test('test_visitPropertyAccess_getter_super', () { | 15457 _ut.test('test_visitPropertyAccess_getter_super', () { |
| 15355 final __test = new ElementResolverTest(); | 15458 final __test = new ElementResolverTest(); |
| 15356 runJUnitTest(__test, __test.test_visitPropertyAccess_getter_super); | 15459 runJUnitTest(__test, __test.test_visitPropertyAccess_getter_super); |
| 15357 }); | 15460 }); |
| 15358 _ut.test('test_visitPropertyAccess_setter_this', () { | 15461 _ut.test('test_visitPropertyAccess_setter_this', () { |
| 15359 final __test = new ElementResolverTest(); | 15462 final __test = new ElementResolverTest(); |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15717 assertErrors(source, [StaticWarningCode.AMBIGUOUS_IMPORT]); | 15820 assertErrors(source, [StaticWarningCode.AMBIGUOUS_IMPORT]); |
| 15718 } | 15821 } |
| 15719 | 15822 |
| 15720 void test_ambiguousImport_typeAnnotation() { | 15823 void test_ambiguousImport_typeAnnotation() { |
| 15721 Source source = addSource(EngineTestCase.createSource([ | 15824 Source source = addSource(EngineTestCase.createSource([ |
| 15722 "import 'lib1.dart';", | 15825 "import 'lib1.dart';", |
| 15723 "import 'lib2.dart';", | 15826 "import 'lib2.dart';", |
| 15724 "typedef N FT(N p);", | 15827 "typedef N FT(N p);", |
| 15725 "N f(N p) {", | 15828 "N f(N p) {", |
| 15726 " N v;", | 15829 " N v;", |
| 15830 " return null;", |
| 15727 "}", | 15831 "}", |
| 15728 "class A {", | 15832 "class A {", |
| 15729 " N m() {}", | 15833 " N m() { return null; }", |
| 15730 "}", | 15834 "}", |
| 15731 "class B<T extends N> {}"])); | 15835 "class B<T extends N> {}"])); |
| 15732 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); | 15836 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); |
| 15733 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); | 15837 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); |
| 15734 resolve(source); | 15838 resolve(source); |
| 15735 assertErrors(source, [ | 15839 assertErrors(source, [ |
| 15736 StaticWarningCode.AMBIGUOUS_IMPORT, | 15840 StaticWarningCode.AMBIGUOUS_IMPORT, |
| 15737 StaticWarningCode.AMBIGUOUS_IMPORT, | 15841 StaticWarningCode.AMBIGUOUS_IMPORT, |
| 15738 StaticWarningCode.AMBIGUOUS_IMPORT, | 15842 StaticWarningCode.AMBIGUOUS_IMPORT, |
| 15739 StaticWarningCode.AMBIGUOUS_IMPORT, | 15843 StaticWarningCode.AMBIGUOUS_IMPORT, |
| 15740 StaticWarningCode.AMBIGUOUS_IMPORT, | 15844 StaticWarningCode.AMBIGUOUS_IMPORT, |
| 15741 StaticWarningCode.AMBIGUOUS_IMPORT, | 15845 StaticWarningCode.AMBIGUOUS_IMPORT, |
| 15742 StaticWarningCode.AMBIGUOUS_IMPORT]); | 15846 StaticWarningCode.AMBIGUOUS_IMPORT]); |
| 15743 } | 15847 } |
| 15744 | 15848 |
| 15745 void test_ambiguousImport_typeArgument_annotation() { | 15849 void test_ambiguousImport_typeArgument_annotation() { |
| 15746 Source source = addSource(EngineTestCase.createSource([ | 15850 Source source = addSource(EngineTestCase.createSource([ |
| 15747 "import 'lib1.dart';", | 15851 "import 'lib1.dart';", |
| 15748 "import 'lib2.dart';", | 15852 "import 'lib2.dart';", |
| 15749 "class A<T> {}", | 15853 "class A<T> {}", |
| 15750 "A<N> f() {}"])); | 15854 "A<N> f() { return null; }"])); |
| 15751 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); | 15855 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); |
| 15752 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); | 15856 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); |
| 15753 resolve(source); | 15857 resolve(source); |
| 15754 assertErrors(source, [StaticWarningCode.AMBIGUOUS_IMPORT]); | 15858 assertErrors(source, [StaticWarningCode.AMBIGUOUS_IMPORT]); |
| 15755 } | 15859 } |
| 15756 | 15860 |
| 15757 void test_ambiguousImport_typeArgument_instanceCreation() { | 15861 void test_ambiguousImport_typeArgument_instanceCreation() { |
| 15758 Source source = addSource(EngineTestCase.createSource([ | 15862 Source source = addSource(EngineTestCase.createSource([ |
| 15759 "import 'lib1.dart';", | 15863 "import 'lib1.dart';", |
| 15760 "import 'lib2.dart';", | 15864 "import 'lib2.dart';", |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15821 " operator +(int p) {}", | 15925 " operator +(int p) {}", |
| 15822 "}", | 15926 "}", |
| 15823 "f(A a) {", | 15927 "f(A a) {", |
| 15824 " a + '0';", | 15928 " a + '0';", |
| 15825 "}"])); | 15929 "}"])); |
| 15826 resolve(source); | 15930 resolve(source); |
| 15827 assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 15931 assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 15828 verify([source]); | 15932 verify([source]); |
| 15829 } | 15933 } |
| 15830 | 15934 |
| 15831 void test_argumentTypeNotAssignable_cascadeSEcond() { | 15935 void test_argumentTypeNotAssignable_cascadeSecond() { |
| 15832 Source source = addSource(EngineTestCase.createSource([ | 15936 Source source = addSource(EngineTestCase.createSource([ |
| 15833 "// filler filler filler filler filler filler filler filler filler fille
r", | 15937 "// filler filler filler filler filler filler filler filler filler fille
r", |
| 15834 "class A {", | 15938 "class A {", |
| 15835 " B ma() {}", | 15939 " B ma() { return new B(); }", |
| 15836 "}", | 15940 "}", |
| 15837 "class B {", | 15941 "class B {", |
| 15838 " mb(String p) {}", | 15942 " mb(String p) {}", |
| 15839 "}", | 15943 "}", |
| 15840 "", | 15944 "", |
| 15841 "main() {", | 15945 "main() {", |
| 15842 " A a = new A();", | 15946 " A a = new A();", |
| 15843 " a.. ma().mb(0);", | 15947 " a.. ma().mb(0);", |
| 15844 "}"])); | 15948 "}"])); |
| 15845 resolve(source); | 15949 resolve(source); |
| (...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16821 " String m() { return 'a'; }", | 16925 " String m() { return 'a'; }", |
| 16822 "}"])); | 16926 "}"])); |
| 16823 resolve(source); | 16927 resolve(source); |
| 16824 assertErrors(source, [StaticWarningCode.INVALID_METHOD_OVERRIDE_RETURN_TYPE]
); | 16928 assertErrors(source, [StaticWarningCode.INVALID_METHOD_OVERRIDE_RETURN_TYPE]
); |
| 16825 verify([source]); | 16929 verify([source]); |
| 16826 } | 16930 } |
| 16827 | 16931 |
| 16828 void test_invalidMethodOverrideReturnType_void() { | 16932 void test_invalidMethodOverrideReturnType_void() { |
| 16829 Source source = addSource(EngineTestCase.createSource([ | 16933 Source source = addSource(EngineTestCase.createSource([ |
| 16830 "class A {", | 16934 "class A {", |
| 16831 " int m() {}", | 16935 " int m() { return 0; }", |
| 16832 "}", | 16936 "}", |
| 16833 "class B extends A {", | 16937 "class B extends A {", |
| 16834 " void m() {}", | 16938 " void m() {}", |
| 16835 "}"])); | 16939 "}"])); |
| 16836 resolve(source); | 16940 resolve(source); |
| 16837 assertErrors(source, [StaticWarningCode.INVALID_METHOD_OVERRIDE_RETURN_TYPE]
); | 16941 assertErrors(source, [StaticWarningCode.INVALID_METHOD_OVERRIDE_RETURN_TYPE]
); |
| 16838 verify([source]); | 16942 verify([source]); |
| 16839 } | 16943 } |
| 16840 | 16944 |
| 16841 void test_invalidOverrideDifferentDefaultValues_named() { | 16945 void test_invalidOverrideDifferentDefaultValues_named() { |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17177 " o();", | 17281 " o();", |
| 17178 " p();", | 17282 " p();", |
| 17179 "}", | 17283 "}", |
| 17180 "class C extends A {", | 17284 "class C extends A {", |
| 17181 "}"])); | 17285 "}"])); |
| 17182 resolve(source); | 17286 resolve(source); |
| 17183 assertErrors(source, [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT
_MEMBER_FOUR]); | 17287 assertErrors(source, [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT
_MEMBER_FOUR]); |
| 17184 verify([source]); | 17288 verify([source]); |
| 17185 } | 17289 } |
| 17186 | 17290 |
| 17291 void test_nonAbstractClassInheritsAbstractMemberOne_abstractOverridesConcrete_
accessor() { |
| 17292 Source source = addSource(EngineTestCase.createSource([ |
| 17293 "class A {", |
| 17294 " int get g => 0;", |
| 17295 "}", |
| 17296 "abstract class B extends A {", |
| 17297 " int get g;", |
| 17298 "}", |
| 17299 "class C extends B {}"])); |
| 17300 resolve(source); |
| 17301 assertErrors(source, [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT
_MEMBER_ONE]); |
| 17302 verify([source]); |
| 17303 } |
| 17304 |
| 17305 void test_nonAbstractClassInheritsAbstractMemberOne_abstractOverridesConcrete_
method() { |
| 17306 Source source = addSource(EngineTestCase.createSource([ |
| 17307 "class A {", |
| 17308 " m(p) {}", |
| 17309 "}", |
| 17310 "abstract class B extends A {", |
| 17311 " m(p);", |
| 17312 "}", |
| 17313 "class C extends B {}"])); |
| 17314 resolve(source); |
| 17315 assertErrors(source, [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT
_MEMBER_ONE]); |
| 17316 verify([source]); |
| 17317 } |
| 17318 |
| 17319 void test_nonAbstractClassInheritsAbstractMemberOne_ensureCorrectFunctionSubty
peIsUsedInImplementation() { |
| 17320 Source source = addSource(EngineTestCase.createSource([ |
| 17321 "class C {", |
| 17322 " foo(int x) => x;", |
| 17323 "}", |
| 17324 "abstract class D {", |
| 17325 " foo(x, [y]);", |
| 17326 "}", |
| 17327 "class E extends C implements D {}"])); |
| 17328 resolve(source); |
| 17329 assertErrors(source, [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT
_MEMBER_ONE]); |
| 17330 verify([source]); |
| 17331 } |
| 17332 |
| 17187 void test_nonAbstractClassInheritsAbstractMemberOne_getter_fromInterface() { | 17333 void test_nonAbstractClassInheritsAbstractMemberOne_getter_fromInterface() { |
| 17188 Source source = addSource(EngineTestCase.createSource([ | 17334 Source source = addSource(EngineTestCase.createSource([ |
| 17189 "class I {", | 17335 "class I {", |
| 17190 " int get g {return 1;}", | 17336 " int get g {return 1;}", |
| 17191 "}", | 17337 "}", |
| 17192 "class C implements I {", | 17338 "class C implements I {", |
| 17193 "}"])); | 17339 "}"])); |
| 17194 resolve(source); | 17340 resolve(source); |
| 17195 assertErrors(source, [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT
_MEMBER_ONE]); | 17341 assertErrors(source, [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT
_MEMBER_ONE]); |
| 17196 verify([source]); | 17342 verify([source]); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17327 " try {", | 17473 " try {", |
| 17328 " } on T catch (e) {", | 17474 " } on T catch (e) {", |
| 17329 " }", | 17475 " }", |
| 17330 "}"])); | 17476 "}"])); |
| 17331 resolve(source); | 17477 resolve(source); |
| 17332 assertErrors(source, [StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE]); | 17478 assertErrors(source, [StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE]); |
| 17333 verify([source]); | 17479 verify([source]); |
| 17334 } | 17480 } |
| 17335 | 17481 |
| 17336 void test_nonVoidReturnForOperator() { | 17482 void test_nonVoidReturnForOperator() { |
| 17337 Source source = addSource(EngineTestCase.createSource(["class A {", " int o
perator []=(a, b) {}", "}"])); | 17483 Source source = addSource(EngineTestCase.createSource([ |
| 17484 "class A {", |
| 17485 " int operator []=(a, b) { return a; }", |
| 17486 "}"])); |
| 17338 resolve(source); | 17487 resolve(source); |
| 17339 assertErrors(source, [StaticWarningCode.NON_VOID_RETURN_FOR_OPERATOR]); | 17488 assertErrors(source, [StaticWarningCode.NON_VOID_RETURN_FOR_OPERATOR]); |
| 17340 verify([source]); | 17489 verify([source]); |
| 17341 } | 17490 } |
| 17342 | 17491 |
| 17343 void test_nonVoidReturnForSetter_function() { | 17492 void test_nonVoidReturnForSetter_function() { |
| 17344 Source source = addSource(EngineTestCase.createSource(["int set x(int v) {",
" return 42;", "}"])); | 17493 Source source = addSource(EngineTestCase.createSource(["int set x(int v) {",
" return 42;", "}"])); |
| 17345 resolve(source); | 17494 resolve(source); |
| 17346 assertErrors(source, [StaticWarningCode.NON_VOID_RETURN_FOR_SETTER]); | 17495 assertErrors(source, [StaticWarningCode.NON_VOID_RETURN_FOR_SETTER]); |
| 17347 verify([source]); | 17496 verify([source]); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17540 } | 17689 } |
| 17541 | 17690 |
| 17542 void test_typeParameterReferencedByStatic_methodParameter() { | 17691 void test_typeParameterReferencedByStatic_methodParameter() { |
| 17543 Source source = addSource(EngineTestCase.createSource(["class A<K> {", " st
atic m(K k) {}", "}"])); | 17692 Source source = addSource(EngineTestCase.createSource(["class A<K> {", " st
atic m(K k) {}", "}"])); |
| 17544 resolve(source); | 17693 resolve(source); |
| 17545 assertErrors(source, [StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC]
); | 17694 assertErrors(source, [StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC]
); |
| 17546 verify([source]); | 17695 verify([source]); |
| 17547 } | 17696 } |
| 17548 | 17697 |
| 17549 void test_typeParameterReferencedByStatic_methodReturn() { | 17698 void test_typeParameterReferencedByStatic_methodReturn() { |
| 17550 Source source = addSource(EngineTestCase.createSource(["class A<K> {", " st
atic K m() {}", "}"])); | 17699 Source source = addSource(EngineTestCase.createSource(["class A<K> {", " st
atic K m() { return null; }", "}"])); |
| 17551 resolve(source); | 17700 resolve(source); |
| 17552 assertErrors(source, [StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC]
); | 17701 assertErrors(source, [StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC]
); |
| 17553 verify([source]); | 17702 verify([source]); |
| 17554 } | 17703 } |
| 17555 | 17704 |
| 17556 void test_typeParameterReferencedByStatic_setter() { | 17705 void test_typeParameterReferencedByStatic_setter() { |
| 17557 Source source = addSource(EngineTestCase.createSource(["class A<K> {", " st
atic set s(K k) {}", "}"])); | 17706 Source source = addSource(EngineTestCase.createSource(["class A<K> {", " st
atic set s(K k) {}", "}"])); |
| 17558 resolve(source); | 17707 resolve(source); |
| 17559 assertErrors(source, [StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC]
); | 17708 assertErrors(source, [StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC]
); |
| 17560 verify([source]); | 17709 verify([source]); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17802 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_annotation_na
medConstructor); | 17951 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_annotation_na
medConstructor); |
| 17803 }); | 17952 }); |
| 17804 _ut.test('test_argumentTypeNotAssignable_annotation_unnamedConstructor', (
) { | 17953 _ut.test('test_argumentTypeNotAssignable_annotation_unnamedConstructor', (
) { |
| 17805 final __test = new StaticWarningCodeTest(); | 17954 final __test = new StaticWarningCodeTest(); |
| 17806 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_annotation_un
namedConstructor); | 17955 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_annotation_un
namedConstructor); |
| 17807 }); | 17956 }); |
| 17808 _ut.test('test_argumentTypeNotAssignable_binary', () { | 17957 _ut.test('test_argumentTypeNotAssignable_binary', () { |
| 17809 final __test = new StaticWarningCodeTest(); | 17958 final __test = new StaticWarningCodeTest(); |
| 17810 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_binary); | 17959 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_binary); |
| 17811 }); | 17960 }); |
| 17812 _ut.test('test_argumentTypeNotAssignable_cascadeSEcond', () { | 17961 _ut.test('test_argumentTypeNotAssignable_cascadeSecond', () { |
| 17813 final __test = new StaticWarningCodeTest(); | 17962 final __test = new StaticWarningCodeTest(); |
| 17814 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_cascadeSEcond
); | 17963 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_cascadeSecond
); |
| 17815 }); | 17964 }); |
| 17816 _ut.test('test_argumentTypeNotAssignable_const', () { | 17965 _ut.test('test_argumentTypeNotAssignable_const', () { |
| 17817 final __test = new StaticWarningCodeTest(); | 17966 final __test = new StaticWarningCodeTest(); |
| 17818 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_const); | 17967 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_const); |
| 17819 }); | 17968 }); |
| 17820 _ut.test('test_argumentTypeNotAssignable_const_super', () { | 17969 _ut.test('test_argumentTypeNotAssignable_const_super', () { |
| 17821 final __test = new StaticWarningCodeTest(); | 17970 final __test = new StaticWarningCodeTest(); |
| 17822 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_const_super); | 17971 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_const_super); |
| 17823 }); | 17972 }); |
| 17824 _ut.test('test_argumentTypeNotAssignable_functionExpressionInvocation_requ
ired', () { | 17973 _ut.test('test_argumentTypeNotAssignable_functionExpressionInvocation_requ
ired', () { |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18278 runJUnitTest(__test, __test.test_newWithUndefinedConstructorDefault); | 18427 runJUnitTest(__test, __test.test_newWithUndefinedConstructorDefault); |
| 18279 }); | 18428 }); |
| 18280 _ut.test('test_nonAbstractClassInheritsAbstractMemberFivePlus', () { | 18429 _ut.test('test_nonAbstractClassInheritsAbstractMemberFivePlus', () { |
| 18281 final __test = new StaticWarningCodeTest(); | 18430 final __test = new StaticWarningCodeTest(); |
| 18282 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberF
ivePlus); | 18431 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberF
ivePlus); |
| 18283 }); | 18432 }); |
| 18284 _ut.test('test_nonAbstractClassInheritsAbstractMemberFour', () { | 18433 _ut.test('test_nonAbstractClassInheritsAbstractMemberFour', () { |
| 18285 final __test = new StaticWarningCodeTest(); | 18434 final __test = new StaticWarningCodeTest(); |
| 18286 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberF
our); | 18435 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberF
our); |
| 18287 }); | 18436 }); |
| 18437 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_abstractOverrides
Concrete_accessor', () { |
| 18438 final __test = new StaticWarningCodeTest(); |
| 18439 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_abstractOverridesConcrete_accessor); |
| 18440 }); |
| 18441 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_abstractOverrides
Concrete_method', () { |
| 18442 final __test = new StaticWarningCodeTest(); |
| 18443 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_abstractOverridesConcrete_method); |
| 18444 }); |
| 18445 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_ensureCorrectFunc
tionSubtypeIsUsedInImplementation', () { |
| 18446 final __test = new StaticWarningCodeTest(); |
| 18447 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_ensureCorrectFunctionSubtypeIsUsedInImplementation); |
| 18448 }); |
| 18288 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_getter_fromInterf
ace', () { | 18449 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_getter_fromInterf
ace', () { |
| 18289 final __test = new StaticWarningCodeTest(); | 18450 final __test = new StaticWarningCodeTest(); |
| 18290 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_getter_fromInterface); | 18451 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_getter_fromInterface); |
| 18291 }); | 18452 }); |
| 18292 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_getter_fromSuperc
lass', () { | 18453 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_getter_fromSuperc
lass', () { |
| 18293 final __test = new StaticWarningCodeTest(); | 18454 final __test = new StaticWarningCodeTest(); |
| 18294 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_getter_fromSuperclass); | 18455 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_getter_fromSuperclass); |
| 18295 }); | 18456 }); |
| 18296 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_method_fromInterf
ace', () { | 18457 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_method_fromInterf
ace', () { |
| 18297 final __test = new StaticWarningCodeTest(); | 18458 final __test = new StaticWarningCodeTest(); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18518 runJUnitTest(__test, __test.test_undefinedStaticMethodOrGetter_method_in
Superclass); | 18679 runJUnitTest(__test, __test.test_undefinedStaticMethodOrGetter_method_in
Superclass); |
| 18519 }); | 18680 }); |
| 18520 _ut.test('test_undefinedStaticMethodOrGetter_setter_inSuperclass', () { | 18681 _ut.test('test_undefinedStaticMethodOrGetter_setter_inSuperclass', () { |
| 18521 final __test = new StaticWarningCodeTest(); | 18682 final __test = new StaticWarningCodeTest(); |
| 18522 runJUnitTest(__test, __test.test_undefinedStaticMethodOrGetter_setter_in
Superclass); | 18683 runJUnitTest(__test, __test.test_undefinedStaticMethodOrGetter_setter_in
Superclass); |
| 18523 }); | 18684 }); |
| 18524 }); | 18685 }); |
| 18525 } | 18686 } |
| 18526 } | 18687 } |
| 18527 | 18688 |
| 18689 /** |
| 18690 * Helper for creating and managing single [AnalysisContext]. |
| 18691 */ |
| 18692 class AnalysisContextHelper { |
| 18693 AnalysisContext context; |
| 18694 |
| 18695 SourceFactory _sourceFactory; |
| 18696 |
| 18697 ContentCache _cache; |
| 18698 |
| 18699 /** |
| 18700 * Creates new [AnalysisContext] using [AnalysisContextFactory#contextWithCore
]. |
| 18701 */ |
| 18702 AnalysisContextHelper() { |
| 18703 context = AnalysisContextFactory.contextWithCore(); |
| 18704 _sourceFactory = context.sourceFactory; |
| 18705 _cache = _sourceFactory.contentCache; |
| 18706 } |
| 18707 |
| 18708 Source addSource(String path, String code) { |
| 18709 Source source = new FileBasedSource.con1(_cache, FileUtilities2.createFile(p
ath)); |
| 18710 { |
| 18711 _sourceFactory.setContents(source, ""); |
| 18712 ChangeSet changeSet = new ChangeSet(); |
| 18713 changeSet.added(source); |
| 18714 context.applyChanges(changeSet); |
| 18715 } |
| 18716 context.setContents(source, code); |
| 18717 return source; |
| 18718 } |
| 18719 |
| 18720 CompilationUnit resolveDefiningUnit(Source source) { |
| 18721 LibraryElement libraryElement = context.computeLibraryElement(source); |
| 18722 return context.resolveCompilationUnit(source, libraryElement); |
| 18723 } |
| 18724 } |
| 18725 |
| 18528 class ErrorResolverTest extends ResolverTestCase { | 18726 class ErrorResolverTest extends ResolverTestCase { |
| 18529 void test_breakLabelOnSwitchMember() { | 18727 void test_breakLabelOnSwitchMember() { |
| 18530 Source source = addSource(EngineTestCase.createSource([ | 18728 Source source = addSource(EngineTestCase.createSource([ |
| 18531 "class A {", | 18729 "class A {", |
| 18532 " void m(int i) {", | 18730 " void m(int i) {", |
| 18533 " switch (i) {", | 18731 " switch (i) {", |
| 18534 " l: case 0:", | 18732 " l: case 0:", |
| 18535 " break;", | 18733 " break;", |
| 18536 " case 1:", | 18734 " case 1:", |
| 18537 " break l;", | 18735 " break l;", |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19088 new LibraryImportScope(definingLibrary, errorListener); | 19286 new LibraryImportScope(definingLibrary, errorListener); |
| 19089 } | 19287 } |
| 19090 | 19288 |
| 19091 void test_creation_nonEmpty() { | 19289 void test_creation_nonEmpty() { |
| 19092 AnalysisContext context = new AnalysisContextImpl(); | 19290 AnalysisContext context = new AnalysisContextImpl(); |
| 19093 String importedTypeName = "A"; | 19291 String importedTypeName = "A"; |
| 19094 ClassElement importedType = new ClassElementImpl(ASTFactory.identifier3(impo
rtedTypeName)); | 19292 ClassElement importedType = new ClassElementImpl(ASTFactory.identifier3(impo
rtedTypeName)); |
| 19095 LibraryElement importedLibrary = createTestLibrary2(context, "imported", [])
; | 19293 LibraryElement importedLibrary = createTestLibrary2(context, "imported", [])
; |
| 19096 (importedLibrary.definingCompilationUnit as CompilationUnitElementImpl).type
s = <ClassElement> [importedType]; | 19294 (importedLibrary.definingCompilationUnit as CompilationUnitElementImpl).type
s = <ClassElement> [importedType]; |
| 19097 LibraryElementImpl definingLibrary = createTestLibrary2(context, "importing"
, []); | 19295 LibraryElementImpl definingLibrary = createTestLibrary2(context, "importing"
, []); |
| 19098 ImportElementImpl importElement = new ImportElementImpl(); | 19296 ImportElementImpl importElement = new ImportElementImpl(0); |
| 19099 importElement.importedLibrary = importedLibrary; | 19297 importElement.importedLibrary = importedLibrary; |
| 19100 definingLibrary.imports = <ImportElement> [importElement]; | 19298 definingLibrary.imports = <ImportElement> [importElement]; |
| 19101 GatheringErrorListener errorListener = new GatheringErrorListener(); | 19299 GatheringErrorListener errorListener = new GatheringErrorListener(); |
| 19102 Scope scope = new LibraryImportScope(definingLibrary, errorListener); | 19300 Scope scope = new LibraryImportScope(definingLibrary, errorListener); |
| 19103 JUnitTestCase.assertEquals(importedType, scope.lookup(ASTFactory.identifier3
(importedTypeName), definingLibrary)); | 19301 JUnitTestCase.assertEquals(importedType, scope.lookup(ASTFactory.identifier3
(importedTypeName), definingLibrary)); |
| 19104 } | 19302 } |
| 19105 | 19303 |
| 19106 void test_getErrorListener() { | 19304 void test_getErrorListener() { |
| 19107 LibraryElement definingLibrary = createTestLibrary(); | 19305 LibraryElement definingLibrary = createTestLibrary(); |
| 19108 GatheringErrorListener errorListener = new GatheringErrorListener(); | 19306 GatheringErrorListener errorListener = new GatheringErrorListener(); |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19544 new LibraryScope(definingLibrary, errorListener); | 19742 new LibraryScope(definingLibrary, errorListener); |
| 19545 } | 19743 } |
| 19546 | 19744 |
| 19547 void test_creation_nonEmpty() { | 19745 void test_creation_nonEmpty() { |
| 19548 AnalysisContext context = new AnalysisContextImpl(); | 19746 AnalysisContext context = new AnalysisContextImpl(); |
| 19549 String importedTypeName = "A"; | 19747 String importedTypeName = "A"; |
| 19550 ClassElement importedType = new ClassElementImpl(ASTFactory.identifier3(impo
rtedTypeName)); | 19748 ClassElement importedType = new ClassElementImpl(ASTFactory.identifier3(impo
rtedTypeName)); |
| 19551 LibraryElement importedLibrary = createTestLibrary2(context, "imported", [])
; | 19749 LibraryElement importedLibrary = createTestLibrary2(context, "imported", [])
; |
| 19552 (importedLibrary.definingCompilationUnit as CompilationUnitElementImpl).type
s = <ClassElement> [importedType]; | 19750 (importedLibrary.definingCompilationUnit as CompilationUnitElementImpl).type
s = <ClassElement> [importedType]; |
| 19553 LibraryElementImpl definingLibrary = createTestLibrary2(context, "importing"
, []); | 19751 LibraryElementImpl definingLibrary = createTestLibrary2(context, "importing"
, []); |
| 19554 ImportElementImpl importElement = new ImportElementImpl(); | 19752 ImportElementImpl importElement = new ImportElementImpl(0); |
| 19555 importElement.importedLibrary = importedLibrary; | 19753 importElement.importedLibrary = importedLibrary; |
| 19556 definingLibrary.imports = <ImportElement> [importElement]; | 19754 definingLibrary.imports = <ImportElement> [importElement]; |
| 19557 GatheringErrorListener errorListener = new GatheringErrorListener(); | 19755 GatheringErrorListener errorListener = new GatheringErrorListener(); |
| 19558 Scope scope = new LibraryScope(definingLibrary, errorListener); | 19756 Scope scope = new LibraryScope(definingLibrary, errorListener); |
| 19559 JUnitTestCase.assertEquals(importedType, scope.lookup(ASTFactory.identifier3
(importedTypeName), definingLibrary)); | 19757 JUnitTestCase.assertEquals(importedType, scope.lookup(ASTFactory.identifier3
(importedTypeName), definingLibrary)); |
| 19560 } | 19758 } |
| 19561 | 19759 |
| 19562 void test_getErrorListener() { | 19760 void test_getErrorListener() { |
| 19563 LibraryElement definingLibrary = createTestLibrary(); | 19761 LibraryElement definingLibrary = createTestLibrary(); |
| 19564 GatheringErrorListener errorListener = new GatheringErrorListener(); | 19762 GatheringErrorListener errorListener = new GatheringErrorListener(); |
| (...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20863 void test_divisionOptimization_supressIfDivisionNotDefinedInCore() { | 21061 void test_divisionOptimization_supressIfDivisionNotDefinedInCore() { |
| 20864 Source source = addSource(EngineTestCase.createSource(["f(x, y) {", " var v
= (x / y).toInt();", "}"])); | 21062 Source source = addSource(EngineTestCase.createSource(["f(x, y) {", " var v
= (x / y).toInt();", "}"])); |
| 20865 resolve(source); | 21063 resolve(source); |
| 20866 assertNoErrors(source); | 21064 assertNoErrors(source); |
| 20867 verify([source]); | 21065 verify([source]); |
| 20868 } | 21066 } |
| 20869 | 21067 |
| 20870 void test_divisionOptimization_supressIfDivisionOverridden() { | 21068 void test_divisionOptimization_supressIfDivisionOverridden() { |
| 20871 Source source = addSource(EngineTestCase.createSource([ | 21069 Source source = addSource(EngineTestCase.createSource([ |
| 20872 "class A {", | 21070 "class A {", |
| 20873 " num operator /(x) {}", | 21071 " num operator /(x) { return x; }", |
| 20874 "}", | 21072 "}", |
| 20875 "f(A x, A y) {", | 21073 "f(A x, A y) {", |
| 20876 " var v = (x / y).toInt();", | 21074 " var v = (x / y).toInt();", |
| 20877 "}"])); | 21075 "}"])); |
| 20878 resolve(source); | 21076 resolve(source); |
| 20879 assertNoErrors(source); | 21077 assertNoErrors(source); |
| 20880 verify([source]); | 21078 verify([source]); |
| 20881 } | 21079 } |
| 20882 | 21080 |
| 20883 void test_duplicateImport_as() { | 21081 void test_duplicateImport_as() { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 20912 "import 'lib1.dart';", | 21110 "import 'lib1.dart';", |
| 20913 "import 'lib1.dart' show A;", | 21111 "import 'lib1.dart' show A;", |
| 20914 "A a;", | 21112 "A a;", |
| 20915 "B b;"])); | 21113 "B b;"])); |
| 20916 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s A {}", "class B {}"])); | 21114 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s A {}", "class B {}"])); |
| 20917 resolve(source); | 21115 resolve(source); |
| 20918 assertNoErrors(source); | 21116 assertNoErrors(source); |
| 20919 verify([source]); | 21117 verify([source]); |
| 20920 } | 21118 } |
| 20921 | 21119 |
| 21120 void test_missingReturn_emptyFunctionBody() { |
| 21121 Source source = addSource(EngineTestCase.createSource(["abstract class A {",
" int m();", "}"])); |
| 21122 resolve(source); |
| 21123 assertNoErrors(source); |
| 21124 verify([source]); |
| 21125 } |
| 21126 |
| 21127 void test_missingReturn_expressionFunctionBody() { |
| 21128 Source source = addSource(EngineTestCase.createSource(["int f() => 0;"])); |
| 21129 resolve(source); |
| 21130 assertNoErrors(source); |
| 21131 verify([source]); |
| 21132 } |
| 21133 |
| 21134 void test_missingReturn_noReturnType() { |
| 21135 Source source = addSource(EngineTestCase.createSource(["f() {}"])); |
| 21136 resolve(source); |
| 21137 assertNoErrors(source); |
| 21138 verify([source]); |
| 21139 } |
| 21140 |
| 21141 void test_missingReturn_voidReturnType() { |
| 21142 Source source = addSource(EngineTestCase.createSource(["void f() {}"])); |
| 21143 resolve(source); |
| 21144 assertNoErrors(source); |
| 21145 verify([source]); |
| 21146 } |
| 21147 |
| 20922 void test_overriddingPrivateMember_sameLibrary() { | 21148 void test_overriddingPrivateMember_sameLibrary() { |
| 20923 Source source = addSource(EngineTestCase.createSource([ | 21149 Source source = addSource(EngineTestCase.createSource([ |
| 20924 "class A {", | 21150 "class A {", |
| 20925 " _m(int x) => 0;", | 21151 " _m(int x) => 0;", |
| 20926 "}", | 21152 "}", |
| 20927 "class B extends A {", | 21153 "class B extends A {", |
| 20928 " _m(int x) => 0;", | 21154 " _m(int x) => 0;", |
| 20929 "}"])); | 21155 "}"])); |
| 20930 resolve(source); | 21156 resolve(source); |
| 20931 assertNoErrors(source); | 21157 assertNoErrors(source); |
| 20932 verify([source]); | 21158 verify([source]); |
| 20933 } | 21159 } |
| 20934 | 21160 |
| 20935 void test_overrideEqualsButNotHashCode() { | 21161 void test_overrideEqualsButNotHashCode() { |
| 20936 Source source = addSource(EngineTestCase.createSource([ | 21162 Source source = addSource(EngineTestCase.createSource([ |
| 20937 "class A {", | 21163 "class A {", |
| 20938 " bool operator ==(x) {}", | 21164 " bool operator ==(x) { return x; }", |
| 20939 " get hashCode => 0;", | 21165 " get hashCode => 0;", |
| 20940 "}"])); | 21166 "}"])); |
| 20941 resolve(source); | 21167 resolve(source); |
| 20942 assertNoErrors(source); | 21168 assertNoErrors(source); |
| 20943 verify([source]); | 21169 verify([source]); |
| 20944 } | 21170 } |
| 20945 | 21171 |
| 20946 void test_proxy_annotation_prefixed() { | 21172 void test_proxy_annotation_prefixed() { |
| 20947 Source source = addSource(EngineTestCase.createSource([ | 21173 Source source = addSource(EngineTestCase.createSource([ |
| 20948 "library L;", | 21174 "library L;", |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21304 runJUnitTest(__test, __test.test_duplicateImport_as); | 21530 runJUnitTest(__test, __test.test_duplicateImport_as); |
| 21305 }); | 21531 }); |
| 21306 _ut.test('test_duplicateImport_hide', () { | 21532 _ut.test('test_duplicateImport_hide', () { |
| 21307 final __test = new NonHintCodeTest(); | 21533 final __test = new NonHintCodeTest(); |
| 21308 runJUnitTest(__test, __test.test_duplicateImport_hide); | 21534 runJUnitTest(__test, __test.test_duplicateImport_hide); |
| 21309 }); | 21535 }); |
| 21310 _ut.test('test_duplicateImport_show', () { | 21536 _ut.test('test_duplicateImport_show', () { |
| 21311 final __test = new NonHintCodeTest(); | 21537 final __test = new NonHintCodeTest(); |
| 21312 runJUnitTest(__test, __test.test_duplicateImport_show); | 21538 runJUnitTest(__test, __test.test_duplicateImport_show); |
| 21313 }); | 21539 }); |
| 21540 _ut.test('test_missingReturn_emptyFunctionBody', () { |
| 21541 final __test = new NonHintCodeTest(); |
| 21542 runJUnitTest(__test, __test.test_missingReturn_emptyFunctionBody); |
| 21543 }); |
| 21544 _ut.test('test_missingReturn_expressionFunctionBody', () { |
| 21545 final __test = new NonHintCodeTest(); |
| 21546 runJUnitTest(__test, __test.test_missingReturn_expressionFunctionBody); |
| 21547 }); |
| 21548 _ut.test('test_missingReturn_noReturnType', () { |
| 21549 final __test = new NonHintCodeTest(); |
| 21550 runJUnitTest(__test, __test.test_missingReturn_noReturnType); |
| 21551 }); |
| 21552 _ut.test('test_missingReturn_voidReturnType', () { |
| 21553 final __test = new NonHintCodeTest(); |
| 21554 runJUnitTest(__test, __test.test_missingReturn_voidReturnType); |
| 21555 }); |
| 21314 _ut.test('test_overriddingPrivateMember_sameLibrary', () { | 21556 _ut.test('test_overriddingPrivateMember_sameLibrary', () { |
| 21315 final __test = new NonHintCodeTest(); | 21557 final __test = new NonHintCodeTest(); |
| 21316 runJUnitTest(__test, __test.test_overriddingPrivateMember_sameLibrary); | 21558 runJUnitTest(__test, __test.test_overriddingPrivateMember_sameLibrary); |
| 21317 }); | 21559 }); |
| 21318 _ut.test('test_overrideEqualsButNotHashCode', () { | 21560 _ut.test('test_overrideEqualsButNotHashCode', () { |
| 21319 final __test = new NonHintCodeTest(); | 21561 final __test = new NonHintCodeTest(); |
| 21320 runJUnitTest(__test, __test.test_overrideEqualsButNotHashCode); | 21562 runJUnitTest(__test, __test.test_overrideEqualsButNotHashCode); |
| 21321 }); | 21563 }); |
| 21322 _ut.test('test_proxy_annotation_prefixed', () { | 21564 _ut.test('test_proxy_annotation_prefixed', () { |
| 21323 final __test = new NonHintCodeTest(); | 21565 final __test = new NonHintCodeTest(); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21407 final __test = new NonHintCodeTest(); | 21649 final __test = new NonHintCodeTest(); |
| 21408 runJUnitTest(__test, __test.test_unusedImport_prefix_topLevelFunction); | 21650 runJUnitTest(__test, __test.test_unusedImport_prefix_topLevelFunction); |
| 21409 }); | 21651 }); |
| 21410 }); | 21652 }); |
| 21411 } | 21653 } |
| 21412 } | 21654 } |
| 21413 | 21655 |
| 21414 class EnclosedScopeTest extends ResolverTestCase { | 21656 class EnclosedScopeTest extends ResolverTestCase { |
| 21415 void test_define_duplicate() { | 21657 void test_define_duplicate() { |
| 21416 GatheringErrorListener errorListener2 = new GatheringErrorListener(); | 21658 GatheringErrorListener errorListener2 = new GatheringErrorListener(); |
| 21417 Scope rootScope = new Scope_24(errorListener2); | 21659 Scope rootScope = new Scope_25(errorListener2); |
| 21418 EnclosedScope scope = new EnclosedScope(rootScope); | 21660 EnclosedScope scope = new EnclosedScope(rootScope); |
| 21419 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); | 21661 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); |
| 21420 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); | 21662 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); |
| 21421 scope.define(element1); | 21663 scope.define(element1); |
| 21422 scope.define(element2); | 21664 scope.define(element2); |
| 21423 errorListener2.assertErrors3([ErrorSeverity.ERROR]); | 21665 errorListener2.assertErrors3([ErrorSeverity.ERROR]); |
| 21424 } | 21666 } |
| 21425 | 21667 |
| 21426 void test_define_normal() { | 21668 void test_define_normal() { |
| 21427 GatheringErrorListener errorListener3 = new GatheringErrorListener(); | 21669 GatheringErrorListener errorListener3 = new GatheringErrorListener(); |
| 21428 Scope rootScope = new Scope_25(errorListener3); | 21670 Scope rootScope = new Scope_26(errorListener3); |
| 21429 EnclosedScope outerScope = new EnclosedScope(rootScope); | 21671 EnclosedScope outerScope = new EnclosedScope(rootScope); |
| 21430 EnclosedScope innerScope = new EnclosedScope(outerScope); | 21672 EnclosedScope innerScope = new EnclosedScope(outerScope); |
| 21431 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); | 21673 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); |
| 21432 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v2")); | 21674 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v2")); |
| 21433 outerScope.define(element1); | 21675 outerScope.define(element1); |
| 21434 innerScope.define(element2); | 21676 innerScope.define(element2); |
| 21435 errorListener3.assertNoErrors(); | 21677 errorListener3.assertNoErrors(); |
| 21436 } | 21678 } |
| 21437 | 21679 |
| 21438 static dartSuite() { | 21680 static dartSuite() { |
| 21439 _ut.group('EnclosedScopeTest', () { | 21681 _ut.group('EnclosedScopeTest', () { |
| 21440 _ut.test('test_define_duplicate', () { | 21682 _ut.test('test_define_duplicate', () { |
| 21441 final __test = new EnclosedScopeTest(); | 21683 final __test = new EnclosedScopeTest(); |
| 21442 runJUnitTest(__test, __test.test_define_duplicate); | 21684 runJUnitTest(__test, __test.test_define_duplicate); |
| 21443 }); | 21685 }); |
| 21444 _ut.test('test_define_normal', () { | 21686 _ut.test('test_define_normal', () { |
| 21445 final __test = new EnclosedScopeTest(); | 21687 final __test = new EnclosedScopeTest(); |
| 21446 runJUnitTest(__test, __test.test_define_normal); | 21688 runJUnitTest(__test, __test.test_define_normal); |
| 21447 }); | 21689 }); |
| 21448 }); | 21690 }); |
| 21449 } | 21691 } |
| 21450 } | 21692 } |
| 21451 | 21693 |
| 21452 class Scope_24 extends Scope { | 21694 class Scope_25 extends Scope { |
| 21453 GatheringErrorListener errorListener2; | 21695 GatheringErrorListener errorListener2; |
| 21454 | 21696 |
| 21455 Scope_24(this.errorListener2) : super(); | 21697 Scope_25(this.errorListener2) : super(); |
| 21456 | 21698 |
| 21457 AnalysisErrorListener get errorListener => errorListener2; | 21699 AnalysisErrorListener get errorListener => errorListener2; |
| 21458 | 21700 |
| 21459 Element lookup3(Identifier identifier, String name, LibraryElement referencing
Library) => null; | 21701 Element lookup3(Identifier identifier, String name, LibraryElement referencing
Library) => null; |
| 21460 } | 21702 } |
| 21461 | 21703 |
| 21462 class Scope_25 extends Scope { | 21704 class Scope_26 extends Scope { |
| 21463 GatheringErrorListener errorListener3; | 21705 GatheringErrorListener errorListener3; |
| 21464 | 21706 |
| 21465 Scope_25(this.errorListener3) : super(); | 21707 Scope_26(this.errorListener3) : super(); |
| 21466 | 21708 |
| 21467 AnalysisErrorListener get errorListener => errorListener3; | 21709 AnalysisErrorListener get errorListener => errorListener3; |
| 21468 | 21710 |
| 21469 Element lookup3(Identifier identifier, String name, LibraryElement referencing
Library) => null; | 21711 Element lookup3(Identifier identifier, String name, LibraryElement referencing
Library) => null; |
| 21470 } | 21712 } |
| 21471 | 21713 |
| 21472 class LibraryElementBuilderTest extends EngineTestCase { | 21714 class LibraryElementBuilderTest extends EngineTestCase { |
| 21473 /** | 21715 /** |
| 21474 * The source factory used to create [Source]. | 21716 * The source factory used to create [Source]. |
| 21475 */ | 21717 */ |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22187 "main() {", | 22429 "main() {", |
| 22188 " var myVar = (int p) => 'foo';", | 22430 " var myVar = (int p) => 'foo';", |
| 22189 " myVar(42);", | 22431 " myVar(42);", |
| 22190 "}"])); | 22432 "}"])); |
| 22191 LibraryElement library = resolve(source); | 22433 LibraryElement library = resolve(source); |
| 22192 JUnitTestCase.assertNotNull(library); | 22434 JUnitTestCase.assertNotNull(library); |
| 22193 CompilationUnit unit = analysisContext.getResolvedCompilationUnit(source, li
brary); | 22435 CompilationUnit unit = analysisContext.getResolvedCompilationUnit(source, li
brary); |
| 22194 JUnitTestCase.assertNotNull(unit); | 22436 JUnitTestCase.assertNotNull(unit); |
| 22195 List<bool> found = [false]; | 22437 List<bool> found = [false]; |
| 22196 List<AnalysisException> thrownException = new List<AnalysisException>(1); | 22438 List<AnalysisException> thrownException = new List<AnalysisException>(1); |
| 22197 unit.accept(new RecursiveASTVisitor_28(this, found, thrownException)); | 22439 unit.accept(new RecursiveASTVisitor_29(this, found, thrownException)); |
| 22198 if (thrownException[0] != null) { | 22440 if (thrownException[0] != null) { |
| 22199 throw new AnalysisException.con3(thrownException[0]); | 22441 throw new AnalysisException.con3(thrownException[0]); |
| 22200 } | 22442 } |
| 22201 JUnitTestCase.assertTrue(found[0]); | 22443 JUnitTestCase.assertTrue(found[0]); |
| 22202 } | 22444 } |
| 22203 | 22445 |
| 22204 void test_metadata_class() { | 22446 void test_metadata_class() { |
| 22205 Source source = addSource(EngineTestCase.createSource(["const A = null;", "@
A class C {}"])); | 22447 Source source = addSource(EngineTestCase.createSource(["const A = null;", "@
A class C {}"])); |
| 22206 LibraryElement library = resolve(source); | 22448 LibraryElement library = resolve(source); |
| 22207 JUnitTestCase.assertNotNull(library); | 22449 JUnitTestCase.assertNotNull(library); |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22583 runJUnitTest(__test, __test.test_setter_inherited); | 22825 runJUnitTest(__test, __test.test_setter_inherited); |
| 22584 }); | 22826 }); |
| 22585 _ut.test('test_setter_static', () { | 22827 _ut.test('test_setter_static', () { |
| 22586 final __test = new SimpleResolverTest(); | 22828 final __test = new SimpleResolverTest(); |
| 22587 runJUnitTest(__test, __test.test_setter_static); | 22829 runJUnitTest(__test, __test.test_setter_static); |
| 22588 }); | 22830 }); |
| 22589 }); | 22831 }); |
| 22590 } | 22832 } |
| 22591 } | 22833 } |
| 22592 | 22834 |
| 22593 class RecursiveASTVisitor_28 extends RecursiveASTVisitor<Object> { | 22835 class RecursiveASTVisitor_29 extends RecursiveASTVisitor<Object> { |
| 22594 final SimpleResolverTest SimpleResolverTest_this; | 22836 final SimpleResolverTest SimpleResolverTest_this; |
| 22595 | 22837 |
| 22596 List<bool> found; | 22838 List<bool> found; |
| 22597 | 22839 |
| 22598 List<AnalysisException> thrownException; | 22840 List<AnalysisException> thrownException; |
| 22599 | 22841 |
| 22600 RecursiveASTVisitor_28(this.SimpleResolverTest_this, this.found, this.thrownEx
ception) : super(); | 22842 RecursiveASTVisitor_29(this.SimpleResolverTest_this, this.found, this.thrownEx
ception) : super(); |
| 22601 | 22843 |
| 22602 Object visitSimpleIdentifier(SimpleIdentifier node) { | 22844 Object visitSimpleIdentifier(SimpleIdentifier node) { |
| 22603 if (node.name == "myVar" && node.parent is MethodInvocation) { | 22845 if (node.name == "myVar" && node.parent is MethodInvocation) { |
| 22604 try { | 22846 try { |
| 22605 found[0] = true; | 22847 found[0] = true; |
| 22606 Type2 staticType = node.staticType; | 22848 Type2 staticType = node.staticType; |
| 22607 JUnitTestCase.assertSame(SimpleResolverTest_this.typeProvider.dynamicTyp
e, staticType); | 22849 JUnitTestCase.assertSame(SimpleResolverTest_this.typeProvider.dynamicTyp
e, staticType); |
| 22608 FunctionType propagatedType = node.propagatedType as FunctionType; | 22850 FunctionType propagatedType = node.propagatedType as FunctionType; |
| 22609 JUnitTestCase.assertEquals(SimpleResolverTest_this.typeProvider.stringTy
pe, propagatedType.returnType); | 22851 JUnitTestCase.assertEquals(SimpleResolverTest_this.typeProvider.stringTy
pe, propagatedType.returnType); |
| 22610 } on AnalysisException catch (e) { | 22852 } on AnalysisException catch (e) { |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22955 // HintCodeTest.dartSuite(); | 23197 // HintCodeTest.dartSuite(); |
| 22956 // MemberMapTest.dartSuite(); | 23198 // MemberMapTest.dartSuite(); |
| 22957 // NonHintCodeTest.dartSuite(); | 23199 // NonHintCodeTest.dartSuite(); |
| 22958 // NonErrorResolverTest.dartSuite(); | 23200 // NonErrorResolverTest.dartSuite(); |
| 22959 // SimpleResolverTest.dartSuite(); | 23201 // SimpleResolverTest.dartSuite(); |
| 22960 // StaticTypeWarningCodeTest.dartSuite(); | 23202 // StaticTypeWarningCodeTest.dartSuite(); |
| 22961 // StaticWarningCodeTest.dartSuite(); | 23203 // StaticWarningCodeTest.dartSuite(); |
| 22962 // StrictModeTest.dartSuite(); | 23204 // StrictModeTest.dartSuite(); |
| 22963 // TypePropagationTest.dartSuite(); | 23205 // TypePropagationTest.dartSuite(); |
| 22964 } | 23206 } |
| OLD | NEW |