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%2Felaboration%2Fexpressions%2FEApply.java;fp=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Felaboration%2Fexpressions%2FEApply.java;h=06ff05c18bf4aec3cb60325734daa382e2544a92;hp=7f50d730b9f0d536fc91f6dfa439f8ccebc43fcd;hb=d09b3768f601b5ee977c2e80c23ef96e9879f8f1;hpb=1ca7c5aad9e845ca9969ea37c7d4bef54e94b9e2 diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EApply.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EApply.java index 7f50d730b..06ff05c18 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EApply.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EApply.java @@ -249,6 +249,12 @@ public class EApply extends Expression { current.setType(mfun.returnType); if(marity < current.parameters.length) { + if (marity == 0) { + // Cannot eat away any more parameters + context.getErrorLog().log(location, "Application of non-function"); + return current; + } + Expression[] missingParameters = Arrays.copyOfRange(current.parameters, marity, current.parameters.length); functionType = mfun.returnType; current.parameters = Arrays.copyOf(current.parameters, marity);