Parser rejects `private @attr {…}` and a doc comment before a non-record type
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- ocaml
- Bereich
- compilers
Rechercherichtung
Start in compiler/syntax/src/res_core.ml at parse_private_eq_or_repr and the type representation dispatch around the cited lines. Trace how private attributes and DocComment tokens reach parse_typ_expr or parse_type_representation, then check nearby parser tests for the corresponding syntax cases. Done means both examples and the listed related type forms parse without changing existing cases; pull request #9115 is already open.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Found by a bug hunt over the 16 commits from eb087382 to cd641cbc.
private followed by an attribute and a record.
type t = private @attr {x: int}
This fails with "An inline record type declaration is only allowed in a variant constructor's declaration or nested inside of a record type declaration". type t = @attr {x: int} (#8919) and type u = private {x: int} both parse. At counts as the start of a type expression (res_grammar.ml#L205), so parse_private_eq_or_repr parses @attr {x: int} with parse_typ_expr (res_core.ml#L5802-L5803). The non-private path has its own At lookahead (res_core.ml#L6043).
A doc comment after = in front of a non-record type.
type z = /** d */ int
This fails with "Did you mean Int instead of int?". {"a": int}, (int, int) and [#A] fail the same way. /** d */ {x: int}, /** d */ A | B and @attr int parse. res_core.ml#L6037 sends DocComment straight to parse_type_representation. The At case at the next arm looks ahead for objects and manifests first.
Both reproduce at b123b7c3.
🤖 Generated with Claude Code
- Vorherrschende Sprache
- OCaml
- Sterne
- 7.5k
- Forks
- 484
- Ø Merge
- 20 Std. 19 Min.
- Gemergte PRs (30 T.)
- 242
Entwicklungsumgebung
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus rescript-lang/rescript
-
Record coercion can construct a private record from outside its moduleEvtl. vergeben @cknitt hat das heute übernommen. Offen
Schwierigkeit 4/5 1-2 Tage Anfängerfreundlichkeit 52/100
rescript-lang/rescript#9124 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 56/100
rescript-lang/rescript#9123 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 1-2 Tage Anfängerfreundlichkeit 55/100
rescript-lang/rescript#9122 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 15/100
rescript-lang/rescript#9109 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Formatter: five cases where comments and doc comments are placed wronglyEvtl. vergeben @cknitt hat das vor 1 Tag übernommen. Offen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
rescript-lang/rescript#9107 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in rescript-lang/rescript
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
CanadaHonk/porffor#426 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 77/100
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
compiler-rt:asan llvm:transforms
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
llvm/llvm-project#236682 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Lexer: Turbopack magic comments are not classifiedEvtl. vergeben @Aschenbath hat das heute übernommen. OffenA-lexer
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
oxc-project/oxc#28320 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag