Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Signature does not compare @as tags of variant cases with payloads

Aperta
#8,956 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
1-2 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
javascript
Ambito
compilers

Direzione di ricerca

Start with rule 14 in compiler/ml/UntaggedVariants.md, linked from the issue, and compare its handling of nullary cases with payload cases. Then trace the compiler's interface inclusion checks for variant cases. Done means implementations that change payload case @as tags are rejected, matching the behavior for nullary cases.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

A signature does not compare the @as tags of a variant's cases with payloads. An implementation that swaps the tags passes the signature, and its values match the wrong constructor through the signature.

module M: {
  type t = A({x: int}) | C({x: int})
  let a: t
} = {
  type t = | @as("C") A({x: int}) | @as("A") C({x: int})
  let a = A({x: 1})
}
Console.log(switch M.a { | M.A(_) => "A" | M.C(_) => "C" })

Output: C.

Expected: the implementation is rejected, because its cases' tags differ from the signature's, as they are for nullary cases.

Interface inclusion compares the literals of nullary cases only. The rule is compiler/ml/UntaggedVariants.md rule 14, in #8952.

Lingua principale
OCaml
Stelle
7.5k
Fork
483
Merge medio
21h 8m
PR unite (30g)
183

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rescript-lang/rescript

Tutte le issue di rescript-lang/rescript

Issue simili

Altre issue su Compilers

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.