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

Side by Side Diff: pkg/analyzer/test/src/task/strong/front_end_inference_test.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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/kernel/body_builder.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:convert'; 6 import 'dart:convert';
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/visitor.dart'; 10 import 'package:analyzer/dart/ast/visitor.dart';
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 _recordType(parameter.offset, type.parameters[i].type); 354 _recordType(parameter.offset, type.parameters[i].type);
355 } 355 }
356 } 356 }
357 } 357 }
358 } 358 }
359 } 359 }
360 360
361 @override 361 @override
362 visitFunctionExpressionInvocation(FunctionExpressionInvocation node) { 362 visitFunctionExpressionInvocation(FunctionExpressionInvocation node) {
363 super.visitFunctionExpressionInvocation(node); 363 super.visitFunctionExpressionInvocation(node);
364 var receiverType = node.function.staticType;
365 if (receiverType is InterfaceType) {
366 // This is a hack since analyzer doesn't record .call targets
367 var target = receiverType.element.lookUpMethod('call', null) ??
368 receiverType.element.lookUpGetter('call', null);
369 if (target != null) {
370 _recordTarget(node.argumentList.offset, target);
371 }
372 }
364 if (node.typeArguments == null) { 373 if (node.typeArguments == null) {
365 var inferredTypeArguments = _getInferredFunctionTypeArguments( 374 var inferredTypeArguments = _getInferredFunctionTypeArguments(
366 node.function.staticType, 375 node.function.staticType,
367 node.staticInvokeType, 376 node.staticInvokeType,
368 node.typeArguments) 377 node.typeArguments)
369 .toList(); 378 .toList();
370 if (inferredTypeArguments.isNotEmpty) { 379 if (inferredTypeArguments.isNotEmpty) {
371 _recordTypeArguments(node.argumentList.offset, inferredTypeArguments); 380 _recordTypeArguments(node.argumentList.offset, inferredTypeArguments);
372 } 381 }
373 } 382 }
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 545
537 /// Based on DDC code generator's `_recoverTypeArguments` 546 /// Based on DDC code generator's `_recoverTypeArguments`
538 Iterable<DartType> _recoverTypeArguments(FunctionType g, FunctionType f) { 547 Iterable<DartType> _recoverTypeArguments(FunctionType g, FunctionType f) {
539 assert(identical(g.element, f.element)); 548 assert(identical(g.element, f.element));
540 assert(g.typeFormals.isNotEmpty && f.typeFormals.isEmpty); 549 assert(g.typeFormals.isNotEmpty && f.typeFormals.isEmpty);
541 assert(g.typeFormals.length + g.typeArguments.length == 550 assert(g.typeFormals.length + g.typeArguments.length ==
542 f.typeArguments.length); 551 f.typeArguments.length);
543 return f.typeArguments.skip(g.typeArguments.length); 552 return f.typeArguments.skip(g.typeArguments.length);
544 } 553 }
545 } 554 }
OLDNEW
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/kernel/body_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698