diff --git a/src/de/dhbwstuttgart/typeinference/unify/Unify.java b/src/de/dhbwstuttgart/typeinference/unify/Unify.java index 6048fbe2..b9c1d9b1 100644 --- a/src/de/dhbwstuttgart/typeinference/unify/Unify.java +++ b/src/de/dhbwstuttgart/typeinference/unify/Unify.java @@ -479,11 +479,15 @@ public class Unify { protected Set> unifyCase6(ExtendsType extTheta, PlaceholderType a, IFiniteClosure fc) { Set> result = new HashSet<>(); - for(UnifyType thetaS : fc.grArg(extTheta)) { - Set 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 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; } diff --git a/test/unify/StandardUnifyTest.java b/test/unify/StandardUnifyTest.java index 2664324c..83f8abe1 100644 --- a/test/unify/StandardUnifyTest.java +++ b/test/unify/StandardUnifyTest.java @@ -32,8 +32,6 @@ public class StandardUnifyTest { System.out.println(unify.unify(f, y).get()); - // TODO ist das ergebnis { (x -> ? extends a), (y -> g) } in der richtigen form oder - // muss es { (x -> ? extends a), (y -> g) } sein? // {f,x> = f} UnifyType g = tf.getSimpleType("g", "x"); UnifyType f1 = tf.getSimpleType("f", g, x); diff --git a/test/unify/UnifyTest.java b/test/unify/UnifyTest.java index a9773809..6f0597fd 100644 --- a/test/unify/UnifyTest.java +++ b/test/unify/UnifyTest.java @@ -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