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

Unified Diff: pkg/analyzer/lib/src/task/strong/checker.dart

Issue 1699463002: Remove redundant verbiage on inference failure errors. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Finish tearing out unused reason. Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/task/strong/info.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/task/strong/checker.dart
diff --git a/pkg/analyzer/lib/src/task/strong/checker.dart b/pkg/analyzer/lib/src/task/strong/checker.dart
index a67251e7905f1279f3841bb9da968481d640e5a6..3883f952908703594fc3c69d6db8380a6c402d98 100644
--- a/pkg/analyzer/lib/src/task/strong/checker.dart
+++ b/pkg/analyzer/lib/src/task/strong/checker.dart
@@ -569,15 +569,7 @@ class CodeChecker extends RecursiveAstVisitor {
final Coercion c = _coerceTo(fromT, toT);
if (c is Identity) return null;
if (c is CoercionError) return new StaticTypeError(rules, expr, toT);
- var reason = null;
-
- var errors = <String>[];
-
- var ok = _inferExpression(expr, toT, errors);
- if (ok) return InferredType.create(rules, expr, toT);
- reason = (errors.isNotEmpty) ? errors.first : null;
-
- if (c is Cast) return DownCast.create(rules, expr, c, reason: reason);
+ if (c is Cast) return DownCast.create(rules, expr, c);
assert(false);
return null;
}
@@ -800,17 +792,6 @@ class CodeChecker extends RecursiveAstVisitor {
return null;
}
- /// Checks if we can perform downwards inference on [e] tp get type [t].
- /// If it is not possible, this will add a message to [errors].
- bool _inferExpression(Expression e, DartType t, List<String> errors) {
- DartType staticType = e.staticType ?? DynamicTypeImpl.instance;
- if (rules.isSubtypeOf(staticType, t)) {
- return true;
- }
- errors.add("$e cannot be typed as $t");
- return false;
- }
-
/// Returns `true` if the expression is a dynamic function call or method
/// invocation.
bool _isDynamicCall(Expression call) {
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/task/strong/info.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698