modified: src/main/java/de/dhbwstuttgart/syntaxtree/type/TypePlaceholder.java
modified: src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java
This commit is contained in:
parent
23384f413d
commit
5c97d80eb0
@ -19,6 +19,10 @@ public class TypePlaceholder extends RefTypeOrTPHOrWildcardOrGeneric
|
||||
{
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* wird bisher nicht genutzt
|
||||
* setVariance muss ggf. auskommentiert werden.
|
||||
*/
|
||||
int variance = 0;
|
||||
|
||||
|
||||
@ -70,9 +74,11 @@ public class TypePlaceholder extends RefTypeOrTPHOrWildcardOrGeneric
|
||||
return name;
|
||||
}
|
||||
|
||||
/* wird bisher nicht genutzt
|
||||
public void setVariance(int variance) {
|
||||
this.variance= variance;
|
||||
}
|
||||
*/
|
||||
|
||||
public int getVariance() {
|
||||
return this.variance;
|
||||
|
@ -573,17 +573,10 @@ public class TYPEStmt implements StatementVisitor{
|
||||
*/
|
||||
|
||||
RefTypeOrTPHOrWildcardOrGeneric retType = assumption.getReceiverType(resolver);
|
||||
RefTypeOrTPHOrWildcardOrGeneric zwSp;
|
||||
methodConstraint.add(new Pair(zwSp = forMethod.receiver.getType(), retType,
|
||||
methodConstraint.add(new Pair(forMethod.receiver.getType(), retType,
|
||||
PairOperator.SMALLERDOT));
|
||||
if (zwSp instanceof TypePlaceholder) {
|
||||
((TypePlaceholder) zwSp).setVariance(1);
|
||||
}
|
||||
methodConstraint.add(new Pair(assumption.getReturnType(resolver), zwSp = forMethod.getType(),
|
||||
methodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(),
|
||||
PairOperator.EQUALSDOT));
|
||||
if (zwSp instanceof TypePlaceholder) {
|
||||
((TypePlaceholder) zwSp).setVariance(-1);
|
||||
}
|
||||
methodConstraint.addAll(generateParameterConstraints(forMethod, assumption, info, resolver));
|
||||
return methodConstraint;
|
||||
}
|
||||
@ -596,9 +589,6 @@ public class TYPEStmt implements StatementVisitor{
|
||||
RefTypeOrTPHOrWildcardOrGeneric argType = foMethod.arglist.getArguments().get(i).getType();
|
||||
RefTypeOrTPHOrWildcardOrGeneric assType = assumption.getArgTypes(resolver).get(i);
|
||||
ret.add(new Pair(argType, assType, PairOperator.SMALLERDOT));
|
||||
if (argType instanceof TypePlaceholder) {
|
||||
((TypePlaceholder) argType).setVariance(1);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user