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
Toplevel let should take attributes. #6677
Comments
Comment author: furuse Oh #6586 is technically the same issue. The motivation here is to control the warning 39 at the toplevel let recs by attributes. |
Comment author: furuse [@@@ocaml.warning "-39"] works but it changes the setting globally... |
Comment author: @damiendoligez This is not exactly the same as #6586: what you need is not a shorthand notation but any way at all of placing an attribute on the whole let. |
Comment author: @alainfrisch Toplevel lets accept attributes. As for any other structure/signature item, the syntax is [@@...] following the item: let rec x = 1 in x Now I don't think that ocaml.warning is interpreted in such context, but this is another story. If this is about generated code, a workaround is to generate: include struct |
Comment author: @whitequark I think this was fixed in 4.03. |
Comment author: @alainfrisch
This is now allowed syntactically; the attribute is attached to the "value_binding". But the ocaml.warning attribute is not interpreted on value bindings. It could make sense to control warnings while type-checking each binding, but this would require a different fix anyway. I suggest to keep this ticket open for this part. |
Comment author: @alainfrisch The original issue (being able to add attributes on toplevel lets) has been fixed. Marking as fixed for now. I don't know how critical is the remaining part (interpreting the ocaml.warning attribute). Feel free to open another ticket for this part. |
Original bug ID: 6677
Reporter: furuse
Assigned to: @alainfrisch
Status: resolved (set by @alainfrisch on 2017-02-24T15:13:02Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.02.1
Fixed in version: 4.03.0
Category: typing
Related to: #6586 #6714
Monitored by: @whitequark @hcarty
Bug description
In 4.02.1, the toplevel let does not accept attributes but only extensions, while the local let accepts the both. Is this asymmetry required?
This is problematic when ppx code generators produce toplevel bindings possibly recursive but not necessarily.
At the local lets we can use [@ocaml.warning "-39"] to stop the warning:
But it seems the same technique is not usable against the toplevel let:
The text was updated successfully, but these errors were encountered: