-
Notifications
You must be signed in to change notification settings - Fork 33
Code Refactoring #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code Refactoring #109
Conversation
CatarinaGamboa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, check the comments
|
|
||
| public StateConflictError(CtElement element, Predicate predicate, String className) { | ||
| super("State Conflict Error", "Found multiple disjoint states from a StateSet in refinement", element); | ||
| super("State Conflict Error", "Found multiple disjoint states in state transition", element); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could even improve this message to something like "Found multiple disjoint states in state transition - State transition can only go to one state of each state set"
| String name = String.format(freshFormat, context.getCounter()); | ||
| if (c.getVariableNames().contains(WILD_VAR)) { | ||
| c = c.substituteVariable(WILD_VAR, name); | ||
| String name = String.format(Formats.RET, context.getCounter()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we changing from fresh to return?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good eye! 😅
| System.out.println("\nSMT subtyping:" + stringSMT + " <: " + expectedType.toString()); | ||
| System.out.println("--------------------------------------------------------------"); | ||
| } | ||
| // private void printVCs(String string, String stringSMT, Predicate expectedType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eliminate this code already, we can always go a previous version in git to get them
| Predicate cSMTMessageReady = premises; // substituteByMap(premises, map); | ||
| ErrorHandler.printError(element, s, etMessageReady, cSMTMessageReady, map, errorEmitter); | ||
| } | ||
| // private void printError(Predicate premises, Predicate expectedType, CtElement element, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
| // TODO COMPLETE WITH MORE OPERANDS | ||
| } | ||
| return switch (kind) { | ||
| case PLUS -> Ops.PLUS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
niceee
| } | ||
| return noOld; | ||
| } | ||
| // private static Predicate changeVarsFields(Predicate pred, TypeChecker tc) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete
| case Types.BOOLEAN -> new LiteralBoolean(value); | ||
| case Types.INT, Types.SHORT -> new LiteralInt(value); | ||
| case Types.DOUBLE, Types.LONG -> new LiteralReal(value); | ||
| default -> new LiteralReal(value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the future if we want to add strings this default can be a problem, maybe we can emit an error or smt
CatarinaGamboa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a followup for cleanup feel free to remove all code in comments, its just polluting the codebase
Cleaned up some code by:
Formats,Keys,Ops,PatternsandTypes