package org.simantics.scl.compiler.internal.elaboration.subsumption; import java.util.ArrayList; import org.simantics.scl.compiler.common.exceptions.InternalCompilerError; import org.simantics.scl.compiler.internal.types.effects.EffectIdMap; import org.simantics.scl.compiler.top.SCLCompilerConfiguration; import org.simantics.scl.compiler.types.TMetaVar; import org.simantics.scl.compiler.types.Type; import org.simantics.scl.compiler.types.exceptions.UnificationException; public class Var { String name; int constLowerBound = EffectIdMap.MIN; int constUpperBound = EffectIdMap.MAX; int upperApprox = EffectIdMap.MAX; TMetaVar original; ArrayList simpleLowerBounds = new ArrayList(); ArrayList simpleUpperBounds = new ArrayList(); ArrayList complexLowerBounds = new ArrayList(); ArrayList complexUpperBounds = new ArrayList(); SubSolver solver; boolean dirty; public Var(TMetaVar original, String name, SubSolver solver) { this.original = original; this.name = name; this.solver = solver; markDirty(); } void markDirty() { if(!dirty) { dirty = true; solver.dirtyQueue.add(this); } } /** * Adds a constant constraint */ public void addUpperBound(int c) { c &= constUpperBound; if(c != constUpperBound) { if((c & constLowerBound) != constLowerBound) { solver.errorLog.log(solver.globalLoc, "Subsumption failed: " + solver.effectIds.toType(constLowerBound) + " is not a subtype of " + solver.effectIds.toType(c) ); return; } constUpperBound = c; for(int i=0;i