-
Notifications
You must be signed in to change notification settings - Fork 232
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
Support mutually recursive let bindings in sigelt_view #2291
Support mutually recursive let bindings in sigelt_view #2291
Conversation
3911ee5
to
d6758e6
Compare
d6758e6
to
838559a
Compare
Following a discussion with @aseemr and @nikswamy, I've changed the implementation of this PR to generalize | Sg_MLet of bool * list<letbinding> Where the boolean value flags whether the binding is recursive, and I also defined the |
Fixed the errors caused by this PR in HACL* in hacl-star#471 |
e085403
to
c289d4c
Compare
c289d4c
to
7d4cb50
Compare
BU.bind_opt (unembed (e_list e_letbinding) cb lbs) (fun lbs -> | ||
Some <| Sg_Let (r, lbs))) | ||
|
||
| Construct (fv, _, [(t, _); (us, _); (nm, _)]) when S.fv_eq_lid fv ref_Sg_Val.lid -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this code fixing the unembedding of Sg_val
? Was it a bug in the previous code? (Asking only because doesn't seem directly related to the change that this PR is doing.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's fixing the Sg_Val
case. I really can’t remember now, but I'm almost positive it was a bug.
@@ -673,22 +733,6 @@ let e_exp = | |||
|
|||
let e_binder_view = e_tuple2 e_bv (e_tuple2 e_aqualv (e_list e_term)) | |||
|
|||
let e_attribute = e_term |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to remove these? I am guessing these functions are not used currently but still any harm in keeping them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These aren’t removed, they're moved a little earlier in the module (l.625).
Thanks Antonio! Looks good to me, left a couple of comments. Since this is a breaking change, can you add an entry to Thanks again, this is a nice enhancement to the reflection API that would definitely be useful for others too. |
Hi @aseemr, thank you so much for the review. I've updated the |
Context
The module
FStar.Reflection.Data
defines the data typesigelt_view
, which is used for inspecting the signature of a declaration. As of right now, its definition is:The problem is that there’s no way of inspecting mutually recursive let bindings, as the first constructor can only represent a single standalone let. In contrast, the
sigelt
datatype'sSig_let
constructor has a list of let bindings to accommodate mutually recursive lets.Implemented solution
In this PR I provide a workaround to this, which involves adding a new constructor to
sigelt_view
to represent mutually recursive lets:where
lb_view
is a type that packs the same information as inSg_Let
, and is defined as:I chose to add a new constructor to make sure this worked without having to fix every use of
Sg_Let
, but I believe the two could well be unified. This is something I need in the project I'm currently working on, so I would be happy to hear you opinion on this issue and make any changes to its solution.