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

Weiter Ausgave der abstrakten Syntax auf die Console
Fehler bei der Auswahl der Varianz behoben.
This commit is contained in:
pl@gohorb.ba-horb.de 2020-01-31 10:03:33 +01:00
parent 8d72b58fcc
commit b68004a214
2 changed files with 3 additions and 2 deletions

View File

@ -508,6 +508,7 @@ public class JavaTXCompiler {
logFile.write("FC:\\" + finiteClosure.toString() + "\n"); logFile.write("FC:\\" + finiteClosure.toString() + "\n");
for (SourceFile sf : this.sourceFiles.values()) { for (SourceFile sf : this.sourceFiles.values()) {
logFile.write(ASTTypePrinter.print(sf)); logFile.write(ASTTypePrinter.print(sf));
System.out.println(ASTTypePrinter.print(sf));
} }
logFile.flush(); logFile.flush();

View File

@ -607,8 +607,8 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
for (UnifyPair ele : nextSetasList.get(0)) {//check ob a <. ty base oder ob Ueberladung for (UnifyPair ele : nextSetasList.get(0)) {//check ob a <. ty base oder ob Ueberladung
sameBase = sameBase && ele.getBasePair() != null && ele.getBasePair().equals(fstBasePair); sameBase = sameBase && ele.getBasePair() != null && ele.getBasePair().equals(fstBasePair);
} }
if (sameBase) { if (sameBase) { //angefuegt PL 2020-02-30
Optional<Integer> xi = nextSetasList.stream().map(x -> x.stream().filter(y -> y.getLhsType() instanceof PlaceholderType) Optional<Integer> xi = nextSetasList.stream().map(x -> x.stream().filter(y -> (y.getLhsType() instanceof PlaceholderType && !(y.getRhsType() instanceof PlaceholderType)))
.filter(z -> ((PlaceholderType)z.getLhsType()).getVariance() != 0) .filter(z -> ((PlaceholderType)z.getLhsType()).getVariance() != 0)
.map(c -> ((PlaceholderType)c.getLhsType()).getVariance()) .map(c -> ((PlaceholderType)c.getLhsType()).getVariance())
.reduce((a,b)-> {if (a==b) return a; else return 0; })) //2 kommt insbesondere bei Oder-Constraints vor .reduce((a,b)-> {if (a==b) return a; else return 0; })) //2 kommt insbesondere bei Oder-Constraints vor