forked from JavaTX/JavaCompilerCore
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;
|
private final String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wird bisher nicht genutzt
|
||||||
|
* setVariance muss ggf. auskommentiert werden.
|
||||||
|
*/
|
||||||
int variance = 0;
|
int variance = 0;
|
||||||
|
|
||||||
|
|
||||||
@ -70,9 +74,11 @@ public class TypePlaceholder extends RefTypeOrTPHOrWildcardOrGeneric
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* wird bisher nicht genutzt
|
||||||
public void setVariance(int variance) {
|
public void setVariance(int variance) {
|
||||||
this.variance= variance;
|
this.variance= variance;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
public int getVariance() {
|
public int getVariance() {
|
||||||
return this.variance;
|
return this.variance;
|
||||||
|
@ -573,17 +573,10 @@ public class TYPEStmt implements StatementVisitor{
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
RefTypeOrTPHOrWildcardOrGeneric retType = assumption.getReceiverType(resolver);
|
RefTypeOrTPHOrWildcardOrGeneric retType = assumption.getReceiverType(resolver);
|
||||||
RefTypeOrTPHOrWildcardOrGeneric zwSp;
|
methodConstraint.add(new Pair(forMethod.receiver.getType(), retType,
|
||||||
methodConstraint.add(new Pair(zwSp = forMethod.receiver.getType(), retType,
|
|
||||||
PairOperator.SMALLERDOT));
|
PairOperator.SMALLERDOT));
|
||||||
if (zwSp instanceof TypePlaceholder) {
|
methodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(),
|
||||||
((TypePlaceholder) zwSp).setVariance(1);
|
|
||||||
}
|
|
||||||
methodConstraint.add(new Pair(assumption.getReturnType(resolver), zwSp = forMethod.getType(),
|
|
||||||
PairOperator.EQUALSDOT));
|
PairOperator.EQUALSDOT));
|
||||||
if (zwSp instanceof TypePlaceholder) {
|
|
||||||
((TypePlaceholder) zwSp).setVariance(-1);
|
|
||||||
}
|
|
||||||
methodConstraint.addAll(generateParameterConstraints(forMethod, assumption, info, resolver));
|
methodConstraint.addAll(generateParameterConstraints(forMethod, assumption, info, resolver));
|
||||||
return methodConstraint;
|
return methodConstraint;
|
||||||
}
|
}
|
||||||
@ -596,9 +589,6 @@ public class TYPEStmt implements StatementVisitor{
|
|||||||
RefTypeOrTPHOrWildcardOrGeneric argType = foMethod.arglist.getArguments().get(i).getType();
|
RefTypeOrTPHOrWildcardOrGeneric argType = foMethod.arglist.getArguments().get(i).getType();
|
||||||
RefTypeOrTPHOrWildcardOrGeneric assType = assumption.getArgTypes(resolver).get(i);
|
RefTypeOrTPHOrWildcardOrGeneric assType = assumption.getArgTypes(resolver).get(i);
|
||||||
ret.add(new Pair(argType, assType, PairOperator.SMALLERDOT));
|
ret.add(new Pair(argType, assType, PairOperator.SMALLERDOT));
|
||||||
if (argType instanceof TypePlaceholder) {
|
|
||||||
((TypePlaceholder) argType).setVariance(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user