Failing test for annotation on formal parameters of redirecting factory constructors.

For https://github.com/dart-lang/sdk/issues/33800

R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I7e145a90aee441a73ab125f32dd43124e26ea84a
Reviewed-on: https://dart-review.googlesource.com/64244
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Konstantin Shcheglov
2018-07-09 23:16:08 +00:00
committed by commit-bot@chromium.org
parent cf30a28ca1
commit 7ffebea896
3 changed files with 34 additions and 1 deletions
@@ -177,7 +177,7 @@ class NonErrorResolverTest_Kernel extends NonErrorResolverTest_Driver {
@override
@failingTest
@potentialAnalyzerProblem
@FastaProblem('https://github.com/dart-lang/sdk/issues/33799')
test_functionTypeAlias_scope_signature() async {
// Caused by Bad state: Found 1 annotation nodes and 0 element annotations
return super.test_functionTypeAlias_scope_signature();
@@ -28,6 +28,13 @@ class AnalysisDriverResolutionTest_Kernel extends AnalysisDriverResolutionTest {
await super.test_annotation_onDirective_partOf();
}
@override
@failingTest
@FastaProblem('https://github.com/dart-lang/sdk/issues/33800')
test_annotation_onFormalParameter_redirectingFactory() async {
await super.test_annotation_onFormalParameter_redirectingFactory();
}
@failingTest
@override
test_annotation_onVariableList_topLevelVariable() =>
@@ -344,6 +344,28 @@ const a = 1;
assertType(aRef, 'int');
}
test_annotation_onFormalParameter_redirectingFactory() async {
addTestFile(r'''
class C {
factory C(@a p) = C.named;
C.named(p);
}
const a = 1;
''');
await resolveTestFile();
var parameter = findNode.simpleParameter('p) = C.');
expect(parameter.metadata, hasLength(1));
Annotation annotation = parameter.metadata[0];
expect(annotation.element, findElement.topGet('a'));
SimpleIdentifier aRef = annotation.name;
assertElement(aRef, findElement.topGet('a'));
assertType(aRef, 'int');
}
test_annotation_onVariableList_constructor() async {
String content = r'''
class C {
@@ -7875,6 +7897,10 @@ class FindNode {
return _node(search);
}
SimpleFormalParameter simpleParameter(String search) {
return _node(search).getAncestor((n) => n is SimpleFormalParameter);
}
VariableDeclaration variableDeclaration(String search) {
return _node(search).getAncestor((n) => n is VariableDeclaration);
}