modified: src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java

modified:   src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
Reihenfolge geaendert, so dass bei Variance 1 (x <. theta) vorne und bei Variance -1 (theta <. x) vorne
This commit is contained in:
pl@gohorb.ba-horb.de 2020-03-28 00:16:43 +01:00
parent 8bdb7e7b13
commit 577faa88af
2 changed files with 32 additions and 8 deletions

View File

@ -73,7 +73,7 @@ public class JavaTXCompiler {
public static JavaTXCompiler INSTANCE;
final CompilationEnvironment environment;
Boolean resultmodel = false;
Boolean resultmodel = true;
public final Map<File, SourceFile> sourceFiles = new HashMap<>();
Boolean log = true; //gibt an ob ein Log-File nach System.getProperty("user.dir")+"src/test/java/logFiles" geschrieben werden soll?
public volatile UnifyTaskModel usedTasks = new UnifyTaskModel();

View File

@ -696,7 +696,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
List<Set<UnifyPair>> nextSetasListRest = new ArrayList<>();
//List<Set<UnifyPair>> nextSetasListRestMin = new ArrayList<>();
//List<Set<UnifyPair>> nextSetasListRestOder = new ArrayList<>();
writeLog("WhileAnfangNextSet: " + nextSet.toString());
writeLog("qextSet: " + nextSet.toString());
writeLog("WhileAnfangNextSetasList: " + nextSetasList.toString());
if (variance == 1) {
a = oup.max(nextSetasList.iterator());
@ -1824,21 +1824,43 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
Iterator<UnifyPair> eq2sprimeit = eq2sprime.iterator();
ArrayList<UnifyPair> eq2sAsListFst = new ArrayList<>();
ArrayList<UnifyPair> eq2sAsListSnd = new ArrayList<>();
ArrayList<UnifyPair> eq2sAsListThird = new ArrayList<>();
ArrayList<UnifyPair> eq2sAsListFourth = 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 && !((PlaceholderType)up.getLhsType()).isInnerType())
|| (up.getRhsType() instanceof PlaceholderType && ((PlaceholderType)up.getRhsType()).getVariance() != 0) && !((PlaceholderType)up.getRhsType()).isInnerType()) {
eq2sAsListFst.add(up);
if ((up.getLhsType() instanceof PlaceholderType &&
((PlaceholderType)up.getLhsType()).getVariance() == 1 &&
!((PlaceholderType)up.getLhsType()).isInnerType()) ||
(up.getRhsType() instanceof PlaceholderType &&
((PlaceholderType)up.getRhsType()).getVariance() == -1) &&
!((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()) {
else if ((up.getLhsType() instanceof PlaceholderType && ((PlaceholderType)up.getLhsType()).getVariance() == 1 && ((PlaceholderType)up.getLhsType()).isInnerType())
|| (up.getRhsType() instanceof PlaceholderType && ((PlaceholderType)up.getRhsType()).getVariance() == -1) && ((PlaceholderType)up.getRhsType()).isInnerType()) {
eq2sAsListSnd.add(up);
eq2s.remove(up);
}
}
else if ((up.getLhsType() instanceof PlaceholderType &&
((PlaceholderType)up.getLhsType()).getVariance() == -1 &&
!((PlaceholderType)up.getLhsType()).isInnerType()) ||
(up.getRhsType() instanceof PlaceholderType &&
((PlaceholderType)up.getRhsType()).getVariance() == -1) &&
!((PlaceholderType)up.getRhsType()).isInnerType())
{
eq2sAsListThird.add(up);
eq2s.remove(up);
}
else if ((up.getLhsType() instanceof PlaceholderType && ((PlaceholderType)up.getLhsType()).getVariance() == -1 && ((PlaceholderType)up.getLhsType()).isInnerType())
|| (up.getRhsType() instanceof PlaceholderType && ((PlaceholderType)up.getRhsType()).getVariance() == 1) && ((PlaceholderType)up.getRhsType()).isInnerType()) {
eq2sAsListFourth.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);
@ -1876,6 +1898,8 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
eq2sAsList.addAll(eq2sAsListFst);
eq2sAsList.addAll(eq2sAsListSnd);
eq2sAsList.addAll(eq2sAsListThird);
eq2sAsList.addAll(eq2sAsListFourth);
eq2sAsList.addAll(eq2s);
eq2sAsList.addAll(eq2sAsListBack);