Per-constructor @unboxed is not compared across interfaces or coercions
Maintainer antworten meist innerhalb von 1 Tag
@cknitt arbeitet bereits daran.
Seit 25.10.2026.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 25/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- ocaml
- Bereich
- compilers
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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).
- Vorherrschende Sprache
- OCaml
- Sterne
- 7.5k
- Forks
- 483
- Ø Merge
- 19 Std. 35 Min.
- Gemergte PRs (30 T.)
- 208
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
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
rescript-lang/rescript#9037 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
rescript-lang/rescript#9006 · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 70/100
rescript-lang/rescript#8997 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
rescript-lang/rescript#8994 ·
Maintainer antworten meist innerhalb von 1 Tag
-
@notUndefined in an interface is not checked against the implementationEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
rescript-lang/rescript#8964 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in rescript-lang/rescript
Ähnliche Issues
-
enhancement scope:diagnostics scope:syntax
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 77/100
-
code: refactoring good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
idris-lang/Idris2#3887 ·
Maintainer antworten meist innerhalb von 1 Tag
-
severity: low
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
luainkernel/lunatik#2207 ·
Maintainer antworten meist innerhalb von 1 Tag
-
backend:X86 generated by fuzzer llvm:globalisel miscompilation
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
llvm/llvm-project#235468 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
area:codegen backend:cuda backend:hip bug direction:input
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
CrossGL/crosstl#3061 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag