Open ArmborstL opened 10 months ago
Result of discussion today:
In principle, there are two approaches to importing such specifications:
To an end user, the first one would probably feel more natural, so this should be the default way.
However, for libraries (e.g. providing graph functionalities) we might want to have a single implementation that can be used in specifications of all target languages. Thus, here a dedicated namespace is needed. It is already possible to include PVL files into non-PVL projects, which would be the way for the libraries. But it was agreed that this should be used only for specification purposes, not e.g. mix implementations with parallel blocks into non-PVL projects.
Rough proposal:
//@ spec_import Graph.stuff;
package a;
import a.b.C;
import d.e.F;
//@ ghost import g.h.globalPredicate;
class Test {
/*
Here we can use:
- globalPredicate
- g.h.globalPredicate
- (implicitly) any stuff in a.*
- stuff (from Graph.stuff)
*/
}
//@ spec_import Graph.stuff;
#include <interface.h>
//@ ghost include <predicates.h>
If global declarations are defined in one file and used in another, VerCors does not make the connection. I have file A.java
and file B.java
Invoking VerCors on both files together results in "Could not find method named p" for the usage in
B
. It should be able to match the declaration in A.java to the usage inB
. Pieter commented that currently "within a Java file, the resolution works normally; cross-file you can not see the global declarations in otherJavaNamespace
s".