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

Unified Diff: pkg/front_end/lib/src/fasta/type_inference/type_schema_environment.dart

Issue 2946273002: Implement override-based type inference for instance methods. (Closed)
Patch Set: Created 3 years, 6 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/front_end/lib/src/fasta/type_inference/type_schema_environment.dart
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_schema_environment.dart b/pkg/front_end/lib/src/fasta/type_inference/type_schema_environment.dart
index 4336d919eaca55405599ca5ea3f1f6d53c9cc72e..40b8d06b447b869da141a74b6aa12f1267a59927 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_schema_environment.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_schema_environment.dart
@@ -13,6 +13,23 @@ import 'package:kernel/core_types.dart';
import 'package:kernel/type_algebra.dart';
import 'package:kernel/type_environment.dart';
+// TODO(paulberry): try to push this functionality into kernel.
+FunctionType substituteTypeParams(
+ FunctionType type,
+ Map<TypeParameter, DartType> substitutionMap,
+ List<TypeParameter> newTypeParameters) {
+ var substitution = Substitution.fromMap(substitutionMap);
+ return new FunctionType(
+ type.positionalParameters.map(substitution.substituteType).toList(),
+ substitution.substituteType(type.returnType),
+ namedParameters: type.namedParameters
+ .map((named) => new NamedType(
+ named.name, substitution.substituteType(named.type)))
+ .toList(),
+ typeParameters: newTypeParameters,
Siggi Cherem (dart-lang) 2017/06/21 20:19:08 Just making sure I follow the change here. Before
Paul Berry 2017/06/21 20:54:47 That's right. It was a bug which happened to be b
+ requiredParameterCount: type.requiredParameterCount);
+}
+
/// A constraint on a type parameter that we're inferring.
class TypeConstraint {
/// The lower bound of the type being constrained. This bound must be a

Powered by Google App Engine
This is Rietveld 408576698