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.
This commit is contained in:
Martin Plümicke 2018-11-12 17:57:51 +01:00
parent 3ce60eec8d
commit e72310278d
2 changed files with 12 additions and 1 deletions

View File

@ -1233,6 +1233,9 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
if (!oderConstraintsVariance.isEmpty()) { if (!oderConstraintsVariance.isEmpty()) {
Set<Set<UnifyPair>> ret = oderConstraintsVariance.get(0); Set<Set<UnifyPair>> ret = oderConstraintsVariance.get(0);
oderConstraintsOutput.remove(ret); oderConstraintsOutput.remove(ret);
//Set<UnifyPair> 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); result.get(8).add(ret);
first = false; first = false;
} }
@ -1242,7 +1245,11 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
if (eq2sAsList.isEmpty() && first) {//Alle eq2s sind empty und alle oderConstraints mit Variance != 0 sind bearbeitet if (eq2sAsList.isEmpty() && first) {//Alle eq2s sind empty und alle oderConstraints mit Variance != 0 sind bearbeitet
if (!oderConstraintsOutput.isEmpty()) { if (!oderConstraintsOutput.isEmpty()) {
result.get(8).add(oderConstraintsOutput.remove(0)); Set<Set<UnifyPair>> ret = oderConstraintsOutput.remove(0);
//Set<UnifyPair> 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; first = false;
} }
} }

View File

@ -121,6 +121,10 @@ public class UnifyPair {
pairOp = po; pairOp = po;
} }
public void addSubstitutions(Set<UnifyPair> sup) {
substitution.addAll(sup);
}
public byte getVariance() { public byte getVariance() {
return variance; return variance;
} }