modified: ../../../../main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java

Reigenfolge der der nextSets angepasst
This commit is contained in:
pl@gohorb.ba-horb.de 2020-03-13 15:57:27 +01:00
parent 44368f2a2a
commit 21bc3e5193

View File

@ -1765,6 +1765,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
* (as in case 1 where sigma is added to the innermost set).
*/
protected Set<Set<Set<Set<UnifyPair>>>> calculatePairSets(Set<UnifyPair> eq2s, List<Set<Set<UnifyPair>>> oderConstraintsInput, IFiniteClosure fc, Set<UnifyPair> undefined, List<Set<Set<UnifyPair>>> oderConstraintsOutput) {
writeLog("eq2s: " + eq2s.toString());
oderConstraintsOutput.addAll(oderConstraintsInput);
List<Set<Set<Set<UnifyPair>>>> result = new ArrayList<>(9);
@ -1774,17 +1775,30 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
ArrayList<UnifyPair> eq2sprime = new ArrayList<>(eq2s);
Iterator<UnifyPair> eq2sprimeit = eq2sprime.iterator();
ArrayList<UnifyPair> eq2sAsListFst = new ArrayList<>();
ArrayList<UnifyPair> eq2sAsListSnd = new ArrayList<>();
ArrayList<UnifyPair> eq2sAsListBack = new ArrayList<>();
ArrayList<UnifyPair> eq2sAsList = new ArrayList<>();
Boolean first = true;
while(eq2sprimeit.hasNext()) {// alle mit Variance != 0 nach vorne schieben
UnifyPair up = eq2sprimeit.next();
if ((up.getLhsType() instanceof PlaceholderType && ((PlaceholderType)up.getLhsType()).getVariance() != 0)
|| (up.getRhsType() instanceof PlaceholderType && ((PlaceholderType)up.getRhsType()).getVariance() != 0)) {
eq2sAsList.add(up);
if ((up.getLhsType() instanceof PlaceholderType && ((PlaceholderType)up.getLhsType()).getVariance() != 0 && !((PlaceholderType)up.getLhsType()).isInnerType())
|| (up.getRhsType() instanceof PlaceholderType && ((PlaceholderType)up.getRhsType()).getVariance() != 0) && !((PlaceholderType)up.getRhsType()).isInnerType()) {
eq2sAsListFst.add(up);
eq2s.remove(up);
}
else if ((up.getLhsType() instanceof PlaceholderType && ((PlaceholderType)up.getLhsType()).getVariance() != 0 && ((PlaceholderType)up.getLhsType()).isInnerType())
|| (up.getRhsType() instanceof PlaceholderType && ((PlaceholderType)up.getRhsType()).getVariance() != 0) && ((PlaceholderType)up.getRhsType()).isInnerType()) {
eq2sAsListSnd.add(up);
eq2s.remove(up);
}
else if ((up.getLhsType() instanceof PlaceholderType && ((PlaceholderType)up.getLhsType()).isInnerType())
|| (up.getRhsType() instanceof PlaceholderType && ((PlaceholderType)up.getRhsType()).isInnerType())) {
eq2sAsListBack.add(up);
eq2s.remove(up);
}
}
if (eq2sAsList.isEmpty()) {
if (eq2sAsListFst.isEmpty()) {
List<Set<Set<UnifyPair>>> oderConstraintsVariance = oderConstraintsOutput.stream() //Alle Elemente rauswerfen, die Variance 0 haben oder keine TPH in LHS oder RHS sind
.filter(x -> x.stream()
.filter(y ->
@ -1805,7 +1819,15 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
}
}
writeLog("eq2s: " + eq2s.toString());
writeLog("eq2sAsListFst: " + eq2sAsListFst.toString());
writeLog("eq2sAsListSnd: " + eq2sAsListSnd.toString());
writeLog("eq2sAsListBack: " + eq2sAsListBack.toString());
eq2sAsList.addAll(eq2sAsListFst);
eq2sAsList.addAll(eq2sAsListSnd);
eq2sAsList.addAll(eq2s);
eq2sAsList.addAll(eq2sAsListBack);
if (eq2sAsList.isEmpty() && first) {//Alle eq2s sind empty und alle oderConstraints mit Variance != 0 sind bearbeitet
if (!oderConstraintsOutput.isEmpty()) {