Merge remote-tracking branch 'origin/targetBytecode' into unif23

This commit is contained in:
pl@gohorb.ba-horb.de 2023-04-11 15:52:26 +02:00
commit be6f4bd578
5 changed files with 49 additions and 3 deletions

View File

@ -121,6 +121,7 @@ public class UnifyTypeFactory {
}
PlaceholderType ntph = new PlaceholderType(tph.getName());
ntph.setVariance(tph.getVariance());
ntph.setOrCons(tph.getOrCons());
int in = PLACEHOLDERS.indexOf(ntph);
if (in == -1) {
PLACEHOLDERS.add(ntph);

View File

@ -24,6 +24,14 @@ public class TypePlaceholder extends RefTypeOrTPHOrWildcardOrGeneric
* wird im Generate Generics Teil nach der Rueckumwandlung nach dem Unify genutzt
*/
private int variance = 0;
/*
* Fuer Oder-Constraints:
* orCons = 1: Receiver
* orCons = 0: Argument oder kein Oder-Constraint
* orCons = -1: RetType
*/
private byte orCons = 0;
/**
@ -104,4 +112,12 @@ public class TypePlaceholder extends RefTypeOrTPHOrWildcardOrGeneric
public void accept(ResultSetVisitor visitor) {
visitor.visit(this);
}
public void setOrCons(byte i) {
orCons = i;
}
public byte getOrCons() {
return orCons;
}
}

View File

@ -613,6 +613,11 @@ public class TYPEStmt implements StatementVisitor{
methodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(), PairOperator.EQUALSDOT));
extendsMethodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(), PairOperator.EQUALSDOT));
//methodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(), PairOperator.EQUALSDOT));
//extendsMethodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(), PairOperator.EQUALSDOT));
((TypePlaceholder)forMethod.getType()).setOrCons((byte)-1);//fuer Maximums-Bestimmung
Set<Pair> parameterContraints = generateParameterConstraints(forMethod, assumption, info, resolver);
methodConstraint.addAll(parameterContraints);

View File

@ -131,7 +131,11 @@ public class OrderingUnifyPair extends OrderingExtend<Set<UnifyPair>> {
* fuehrt zu Fehlern bei Arrays.sort (contract nicht erfuellt)
* @see com.google.common.collect.Ordering#compare(java.lang.Object, java.lang.Object)
*/
public int compare (Set<UnifyPair> left, Set<UnifyPair> right) {
public int compare (Set<UnifyPair> leftpara, Set<UnifyPair> rightpara) {
Set<UnifyPair> left = new HashSet<>(leftpara);
Set<UnifyPair> right = new HashSet<>(rightpara);
/*
//pairop = PairOperator.SMALLERDOTWC;
List<UnifyType> al = new ArrayList<>();
@ -220,22 +224,26 @@ public class OrderingUnifyPair extends OrderingExtend<Set<UnifyPair>> {
!(y.getRhsType() instanceof PlaceholderType) &&
x.getPairOp() == PairOperator.EQUALSDOT);})
.collect(Collectors.toCollection(HashSet::new));
left.removeAll(lefteqOder);
Set<UnifyPair> righteqOder = right.stream()
.filter(x -> { UnifyPair y = x.getGroundBasePair();
return (y.getLhsType() instanceof PlaceholderType &&
!(y.getRhsType() instanceof PlaceholderType) &&
x.getPairOp() == PairOperator.EQUALSDOT);})
.collect(Collectors.toCollection(HashSet::new));
right.removeAll(righteqOder);
Set<UnifyPair> lefteqRet = left.stream()
.filter(x -> { UnifyPair y = x.getGroundBasePair();
return (y.getRhsType() instanceof PlaceholderType &&
x.getPairOp() == PairOperator.EQUALSDOT);})
((PlaceholderType)y.getRhsType()).getOrCons() == (byte)-1);})
.collect(Collectors.toCollection(HashSet::new));
left.removeAll(lefteqRet);
Set<UnifyPair> righteqRet = right.stream()
.filter(x -> { UnifyPair y = x.getGroundBasePair();
return (y.getRhsType() instanceof PlaceholderType &&
x.getPairOp() == PairOperator.EQUALSDOT);})
((PlaceholderType)y.getRhsType()).getOrCons() == (byte)-1);})
.collect(Collectors.toCollection(HashSet::new));
right.removeAll(righteqRet);
Set<UnifyPair> leftleOder = left.stream()
.filter(x -> (x.getPairOp() == PairOperator.SMALLERDOT))
.collect(Collectors.toCollection(HashSet::new));

View File

@ -59,6 +59,14 @@ public final class PlaceholderType extends UnifyType{
* PL 2018-03-21
*/
private int variance = 0;
/*
* Fuer Oder-Constraints:
* orCons = 1: Receiver
* orCons = 0: Argument oder kein Oder-Constraint
* orCons = -1: RetType
*/
private byte orCons = 0;
/**
* Creates a new placeholder type with the specified name.
@ -122,6 +130,14 @@ public final class PlaceholderType extends UnifyType{
}}
}
public void setOrCons(byte i) {
orCons = i;
}
public byte getOrCons() {
return orCons;
}
public Boolean isWildcardable() {
return wildcardable;
}