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

Unterscheidung zwischen FUNN-Receiver und anderem Receiver wieder geloescht
(war nur auskmmentiert)

	modified:   ../../src/de/dhbwstuttgart/typeinference/unify/RuleSet.java
Fehler in der Reduce-FUNN-Rege beseitigt
This commit is contained in:
Martin Plümicke 2018-11-04 11:33:32 +01:00
parent 4ef360e41e
commit 9bf273ac1a
2 changed files with 13 additions and 12 deletions

View File

@ -520,14 +520,8 @@ public class TYPEStmt implements StatementVisitor{
*/
RefTypeOrTPHOrWildcardOrGeneric retType = assumption.getReceiverType(resolver);
/* if (retType instanceof FunN) {
methodConstraint.add(new Pair(forMethod.receiver.getType(), retType,
PairOperator.EQUALSDOT));
}
else {//RefType */
methodConstraint.add(new Pair(forMethod.receiver.getType(), retType,
methodConstraint.add(new Pair(forMethod.receiver.getType(), retType,
PairOperator.SMALLERDOT));
//}
methodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(),
PairOperator.EQUALSDOT));
methodConstraint.addAll(generateParameterConstraints(forMethod, assumption, info, resolver));

View File

@ -782,10 +782,17 @@ public class RuleSet implements IRuleSet{
return Optional.empty();
Set<UnifyPair> result = new HashSet<UnifyPair>();
result.add(new UnifyPair(funNLhsType.getTypeParams().get(funNLhsType.getTypeParams().size()-1), funNRhsType.getTypeParams().get(funNRhsType.getTypeParams().size()-1), PairOperator.SMALLERDOT, pair.getSubstitution(), pair.getBasePair()));
for(int i = 0; i < funNLhsType.getTypeParams().size()-1; i++) {
result.add(new UnifyPair(funNRhsType.getTypeParams().get(i), funNLhsType.getTypeParams().get(i), PairOperator.SMALLERDOT, pair.getSubstitution(), pair.getBasePair()));
if (pair.getPairOp() == PairOperator.SMALLERDOT) {
result.add(new UnifyPair(funNLhsType.getTypeParams().get(funNLhsType.getTypeParams().size()-1), funNRhsType.getTypeParams().get(funNRhsType.getTypeParams().size()-1), PairOperator.SMALLERDOT, pair.getSubstitution(), pair.getBasePair()));
for(int i = 0; i < funNLhsType.getTypeParams().size()-1; i++) {
result.add(new UnifyPair(funNRhsType.getTypeParams().get(i), funNLhsType.getTypeParams().get(i), PairOperator.SMALLERDOT, pair.getSubstitution(), pair.getBasePair()));
}
}
else {// pair.getPairOp() == PairOperator.EQUALDOT
result.add(new UnifyPair(funNLhsType.getTypeParams().get(funNLhsType.getTypeParams().size()-1), funNRhsType.getTypeParams().get(funNRhsType.getTypeParams().size()-1), PairOperator.EQUALSDOT, pair.getSubstitution(), pair.getBasePair()));
for(int i = 0; i < funNLhsType.getTypeParams().size()-1; i++) {
result.add(new UnifyPair(funNRhsType.getTypeParams().get(i), funNLhsType.getTypeParams().get(i), PairOperator.EQUALSDOT, pair.getSubstitution(), pair.getBasePair()));
}
}
result.stream().forEach(x -> { UnifyType l = x.getLhsType();
if (l instanceof PlaceholderType) { ((PlaceholderType)l).disableWildcardtable(); }
@ -798,7 +805,7 @@ public class RuleSet implements IRuleSet{
logFile.flush();
}
catch (IOException e) {
System.out.println("lofFile-Error");
System.out.println("logFile-Error");
}
return Optional.of(result);
}