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=8817eb23c6979c25acefb81f7be30c4d87a8bc7c;hb=50f197d8b0f5824e930c5829db3f808cb6d455f4;hp=a9d779bfd81f83d856278ce8c7e76c68282397f9;hpb=cc7c007fb930bb1453a529916f8cf2ba8d18f0e3;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 a9d779bfd..8817eb23c 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 @@ -6,6 +6,8 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +import org.simantics.scl.compiler.common.exceptions.InternalCompilerError; +import org.simantics.scl.compiler.environment.Environments; import org.simantics.scl.compiler.errors.Locations; import org.simantics.scl.compiler.internal.parsing.exceptions.SCLSyntaxErrorException; import org.simantics.scl.compiler.internal.parsing.parser.SCLParserImpl; @@ -642,7 +644,52 @@ public class Types { effect, type); } + + /** + * This function always success, but may return a multi function + * with arity smaller than given parameter + */ + public static MultiFunction unifyFunction2(Type type, int arity) { + type = canonical(type); + Type[] parameterTypes = new Type[arity]; + Type effect = Types.NO_EFFECTS; + int i; + for(i=0;i