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

Reference a polymorphic variant constructor belonging to a type #907

Open
MisterDA opened this issue Nov 21, 2022 · 1 comment · May be fixed by #1115
Open

Reference a polymorphic variant constructor belonging to a type #907

MisterDA opened this issue Nov 21, 2022 · 1 comment · May be fixed by #1115
Labels
cross-referencer enhancement New feature or request

Comments

@MisterDA
Copy link
Contributor

MisterDA commented Nov 21, 2022

Considering a polymorphic variant type:

type switch = [`On; `Off]

I'd like to be able to refer to the constructors in the documentation. It could be doable if the full path is specified; there's even an anchor generated in the html code, which suggests a possible syntax:

(** {!type-switch.On} *)

Thanks!

@dbuenzli dbuenzli added parser enhancement New feature or request labels Nov 21, 2022
@Julow
Copy link
Collaborator

Julow commented Nov 21, 2022

This is not a parser problem but a missing feature in the reference resolver. Speaking of parser, there's room already in the syntax for the `: {!t."`Foo"}.
This might be useful to disambiguate between a regular and a polymorphic constructor (as an alternative to a prefix like {!t.poly-Foo}).

We already have code to handle ambiguous references, so it might be possible to handle cases like {!"`Foo"}, which could mean "The constructor `Foo in any type declaration in scope.".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cross-referencer enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants