-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix visibility analysis and do not traverse CAbstractStruct into type…
… definitions This fixes #247
- Loading branch information
Showing
7 changed files
with
79 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
module AbstractStruct2 | ||
module HS = FStar.HyperStack | ||
module B = LowStar.Buffer | ||
|
||
open FStar.HyperStack.ST | ||
|
||
[@@CAbstractStruct] | ||
noeq | ||
type handle = { | ||
something: bool; | ||
another: AbstractStructAbstract.t AbstractStructParameter.param; | ||
} | ||
|
||
let init (_:unit) = | ||
let h = { | ||
something = false; | ||
another = AbstractStructAbstract.make AbstractStructParameter.({ param_one = true; param_two = false }) | ||
} in | ||
B.malloc HS.root h 1ul | ||
|
||
open LowStar.BufferOps | ||
open AbstractStructParameter | ||
open AbstractStructAbstract | ||
|
||
let main () = | ||
let p = init () in | ||
if (read (!*p).another).param_two then | ||
1l | ||
else | ||
0l |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module AbstractStruct2 | ||
open FStar.HyperStack.ST | ||
module B = LowStar.Buffer | ||
|
||
[@@CAbstractStruct] | ||
val handle : Type0 | ||
|
||
val init (_:unit) | ||
: ST (B.pointer handle) | ||
(requires fun _ -> True) | ||
(ensures fun _ handle h1 -> B.live h1 handle) | ||
|
||
val main: unit -> St Int32.t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module AbstractStructAbstract | ||
|
||
type t a = (bool & a) | ||
|
||
let make #a x = (false, x) | ||
let read #a t = snd t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module AbstractStructAbstract | ||
|
||
val t (a:Type0) : Type0 | ||
|
||
val make (#a:Type0) (x:a) : t a | ||
val read (#a:Type0) (x:t a) : a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module AbstractStructParameter | ||
|
||
[@@CAbstractStruct] | ||
type param = { | ||
param_one: bool; | ||
param_two: bool | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters