X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Ftypes%2FTypes.java;h=9ea064cfd11bf4abf4094a900a53d9951dc24878;hp=e6454fc0c22fcc6561fbe82cb6f96dc651b21b3c;hb=1ec0193a5a5b8f368b03adb24acd762838ddf8ea;hpb=55ca14c4198659b908aeffc8d16e240b35a75e66 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 e6454fc0c..9ea064cfd 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 @@ -98,9 +98,7 @@ public class Types { public static final TCon ORDERED_RING = con("Prelude", "OrderedRing"); public static final TCon REAL = con("Prelude", "Real"); public static final TCon SHOW = con("Prelude", "Show"); - public static final TCon EQ = con("Prelude", "Eq"); public static final TCon ORD = con("Prelude", "Ord"); - public static final TCon HASHABLE = con("Prelude", "Hashable"); public static final TCon IO = con("Serialization", "IO"); public static final Type REF = con("Prelude", "Ref"); @@ -114,6 +112,9 @@ public class Types { public static final TCon PROC = con(BUILTIN, "Proc"); public static final TCon BRANCH_POINT = con(BUILTIN, "BranchPoint"); + + public static final TCon CHRContext = con(BUILTIN, "CHRContext"); + private volatile static TCon[] tupleCache = new TCon[] { UNIT, null @@ -130,7 +131,7 @@ public class Types { } }; - + public static boolean isPrimitive(Type type) { return type == BOOLEAN || type == BYTE || type == CHARACTER || type == SHORT || type == INTEGER || type == LONG || type == FLOAT || type == DOUBLE || type == STRING; @@ -1017,6 +1018,15 @@ public class Types { return result; } + public static TPred[] replace(TPred[] types, TVar[] from, Type[] to) { + if(types.length == 0) + return TPred.EMPTY_ARRAY; + TPred[] result = new TPred[types.length]; + for(int i=0;i Type[] replace(Type[] types, THashMap map) { if(types.length == 0) return Type.EMPTY_ARRAY; @@ -1034,6 +1044,10 @@ public class Types { else return new TUnion(effects); } + + public static Type union(Type effect1, Type effect2) { + return new TUnion(effect1, effect2); + } public static Type union(List effects) { if(effects.size() == 0)