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 16bc975
Browse filesBrowse the repository at this point in the historyBrowse files
Keep a doc comment in front of a record or open type representation
Why:
Only a doc comment after an attribute reached the declaration; one
directly after `=` was parsed as the start of a constructor list and
failed on `{` or `..`. It 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.
AST modified (doc comment before a record representation):
Example:
type t = /** doc */ {x: int}
Before (diagnostic):
At this point, I'm looking for an uppercased name like `Array` or `Math`
After (parse):
type_declaration "t"
attribute "res.doc"
[
structure_item
Pstr_eval
expression
Pexp_constant PConst_string (source=" doc ", semantic=" doc ")
]
ptype_params =
[]
ptype_cstrs =
[]
ptype_kind =
Ptype_record
…
Format modified (doc comment before a record or open representation):
Example:
type t = /** doc */ {x: int}
type u = /** doc */ ..
After (rescript):
/** doc */
type t = {x: int}
/** doc */
type u = ..
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