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

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

Issue 1627503002: remove obsolete UninferredClosure type (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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/test/src/task/strong/checker_test.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/info.dart
diff --git a/pkg/analyzer/lib/src/task/strong/info.dart b/pkg/analyzer/lib/src/task/strong/info.dart
index d9c912600eaab412ce05292c1655c62663fd9cc3..ade985dfa54f0b94a840cbdef9dd58d41c6bc10f 100644
--- a/pkg/analyzer/lib/src/task/strong/info.dart
+++ b/pkg/analyzer/lib/src/task/strong/info.dart
@@ -124,16 +124,11 @@ abstract class DownCast extends CoercionInfo {
}
// Inference "casts":
- if (expression is Literal) {
+ if (expression is Literal || expression is FunctionExpression) {
// fromT should be an exact type - this will almost certainly fail at
// runtime.
return new StaticTypeError(rules, expression, toT, reason: reason);
}
- if (expression is FunctionExpression) {
- // fromT should be an exact type - this will almost certainly fail at
- // runtime.
- return new UninferredClosure(rules, expression, cast);
- }
if (expression is InstanceCreationExpression) {
ConstructorElement e = expression.staticElement;
if (e == null || !e.isFactory) {
@@ -565,23 +560,3 @@ class StaticTypeError extends StaticError {
@override
String get name => 'STRONG_MODE_STATIC_TYPE_ERROR';
}
-
-//
-// Temporary "casts" of allocation sites - literals, constructor invocations,
-// and closures. These should be handled by contextual inference. In most
-// cases, inference will be sufficient, though in some it may unmask an actual
-// error: e.g.,
-// List<int> l = [1, 2, 3]; // Inference succeeds
-// List<String> l = [1, 2, 3]; // Inference reveals static type error
-// We're marking all as warnings for now.
-//
-// TODO(vsm,leafp): Remove this.
-class UninferredClosure extends DownCast {
- UninferredClosure(TypeSystem rules, FunctionExpression expression, Cast cast)
- : super._internal(rules, expression, cast);
-
- @override
- String get name => 'STRONG_MODE_UNINFERRED_CLOSURE';
-
- toErrorCode() => new StaticTypeWarningCode(name, message);
-}
« no previous file with comments | « no previous file | pkg/analyzer/test/src/task/strong/checker_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698