Skip to content
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

Standardize "resource functions" to predicates #607

Merged
merged 3 commits into from
Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions examples/basic/predicate.pvl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//:: case OnlyPredicate
//:: verdict Pass
//:: tools silicon carbon

class Pred {
resource f() = true;
}
14 changes: 10 additions & 4 deletions src/main/java/vct/col/features/FeatureRainbow.scala
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,16 @@ class RainbowVisitor(source: ProgramUnit) extends RecursiveVisitor(source, true)
}
}

if(isPure(m) && isInline(m))
addFeature(InlinePredicate, m)
if(isPure(m) && m.getBody.isInstanceOf[BlockStatement])
addFeature(PureImperativeMethods, m)
if(isPure(m)) {
if(isInline(m))
addFeature(InlinePredicate, m)
if(m.getBody.isInstanceOf[BlockStatement])
addFeature(PureImperativeMethods, m)
}

if(m.kind == Method.Kind.Pure && m.getReturnType.isPrimitive(PrimitiveSort.Resource))
addFeature(NotStandardized, m)

if(m.kind == Method.Kind.Constructor)
addFeature(Constructors, m)
if(!m.getReturnType.isPrimitive(PrimitiveSort.Void) && !isPure(m))
Expand Down