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

Unified Diff: pkg/analyzer_experimental/test/generated/resolver_test.dart

Issue 17932005: New analyzer_experimental snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Disable resolver tests Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer_experimental/test/generated/resolver_test.dart
diff --git a/pkg/analyzer_experimental/test/generated/resolver_test.dart b/pkg/analyzer_experimental/test/generated/resolver_test.dart
index 81a1c4487af79ba28be6c78f9c131b06ce036fcd..708f070193239c122acb5885f80cc7da3a2084a7 100644
--- a/pkg/analyzer_experimental/test/generated/resolver_test.dart
+++ b/pkg/analyzer_experimental/test/generated/resolver_test.dart
@@ -21,6 +21,26 @@ import 'test_support.dart';
import 'ast_test.dart' show ASTFactory;
import 'element_test.dart' show ElementFactory;
class TypePropagationTest extends ResolverTestCase {
+ void fail_functionExpression_asInvocationArgument_functionExpressionInvocation() {
+ String code = EngineTestCase.createSource(["main() {", " (f(String value)) {} ((v) {", " v;", " });", "}"]);
+ Source source = addSource(code);
+ LibraryElement library = resolve(source);
+ assertNoErrors();
+ verify([source]);
+ CompilationUnit unit = resolveCompilationUnit(source, library);
+ Type2 dynamicType = typeProvider.dynamicType;
+ Type2 stringType = typeProvider.stringType;
+ FormalParameter vParameter = EngineTestCase.findNode(unit, code, "v)", FormalParameter);
+ JUnitTestCase.assertSame(stringType, vParameter.identifier.propagatedType);
+ JUnitTestCase.assertSame(dynamicType, vParameter.identifier.staticType);
+ SimpleIdentifier vIdentifier = EngineTestCase.findNode(unit, code, "v;", SimpleIdentifier);
+ JUnitTestCase.assertSame(stringType, vIdentifier.propagatedType);
+ JUnitTestCase.assertSame(dynamicType, vIdentifier.staticType);
+ }
+ void fail_propagatedReturnType_functionExpression() {
+ String code = EngineTestCase.createSource(["main() {", " var v = (() {return 42;})();", "}"]);
+ check_propagatedReturnType(code, typeProvider.dynamicType, typeProvider.intType);
+ }
void test_as() {
Source source = addSource(EngineTestCase.createSource(["class A {", " bool get g => true;", "}", "A f(var p) {", " if ((p as A).g) {", " return p;", " } else {", " return null;", " }", "}"]));
LibraryElement library = resolve(source);
@@ -89,6 +109,83 @@ class TypePropagationTest extends ResolverTestCase {
SimpleIdentifier variableName = statement.expression as SimpleIdentifier;
JUnitTestCase.assertSame(typeA, variableName.propagatedType);
}
+ void test_functionExpression_asInvocationArgument() {
+ String code = EngineTestCase.createSource(["class MyMap<K, V> {", " forEach(f(K key, V value)) {}", "}", "f(MyMap<int, String> m) {", " m.forEach((k, v) {", " k;", " v;", " });", "}"]);
+ Source source = addSource(code);
+ LibraryElement library = resolve(source);
+ assertNoErrors();
+ verify([source]);
+ CompilationUnit unit = resolveCompilationUnit(source, library);
+ Type2 intType = typeProvider.intType;
+ FormalParameter kParameter = EngineTestCase.findNode(unit, code, "k, ", SimpleFormalParameter);
+ JUnitTestCase.assertSame(intType, kParameter.identifier.propagatedType);
+ SimpleIdentifier kIdentifier = EngineTestCase.findNode(unit, code, "k;", SimpleIdentifier);
+ JUnitTestCase.assertSame(intType, kIdentifier.propagatedType);
+ JUnitTestCase.assertSame(typeProvider.dynamicType, kIdentifier.staticType);
+ Type2 stringType = typeProvider.stringType;
+ FormalParameter vParameter = EngineTestCase.findNode(unit, code, "v)", SimpleFormalParameter);
+ JUnitTestCase.assertSame(stringType, vParameter.identifier.propagatedType);
+ SimpleIdentifier vIdentifier = EngineTestCase.findNode(unit, code, "v;", SimpleIdentifier);
+ JUnitTestCase.assertSame(stringType, vIdentifier.propagatedType);
+ JUnitTestCase.assertSame(typeProvider.dynamicType, vIdentifier.staticType);
+ }
+ void test_functionExpression_asInvocationArgument_fromInferredInvocation() {
+ String code = EngineTestCase.createSource(["class MyMap<K, V> {", " forEach(f(K key, V value)) {}", "}", "f(MyMap<int, String> m) {", " var m2 = m;", " m2.forEach((k, v) {});", "}"]);
+ Source source = addSource(code);
+ LibraryElement library = resolve(source);
+ assertNoErrors();
+ verify([source]);
+ CompilationUnit unit = resolveCompilationUnit(source, library);
+ Type2 intType = typeProvider.intType;
+ FormalParameter kParameter = EngineTestCase.findNode(unit, code, "k, ", SimpleFormalParameter);
+ JUnitTestCase.assertSame(intType, kParameter.identifier.propagatedType);
+ Type2 stringType = typeProvider.stringType;
+ FormalParameter vParameter = EngineTestCase.findNode(unit, code, "v)", SimpleFormalParameter);
+ JUnitTestCase.assertSame(stringType, vParameter.identifier.propagatedType);
+ }
+ void test_functionExpression_asInvocationArgument_keepIfLessSpecific() {
+ String code = EngineTestCase.createSource(["class MyList {", " forEach(f(Object value)) {}", "}", "f(MyList list) {", " list.forEach((int v) {", " v;", " });", "}"]);
+ Source source = addSource(code);
+ LibraryElement library = resolve(source);
+ assertNoErrors();
+ verify([source]);
+ CompilationUnit unit = resolveCompilationUnit(source, library);
+ Type2 intType = typeProvider.intType;
+ FormalParameter vParameter = EngineTestCase.findNode(unit, code, "v)", SimpleFormalParameter);
+ JUnitTestCase.assertSame(null, vParameter.identifier.propagatedType);
+ JUnitTestCase.assertSame(intType, vParameter.identifier.staticType);
+ SimpleIdentifier vIdentifier = EngineTestCase.findNode(unit, code, "v;", SimpleIdentifier);
+ JUnitTestCase.assertSame(intType, vIdentifier.staticType);
+ JUnitTestCase.assertSame(null, vIdentifier.propagatedType);
+ }
+ void test_functionExpression_asInvocationArgument_replaceIfMoreSpecific() {
+ String code = EngineTestCase.createSource(["class MyList<E> {", " forEach(f(E value)) {}", "}", "f(MyList<String> list) {", " list.forEach((Object v) {", " v;", " });", "}"]);
+ Source source = addSource(code);
+ LibraryElement library = resolve(source);
+ assertNoErrors();
+ verify([source]);
+ CompilationUnit unit = resolveCompilationUnit(source, library);
+ Type2 stringType = typeProvider.stringType;
+ FormalParameter vParameter = EngineTestCase.findNode(unit, code, "v)", SimpleFormalParameter);
+ JUnitTestCase.assertSame(stringType, vParameter.identifier.propagatedType);
+ JUnitTestCase.assertSame(typeProvider.objectType, vParameter.identifier.staticType);
+ SimpleIdentifier vIdentifier = EngineTestCase.findNode(unit, code, "v;", SimpleIdentifier);
+ JUnitTestCase.assertSame(stringType, vIdentifier.propagatedType);
+ }
+ void test_Future_then() {
+ String code = EngineTestCase.createSource(["import 'dart:async';", "main(Future<int> firstFuture) {", " firstFuture.then((p1) {", " return 1.0;", " }).then((p2) {", " return new Future<String>.value('str');", " }).then((p3) {", " });", "}"]);
+ Source source = addSource(code);
+ LibraryElement library = resolve(source);
+ assertNoErrors();
+ verify([source]);
+ CompilationUnit unit = resolveCompilationUnit(source, library);
+ FormalParameter p1 = EngineTestCase.findNode(unit, code, "p1) {", SimpleFormalParameter);
+ JUnitTestCase.assertSame(typeProvider.intType, p1.identifier.propagatedType);
+ FormalParameter p2 = EngineTestCase.findNode(unit, code, "p2) {", SimpleFormalParameter);
+ JUnitTestCase.assertSame(typeProvider.doubleType, p2.identifier.propagatedType);
+ FormalParameter p3 = EngineTestCase.findNode(unit, code, "p3) {", SimpleFormalParameter);
+ JUnitTestCase.assertSame(typeProvider.stringType, p3.identifier.propagatedType);
+ }
void test_initializer() {
Source source = addSource(EngineTestCase.createSource(["f() {", " var v = 0;", " return v;", "}"]));
LibraryElement library = resolve(source);
@@ -97,9 +194,18 @@ class TypePropagationTest extends ResolverTestCase {
CompilationUnit unit = resolveCompilationUnit(source, library);
FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration;
BlockFunctionBody body = function.functionExpression.body as BlockFunctionBody;
- ReturnStatement statement = body.block.statements[1] as ReturnStatement;
- SimpleIdentifier variableName = statement.expression as SimpleIdentifier;
- JUnitTestCase.assertSame(typeProvider.intType, variableName.propagatedType);
+ NodeList<Statement> statements = body.block.statements;
+ {
+ VariableDeclarationStatement statement = statements[0] as VariableDeclarationStatement;
+ SimpleIdentifier variableName = statement.variables.variables[0].name;
+ JUnitTestCase.assertSame(typeProvider.dynamicType, variableName.staticType);
+ JUnitTestCase.assertSame(typeProvider.intType, variableName.propagatedType);
+ }
+ {
+ ReturnStatement statement = statements[1] as ReturnStatement;
+ SimpleIdentifier variableName = statement.expression as SimpleIdentifier;
+ JUnitTestCase.assertSame(typeProvider.intType, variableName.propagatedType);
+ }
}
void test_initializer_dereference() {
Source source = addSource(EngineTestCase.createSource(["f() {", " var v = 'String';", " v.", "}"]));
@@ -357,6 +463,34 @@ class TypePropagationTest extends ResolverTestCase {
JUnitTestCase.assertSame(typeProvider.stringType, typeArguments[0]);
JUnitTestCase.assertSame(typeProvider.intType, typeArguments[1]);
}
+ void test_propagatedReturnType_function_hasReturnType_returnsNull() {
+ String code = EngineTestCase.createSource(["String f() => null;", "main() {", " var v = f();", "}"]);
+ check_propagatedReturnType(code, typeProvider.dynamicType, typeProvider.stringType);
+ }
+ void test_propagatedReturnType_function_lessSpecificStaticReturnType() {
+ String code = EngineTestCase.createSource(["Object f() => 42;", "main() {", " var v = f();", "}"]);
+ check_propagatedReturnType(code, typeProvider.dynamicType, typeProvider.intType);
+ }
+ void test_propagatedReturnType_function_moreSpecificStaticReturnType() {
+ String code = EngineTestCase.createSource(["int f() => (42 as Object);", "main() {", " var v = f();", "}"]);
+ check_propagatedReturnType(code, typeProvider.dynamicType, typeProvider.intType);
+ }
+ void test_propagatedReturnType_function_noReturnTypeName_blockBody_multipleReturns() {
+ String code = EngineTestCase.createSource(["f() {", " if (true) return 0;", " return 1.0;", "}", "main() {", " var v = f();", "}"]);
+ check_propagatedReturnType(code, typeProvider.dynamicType, typeProvider.numType);
+ }
+ void test_propagatedReturnType_function_noReturnTypeName_blockBody_oneReturn() {
+ String code = EngineTestCase.createSource(["f() {", " var z = 42;", " return z;", "}", "main() {", " var v = f();", "}"]);
+ check_propagatedReturnType(code, typeProvider.dynamicType, typeProvider.intType);
+ }
+ void test_propagatedReturnType_function_noReturnTypeName_expressionBody() {
+ String code = EngineTestCase.createSource(["f() => 42;", "main() {", " var v = f();", "}"]);
+ check_propagatedReturnType(code, typeProvider.dynamicType, typeProvider.intType);
+ }
+ void test_propagatedReturnType_localFunction() {
+ String code = EngineTestCase.createSource(["main() {", " f() => 42;", " var v = f();", "}"]);
+ check_propagatedReturnType(code, typeProvider.dynamicType, typeProvider.intType);
+ }
void test_query() {
Source source = addSource(EngineTestCase.createSource(["import 'dart:html';", "", "main() {", " var v1 = query('a');", " var v2 = query('A');", " var v3 = query('body:active');", " var v4 = query('button[foo=\"bar\"]');", " var v5 = query('div.class');", " var v6 = query('input#id');", " var v7 = query('select#id');", " // invocation of method", " var m1 = document.query('div');", " // unsupported currently", " var b1 = query('noSuchTag');", " var b2 = query('DART_EDITOR_NO_SUCH_TYPE');", " var b3 = query('body div');", " return [v1, v2, v3, v4, v5, v6, v7, m1, b1, b2, b3];", "}"]));
LibraryElement library = resolve(source);
@@ -379,8 +513,27 @@ class TypePropagationTest extends ResolverTestCase {
JUnitTestCase.assertEquals("Element", elements[9].propagatedType.name);
JUnitTestCase.assertEquals("Element", elements[10].propagatedType.name);
}
+
+ /**
+ * @param code the code that assigns the value to the variable "v", no matter how. We check that
+ * "v" has expected static and propagated type.
+ */
+ void check_propagatedReturnType(String code, Type2 expectedStaticType, Type2 expectedPropagatedType) {
+ Source source = addSource(code);
+ LibraryElement library = resolve(source);
+ assertNoErrors();
+ verify([source]);
+ CompilationUnit unit = resolveCompilationUnit(source, library);
+ SimpleIdentifier identifier = EngineTestCase.findNode(unit, code, "v = ", SimpleIdentifier);
+ JUnitTestCase.assertSame(expectedStaticType, identifier.staticType);
+ JUnitTestCase.assertSame(expectedPropagatedType, identifier.propagatedType);
+ }
static dartSuite() {
_ut.group('TypePropagationTest', () {
+ _ut.test('test_Future_then', () {
+ final __test = new TypePropagationTest();
+ runJUnitTest(__test, __test.test_Future_then);
+ });
_ut.test('test_as', () {
final __test = new TypePropagationTest();
runJUnitTest(__test, __test.test_as);
@@ -401,6 +554,22 @@ class TypePropagationTest extends ResolverTestCase {
final __test = new TypePropagationTest();
runJUnitTest(__test, __test.test_forEach);
});
+ _ut.test('test_functionExpression_asInvocationArgument', () {
+ final __test = new TypePropagationTest();
+ runJUnitTest(__test, __test.test_functionExpression_asInvocationArgument);
+ });
+ _ut.test('test_functionExpression_asInvocationArgument_fromInferredInvocation', () {
+ final __test = new TypePropagationTest();
+ runJUnitTest(__test, __test.test_functionExpression_asInvocationArgument_fromInferredInvocation);
+ });
+ _ut.test('test_functionExpression_asInvocationArgument_keepIfLessSpecific', () {
+ final __test = new TypePropagationTest();
+ runJUnitTest(__test, __test.test_functionExpression_asInvocationArgument_keepIfLessSpecific);
+ });
+ _ut.test('test_functionExpression_asInvocationArgument_replaceIfMoreSpecific', () {
+ final __test = new TypePropagationTest();
+ runJUnitTest(__test, __test.test_functionExpression_asInvocationArgument_replaceIfMoreSpecific);
+ });
_ut.test('test_initializer', () {
final __test = new TypePropagationTest();
runJUnitTest(__test, __test.test_initializer);
@@ -477,6 +646,34 @@ class TypePropagationTest extends ResolverTestCase {
final __test = new TypePropagationTest();
runJUnitTest(__test, __test.test_mapLiteral_same);
});
+ _ut.test('test_propagatedReturnType_function_hasReturnType_returnsNull', () {
+ final __test = new TypePropagationTest();
+ runJUnitTest(__test, __test.test_propagatedReturnType_function_hasReturnType_returnsNull);
+ });
+ _ut.test('test_propagatedReturnType_function_lessSpecificStaticReturnType', () {
+ final __test = new TypePropagationTest();
+ runJUnitTest(__test, __test.test_propagatedReturnType_function_lessSpecificStaticReturnType);
+ });
+ _ut.test('test_propagatedReturnType_function_moreSpecificStaticReturnType', () {
+ final __test = new TypePropagationTest();
+ runJUnitTest(__test, __test.test_propagatedReturnType_function_moreSpecificStaticReturnType);
+ });
+ _ut.test('test_propagatedReturnType_function_noReturnTypeName_blockBody_multipleReturns', () {
+ final __test = new TypePropagationTest();
+ runJUnitTest(__test, __test.test_propagatedReturnType_function_noReturnTypeName_blockBody_multipleReturns);
+ });
+ _ut.test('test_propagatedReturnType_function_noReturnTypeName_blockBody_oneReturn', () {
+ final __test = new TypePropagationTest();
+ runJUnitTest(__test, __test.test_propagatedReturnType_function_noReturnTypeName_blockBody_oneReturn);
+ });
+ _ut.test('test_propagatedReturnType_function_noReturnTypeName_expressionBody', () {
+ final __test = new TypePropagationTest();
+ runJUnitTest(__test, __test.test_propagatedReturnType_function_noReturnTypeName_expressionBody);
+ });
+ _ut.test('test_propagatedReturnType_localFunction', () {
+ final __test = new TypePropagationTest();
+ runJUnitTest(__test, __test.test_propagatedReturnType_localFunction);
+ });
_ut.test('test_query', () {
final __test = new TypePropagationTest();
runJUnitTest(__test, __test.test_query);
@@ -666,6 +863,19 @@ class NonErrorResolverTest extends ResolverTestCase {
assertNoErrors();
verify([source]);
}
+ void test_constEval_propertyExtraction_fieldStatic_targetType() {
+ addSource2("/math.dart", EngineTestCase.createSource(["library math;", "const PI = 3.14;"]));
+ Source source = addSource(EngineTestCase.createSource(["import 'math.dart' as math;", "const C = math.PI;"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
+ void test_constEval_propertyExtraction_methodStatic_targetType() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " const A();", " static m() {}", "}", "const C = A.m;"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
void test_constEvalTypeBoolNumString_equal() {
Source source = addSource(EngineTestCase.createSource(["class A {", " const A();", "}", "class B {", " final v;", " const B.a1(bool p) : v = p == true;", " const B.a2(bool p) : v = p == false;", " const B.a3(bool p) : v = p == 0;", " const B.a4(bool p) : v = p == 0.0;", " const B.a5(bool p) : v = p == '';", " const B.b1(int p) : v = p == true;", " const B.b2(int p) : v = p == false;", " const B.b3(int p) : v = p == 0;", " const B.b4(int p) : v = p == 0.0;", " const B.b5(int p) : v = p == '';", " const B.c1(String p) : v = p == true;", " const B.c2(String p) : v = p == false;", " const B.c3(String p) : v = p == 0;", " const B.c4(String p) : v = p == 0.0;", " const B.c5(String p) : v = p == '';", " const B.n1(num p) : v = p == null;", " const B.n2(num p) : v = null == p;", "}"]));
resolve(source);
@@ -929,6 +1139,12 @@ class NonErrorResolverTest extends ResolverTestCase {
assertNoErrors();
verify([source]);
}
+ void test_instanceMemberAccessFromStatic_fromComment() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " m() {}", " /// [m]", " static foo() {", " }", "}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
void test_invalidAssignment() {
Source source = addSource(EngineTestCase.createSource(["f() {", " var x;", " var y;", " x = y;", "}"]));
resolve(source);
@@ -1073,6 +1289,24 @@ class NonErrorResolverTest extends ResolverTestCase {
assertNoErrors();
verify([source]);
}
+ void test_invocationOfNonFunction_localVariable_dynamic() {
+ Source source = addSource(EngineTestCase.createSource(["f() {}", "main() {", " var v = f;", " v();", "}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
+ void test_invocationOfNonFunction_localVariable_dynamic2() {
+ Source source = addSource(EngineTestCase.createSource(["f() {}", "main() {", " var v = f;", " v = 1;", " v();", "}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
+ void test_invocationOfNonFunction_Object() {
+ Source source = addSource(EngineTestCase.createSource(["main() {", " Object v = null;", " v();", "}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
void test_memberWithClassName_setter() {
Source source = addSource(EngineTestCase.createSource(["class A {", " set A(v) {}", "}"]));
resolve(source);
@@ -1457,6 +1691,12 @@ class NonErrorResolverTest extends ResolverTestCase {
assertNoErrors();
verify([source]);
}
+ void test_staticAccessToInstanceMember_annotation() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " A.name() {}", "}", "@A.name()", "main() {", "}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
void test_staticAccessToInstanceMember_method() {
Source source = addSource(EngineTestCase.createSource(["class A {", " static m() {}", "}", "main() {", " A.m;", " A.m();", "}"]));
resolve(source);
@@ -1493,6 +1733,24 @@ class NonErrorResolverTest extends ResolverTestCase {
assertNoErrors();
verify([source]);
}
+ void test_typeArgumentNotMatchingBounds_typeArgumentList_0() {
+ Source source = addSource(EngineTestCase.createSource(["abstract class A<T extends A>{}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
+ void test_typeArgumentNotMatchingBounds_typeArgumentList_1() {
+ Source source = addSource(EngineTestCase.createSource(["abstract class A<T extends A<A>>{}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
+ void test_typeArgumentNotMatchingBounds_typeArgumentList_20() {
+ Source source = addSource(EngineTestCase.createSource(["abstract class A<T extends A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A>>>>>>>>>>>>>>>>>>>>>{}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
void test_undefinedConstructorInInitializer_explicit_named() {
Source source = addSource(EngineTestCase.createSource(["class A {", " A.named() {}", "}", "class B extends A {", " B() : super.named();", "}"]));
resolve(source);
@@ -1564,6 +1822,16 @@ class NonErrorResolverTest extends ResolverTestCase {
assertNoErrors();
verify([source]);
}
+ void test_undefinedMethod_functionExpression_callMethod() {
+ Source source = addSource(EngineTestCase.createSource(["main() {", " (() => null).call();", "}"]));
+ resolve(source);
+ assertNoErrors();
+ }
+ void test_undefinedMethod_functionExpression_directCall() {
+ Source source = addSource(EngineTestCase.createSource(["main() {", " (() => null)();", "}"]));
+ resolve(source);
+ assertNoErrors();
+ }
void test_undefinedMethod_noSuchMethod() {
Source source = addSource(EngineTestCase.createSource(["class A {", " noSuchMethod(invocation) {}", "}", "f() {", " (new A()).m();", "}"]));
resolve(source);
@@ -1586,6 +1854,18 @@ class NonErrorResolverTest extends ResolverTestCase {
resolve(source);
assertNoErrors();
}
+ void test_undefinedSuperMethod_field() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " var m;", "}", "class B extends A {", " f() {", " super.m();", " }", "}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
+ void test_undefinedSuperMethod_method() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " m() {}", "}", "class B extends A {", " f() {", " super.m();", " }", "}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
void test_wrongNumberOfParametersForOperator_index() {
Source source = addSource(EngineTestCase.createSource(["class A {", " operator []=(a, b) {}", "}"]));
resolve(source);
@@ -1755,6 +2035,14 @@ class NonErrorResolverTest extends ResolverTestCase {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_constEvalTypeBoolNumString_notEqual);
});
+ _ut.test('test_constEval_propertyExtraction_fieldStatic_targetType', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_constEval_propertyExtraction_fieldStatic_targetType);
+ });
+ _ut.test('test_constEval_propertyExtraction_methodStatic_targetType', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_constEval_propertyExtraction_methodStatic_targetType);
+ });
_ut.test('test_constWithNonConstantArgument_literals', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_constWithNonConstantArgument_literals);
@@ -1919,6 +2207,10 @@ class NonErrorResolverTest extends ResolverTestCase {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_initializingFormalForNonExistantField);
});
+ _ut.test('test_instanceMemberAccessFromStatic_fromComment', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_instanceMemberAccessFromStatic_fromComment);
+ });
_ut.test('test_invalidAssignment', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_invalidAssignment);
@@ -2003,6 +2295,10 @@ class NonErrorResolverTest extends ResolverTestCase {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_invalidTypeArgumentInConstMap);
});
+ _ut.test('test_invocationOfNonFunction_Object', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_invocationOfNonFunction_Object);
+ });
_ut.test('test_invocationOfNonFunction_dynamic', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_invocationOfNonFunction_dynamic);
@@ -2015,6 +2311,14 @@ class NonErrorResolverTest extends ResolverTestCase {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_invocationOfNonFunction_localVariable);
});
+ _ut.test('test_invocationOfNonFunction_localVariable_dynamic', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_invocationOfNonFunction_localVariable_dynamic);
+ });
+ _ut.test('test_invocationOfNonFunction_localVariable_dynamic2', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_invocationOfNonFunction_localVariable_dynamic2);
+ });
_ut.test('test_memberWithClassName_setter', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_memberWithClassName_setter);
@@ -2271,6 +2575,10 @@ class NonErrorResolverTest extends ResolverTestCase {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_returnWithoutValue_void);
});
+ _ut.test('test_staticAccessToInstanceMember_annotation', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_staticAccessToInstanceMember_annotation);
+ });
_ut.test('test_staticAccessToInstanceMember_method', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_staticAccessToInstanceMember_method);
@@ -2295,6 +2603,18 @@ class NonErrorResolverTest extends ResolverTestCase {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_new);
});
+ _ut.test('test_typeArgumentNotMatchingBounds_typeArgumentList_0', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_typeArgumentList_0);
+ });
+ _ut.test('test_typeArgumentNotMatchingBounds_typeArgumentList_1', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_typeArgumentList_1);
+ });
+ _ut.test('test_typeArgumentNotMatchingBounds_typeArgumentList_20', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_typeArgumentList_20);
+ });
_ut.test('test_undefinedConstructorInInitializer_explicit_named', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_undefinedConstructorInInitializer_explicit_named);
@@ -2343,6 +2663,14 @@ class NonErrorResolverTest extends ResolverTestCase {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_undefinedIdentifier_show);
});
+ _ut.test('test_undefinedMethod_functionExpression_callMethod', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_undefinedMethod_functionExpression_callMethod);
+ });
+ _ut.test('test_undefinedMethod_functionExpression_directCall', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_undefinedMethod_functionExpression_directCall);
+ });
_ut.test('test_undefinedMethod_noSuchMethod', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_undefinedMethod_noSuchMethod);
@@ -2359,6 +2687,14 @@ class NonErrorResolverTest extends ResolverTestCase {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_undefinedSetter_noSuchMethod);
});
+ _ut.test('test_undefinedSuperMethod_field', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_undefinedSuperMethod_field);
+ });
+ _ut.test('test_undefinedSuperMethod_method', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_undefinedSuperMethod_method);
+ });
_ut.test('test_wrongNumberOfParametersForOperator1', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_wrongNumberOfParametersForOperator1);
@@ -2406,51 +2742,21 @@ class LibraryTest extends EngineTestCase {
_errorListener = new GatheringErrorListener();
_library5 = library("/lib.dart");
}
- void test_addExport() {
- Library exportLibrary = library("/exported.dart");
- _library5.addExport(ASTFactory.exportDirective2("exported.dart", []), exportLibrary);
- List<Library> exports = _library5.exports;
- EngineTestCase.assertLength(1, exports);
- JUnitTestCase.assertSame(exportLibrary, exports[0]);
- _errorListener.assertNoErrors();
- }
- void test_addImport() {
- Library importLibrary = library("/imported.dart");
- _library5.addImport(ASTFactory.importDirective2("imported.dart", null, []), importLibrary);
- List<Library> imports = _library5.imports;
- EngineTestCase.assertLength(1, imports);
- JUnitTestCase.assertSame(importLibrary, imports[0]);
- _errorListener.assertNoErrors();
- }
void test_getExplicitlyImportsCore() {
JUnitTestCase.assertFalse(_library5.explicitlyImportsCore);
_errorListener.assertNoErrors();
}
- void test_getExport() {
- ExportDirective directive = ASTFactory.exportDirective2("exported.dart", []);
- Library exportLibrary = library("/exported.dart");
- _library5.addExport(directive, exportLibrary);
- JUnitTestCase.assertSame(exportLibrary, _library5.getExport(directive));
- _errorListener.assertNoErrors();
- }
void test_getExports() {
EngineTestCase.assertLength(0, _library5.exports);
_errorListener.assertNoErrors();
}
- void test_getImport() {
- ImportDirective directive = ASTFactory.importDirective2("imported.dart", null, []);
- Library importLibrary = library("/imported.dart");
- _library5.addImport(directive, importLibrary);
- JUnitTestCase.assertSame(importLibrary, _library5.getImport(directive));
- _errorListener.assertNoErrors();
- }
void test_getImports() {
EngineTestCase.assertLength(0, _library5.imports);
_errorListener.assertNoErrors();
}
void test_getImportsAndExports() {
- _library5.addImport(ASTFactory.importDirective2("imported.dart", null, []), library("/imported.dart"));
- _library5.addExport(ASTFactory.exportDirective2("exported.dart", []), library("/exported.dart"));
+ _library5.importedLibraries = <Library> [library("/imported.dart")];
+ _library5.exportedLibraries = <Library> [library("/exported.dart")];
EngineTestCase.assertLength(2, _library5.importsAndExports);
_errorListener.assertNoErrors();
}
@@ -2469,6 +2775,22 @@ class LibraryTest extends EngineTestCase {
JUnitTestCase.assertTrue(_library5.explicitlyImportsCore);
_errorListener.assertNoErrors();
}
+ void test_setExportedLibraries() {
+ Library exportLibrary = library("/exported.dart");
+ _library5.exportedLibraries = <Library> [exportLibrary];
+ List<Library> exports = _library5.exports;
+ EngineTestCase.assertLength(1, exports);
+ JUnitTestCase.assertSame(exportLibrary, exports[0]);
+ _errorListener.assertNoErrors();
+ }
+ void test_setImportedLibraries() {
+ Library importLibrary = library("/imported.dart");
+ _library5.importedLibraries = <Library> [importLibrary];
+ List<Library> imports = _library5.imports;
+ EngineTestCase.assertLength(1, imports);
+ JUnitTestCase.assertSame(importLibrary, imports[0]);
+ _errorListener.assertNoErrors();
+ }
void test_setLibraryElement() {
LibraryElementImpl element = new LibraryElementImpl(_analysisContext, ASTFactory.libraryIdentifier2(["lib"]));
_library5.libraryElement = element;
@@ -2477,30 +2799,14 @@ class LibraryTest extends EngineTestCase {
Library library(String definingCompilationUnitPath) => new Library(_analysisContext, _errorListener, new FileBasedSource.con1(_sourceFactory.contentCache, FileUtilities2.createFile(definingCompilationUnitPath)));
static dartSuite() {
_ut.group('LibraryTest', () {
- _ut.test('test_addExport', () {
- final __test = new LibraryTest();
- runJUnitTest(__test, __test.test_addExport);
- });
- _ut.test('test_addImport', () {
- final __test = new LibraryTest();
- runJUnitTest(__test, __test.test_addImport);
- });
_ut.test('test_getExplicitlyImportsCore', () {
final __test = new LibraryTest();
runJUnitTest(__test, __test.test_getExplicitlyImportsCore);
});
- _ut.test('test_getExport', () {
- final __test = new LibraryTest();
- runJUnitTest(__test, __test.test_getExport);
- });
_ut.test('test_getExports', () {
final __test = new LibraryTest();
runJUnitTest(__test, __test.test_getExports);
});
- _ut.test('test_getImport', () {
- final __test = new LibraryTest();
- runJUnitTest(__test, __test.test_getImport);
- });
_ut.test('test_getImports', () {
final __test = new LibraryTest();
runJUnitTest(__test, __test.test_getImports);
@@ -2521,6 +2827,14 @@ class LibraryTest extends EngineTestCase {
final __test = new LibraryTest();
runJUnitTest(__test, __test.test_setExplicitlyImportsCore);
});
+ _ut.test('test_setExportedLibraries', () {
+ final __test = new LibraryTest();
+ runJUnitTest(__test, __test.test_setExportedLibraries);
+ });
+ _ut.test('test_setImportedLibraries', () {
+ final __test = new LibraryTest();
+ runJUnitTest(__test, __test.test_setImportedLibraries);
+ });
_ut.test('test_setLibraryElement', () {
final __test = new LibraryTest();
runJUnitTest(__test, __test.test_setLibraryElement);
@@ -2535,24 +2849,12 @@ class StaticTypeWarningCodeTest extends ResolverTestCase {
assertErrors([StaticTypeWarningCode.INACCESSIBLE_SETTER]);
verify([source]);
}
- void fail_nonTypeAsTypeArgument() {
- Source source = addSource(EngineTestCase.createSource(["int A;", "class B<E> {}", "f(B<A> b) {}"]));
- resolve(source);
- assertErrors([StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT]);
- verify([source]);
- }
void fail_redirectWithInvalidTypeParameters() {
Source source = addSource(EngineTestCase.createSource([]));
resolve(source);
assertErrors([StaticTypeWarningCode.REDIRECT_WITH_INVALID_TYPE_PARAMETERS]);
verify([source]);
}
- void fail_typeArgumentViolatesBounds() {
- Source source = addSource(EngineTestCase.createSource([]));
- resolve(source);
- assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_VIOLATES_BOUNDS]);
- verify([source]);
- }
void test_inconsistentMethodInheritance_paramCount() {
Source source = addSource(EngineTestCase.createSource(["abstract class A {", " int x();", "}", "abstract class B {", " int x(int y);", "}", "class C implements A, B {", "}"]));
resolve(source);
@@ -2658,6 +2960,18 @@ class StaticTypeWarningCodeTest extends ResolverTestCase {
assertErrors([StaticTypeWarningCode.NON_BOOL_EXPRESSION]);
verify([source]);
}
+ void test_nonTypeAsTypeArgument_notAType() {
+ Source source = addSource(EngineTestCase.createSource(["int A;", "class B<E> {}", "f(B<A> b) {}"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT]);
+ verify([source]);
+ }
+ void test_nonTypeAsTypeArgument_undefinedIdentifier() {
+ Source source = addSource(EngineTestCase.createSource(["class B<E> {}", "f(B<A> b) {}"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT]);
+ verify([source]);
+ }
void test_returnOfInvalidType_expressionFunctionBody_function() {
Source source = addSource(EngineTestCase.createSource(["int f() => '0';"]));
resolve(source);
@@ -2718,18 +3032,108 @@ class StaticTypeWarningCodeTest extends ResolverTestCase {
assertErrors([StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]);
verify([source]);
}
+ void test_typeArgumentNotMatchingBounds_classTypeAlias() {
+ Source source = addSource(EngineTestCase.createSource(["class A {}", "class B {}", "class C {}", "class G<E extends A> {}", "typedef D = G<B> with C;"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
+ verify([source]);
+ }
void test_typeArgumentNotMatchingBounds_const() {
Source source = addSource(EngineTestCase.createSource(["class A {}", "class B {}", "class G<E extends A> {", " const G();", "}", "f() { return const G<B>(); }"]));
resolve(source);
assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
verify([source]);
}
+ void test_typeArgumentNotMatchingBounds_extends() {
+ Source source = addSource(EngineTestCase.createSource(["class A {}", "class B {}", "class G<E extends A> {}", "class C extends G<B>{}"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
+ verify([source]);
+ }
+ void test_typeArgumentNotMatchingBounds_fieldFormalParameter() {
+ Source source = addSource(EngineTestCase.createSource(["class A {}", "class B {}", "class G<E extends A> {}", "class C {", " var f;", " C(G<B> this.f) {}", "}"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
+ verify([source]);
+ }
+ void test_typeArgumentNotMatchingBounds_functionReturnType() {
+ Source source = addSource(EngineTestCase.createSource(["class A {}", "class B {}", "class G<E extends A> {}", "G<B> f() {}"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
+ verify([source]);
+ }
+ void test_typeArgumentNotMatchingBounds_functionTypeAlias() {
+ Source source = addSource(EngineTestCase.createSource(["class A {}", "class B {}", "class G<E extends A> {}", "typedef G<B> f();"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
+ verify([source]);
+ }
+ void test_typeArgumentNotMatchingBounds_functionTypedFormalParameter() {
+ Source source = addSource(EngineTestCase.createSource(["class A {}", "class B {}", "class G<E extends A> {}", "f(G<B> h()) {}"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
+ verify([source]);
+ }
+ void test_typeArgumentNotMatchingBounds_implements() {
+ Source source = addSource(EngineTestCase.createSource(["class A {}", "class B {}", "class G<E extends A> {}", "class C implements G<B>{}"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
+ verify([source]);
+ }
+ void test_typeArgumentNotMatchingBounds_is() {
+ Source source = addSource(EngineTestCase.createSource(["class A {}", "class B {}", "class G<E extends A> {}", "var b = 1 is G<B>;"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
+ verify([source]);
+ }
+ void test_typeArgumentNotMatchingBounds_methodReturnType() {
+ Source source = addSource(EngineTestCase.createSource(["class A {}", "class B {}", "class G<E extends A> {}", "class C {", " G<B> m() {}", "}"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
+ verify([source]);
+ }
void test_typeArgumentNotMatchingBounds_new() {
Source source = addSource(EngineTestCase.createSource(["class A {}", "class B {}", "class G<E extends A> {}", "f() { return new G<B>(); }"]));
resolve(source);
assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
verify([source]);
}
+ void test_typeArgumentNotMatchingBounds_new_superTypeOfUpperBound() {
+ Source source = addSource(EngineTestCase.createSource(["class A {}", "class B extends A {}", "class C extends B {}", "class G<E extends B> {}", "f() { return new G<A>(); }"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
+ verify([source]);
+ }
+ void test_typeArgumentNotMatchingBounds_parameter() {
+ Source source = addSource(EngineTestCase.createSource(["class A {}", "class B {}", "class G<E extends A> {}", "f(G<B> g) {}"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
+ verify([source]);
+ }
+ void test_typeArgumentNotMatchingBounds_typeArgumentList() {
+ Source source = addSource(EngineTestCase.createSource(["class A {}", "class B {}", "class C<E> {}", "class D<E extends A> {}", "C<D<B>> Var;"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
+ verify([source]);
+ }
+ void test_typeArgumentNotMatchingBounds_typeParameter() {
+ Source source = addSource(EngineTestCase.createSource(["class A {}", "class B {}", "class C {}", "class G<E extends A> {}", "class D<F extends G<B>> {}"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
+ verify([source]);
+ }
+ void test_typeArgumentNotMatchingBounds_variableDeclaration() {
+ Source source = addSource(EngineTestCase.createSource(["class A {}", "class B {}", "class G<E extends A> {}", "G<B> g;"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
+ verify([source]);
+ }
+ void test_typeArgumentNotMatchingBounds_with() {
+ Source source = addSource(EngineTestCase.createSource(["class A {}", "class B {}", "class G<E extends A> {}", "class C extends Object with G<B>{}"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
+ verify([source]);
+ }
void test_undefinedFunction() {
Source source = addSource(EngineTestCase.createSource(["void f() {", " g();", "}"]));
resolve(source);
@@ -2802,6 +3206,18 @@ class StaticTypeWarningCodeTest extends ResolverTestCase {
assertErrors([StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]);
verify([source]);
}
+ void test_wrongNumberOfTypeArguments_typeTest_tooFew() {
+ Source source = addSource(EngineTestCase.createSource(["class A {}", "class C<K, V> {}", "f(p) {", " return p is C<A>;", "}"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]);
+ verify([source]);
+ }
+ void test_wrongNumberOfTypeArguments_typeTest_tooMany() {
+ Source source = addSource(EngineTestCase.createSource(["class A {}", "class C<E> {}", "f(p) {", " return p is C<A, A>;", "}"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]);
+ verify([source]);
+ }
static dartSuite() {
_ut.group('StaticTypeWarningCodeTest', () {
_ut.test('test_inconsistentMethodInheritance_paramCount', () {
@@ -2876,6 +3292,14 @@ class StaticTypeWarningCodeTest extends ResolverTestCase {
final __test = new StaticTypeWarningCodeTest();
runJUnitTest(__test, __test.test_nonBoolExpression);
});
+ _ut.test('test_nonTypeAsTypeArgument_notAType', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_nonTypeAsTypeArgument_notAType);
+ });
+ _ut.test('test_nonTypeAsTypeArgument_undefinedIdentifier', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_nonTypeAsTypeArgument_undefinedIdentifier);
+ });
_ut.test('test_returnOfInvalidType_expressionFunctionBody_function', () {
final __test = new StaticTypeWarningCodeTest();
runJUnitTest(__test, __test.test_returnOfInvalidType_expressionFunctionBody_function);
@@ -2916,14 +3340,74 @@ class StaticTypeWarningCodeTest extends ResolverTestCase {
final __test = new StaticTypeWarningCodeTest();
runJUnitTest(__test, __test.test_returnOfInvalidType_void);
});
+ _ut.test('test_typeArgumentNotMatchingBounds_classTypeAlias', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_classTypeAlias);
+ });
_ut.test('test_typeArgumentNotMatchingBounds_const', () {
final __test = new StaticTypeWarningCodeTest();
runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_const);
});
+ _ut.test('test_typeArgumentNotMatchingBounds_extends', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_extends);
+ });
+ _ut.test('test_typeArgumentNotMatchingBounds_fieldFormalParameter', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_fieldFormalParameter);
+ });
+ _ut.test('test_typeArgumentNotMatchingBounds_functionReturnType', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_functionReturnType);
+ });
+ _ut.test('test_typeArgumentNotMatchingBounds_functionTypeAlias', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_functionTypeAlias);
+ });
+ _ut.test('test_typeArgumentNotMatchingBounds_functionTypedFormalParameter', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_functionTypedFormalParameter);
+ });
+ _ut.test('test_typeArgumentNotMatchingBounds_implements', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_implements);
+ });
+ _ut.test('test_typeArgumentNotMatchingBounds_is', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_is);
+ });
+ _ut.test('test_typeArgumentNotMatchingBounds_methodReturnType', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_methodReturnType);
+ });
_ut.test('test_typeArgumentNotMatchingBounds_new', () {
final __test = new StaticTypeWarningCodeTest();
runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_new);
});
+ _ut.test('test_typeArgumentNotMatchingBounds_new_superTypeOfUpperBound', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_new_superTypeOfUpperBound);
+ });
+ _ut.test('test_typeArgumentNotMatchingBounds_parameter', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_parameter);
+ });
+ _ut.test('test_typeArgumentNotMatchingBounds_typeArgumentList', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_typeArgumentList);
+ });
+ _ut.test('test_typeArgumentNotMatchingBounds_typeParameter', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_typeParameter);
+ });
+ _ut.test('test_typeArgumentNotMatchingBounds_variableDeclaration', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_variableDeclaration);
+ });
+ _ut.test('test_typeArgumentNotMatchingBounds_with', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_with);
+ });
_ut.test('test_undefinedFunction', () {
final __test = new StaticTypeWarningCodeTest();
runJUnitTest(__test, __test.test_undefinedFunction);
@@ -2980,6 +3464,14 @@ class StaticTypeWarningCodeTest extends ResolverTestCase {
final __test = new StaticTypeWarningCodeTest();
runJUnitTest(__test, __test.test_wrongNumberOfTypeArguments_tooMany);
});
+ _ut.test('test_wrongNumberOfTypeArguments_typeTest_tooFew', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_wrongNumberOfTypeArguments_typeTest_tooFew);
+ });
+ _ut.test('test_wrongNumberOfTypeArguments_typeTest_tooMany', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_wrongNumberOfTypeArguments_typeTest_tooMany);
+ });
});
}
}
@@ -3193,11 +3685,12 @@ class TypeResolverVisitorTest extends EngineTestCase {
* Analyze the given catch clause and assert that the types of the parameters have been set to the
* given types. The types can be null if the catch clause does not have the corresponding
* parameter.
+ *
* @param node the catch clause to be analyzed
* @param exceptionType the expected type of the exception parameter
* @param stackTraceType the expected type of the stack trace parameter
* @param definedElements the elements that are to be defined in the scope in which the element is
- * being resolved
+ * being resolved
*/
void resolve(CatchClause node, InterfaceType exceptionType, InterfaceType stackTraceType, List<Element> definedElements) {
resolveNode(node, definedElements);
@@ -3214,9 +3707,10 @@ class TypeResolverVisitorTest extends EngineTestCase {
/**
* Return the type associated with the given parameter after the static type analyzer has computed
* a type for it.
+ *
* @param node the parameter with which the type is associated
* @param definedElements the elements that are to be defined in the scope in which the element is
- * being resolved
+ * being resolved
* @return the type associated with the parameter
*/
Type2 resolve6(FormalParameter node, List<Element> definedElements) {
@@ -3227,9 +3721,10 @@ class TypeResolverVisitorTest extends EngineTestCase {
/**
* Return the element associated with the given identifier after the resolver has resolved the
* identifier.
+ *
* @param node the expression to be resolved
* @param definedElements the elements that are to be defined in the scope in which the element is
- * being resolved
+ * being resolved
* @return the element to which the expression was resolved
*/
void resolveNode(ASTNode node, List<Element> definedElements) {
@@ -3294,7 +3789,7 @@ class TypeResolverVisitorTest extends EngineTestCase {
class ResolverTestCase extends EngineTestCase {
/**
- * The source factory used to create [Source sources].
+ * The source factory used to create [Source].
*/
SourceFactory _sourceFactory;
@@ -3308,6 +3803,7 @@ class ResolverTestCase extends EngineTestCase {
/**
* Add a source file to the content provider.
+ *
* @param contents the contents to be returned by the content provider for the specified file
* @return the source object representing the added file
*/
@@ -3315,6 +3811,7 @@ class ResolverTestCase extends EngineTestCase {
/**
* Add a source file to the content provider. The file path should be absolute.
+ *
* @param filePath the path of the file being added
* @param contents the contents to be returned by the content provider for the specified file
* @return the source object representing the added file
@@ -3331,9 +3828,10 @@ class ResolverTestCase extends EngineTestCase {
* Assert that the number of errors that have been gathered matches the number of errors that are
* given and that they have the expected error codes. The order in which the errors were gathered
* is ignored.
+ *
* @param expectedErrorCodes the error codes of the errors that should have been gathered
* @throws AssertionFailedError if a different number of errors have been gathered than were
- * expected
+ * expected
*/
void assertErrors(List<ErrorCode> expectedErrorCodes) {
GatheringErrorListener errorListener = new GatheringErrorListener();
@@ -3347,6 +3845,7 @@ class ResolverTestCase extends EngineTestCase {
/**
* Assert that no errors have been gathered.
+ *
* @throws AssertionFailedError if any errors have been gathered
*/
void assertNoErrors() {
@@ -3362,6 +3861,7 @@ class ResolverTestCase extends EngineTestCase {
/**
* Cache the source file content in the source factory but don't add the source to the analysis
* context. The file path should be absolute.
+ *
* @param filePath the path of the file being cached
* @param contents the contents to be returned by the content provider for the specified file
* @return the source object representing the cached file
@@ -3375,6 +3875,7 @@ class ResolverTestCase extends EngineTestCase {
/**
* Create a library element that represents a library named `"test"` containing a single
* empty compilation unit.
+ *
* @return the library element that was created
*/
LibraryElementImpl createTestLibrary() => createTestLibrary2(new AnalysisContextImpl(), "test", []);
@@ -3382,6 +3883,7 @@ class ResolverTestCase extends EngineTestCase {
/**
* Create a library element that represents a library with the given name containing a single
* empty compilation unit.
+ *
* @param libraryName the name of the library to be created
* @return the library element that was created
*/
@@ -3410,6 +3912,7 @@ class ResolverTestCase extends EngineTestCase {
/**
* Return a type provider that can be used to test the results of resolution.
+ *
* @return a type provider
*/
TypeProvider get typeProvider {
@@ -3431,6 +3934,7 @@ class ResolverTestCase extends EngineTestCase {
* Given a library and all of its parts, resolve the contents of the library and the contents of
* the parts. This assumes that the sources for the library and its parts have already been added
* to the content provider using the method [addSource].
+ *
* @param librarySource the source for the compilation unit that defines the library
* @return the element representing the resolved library
* @throws AnalysisException if the analysis could not be performed
@@ -3439,6 +3943,7 @@ class ResolverTestCase extends EngineTestCase {
/**
* Return the resolved compilation unit corresponding to the given source in the given library.
+ *
* @param source the source of the compilation unit to be returned
* @param library the library in which the compilation unit is to be resolved
* @return the resolved compilation unit
@@ -3449,8 +3954,9 @@ class ResolverTestCase extends EngineTestCase {
/**
* Verify that all of the identifiers in the compilation units associated with the given sources
* have been resolved.
+ *
* @param resolvedElementMap a table mapping the AST nodes that have been resolved to the element
- * to which they were resolved
+ * to which they were resolved
* @param sources the sources identifying the compilation units to be verified
* @throws Exception if the contents of the compilation unit cannot be accessed
*/
@@ -3464,6 +3970,7 @@ class ResolverTestCase extends EngineTestCase {
/**
* Create a source object representing a file with the given name and give it an empty content.
+ *
* @param fileName the name of the file for which a source is to be created
* @return the source that was created
*/
@@ -3489,9 +3996,10 @@ class TypeProviderImplTest extends EngineTestCase {
InterfaceType mapType = classElement("Map", objectType, ["K", "V"]).type;
InterfaceType stackTraceType = classElement("StackTrace", objectType, []).type;
InterfaceType stringType = classElement("String", objectType, []).type;
+ InterfaceType symbolType = classElement("Symbol", objectType, []).type;
InterfaceType typeType = classElement("Type", objectType, []).type;
CompilationUnitElementImpl unit = new CompilationUnitElementImpl("lib.dart");
- unit.types = <ClassElement> [boolType.element, doubleType.element, functionType.element, intType.element, listType.element, mapType.element, objectType.element, stackTraceType.element, stringType.element, typeType.element];
+ unit.types = <ClassElement> [boolType.element, doubleType.element, functionType.element, intType.element, listType.element, mapType.element, objectType.element, stackTraceType.element, stringType.element, symbolType.element, typeType.element];
LibraryElementImpl library = new LibraryElementImpl(new AnalysisContextImpl(), ASTFactory.libraryIdentifier2(["lib"]));
library.definingCompilationUnit = unit;
TypeProviderImpl provider = new TypeProviderImpl(library);
@@ -3506,6 +4014,7 @@ class TypeProviderImplTest extends EngineTestCase {
JUnitTestCase.assertSame(objectType, provider.objectType);
JUnitTestCase.assertSame(stackTraceType, provider.stackTraceType);
JUnitTestCase.assertSame(stringType, provider.stringType);
+ JUnitTestCase.assertSame(symbolType, provider.symbolType);
JUnitTestCase.assertSame(typeType, provider.typeType);
}
ClassElement classElement(String typeName, InterfaceType superclassType, List<String> parameterNames) {
@@ -3858,6 +4367,7 @@ class InheritanceManagerTest extends EngineTestCase {
/**
* Create the inheritance manager used by the tests.
+ *
* @return the inheritance manager that was created
*/
InheritanceManager createInheritanceManager() {
@@ -3999,36 +4509,6 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
assertErrors([CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION]);
verify([source]);
}
- void fail_duplicateDefinition() {
- Source source = addSource(EngineTestCase.createSource(["f() {", " int m = 0;", " m(a) {}", "}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION]);
- verify([source]);
- }
- void fail_duplicateMemberError_classMembers_fields() {
- Source librarySource = addSource(EngineTestCase.createSource(["class A {", " int a;", " int a;", "}"]));
- resolve(librarySource);
- assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION]);
- verify([librarySource]);
- }
- void fail_duplicateMemberError_localFields() {
- Source librarySource = addSource(EngineTestCase.createSource(["class A {", " m() {", " int a;", " int a;", " }", "}"]));
- resolve(librarySource);
- assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION]);
- verify([librarySource]);
- }
- void fail_duplicateMemberName() {
- Source source = addSource(EngineTestCase.createSource(["class A {", " int x = 0;", " int x() {}", "}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.DUPLICATE_MEMBER_NAME]);
- verify([source]);
- }
- void fail_duplicateMemberNameInstanceStatic() {
- Source source = addSource(EngineTestCase.createSource(["class A {", " int x;", " static int x;", "}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.DUPLICATE_MEMBER_NAME_INSTANCE_STATIC]);
- verify([source]);
- }
void fail_extendsOrImplementsDisallowedClass_extends_null() {
Source source = addSource(EngineTestCase.createSource(["class A extends Null {}"]));
resolve(source);
@@ -4041,12 +4521,6 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
verify([source]);
}
- void fail_invalidOverrideDefaultValue() {
- Source source = addSource(EngineTestCase.createSource(["class A {", " m([a = 0]) {}", "}", "class B extends A {", " m([a = 1]) {}", "}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.INVALID_OVERRIDE_DEFAULT_VALUE]);
- verify([source]);
- }
void fail_mixinDeclaresConstructor() {
Source source = addSource(EngineTestCase.createSource(["class A {", " A() {}", "}", "class B extends Object mixin A {}"]));
resolve(source);
@@ -4113,42 +4587,6 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
assertErrors([CompileTimeErrorCode.UNINITIALIZED_FINAL_FIELD]);
verify([source]);
}
- void fail_wrongNumberOfTypeArguments_creation_const_tooFew() {
- Source source = addSource(EngineTestCase.createSource(["class A {}", "class C<K, V> {}", "f(p) {", " return const C<A>();", "}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]);
- verify([source]);
- }
- void fail_wrongNumberOfTypeArguments_creation_const_tooMany() {
- Source source = addSource(EngineTestCase.createSource(["class A {}", "class C<E> {}", "f(p) {", " return const C<A, A>();", "}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]);
- verify([source]);
- }
- void fail_wrongNumberOfTypeArguments_creation_new_tooFew() {
- Source source = addSource(EngineTestCase.createSource(["class A {}", "class C<K, V> {}", "f(p) {", " return new C<A>();", "}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]);
- verify([source]);
- }
- void fail_wrongNumberOfTypeArguments_creation_new_tooMany() {
- Source source = addSource(EngineTestCase.createSource(["class A {}", "class C<E> {}", "f(p) {", " return new C<A, A>();", "}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]);
- verify([source]);
- }
- void fail_wrongNumberOfTypeArguments_typeTest_tooFew() {
- Source source = addSource(EngineTestCase.createSource(["class A {}", "class C<K, V> {}", "f(p) {", " return p is C<A>;", "}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]);
- verify([source]);
- }
- void fail_wrongNumberOfTypeArguments_typeTest_tooMany() {
- Source source = addSource(EngineTestCase.createSource(["class A {}", "class C<E> {}", "f(p) {", " return p is C<A, A>;", "}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]);
- verify([source]);
- }
void test_ambiguousExport() {
Source source = addSource(EngineTestCase.createSource(["library L;", "export 'lib1.dart';", "export 'lib2.dart';"]));
addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "class N {}"]));
@@ -4264,7 +4702,7 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
verify([source]);
}
void test_caseExpressionTypeImplementsEquals() {
- Source source = addSource(EngineTestCase.createSource(["class IntWrapper {", " final int value;", " const IntWrapper(this.value);", " bool operator ==(IntWrapper x) {", " return value == x.value;", " }", "}", "", "f(IntWrapper a) {", " switch(a) {", " case(const IntWrapper(1)) : return 1;", " default: return 0;", " }", "}"]));
+ Source source = addSource(EngineTestCase.createSource(["class IntWrapper {", " final int value;", " const IntWrapper(this.value);", " bool operator ==(IntWrapper x) {", " return value == x.value;", " }", "}", "", "f(var a) {", " switch(a) {", " case(const IntWrapper(1)) : return 1;", " default: return 0;", " }", "}"]));
resolve(source);
assertErrors([CompileTimeErrorCode.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]);
verify([source]);
@@ -4281,6 +4719,30 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
assertErrors([CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD]);
verify([source]);
}
+ void test_conflictingGetterAndMethod_field_method() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " int m;", "}", "class B extends A {", " m() {}", "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD]);
+ verify([source]);
+ }
+ void test_conflictingGetterAndMethod_getter_method() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " get m => 0;", "}", "class B extends A {", " m() {}", "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD]);
+ verify([source]);
+ }
+ void test_conflictingGetterAndMethod_method_field() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " m() {}", "}", "class B extends A {", " int m;", "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]);
+ verify([source]);
+ }
+ void test_conflictingGetterAndMethod_method_getter() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " m() {}", "}", "class B extends A {", " get m => 0;", "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]);
+ verify([source]);
+ }
void test_constConstructorWithNonFinalField_mixin() {
Source source = addSource(EngineTestCase.createSource(["class A {", " var a;", "}", "class B extends Object with A {", " const B();", "}"]));
resolve(source);
@@ -4299,6 +4761,24 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
assertErrors([CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD]);
verify([source]);
}
+ void test_constEval_newInstance_constConstructor() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " const A();", "}", "const a = new A();"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
+ verify([source]);
+ }
+ void test_constEval_propertyExtraction_methodInstance() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " const A();", " m() {}", "}", "final a = const A();", "const C = a.m;"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
+ verify([source]);
+ }
+ void test_constEval_propertyExtraction_methodStatic_targetInstance() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " const A();", " static m() {}", "}", "final a = const A();", "const C = a.m;"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
+ verify([source]);
+ }
void test_constEvalThrowsException_binaryMinus_null() {
check_constEvalThrowsException_binary_null("null - 5", false);
check_constEvalThrowsException_binary_null("5 - null", true);
@@ -4307,6 +4787,12 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
check_constEvalThrowsException_binary_null("null + 5", false);
check_constEvalThrowsException_binary_null("5 + null", true);
}
+ void test_constEvalThrowsException_divisionByZero() {
+ Source source = addSource("const C = 1 ~/ 0;");
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.CONST_EVAL_THROWS_IDBZE]);
+ verify([source]);
+ }
void test_constEvalThrowsException_unaryBitNot_null() {
Source source = addSource("const C = ~null;");
resolve(source);
@@ -4327,6 +4813,12 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
check_constEvalTypeBool_withParameter_binary("p && ''");
check_constEvalTypeBool_withParameter_binary("p || ''");
}
+ void test_constEvalTypeBool_binary_leftTrue() {
+ Source source = addSource("const C = (true || 0);");
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL]);
+ verify([source]);
+ }
void test_constEvalTypeBoolNumString_equal() {
Source source = addSource(EngineTestCase.createSource(["class A {", " const A();", "}", "class B {", " final a;", " const B(num p) : a = p == const A();", "}"]));
resolve(source);
@@ -4400,6 +4892,18 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
assertErrors([CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS]);
verify([source]);
}
+ void test_constWithInvalidTypeParameters_tooFew() {
+ Source source = addSource(EngineTestCase.createSource(["class A {}", "class C<K, V> {", " const C();", "}", "f(p) {", " return const C<A>();", "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS]);
+ verify([source]);
+ }
+ void test_constWithInvalidTypeParameters_tooMany() {
+ Source source = addSource(EngineTestCase.createSource(["class A {}", "class C<E> {", " const C();", "}", "f(p) {", " return const C<A, A>();", "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS]);
+ verify([source]);
+ }
void test_constWithNonConst() {
Source source = addSource(EngineTestCase.createSource(["class T {", " T(a, b, {c, d}) {}", "}", "f() { return const T(0, 1, c: 2, d: 3); }"]));
resolve(source);
@@ -4418,6 +4922,14 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
assertErrors([CompileTimeErrorCode.CONST_WITH_NON_TYPE]);
verify([source]);
}
+ void test_constWithNonType_fromLibrary() {
+ Source source1 = addSource2("lib.dart", "");
+ Source source2 = addSource2("lib2.dart", EngineTestCase.createSource(["import 'lib.dart' as lib;", "void f() {", " const lib.A();", "}"]));
+ resolve(source1);
+ resolve(source2);
+ assertErrors([CompileTimeErrorCode.CONST_WITH_NON_TYPE]);
+ verify([source1]);
+ }
void test_constWithTypeParameters_direct() {
Source source = addSource(EngineTestCase.createSource(["class A<T> {", " static const V = const A<T>();", " const A();", "}"]));
resolve(source);
@@ -4447,17 +4959,55 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
assertErrors([CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS]);
verify([source]);
}
- void test_duplicateConstructorName_named() {
- Source source = addSource(EngineTestCase.createSource(["class A {", " A.a() {}", " A.a() {}", "}"]));
+ void test_duplicateConstructorName_named() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " A.a() {}", " A.a() {}", "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME, CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME]);
+ verify([source]);
+ }
+ void test_duplicateConstructorName_unnamed() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " A() {}", " A() {}", "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT, CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT]);
+ verify([source]);
+ }
+ void test_duplicateDefinition() {
+ Source source = addSource(EngineTestCase.createSource(["f() {", " int m = 0;", " m(a) {}", "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION, CompileTimeErrorCode.DUPLICATE_DEFINITION]);
+ verify([source]);
+ }
+ void test_duplicateDefinition_acrossLibraries() {
+ Source librarySource = addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "", "part 'a.dart';", "part 'b.dart';"]));
+ Source sourceA = addSource2("/a.dart", EngineTestCase.createSource(["part of lib;", "", "class A {}"]));
+ Source sourceB = addSource2("/b.dart", EngineTestCase.createSource(["part of lib;", "", "class A {}"]));
+ resolve(librarySource);
+ assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION]);
+ verify([librarySource, sourceA, sourceB]);
+ }
+ void test_duplicateDefinition_classMembers_fields() {
+ Source librarySource = addSource(EngineTestCase.createSource(["class A {", " int a;", " int a;", "}"]));
+ resolve(librarySource);
+ assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION, CompileTimeErrorCode.DUPLICATE_DEFINITION, CompileTimeErrorCode.DUPLICATE_DEFINITION, CompileTimeErrorCode.DUPLICATE_DEFINITION]);
+ verify([librarySource]);
+ }
+ void test_duplicateDefinition_classMembers_fields_oneStatic() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " int x;", " static int x;", "}"]));
resolve(source);
- assertErrors([CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME, CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME]);
+ assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION, CompileTimeErrorCode.DUPLICATE_DEFINITION, CompileTimeErrorCode.DUPLICATE_DEFINITION, CompileTimeErrorCode.DUPLICATE_DEFINITION]);
verify([source]);
}
- void test_duplicateConstructorName_unnamed() {
- Source source = addSource(EngineTestCase.createSource(["class A {", " A() {}", " A() {}", "}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT, CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT]);
- verify([source]);
+ void test_duplicateDefinition_classMembers_methods() {
+ Source librarySource = addSource(EngineTestCase.createSource(["class A {", " m() {}", " m() {}", "}"]));
+ resolve(librarySource);
+ assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION, CompileTimeErrorCode.DUPLICATE_DEFINITION]);
+ verify([librarySource]);
+ }
+ void test_duplicateDefinition_localFields() {
+ Source librarySource = addSource(EngineTestCase.createSource(["class A {", " m() {", " int a;", " int a;", " }", "}"]));
+ resolve(librarySource);
+ assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION, CompileTimeErrorCode.DUPLICATE_DEFINITION]);
+ verify([librarySource]);
}
void test_duplicateDefinition_parameterWithFunctionName_local() {
Source source = addSource(EngineTestCase.createSource(["main() {", " f(f) {}", "}"]));
@@ -4471,19 +5021,17 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION, CompileTimeErrorCode.DUPLICATE_DEFINITION]);
verify([source]);
}
- void test_duplicateMemberError() {
- Source librarySource = addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "", "part 'a.dart';", "part 'b.dart';"]));
- Source sourceA = addSource2("/a.dart", EngineTestCase.createSource(["part of lib;", "", "class A {}"]));
- Source sourceB = addSource2("/b.dart", EngineTestCase.createSource(["part of lib;", "", "class A {}"]));
- resolve(librarySource);
- assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION]);
- verify([librarySource, sourceA, sourceB]);
+ void test_duplicateDefinitionInheritance_instanceMethod_staticMethod() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " x() {}", "}", "class B extends A {", " static x() {}", "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]);
+ verify([source]);
}
- void test_duplicateMemberError_classMembers_methods() {
- Source librarySource = addSource(EngineTestCase.createSource(["class A {", " m() {}", " m() {}", "}"]));
- resolve(librarySource);
- assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION, CompileTimeErrorCode.DUPLICATE_DEFINITION]);
- verify([librarySource]);
+ void test_duplicateDefinitionInheritance_instanceMethodAbstract_staticMethod() {
+ Source source = addSource(EngineTestCase.createSource(["abstract class A {", " x();", "}", "abstract class B extends A {", " static x() {}", "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]);
+ verify([source]);
}
void test_duplicateNamedArgument() {
Source source = addSource(EngineTestCase.createSource(["f({a, b}) {}", "main() {", " f(a: 1, a: 2);", "}"]));
@@ -4513,31 +5061,31 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
void test_extendsOrImplementsDisallowedClass_extends_bool() {
Source source = addSource(EngineTestCase.createSource(["class A extends bool {}"]));
resolve(source);
- assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, StaticWarningCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
+ assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
verify([source]);
}
void test_extendsOrImplementsDisallowedClass_extends_double() {
Source source = addSource(EngineTestCase.createSource(["class A extends double {}"]));
resolve(source);
- assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, StaticWarningCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
+ assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
verify([source]);
}
void test_extendsOrImplementsDisallowedClass_extends_int() {
Source source = addSource(EngineTestCase.createSource(["class A extends int {}"]));
resolve(source);
- assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, StaticWarningCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
+ assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
verify([source]);
}
void test_extendsOrImplementsDisallowedClass_extends_num() {
Source source = addSource(EngineTestCase.createSource(["class A extends num {}"]));
resolve(source);
- assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, StaticWarningCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
+ assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
verify([source]);
}
void test_extendsOrImplementsDisallowedClass_extends_String() {
Source source = addSource(EngineTestCase.createSource(["class A extends String {}"]));
resolve(source);
- assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, StaticWarningCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
+ assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
verify([source]);
}
void test_extendsOrImplementsDisallowedClass_implements_bool() {
@@ -4739,6 +5287,12 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
assertErrors([CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]);
verify([source]);
}
+ void test_implicitThisReferenceInInitializer_field2() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " final x = 0;", " final y = x;", "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]);
+ verify([source]);
+ }
void test_implicitThisReferenceInInitializer_invocation() {
Source source = addSource(EngineTestCase.createSource(["class A {", " var v;", " A() : v = f();", " f() {}", "}"]));
resolve(source);
@@ -4823,6 +5377,24 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
assertErrors([CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_STATIC_FIELD]);
verify([source]);
}
+ void test_instanceMemberAccessFromStatic_field() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " int f;", " static foo() {", " f;", " }", "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_STATIC]);
+ verify([source]);
+ }
+ void test_instanceMemberAccessFromStatic_getter() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " get g => null;", " static foo() {", " g;", " }", "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_STATIC]);
+ verify([source]);
+ }
+ void test_instanceMemberAccessFromStatic_method() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " m() {}", " static foo() {", " m();", " }", "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_STATIC]);
+ verify([source]);
+ }
void test_invalidConstructorName_notEnclosingClassName() {
Source source = addSource(EngineTestCase.createSource(["class A {", " B() : super();", "}"]));
resolve(source);
@@ -5075,6 +5647,36 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
assertErrors([CompileTimeErrorCode.NEW_WITH_INVALID_TYPE_PARAMETERS]);
verify([source]);
}
+ void test_newWithInvalidTypeParameters_tooFew() {
+ Source source = addSource(EngineTestCase.createSource(["class A {}", "class C<K, V> {}", "f(p) {", " return new C<A>();", "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.NEW_WITH_INVALID_TYPE_PARAMETERS]);
+ verify([source]);
+ }
+ void test_newWithInvalidTypeParameters_tooMany() {
+ Source source = addSource(EngineTestCase.createSource(["class A {}", "class C<E> {}", "f(p) {", " return new C<A, A>();", "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.NEW_WITH_INVALID_TYPE_PARAMETERS]);
+ verify([source]);
+ }
+ void test_noDefaultSuperConstructorExplicit() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " A(p);", "}", "class B extends A {", " B() {}", "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT]);
+ verify([source]);
+ }
+ void test_noDefaultSuperConstructorImplicit_superHasParameters() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " A(p);", "}", "class B extends A {", "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
+ verify([source]);
+ }
+ void test_noDefaultSuperConstructorImplicit_superOnlyNamed() {
+ Source source = addSource(EngineTestCase.createSource(["class A { A.named() {} }", "class B extends A {}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
+ verify([source]);
+ }
void test_nonConstantDefaultValue_function_named() {
Source source = addSource(EngineTestCase.createSource(["int y;", "f({x : y}) {}"]));
resolve(source);
@@ -5201,6 +5803,12 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
assertErrors([CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR]);
verify([source]);
}
+ void test_nonGenerativeConstructor_implicit2() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " factory A() {}", "}", "class B extends A {", "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR]);
+ verify([source]);
+ }
void test_notEnoughRequiredArguments_const() {
Source source = addSource(EngineTestCase.createSource(["class A {", " const A(int p);", "}", "main() {", " const A();", "}"]));
resolve(source);
@@ -5536,6 +6144,18 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
check_wrongNumberOfParametersForOperator1(">>");
check_wrongNumberOfParametersForOperator1("[]");
}
+ void test_wrongNumberOfParametersForSetter_function_named() {
+ Source source = addSource("set x({p}) {}");
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
+ verify([source]);
+ }
+ void test_wrongNumberOfParametersForSetter_function_optional() {
+ Source source = addSource("set x([p]) {}");
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
+ verify([source]);
+ }
void test_wrongNumberOfParametersForSetter_function_tooFew() {
Source source = addSource("set x() {}");
resolve(source);
@@ -5548,6 +6168,18 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
verify([source]);
}
+ void test_wrongNumberOfParametersForSetter_method_named() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " set x({p}) {}", "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
+ verify([source]);
+ }
+ void test_wrongNumberOfParametersForSetter_method_optional() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " set x([p]) {}", "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
+ verify([source]);
+ }
void test_wrongNumberOfParametersForSetter_method_tooFew() {
Source source = addSource(EngineTestCase.createSource(["class A {", " set x() {}", "}"]));
resolve(source);
@@ -5685,6 +6317,22 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_conflictingConstructorNameAndMember_method);
});
+ _ut.test('test_conflictingGetterAndMethod_field_method', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_conflictingGetterAndMethod_field_method);
+ });
+ _ut.test('test_conflictingGetterAndMethod_getter_method', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_conflictingGetterAndMethod_getter_method);
+ });
+ _ut.test('test_conflictingGetterAndMethod_method_field', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_conflictingGetterAndMethod_method_field);
+ });
+ _ut.test('test_conflictingGetterAndMethod_method_getter', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_conflictingGetterAndMethod_method_getter);
+ });
_ut.test('test_constConstructorWithNonFinalField_mixin', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_constConstructorWithNonFinalField_mixin);
@@ -5705,6 +6353,10 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_constEvalThrowsException_binaryPlus_null);
});
+ _ut.test('test_constEvalThrowsException_divisionByZero', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_constEvalThrowsException_divisionByZero);
+ });
_ut.test('test_constEvalThrowsException_unaryBitNot_null', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_constEvalThrowsException_unaryBitNot_null);
@@ -5729,6 +6381,10 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_constEvalTypeBool_binary);
});
+ _ut.test('test_constEvalTypeBool_binary_leftTrue', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_constEvalTypeBool_binary_leftTrue);
+ });
_ut.test('test_constEvalTypeInt_binary', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_constEvalTypeInt_binary);
@@ -5737,6 +6393,18 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_constEvalTypeNum_binary);
});
+ _ut.test('test_constEval_newInstance_constConstructor', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_constEval_newInstance_constConstructor);
+ });
+ _ut.test('test_constEval_propertyExtraction_methodInstance', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_constEval_propertyExtraction_methodInstance);
+ });
+ _ut.test('test_constEval_propertyExtraction_methodStatic_targetInstance', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_constEval_propertyExtraction_methodStatic_targetInstance);
+ });
_ut.test('test_constFormalParameter_fieldFormalParameter', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_constFormalParameter_fieldFormalParameter);
@@ -5765,6 +6433,14 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_constWithInvalidTypeParameters);
});
+ _ut.test('test_constWithInvalidTypeParameters_tooFew', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_constWithInvalidTypeParameters_tooFew);
+ });
+ _ut.test('test_constWithInvalidTypeParameters_tooMany', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_constWithInvalidTypeParameters_tooMany);
+ });
_ut.test('test_constWithNonConst', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_constWithNonConst);
@@ -5777,6 +6453,10 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_constWithNonType);
});
+ _ut.test('test_constWithNonType_fromLibrary', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_constWithNonType_fromLibrary);
+ });
_ut.test('test_constWithTypeParameters_direct', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_constWithTypeParameters_direct);
@@ -5805,21 +6485,45 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_duplicateConstructorName_unnamed);
});
- _ut.test('test_duplicateDefinition_parameterWithFunctionName_local', () {
+ _ut.test('test_duplicateDefinition', () {
final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_duplicateDefinition_parameterWithFunctionName_local);
+ runJUnitTest(__test, __test.test_duplicateDefinition);
});
- _ut.test('test_duplicateDefinition_parameterWithFunctionName_topLevel', () {
+ _ut.test('test_duplicateDefinitionInheritance_instanceMethodAbstract_staticMethod', () {
final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_duplicateDefinition_parameterWithFunctionName_topLevel);
+ runJUnitTest(__test, __test.test_duplicateDefinitionInheritance_instanceMethodAbstract_staticMethod);
+ });
+ _ut.test('test_duplicateDefinitionInheritance_instanceMethod_staticMethod', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_duplicateDefinitionInheritance_instanceMethod_staticMethod);
+ });
+ _ut.test('test_duplicateDefinition_acrossLibraries', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_duplicateDefinition_acrossLibraries);
+ });
+ _ut.test('test_duplicateDefinition_classMembers_fields', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_duplicateDefinition_classMembers_fields);
+ });
+ _ut.test('test_duplicateDefinition_classMembers_fields_oneStatic', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_duplicateDefinition_classMembers_fields_oneStatic);
+ });
+ _ut.test('test_duplicateDefinition_classMembers_methods', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_duplicateDefinition_classMembers_methods);
+ });
+ _ut.test('test_duplicateDefinition_localFields', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_duplicateDefinition_localFields);
});
- _ut.test('test_duplicateMemberError', () {
+ _ut.test('test_duplicateDefinition_parameterWithFunctionName_local', () {
final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_duplicateMemberError);
+ runJUnitTest(__test, __test.test_duplicateDefinition_parameterWithFunctionName_local);
});
- _ut.test('test_duplicateMemberError_classMembers_methods', () {
+ _ut.test('test_duplicateDefinition_parameterWithFunctionName_topLevel', () {
final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_duplicateMemberError_classMembers_methods);
+ runJUnitTest(__test, __test.test_duplicateDefinition_parameterWithFunctionName_topLevel);
});
_ut.test('test_duplicateNamedArgument', () {
final __test = new CompileTimeErrorCodeTest();
@@ -5977,6 +6681,10 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_implicitThisReferenceInInitializer_field);
});
+ _ut.test('test_implicitThisReferenceInInitializer_field2', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_implicitThisReferenceInInitializer_field2);
+ });
_ut.test('test_implicitThisReferenceInInitializer_invocation', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_implicitThisReferenceInInitializer_invocation);
@@ -6033,6 +6741,18 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_initializingFormalForNonExistantField_static);
});
+ _ut.test('test_instanceMemberAccessFromStatic_field', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_instanceMemberAccessFromStatic_field);
+ });
+ _ut.test('test_instanceMemberAccessFromStatic_getter', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_instanceMemberAccessFromStatic_getter);
+ });
+ _ut.test('test_instanceMemberAccessFromStatic_method', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_instanceMemberAccessFromStatic_method);
+ });
_ut.test('test_invalidConstructorName_notEnclosingClassName', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_invalidConstructorName_notEnclosingClassName);
@@ -6209,6 +6929,26 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_newWithInvalidTypeParameters);
});
+ _ut.test('test_newWithInvalidTypeParameters_tooFew', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_newWithInvalidTypeParameters_tooFew);
+ });
+ _ut.test('test_newWithInvalidTypeParameters_tooMany', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_newWithInvalidTypeParameters_tooMany);
+ });
+ _ut.test('test_noDefaultSuperConstructorExplicit', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_noDefaultSuperConstructorExplicit);
+ });
+ _ut.test('test_noDefaultSuperConstructorImplicit_superHasParameters', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_noDefaultSuperConstructorImplicit_superHasParameters);
+ });
+ _ut.test('test_noDefaultSuperConstructorImplicit_superOnlyNamed', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_noDefaultSuperConstructorImplicit_superOnlyNamed);
+ });
_ut.test('test_nonConstCaseExpression', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_nonConstCaseExpression);
@@ -6293,6 +7033,10 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_nonGenerativeConstructor_implicit);
});
+ _ut.test('test_nonGenerativeConstructor_implicit2', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_nonGenerativeConstructor_implicit2);
+ });
_ut.test('test_notEnoughRequiredArguments_const', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_notEnoughRequiredArguments_const);
@@ -6513,6 +7257,14 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_wrongNumberOfParametersForOperator_tilde);
});
+ _ut.test('test_wrongNumberOfParametersForSetter_function_named', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_wrongNumberOfParametersForSetter_function_named);
+ });
+ _ut.test('test_wrongNumberOfParametersForSetter_function_optional', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_wrongNumberOfParametersForSetter_function_optional);
+ });
_ut.test('test_wrongNumberOfParametersForSetter_function_tooFew', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_wrongNumberOfParametersForSetter_function_tooFew);
@@ -6521,6 +7273,14 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_wrongNumberOfParametersForSetter_function_tooMany);
});
+ _ut.test('test_wrongNumberOfParametersForSetter_method_named', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_wrongNumberOfParametersForSetter_method_named);
+ });
+ _ut.test('test_wrongNumberOfParametersForSetter_method_optional', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_wrongNumberOfParametersForSetter_method_optional);
+ });
_ut.test('test_wrongNumberOfParametersForSetter_method_tooFew', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_wrongNumberOfParametersForSetter_method_tooFew);
@@ -7203,6 +7963,7 @@ class ElementResolverTest extends EngineTestCase {
/**
* Create the resolver used by the tests.
+ *
* @return the resolver that was created
*/
ElementResolver createResolver() {
@@ -7228,6 +7989,7 @@ class ElementResolverTest extends EngineTestCase {
/**
* Return the element associated with the label of the given statement after the resolver has
* resolved the statement.
+ *
* @param statement the statement to be resolved
* @param labelElement the label element to be defined in the statement's label scope
* @return the element to which the statement's label was resolved
@@ -7240,6 +8002,7 @@ class ElementResolverTest extends EngineTestCase {
/**
* Return the element associated with the label of the given statement after the resolver has
* resolved the statement.
+ *
* @param statement the statement to be resolved
* @param labelElement the label element to be defined in the statement's label scope
* @return the element to which the statement's label was resolved
@@ -7252,9 +8015,10 @@ class ElementResolverTest extends EngineTestCase {
/**
* Return the element associated with the given identifier after the resolver has resolved the
* identifier.
+ *
* @param node the expression to be resolved
* @param definedElements the elements that are to be defined in the scope in which the element is
- * being resolved
+ * being resolved
* @return the element to which the expression was resolved
*/
Element resolve4(Identifier node, List<Element> definedElements) {
@@ -7265,9 +8029,10 @@ class ElementResolverTest extends EngineTestCase {
/**
* Return the element associated with the given expression after the resolver has resolved the
* expression.
+ *
* @param node the expression to be resolved
* @param definedElements the elements that are to be defined in the scope in which the element is
- * being resolved
+ * being resolved
* @return the element to which the expression was resolved
*/
Element resolve5(IndexExpression node, List<Element> definedElements) {
@@ -7278,6 +8043,7 @@ class ElementResolverTest extends EngineTestCase {
/**
* Return the element associated with the given identifier after the resolver has resolved the
* identifier.
+ *
* @param node the expression to be resolved
* @param enclosingClass the element representing the class enclosing the identifier
* @return the element to which the expression was resolved
@@ -7302,9 +8068,10 @@ class ElementResolverTest extends EngineTestCase {
/**
* Return the element associated with the given identifier after the resolver has resolved the
* identifier.
+ *
* @param node the expression to be resolved
* @param definedElements the elements that are to be defined in the scope in which the element is
- * being resolved
+ * being resolved
* @return the element to which the expression was resolved
*/
void resolveNode(ASTNode node, List<Element> definedElements) {
@@ -7328,6 +8095,7 @@ class ElementResolverTest extends EngineTestCase {
/**
* Return the element associated with the label of the given statement after the resolver has
* resolved the statement.
+ *
* @param statement the statement to be resolved
* @param labelElement the label element to be defined in the statement's label scope
* @return the element to which the statement's label was resolved
@@ -7814,6 +8582,18 @@ class StaticWarningCodeTest extends ResolverTestCase {
resolve(source);
assertErrors([StaticWarningCode.AMBIGUOUS_IMPORT]);
}
+ void test_argumentTypeNotAssignable_annotation_namedConstructor() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " A.fromInt(int p) {}", "}", "@A.fromInt('0')", "main() {", "}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
+ verify([source]);
+ }
+ void test_argumentTypeNotAssignable_annotation_unnamedConstructor() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " A(int p) {}", "}", "@A('0')", "main() {", "}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
+ verify([source]);
+ }
void test_argumentTypeNotAssignable_binary() {
Source source = addSource(EngineTestCase.createSource(["class A {", " operator +(int p) {}", "}", "f(A a) {", " a + '0';", "}"]));
resolve(source);
@@ -8173,13 +8953,13 @@ class StaticWarningCodeTest extends ResolverTestCase {
verify([source]);
}
void test_instanceMethodNameCollidesWithSuperclassStatic_setter() {
- Source source = addSource(EngineTestCase.createSource(["class A {", " int i = 0;", " static set n(int x) {i = x;}", "}", "class B extends A {", " void n() {}", "}"]));
+ Source source = addSource(EngineTestCase.createSource(["class A {", " static set n(int x) {}", "}", "class B extends A {", " void n() {}", "}"]));
resolve(source);
assertErrors([StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC]);
verify([source]);
}
void test_instanceMethodNameCollidesWithSuperclassStatic_setter2() {
- Source source = addSource(EngineTestCase.createSource(["class A {", " int i = 0;", " static set n(int x) {i = x;}", "}", "class B extends A {", "}", "class C extends B {", " void n() {}", "}"]));
+ Source source = addSource(EngineTestCase.createSource(["class A {", " static set n(int x) {}", "}", "class B extends A {", "}", "class C extends B {", " void n() {}", "}"]));
resolve(source);
assertErrors([StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC]);
verify([source]);
@@ -8286,6 +9066,14 @@ class StaticWarningCodeTest extends ResolverTestCase {
assertErrors([StaticWarningCode.NEW_WITH_NON_TYPE]);
verify([source]);
}
+ void test_newWithNonType_fromLibrary() {
+ Source source1 = addSource2("lib.dart", "");
+ Source source2 = addSource2("lib2.dart", EngineTestCase.createSource(["import 'lib.dart' as lib;", "void f() {", " var a = new lib.A();", "}"]));
+ resolve(source1);
+ resolve(source2);
+ assertErrors([StaticWarningCode.NEW_WITH_NON_TYPE]);
+ verify([source1]);
+ }
void test_newWithUndefinedConstructor() {
Source source = addSource(EngineTestCase.createSource(["class A {", " A() {}", "}", "f() {", " new A.name();", "}"]));
resolve(source);
@@ -8297,24 +9085,6 @@ class StaticWarningCodeTest extends ResolverTestCase {
assertErrors([StaticWarningCode.NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT]);
verify([source]);
}
- void test_noDefaultSuperConstructorExplicit() {
- Source source = addSource(EngineTestCase.createSource(["class A {", " A(p);", "}", "class B extends A {", " B() {}", "}"]));
- resolve(source);
- assertErrors([StaticWarningCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT]);
- verify([source]);
- }
- void test_noDefaultSuperConstructorImplicit_superHasParameters() {
- Source source = addSource(EngineTestCase.createSource(["class A {", " A(p);", "}", "class B extends A {", "}"]));
- resolve(source);
- assertErrors([StaticWarningCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
- verify([source]);
- }
- void test_noDefaultSuperConstructorImplicit_superOnlyNamed() {
- Source source = addSource(EngineTestCase.createSource(["class A { A.named() {} }", "class B extends A {}"]));
- resolve(source);
- assertErrors([StaticWarningCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
- verify([source]);
- }
void test_nonAbstractClassInheritsAbstractMemberFivePlus() {
Source source = addSource(EngineTestCase.createSource(["abstract class A {", " m();", " n();", " o();", " p();", " q();", "}", "class C extends A {", "}"]));
resolve(source);
@@ -8458,7 +9228,13 @@ class StaticWarningCodeTest extends ResolverTestCase {
resolve(source);
assertErrors([StaticWarningCode.REDIRECT_TO_MISSING_CONSTRUCTOR]);
}
- void test_redirectToNonClass() {
+ void test_redirectToNonClass_notAType() {
+ Source source = addSource(EngineTestCase.createSource(["class B {", " int A;", " B() = A;", "}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.REDIRECT_TO_NON_CLASS]);
+ verify([source]);
+ }
+ void test_redirectToNonClass_undefinedIdentifier() {
Source source = addSource(EngineTestCase.createSource(["class B {", " B() = A;", "}"]));
resolve(source);
assertErrors([StaticWarningCode.REDIRECT_TO_NON_CLASS]);
@@ -8527,6 +9303,14 @@ class StaticWarningCodeTest extends ResolverTestCase {
resolve(source);
assertErrors([StaticWarningCode.UNDEFINED_CLASS_BOOLEAN]);
}
+ void test_undefinedGetter_fromLibrary() {
+ Source source1 = addSource2("lib.dart", "");
+ Source source2 = addSource2("lib2.dart", EngineTestCase.createSource(["import 'lib.dart' as lib;", "void f() {", " var g = lib.gg;", "}"]));
+ resolve(source1);
+ resolve(source2);
+ assertErrors([StaticWarningCode.UNDEFINED_GETTER]);
+ verify([source1]);
+ }
void test_undefinedIdentifier_initializer() {
Source source = addSource(EngineTestCase.createSource(["var a = b;"]));
resolve(source);
@@ -8557,6 +9341,14 @@ class StaticWarningCodeTest extends ResolverTestCase {
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_ambiguousImport_typeArgument_annotation);
});
+ _ut.test('test_argumentTypeNotAssignable_annotation_namedConstructor', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_argumentTypeNotAssignable_annotation_namedConstructor);
+ });
+ _ut.test('test_argumentTypeNotAssignable_annotation_unnamedConstructor', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_argumentTypeNotAssignable_annotation_unnamedConstructor);
+ });
_ut.test('test_argumentTypeNotAssignable_binary', () {
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_argumentTypeNotAssignable_binary);
@@ -8869,6 +9661,10 @@ class StaticWarningCodeTest extends ResolverTestCase {
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_newWithNonType);
});
+ _ut.test('test_newWithNonType_fromLibrary', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_newWithNonType_fromLibrary);
+ });
_ut.test('test_newWithUndefinedConstructor', () {
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_newWithUndefinedConstructor);
@@ -8877,18 +9673,6 @@ class StaticWarningCodeTest extends ResolverTestCase {
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_newWithUndefinedConstructorDefault);
});
- _ut.test('test_noDefaultSuperConstructorExplicit', () {
- final __test = new StaticWarningCodeTest();
- runJUnitTest(__test, __test.test_noDefaultSuperConstructorExplicit);
- });
- _ut.test('test_noDefaultSuperConstructorImplicit_superHasParameters', () {
- final __test = new StaticWarningCodeTest();
- runJUnitTest(__test, __test.test_noDefaultSuperConstructorImplicit_superHasParameters);
- });
- _ut.test('test_noDefaultSuperConstructorImplicit_superOnlyNamed', () {
- final __test = new StaticWarningCodeTest();
- runJUnitTest(__test, __test.test_noDefaultSuperConstructorImplicit_superOnlyNamed);
- });
_ut.test('test_nonAbstractClassInheritsAbstractMemberFivePlus', () {
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberFivePlus);
@@ -8985,9 +9769,13 @@ class StaticWarningCodeTest extends ResolverTestCase {
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_redirectToMissingConstructor_unnamed);
});
- _ut.test('test_redirectToNonClass', () {
+ _ut.test('test_redirectToNonClass_notAType', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_redirectToNonClass_notAType);
+ });
+ _ut.test('test_redirectToNonClass_undefinedIdentifier', () {
final __test = new StaticWarningCodeTest();
- runJUnitTest(__test, __test.test_redirectToNonClass);
+ runJUnitTest(__test, __test.test_redirectToNonClass_undefinedIdentifier);
});
_ut.test('test_returnWithoutValue', () {
final __test = new StaticWarningCodeTest();
@@ -9033,6 +9821,10 @@ class StaticWarningCodeTest extends ResolverTestCase {
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_undefinedClass_variableDeclaration);
});
+ _ut.test('test_undefinedGetter_fromLibrary', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_undefinedGetter_fromLibrary);
+ });
_ut.test('test_undefinedIdentifier_initializer', () {
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_undefinedIdentifier_initializer);
@@ -9155,6 +9947,11 @@ class TestTypeProvider implements TypeProvider {
InterfaceType _stringType;
/**
+ * The type representing the built-in type 'Symbol'.
+ */
+ InterfaceType _symbolType;
+
+ /**
* The type representing the built-in type 'Type'.
*/
InterfaceType _typeType;
@@ -9270,6 +10067,12 @@ class TestTypeProvider implements TypeProvider {
}
return _stringType;
}
+ InterfaceType get symbolType {
+ if (_symbolType == null) {
+ _symbolType = ElementFactory.classElement2("Symbol", []).type;
+ }
+ return _symbolType;
+ }
InterfaceType get typeType {
if (_typeType == null) {
_typeType = ElementFactory.classElement2("Type", []).type;
@@ -9306,6 +10109,7 @@ class TestTypeProvider implements TypeProvider {
/**
* Given a class element representing a class with type parameters, propagate those type
* parameters to all of the accessors, methods and constructors defined for the class.
+ *
* @param classElement the element representing the class with type parameters
*/
void propagateTypeArguments(ClassElementImpl classElement) {
@@ -9332,6 +10136,7 @@ class AnalysisContextFactory {
/**
* Create an analysis context that has a fake core library already resolved.
+ *
* @return the analysis context that was created
*/
static AnalysisContextImpl contextWithCore() {
@@ -9535,9 +10340,10 @@ class ResolutionVerifier extends RecursiveASTVisitor<Object> {
* structures that are expected to have been resolved have an element associated with them. Nodes
* in the set of known exceptions are not expected to have been resolved, even if they normally
* would have been expected to have been resolved.
+ *
* @param knownExceptions a set containing nodes that are known to not be resolvable and should
- * therefore not cause the test to fail
- */
+ * therefore not cause the test to fail
+ **/
ResolutionVerifier.con1(Set<ASTNode> knownExceptions2) {
_jtd_constructor_362_impl(knownExceptions2);
}
@@ -10283,6 +11089,7 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
/**
* Return the type associated with the given expression after the static type analyzer has
* computed a type for it.
+ *
* @param node the expression with which the type is associated
* @return the type associated with the expression
*/
@@ -10291,6 +11098,7 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
/**
* Return the type associated with the given expression after the static type analyzer has
* computed a type for it.
+ *
* @param node the expression with which the type is associated
* @param thisType the type of 'this'
* @return the type associated with the expression
@@ -10308,6 +11116,7 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
/**
* Return the type associated with the given parameter after the static type analyzer has computed
* a type for it.
+ *
* @param node the parameter with which the type is associated
* @return the type associated with the parameter
*/
@@ -10318,6 +11127,7 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
/**
* Assert that the actual type is a function type with the expected characteristics.
+ *
* @param expectedReturnType the expected return type of the function
* @param expectedNormalTypes the expected types of the normal parameters
* @param expectedOptionalTypes the expected types of the optional parameters
@@ -10378,6 +11188,7 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
/**
* Create the analyzer used by the tests.
+ *
* @return the analyzer to be used by the tests
*/
StaticTypeAnalyzer createAnalyzer() {
@@ -10402,6 +11213,7 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
/**
* Return an integer literal that has been resolved to the correct type.
+ *
* @param value the value of the literal
* @return an integer literal that has been resolved to the correct type
*/
@@ -10413,8 +11225,10 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
/**
* Create a function expression that has an element associated with it, where the element has an
- * incomplete type associated with it (just like the one[ElementBuilder#visitFunctionExpression] would have built if we had
+ * incomplete type associated with it (just like the one
+ * [ElementBuilder#visitFunctionExpression] would have built if we had
* run it).
+ *
* @param parameters the parameters to the function
* @param body the body of the function
* @return a resolved function expression
@@ -10435,6 +11249,7 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
/**
* Return an integer literal that has been resolved to the correct type.
+ *
* @param value the value of the literal
* @return an integer literal that has been resolved to the correct type
*/
@@ -10446,6 +11261,7 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
/**
* Return a string literal that has been resolved to the correct type.
+ *
* @param value the value of the literal
* @return a string literal that has been resolved to the correct type
*/
@@ -10457,6 +11273,7 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
/**
* Return a simple identifier that has been resolved to a variable element with the given type.
+ *
* @param type the type of the variable being represented
* @param variableName the name of the variable
* @return a simple identifier that has been resolved to a variable element with the given type
@@ -10480,6 +11297,7 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
/**
* Set the type of the given parameter to the given type.
+ *
* @param parameter the parameter whose type is to be set
* @param type the new type of the given parameter
*/
@@ -10765,7 +11583,7 @@ class EnclosedScopeTest extends ResolverTestCase {
void test_define_duplicate() {
LibraryElement definingLibrary2 = createTestLibrary();
GatheringErrorListener errorListener2 = new GatheringErrorListener();
- Scope rootScope = new Scope_16(definingLibrary2, errorListener2);
+ Scope rootScope = new Scope_17(definingLibrary2, errorListener2);
EnclosedScope scope = new EnclosedScope(rootScope);
VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.identifier3("v1"));
VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.identifier3("v1"));
@@ -10776,7 +11594,7 @@ class EnclosedScopeTest extends ResolverTestCase {
void test_define_normal() {
LibraryElement definingLibrary3 = createTestLibrary();
GatheringErrorListener errorListener3 = new GatheringErrorListener();
- Scope rootScope = new Scope_17(definingLibrary3, errorListener3);
+ Scope rootScope = new Scope_18(definingLibrary3, errorListener3);
EnclosedScope outerScope = new EnclosedScope(rootScope);
EnclosedScope innerScope = new EnclosedScope(outerScope);
VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.identifier3("v1"));
@@ -10798,18 +11616,18 @@ class EnclosedScopeTest extends ResolverTestCase {
});
}
}
-class Scope_16 extends Scope {
+class Scope_17 extends Scope {
LibraryElement definingLibrary2;
GatheringErrorListener errorListener2;
- Scope_16(this.definingLibrary2, this.errorListener2) : super();
+ Scope_17(this.definingLibrary2, this.errorListener2) : super();
LibraryElement get definingLibrary => definingLibrary2;
AnalysisErrorListener get errorListener => errorListener2;
Element lookup3(Identifier identifier, String name, LibraryElement referencingLibrary) => null;
}
-class Scope_17 extends Scope {
+class Scope_18 extends Scope {
LibraryElement definingLibrary3;
GatheringErrorListener errorListener3;
- Scope_17(this.definingLibrary3, this.errorListener3) : super();
+ Scope_18(this.definingLibrary3, this.errorListener3) : super();
LibraryElement get definingLibrary => definingLibrary3;
AnalysisErrorListener get errorListener => errorListener3;
Element lookup3(Identifier identifier, String name, LibraryElement referencingLibrary) => null;
@@ -10817,7 +11635,7 @@ class Scope_17 extends Scope {
class LibraryElementBuilderTest extends EngineTestCase {
/**
- * The source factory used to create [Source sources].
+ * The source factory used to create [Source].
*/
SourceFactory _sourceFactory;
void setUp() {
@@ -10901,6 +11719,7 @@ class LibraryElementBuilderTest extends EngineTestCase {
/**
* Add a source file to the content provider. The file path should be absolute.
+ *
* @param filePath the path of the file being added
* @param contents the contents to be returned by the content provider for the specified file
* @return the source object representing the added file
@@ -10913,6 +11732,7 @@ class LibraryElementBuilderTest extends EngineTestCase {
/**
* Ensure that there are elements representing all of the types in the given array of type names.
+ *
* @param unit the compilation unit containing the types
* @param typeNames the names of the types that should be found
*/
@@ -10937,9 +11757,10 @@ class LibraryElementBuilderTest extends EngineTestCase {
/**
* Build the element model for the library whose defining compilation unit has the given source.
+ *
* @param librarySource the source of the defining compilation unit for the library
* @param expectedErrorCodes the errors that are expected to be found while building the element
- * model
+ * model
* @return the element model that was built for the library
* @throws Exception if the element model could not be built
*/
@@ -11407,10 +12228,11 @@ class SimpleResolverTest extends ResolverTestCase {
* which the argument expression was resolved is the parameter in the invoked method's list of
* parameters at that index. Arguments that should not be resolved to a parameter because of an
* error can be denoted by including a negative index in the array of indices.
+ *
* @param source the source to be resolved
* @param indices the array of indices used to associate arguments with parameters
* @throws Exception if the source could not be resolved or if the structure of the source is not
- * valid
+ * valid
*/
void validateArgumentResolution(Source source, List<int> indices) {
LibraryElement library = resolve(source);
« no previous file with comments | « pkg/analyzer_experimental/test/generated/parser_test.dart ('k') | pkg/analyzer_experimental/test/generated/scanner_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698