extended case 6
This commit is contained in:
parent
41b3e4f6c2
commit
d080eb4a0a
@ -479,11 +479,15 @@ public class Unify {
|
|||||||
|
|
||||||
protected Set<Set<UnifyPair>> unifyCase6(ExtendsType extTheta, PlaceholderType a, IFiniteClosure fc) {
|
protected Set<Set<UnifyPair>> unifyCase6(ExtendsType extTheta, PlaceholderType a, IFiniteClosure fc) {
|
||||||
Set<Set<UnifyPair>> result = new HashSet<>();
|
Set<Set<UnifyPair>> result = new HashSet<>();
|
||||||
for(UnifyType thetaS : fc.grArg(extTheta)) {
|
//for(UnifyType thetaS : fc.smaller(extTheta.getExtendedType())) {
|
||||||
Set<UnifyPair> resultPrime = new HashSet<>();
|
UnifyType freshTph = PlaceholderType.freshPlaceholder();
|
||||||
resultPrime.add(new UnifyPair(a, thetaS, PairOperator.EQUALSDOT));
|
UnifyType extFreshTph = new ExtendsType(freshTph);
|
||||||
result.add(resultPrime);
|
|
||||||
}
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -32,8 +32,6 @@ public class StandardUnifyTest {
|
|||||||
|
|
||||||
System.out.println(unify.unify(f, y).get());
|
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>}
|
// {f<g<x>,x> = f<y, ? extends a>}
|
||||||
UnifyType g = tf.getSimpleType("g", "x");
|
UnifyType g = tf.getSimpleType("g", "x");
|
||||||
UnifyType f1 = tf.getSimpleType("f", g, x);
|
UnifyType f1 = tf.getSimpleType("f", g, x);
|
||||||
|
@ -174,7 +174,7 @@ public class UnifyTest extends Unify {
|
|||||||
addAsSet(expected, new UnifyPair(tphA, extObject, PairOperator.EQUALSDOT));
|
addAsSet(expected, new UnifyPair(tphA, extObject, PairOperator.EQUALSDOT));
|
||||||
|
|
||||||
actual = unify(eq, fc);
|
actual = unify(eq, fc);
|
||||||
|
actual = filterGeneratedTPHsMultiple(actual);
|
||||||
Assert.assertEquals(expected, actual);
|
Assert.assertEquals(expected, actual);
|
||||||
|
|
||||||
|
|
||||||
@ -479,6 +479,25 @@ public class UnifyTest extends Unify {
|
|||||||
System.out.println(actual);
|
System.out.println(actual);
|
||||||
//Assert.assertEquals(expected, 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
|
@Test
|
||||||
|
Loading…
Reference in New Issue
Block a user