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) {
|
if (caseExpressionType == null) {
|
||||||
for (var child : switchStmt.getBlocks()) {
|
for (var child : switchStmt.getBlocks()) {
|
||||||
@ -846,7 +865,7 @@ public class TYPEStmt implements StatementVisitor {
|
|||||||
}
|
}
|
||||||
if (label.getPattern() instanceof RecordPattern) {
|
if (label.getPattern() instanceof RecordPattern) {
|
||||||
RecordPattern recordPattern = (RecordPattern) label.getPattern();
|
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) {
|
} else if (label.getPattern() instanceof FormalParameter) {
|
||||||
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())));
|
||||||
}
|
}
|
||||||
@ -855,6 +874,8 @@ public class TYPEStmt implements StatementVisitor {
|
|||||||
} else {
|
} else {
|
||||||
constraintsSet.addUndConstraint(new Pair(caseExpressionType, switchStmt.getSwitch().getType(), PairOperator.EQUALSDOT, loc(switchStmt.getSwitch().getOffset())));
|
constraintsSet.addUndConstraint(new Pair(caseExpressionType, switchStmt.getSwitch().getType(), PairOperator.EQUALSDOT, loc(switchStmt.getSwitch().getOffset())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (var child : switchStmt.getBlocks()) {
|
for (var child : switchStmt.getBlocks()) {
|
||||||
|
|
||||||
|
|
||||||
@ -888,8 +909,8 @@ public class TYPEStmt implements StatementVisitor {
|
|||||||
|
|
||||||
for (var subPattern : pattern.getSubPattern()) {
|
for (var subPattern : pattern.getSubPattern()) {
|
||||||
for (Constructor con : constructors) {
|
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())));
|
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);
|
if (subPattern instanceof RecordPattern) recursivelyAddRecordConstraints((RecordPattern) subPattern);
|
||||||
counter++;
|
counter++;
|
||||||
|
Loading…
Reference in New Issue
Block a user