| Index: frog/type.dart
|
| diff --git a/frog/type.dart b/frog/type.dart
|
| index 15e3dc7edd1d18e1caa57f75ad9b32445da17e33..779e2003a07b3f46ec5b2b9df22b9d33181b0d9a 100644
|
| --- a/frog/type.dart
|
| +++ b/frog/type.dart
|
| @@ -109,6 +109,31 @@ class Type extends Element {
|
| return _hasNativeSubtypes;
|
| }
|
|
|
| + void _checkExtends() {
|
| + var typeParams = genericType.typeParameters;
|
| + if (typeParams != null && typeArgsInOrder != null) {
|
| + // TODO(jmesserly): making typeArgsInOrder be a List instead of a
|
| + // Collection would clean this up.
|
| + var args = typeArgsInOrder.iterator();
|
| + var params = typeParams.iterator();
|
| + while (args.hasNext() && params.hasNext()) {
|
| + var typeParam = params.next();
|
| + var typeArg = args.next();
|
| + if (typeParam.extendsType != null && typeArg != null) {
|
| + typeArg.ensureSubtypeOf(typeParam.extendsType, typeParam.span, true);
|
| + }
|
| + }
|
| + }
|
| +
|
| + // Parent should be handled by the super constructor call, but we still
|
| + // need to check our interfaces.
|
| + if (interfaces != null) {
|
| + for (var i in interfaces) {
|
| + i._checkExtends();
|
| + }
|
| + }
|
| + }
|
| +
|
| void _checkOverride(Member member) {
|
| // always look in parents to check that any overloads are legal
|
| var parentMember = _getMemberInParents(member.name);
|
| @@ -528,10 +553,11 @@ class ConcreteType extends Type {
|
| Library get library() => genericType.library;
|
| SourceSpan get span() => genericType.span;
|
|
|
| -
|
| bool get hasTypeParams() =>
|
| typeArguments.getValues().some((e) => e is ParameterType);
|
|
|
| + bool isUsed = false;
|
| +
|
| /**
|
| * Keeps a collection of members for which a concrete version needed to
|
| * be created. For constructors we always create this. For other methods,
|
| @@ -586,6 +612,8 @@ class ConcreteType extends Type {
|
| if (_subtypes == null) {
|
| _subtypes = new Set<Type>();
|
| for (var s in genericType.subtypes) {
|
| + // TODO(jmesserly): this substitution is not right if type names are
|
| + // different in the subtype.
|
| _subtypes.add(s.resolveTypeParams(this));
|
| }
|
| }
|
| @@ -613,12 +641,14 @@ class ConcreteType extends Type {
|
| }
|
|
|
| void markUsed() {
|
| + if (isUsed) return;
|
| +
|
| + isUsed = true;
|
| + _checkExtends();
|
| genericType.markUsed();
|
| }
|
| - void genMethod(Member method) {
|
| - genericType.genMethod(method);
|
| - }
|
|
|
| + void genMethod(Member method) => genericType.genMethod(method);
|
|
|
| getFactory(Type type, String constructorName) {
|
| return genericType.getFactory(type, constructorName);
|
| @@ -802,6 +832,8 @@ class DefinedType extends Type {
|
|
|
| isUsed = true;
|
|
|
| + _checkExtends();
|
| +
|
| if (_lazyGenMethods != null) {
|
| for (var method in orderValuesByKeys(_lazyGenMethods)) {
|
| world.gen.genMethod(method);
|
|
|