@@ -243,16 +243,6 @@ class KernelTypeGraphBuilder extends ir.VisitorDefault<TypeInformation?>
243243 return visit (_analyzedNode)! ;
244244 }
245245
246- bool isIncompatibleInvoke (FunctionEntity function, ArgumentsTypes arguments) {
247- ParameterStructure parameterStructure = function.parameterStructure;
248-
249- return arguments.positional.length <
250- parameterStructure.requiredPositionalParameters ||
251- arguments.positional.length > parameterStructure.positionalParameters ||
252- arguments.named.keys
253- .any ((name) => ! parameterStructure.namedParameters.contains (name));
254- }
255-
256246 void recordReturnType (TypeInformation type) {
257247 final analyzedMethod = _analyzedMember as FunctionEntity ;
258248 _returnType = _inferrer.addReturnTypeForMethod (analyzedMethod, type);
@@ -940,10 +930,6 @@ class KernelTypeGraphBuilder extends ir.VisitorDefault<TypeInformation?>
940930 ClosureRepresentationInfo info =
941931 _closureDataLookup.getClosureInfo (function);
942932 final callMethod = info.callMethod! ;
943- if (isIncompatibleInvoke (callMethod, argumentsTypes)) {
944- return _types.dynamicType;
945- }
946-
947933 TypeInformation type =
948934 handleStaticInvoke (node, selector, callMethod, argumentsTypes);
949935 FunctionType functionType =
@@ -2153,15 +2139,6 @@ class KernelTypeGraphBuilder extends ir.VisitorDefault<TypeInformation?>
21532139 return _types.nonNullEmpty ();
21542140 }
21552141
2156- TypeInformation handleSuperNoSuchMethod (
2157- ir.Node node, Selector selector, ArgumentsTypes ? arguments) {
2158- // Ensure we create a node, to make explicit the call to the
2159- // `noSuchMethod` handler.
2160- FunctionEntity noSuchMethod =
2161- _elementMap.getSuperNoSuchMethod (_analyzedMember.enclosingClass! );
2162- return handleStaticInvoke (node, selector, noSuchMethod, arguments);
2163- }
2164-
21652142 @override
21662143 TypeInformation visitSuperPropertyGet (ir.SuperPropertyGet node) {
21672144 // TODO(herhut): We could do better here if we knew what we
@@ -2170,13 +2147,6 @@ class KernelTypeGraphBuilder extends ir.VisitorDefault<TypeInformation?>
21702147
21712148 final target = getEffectiveSuperTarget (node.interfaceTarget);
21722149 Selector selector = Selector .getter (_elementMap.getName (node.name));
2173- if (target == null ) {
2174- // TODO(johnniwinther): Remove this when the CFE checks for missing
2175- // concrete super targets.
2176- // TODO(48820): If this path is infeasible, update types on
2177- // getEffectiveSuperTarget.
2178- return handleSuperNoSuchMethod (node, selector, null );
2179- }
21802150 MemberEntity member = _elementMap.getMember (target);
21812151 TypeInformation type = handleStaticInvoke (node, selector, member, null );
21822152 if (member.isGetter) {
@@ -2208,11 +2178,6 @@ class KernelTypeGraphBuilder extends ir.VisitorDefault<TypeInformation?>
22082178 final target = getEffectiveSuperTarget (node.interfaceTarget);
22092179 Selector selector = Selector .setter (_elementMap.getName (node.name));
22102180 ArgumentsTypes arguments = ArgumentsTypes ([rhsType], null );
2211- if (target == null ) {
2212- // TODO(johnniwinther): Remove this when the CFE checks for missing
2213- // concrete super targets.
2214- return handleSuperNoSuchMethod (node, selector, arguments);
2215- }
22162181 final member = _elementMap.getMember (target);
22172182 handleStaticInvoke (node, selector, member, arguments);
22182183 return rhsType;
@@ -2227,27 +2192,19 @@ class KernelTypeGraphBuilder extends ir.VisitorDefault<TypeInformation?>
22272192 final target = getEffectiveSuperTarget (node.interfaceTarget);
22282193 ArgumentsTypes arguments = analyzeArguments (node.arguments);
22292194 Selector selector = _elementMap.getSelector (node);
2230- if (target == null ) {
2231- // TODO(johnniwinther): Remove this when the CFE checks for missing
2232- // concrete super targets.
2233- return handleSuperNoSuchMethod (node, selector, arguments);
2234- }
22352195 MemberEntity member = _elementMap.getMember (target);
22362196 assert (member.isFunction, "Unexpected super invocation target: $member " );
2237- if (isIncompatibleInvoke (member as FunctionEntity , arguments)) {
2238- return handleSuperNoSuchMethod (node, selector, arguments);
2239- } else {
2240- TypeInformation type =
2241- handleStaticInvoke (node, selector, member, arguments);
2242- FunctionType functionType =
2243- _elementMap.elementEnvironment.getFunctionType (member);
2244- if (functionType.returnType.containsFreeTypeVariables) {
2245- // The return type varies with the call site so we narrow the static
2246- // return type.
2247- type = _types.narrowType (type, _getStaticType (node));
2248- }
2249- return type;
2197+ member as FunctionEntity ;
2198+ TypeInformation type =
2199+ handleStaticInvoke (node, selector, member, arguments);
2200+ FunctionType functionType =
2201+ _elementMap.elementEnvironment.getFunctionType (member);
2202+ if (functionType.returnType.containsFreeTypeVariables) {
2203+ // The return type varies with the call site so we narrow the static
2204+ // return type.
2205+ type = _types.narrowType (type, _getStaticType (node));
22502206 }
2207+ return type;
22512208 }
22522209
22532210 @override
0 commit comments