You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cf0a239
Browse filesBrowse the repository at this point in the historyBrowse files
Keep a doc comment in front of a record or open type representation
A doc comment directly after `=` now goes through the same lookahead as an
attribute: in front of `{` or `..` it attaches to the type declaration, in
front of a constructor it still attaches to that constructor. Before, only a
doc comment after an attribute reached the declaration; one at the start
was parsed as a constructor list and failed on `{` or `..`.
Example (rescript):
type t = /** doc */ {x: int}
type u = /** doc */ ..
Before (text):
syntax errors: a constructor is expected at `{` and at `..`
After (rescript):
/** doc */
type t = {x: int}
/** doc */
type u = ..
Area: syntax tests
Output: unchanged
Formatting: changed `type t = /** doc */ {...}` and `type t = /** doc */ ..`
now parse and print with the doc comment in front of `type`
Formats: none
PPX: unchanged
Editor: unchanged
Tests: ~tests/syntax_tests/data/parsing/grammar/typedefinition/typeRepresentation.res
~tests/syntax_tests/data/parsing/grammar/typedefinition/expected/typeRepresentation.res.txt
~tests/syntax_tests/data/printer/typeDef/attributes.res
~tests/syntax_tests/data/printer/typeDef/expected/attributes.res.txt
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kr4cjoUi2f5VpMvE6wT9bo
Signed-off-by: Christoph Knittel <ck@cca.io>
0 commit comments