mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 00:09:49 +00:00
analyzer: tearoff function reference w/ type args as part of method call
Fixes https://github.com/dart-lang/sdk/issues/47005 Change-Id: I0ea2dcd337030ef471123fd0e02b4398e1ace671 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211463 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
parent
88cd302eb0
commit
59216c7949
|
@ -45,7 +45,7 @@ class AstRewriter {
|
|||
var typeName = node.constructorName.type.name;
|
||||
if (typeName is SimpleIdentifier) {
|
||||
var element = nameScope.lookup(typeName.name).getter;
|
||||
if (element is MethodElement) {
|
||||
if (element is FunctionElement || element is MethodElement) {
|
||||
return _toMethodInvocationOfFunctionReference(
|
||||
node: node, function: typeName);
|
||||
}
|
||||
|
|
|
@ -867,6 +867,22 @@ bar() {
|
|||
findNode.functionReference('foo<int>;'), null, 'dynamic');
|
||||
}
|
||||
|
||||
test_topLevelFunction_targetOfFunctionCall() async {
|
||||
await assertNoErrorsInCode('''
|
||||
void foo<T>(T arg) {}
|
||||
|
||||
extension on Function {
|
||||
void m() {}
|
||||
}
|
||||
void bar() {
|
||||
foo<int>.m();
|
||||
}
|
||||
''');
|
||||
|
||||
assertFunctionReference(findNode.functionReference('foo<int>'),
|
||||
findElement.topFunction('foo'), 'void Function(int)');
|
||||
}
|
||||
|
||||
test_topLevelVariable_prefix_unknownIdentifier() async {
|
||||
newFile('$testPackageLibPath/a.dart', content: '');
|
||||
await assertErrorsInCode('''
|
||||
|
|
Loading…
Reference in a new issue