Doc comments in type with labelled argument fail to parse
Using 10.0.0-beta.3
I have an external in my project that looks like this:
@val external myMethod: (
/** comment for argument 1 */
~firstArg: bool,
/** comment for argument 2 */
~secondArg: bool
) => string = "myMethod"
When compiling this with v10, it fails to compile:
I'm not sure what to parse here when looking at "DocComment comment for argument 1 ".
I can work around the problem using regular comments or @ocaml.doc annotations.
This is correct and reflective of where the parser currently accepts @annotations. See release notes.
A.k.a. known breaking change. The kind, that is. Not the specific example.
There's a long story. Something something the ast does not have locations for labelled argument. Which keeps coming up and creating little issues. But we are not changing the ast just yet.
sorry, I have looked at the notes and it wasn't clear (they've become a bit hard to read with breaking changes spread across multiple alpha/beta versions).
I found the note that talks about them only being valid where @foo is allowed, which is confusing because @ocaml.doc works?
It's definitely true that we need to improve release notes for the actual release. Would you have a suggestion for how this could have been clarified? Feel free to open a PR on the CHANGELOG directly.
I think, as we get closer to release, it's time to just combine them all into one v10 section. New beta releases can have their own section, but all previous v10 updates should be combined IMO.
I don't think I'll have time to log a PR today, maybe tomorrow. Should I do it against master or the new v10 branch/PR?
I found the note that talks about them only being valid where
@foois allowed, which is confusing because@ocaml.docworks?
Technically /** is parsed in not exactly the same code path as @foo so this is a good question (issue) for the syntax repo. As to why there's a difference here.
I think, as we get closer to release, it's time to just combine them all into one v10 section. New beta releases can have their own section, but all previous v10 updates should be combined IMO.
I don't think I'll have time to log a PR today, maybe tomorrow. Should I do it against master or the new v10 branch/PR?
v10 branch.
Better example:
type z = (
@thisIsOk ~firstArg: bool,
/** thisIsNotOk */
~secondArg: bool
) => string
The rescript-lang/syntax repo is obsolete and will be archived soon. If this issue is still relevant, please reopen in the compiler repo (https://github.com/rescript-lang/rescript-compiler) or comment here to ask for it to be moved. Thank you for your contributions.