Index: dart/sdk/lib/_internal/compiler/implementation/typechecker.dart |
=================================================================== |
--- dart/sdk/lib/_internal/compiler/implementation/typechecker.dart (revision 31731) |
+++ dart/sdk/lib/_internal/compiler/implementation/typechecker.dart (working copy) |
@@ -1334,10 +1334,19 @@ |
if (Elements.isUnresolved(constructor)) return types.dynamicType; |
DartType constructorType = constructor.computeType(compiler); |
if (identical(type.kind, TypeKind.INTERFACE)) { |
- InterfaceType interfaceType = type; |
- constructorType = constructorType.subst( |
- interfaceType.typeArguments, |
- interfaceType.element.typeVariables); |
+ if (constructor.isSynthesized) { |
+ // TODO(johnniwinther): Remove this when synthesized constructors handle |
+ // type variables correctly. |
+ InterfaceType interfaceType = type; |
+ ClassElement receiverElement = interfaceType.element; |
+ while (receiverElement.isMixinApplication) { |
+ receiverElement = receiverElement.supertype.element; |
+ } |
+ constructorType = constructorType.substByContext( |
+ interfaceType.asInstanceOf(receiverElement)); |
+ } else { |
+ constructorType = constructorType.substByContext(type); |
+ } |
} |
return constructorType; |
} |