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

@notUndefined in an interface is not checked against the implementation

Chiusa
#8,964 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Una pull request collegata è già stata integrata.

  • #8966 di @cknitt — integrata

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
ocaml
Ambito
compilers

Direzione di ricerca

Start with compiler/ml/UntaggedVariants.md, rule 13, and the linked discussion in #8952, which describe the current interface inclusion behavior. Then trace inclusion checks for @notUndefined across interfaces, functor arguments, and with type constraints. Done means implementations whose types can hold undefined are rejected while the listed valid implementation types remain accepted; linked pull request #8966 is already open.

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

Descrizione

An interface can declare an abstract type @notUndefined while its implementation is a type that holds undefined. Interface inclusion does not compare the attribute, so clients unbox option of the type, and Some(None) becomes None.

// M.resi
@notUndefined type t
let none: t

// M.res
type t = option<int>
let none: t = None

// C.res
@inline(never) let id = x => x
let o: option<M.t> = id(Some(M.none))
Console.log2(
  "Some(none) is",
  switch o {
  | Some(_) => "Some"
  | None => "None"
  },
)

Output on master: Some(none) is None. C builds Some(M.none) as M.none itself, which is undefined.

Expected: the implementation is rejected, because type t = option<int> can hold undefined, which the interface rules out. An implementation satisfies @notUndefined when its own type cannot hold undefined: it is @notUndefined itself, a record, a builtin type other than option/unit, or a type declared with @instanceOf/@typeOf (#8950).

The same holds for functor arguments and with type constraints. compiler/ml/UntaggedVariants.md (rule 13, #8952) states that inclusion does not compare @notUndefined.

Lingua principale
OCaml
Stelle
7.5k
Fork
483
Merge medio
20h
PR unite (30g)
219

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.