Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

@notUndefined in an interface is not checked against the implementation

Offen
#8,964 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Ein zugehöriger Pull Request wurde bereits gemerged.

  • #8966 von @cknitt — gemerged

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Veraltet
Tech-Stack
ocaml
Bereich
compilers

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
OCaml
Sterne
7.5k
Forks
483
Ø Merge
19 Std. 35 Min.
Gemergte PRs (30 T.)
208

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus rescript-lang/rescript

Alle Issues in rescript-lang/rescript

Ähnliche Issues

Weitere Issues zu Compilers

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.