forked from JavaTX/JavaCompilerCore
fixed bug where constraints in test had undefinded placeholder
This commit is contained in:
parent
3863968a6e
commit
8f8ee9a385
@ -75,11 +75,17 @@ public class UnifyTest {
|
||||
type1 = new ReferenceType("Object");
|
||||
type2 = new ReferenceType("Number");
|
||||
constraints.add(new UnifyPair(type1, type2, PairOperator.SMALLER));
|
||||
type1 = new ReferenceType("AbstractList", new TypeParams(new PlaceholderType("X")));
|
||||
/* type1 = new ReferenceType("AbstractList", new TypeParams(new PlaceholderType("X")));
|
||||
type2 = new ReferenceType("List", new TypeParams(new PlaceholderType("X")));
|
||||
constraints.add(new UnifyPair(type1, type2, PairOperator.SMALLER));
|
||||
type1 = new ReferenceType("Object");
|
||||
type2 = new ReferenceType("AbstractList", new TypeParams(new PlaceholderType("X")));
|
||||
constraints.add(new UnifyPair(type1, type2, PairOperator.SMALLER));*/
|
||||
type1 = new ReferenceType("AbstractList");
|
||||
type2 = new ReferenceType("List");
|
||||
constraints.add(new UnifyPair(type1, type2, PairOperator.SMALLER));
|
||||
type1 = new ReferenceType("Object");
|
||||
type2 = new ReferenceType("AbstractList");
|
||||
constraints.add(new UnifyPair(type1, type2, PairOperator.SMALLER));
|
||||
|
||||
IFiniteClosure finiteClosure = new FiniteClosure(constraints, new NullWriter());
|
||||
@ -95,7 +101,7 @@ public class UnifyTest {
|
||||
@Test
|
||||
public void smallUnifyTest(){
|
||||
UnifyType type1 = new PlaceholderType("a");
|
||||
UnifyType type2 = new ReferenceType("Integer");
|
||||
UnifyType type2 = new ReferenceType("List", new TypeParams(new ReferenceType("Integer")));
|
||||
UnifyPair pair1 = new UnifyPair(type1, type2, PairOperator.SMALLERDOT);
|
||||
|
||||
Set<UnifyPair> undConstraints = new HashSet<>();
|
||||
@ -105,6 +111,9 @@ public class UnifyTest {
|
||||
|
||||
Set<UnifyPair> constraints = new HashSet<>();
|
||||
type1 = new ReferenceType("Object");
|
||||
type2 = new ReferenceType("List");
|
||||
constraints.add(new UnifyPair(type1, type2, PairOperator.SMALLER));
|
||||
type1 = new ReferenceType("Object");
|
||||
type2 = new ReferenceType("Integer");
|
||||
constraints.add(new UnifyPair(type1, type2, PairOperator.SMALLER));
|
||||
|
||||
@ -116,6 +125,7 @@ public class UnifyTest {
|
||||
UnifyTaskModel tasks = new UnifyTaskModel();
|
||||
Set<Set<UnifyPair>> solution = unifyAlgo.unify(undConstraints, oderConstraints, finiteClosure, new NullWriter(), false, urm, tasks);
|
||||
System.out.println(solution.size());
|
||||
System.out.println(solution);
|
||||
}
|
||||
/*
|
||||
@Test
|
||||
|
Loading…
x
Reference in New Issue
Block a user