|
@@ -11,42 +11,16 @@ import org.openzen.zencode.shared.CompileExceptionCode;
|
11
|
11
|
import org.openzen.zenscript.codemodel.CompareType;
|
12
|
12
|
import org.openzen.zenscript.codemodel.GenericName;
|
13
|
13
|
import org.openzen.zenscript.codemodel.OperatorType;
|
14
|
|
-import org.openzen.zenscript.codemodel.expression.CallArguments;
|
15
|
|
-import org.openzen.zenscript.codemodel.expression.CheckNullExpression;
|
16
|
|
-import org.openzen.zenscript.codemodel.expression.Expression;
|
17
|
|
-import org.openzen.zenscript.codemodel.expression.InterfaceCastExpression;
|
18
|
|
-import org.openzen.zenscript.codemodel.expression.InvalidExpression;
|
19
|
|
-import org.openzen.zenscript.codemodel.expression.NullExpression;
|
20
|
|
-import org.openzen.zenscript.codemodel.expression.StorageCastExpression;
|
21
|
|
-import org.openzen.zenscript.codemodel.expression.SupertypeCastExpression;
|
22
|
|
-import org.openzen.zenscript.codemodel.expression.WrapOptionalExpression;
|
23
|
|
-import org.openzen.zenscript.codemodel.generic.TypeParameterBound;
|
|
14
|
+import org.openzen.zenscript.codemodel.expression.*;
|
24
|
15
|
import org.openzen.zenscript.codemodel.member.EnumConstantMember;
|
25
|
16
|
import org.openzen.zenscript.codemodel.member.IDefinitionMember;
|
26
|
17
|
import org.openzen.zenscript.codemodel.member.InnerDefinition;
|
27
|
|
-import org.openzen.zenscript.codemodel.member.ref.CasterMemberRef;
|
28
|
|
-import org.openzen.zenscript.codemodel.member.ref.ConstMemberRef;
|
29
|
|
-import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
|
30
|
|
-import org.openzen.zenscript.codemodel.member.ref.FieldMemberRef;
|
31
|
|
-import org.openzen.zenscript.codemodel.member.ref.FunctionalMemberRef;
|
32
|
|
-import org.openzen.zenscript.codemodel.member.ref.GetterMemberRef;
|
33
|
|
-import org.openzen.zenscript.codemodel.member.ref.ImplementationMemberRef;
|
34
|
|
-import org.openzen.zenscript.codemodel.member.ref.IteratorMemberRef;
|
35
|
|
-import org.openzen.zenscript.codemodel.member.ref.SetterMemberRef;
|
36
|
|
-import org.openzen.zenscript.codemodel.member.ref.VariantOptionRef;
|
37
|
|
-import org.openzen.zenscript.codemodel.partial.IPartialExpression;
|
38
|
|
-import org.openzen.zenscript.codemodel.partial.PartialMemberGroupExpression;
|
39
|
|
-import org.openzen.zenscript.codemodel.partial.PartialStaticMemberGroupExpression;
|
40
|
|
-import org.openzen.zenscript.codemodel.partial.PartialTypeExpression;
|
41
|
|
-import org.openzen.zenscript.codemodel.partial.PartialVariantOptionExpression;
|
|
18
|
+import org.openzen.zenscript.codemodel.member.ref.*;
|
|
19
|
+import org.openzen.zenscript.codemodel.partial.*;
|
42
|
20
|
import org.openzen.zenscript.codemodel.scope.TypeScope;
|
43
|
21
|
import org.openzen.zenscript.codemodel.type.*;
|
44
|
22
|
|
45
|
|
-import java.util.ArrayList;
|
46
|
|
-import java.util.HashMap;
|
47
|
|
-import java.util.List;
|
48
|
|
-import java.util.Map;
|
49
|
|
-import java.util.Set;
|
|
23
|
+import java.util.*;
|
50
|
24
|
|
51
|
25
|
/**
|
52
|
26
|
*
|
|
@@ -82,6 +56,36 @@ public final class TypeMembers {
|
82
|
56
|
|
83
|
57
|
public boolean extendsOrImplements(TypeID other) {
|
84
|
58
|
other = other.getNormalized();
|
|
59
|
+ checkBoundaries:
|
|
60
|
+ if(this.type.type instanceof DefinitionTypeID && other instanceof DefinitionTypeID) {
|
|
61
|
+ DefinitionTypeID thisTypeId = (DefinitionTypeID) this.type.type;
|
|
62
|
+ DefinitionTypeID otherTypeId = (DefinitionTypeID) other;
|
|
63
|
+
|
|
64
|
+ if(thisTypeId.definition != otherTypeId.definition){
|
|
65
|
+ break checkBoundaries;
|
|
66
|
+ }
|
|
67
|
+
|
|
68
|
+ if(thisTypeId.definition.typeParameters.length != otherTypeId.typeArguments.length){
|
|
69
|
+ break checkBoundaries;
|
|
70
|
+ }
|
|
71
|
+
|
|
72
|
+ for (int i = 0; i < thisTypeId.definition.typeParameters.length; i++) {
|
|
73
|
+ final TypeID type = otherTypeId.typeArguments[i].type;
|
|
74
|
+ if (type == BasicTypeID.UNDETERMINED) {
|
|
75
|
+ continue;
|
|
76
|
+ }
|
|
77
|
+ if (type instanceof InvalidTypeID && ((InvalidTypeID) type).code == CompileExceptionCode.TYPE_ARGUMENTS_NOT_INFERRABLE) {
|
|
78
|
+ continue;
|
|
79
|
+ }
|
|
80
|
+ if (thisTypeId.definition.typeParameters[i].matches(cache, type)) {
|
|
81
|
+ continue;
|
|
82
|
+ }
|
|
83
|
+ break checkBoundaries;
|
|
84
|
+ }
|
|
85
|
+ return true;
|
|
86
|
+ }
|
|
87
|
+
|
|
88
|
+
|
85
|
89
|
TypeID superType = type.type.getSuperType(cache.getRegistry());
|
86
|
90
|
if (superType != null) {
|
87
|
91
|
if (superType == other)
|