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

Unified Diff: sdk/lib/_internal/compiler/implementation/typechecker.dart

Issue 120423006: Compute correct constructor type for synthesized mixin constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use Platform.packageRoot. Created 6 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
Index: sdk/lib/_internal/compiler/implementation/typechecker.dart
diff --git a/sdk/lib/_internal/compiler/implementation/typechecker.dart b/sdk/lib/_internal/compiler/implementation/typechecker.dart
index 5dd026aa6ed882f957bd4466555d31f034784265..ff499fc4548274054087a5d8e703feb0980490af 100644
--- a/sdk/lib/_internal/compiler/implementation/typechecker.dart
+++ b/sdk/lib/_internal/compiler/implementation/typechecker.dart
@@ -1334,10 +1334,19 @@ class TypeCheckerVisitor extends Visitor<DartType> {
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;
}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/resolution/members.dart ('k') | tests/compiler/dart2js/memory_compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698