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;
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;
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) {