return ref.toTypeAst(context);
}
- @Override
- public int hashCode() {
- if(ref == null)
- return System.identityHashCode(this);
- else
- return ref.hashCode();
- }
-
@Override
public void updateHashCode(TypeHashCodeContext context) {
if(ref == null)
}
public void setRef(Type type) throws UnificationException {
+ if(type instanceof TMetaVar && ((TMetaVar)type).ref != null)
+ throw new InternalCompilerError("Not canonical!");
+ if(type == this)
+ throw new InternalCompilerError("Illegal setRef");
if(DEBUG)
System.out.println("setRef " + System.identityHashCode(this) + " -> " + type);
if(ref != null)
fireNotifyAboutChange();
}
+ @Override
+ public int hashCode() {
+ if(ref == null)
+ return System.identityHashCode(this);
+ else
+ return ref.hashCode();
+ }
+
@Override
public int hashCode(int hash) {
if(ref == null)
return ref.hashCode(hash, boundVars);
}
+ @Override
+ public int skeletonHashCode() {
+ if(ref != null)
+ return ref.skeletonHashCode();
+ else if(skeletonRef != null)
+ return skeletonRef.skeletonHashCode();
+ else
+ return System.identityHashCode(this);
+ }
+
+ @Override
+ public int skeletonHashCode(int hash) {
+ if(ref != null)
+ return ref.skeletonHashCode(hash);
+ else if(skeletonRef != null)
+ return skeletonRef.skeletonHashCode(hash);
+ else
+ return HashCodeUtils.update(hash, System.identityHashCode(this));
+ }
+
+ @Override
+ public int skeletonHashCode(int hash, TVar[] boundVars) {
+ if(ref != null)
+ return ref.skeletonHashCode(hash, boundVars);
+ else if(skeletonRef != null)
+ return skeletonRef.skeletonHashCode(hash, boundVars);
+ else
+ return HashCodeUtils.update(hash, System.identityHashCode(this));
+ }
+
@Override
public boolean equalsCanonical(Type other) {
return this == other;
public Kind getKind(Environment context) {
return kind;
}
+
+ @Override
+ public Type[] skeletonCanonicalChildren() {
+ // Assumes that this is already canonical skeleton
+ return EMPTY_ARRAY;
+ }
}