]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/decomposed/DecomposedExpression.java
(refs #7278, refs #7279) Small fixes to InternalCompilerExceptions
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / internal / elaboration / decomposed / DecomposedExpression.java
index 0ad3096b237a9c0d3279af6295f87f7b9c15f2a7..64e859253d39e16cbe62282b7f39355dd4f0553f 100644 (file)
@@ -7,6 +7,7 @@ import org.simantics.scl.compiler.elaboration.expressions.ELambdaType;
 import org.simantics.scl.compiler.elaboration.expressions.ESimpleLambda;
 import org.simantics.scl.compiler.elaboration.expressions.Expression;
 import org.simantics.scl.compiler.elaboration.expressions.Variable;
+import org.simantics.scl.compiler.errors.ErrorLog;
 import org.simantics.scl.compiler.top.SCLCompilerConfiguration;
 import org.simantics.scl.compiler.types.TVar;
 import org.simantics.scl.compiler.types.Type;
@@ -34,7 +35,7 @@ public class DecomposedExpression {
         this.body = body;
     }
 
-    public static DecomposedExpression decompose(Expression expression) {
+    public static DecomposedExpression decompose(ErrorLog errorLog, Expression expression) {
         ArrayList<TVar> typeParameterList = new ArrayList<TVar>();
         ArrayList<Variable> parameterList = new ArrayList<Variable>();
         Type effect = Types.NO_EFFECTS;
@@ -42,9 +43,9 @@ public class DecomposedExpression {
             if(expression instanceof ESimpleLambda) {
                 ESimpleLambda lambda = (ESimpleLambda)expression;
                 parameterList.add(lambda.parameter);
-                expression = lambda.value;
                 if(Types.canonical(effect) != Types.NO_EFFECTS)
-                    throw new InternalCompilerError();
+                    errorLog.logWarning(expression.location, "Encountered nested lambdas where outermost lambda contains effects. The reason is probably in the subsumption solver and code should be OK.");
+                expression = lambda.value;
                 effect = Types.simplifyFinalEffect(lambda.getLocalEffect());
             } 
             else if(expression instanceof ELambdaType) {