refactor: enhanced Constraint-Genereation
All checks were successful
Build and Test with Maven / Build-and-test-with-Maven (push) Successful in 5m41s
All checks were successful
Build and Test with Maven / Build-and-test-with-Maven (push) Successful in 5m41s
This commit is contained in:
parent
f57c8aa5a9
commit
929392b7d4
@ -836,7 +836,26 @@ public class TYPEStmt implements StatementVisitor {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (caseExpressionType == null) {
|
||||
for (var child : switchStmt.getBlocks()) {
|
||||
for (var label : child.getLabels()) {
|
||||
if (label.getPattern() == null) {
|
||||
System.out.println("DefaultCase");
|
||||
} else {
|
||||
constraintsSet.addUndConstraint(
|
||||
new Pair(
|
||||
label.getPattern().getType(),
|
||||
switchStmt.getSwitch().getType(),
|
||||
PairOperator.SMALLERDOT,
|
||||
loc(label.getOffset())
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
constraintsSet.addUndConstraint(new Pair(caseExpressionType, switchStmt.getSwitch().getType(), PairOperator.EQUALSDOT, loc(switchStmt.getSwitch().getOffset())));
|
||||
}
|
||||
|
||||
if (caseExpressionType == null) {
|
||||
for (var child : switchStmt.getBlocks()) {
|
||||
@ -846,7 +865,7 @@ public class TYPEStmt implements StatementVisitor {
|
||||
}
|
||||
if (label.getPattern() instanceof RecordPattern) {
|
||||
RecordPattern recordPattern = (RecordPattern) label.getPattern();
|
||||
constraintsSet.addUndConstraint(new Pair(label.getPattern().getType(), switchStmt.getSwitch().getType(), PairOperator.SMALLERDOT, loc(label.getOffset())));
|
||||
//constraintsSet.addUndConstraint(new Pair(label.getPattern().getType(), switchStmt.getSwitch().getType(), PairOperator.SMALLERDOT, loc(label.getOffset())));
|
||||
} else if (label.getPattern() instanceof FormalParameter) {
|
||||
constraintsSet.addUndConstraint(new Pair(label.getPattern().getType(), switchStmt.getSwitch().getType(), PairOperator.SMALLERDOT, loc(label.getOffset())));
|
||||
}
|
||||
@ -855,6 +874,8 @@ public class TYPEStmt implements StatementVisitor {
|
||||
} else {
|
||||
constraintsSet.addUndConstraint(new Pair(caseExpressionType, switchStmt.getSwitch().getType(), PairOperator.EQUALSDOT, loc(switchStmt.getSwitch().getOffset())));
|
||||
}
|
||||
|
||||
|
||||
for (var child : switchStmt.getBlocks()) {
|
||||
|
||||
|
||||
@ -888,7 +909,7 @@ public class TYPEStmt implements StatementVisitor {
|
||||
|
||||
for (var subPattern : pattern.getSubPattern()) {
|
||||
for (Constructor con : constructors) {
|
||||
System.out.println("----------------------\n" + subPattern.getType()+ " | " + con.getParameterList().getParameterAt(counter).getType() + "\n----------------------\n");
|
||||
System.out.println("----------------------\n" + subPattern.getType() + " | " + con.getParameterList().getParameterAt(counter).getType() + "\n----------------------\n");
|
||||
constraintsSet.addUndConstraint(new Pair(subPattern.getType(), con.getParameterList().getParameterAt(counter).getType(), PairOperator.SMALLERDOT, loc(con.getParameterList().getParameterAt(counter).getOffset())));
|
||||
}
|
||||
if (subPattern instanceof RecordPattern) recursivelyAddRecordConstraints((RecordPattern) subPattern);
|
||||
|
Loading…
Reference in New Issue
Block a user