mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-08 18:30:42 +00:00
Fix tooltips in case of failed let inference
This commit is contained in:
parent
60ee1583fd
commit
90833c37b5
@ -98,6 +98,12 @@ public class StepAnnotator implements StepVisitor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visit(LetStepDefault letD) {
|
public void visit(LetStepDefault letD) {
|
||||||
|
// account for failed sub-inference
|
||||||
|
if (letD.getPremise() instanceof EmptyStep) { // TODO: there must be a better way to solve this!
|
||||||
|
annotations.add("");
|
||||||
|
letD.getTypeInferer().getFirstInferenceStep().accept(this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
visitGeneric2(List.of(
|
visitGeneric2(List.of(
|
||||||
Pair.of("_1", letD.getTypeInferer().getFirstInferenceStep().getConclusion().getType()),
|
Pair.of("_1", letD.getTypeInferer().getFirstInferenceStep().getConclusion().getType()),
|
||||||
Pair.of("_2", letD.getPremise().getConclusion().getType())),
|
Pair.of("_2", letD.getPremise().getConclusion().getType())),
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
package edu.kit.typicalc.model.step;
|
||||||
|
|
||||||
|
import edu.kit.typicalc.model.Model;
|
||||||
|
import edu.kit.typicalc.model.ModelImpl;
|
||||||
|
import edu.kit.typicalc.model.TypeInfererInterface;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
public class StepAnnotatorTest {
|
||||||
|
@Test
|
||||||
|
void canAnnotateFailedLetTerm() {
|
||||||
|
Model model = new ModelImpl();
|
||||||
|
TypeInfererInterface typer = model.getTypeInferer("let f = (λx.y x) (y 5) in λg.f 3", "y: int->(int->boolean)").unwrap();
|
||||||
|
typer.getFirstInferenceStep().accept(new StepAnnotator());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user