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;
@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 {
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();
+ context.declareEffect(location, effect);
+ }
+ else
+ effect = Types.NO_EFFECTS;
Type inType = in.getType();
setType(inType);
return this;