]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/Types.java
Merged changes from SVN
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / types / Types.java
index f0c9dbddfb2e1383ff746aa9b1a1ce7f1f12e552..5e8c548878e4b10e010cb6fc8f0f7cddc8da18ef 100644 (file)
@@ -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;
     }