| 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 cf4f8226714d4f5000d77144aabbec8cde263ec4..b6882bc4368293ddd41074a32329e6acc3b5f637 100644
|
| --- a/pkg/analyzer/lib/src/task/strong/info.dart
|
| +++ b/pkg/analyzer/lib/src/task/strong/info.dart
|
| @@ -133,9 +133,12 @@ abstract class DownCast extends CoercionInfo {
|
| return new UninferredClosure(rules, expression, cast);
|
| }
|
| if (expression is InstanceCreationExpression) {
|
| - // fromT should be an exact type - this will almost certainly fail at
|
| - // runtime.
|
| - return new StaticTypeError(rules, expression, toT, reason: reason);
|
| + 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);
|
| + }
|
| }
|
|
|
| // TODO(vsm): Change this to an assert when we have generic methods and
|
|
|