modified: src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java

modified:   src/main/java/de/dhbwstuttgart/typeinference/unify/model/OrderingUnifyPair.java
Fehler korrigiert in compare
This commit is contained in:
pl@gohorb.ba-horb.de 2020-03-12 10:18:48 +01:00
parent d63c27579c
commit aa94ce8ad9
2 changed files with 16 additions and 15 deletions

View File

@ -576,7 +576,7 @@ public class TYPEStmt implements StatementVisitor{
methodConstraint.add(new Pair(forMethod.receiver.getType(), retType,
PairOperator.SMALLERDOT));
//Fuer Bytecodegenerierung
//Fuer Bytecodegenerierung PL 2020-03-09 wird derzeit nicht benutzt
methodConstraint.add(new Pair(forMethod.receiverType, retType,
PairOperator.EQUALSDOT));
@ -595,7 +595,7 @@ public class TYPEStmt implements StatementVisitor{
RefTypeOrTPHOrWildcardOrGeneric assType = assumption.getArgTypes(resolver).get(i);
ret.add(new Pair(argType, assType, PairOperator.SMALLERDOT));
//Fuer Bytecodegenerierung
//Fuer Bytecodegenerierung PL 2020-03-09 wird derzeit nicht benutzt
ret.add(new Pair(foMethod.argTypes.get(i), assType, PairOperator.EQUALSDOT));
}
return ret;

View File

@ -293,24 +293,25 @@ public class OrderingUnifyPair extends Ordering<Set<UnifyPair>> {
} else {
if (leftlewc.size() > 0) {
Set<UnifyPair> subst;
if (leftlewc.iterator().next().getLhsType() instanceof PlaceholderType) {
subst = leftlewc.stream().map(x -> new UnifyPair(x.getLhsType(), x.getRhsType(), PairOperator.EQUALSDOT)).collect(Collectors.toCollection(HashSet::new));
}
else {
subst = leftlewc.stream().map(x -> new UnifyPair(x.getRhsType(), x.getLhsType(), PairOperator.EQUALSDOT)).collect(Collectors.toCollection(HashSet::new));
}
subst = leftlewc.stream().map(x -> {
if (x.getLhsType() instanceof PlaceholderType) {
return new UnifyPair(x.getLhsType(), x.getRhsType(), PairOperator.EQUALSDOT);
}
else {
return new UnifyPair(x.getRhsType(), x.getLhsType(), PairOperator.EQUALSDOT);
}}).collect(Collectors.toCollection(HashSet::new));
Unifier uni = new Unifier();
subst.stream().forEach(x -> uni.add((PlaceholderType) x.getLhsType(), x.getRhsType()));
lseq = uni.apply(lseq);
}
else {
Set<UnifyPair> subst;
if (rightlewc.iterator().next().getLhsType() instanceof PlaceholderType) {
subst = rightlewc.stream().map(x -> new UnifyPair(x.getLhsType(), x.getRhsType(), PairOperator.EQUALSDOT)).collect(Collectors.toCollection(HashSet::new));
}
else {
subst = rightlewc.stream().map(x -> new UnifyPair(x.getRhsType(), x.getLhsType(), PairOperator.EQUALSDOT)).collect(Collectors.toCollection(HashSet::new));
}
subst = rightlewc.stream().map(x -> {
if (x.getLhsType() instanceof PlaceholderType) {
return new UnifyPair(x.getLhsType(), x.getRhsType(), PairOperator.EQUALSDOT);
}
else {
return new UnifyPair(x.getRhsType(), x.getLhsType(), PairOperator.EQUALSDOT);
}}).collect(Collectors.toCollection(HashSet::new));
Unifier uni = new Unifier();
subst.stream().forEach(x -> uni.add((PlaceholderType) x.getLhsType(), x.getRhsType()));
rseq = uni.apply(rseq);