Parser: an attribute or doc comment in front of a `{...` spread type changes how it is read
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 55/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- ocaml
- Domaine
- compilers
Piste de recherche
Start by reading the lookahead in res_core.ml and the referenced context in #9115, which keeps the current behaviors. Reproduce the table with bsc -bs-no-builtin-ppx -only-parse -dparsetree to trace how prefixes affect {... classification. Done means prefixes no longer change the classification, both reported syntax errors are fixed, and the compatibility change has a changelog entry.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
A type body starting with {... can be a record spread or an object spread. Without a prefix, the parser reads it as a record unless a quoted field follows. With an attribute or a doc comment in front, it takes a different path, so the prefix changes what the declaration means or makes it a syntax error.
Checked on master at 85f31fbb15 with bsc -bs-no-builtin-ppx -only-parse -dparsetree:
type t = … |
no prefix | @attr |
/** d */ |
|---|---|---|---|
{...base, y: int} |
record | syntax error | record |
{...base} |
record | object type | record |
{...base, "y": int} |
object type | object type | syntax error |
The same holds after private, e.g. type t = private @attr {...base, y: int} is a syntax error.
Cause: after an attribute, the lookahead in res_core.ml treats {... as the start of a type expression (object type); after a doc comment, the record path is taken unconditionally. #9115 (for #9106) keeps both behaviours as they are, so nothing master accepts changes there.
Expected: the prefix doesn't matter, and {... is classified as without one. That fixes both syntax errors, but it also turns @attr {...base} from an object type into a record, which changes code that compiles today, so it needs a changelog entry.
🤖 Generated with Claude Code
- Langage dominant
- OCaml
- Étoiles
- 7.5k
- Forks
- 484
- Merge moyen
- 20 h 43 min
- PR mergées (30 j)
- 263
Préparer son environnement
Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de rescript-lang/rescript
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 85/100
rescript-lang/rescript#9139 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
rescript-lang/rescript#9151 ·
Les mainteneurs répondent en général sous 1 jour
-
Printed @as names of fields and constructors turn non-ASCII letters into other charactersPeut-être pris @cknitt l’a pris il y a 1 jour. Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 25/100
rescript-lang/rescript#9142 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
rescript-lang/rescript#9130 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Dev dependencies interactingPeut-être pris @CarlOlson l’a pris il y a 4 jours. Ouverte
Difficulté 4/5 1-2 jours Accessibilité débutants 25/100
rescript-lang/rescript#9089 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de rescript-lang/rescript
Issues similaires
-
bot-triaged module: inductor oncall: pt2 topic: fuzzer triaged
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour
-
bug needs-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
microsoft/DirectXShaderCompiler#9087 ·
Les mainteneurs répondent en général sous 1 jour
-
confirmed generated by fuzzer llvm:codegen miscompilation
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
llvm/llvm-project#237380 ·
Les mainteneurs répondent en général sous 1 jour
-
Source comments still name the removed set_observer_thresholds and set_observer_scale builtinsOuvertearea:observer area:trace-tape found-by:code-review kind:docs-drift
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
InauguralSystems/EigenScript#2212 ·
Les mainteneurs répondent en général sous 1 jour
-
bug medium priority openmp tokenizer wrong result
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour