forked from JavaTX/JavaCompilerCore
modified: src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java
modified: src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java wenn nicht wildcardable dann receiver ? extends geloescht modified: src/main/java/de/dhbwstuttgart/typeinference/unify/model/OrderingUnifyPair.java kleiner Fehler in compare
This commit is contained in:
parent
7c7dbf3769
commit
97bdfe1d3a
@ -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();
|
||||
|
@ -1884,6 +1884,14 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
oderConstraintsOutput.remove(ret);
|
||||
//Set<UnifyPair> retFlat = new HashSet<>();
|
||||
//ret.stream().forEach(x -> retFlat.addAll(x));
|
||||
ret = ret.stream().filter(x -> { Optional<UnifyPair> optElem;
|
||||
return !((optElem=x.stream().filter(y -> (y.getLhsType()) instanceof PlaceholderType
|
||||
&& !((PlaceholderType)y.getLhsType()).isWildcardable()
|
||||
&& y.getPairOp() == PairOperator.EQUALSDOT
|
||||
&& !(y.getRhsType() instanceof PlaceholderType))
|
||||
.findAny()).isPresent()
|
||||
&& optElem.get().getRhsType() instanceof ExtendsType);})
|
||||
.collect(Collectors.toSet());
|
||||
ret.stream().forEach(x -> x.stream().forEach(y -> { Set<UnifyPair> x_new = new HashSet<>(x); //PL 2020-03-18: y selbst darf nicht in die Substitutionen
|
||||
x_new.remove(y);
|
||||
y.addSubstitutions(x_new);
|
||||
@ -1912,6 +1920,14 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
// System.out.println("M");
|
||||
//Set<UnifyPair> retFlat = new HashSet<>();
|
||||
//ret.stream().forEach(x -> retFlat.addAll(x));
|
||||
ret = ret.stream().filter(x -> { Optional<UnifyPair> optElem;
|
||||
return !((optElem=x.stream().filter(y -> (y.getLhsType()) instanceof PlaceholderType
|
||||
&& !((PlaceholderType)y.getLhsType()).isWildcardable()
|
||||
&& y.getPairOp() == PairOperator.EQUALSDOT
|
||||
&& !(y.getRhsType() instanceof PlaceholderType))
|
||||
.findAny()).isPresent()
|
||||
&& optElem.get().getRhsType() instanceof ExtendsType);})
|
||||
.collect(Collectors.toSet());
|
||||
ret.stream().forEach(x -> x.stream().forEach(y -> { Set<UnifyPair> x_new = new HashSet<>(x); //PL 2020-03-18: y selbst darf nicht in die Substitutionen
|
||||
x_new.remove(y);
|
||||
y.addSubstitutions(x_new);
|
||||
|
@ -262,16 +262,16 @@ public class OrderingUnifyPair extends Ordering<Set<UnifyPair>> {
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
Integer compareEq;
|
||||
if (lefteqOder.size() == 1 && righteqOder.size() == 1 && lefteqRet.size() == 1 && righteqRet.size() == 1) {
|
||||
Match m = new Match();
|
||||
if (compareEq(lefteqOder.iterator().next().getGroundBasePair(), righteqOder.iterator().next().getGroundBasePair()) == -1) {
|
||||
if ((compareEq = compareEq(lefteqOder.iterator().next().getGroundBasePair(), righteqOder.iterator().next().getGroundBasePair())) == -1) {
|
||||
ArrayList<UnifyPair> matchList =
|
||||
leftleOder.stream().map(x -> {
|
||||
UnifyPair rightElem = rightleOder.stream()
|
||||
rightleOder.stream().map(x -> {
|
||||
UnifyPair leftElem = leftleOder.stream()
|
||||
.filter(y -> y.getGroundBasePair().getLhsType().equals(x.getGroundBasePair().getLhsType()))
|
||||
.findAny().get();
|
||||
return new UnifyPair(x.getRhsType(), rightElem.getRhsType(), PairOperator.EQUALSDOT);})
|
||||
return new UnifyPair(x.getRhsType(), leftElem.getRhsType(), PairOperator.EQUALSDOT);})
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
if (m.match(matchList).isPresent()) {
|
||||
return -1;
|
||||
@ -279,13 +279,13 @@ public class OrderingUnifyPair extends Ordering<Set<UnifyPair>> {
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
} else if (compareEq(lefteqOder.iterator().next().getGroundBasePair(), righteqOder.iterator().next().getGroundBasePair()) == 1) {
|
||||
} else if (compareEq == 1) {
|
||||
ArrayList<UnifyPair> matchList =
|
||||
rightleOder.stream().map(x -> {
|
||||
UnifyPair leftElem = leftleOder.stream()
|
||||
leftleOder.stream().map(x -> {
|
||||
UnifyPair rightElem = rightleOder.stream()
|
||||
.filter(y -> y.getGroundBasePair().getLhsType().equals(x.getGroundBasePair().getLhsType()))
|
||||
.findAny().get();
|
||||
return new UnifyPair(x.getRhsType(), leftElem.getRhsType(), PairOperator.EQUALSDOT);})
|
||||
return new UnifyPair(x.getRhsType(), rightElem.getRhsType(), PairOperator.EQUALSDOT);})
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
if (m.match(matchList).isPresent()) {
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user