X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Ftypes%2FTypes.java;h=e6454fc0c22fcc6561fbe82cb6f96dc651b21b3c;hb=55ca14c;hp=f0c9dbddfb2e1383ff746aa9b1a1ce7f1f12e552;hpb=9a175feb652b2b7bba7afa540831b9076be3c10e;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/Types.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/Types.java index f0c9dbddf..e6454fc0c 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/Types.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/Types.java @@ -86,6 +86,8 @@ public class Types { public static final TCon VEC_COMP = con(BUILTIN, "VecComp"); public static final TCon BINDING = con(BUILTIN, "Binding"); + public static final TCon TYPE = con(BUILTIN, "Type"); + public static final TCon DYNAMIC = con("Prelude", "Dynamic"); public static final TCon VARIANT = con(BUILTIN, "Variant"); @@ -152,11 +154,13 @@ public class Types { * Get the concrete type pointed to by a chain of type meta-variables. */ public static Type canonical(Type type) { - while(type instanceof TMetaVar) { + if(type instanceof TMetaVar) { TMetaVar metaVar = (TMetaVar)type; type = metaVar.ref; if(type == null) return metaVar; + else + return metaVar.ref = canonical(type); } return type; } @@ -552,7 +556,15 @@ public class Types { parameters.add(Types.canonical(apply.parameter)); type = canonical(apply.function); } - return new MultiApply(type, parameters.toArray(new Type[parameters.size()])); + Type[] parametersArray; + if(parameters.isEmpty()) + parametersArray = Type.EMPTY_ARRAY; + else { + parametersArray = new Type[parameters.size()]; + for(int i=0,j=parametersArray.length-1;i