fix compiling errors after changing TypeAbstrarction's quantifiedVariables from list to set

This commit is contained in:
Johanna Stuber 2021-02-04 10:25:19 +01:00
parent a80d1f9059
commit e4e4fca350
3 changed files with 8 additions and 14 deletions

View File

@ -1,16 +1,15 @@
package edu.kit.typicalc.model.parser;
import edu.kit.typicalc.model.parser.Token.TokenType;
import edu.kit.typicalc.model.term.VarTerm;
import edu.kit.typicalc.model.type.FunctionType;
import edu.kit.typicalc.model.type.NamedType;
import edu.kit.typicalc.model.type.Type;
import edu.kit.typicalc.model.type.TypeAbstraction;
import edu.kit.typicalc.model.parser.Token.TokenType;
import edu.kit.typicalc.util.Result;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@ -34,7 +33,7 @@ public class TypeAssumptionParser {
if (parsedType.isError()) {
return new Result<>(null, parsedType.unwrapError());
}
return new Result<>(new TypeAbstraction(parsedType.unwrap().getLeft(), Collections.emptyList()));
return new Result<>(new TypeAbstraction(parsedType.unwrap().getLeft()));
}
private Result<Pair<Type, Integer>, ParseError> parseType(LambdaLexer lexer, int parenCount) {

View File

@ -9,7 +9,6 @@ import nl.jqno.equalsverifier.EqualsVerifier;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
@ -23,7 +22,7 @@ class ConclusionTest {
@BeforeAll
static void setUp() {
TYPE_ASSUMPTIONS.put(new VarTerm("var2"), new TypeAbstraction(new NamedType("type2"), new ArrayList<>()));
TYPE_ASSUMPTIONS.put(new VarTerm("var2"), new TypeAbstraction(new NamedType("type2")));
}
@Test

View File

@ -8,7 +8,6 @@ import edu.kit.typicalc.model.type.TypeAbstraction;
import edu.kit.typicalc.util.Result;
import org.junit.jupiter.api.Test;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@ -29,7 +28,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
assertEquals(1, types.size());
Map.Entry<VarTerm, TypeAbstraction> assumption = types.entrySet().stream().findFirst().get();
assertEquals(new VarTerm("a"), assumption.getKey());
assertEquals(new TypeAbstraction(INT, Collections.emptyList()), assumption.getValue());
assertEquals(new TypeAbstraction(INT), assumption.getValue());
}
@Test
@ -43,7 +42,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
assertEquals(1, types.size());
Map.Entry<VarTerm, TypeAbstraction> assumption = types.entrySet().stream().findFirst().get();
assertEquals(new VarTerm("id"), assumption.getKey());
assertEquals(new TypeAbstraction(new FunctionType(INT, INT), Collections.emptyList()), assumption.getValue());
assertEquals(new TypeAbstraction(new FunctionType(INT, INT)), assumption.getValue());
HashMap<String, String> assumptions2 = new HashMap<>();
assumptions2.put("f", "int -> int -> int");
@ -61,8 +60,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
new FunctionType(
INT,
new FunctionType(INT, INT)
),
Collections.emptyList()), assumption.getValue());
)), assumption.getValue());
}
@Test
@ -84,8 +82,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
new FunctionType(
new FunctionType(INT, INT),
new FunctionType(BOOLEAN, BOOLEAN)
),
Collections.emptyList()), assumption.getValue());
)), assumption.getValue());
parser = new TypeAssumptionParser();
HashMap<String, String> assumptions2 = new HashMap<>();
assumptions2.put("id", "((int -> int) -> (boolean -> boolean)) -> ((int2 -> boolean2) -> (boolean2 -> int2))");
@ -111,7 +108,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
new FunctionType(int2, boolean2),
new FunctionType(boolean2, int2)
)
),
Collections.emptyList()), assumption.getValue());
)), assumption.getValue());
}
}