Skip to content

Commit 6d4e7d6

Browse files
bwilkersoncommit-bot@chromium.org
authored andcommitted
Fix an exception thrown when a method cannot be resolved because the target type is dynamic
Change-Id: I0479305057a2f763f68aa61c860ab9785d2ca1b9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151420 Reviewed-by: Jaime Wren <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]>
1 parent 7fce125 commit 6d4e7d6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,9 +720,15 @@ extension AstNodeFeatureComputerExtension on AstNode {
720720
/// Return the [FunctionType], if there is one, for this [AstNode].
721721
FunctionType get functionType {
722722
if (parent is MethodInvocation) {
723-
return (parent as MethodInvocation).staticInvokeType;
723+
var type = (parent as MethodInvocation).staticInvokeType;
724+
if (type is FunctionType) {
725+
return type;
726+
}
724727
} else if (parent is FunctionExpressionInvocation) {
725-
return (parent as FunctionExpressionInvocation).staticInvokeType;
728+
var type = (parent as FunctionExpressionInvocation).staticInvokeType;
729+
if (type is FunctionType) {
730+
return type;
731+
}
726732
}
727733
return null;
728734
}

0 commit comments

Comments
 (0)