From e72310278da7f13bb74eee66c344dbded9d9ce77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Pl=C3=BCmicke?= Date: Mon, 12 Nov 2018 17:57:51 +0100 Subject: [PATCH] modified: ../../src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java modified: ../../src/de/dhbwstuttgart/typeinference/unify/model/UnifyPair.java Oder-Constraints als Subsitutions zu den Substitutions der UnifyPairs hinzugefuegt. --- .../dhbwstuttgart/typeinference/unify/TypeUnifyTask.java | 9 ++++++++- .../typeinference/unify/model/UnifyPair.java | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java b/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java index bb36c5b4..fa84a8d9 100644 --- a/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java +++ b/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java @@ -1233,6 +1233,9 @@ public class TypeUnifyTask extends RecursiveTask>> { if (!oderConstraintsVariance.isEmpty()) { Set> ret = oderConstraintsVariance.get(0); oderConstraintsOutput.remove(ret); + //Set retFlat = new HashSet<>(); + //ret.stream().forEach(x -> retFlat.addAll(x)); + ret.stream().forEach(x -> x.stream().forEach(y -> y.addSubstitutions(x))); result.get(8).add(ret); first = false; } @@ -1242,7 +1245,11 @@ public class TypeUnifyTask extends RecursiveTask>> { if (eq2sAsList.isEmpty() && first) {//Alle eq2s sind empty und alle oderConstraints mit Variance != 0 sind bearbeitet if (!oderConstraintsOutput.isEmpty()) { - result.get(8).add(oderConstraintsOutput.remove(0)); + Set> ret = oderConstraintsOutput.remove(0); + //Set retFlat = new HashSet<>(); + //ret.stream().forEach(x -> retFlat.addAll(x)); + ret.stream().forEach(x -> x.stream().forEach(y -> y.addSubstitutions(x))); + result.get(8).add(ret); first = false; } } diff --git a/src/de/dhbwstuttgart/typeinference/unify/model/UnifyPair.java b/src/de/dhbwstuttgart/typeinference/unify/model/UnifyPair.java index 729f7f4a..57b4e61e 100644 --- a/src/de/dhbwstuttgart/typeinference/unify/model/UnifyPair.java +++ b/src/de/dhbwstuttgart/typeinference/unify/model/UnifyPair.java @@ -121,6 +121,10 @@ public class UnifyPair { pairOp = po; } + public void addSubstitutions(Set sup) { + substitution.addAll(sup); + } + public byte getVariance() { return variance; }