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 6883c20
Browse filesBrowse the repository at this point in the historyBrowse files
Parse attributes after = private and a doc comment before a manifest
Why:
`private @attr {x: int}` took the type expression path and rejected
the record, and a doc comment right after `=` always started a
constructor list, so `/** d */ int` failed. Both now use the
lookahead that attributes after `=` already had: past attributes and
doc comments, a record, `..`, `|` or constructor is a representation,
anything else a manifest.
AST modified (doc comment before a manifest):
Example:
type z = /** d */ int
Before (diagnostic):
Did you mean `Int` instead of `int`?
After (parse):
type_declaration "z"
ptype_kind =
Ptype_abstract
ptype_private = Public
ptype_manifest =
Some
core_type
attribute "res.doc"
…
Ptyp_constr "int"
Format modified (attribute after `private`):
Example:
type t = private @attr {x: int}
type u = private /** d */ int
Before (diagnostic):
An inline record type declaration is only allowed in a variant
constructor's declaration or nested inside of a record type declaration
After (rescript):
@attr type t = private {x: int}
type u = private /** d */ int
Review: Does a doc comment change how `{...base, y: int}` parses? No. A
spread after a leading doc comment stays a record declaration and after a
leading attribute an object type, as before; only `{.`, `{..` and `{"`
after a doc comment are new, and they parse as object types.
Fixes#9106
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gGkPma9LAZimuQjnrP
Signed-off-by: Christoph Knittel <ck@cca.io>
0 commit comments