diff --git a/src/main/java/edu/kit/typicalc/model/TypeInfererLet.java b/src/main/java/edu/kit/typicalc/model/TypeInfererLet.java index 0241f5b..8bed6f4 100644 --- a/src/main/java/edu/kit/typicalc/model/TypeInfererLet.java +++ b/src/main/java/edu/kit/typicalc/model/TypeInfererLet.java @@ -33,10 +33,18 @@ public class TypeInfererLet extends TypeInferer { * C := { αi = σ(αi) | σ defined for αi } * * @return the constraints needed in the outer inference + * @throws IllegalStateException if the method is called despite missing mgu */ public List getLetConstraints() { - return new ArrayList<>(); - // TODO + if (this.getMGU().isEmpty()) { + throw new IllegalStateException("getLetConstraints() should never be called when no mgu was found"); + } + List letConstraints = new ArrayList<>(); + for (Substitution substitution : this.getMGU().get()) { + Constraint constraint = new Constraint(substitution.getVariable(), substitution.getType()); + letConstraints.add(constraint); + } + return letConstraints; } }