This commit is contained in:
Florian Steurer 2016-04-02 11:29:31 +02:00
parent d89d06797e
commit 0be7534b98
2 changed files with 7 additions and 4 deletions

View File

@ -14,11 +14,13 @@ public class Unify_FC_TTO_Builder {
public void AddInheritance(Type t1, Type t2) {
if(t1 instanceof RefType)
classes.add(new Class(t1.get_Name(), t1.getOffset()));
if(!classes.stream().anyMatch(x -> x.getName().equals(t1.getName())))
classes.add(new Class(t1.get_Name(), t1.getOffset()));
if(t2 instanceof RefType)
classes.add(new Class(t2.get_Name(), t2.getOffset()));
if(!classes.stream().anyMatch(x -> x.getName().equals(t2.getName())))
classes.add(new Class(t2.get_Name(), t2.getOffset()));
fc.add(new Pair(t1, t2));
}

View File

@ -50,8 +50,9 @@ public class UnifyTest extends Unify {
Set<MPair> eq = new HashSet<MPair>();
Set<Set<MPair>> expected = new HashSet<>();
expected.add(new HashSet<>());
Set<Set<MPair>> actual = unify(eq, fc);
Assert.assertEquals(actual, expected);
Assert.assertEquals(expected, actual);
/*
* Test 2: