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

Unified Diff: pkg/analyzer/lib/src/task/strong/info.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 | « pkg/analyzer/lib/src/task/strong/checker.dart ('k') | no next file » | 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 82954395b981c280bf19aa23b365d4ea816a45c9..c3a58396d83da95d1cac5966860aa57397a84129 100644
--- a/pkg/analyzer/lib/src/task/strong/info.dart
+++ b/pkg/analyzer/lib/src/task/strong/info.dart
@@ -107,8 +107,7 @@ abstract class DownCast extends CoercionInfo {
// Factory to create correct DownCast variant.
static StaticInfo create(
- StrongTypeSystemImpl rules, Expression expression, Cast cast,
- {String reason}) {
+ StrongTypeSystemImpl rules, Expression expression, Cast cast) {
final fromT = cast.fromType;
final toT = cast.toType;
@@ -127,14 +126,15 @@ abstract class DownCast extends CoercionInfo {
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);
+ return new StaticTypeError(rules, expression, toT);
}
+
if (expression is InstanceCreationExpression) {
ConstructorElement e = expression.staticElement;
if (e == null || !e.isFactory) {
// fromT should be an exact type - this will almost certainly fail at
// runtime.
- return new StaticTypeError(rules, expression, toT, reason: reason);
+ return new StaticTypeError(rules, expression, toT);
}
}
@@ -148,7 +148,7 @@ abstract class DownCast extends CoercionInfo {
// declaration, will have an exact type, so we know a downcast will fail.
if (element is FunctionElement ||
element is MethodElement && element.isStatic) {
- return new StaticTypeError(rules, expression, toT, reason: reason);
+ return new StaticTypeError(rules, expression, toT);
}
// TODO(vsm): Change this to an assert when we have generic methods and
@@ -556,19 +556,15 @@ abstract class StaticInfo {
class StaticTypeError extends StaticError {
final DartType baseType;
final DartType expectedType;
- String reason = null;
- StaticTypeError(TypeSystem rules, Expression expression, this.expectedType,
- {this.reason})
+ StaticTypeError(TypeSystem rules, Expression expression, this.expectedType)
: baseType = expression.staticType ?? DynamicTypeImpl.instance,
super(expression);
@override
List<Object> get arguments => [node, baseType, expectedType];
@override
- String get message =>
- 'Type check failed: {0} ({1}) is not of type {2}' +
- ((reason == null) ? '' : ' because $reason');
+ String get message => 'Type check failed: {0} ({1}) is not of type {2}';
@override
String get name => 'STRONG_MODE_STATIC_TYPE_ERROR';
« no previous file with comments | « pkg/analyzer/lib/src/task/strong/checker.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698