mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-08 18:30:42 +00:00
partly fix issues with failing sub inference
This commit is contained in:
parent
34a727e0c0
commit
cadc299791
@ -63,10 +63,10 @@ public class Tree implements TermVisitorTree {
|
||||
|
||||
this.stepFactory = lambdaTerm.hasLet() || partOfLetTerm ? new StepFactoryWithLet() : new StepFactoryDefault();
|
||||
|
||||
this.failedSubInference = false;
|
||||
|
||||
this.firstTypeVariable = typeVarFactory.nextTypeVariable();
|
||||
this.firstInferenceStep = lambdaTerm.accept(this, typeAssumptions, firstTypeVariable);
|
||||
|
||||
this.failedSubInference = false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -48,6 +48,7 @@ public class LatexCreatorConstraints implements StepVisitor {
|
||||
|
||||
protected List<String> getEverything() {
|
||||
List<String> result = new ArrayList<>(constraints);
|
||||
if (typeInferer.getUnificationSteps().isPresent()) {
|
||||
generateUnification().forEach(step -> {
|
||||
result.add(step);
|
||||
numberGenerator.push();
|
||||
@ -59,6 +60,7 @@ public class LatexCreatorConstraints implements StepVisitor {
|
||||
numberGenerator.push();
|
||||
});
|
||||
// todo add some helpful text for the user
|
||||
}
|
||||
if (FIRST_PREFIX.equals(prefix)) {
|
||||
result.replaceAll(content -> ALIGN_BEGIN + content + ALIGN_END);
|
||||
}
|
||||
@ -126,6 +128,10 @@ public class LatexCreatorConstraints implements StepVisitor {
|
||||
constraints.get(constraints.size() - 1) + LATEX_NEW_LINE + NEW_LINE);
|
||||
constraints.addAll(subCreator.getEverything());
|
||||
|
||||
// cancels constraint creation if sub inference failed
|
||||
if (letD.getTypeInferer().getMGU().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
// adds one step in which all let constraints are added to 'outer' constraint set
|
||||
String letConstraints = createLetConstraints(letD.getTypeInferer().getLetConstraints());
|
||||
prevStep = prevStep.equals("") ? letConstraints : prevStep + COMMA + letConstraints;
|
||||
|
@ -23,7 +23,8 @@ public class ExampleDialog extends Dialog implements LocaleChangeObserver {
|
||||
|
||||
private static final List<String> EXAMPLES =
|
||||
List.of("λx.x", "λx.λy.y x", "λx.λy.y (x x)", "let f = λx. g y y in f 3", "(λx.x x) (λx.x x)",
|
||||
"(λx.λy.y (x y)) (λz. λa. z g a)", "let f = λx. let g = λy. y in g x in f 3");
|
||||
"(λx.λy.y (x y)) (λz. λa. z g a)", "let f = λx. let g = λy. y in g x in f 3",
|
||||
"let f = λx. let g = λy.5 5 in g x in f 3");
|
||||
private final Paragraph instruction;
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user