Skip to content

Commit b9a8f5d

Browse files
rodrigomilissercosta358
authored andcommitted
allowed support for verifying refinements declared in a separate package
1 parent 7575e5a commit b9a8f5d

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

liquidjava-verifier/src/main/java/liquidjava/api/CommandLineLauncher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public static void main(String[] args) {
1818
// In eclipse only needed this:"../liquidjava-example/src/main/java/"
1919
// In VSCode needs:
2020
// "../liquidjava/liquidjava-umbrella/liquidjava-example/src/main/java/liquidjava/test/project";
21-
21+
2222
if (args.length == 0) {
2323
System.out.println("No input files or directories provided");
2424
System.out.println("\nUsage: ./liquidjava <...paths>");

liquidjava-verifier/src/main/java/liquidjava/processor/refinement_checker/object_checkers/AuxStateHandler.java

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -551,24 +551,21 @@ private static String addInstanceWithState(TypeChecker tc, String superName, Str
551551
prevInstance.getRefinement(), invocation);
552552
// vi2.setState(transitionedState);
553553
vi2.setRefinement(transitionedState);
554-
RefinedVariable rv = superName != null ? tc.getContext().getVariableByName(superName) : null;
555-
if (rv != null) {
556-
// propagate supertypes from the refined variable
557-
for (CtTypeReference<?> t : rv.getSuperTypes())
554+
Context ctx = tc.getContext();
555+
if (ctx.hasVariable(superName)) {
556+
RefinedVariable rv = ctx.getVariableByName(superName);
557+
for (CtTypeReference<?> t : rv.getSuperTypes()) {
558558
vi2.addSuperType(t);
559-
} else {
560-
// propagate supertypes from the previous instance
561-
for (CtTypeReference<?> t : prevInstance.getSuperTypes())
562-
vi2.addSuperType(t);
563-
}
559+
}
564560

565-
// if the variable is a parent (not a VariableInstance) we need to check that
566-
// this refinement
567-
// is a subtype of the variable's main refinement
568-
if (rv instanceof Variable) {
569-
Predicate superC = rv.getMainRefinement().substituteVariable(rv.getName(), vi2.getName());
570-
tc.checkSMT(superC, invocation);
571-
tc.getContext().addRefinementInstanceToVariable(superName, name2);
561+
// if the variable is a parent (not a VariableInstance) we need to check that
562+
// this refinement
563+
// is a subtype of the variable's main refinement
564+
if (rv instanceof Variable) {
565+
Predicate superC = rv.getMainRefinement().substituteVariable(rv.getName(), vi2.getName());
566+
tc.checkSMT(superC, invocation);
567+
tc.getContext().addRefinementInstanceToVariable(superName, name2);
568+
}
572569
}
573570

574571
invocation.putMetadata(tc.TARGET_KEY, vi2);

0 commit comments

Comments
 (0)