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

Parsetree.row_field.Rtag should contain attributes #6387

Closed
vicuna opened this Issue Apr 30, 2014 · 3 comments

Comments

Projects
None yet
2 participants
@vicuna
Copy link
Collaborator

vicuna commented Apr 30, 2014

Original bug ID: 6387
Reporter: @whitequark
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2015-12-11T18:26:46Z)
Resolution: fixed
Priority: normal
Severity: feature
Fixed in version: 4.02.0+dev
Category: ~DO NOT USE (was: OCaml general)

Bug description

I am developing an extension for serializing data to Protocol Buffers. In particular, it accepts attributes on variant constructors that define their mapping to integer keys used in the protocol, like this: type v = A [@key 1] | B [@key 10] of int.

It would make sense if I could define the exact same type, mapping to exact same message, with polymorphic variants: type v' = A [@key 1] | `B [@key 10] of int'. However, this is currently not possible, as parser does not accept attributes in that position.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Apr 30, 2014

Comment author: @alainfrisch

Wish granted by commit 14712 on trunk. ppx_tools has been adapted.

(The internal representation of Rtag might change in the future.)

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented May 5, 2014

Comment author: @alainfrisch

By symmetry, attributes are now also allowed on methods in object types:

type t = < m [@foo] : int >

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented May 5, 2014

Comment author: @alainfrisch

Manual and ppx_tools have been adapted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.