Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Untagged variant puts one typed array in another typed array's case

Abierto
#8,955 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
javascript
Área
compilers

Línea de trabajo

Start with rule 5 in compiler/ml/UntaggedVariants.md and review the linked context in #8952 and #8950, which changes how the types are recognized. Reproduce the example with the two typed arrays and trace how their type names are used for run-time case checks. Done means the invalid overlap is rejected or the mismatched value becomes a type error.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

An untagged variant with cases for two typed arrays accepts a value of one typed array in the case of the other, and the value then matches the other case.

@unboxed type ta = I8(Int8Array.t) | U8(Uint8Array.t)
let f = v => switch v { | I8(_) => "i8" | U8(_) => "u8" }
Console.log(f(I8(Uint8Array.fromArray([1]))))

Output: u8.

The typed-array types are abbreviations of one type, so I8(Uint8Array…) type-checks. The cases are classified by the type name as written, so the run-time check is instanceof Uint8Array.

Expected: either the cases are distinct types, so that I8(Uint8Array…) is a type error, or the variant is rejected because two cases share one type.

The rule is compiler/ml/UntaggedVariants.md rule 5, in #8952. #8950 changes how these types are recognized.

Lenguaje dominante
OCaml
Estrellas
7.5k
Forks
483
Merge medio
21 h 8 min
PR fusionados (30 d)
183

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de rescript-lang/rescript

Todos los issues de rescript-lang/rescript

Issues similares

Más issues de Compilers

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.