From 0be7534b98f9d8f0d1a1ea12b0ef30dcd79d58a9 Mon Sep 17 00:00:00 2001 From: Florian Steurer Date: Sat, 2 Apr 2016 11:29:31 +0200 Subject: [PATCH] . --- .../syntaxtree/factory/Unify_FC_TTO_Builder.java | 8 +++++--- test/unify/UnifyTest.java | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/de/dhbwstuttgart/syntaxtree/factory/Unify_FC_TTO_Builder.java b/src/de/dhbwstuttgart/syntaxtree/factory/Unify_FC_TTO_Builder.java index 524e729e..d8276f99 100644 --- a/src/de/dhbwstuttgart/syntaxtree/factory/Unify_FC_TTO_Builder.java +++ b/src/de/dhbwstuttgart/syntaxtree/factory/Unify_FC_TTO_Builder.java @@ -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)); } diff --git a/test/unify/UnifyTest.java b/test/unify/UnifyTest.java index 3c5792a3..7e3cff74 100644 --- a/test/unify/UnifyTest.java +++ b/test/unify/UnifyTest.java @@ -50,8 +50,9 @@ public class UnifyTest extends Unify { Set eq = new HashSet(); Set> expected = new HashSet<>(); + expected.add(new HashSet<>()); Set> actual = unify(eq, fc); - Assert.assertEquals(actual, expected); + Assert.assertEquals(expected, actual); /* * Test 2: