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

Unified Diff: pkg/analyzer/lib/src/generated/static_type_analyzer.dart

Issue 2221233002: fix #27036, pass definite function types to LUB (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: rename Created 4 years, 4 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/task/strong/checker.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/static_type_analyzer.dart
diff --git a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
index 34530f004eb136f67a48e468486fb151205de897..5f089988e9c1567dae421fa306c288d335f4a163 100644
--- a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
+++ b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
@@ -17,6 +17,7 @@ import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer/src/generated/java_engine.dart';
import 'package:analyzer/src/generated/resolver.dart';
import 'package:analyzer/src/generated/utilities_dart.dart';
+import 'package:analyzer/src/task/strong/checker.dart' show getDefiniteType;
/**
* Instances of the class `StaticTypeAnalyzer` perform two type-related tasks. First, they
@@ -1423,8 +1424,8 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
*/
void _analyzeLeastUpperBound(
Expression node, Expression expr1, Expression expr2) {
- DartType staticType1 = _getStaticType(expr1);
- DartType staticType2 = _getStaticType(expr2);
+ DartType staticType1 = _getDefiniteType(expr1);
+ DartType staticType2 = _getDefiniteType(expr2);
if (staticType1 == null) {
// TODO(brianwilkerson) Determine whether this can still happen.
staticType1 = _dynamicType;
@@ -1653,6 +1654,17 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
}
/**
+ * Gets the definite type of expression, which can be used in cases where
+ * the most precise type is desired, for example computing the least upper
+ * bound.
+ *
+ * See [getDefiniteType] for more information. Without strong mode, this is
+ * equivalent to [_getStaticType].
+ */
+ DartType _getDefiniteType(Expression expr) =>
+ getDefiniteType(expr, _typeSystem, _typeProvider);
+
+ /**
* If the given element name can be mapped to the name of a class defined within the given
* library, return the type specified by the argument.
*
« 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