Per-constructor @unboxed is not compared across interfaces or coercions
I maintainer di solito rispondono entro 1 giorno
@cknitt ci sta già lavorando.
Dal 25/10/2026.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- ocaml
- Ambito
- compilers
Direzione di ricerca
The cause lies in Includecore.compare_variants, Variant_coercion.variant_representation_matches, and Printtyp.print_variant_configuration_issue in the compiler. Read those modules to see how variant tags and @unboxed are checked. Done means an untagged constructor only matches an untagged one across interfaces and coercions, with correct error naming.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Whether a constructor is @unboxed (untagged) is not compared across interfaces or in coercions:
module M: {
type t = | @unboxed A(int) | B({x: int})
let a: t
} = {
type t = | A(int) | B({x: int})
let a = A(3)
}
let n = switch M.a { | A(i) => i | B(_) => -1 } // -1: the client expects 3, the implementation built {TAG: "A", _0: 3}
The reverse direction is accepted too. So is a coercion between the two representations:
type a = | @unboxed A(int) | B({x: int})
type b = | A(int) | B({x: int}) | C
let x: b = (A(3): a :> b) // 3 is not a b: matching it gives C
Also, when the @unboxed configurations of two variants differ, the coercion error says the wrong variant is unboxed ("Variant c is unboxed" for the plain one).
Observed on master (d48d577bf6). Cause:
Includecore.compare_variantscompares tags of tagged constructors only, so a tagged and an untagged constructor agree.- The coercion check compares only the declared
@as(Variant_coercion.variant_representation_matches). Printtyp.print_variant_configuration_issueinverts "not".
Expected: an untagged constructor agrees only with an untagged one, in interfaces and coercions alike, and the error names the unboxed variant.
Found by a review of the untagged variant work (#8950).
- Lingua principale
- OCaml
- Stelle
- 7.5k
- Fork
- 483
- Merge medio
- 20h
- PR unite (30g)
- 219
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di rescript-lang/rescript
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
rescript-lang/rescript#9037 ·
I maintainer di solito rispondono entro 1 giorno
-
RFC: Temporal API bindingsAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 12/100
rescript-lang/rescript#9044 · 2 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
rescript-lang/rescript#9006 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 70/100
rescript-lang/rescript#8997 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
rescript-lang/rescript#8994 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di rescript-lang/rescript
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement scope:diagnostics scope:syntax
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
-
code: refactoring good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
idris-lang/Idris2#3887 ·
I maintainer di solito rispondono entro 1 giorno
-
luaebpf: a write to a field of a table the body built is refused as an assignment to a globalApertaseverity: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
luainkernel/lunatik#2207 ·
I maintainer di solito rispondono entro 1 giorno