Skip to content

Commit 32c5ca9

Browse files
allowed support for verifying refinements declared in a separate package
1 parent cdf2111 commit 32c5ca9

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,12 @@ public static ErrorEmitter launch(String... files) {
5757

5858
try {
5959
// To only search the last package - less time spent
60-
CtPackage v = factory.Package().getAll().stream().reduce((first, second) -> second).orElse(null);
61-
if (v != null)
62-
processingManager.process(v);
60+
// CtPackage v = factory.Package().getAll().stream().reduce((first, second) ->
61+
// second).orElse(null);
62+
// if (v != null)
63+
// processingManager.process(v);
6364
// To search all previous packages
64-
// processingManager.process(factory.Package().getRootPackage());
65+
processingManager.process(factory.Package().getRootPackage());
6566
} catch (Exception e) {
6667
e.printStackTrace();
6768
throw e;

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

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -528,18 +528,21 @@ private static String addInstanceWithState(TypeChecker tc, String superName, Str
528528
prevInstance.getRefinement(), invocation);
529529
// vi2.setState(transitionedState);
530530
vi2.setRefinement(transitionedState);
531-
RefinedVariable rv = tc.getContext().getVariableByName(superName);
532-
for (CtTypeReference<?> t : rv.getSuperTypes()) {
533-
vi2.addSuperType(t);
534-
}
531+
Context ctx = tc.getContext();
532+
if (ctx.hasVariable(superName)) {
533+
RefinedVariable rv = ctx.getVariableByName(superName);
534+
for (CtTypeReference<?> t : rv.getSuperTypes()) {
535+
vi2.addSuperType(t);
536+
}
535537

536-
// if the variable is a parent (not a VariableInstance) we need to check that
537-
// this refinement
538-
// is a subtype of the variable's main refinement
539-
if (rv instanceof Variable) {
540-
Predicate superC = rv.getMainRefinement().substituteVariable(rv.getName(), vi2.getName());
541-
tc.checkSMT(superC, invocation);
542-
tc.getContext().addRefinementInstanceToVariable(superName, name2);
538+
// if the variable is a parent (not a VariableInstance) we need to check that
539+
// this refinement
540+
// is a subtype of the variable's main refinement
541+
if (rv instanceof Variable) {
542+
Predicate superC = rv.getMainRefinement().substituteVariable(rv.getName(), vi2.getName());
543+
tc.checkSMT(superC, invocation);
544+
tc.getContext().addRefinementInstanceToVariable(superName, name2);
545+
}
543546
}
544547

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

0 commit comments

Comments
 (0)