Per-constructor @unboxed is not compared across interfaces or coercions
Los mantenedores suelen responder en 1 día
@cknitt ya está trabajando en esto.
Desde el 25/10/2026.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- ocaml
- Área
- compilers
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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).
- Lenguaje dominante
- OCaml
- Estrellas
- 7.5k
- Forks
- 483
- Merge medio
- 20 h
- PR fusionados (30 d)
- 219
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de rescript-lang/rescript
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
rescript-lang/rescript#9037 ·
Los mantenedores suelen responder en 1 día
-
RFC: Temporal API bindingsAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 12/100
rescript-lang/rescript#9044 · 2 reacciones ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
rescript-lang/rescript#9006 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 70/100
rescript-lang/rescript#8997 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
rescript-lang/rescript#8994 ·
Los mantenedores suelen responder en 1 día
Todos los issues de rescript-lang/rescript
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Recover inside a parameter listAbiertoenhancement scope:diagnostics scope:syntax
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
-
code: refactoring good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
idris-lang/Idris2#3887 ·
Los mantenedores suelen responder en 1 día
-
luaebpf: a write to a field of a table the body built is refused as an assignment to a globalAbiertoseverity: low
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
luainkernel/lunatik#2207 ·
Los mantenedores suelen responder en 1 día
-
backend:X86 generated by fuzzer llvm:globalisel miscompilation
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
llvm/llvm-project#235468 · 1 comentario ·
Los mantenedores suelen responder en 1 día