| 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 99404c35bc6f276c38fa810795a39d08ad4955f2..35215c9aa9d7ceecbcc5917f461bdd6d9d986de2 100644
|
| --- a/pkg/analyzer_experimental/test/generated/resolver_test.dart
|
| +++ b/pkg/analyzer_experimental/test/generated/resolver_test.dart
|
| @@ -1155,6 +1155,21 @@ class NonErrorResolverTest extends ResolverTestCase {
|
| assertNoErrors();
|
| verify([source]);
|
| }
|
| + void test_constConstructorWithNonConstSuper_redirectingFactory() {
|
| + Source source = addSource(EngineTestCase.createSource([
|
| + "class A {",
|
| + " A();",
|
| + "}",
|
| + "class B implements C {",
|
| + " const B();",
|
| + "}",
|
| + "class C extends A {",
|
| + " const factory C() = B;",
|
| + "}"]));
|
| + resolve(source);
|
| + assertNoErrors();
|
| + verify([source]);
|
| + }
|
| void test_constConstructorWithNonFinalField_finalInstanceVar() {
|
| Source source = addSource(EngineTestCase.createSource(["class A {", " final int x = 0;", " const A();", "}"]));
|
| resolve(source);
|
| @@ -1316,6 +1331,18 @@ class NonErrorResolverTest extends ResolverTestCase {
|
| assertErrors([]);
|
| verify([source]);
|
| }
|
| + void test_defaultValueInFunctionTypedParameter_named() {
|
| + Source source = addSource(EngineTestCase.createSource(["f(g({p})) {}"]));
|
| + resolve(source);
|
| + assertNoErrors();
|
| + verify([source]);
|
| + }
|
| + void test_defaultValueInFunctionTypedParameter_optional() {
|
| + Source source = addSource(EngineTestCase.createSource(["f(g([p])) {}"]));
|
| + resolve(source);
|
| + assertNoErrors();
|
| + verify([source]);
|
| + }
|
| void test_duplicateDefinition_emptyName() {
|
| Source source = addSource(EngineTestCase.createSource([
|
| "Map _globalMap = {",
|
| @@ -1332,6 +1359,12 @@ class NonErrorResolverTest extends ResolverTestCase {
|
| assertNoErrors();
|
| verify([source]);
|
| }
|
| + void test_dynamicIdentifier() {
|
| + Source source = addSource(EngineTestCase.createSource(["main() {", " var v = dynamic;", "}"]));
|
| + resolve(source);
|
| + assertNoErrors();
|
| + verify([source]);
|
| + }
|
| void test_exportOfNonLibrary_libraryDeclared() {
|
| Source source = addSource(EngineTestCase.createSource(["library L;", "export 'lib1.dart';"]));
|
| addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;"]));
|
| @@ -1666,12 +1699,122 @@ class NonErrorResolverTest extends ResolverTestCase {
|
| assertNoErrors();
|
| verify([source]);
|
| }
|
| + void test_inconsistentMethodInheritance_accessors_typeVariables_diamond() {
|
| + Source source = addSource(EngineTestCase.createSource([
|
| + "abstract class F<E> extends B<E> {}",
|
| + "class D<E> extends F<E> {",
|
| + " external E get g;",
|
| + "}",
|
| + "abstract class C<E> {",
|
| + " E get g;",
|
| + "}",
|
| + "abstract class B<E> implements C<E> {",
|
| + " E get g { return null; }",
|
| + "}",
|
| + "class A<E> extends B<E> implements D<E> {",
|
| + "}"]));
|
| + resolve(source);
|
| + assertNoErrors();
|
| + verify([source]);
|
| + }
|
| + void test_inconsistentMethodInheritance_accessors_typeVariables1() {
|
| + Source source = addSource(EngineTestCase.createSource([
|
| + "abstract class A<E> {",
|
| + " E get x;",
|
| + "}",
|
| + "abstract class B<E> {",
|
| + " E get x;",
|
| + "}",
|
| + "class C<E> implements A<E>, B<E> {",
|
| + " E get x => 1;",
|
| + "}"]));
|
| + resolve(source);
|
| + assertNoErrors();
|
| + verify([source]);
|
| + }
|
| + void test_inconsistentMethodInheritance_accessors_typeVariables2() {
|
| + Source source = addSource(EngineTestCase.createSource([
|
| + "abstract class A<E> {",
|
| + " E get x {return 1;}",
|
| + "}",
|
| + "class B<E> {",
|
| + " E get x {return 1;}",
|
| + "}",
|
| + "class C<E> extends A<E> implements B<E> {",
|
| + "}"]));
|
| + resolve(source);
|
| + assertNoErrors();
|
| + verify([source]);
|
| + }
|
| + void test_inconsistentMethodInheritance_methods_typeVariables1() {
|
| + Source source = addSource(EngineTestCase.createSource([
|
| + "class A<E> {",
|
| + " x(E e) {}",
|
| + "}",
|
| + "class B<E> {",
|
| + " x(E e) {}",
|
| + "}",
|
| + "class C<E> implements A<E>, B<E> {",
|
| + " x(E e) {}",
|
| + "}"]));
|
| + resolve(source);
|
| + assertNoErrors();
|
| + verify([source]);
|
| + }
|
| + void test_inconsistentMethodInheritance_methods_typeVariables2() {
|
| + Source source = addSource(EngineTestCase.createSource([
|
| + "class A<E> {",
|
| + " x(E e) {}",
|
| + "}",
|
| + "class B<E> {",
|
| + " x(E e) {}",
|
| + "}",
|
| + "class C<E> extends A<E> implements B<E> {",
|
| + " x(E e) {}",
|
| + "}"]));
|
| + resolve(source);
|
| + assertNoErrors();
|
| + verify([source]);
|
| + }
|
| + void test_inconsistentMethodInheritance_simple() {
|
| + Source source = addSource(EngineTestCase.createSource([
|
| + "abstract class A {",
|
| + " x();",
|
| + "}",
|
| + "abstract class B {",
|
| + " x();",
|
| + "}",
|
| + "class C implements A, B {",
|
| + " x() {}",
|
| + "}"]));
|
| + resolve(source);
|
| + assertNoErrors();
|
| + verify([source]);
|
| + }
|
| void test_initializingFormalForNonExistantField() {
|
| Source source = addSource(EngineTestCase.createSource(["class A {", " int x;", " A(this.x) {}", "}"]));
|
| resolve(source);
|
| assertNoErrors();
|
| verify([source]);
|
| }
|
| + void test_instanceAccessToStaticMember_fromComment() {
|
| + Source source = addSource(EngineTestCase.createSource([
|
| + "class A {",
|
| + " static m() {}",
|
| + "}",
|
| + "/// [A.m]",
|
| + "main() {",
|
| + "}"]));
|
| + resolve(source);
|
| + assertNoErrors();
|
| + verify([source]);
|
| + }
|
| + void test_instanceAccessToStaticMember_topLevel() {
|
| + Source source = addSource(EngineTestCase.createSource(["m() {}", "main() {", " m();", "}"]));
|
| + resolve(source);
|
| + assertNoErrors();
|
| + verify([source]);
|
| + }
|
| void test_instanceMemberAccessFromStatic_fromComment() {
|
| Source source = addSource(EngineTestCase.createSource([
|
| "class A {",
|
| @@ -1734,6 +1877,18 @@ class NonErrorResolverTest extends ResolverTestCase {
|
| assertNoErrors();
|
| verify([source]);
|
| }
|
| + void test_invalidAssignment_defaultValue_named() {
|
| + Source source = addSource(EngineTestCase.createSource(["f({String x: '0'}) {", "}"]));
|
| + resolve(source);
|
| + assertNoErrors();
|
| + verify([source]);
|
| + }
|
| + void test_invalidAssignment_defaultValue_optional() {
|
| + Source source = addSource(EngineTestCase.createSource(["f([String x = '0']) {", "}"]));
|
| + resolve(source);
|
| + assertNoErrors();
|
| + verify([source]);
|
| + }
|
| void test_invalidAssignment_toDynamic() {
|
| Source source = addSource(EngineTestCase.createSource(["f() {", " var g;", " g = () => 0;", "}"]));
|
| resolve(source);
|
| @@ -3108,6 +3263,10 @@ class NonErrorResolverTest extends ResolverTestCase {
|
| final __test = new NonErrorResolverTest();
|
| runJUnitTest(__test, __test.test_conflictingStaticSetterAndInstanceMember_thisClass_method);
|
| });
|
| + _ut.test('test_constConstructorWithNonConstSuper_redirectingFactory', () {
|
| + final __test = new NonErrorResolverTest();
|
| + runJUnitTest(__test, __test.test_constConstructorWithNonConstSuper_redirectingFactory);
|
| + });
|
| _ut.test('test_constConstructorWithNonFinalField_finalInstanceVar', () {
|
| final __test = new NonErrorResolverTest();
|
| runJUnitTest(__test, __test.test_constConstructorWithNonFinalField_finalInstanceVar);
|
| @@ -3160,6 +3319,14 @@ class NonErrorResolverTest extends ResolverTestCase {
|
| final __test = new NonErrorResolverTest();
|
| runJUnitTest(__test, __test.test_defaultValueInFunctionTypeAlias);
|
| });
|
| + _ut.test('test_defaultValueInFunctionTypedParameter_named', () {
|
| + final __test = new NonErrorResolverTest();
|
| + runJUnitTest(__test, __test.test_defaultValueInFunctionTypedParameter_named);
|
| + });
|
| + _ut.test('test_defaultValueInFunctionTypedParameter_optional', () {
|
| + final __test = new NonErrorResolverTest();
|
| + runJUnitTest(__test, __test.test_defaultValueInFunctionTypedParameter_optional);
|
| + });
|
| _ut.test('test_duplicateDefinition_emptyName', () {
|
| final __test = new NonErrorResolverTest();
|
| runJUnitTest(__test, __test.test_duplicateDefinition_emptyName);
|
| @@ -3168,6 +3335,10 @@ class NonErrorResolverTest extends ResolverTestCase {
|
| final __test = new NonErrorResolverTest();
|
| runJUnitTest(__test, __test.test_duplicateDefinition_getter);
|
| });
|
| + _ut.test('test_dynamicIdentifier', () {
|
| + final __test = new NonErrorResolverTest();
|
| + runJUnitTest(__test, __test.test_dynamicIdentifier);
|
| + });
|
| _ut.test('test_exportOfNonLibrary_libraryDeclared', () {
|
| final __test = new NonErrorResolverTest();
|
| runJUnitTest(__test, __test.test_exportOfNonLibrary_libraryDeclared);
|
| @@ -3316,10 +3487,42 @@ class NonErrorResolverTest extends ResolverTestCase {
|
| final __test = new NonErrorResolverTest();
|
| runJUnitTest(__test, __test.test_inconsistentCaseExpressionTypes);
|
| });
|
| + _ut.test('test_inconsistentMethodInheritance_accessors_typeVariables1', () {
|
| + final __test = new NonErrorResolverTest();
|
| + runJUnitTest(__test, __test.test_inconsistentMethodInheritance_accessors_typeVariables1);
|
| + });
|
| + _ut.test('test_inconsistentMethodInheritance_accessors_typeVariables2', () {
|
| + final __test = new NonErrorResolverTest();
|
| + runJUnitTest(__test, __test.test_inconsistentMethodInheritance_accessors_typeVariables2);
|
| + });
|
| + _ut.test('test_inconsistentMethodInheritance_accessors_typeVariables_diamond', () {
|
| + final __test = new NonErrorResolverTest();
|
| + runJUnitTest(__test, __test.test_inconsistentMethodInheritance_accessors_typeVariables_diamond);
|
| + });
|
| + _ut.test('test_inconsistentMethodInheritance_methods_typeVariables1', () {
|
| + final __test = new NonErrorResolverTest();
|
| + runJUnitTest(__test, __test.test_inconsistentMethodInheritance_methods_typeVariables1);
|
| + });
|
| + _ut.test('test_inconsistentMethodInheritance_methods_typeVariables2', () {
|
| + final __test = new NonErrorResolverTest();
|
| + runJUnitTest(__test, __test.test_inconsistentMethodInheritance_methods_typeVariables2);
|
| + });
|
| + _ut.test('test_inconsistentMethodInheritance_simple', () {
|
| + final __test = new NonErrorResolverTest();
|
| + runJUnitTest(__test, __test.test_inconsistentMethodInheritance_simple);
|
| + });
|
| _ut.test('test_initializingFormalForNonExistantField', () {
|
| final __test = new NonErrorResolverTest();
|
| runJUnitTest(__test, __test.test_initializingFormalForNonExistantField);
|
| });
|
| + _ut.test('test_instanceAccessToStaticMember_fromComment', () {
|
| + final __test = new NonErrorResolverTest();
|
| + runJUnitTest(__test, __test.test_instanceAccessToStaticMember_fromComment);
|
| + });
|
| + _ut.test('test_instanceAccessToStaticMember_topLevel', () {
|
| + final __test = new NonErrorResolverTest();
|
| + runJUnitTest(__test, __test.test_instanceAccessToStaticMember_topLevel);
|
| + });
|
| _ut.test('test_instanceMemberAccessFromStatic_fromComment', () {
|
| final __test = new NonErrorResolverTest();
|
| runJUnitTest(__test, __test.test_instanceMemberAccessFromStatic_fromComment);
|
| @@ -3344,6 +3547,14 @@ class NonErrorResolverTest extends ResolverTestCase {
|
| final __test = new NonErrorResolverTest();
|
| runJUnitTest(__test, __test.test_invalidAssignment_compoundAssignment);
|
| });
|
| + _ut.test('test_invalidAssignment_defaultValue_named', () {
|
| + final __test = new NonErrorResolverTest();
|
| + runJUnitTest(__test, __test.test_invalidAssignment_defaultValue_named);
|
| + });
|
| + _ut.test('test_invalidAssignment_defaultValue_optional', () {
|
| + final __test = new NonErrorResolverTest();
|
| + runJUnitTest(__test, __test.test_invalidAssignment_defaultValue_optional);
|
| + });
|
| _ut.test('test_invalidAssignment_toDynamic', () {
|
| final __test = new NonErrorResolverTest();
|
| runJUnitTest(__test, __test.test_invalidAssignment_toDynamic);
|
| @@ -4039,6 +4250,66 @@ class StaticTypeWarningCodeTest extends ResolverTestCase {
|
| assertErrors([StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE]);
|
| verify([source]);
|
| }
|
| + void test_instanceAccessToStaticMember_method_invocation() {
|
| + Source source = addSource(EngineTestCase.createSource([
|
| + "class A {",
|
| + " static m() {}",
|
| + "}",
|
| + "main(A a) {",
|
| + " a.m();",
|
| + "}"]));
|
| + resolve(source);
|
| + assertErrors([StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER]);
|
| + verify([source]);
|
| + }
|
| + void test_instanceAccessToStaticMember_method_reference() {
|
| + Source source = addSource(EngineTestCase.createSource([
|
| + "class A {",
|
| + " static m() {}",
|
| + "}",
|
| + "main(A a) {",
|
| + " a.m;",
|
| + "}"]));
|
| + resolve(source);
|
| + assertErrors([StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER]);
|
| + verify([source]);
|
| + }
|
| + void test_instanceAccessToStaticMember_propertyAccess_field() {
|
| + Source source = addSource(EngineTestCase.createSource([
|
| + "class A {",
|
| + " static var f;",
|
| + "}",
|
| + "main(A a) {",
|
| + " a.f;",
|
| + "}"]));
|
| + resolve(source);
|
| + assertErrors([StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER]);
|
| + verify([source]);
|
| + }
|
| + void test_instanceAccessToStaticMember_propertyAccess_getter() {
|
| + Source source = addSource(EngineTestCase.createSource([
|
| + "class A {",
|
| + " static get f => 42;",
|
| + "}",
|
| + "main(A a) {",
|
| + " a.f;",
|
| + "}"]));
|
| + resolve(source);
|
| + assertErrors([StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER]);
|
| + verify([source]);
|
| + }
|
| + void test_instanceAccessToStaticMember_propertyAccess_setter() {
|
| + Source source = addSource(EngineTestCase.createSource([
|
| + "class A {",
|
| + " static set f(x) {}",
|
| + "}",
|
| + "main(A a) {",
|
| + " a.f = 42;",
|
| + "}"]));
|
| + resolve(source);
|
| + assertErrors([StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER]);
|
| + verify([source]);
|
| + }
|
| void test_invalidAssignment_compoundAssignment() {
|
| Source source = addSource(EngineTestCase.createSource([
|
| "class byte {",
|
| @@ -4055,6 +4326,18 @@ class StaticTypeWarningCodeTest extends ResolverTestCase {
|
| assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]);
|
| verify([source]);
|
| }
|
| + void test_invalidAssignment_defaultValue_named() {
|
| + Source source = addSource(EngineTestCase.createSource(["f({String x: 0}) {", "}"]));
|
| + resolve(source);
|
| + assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]);
|
| + verify([source]);
|
| + }
|
| + void test_invalidAssignment_defaultValue_optional() {
|
| + Source source = addSource(EngineTestCase.createSource(["f([String x = 0]) {", "}"]));
|
| + resolve(source);
|
| + assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]);
|
| + verify([source]);
|
| + }
|
| void test_invalidAssignment_instanceVariable() {
|
| Source source = addSource(EngineTestCase.createSource([
|
| "class A {",
|
| @@ -4450,11 +4733,6 @@ class StaticTypeWarningCodeTest extends ResolverTestCase {
|
| assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
|
| verify([source]);
|
| }
|
| - void test_undefinedFunction() {
|
| - Source source = addSource(EngineTestCase.createSource(["void f() {", " g();", "}"]));
|
| - resolve(source);
|
| - assertErrors([StaticTypeWarningCode.UNDEFINED_FUNCTION]);
|
| - }
|
| void test_undefinedGetter() {
|
| Source source = addSource(EngineTestCase.createSource(["class T {}", "f(T e) { return e.m; }"]));
|
| resolve(source);
|
| @@ -4572,10 +4850,38 @@ class StaticTypeWarningCodeTest extends ResolverTestCase {
|
| final __test = new StaticTypeWarningCodeTest();
|
| runJUnitTest(__test, __test.test_inconsistentMethodInheritance_returnType);
|
| });
|
| + _ut.test('test_instanceAccessToStaticMember_method_invocation', () {
|
| + final __test = new StaticTypeWarningCodeTest();
|
| + runJUnitTest(__test, __test.test_instanceAccessToStaticMember_method_invocation);
|
| + });
|
| + _ut.test('test_instanceAccessToStaticMember_method_reference', () {
|
| + final __test = new StaticTypeWarningCodeTest();
|
| + runJUnitTest(__test, __test.test_instanceAccessToStaticMember_method_reference);
|
| + });
|
| + _ut.test('test_instanceAccessToStaticMember_propertyAccess_field', () {
|
| + final __test = new StaticTypeWarningCodeTest();
|
| + runJUnitTest(__test, __test.test_instanceAccessToStaticMember_propertyAccess_field);
|
| + });
|
| + _ut.test('test_instanceAccessToStaticMember_propertyAccess_getter', () {
|
| + final __test = new StaticTypeWarningCodeTest();
|
| + runJUnitTest(__test, __test.test_instanceAccessToStaticMember_propertyAccess_getter);
|
| + });
|
| + _ut.test('test_instanceAccessToStaticMember_propertyAccess_setter', () {
|
| + final __test = new StaticTypeWarningCodeTest();
|
| + runJUnitTest(__test, __test.test_instanceAccessToStaticMember_propertyAccess_setter);
|
| + });
|
| _ut.test('test_invalidAssignment_compoundAssignment', () {
|
| final __test = new StaticTypeWarningCodeTest();
|
| runJUnitTest(__test, __test.test_invalidAssignment_compoundAssignment);
|
| });
|
| + _ut.test('test_invalidAssignment_defaultValue_named', () {
|
| + final __test = new StaticTypeWarningCodeTest();
|
| + runJUnitTest(__test, __test.test_invalidAssignment_defaultValue_named);
|
| + });
|
| + _ut.test('test_invalidAssignment_defaultValue_optional', () {
|
| + final __test = new StaticTypeWarningCodeTest();
|
| + runJUnitTest(__test, __test.test_invalidAssignment_defaultValue_optional);
|
| + });
|
| _ut.test('test_invalidAssignment_instanceVariable', () {
|
| final __test = new StaticTypeWarningCodeTest();
|
| runJUnitTest(__test, __test.test_invalidAssignment_instanceVariable);
|
| @@ -4756,10 +5062,6 @@ class StaticTypeWarningCodeTest extends ResolverTestCase {
|
| final __test = new StaticTypeWarningCodeTest();
|
| runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_with);
|
| });
|
| - _ut.test('test_undefinedFunction', () {
|
| - final __test = new StaticTypeWarningCodeTest();
|
| - runJUnitTest(__test, __test.test_undefinedFunction);
|
| - });
|
| _ut.test('test_undefinedGetter', () {
|
| final __test = new StaticTypeWarningCodeTest();
|
| runJUnitTest(__test, __test.test_undefinedGetter);
|
| @@ -5831,10 +6133,12 @@ class InheritanceManagerTest extends EngineTestCase {
|
| String getterName = "g";
|
| PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, false, _typeProvider.intType);
|
| classA.accessors = <PropertyAccessorElement> [getterG];
|
| - ClassElementImpl classB = ElementFactory.classElement2("B", []);
|
| - classB.supertype = classA.type;
|
| - Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromClasses(classB);
|
| - JUnitTestCase.assertSame(getterG, map[getterName]);
|
| + ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
|
| + Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInheritedFromClasses(classB);
|
| + Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInheritedFromClasses(classA);
|
| + EngineTestCase.assertSize2(5, mapA);
|
| + EngineTestCase.assertSize2(6, mapB);
|
| + JUnitTestCase.assertSame(getterG, mapB[getterName]);
|
| assertNoErrors(classA);
|
| assertNoErrors(classB);
|
| }
|
| @@ -5845,8 +6149,11 @@ class InheritanceManagerTest extends EngineTestCase {
|
| classA.accessors = <PropertyAccessorElement> [getterG];
|
| ClassElementImpl classB = ElementFactory.classElement2("B", []);
|
| classB.interfaces = <InterfaceType> [classA.type];
|
| - Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromClasses(classB);
|
| - JUnitTestCase.assertNull(map[getterName]);
|
| + Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInheritedFromClasses(classB);
|
| + Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInheritedFromClasses(classA);
|
| + EngineTestCase.assertSize2(5, mapA);
|
| + EngineTestCase.assertSize2(5, mapB);
|
| + JUnitTestCase.assertNull(mapB[getterName]);
|
| assertNoErrors(classA);
|
| assertNoErrors(classB);
|
| }
|
| @@ -5857,8 +6164,11 @@ class InheritanceManagerTest extends EngineTestCase {
|
| classA.accessors = <PropertyAccessorElement> [getterG];
|
| ClassElementImpl classB = ElementFactory.classElement2("B", []);
|
| classB.mixins = <InterfaceType> [classA.type];
|
| - Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromClasses(classB);
|
| - JUnitTestCase.assertSame(getterG, map[getterName]);
|
| + Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInheritedFromClasses(classB);
|
| + Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInheritedFromClasses(classA);
|
| + EngineTestCase.assertSize2(5, mapA);
|
| + EngineTestCase.assertSize2(6, mapB);
|
| + JUnitTestCase.assertSame(getterG, mapB[getterName]);
|
| assertNoErrors(classA);
|
| assertNoErrors(classB);
|
| }
|
| @@ -5869,8 +6179,11 @@ class InheritanceManagerTest extends EngineTestCase {
|
| classA.methods = <MethodElement> [methodM];
|
| ClassElementImpl classB = ElementFactory.classElement2("B", []);
|
| classB.supertype = classA.type;
|
| - Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromClasses(classB);
|
| - JUnitTestCase.assertSame(methodM, map[methodName]);
|
| + Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInheritedFromClasses(classB);
|
| + Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInheritedFromClasses(classA);
|
| + EngineTestCase.assertSize2(5, mapA);
|
| + EngineTestCase.assertSize2(6, mapB);
|
| + JUnitTestCase.assertSame(methodM, mapB[methodName]);
|
| assertNoErrors(classA);
|
| assertNoErrors(classB);
|
| }
|
| @@ -5881,8 +6194,11 @@ class InheritanceManagerTest extends EngineTestCase {
|
| classA.methods = <MethodElement> [methodM];
|
| ClassElementImpl classB = ElementFactory.classElement2("B", []);
|
| classB.interfaces = <InterfaceType> [classA.type];
|
| - Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromClasses(classB);
|
| - JUnitTestCase.assertNull(map[methodName]);
|
| + Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInheritedFromClasses(classB);
|
| + Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInheritedFromClasses(classA);
|
| + EngineTestCase.assertSize2(5, mapA);
|
| + EngineTestCase.assertSize2(5, mapB);
|
| + JUnitTestCase.assertNull(mapB[methodName]);
|
| assertNoErrors(classA);
|
| assertNoErrors(classB);
|
| }
|
| @@ -5893,8 +6209,11 @@ class InheritanceManagerTest extends EngineTestCase {
|
| classA.methods = <MethodElement> [methodM];
|
| ClassElementImpl classB = ElementFactory.classElement2("B", []);
|
| classB.mixins = <InterfaceType> [classA.type];
|
| - Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromClasses(classB);
|
| - JUnitTestCase.assertSame(methodM, map[methodName]);
|
| + Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInheritedFromClasses(classB);
|
| + Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInheritedFromClasses(classA);
|
| + EngineTestCase.assertSize2(5, mapA);
|
| + EngineTestCase.assertSize2(6, mapB);
|
| + JUnitTestCase.assertSame(methodM, mapB[methodName]);
|
| assertNoErrors(classA);
|
| assertNoErrors(classB);
|
| }
|
| @@ -5903,10 +6222,12 @@ class InheritanceManagerTest extends EngineTestCase {
|
| String getterName = "g";
|
| PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, false, _typeProvider.intType);
|
| classA.accessors = <PropertyAccessorElement> [getterG];
|
| - ClassElementImpl classB = ElementFactory.classElement2("B", []);
|
| - classB.supertype = classA.type;
|
| - Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classB);
|
| - JUnitTestCase.assertSame(getterG, map[getterName]);
|
| + ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
|
| + Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classB);
|
| + Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA);
|
| + EngineTestCase.assertSize2(5, mapA);
|
| + EngineTestCase.assertSize2(6, mapB);
|
| + JUnitTestCase.assertSame(getterG, mapB[getterName]);
|
| assertNoErrors(classA);
|
| assertNoErrors(classB);
|
| }
|
| @@ -5917,8 +6238,11 @@ class InheritanceManagerTest extends EngineTestCase {
|
| classA.accessors = <PropertyAccessorElement> [getterG];
|
| ClassElementImpl classB = ElementFactory.classElement2("B", []);
|
| classB.interfaces = <InterfaceType> [classA.type];
|
| - Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classB);
|
| - JUnitTestCase.assertSame(getterG, map[getterName]);
|
| + Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classB);
|
| + Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA);
|
| + EngineTestCase.assertSize2(5, mapA);
|
| + EngineTestCase.assertSize2(6, mapB);
|
| + JUnitTestCase.assertSame(getterG, mapB[getterName]);
|
| assertNoErrors(classA);
|
| assertNoErrors(classB);
|
| }
|
| @@ -5929,8 +6253,11 @@ class InheritanceManagerTest extends EngineTestCase {
|
| classA.accessors = <PropertyAccessorElement> [getterG];
|
| ClassElementImpl classB = ElementFactory.classElement2("B", []);
|
| classB.mixins = <InterfaceType> [classA.type];
|
| - Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classB);
|
| - JUnitTestCase.assertSame(getterG, map[getterName]);
|
| + Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classB);
|
| + Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA);
|
| + EngineTestCase.assertSize2(5, mapA);
|
| + EngineTestCase.assertSize2(6, mapB);
|
| + JUnitTestCase.assertSame(getterG, mapB[getterName]);
|
| assertNoErrors(classA);
|
| assertNoErrors(classB);
|
| }
|
| @@ -5939,10 +6266,12 @@ class InheritanceManagerTest extends EngineTestCase {
|
| String methodName = "m";
|
| MethodElement methodM = ElementFactory.methodElement(methodName, _typeProvider.intType, []);
|
| classA.methods = <MethodElement> [methodM];
|
| - ClassElementImpl classB = ElementFactory.classElement2("B", []);
|
| - classB.supertype = classA.type;
|
| - Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classB);
|
| - JUnitTestCase.assertSame(methodM, map[methodName]);
|
| + ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
|
| + Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classB);
|
| + Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA);
|
| + EngineTestCase.assertSize2(5, mapA);
|
| + EngineTestCase.assertSize2(6, mapB);
|
| + JUnitTestCase.assertSame(methodM, mapB[methodName]);
|
| assertNoErrors(classA);
|
| assertNoErrors(classB);
|
| }
|
| @@ -5953,8 +6282,11 @@ class InheritanceManagerTest extends EngineTestCase {
|
| classA.methods = <MethodElement> [methodM];
|
| ClassElementImpl classB = ElementFactory.classElement2("B", []);
|
| classB.interfaces = <InterfaceType> [classA.type];
|
| - Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classB);
|
| - JUnitTestCase.assertSame(methodM, map[methodName]);
|
| + Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classB);
|
| + Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA);
|
| + EngineTestCase.assertSize2(5, mapA);
|
| + EngineTestCase.assertSize2(6, mapB);
|
| + JUnitTestCase.assertSame(methodM, mapB[methodName]);
|
| assertNoErrors(classA);
|
| assertNoErrors(classB);
|
| }
|
| @@ -5965,8 +6297,11 @@ class InheritanceManagerTest extends EngineTestCase {
|
| classA.methods = <MethodElement> [methodM];
|
| ClassElementImpl classB = ElementFactory.classElement2("B", []);
|
| classB.mixins = <InterfaceType> [classA.type];
|
| - Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classB);
|
| - JUnitTestCase.assertSame(methodM, map[methodName]);
|
| + Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classB);
|
| + Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA);
|
| + EngineTestCase.assertSize2(5, mapA);
|
| + EngineTestCase.assertSize2(6, mapB);
|
| + JUnitTestCase.assertSame(methodM, mapB[methodName]);
|
| assertNoErrors(classA);
|
| assertNoErrors(classB);
|
| }
|
| @@ -6532,6 +6867,18 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
|
| assertErrors([CompileTimeErrorCode.AMBIGUOUS_EXPORT]);
|
| verify([source]);
|
| }
|
| + void test_ambiguousImport_function() {
|
| + Source source = addSource(EngineTestCase.createSource([
|
| + "import 'lib1.dart';",
|
| + "import 'lib2.dart';",
|
| + "g() { return f(); }"]));
|
| + addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "f() {}"]));
|
| + addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "f() {}"]));
|
| + resolve(source);
|
| + assertErrors([
|
| + StaticWarningCode.AMBIGUOUS_IMPORT,
|
| + StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]);
|
| + }
|
| void test_argumentDefinitionTestNonParameter() {
|
| Source source = addSource(EngineTestCase.createSource(["f() {", " var v = 0;", " return ?v;", "}"]));
|
| resolve(source);
|
| @@ -6676,6 +7023,30 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
|
| assertErrors([CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]);
|
| verify([source]);
|
| }
|
| + void test_constConstructorWithNonConstSuper_explicit() {
|
| + Source source = addSource(EngineTestCase.createSource([
|
| + "class A {",
|
| + " A();",
|
| + "}",
|
| + "class B extends A {",
|
| + " const B(): super();",
|
| + "}"]));
|
| + resolve(source);
|
| + assertErrors([CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER]);
|
| + verify([source]);
|
| + }
|
| + void test_constConstructorWithNonConstSuper_implicit() {
|
| + Source source = addSource(EngineTestCase.createSource([
|
| + "class A {",
|
| + " A();",
|
| + "}",
|
| + "class B extends A {",
|
| + " const B();",
|
| + "}"]));
|
| + resolve(source);
|
| + assertErrors([CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER]);
|
| + verify([source]);
|
| + }
|
| void test_constConstructorWithNonFinalField_mixin() {
|
| Source source = addSource(EngineTestCase.createSource([
|
| "class A {",
|
| @@ -6697,7 +7068,9 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
|
| " const B();",
|
| "}"]));
|
| resolve(source);
|
| - assertErrors([CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD]);
|
| + assertErrors([
|
| + CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD,
|
| + CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER]);
|
| verify([source]);
|
| }
|
| void test_constConstructorWithNonFinalField_this() {
|
| @@ -6712,7 +7085,7 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
|
| assertErrors([CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
|
| verify([source]);
|
| }
|
| - void test_constEval_propertyExtraction_methodInstance() {
|
| + void test_constEval_propertyExtraction_targetNotConst() {
|
| Source source = addSource(EngineTestCase.createSource([
|
| "class A {",
|
| " const A();",
|
| @@ -6724,18 +7097,6 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
|
| 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);
|
| @@ -7009,6 +7370,18 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
|
| assertErrors([CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS]);
|
| verify([source]);
|
| }
|
| + void test_defaultValueInFunctionTypedParameter_named() {
|
| + Source source = addSource(EngineTestCase.createSource(["f(g({p: null})) {}"]));
|
| + resolve(source);
|
| + assertErrors([CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER]);
|
| + verify([source]);
|
| + }
|
| + void test_defaultValueInFunctionTypedParameter_optional() {
|
| + Source source = addSource(EngineTestCase.createSource(["f(g([p = null])) {}"]));
|
| + resolve(source);
|
| + assertErrors([CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER]);
|
| + verify([source]);
|
| + }
|
| void test_duplicateConstructorName_named() {
|
| Source source = addSource(EngineTestCase.createSource(["class A {", " A.a() {}", " A.a() {}", "}"]));
|
| resolve(source);
|
| @@ -7725,54 +8098,6 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
|
| resolve(source);
|
| assertErrors([CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS]);
|
| }
|
| - void test_invalidOverrideNamed_fewerNamedParameters() {
|
| - Source source = addSource(EngineTestCase.createSource([
|
| - "class A {",
|
| - " m({a, b}) {}",
|
| - "}",
|
| - "class B extends A {",
|
| - " m({a}) {}",
|
| - "}"]));
|
| - resolve(source);
|
| - assertErrors([CompileTimeErrorCode.INVALID_OVERRIDE_NAMED]);
|
| - verify([source]);
|
| - }
|
| - void test_invalidOverrideNamed_missingNamedParameter() {
|
| - Source source = addSource(EngineTestCase.createSource([
|
| - "class A {",
|
| - " m({a, b}) {}",
|
| - "}",
|
| - "class B extends A {",
|
| - " m({a, c}) {}",
|
| - "}"]));
|
| - resolve(source);
|
| - assertErrors([CompileTimeErrorCode.INVALID_OVERRIDE_NAMED]);
|
| - verify([source]);
|
| - }
|
| - void test_invalidOverridePositional() {
|
| - Source source = addSource(EngineTestCase.createSource([
|
| - "class A {",
|
| - " m([a, b]) {}",
|
| - "}",
|
| - "class B extends A {",
|
| - " m([a]) {}",
|
| - "}"]));
|
| - resolve(source);
|
| - assertErrors([CompileTimeErrorCode.INVALID_OVERRIDE_POSITIONAL]);
|
| - verify([source]);
|
| - }
|
| - void test_invalidOverrideRequired() {
|
| - Source source = addSource(EngineTestCase.createSource([
|
| - "class A {",
|
| - " m(a) {}",
|
| - "}",
|
| - "class B extends A {",
|
| - " m(a, b) {}",
|
| - "}"]));
|
| - resolve(source);
|
| - assertErrors([CompileTimeErrorCode.INVALID_OVERRIDE_REQUIRED]);
|
| - verify([source]);
|
| - }
|
| void test_invalidReferenceToThis_factoryConstructor() {
|
| Source source = addSource(EngineTestCase.createSource(["class A {", " factory A() { return this; }", "}"]));
|
| resolve(source);
|
| @@ -8852,6 +9177,19 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
|
| assertErrors([CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT]);
|
| verify([source]);
|
| }
|
| + void test_undefinedFunction() {
|
| + Source source = addSource(EngineTestCase.createSource(["void f() {", " g();", "}"]));
|
| + resolve(source);
|
| + assertErrors([CompileTimeErrorCode.UNDEFINED_FUNCTION]);
|
| + }
|
| + void test_undefinedFunction_hasImportPrefix() {
|
| + Source source = addSource(EngineTestCase.createSource(["import 'lib.dart' as f;", "main() { return f(); }"]));
|
| + addSource2("/lib.dart", "library lib;");
|
| + resolve(source);
|
| + assertErrors([
|
| + CompileTimeErrorCode.UNDEFINED_FUNCTION,
|
| + HintCode.UNUSED_IMPORT]);
|
| + }
|
| void test_undefinedNamedParameter() {
|
| Source source = addSource(EngineTestCase.createSource([
|
| "class A {",
|
| @@ -9033,6 +9371,10 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
|
| final __test = new CompileTimeErrorCodeTest();
|
| runJUnitTest(__test, __test.test_ambiguousExport);
|
| });
|
| + _ut.test('test_ambiguousImport_function', () {
|
| + final __test = new CompileTimeErrorCodeTest();
|
| + runJUnitTest(__test, __test.test_ambiguousImport_function);
|
| + });
|
| _ut.test('test_argumentDefinitionTestNonParameter', () {
|
| final __test = new CompileTimeErrorCodeTest();
|
| runJUnitTest(__test, __test.test_argumentDefinitionTestNonParameter);
|
| @@ -9093,6 +9435,14 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
|
| final __test = new CompileTimeErrorCodeTest();
|
| runJUnitTest(__test, __test.test_conflictingGetterAndMethod_method_getter);
|
| });
|
| + _ut.test('test_constConstructorWithNonConstSuper_explicit', () {
|
| + final __test = new CompileTimeErrorCodeTest();
|
| + runJUnitTest(__test, __test.test_constConstructorWithNonConstSuper_explicit);
|
| + });
|
| + _ut.test('test_constConstructorWithNonConstSuper_implicit', () {
|
| + final __test = new CompileTimeErrorCodeTest();
|
| + runJUnitTest(__test, __test.test_constConstructorWithNonConstSuper_implicit);
|
| + });
|
| _ut.test('test_constConstructorWithNonFinalField_mixin', () {
|
| final __test = new CompileTimeErrorCodeTest();
|
| runJUnitTest(__test, __test.test_constConstructorWithNonFinalField_mixin);
|
| @@ -9161,13 +9511,9 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
|
| final __test = new CompileTimeErrorCodeTest();
|
| runJUnitTest(__test, __test.test_constEval_newInstance_constConstructor);
|
| });
|
| - _ut.test('test_constEval_propertyExtraction_methodInstance', () {
|
| + _ut.test('test_constEval_propertyExtraction_targetNotConst', () {
|
| 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);
|
| + runJUnitTest(__test, __test.test_constEval_propertyExtraction_targetNotConst);
|
| });
|
| _ut.test('test_constFormalParameter_fieldFormalParameter', () {
|
| final __test = new CompileTimeErrorCodeTest();
|
| @@ -9245,6 +9591,14 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
|
| final __test = new CompileTimeErrorCodeTest();
|
| runJUnitTest(__test, __test.test_defaultValueInFunctionTypeAlias);
|
| });
|
| + _ut.test('test_defaultValueInFunctionTypedParameter_named', () {
|
| + final __test = new CompileTimeErrorCodeTest();
|
| + runJUnitTest(__test, __test.test_defaultValueInFunctionTypedParameter_named);
|
| + });
|
| + _ut.test('test_defaultValueInFunctionTypedParameter_optional', () {
|
| + final __test = new CompileTimeErrorCodeTest();
|
| + runJUnitTest(__test, __test.test_defaultValueInFunctionTypedParameter_optional);
|
| + });
|
| _ut.test('test_duplicateConstructorName_named', () {
|
| final __test = new CompileTimeErrorCodeTest();
|
| runJUnitTest(__test, __test.test_duplicateConstructorName_named);
|
| @@ -9585,22 +9939,6 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
|
| final __test = new CompileTimeErrorCodeTest();
|
| runJUnitTest(__test, __test.test_invalidFactoryNameNotAClass_notEnclosingClassName);
|
| });
|
| - _ut.test('test_invalidOverrideNamed_fewerNamedParameters', () {
|
| - final __test = new CompileTimeErrorCodeTest();
|
| - runJUnitTest(__test, __test.test_invalidOverrideNamed_fewerNamedParameters);
|
| - });
|
| - _ut.test('test_invalidOverrideNamed_missingNamedParameter', () {
|
| - final __test = new CompileTimeErrorCodeTest();
|
| - runJUnitTest(__test, __test.test_invalidOverrideNamed_missingNamedParameter);
|
| - });
|
| - _ut.test('test_invalidOverridePositional', () {
|
| - final __test = new CompileTimeErrorCodeTest();
|
| - runJUnitTest(__test, __test.test_invalidOverridePositional);
|
| - });
|
| - _ut.test('test_invalidOverrideRequired', () {
|
| - final __test = new CompileTimeErrorCodeTest();
|
| - runJUnitTest(__test, __test.test_invalidOverrideRequired);
|
| - });
|
| _ut.test('test_invalidReferenceToThis_factoryConstructor', () {
|
| final __test = new CompileTimeErrorCodeTest();
|
| runJUnitTest(__test, __test.test_invalidReferenceToThis_factoryConstructor);
|
| @@ -10113,6 +10451,14 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
|
| final __test = new CompileTimeErrorCodeTest();
|
| runJUnitTest(__test, __test.test_undefinedConstructorInInitializer_implicit);
|
| });
|
| + _ut.test('test_undefinedFunction', () {
|
| + final __test = new CompileTimeErrorCodeTest();
|
| + runJUnitTest(__test, __test.test_undefinedFunction);
|
| + });
|
| + _ut.test('test_undefinedFunction_hasImportPrefix', () {
|
| + final __test = new CompileTimeErrorCodeTest();
|
| + runJUnitTest(__test, __test.test_undefinedFunction_hasImportPrefix);
|
| + });
|
| _ut.test('test_undefinedNamedParameter', () {
|
| final __test = new CompileTimeErrorCodeTest();
|
| runJUnitTest(__test, __test.test_undefinedNamedParameter);
|
| @@ -10905,6 +11251,13 @@ class ElementResolverTest extends EngineTestCase {
|
| JUnitTestCase.assertEquals(getGetter(doubleType, fieldName), node.element);
|
| _listener.assertNoErrors();
|
| }
|
| + void test_visitSimpleIdentifier_dynamic() {
|
| + SimpleIdentifier node = ASTFactory.identifier3("dynamic");
|
| + resolve4(node, []);
|
| + JUnitTestCase.assertSame(_typeProvider.dynamicType.element, node.staticElement);
|
| + JUnitTestCase.assertSame(_typeProvider.typeType, node.staticType);
|
| + _listener.assertNoErrors();
|
| + }
|
| void test_visitSimpleIdentifier_lexicalScope() {
|
| SimpleIdentifier node = ASTFactory.identifier3("i");
|
| VariableElementImpl element = ElementFactory.localVariableElement(node);
|
| @@ -11231,6 +11584,10 @@ class ElementResolverTest extends EngineTestCase {
|
| final __test = new ElementResolverTest();
|
| runJUnitTest(__test, __test.test_visitSimpleIdentifier_classScope);
|
| });
|
| + _ut.test('test_visitSimpleIdentifier_dynamic', () {
|
| + final __test = new ElementResolverTest();
|
| + runJUnitTest(__test, __test.test_visitSimpleIdentifier_dynamic);
|
| + });
|
| _ut.test('test_visitSimpleIdentifier_lexicalScope', () {
|
| final __test = new ElementResolverTest();
|
| runJUnitTest(__test, __test.test_visitSimpleIdentifier_lexicalScope);
|
| @@ -11573,18 +11930,6 @@ class StaticWarningCodeTest extends ResolverTestCase {
|
| StaticWarningCode.AMBIGUOUS_IMPORT,
|
| CompileTimeErrorCode.EXTENDS_NON_CLASS]);
|
| }
|
| - void test_ambiguousImport_function() {
|
| - Source source = addSource(EngineTestCase.createSource([
|
| - "import 'lib1.dart';",
|
| - "import 'lib2.dart';",
|
| - "g() { return f(); }"]));
|
| - addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "f() {}"]));
|
| - addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "f() {}"]));
|
| - resolve(source);
|
| - assertErrors([
|
| - StaticWarningCode.AMBIGUOUS_IMPORT,
|
| - StaticTypeWarningCode.UNDEFINED_FUNCTION]);
|
| - }
|
| void test_ambiguousImport_implements() {
|
| Source source = addSource(EngineTestCase.createSource([
|
| "import 'lib1.dart';",
|
| @@ -11774,6 +12119,17 @@ class StaticWarningCodeTest extends ResolverTestCase {
|
| assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
|
| verify([source]);
|
| }
|
| + void test_argumentTypeNotAssignable_invocation_functionTypes_optional() {
|
| + Source source = addSource(EngineTestCase.createSource([
|
| + "void acceptFunNumOptBool(void funNumOptBool([bool b])) {}",
|
| + "void funNumBool(bool b) {}",
|
| + "main() {",
|
| + " acceptFunNumOptBool(funNumBool);",
|
| + "}"]));
|
| + resolve(source);
|
| + assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
|
| + verify([source]);
|
| + }
|
| void test_argumentTypeNotAssignable_invocation_generic() {
|
| Source source = addSource(EngineTestCase.createSource([
|
| "class A<T> {",
|
| @@ -11870,8 +12226,7 @@ class StaticWarningCodeTest extends ResolverTestCase {
|
| " static const v = 0;",
|
| "}",
|
| "f() {",
|
| - " A a = new A();",
|
| - " a.v = 1;",
|
| + " A.v = 1;",
|
| "}"]));
|
| resolve(source);
|
| assertErrors([StaticWarningCode.ASSIGNMENT_TO_CONST]);
|
| @@ -12509,6 +12864,54 @@ class StaticWarningCodeTest extends ResolverTestCase {
|
| assertErrors([StaticWarningCode.INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL]);
|
| verify([source]);
|
| }
|
| + void test_invalidOverrideNamed_fewerNamedParameters() {
|
| + Source source = addSource(EngineTestCase.createSource([
|
| + "class A {",
|
| + " m({a, b}) {}",
|
| + "}",
|
| + "class B extends A {",
|
| + " m({a}) {}",
|
| + "}"]));
|
| + resolve(source);
|
| + assertErrors([StaticWarningCode.INVALID_OVERRIDE_NAMED]);
|
| + verify([source]);
|
| + }
|
| + void test_invalidOverrideNamed_missingNamedParameter() {
|
| + Source source = addSource(EngineTestCase.createSource([
|
| + "class A {",
|
| + " m({a, b}) {}",
|
| + "}",
|
| + "class B extends A {",
|
| + " m({a, c}) {}",
|
| + "}"]));
|
| + resolve(source);
|
| + assertErrors([StaticWarningCode.INVALID_OVERRIDE_NAMED]);
|
| + verify([source]);
|
| + }
|
| + void test_invalidOverridePositional() {
|
| + Source source = addSource(EngineTestCase.createSource([
|
| + "class A {",
|
| + " m([a, b]) {}",
|
| + "}",
|
| + "class B extends A {",
|
| + " m([a]) {}",
|
| + "}"]));
|
| + resolve(source);
|
| + assertErrors([StaticWarningCode.INVALID_OVERRIDE_POSITIONAL]);
|
| + verify([source]);
|
| + }
|
| + void test_invalidOverrideRequired() {
|
| + Source source = addSource(EngineTestCase.createSource([
|
| + "class A {",
|
| + " m(a) {}",
|
| + "}",
|
| + "class B extends A {",
|
| + " m(a, b) {}",
|
| + "}"]));
|
| + resolve(source);
|
| + assertErrors([StaticWarningCode.INVALID_OVERRIDE_REQUIRED]);
|
| + verify([source]);
|
| + }
|
| void test_invalidSetterOverrideNormalParamType() {
|
| Source source = addSource(EngineTestCase.createSource([
|
| "class A {",
|
| @@ -13041,6 +13444,41 @@ class StaticWarningCodeTest extends ResolverTestCase {
|
| assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]);
|
| verify([source]);
|
| }
|
| + void test_undefinedIdentifier_hideInBlock_function() {
|
| + Source source = addSource(EngineTestCase.createSource([
|
| + "var v = 1;",
|
| + "main() {",
|
| + " print(v);",
|
| + " v() {}",
|
| + "}",
|
| + "print(x) {}"]));
|
| + resolve(source);
|
| + assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]);
|
| + }
|
| + void test_undefinedIdentifier_hideInBlock_local() {
|
| + Source source = addSource(EngineTestCase.createSource([
|
| + "var v = 1;",
|
| + "main() {",
|
| + " print(v);",
|
| + " var v = 2;",
|
| + "}",
|
| + "print(x) {}"]));
|
| + resolve(source);
|
| + assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]);
|
| + }
|
| + void test_undefinedIdentifier_hideInBlock_subBlock() {
|
| + Source source = addSource(EngineTestCase.createSource([
|
| + "var v = 1;",
|
| + "main() {",
|
| + " {",
|
| + " print(v);",
|
| + " }",
|
| + " var v = 2;",
|
| + "}",
|
| + "print(x) {}"]));
|
| + resolve(source);
|
| + assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]);
|
| + }
|
| void test_undefinedIdentifier_initializer() {
|
| Source source = addSource(EngineTestCase.createSource(["var a = b;"]));
|
| resolve(source);
|
| @@ -13077,10 +13515,6 @@ class StaticWarningCodeTest extends ResolverTestCase {
|
| final __test = new StaticWarningCodeTest();
|
| runJUnitTest(__test, __test.test_ambiguousImport_extends);
|
| });
|
| - _ut.test('test_ambiguousImport_function', () {
|
| - final __test = new StaticWarningCodeTest();
|
| - runJUnitTest(__test, __test.test_ambiguousImport_function);
|
| - });
|
| _ut.test('test_ambiguousImport_implements', () {
|
| final __test = new StaticWarningCodeTest();
|
| runJUnitTest(__test, __test.test_ambiguousImport_implements);
|
| @@ -13145,6 +13579,10 @@ class StaticWarningCodeTest extends ResolverTestCase {
|
| final __test = new StaticWarningCodeTest();
|
| runJUnitTest(__test, __test.test_argumentTypeNotAssignable_invocation_functionParameter);
|
| });
|
| + _ut.test('test_argumentTypeNotAssignable_invocation_functionTypes_optional', () {
|
| + final __test = new StaticWarningCodeTest();
|
| + runJUnitTest(__test, __test.test_argumentTypeNotAssignable_invocation_functionTypes_optional);
|
| + });
|
| _ut.test('test_argumentTypeNotAssignable_invocation_generic', () {
|
| final __test = new StaticWarningCodeTest();
|
| runJUnitTest(__test, __test.test_argumentTypeNotAssignable_invocation_generic);
|
| @@ -13437,6 +13875,22 @@ class StaticWarningCodeTest extends ResolverTestCase {
|
| final __test = new StaticWarningCodeTest();
|
| runJUnitTest(__test, __test.test_invalidOverrideDifferentDefaultValues_positional);
|
| });
|
| + _ut.test('test_invalidOverrideNamed_fewerNamedParameters', () {
|
| + final __test = new StaticWarningCodeTest();
|
| + runJUnitTest(__test, __test.test_invalidOverrideNamed_fewerNamedParameters);
|
| + });
|
| + _ut.test('test_invalidOverrideNamed_missingNamedParameter', () {
|
| + final __test = new StaticWarningCodeTest();
|
| + runJUnitTest(__test, __test.test_invalidOverrideNamed_missingNamedParameter);
|
| + });
|
| + _ut.test('test_invalidOverridePositional', () {
|
| + final __test = new StaticWarningCodeTest();
|
| + runJUnitTest(__test, __test.test_invalidOverridePositional);
|
| + });
|
| + _ut.test('test_invalidOverrideRequired', () {
|
| + final __test = new StaticWarningCodeTest();
|
| + runJUnitTest(__test, __test.test_invalidOverrideRequired);
|
| + });
|
| _ut.test('test_invalidSetterOverrideNormalParamType', () {
|
| final __test = new StaticWarningCodeTest();
|
| runJUnitTest(__test, __test.test_invalidSetterOverrideNormalParamType);
|
| @@ -13677,6 +14131,18 @@ class StaticWarningCodeTest extends ResolverTestCase {
|
| final __test = new StaticWarningCodeTest();
|
| runJUnitTest(__test, __test.test_undefinedIdentifier_function_prefix);
|
| });
|
| + _ut.test('test_undefinedIdentifier_hideInBlock_function', () {
|
| + final __test = new StaticWarningCodeTest();
|
| + runJUnitTest(__test, __test.test_undefinedIdentifier_hideInBlock_function);
|
| + });
|
| + _ut.test('test_undefinedIdentifier_hideInBlock_local', () {
|
| + final __test = new StaticWarningCodeTest();
|
| + runJUnitTest(__test, __test.test_undefinedIdentifier_hideInBlock_local);
|
| + });
|
| + _ut.test('test_undefinedIdentifier_hideInBlock_subBlock', () {
|
| + final __test = new StaticWarningCodeTest();
|
| + runJUnitTest(__test, __test.test_undefinedIdentifier_hideInBlock_subBlock);
|
| + });
|
| _ut.test('test_undefinedIdentifier_initializer', () {
|
| final __test = new StaticWarningCodeTest();
|
| runJUnitTest(__test, __test.test_undefinedIdentifier_initializer);
|
| @@ -13801,6 +14267,11 @@ class TestTypeProvider implements TypeProvider {
|
| InterfaceType _mapType;
|
|
|
| /**
|
| + * The type representing the built-in type 'Null'.
|
| + */
|
| + InterfaceType _nullType;
|
| +
|
| + /**
|
| * The type representing the built-in type 'num'.
|
| */
|
| InterfaceType _numType;
|
| @@ -13913,6 +14384,12 @@ class TestTypeProvider implements TypeProvider {
|
| }
|
| return _mapType;
|
| }
|
| + InterfaceType get nullType {
|
| + if (_nullType == null) {
|
| + _nullType = ElementFactory.classElement2("Null", []).type;
|
| + }
|
| + return _nullType;
|
| + }
|
| InterfaceType get numType {
|
| if (_numType == null) {
|
| initializeNumericTypes();
|
| @@ -15611,7 +16088,7 @@ class NonHintCodeTest extends ResolverTestCase {
|
| verify([source]);
|
| }
|
| void test_unusedImport_export_infiniteLoop() {
|
| - Source source = addSource(EngineTestCase.createSource(["library L;", "import 'lib1.dart';", "Two one;"]));
|
| + Source source = addSource(EngineTestCase.createSource(["library L;", "import 'lib1.dart';", "Two two;"]));
|
| addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "export 'lib2.dart';", "class One {}"]));
|
| addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "export 'lib3.dart';", "class Two {}"]));
|
| addSource2("/lib3.dart", EngineTestCase.createSource(["library lib3;", "export 'lib2.dart';", "class Three {}"]));
|
| @@ -15620,7 +16097,7 @@ class NonHintCodeTest extends ResolverTestCase {
|
| verify([source]);
|
| }
|
| void test_unusedImport_export2() {
|
| - Source source = addSource(EngineTestCase.createSource(["library L;", "import 'lib1.dart';", "Two one;"]));
|
| + Source source = addSource(EngineTestCase.createSource(["library L;", "import 'lib1.dart';", "Three three;"]));
|
| addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "export 'lib2.dart';", "class One {}"]));
|
| addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "export 'lib3.dart';", "class Two {}"]));
|
| addSource2("/lib3.dart", EngineTestCase.createSource(["library lib3;", "class Three {}"]));
|
|
|