extended case 6

This commit is contained in:
Florian Steurer 2016-04-08 18:48:35 +02:00
parent 41b3e4f6c2
commit d080eb4a0a
3 changed files with 29 additions and 8 deletions

View File

@ -479,11 +479,15 @@ public class Unify {
protected Set<Set<UnifyPair>> unifyCase6(ExtendsType extTheta, PlaceholderType a, IFiniteClosure fc) {
Set<Set<UnifyPair>> result = new HashSet<>();
for(UnifyType thetaS : fc.grArg(extTheta)) {
Set<UnifyPair> resultPrime = new HashSet<>();
resultPrime.add(new UnifyPair(a, thetaS, PairOperator.EQUALSDOT));
result.add(resultPrime);
}
//for(UnifyType thetaS : fc.smaller(extTheta.getExtendedType())) {
UnifyType freshTph = PlaceholderType.freshPlaceholder();
UnifyType extFreshTph = new ExtendsType(freshTph);
Set<UnifyPair> resultPrime = new HashSet<>();
resultPrime.add(new UnifyPair(a, extFreshTph, PairOperator.EQUALSDOT));
resultPrime.add(new UnifyPair(extTheta.getExtendedType(), freshTph, PairOperator.SMALLERDOT));
result.add(resultPrime);
//}
return result;
}

View File

@ -32,8 +32,6 @@ public class StandardUnifyTest {
System.out.println(unify.unify(f, y).get());
// TODO ist das ergebnis { (x -> ? extends a), (y -> g<x>) } in der richtigen form oder
// muss es { (x -> ? extends a), (y -> g<? extends a>) } sein?
// {f<g<x>,x> = f<y, ? extends a>}
UnifyType g = tf.getSimpleType("g", "x");
UnifyType f1 = tf.getSimpleType("f", g, x);

View File

@ -174,7 +174,7 @@ public class UnifyTest extends Unify {
addAsSet(expected, new UnifyPair(tphA, extObject, PairOperator.EQUALSDOT));
actual = unify(eq, fc);
actual = filterGeneratedTPHsMultiple(actual);
Assert.assertEquals(expected, actual);
@ -479,6 +479,25 @@ public class UnifyTest extends Unify {
System.out.println(actual);
//Assert.assertEquals(expected, actual);
/*
* Test 6:
* This is a test for the extension of case 6 of the cartesian product of step 4.
*
* ? extends b <.? a
* b =. Integer
*/
eq = new HashSet<>();
eq.add(new UnifyPair(extB, tphA, PairOperator.SMALLERDOTWC));
eq.add(new UnifyPair(tphB, integer, PairOperator.EQUALSDOT));
expected = new HashSet<>();
actual = unify(eq, fc);
System.out.println(actual);
//Assert.assertEquals(expected, actual);
}
@Test