Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Unified Diff: pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart

Issue 2928613003: Fix corner cases of type inference with implicit references to `.call`. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
index 002ab8ef25c1dc1a510fddd932d88b92849e3ef6..b710245161a05ca95e924aae65464d626e015126 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
@@ -1034,13 +1034,14 @@ class KernelMapLiteral extends MapLiteral implements KernelExpression {
/// Shadow object for [MethodInvocation].
class KernelMethodInvocation extends MethodInvocation
implements KernelExpression {
- KernelMethodInvocation(Expression receiver, Name name, Arguments arguments,
- [Procedure interfaceTarget])
- : super(receiver, name, arguments, interfaceTarget);
+ /// Indicates whether this method invocation is a call to a `call` method
+ /// resulting from the invocation of a function expression.
+ final bool _isImplicitCall;
- KernelMethodInvocation.byReference(Expression receiver, Name name,
- Arguments arguments, Reference interfaceTargetReference)
- : super.byReference(receiver, name, arguments, interfaceTargetReference);
+ KernelMethodInvocation(Expression receiver, Name name, Arguments arguments,
+ {bool isImplicitCall: false, Procedure interfaceTarget})
+ : _isImplicitCall = isImplicitCall,
+ super(receiver, name, arguments, interfaceTarget);
@override
void _collectDependencies(KernelDependencyCollector collector) {
@@ -1081,8 +1082,8 @@ class KernelMethodInvocation extends MethodInvocation
.isOverloadedArithmeticOperator(interfaceMember);
}
}
- var calleeType =
- inferrer.getCalleeFunctionType(interfaceMember, receiverType, name);
+ var calleeType = inferrer.getCalleeFunctionType(
+ interfaceMember, receiverType, name, !_isImplicitCall);
var inferredType = inferrer.inferInvocation(typeContext, typeNeeded,
fileOffset, calleeType, calleeType.returnType, arguments,
isOverloadedArithmeticOperator: isOverloadedArithmeticOperator,

Powered by Google App Engine
This is Rietveld 408576698