extended case 5

This commit is contained in:
Florian Steurer 2016-04-08 18:28:34 +02:00
parent 5c73224f8f
commit 41b3e4f6c2
2 changed files with 29 additions and 5 deletions

View File

@ -463,7 +463,14 @@ public class Unify {
Set<Set<UnifyPair>> result = new HashSet<>();
for(UnifyType thetaS : fc.greater(theta)) {
Set<UnifyPair> resultPrime = new HashSet<>();
resultPrime.add(new UnifyPair(a, thetaS, PairOperator.EQUALSDOT));
UnifyType[] freshTphs = new UnifyType[thetaS.getTypeParams().size()];
for(int i = 0; i < freshTphs.length; i++) {
freshTphs[i] = PlaceholderType.freshPlaceholder();
resultPrime.add(new UnifyPair(thetaS.getTypeParams().get(i), freshTphs[i], PairOperator.SMALLERDOTWC));
}
resultPrime.add(new UnifyPair(a, thetaS.setTypeParams(new TypeParams(freshTphs)), PairOperator.EQUALSDOT));
result.add(resultPrime);
}

View File

@ -457,11 +457,28 @@ public class UnifyTest extends Unify {
//Assert.assertEquals(expected, actual);
/*
* Test 4:
* This is a test for the extension of case 4 of the cartesian product of step 4.
*
*
* Case 4 has no extension
*/
/*
* Test 5:
* This is a test for the extension of case 5 of the cartesian product of step 4.
*
* Vector<b> <. a
* b =. Number
*/
eq = new HashSet<>();
eq.add(new UnifyPair(tf.getSimpleType("HashSet", tphB), tphA, PairOperator.SMALLERDOT));
eq.add(new UnifyPair(tphB, number, PairOperator.EQUALSDOT));
expected = new HashSet<>();
actual = unify(eq, fc);
System.out.println(actual);
//Assert.assertEquals(expected, actual);
}
@Test