@notUndefined in an interface is not checked against the implementation
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
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
-
Per-constructor @unboxed is not compared across interfaces or coercionsEvtl. vergeben @cknitt hat das heute übernommen. Offen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 25/100
rescript-lang/rescript#9038 ·
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
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
-
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
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100