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

Signature does not compare @as tags of variant cases with payloads

Offen
#8,956 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
52/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
javascript
Bereich
compilers

Rechercherichtung

Start with rule 14 in compiler/ml/UntaggedVariants.md, linked from the issue, and compare its handling of nullary cases with payload cases. Then trace the compiler's interface inclusion checks for variant cases. Done means implementations that change payload case @as tags are rejected, matching the behavior for nullary cases.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

A signature does not compare the @as tags of a variant's cases with payloads. An implementation that swaps the tags passes the signature, and its values match the wrong constructor through the signature.

module M: {
  type t = A({x: int}) | C({x: int})
  let a: t
} = {
  type t = | @as("C") A({x: int}) | @as("A") C({x: int})
  let a = A({x: 1})
}
Console.log(switch M.a { | M.A(_) => "A" | M.C(_) => "C" })

Output: C.

Expected: the implementation is rejected, because its cases' tags differ from the signature's, as they are for nullary cases.

Interface inclusion compares the literals of nullary cases only. The rule is compiler/ml/UntaggedVariants.md rule 14, in #8952.

Vorherrschende Sprache
OCaml
Sterne
7.5k
Forks
483
Ø Merge
1 T. 1 Std.
Gemergte PRs (30 T.)
169

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.