mirror of
https://github.com/dart-lang/sdk
synced 2024-09-18 22:01:19 +00:00
Issue 46103. Resolve type arguments of TypeName(s) - there might be expressions.
Bug: https://github.com/dart-lang/sdk/issues/46103 Change-Id: Ia847403c7609f289f3f3f8bd5cd10e221216993f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214101 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
parent
bcaa2a320c
commit
dc5eec2c5a
|
@ -3052,7 +3052,12 @@ class ScopeResolverVisitor extends ResolverBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void visitTypeName(TypeName node) {}
|
void visitTypeName(TypeName node) {
|
||||||
|
// All TypeName(s) are already resolved, so we don't resolve it here.
|
||||||
|
// But there might be type arguments with Expression(s), such as
|
||||||
|
// annotations on formal parameters of GenericFunctionType(s).
|
||||||
|
node.typeArguments?.accept(this);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void visitVariableDeclaration(VariableDeclaration node) {
|
void visitVariableDeclaration(VariableDeclaration node) {
|
||||||
|
|
|
@ -27,6 +27,27 @@ class MetadataResolutionTest extends PubPackageResolutionTest {
|
||||||
return findElement.importFind('package:test/a.dart');
|
return findElement.importFind('package:test/a.dart');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test_at_genericFunctionType_formalParameter() async {
|
||||||
|
await assertNoErrorsInCode(r'''
|
||||||
|
const a = 42;
|
||||||
|
List<void Function(@a int b)> f() => [];
|
||||||
|
''');
|
||||||
|
|
||||||
|
var annotation = findNode.annotation('@a');
|
||||||
|
_assertResolvedNodeText(annotation, r'''
|
||||||
|
Annotation
|
||||||
|
atSign: @
|
||||||
|
element: self::@getter::a
|
||||||
|
name: SimpleIdentifier
|
||||||
|
staticElement: self::@getter::a
|
||||||
|
staticType: null
|
||||||
|
token: a
|
||||||
|
''');
|
||||||
|
_assertAnnotationValueText(annotation, '''
|
||||||
|
int 42
|
||||||
|
''');
|
||||||
|
}
|
||||||
|
|
||||||
test_location_partDirective() async {
|
test_location_partDirective() async {
|
||||||
newFile('$testPackageLibPath/a.dart', content: r'''
|
newFile('$testPackageLibPath/a.dart', content: r'''
|
||||||
part of 'test.dart';
|
part of 'test.dart';
|
||||||
|
|
Loading…
Reference in a new issue