| 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';
|
|
|