[JS/TS] Char.ToUpper and Char.ToUpperInvariant expand one-to-many Unicode mappings

Aperta
#5,279 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
57/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
fsharp, javascript, typescript
Ambito
compilers

Direzione di ricerca

Start by tracing how System.Char.ToUpper and System.Char.ToUpperInvariant compile for Fable’s JavaScript and TypeScript targets, then compare that behavior with the Rust target described in the issue. Reproduce the four examples in the issue and check that each returns the expected single-character result, including unchanged characters without a simple uppercase mapping.

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

Descrizione

Description

In Fable targeting JavaScript/TypeScript, System.Char.ToUpper and System.Char.ToUpperInvariant compile directly to c.toLocaleUpperCase() and c.toUpperCase(). Because Fable represents char as a 1-character string and int c as c.charCodeAt(0), characters whose full Unicode uppercase mapping has multiple UTF-16 code units produce a multi-character char value or truncate to the first code unit when converted to int.

In .NET (and in Fable's Rust target), Char.ToUpper and Char.ToUpperInvariant use simple single-character case mapping and return the input character unchanged when it has no single-character uppercase equivalent or is already titlecase/uppercase (such as U+1F88 'ᾈ').

Repro code
open System

printfn "%d" (int (Char.ToUpperInvariant 'ß'))
printfn "%d" (int (Char.ToUpper 'ʼn'))
printfn "%d" (int (Char.ToUpperInvariant 'ᾈ'))
printfn "%s" (string (Char.ToUpperInvariant 'ß'))
Expected and actual results

Expected output (matching .NET 10.0.403):

223
329
8072
ß

Actual output under Fable (JavaScript/TypeScript on Node.js):

83
700
7944
SS
Related information
  • Fable version: 5.27.0
  • Operating system: Linux / macOS (Node.js)

Credit: https://ucsbplse.github.io/

Lingua principale
F#
Stelle
3.2k
Fork
335
Merge medio
18h 57m
PR unite (30g)
154

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

  • Nessun Dockerfile né file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

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 fable-compiler/Fable

Tutte le issue di fable-compiler/Fable

Issue simili

Altre issue su Compilers

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.