Index: pkg/analyzer/test/generated/resolver_test.dart |
diff --git a/pkg/analyzer/test/generated/resolver_test.dart b/pkg/analyzer/test/generated/resolver_test.dart |
index 19cfd3b4f6dd8710af97c84cb09c07070662a58f..a36fb9ed85331246a762cf9f62539cc94d1d6041 100644 |
--- a/pkg/analyzer/test/generated/resolver_test.dart |
+++ b/pkg/analyzer/test/generated/resolver_test.dart |
@@ -197,8 +197,8 @@ class AnalysisContextFactory { |
'onValue', futureThenR, [futureElement.typeParameters[0]], null); |
DartType futureRType = futureElement.type.substitute4([futureThenR.type]); |
- MethodElementImpl thenMethod = ElementFactory.methodElementWithParameters( |
- futureElement, "then", futureRType, [ |
+ MethodElementImpl thenMethod = ElementFactory |
+ .methodElementWithParameters(futureElement, "then", futureRType, [ |
ElementFactory.requiredParameter2("onValue", thenOnValue.type), |
ElementFactory.namedParameter2("onError", provider.functionType) |
]); |
@@ -287,8 +287,8 @@ class AnalysisContextFactory { |
ClassElementImpl htmlDocumentElement = |
ElementFactory.classElement("HtmlDocument", documentElement.type); |
htmlDocumentElement.methods = <MethodElement>[ |
- ElementFactory.methodElement( |
- "query", elementType, <DartType>[provider.stringType]) |
+ ElementFactory |
+ .methodElement("query", elementType, <DartType>[provider.stringType]) |
]; |
htmlUnit.types = <ClassElement>[ |
ElementFactory.classElement("AnchorElement", elementType), |
@@ -308,8 +308,8 @@ class AnalysisContextFactory { |
ElementFactory.functionElement3("query", elementElement, |
<ClassElement>[provider.stringType.element], ClassElement.EMPTY_LIST) |
]; |
- TopLevelVariableElementImpl document = ElementFactory |
- .topLevelVariableElement3( |
+ TopLevelVariableElementImpl document = |
+ ElementFactory.topLevelVariableElement3( |
"document", false, true, htmlDocumentElement.type); |
htmlUnit.topLevelVariables = <TopLevelVariableElement>[document]; |
htmlUnit.accessors = <PropertyAccessorElement>[document.getter]; |
@@ -3458,6 +3458,37 @@ f(var a) { |
StaticTypeWarningCode.UNDEFINED_GETTER.message); |
} |
+ void test_undefinedIdentifier_inComment_prefixed_prefix() { |
+ Source source = addSource(r''' |
+/// [Foo.bar] |
+main() {} |
+'''); |
+ computeLibrarySourceErrors(source); |
+ assertErrors(source, [HintCode.UNDEFINED_IDENTIFIER]); |
+ verify([source]); |
+ } |
+ |
+ void test_undefinedIdentifier_inComment_simple() { |
+ Source source = addSource(r''' |
+/// [Foo] |
+main() {} |
+'''); |
+ computeLibrarySourceErrors(source); |
+ assertErrors(source, [HintCode.UNDEFINED_IDENTIFIER]); |
+ verify([source]); |
+ } |
+ |
+ void test_undefinedMember_inComment_prefixed_name() { |
+ Source source = addSource(r''' |
+class Foo {} |
+/// [Foo.bar] |
+main() {} |
+'''); |
+ computeLibrarySourceErrors(source); |
+ assertErrors(source, [HintCode.UNDEFINED_MEMBER]); |
+ verify([source]); |
+ } |
+ |
void test_undefinedMethod() { |
Source source = addSource(r''' |
f() { |
@@ -5149,7 +5180,8 @@ class InheritanceManagerTest { |
_assertNoErrors(classA); |
} |
- void test_getMapOfMembersInheritedFromInterfaces_inconsistentMethodInheritance_getter_method() { |
+ void |
+ test_getMapOfMembersInheritedFromInterfaces_inconsistentMethodInheritance_getter_method() { |
// class I1 { int m(); } |
// class I2 { int get m; } |
// class A implements I2, I1 {} |
@@ -5172,7 +5204,8 @@ class InheritanceManagerTest { |
[StaticWarningCode.INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD]); |
} |
- void test_getMapOfMembersInheritedFromInterfaces_inconsistentMethodInheritance_int_str() { |
+ void |
+ test_getMapOfMembersInheritedFromInterfaces_inconsistentMethodInheritance_int_str() { |
// class I1 { int m(); } |
// class I2 { String m(); } |
// class A implements I1, I2 {} |
@@ -5182,8 +5215,8 @@ class InheritanceManagerTest { |
ElementFactory.methodElement(methodName, null, [_typeProvider.intType]); |
classI1.methods = <MethodElement>[methodM1]; |
ClassElementImpl classI2 = ElementFactory.classElement2("I2"); |
- MethodElement methodM2 = ElementFactory.methodElement( |
- methodName, null, [_typeProvider.stringType]); |
+ MethodElement methodM2 = ElementFactory |
+ .methodElement(methodName, null, [_typeProvider.stringType]); |
classI2.methods = <MethodElement>[methodM2]; |
ClassElementImpl classA = ElementFactory.classElement2("A"); |
classA.interfaces = <InterfaceType>[classI1.type, classI2.type]; |
@@ -5195,7 +5228,8 @@ class InheritanceManagerTest { |
classA, [StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE]); |
} |
- void test_getMapOfMembersInheritedFromInterfaces_inconsistentMethodInheritance_method_getter() { |
+ void |
+ test_getMapOfMembersInheritedFromInterfaces_inconsistentMethodInheritance_method_getter() { |
// class I1 { int m(); } |
// class I2 { int get m; } |
// class A implements I1, I2 {} |
@@ -5218,7 +5252,8 @@ class InheritanceManagerTest { |
[StaticWarningCode.INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD]); |
} |
- void test_getMapOfMembersInheritedFromInterfaces_inconsistentMethodInheritance_numOfRequiredParams() { |
+ void |
+ test_getMapOfMembersInheritedFromInterfaces_inconsistentMethodInheritance_numOfRequiredParams() { |
// class I1 { dynamic m(int, [int]); } |
// class I2 { dynamic m(int, int, int); } |
// class A implements I1, I2 {} |
@@ -5267,14 +5302,15 @@ class InheritanceManagerTest { |
classA, [StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE]); |
} |
- void test_getMapOfMembersInheritedFromInterfaces_inconsistentMethodInheritance_str_int() { |
+ void |
+ test_getMapOfMembersInheritedFromInterfaces_inconsistentMethodInheritance_str_int() { |
// class I1 { int m(); } |
// class I2 { String m(); } |
// class A implements I2, I1 {} |
ClassElementImpl classI1 = ElementFactory.classElement2("I1"); |
String methodName = "m"; |
- MethodElement methodM1 = ElementFactory.methodElement( |
- methodName, null, [_typeProvider.stringType]); |
+ MethodElement methodM1 = ElementFactory |
+ .methodElement(methodName, null, [_typeProvider.stringType]); |
classI1.methods = <MethodElement>[methodM1]; |
ClassElementImpl classI2 = ElementFactory.classElement2("I2"); |
MethodElement methodM2 = |
@@ -5376,7 +5412,8 @@ class InheritanceManagerTest { |
_assertNoErrors(classA); |
} |
- void test_getMapOfMembersInheritedFromInterfaces_union_multipleSubtypes_2_getters() { |
+ void |
+ test_getMapOfMembersInheritedFromInterfaces_union_multipleSubtypes_2_getters() { |
// class I1 { int get g; } |
// class I2 { num get g; } |
// class A implements I1, I2 {} |
@@ -5400,7 +5437,8 @@ class InheritanceManagerTest { |
_assertNoErrors(classA); |
} |
- void test_getMapOfMembersInheritedFromInterfaces_union_multipleSubtypes_2_methods() { |
+ void |
+ test_getMapOfMembersInheritedFromInterfaces_union_multipleSubtypes_2_methods() { |
// class I1 { dynamic m(int); } |
// class I2 { dynamic m(num); } |
// class A implements I1, I2 {} |
@@ -5434,7 +5472,8 @@ class InheritanceManagerTest { |
_assertNoErrors(classA); |
} |
- void test_getMapOfMembersInheritedFromInterfaces_union_multipleSubtypes_2_setters() { |
+ void |
+ test_getMapOfMembersInheritedFromInterfaces_union_multipleSubtypes_2_setters() { |
// class I1 { set s(int); } |
// class I2 { set s(num); } |
// class A implements I1, I2 {} |
@@ -5459,7 +5498,8 @@ class InheritanceManagerTest { |
_assertNoErrors(classA); |
} |
- void test_getMapOfMembersInheritedFromInterfaces_union_multipleSubtypes_3_getters() { |
+ void |
+ test_getMapOfMembersInheritedFromInterfaces_union_multipleSubtypes_3_getters() { |
// class A {} |
// class B extends A {} |
// class C extends B {} |
@@ -5498,7 +5538,8 @@ class InheritanceManagerTest { |
_assertNoErrors(classD); |
} |
- void test_getMapOfMembersInheritedFromInterfaces_union_multipleSubtypes_3_methods() { |
+ void |
+ test_getMapOfMembersInheritedFromInterfaces_union_multipleSubtypes_3_methods() { |
// class A {} |
// class B extends A {} |
// class C extends B {} |
@@ -5552,7 +5593,8 @@ class InheritanceManagerTest { |
_assertNoErrors(classD); |
} |
- void test_getMapOfMembersInheritedFromInterfaces_union_multipleSubtypes_3_setters() { |
+ void |
+ test_getMapOfMembersInheritedFromInterfaces_union_multipleSubtypes_3_setters() { |
// class A {} |
// class B extends A {} |
// class C extends B {} |
@@ -5592,7 +5634,8 @@ class InheritanceManagerTest { |
_assertNoErrors(classD); |
} |
- void test_getMapOfMembersInheritedFromInterfaces_union_oneSubtype_2_methods() { |
+ void |
+ test_getMapOfMembersInheritedFromInterfaces_union_oneSubtype_2_methods() { |
// class I1 { int m(); } |
// class I2 { int m([int]); } |
// class A implements I1, I2 {} |
@@ -5619,7 +5662,8 @@ class InheritanceManagerTest { |
_assertNoErrors(classA); |
} |
- void test_getMapOfMembersInheritedFromInterfaces_union_oneSubtype_3_methods() { |
+ void |
+ test_getMapOfMembersInheritedFromInterfaces_union_oneSubtype_3_methods() { |
// class I1 { int m(); } |
// class I2 { int m([int]); } |
// class I3 { int m([int, int]); } |
@@ -5664,7 +5708,8 @@ class InheritanceManagerTest { |
_assertNoErrors(classA); |
} |
- void test_getMapOfMembersInheritedFromInterfaces_union_oneSubtype_4_methods() { |
+ void |
+ test_getMapOfMembersInheritedFromInterfaces_union_oneSubtype_4_methods() { |
// class I1 { int m(); } |
// class I2 { int m(); } |
// class I3 { int m([int]); } |
@@ -6914,6 +6959,51 @@ f(var a) { |
assertNoErrors(source); |
} |
+ void test_undefinedIdentifier_inComment_empty() { |
+ Source source = addSource(r''' |
+/// [] |
+main() {} |
+'''); |
+ computeLibrarySourceErrors(source); |
+ assertNoErrors(source); |
+ verify([source]); |
+ } |
+ |
+ void fail_undefinedIdentifier_inComment_inCode() { |
+ Source source = addSource(r''' |
+/// Validate that every `a[i] == b[i]`. |
+main(a, b) {} |
+'''); |
+ computeLibrarySourceErrors(source); |
+ assertNoErrors(source); |
+ verify([source]); |
+ } |
+ |
+ void test_undefinedIdentifier_inComment_prefixed() { |
+ Source source = addSource(r''' |
+class Foo { |
+ bar() {} |
+ get baz => null; |
+} |
+/// [Foo.bar] and [Foo.baz] |
+main() {} |
+'''); |
+ computeLibrarySourceErrors(source); |
+ assertNoErrors(source); |
+ verify([source]); |
+ } |
+ |
+ void test_undefinedIdentifier_inComment_simple() { |
+ Source source = addSource(r''' |
+class Foo {} |
+/// [Foo] |
+main() {} |
+'''); |
+ computeLibrarySourceErrors(source); |
+ assertNoErrors(source); |
+ verify([source]); |
+ } |
+ |
void test_undefinedMethod_assignmentExpression_inSubtype() { |
Source source = addSource(r''' |
class A {} |
@@ -9366,7 +9456,9 @@ const A = null; |
expect(declarations, hasLength(2)); |
Element expectedElement = (declarations[0] as TopLevelVariableDeclaration) |
.variables |
- .variables[0].name.staticElement; |
+ .variables[0] |
+ .name |
+ .staticElement; |
EngineTestCase.assertInstanceOf((obj) => obj is PropertyInducingElement, |
PropertyInducingElement, expectedElement); |
expectedElement = (expectedElement as PropertyInducingElement).getter; |
@@ -9557,7 +9649,9 @@ const A = null; |
expect(declarations, hasLength(2)); |
Element expectedElement = (declarations[0] as TopLevelVariableDeclaration) |
.variables |
- .variables[0].name.staticElement; |
+ .variables[0] |
+ .name |
+ .staticElement; |
EngineTestCase.assertInstanceOf((obj) => obj is PropertyInducingElement, |
PropertyInducingElement, expectedElement); |
expectedElement = (expectedElement as PropertyInducingElement).getter; |
@@ -11780,17 +11874,17 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase { |
TypeAssertions _assertions; |
AsserterBuilder<Element, DartType> _hasElement; |
AsserterBuilder<DartType, DartType> _isType; |
- AsserterBuilder2<Asserter<DartType>, Asserter<DartType>, |
- DartType> _isFunction2Of; |
- AsserterBuilderBuilder<Asserter<DartType>, List<Asserter<DartType>>, |
- DartType> _isInstantiationOf; |
+ AsserterBuilder2<Asserter<DartType>, Asserter<DartType>, DartType> |
+ _isFunction2Of; |
+ AsserterBuilderBuilder<Asserter<DartType>, List<Asserter<DartType>>, DartType> |
+ _isInstantiationOf; |
Asserter<DartType> _isInt; |
Asserter<DartType> _isNum; |
Asserter<DartType> _isString; |
Asserter<DartType> _isDynamic; |
AsserterBuilder<Asserter<DartType>, InterfaceType> _isListOf; |
- AsserterBuilder2<Asserter<DartType>, Asserter<DartType>, |
- InterfaceType> _isMapOf; |
+ AsserterBuilder2<Asserter<DartType>, Asserter<DartType>, InterfaceType> |
+ _isMapOf; |
@override |
void setUp() { |
@@ -14021,7 +14115,8 @@ class B extends A { |
code, typeProvider.dynamicType, typeProvider.intType); |
} |
- void test_finalPropertyInducingVariable_classMember_instance_propagatedTarget() { |
+ void |
+ test_finalPropertyInducingVariable_classMember_instance_propagatedTarget() { |
addNamedSource( |
"/lib.dart", |
r''' |
@@ -14240,7 +14335,8 @@ f(MyMap<int, String> m) { |
expect(vParameter.identifier.propagatedType, same(stringType)); |
} |
- void test_functionExpression_asInvocationArgument_functionExpressionInvocation() { |
+ void |
+ test_functionExpression_asInvocationArgument_functionExpressionInvocation() { |
String code = r''' |
main() { |
(f(String value)) {} ((v) { |