Diagnostics: inline-record mutability coercion gives no reason, and `throw` in `finally` warns about unreachable code
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 38/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- ocaml
- Ambito
- compilers, developer-experience
Direzione di ricerca
The throw-in-finally case points to compiler/ml/typecore.ml around lines 2920-2922, where the finally block is typed as a statement; check how warning 21 is raised for non-returning statements. The inline-record coercion error is reached through a subtype path the payload does not name, so locate it by searching for the existing plain-record mutability explanation and compare the two. Run the two snippets from the issue to confirm the wrong output, and count done as the mutable-field explanation appearing for inline records and warning 21 no longer firing for throw in finally.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Found by differential semantic drift analysis from b123b7c3 to c10223e8.
What is broken
-
Coercion into an inline record with a mutable field gives no reason (#9086). The coercion is now rejected, correctly:
type v1 = A({x: float}) type v2 = A({mutable x: float}) let a: v1 = A({x: 0.}) let b = (a :> v2)The error is only
Type v1 is not a subtype of v2. For a field of a plain record type ({r: r1}into{r: r2}) the error explains: "The field x is mutable in record r2, but not in record r1. A coercion can't make a field writable." -
throwinfinallygives warning 21 (#8931):exception B let k = () => try { 1 } finally { throw(B) }Warning 21: "This statement does not continue execution; following code is unreachable." No code follows the
throw; the generated JavaScript is correct. The finally block is typed as a statement (typecore.mlL2920-L2922), and a non-returning statement triggers this warning.
Possible cause (speculation only)
The inline-record path reports the subtype failure before reaching the field comparison that produces the explanation for plain records.
🤖 Generated with Claude Code
- Lingua principale
- OCaml
- Stelle
- 7.5k
- Fork
- 484
- Merge medio
- 17h 2m
- PR unite (30g)
- 249
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di rescript-lang/rescript
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
rescript-lang/rescript#9182 ·
I maintainer di solito rispondono entro 1 giorno
-
Issues from differential semantic drift analysis (b123b7c3 to c10223e8)Forse già presa @cknitt l’ha presa 1 giorno fa. Aperta
rescript-lang/rescript#9186 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 28/100
rescript-lang/rescript#9184 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
rescript-lang/rescript#9183 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
rescript-lang/rescript#9181 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di rescript-lang/rescript
Issue simili
-
0.kind: enhancement 9.needs: package (update)
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
S3: friction & debt ws:tooling
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
MedakaLang/medaka#4865 ·
I maintainer di solito rispondono entro 1 giorno
-
Bug: the Atlas reports the five injected `$` helpers as unknown identifiers, including in the default scaffoldForse già presa @ShahadatTest l’ha presa oggi. Apertabug Compiler difficulty:easy good first issue help wanted Tooling
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
Avenx-JS/avenx-js#1615 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
respond_to? on a poly receiver answers true for a program class's private or protected methodAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
I maintainer di solito rispondono entro 1 giorno
-
x/arch/x86/x86asm: disp16/disp32 memory displacements are not sign-extendedForse già presa @mhr3 l’ha presa 1 giorno fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
golang/go#82840 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno