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

Side by Side Diff: pkg/analyzer/lib/src/generated/error_verifier.dart

Issue 2675963004: fix #28630, instance method tear-offs are treated as strict arrows (Closed)
Patch Set: fix sdk Created 3 years, 10 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/analyzer/lib/src/task/strong/checker.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library analyzer.src.generated.error_verifier; 5 library analyzer.src.generated.error_verifier;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import "dart:math" as math; 8 import "dart:math" as math;
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 15 matching lines...) Expand all
26 import 'package:analyzer/src/generated/element_resolver.dart'; 26 import 'package:analyzer/src/generated/element_resolver.dart';
27 import 'package:analyzer/src/generated/engine.dart'; 27 import 'package:analyzer/src/generated/engine.dart';
28 import 'package:analyzer/src/generated/java_engine.dart'; 28 import 'package:analyzer/src/generated/java_engine.dart';
29 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; 29 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode;
30 import 'package:analyzer/src/generated/resolver.dart'; 30 import 'package:analyzer/src/generated/resolver.dart';
31 import 'package:analyzer/src/generated/sdk.dart' show DartSdk, SdkLibrary; 31 import 'package:analyzer/src/generated/sdk.dart' show DartSdk, SdkLibrary;
32 import 'package:analyzer/src/generated/source.dart'; 32 import 'package:analyzer/src/generated/source.dart';
33 import 'package:analyzer/src/generated/utilities_dart.dart'; 33 import 'package:analyzer/src/generated/utilities_dart.dart';
34 import 'package:analyzer/src/task/dart.dart'; 34 import 'package:analyzer/src/task/dart.dart';
35 import 'package:analyzer/src/task/strong/checker.dart' as checker 35 import 'package:analyzer/src/task/strong/checker.dart' as checker
36 show isKnownFunction; 36 show hasStrictArrow;
37 37
38 /** 38 /**
39 * A visitor used to traverse an AST structure looking for additional errors and 39 * A visitor used to traverse an AST structure looking for additional errors and
40 * warnings not covered by the parser and resolver. 40 * warnings not covered by the parser and resolver.
41 */ 41 */
42 class ErrorVerifier extends RecursiveAstVisitor<Object> { 42 class ErrorVerifier extends RecursiveAstVisitor<Object> {
43 /** 43 /**
44 * Static final string with value `"getter "` used in the construction of the 44 * Static final string with value `"getter "` used in the construction of the
45 * [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE], and 45 * [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE], and
46 * similar, error code messages. 46 * similar, error code messages.
(...skipping 6194 matching lines...) Expand 10 before | Expand all | Expand 10 after
6241 DartType staticReturnType = getStaticType(returnExpression); 6241 DartType staticReturnType = getStaticType(returnExpression);
6242 if (staticReturnType != null && _enclosingFunction.isAsynchronous) { 6242 if (staticReturnType != null && _enclosingFunction.isAsynchronous) {
6243 return _typeProvider.futureType.instantiate( 6243 return _typeProvider.futureType.instantiate(
6244 <DartType>[staticReturnType.flattenFutures(_typeSystem)]); 6244 <DartType>[staticReturnType.flattenFutures(_typeSystem)]);
6245 } 6245 }
6246 return staticReturnType; 6246 return staticReturnType;
6247 } 6247 }
6248 6248
6249 bool _expressionIsAssignableAtType(Expression expression, 6249 bool _expressionIsAssignableAtType(Expression expression,
6250 DartType actualStaticType, DartType expectedStaticType) { 6250 DartType actualStaticType, DartType expectedStaticType) {
6251 bool concrete = _options.strongMode && checker.isKnownFunction(expression); 6251 bool concrete = _options.strongMode && checker.hasStrictArrow(expression);
6252 if (concrete && actualStaticType is FunctionType) { 6252 if (concrete && actualStaticType is FunctionType) {
6253 actualStaticType = 6253 actualStaticType =
6254 _typeSystem.functionTypeToConcreteType(actualStaticType); 6254 _typeSystem.functionTypeToConcreteType(actualStaticType);
6255 // TODO(leafp): Move the Downcast functionality here. 6255 // TODO(leafp): Move the Downcast functionality here.
6256 } 6256 }
6257 return _typeSystem.isAssignableTo(actualStaticType, expectedStaticType); 6257 return _typeSystem.isAssignableTo(actualStaticType, expectedStaticType);
6258 } 6258 }
6259 6259
6260 MethodElement _findOverriddenMemberThatMustCallSuper(MethodDeclaration node) { 6260 MethodElement _findOverriddenMemberThatMustCallSuper(MethodDeclaration node) {
6261 ExecutableElement overriddenMember = _getOverriddenMember(node.element); 6261 ExecutableElement overriddenMember = _getOverriddenMember(node.element);
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
7077 class _InvocationCollector extends RecursiveAstVisitor { 7077 class _InvocationCollector extends RecursiveAstVisitor {
7078 final List<String> superCalls = <String>[]; 7078 final List<String> superCalls = <String>[];
7079 7079
7080 @override 7080 @override
7081 visitMethodInvocation(MethodInvocation node) { 7081 visitMethodInvocation(MethodInvocation node) {
7082 if (node.target is SuperExpression) { 7082 if (node.target is SuperExpression) {
7083 superCalls.add(node.methodName.name); 7083 superCalls.add(node.methodName.name);
7084 } 7084 }
7085 } 7085 }
7086 } 7086 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/task/strong/checker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698