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%2FEBind.java;h=84cc220c1a0222e75def8781fe657eaff1a88aa3;hp=5664db7bfdd768f17dbbda87c45a5c6abb8ae995;hb=3ccd513530bc718ef384780d3151ddbb85600986;hpb=c7adae2a1ad46c9f316093213df0320b44461606 diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EBind.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EBind.java index 5664db7bf..84cc220c1 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EBind.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EBind.java @@ -11,6 +11,7 @@ import org.simantics.scl.compiler.elaboration.modules.SCLValue; import org.simantics.scl.compiler.errors.Locations; import org.simantics.scl.compiler.internal.codegen.references.IVal; import org.simantics.scl.compiler.internal.codegen.writer.CodeWriter; +import org.simantics.scl.compiler.internal.header.ModuleHeader; import org.simantics.scl.compiler.types.Type; import org.simantics.scl.compiler.types.Types; import org.simantics.scl.compiler.types.exceptions.MatchException; @@ -52,7 +53,11 @@ public class EBind extends SimplifiableExpression { @Override public Expression checkBasicType(TypingContext context, Type requiredType) { + ModuleHeader header = context.getCompilationContext().header; + boolean edo = header != null && header.edo; + monadType = Types.metaVar(Kinds.STAR_TO_STAR); + inContentType = Types.metaVar(Kinds.STAR); Type monadContent = Types.apply(monadType, inContentType); try { @@ -71,9 +76,13 @@ public class EBind extends SimplifiableExpression { pattern = pattern.checkTypeAsPattern(context, Types.metaVar(Kinds.STAR)); valueContentType = pattern.getType(); value = value.checkType(context, Types.apply(monadType, valueContentType)); - context.pushEffectUpperBound(location, blockType == BlockType.Monad ? Types.NO_EFFECTS : Types.metaVar(Kinds.EFFECT)); + if(edo) + context.pushEffectUpperBound(location, blockType == BlockType.Monad ? Types.NO_EFFECTS : Types.metaVar(Kinds.EFFECT)); in = in.checkType(context, requiredType); - effect = context.popEffectUpperBound(); + if(edo) + effect = context.popEffectUpperBound(); + else + effect = Types.NO_EFFECTS; Type inType = in.getType(); setType(inType); return this;