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

Unified Diff: pkg/compiler/lib/src/resolution/resolution_strategy.dart

Issue 2983483002: Check function type equivalence (Closed)
Patch Set: Created 3 years, 5 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: pkg/compiler/lib/src/resolution/resolution_strategy.dart
diff --git a/pkg/compiler/lib/src/resolution/resolution_strategy.dart b/pkg/compiler/lib/src/resolution/resolution_strategy.dart
index 98222e2b3d4407b423c6b27e680af21a11fc1b34..a73a07ed2393b18e05197692a6d3b35f50282f35 100644
--- a/pkg/compiler/lib/src/resolution/resolution_strategy.dart
+++ b/pkg/compiler/lib/src/resolution/resolution_strategy.dart
@@ -648,7 +648,20 @@ class _CompilerElementEnvironment implements ElementEnvironment {
return method.constructor.type;
}
method.computeType(_resolution);
- return method.type;
+ ResolutionFunctionType type = method.type;
+ if (method.isConstructor) {
+ ConstructorElement constructor = method;
+ if (constructor.definingConstructor != null) {
+ // The type of a defining constructor doesn't use the right type
+ // variables. Substitute the type variable of the defining class by the
+ // type variables of the enclosing class.
+ ClassElement definingClass =
+ constructor.definingConstructor.enclosingClass;
+ type = type.substByContext(
+ method.enclosingClass.thisType.asInstanceOf(definingClass));
+ }
+ }
+ return type;
}
@override
« no previous file with comments | « pkg/compiler/lib/src/kernel/element_map_impl.dart ('k') | tests/compiler/dart2js/equivalence/check_functions.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698