From 577faa88af56378123c3f08e29147a282d072a3d Mon Sep 17 00:00:00 2001 From: "pl@gohorb.ba-horb.de" Date: Sat, 28 Mar 2020 00:16:43 +0100 Subject: [PATCH] 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 --- .../de/dhbwstuttgart/core/JavaTXCompiler.java | 2 +- .../typeinference/unify/TypeUnifyTask.java | 38 +++++++++++++++---- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java index f03589ed..8c2b6d41 100644 --- a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java +++ b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java @@ -73,7 +73,7 @@ public class JavaTXCompiler { public static JavaTXCompiler INSTANCE; final CompilationEnvironment environment; - Boolean resultmodel = false; + Boolean resultmodel = true; public final Map 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(); diff --git a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java index 04ffb57f..d35da74f 100644 --- a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java +++ b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java @@ -696,7 +696,7 @@ public class TypeUnifyTask extends RecursiveTask>> { List> nextSetasListRest = new ArrayList<>(); //List> nextSetasListRestMin = new ArrayList<>(); //List> 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>> { Iterator eq2sprimeit = eq2sprime.iterator(); ArrayList eq2sAsListFst = new ArrayList<>(); ArrayList eq2sAsListSnd = new ArrayList<>(); + ArrayList eq2sAsListThird = new ArrayList<>(); + ArrayList eq2sAsListFourth = new ArrayList<>(); ArrayList eq2sAsListBack = new ArrayList<>(); ArrayList 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>> { eq2sAsList.addAll(eq2sAsListFst); eq2sAsList.addAll(eq2sAsListSnd); + eq2sAsList.addAll(eq2sAsListThird); + eq2sAsList.addAll(eq2sAsListFourth); eq2sAsList.addAll(eq2s); eq2sAsList.addAll(eq2sAsListBack);