Diagnostics: inline-record mutability coercion gives no reason, and `throw` in `finally` warns about unreachable code
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 38/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- ocaml
- Domínio
- compilers, developer-experience
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
- Linguagem predominante
- OCaml
- Estrelas
- 7.5k
- Forks
- 484
- Merge médio
- 17h 2min
- PRs com merge (30d)
- 249
Preparar o ambiente
Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de rescript-lang/rescript
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
rescript-lang/rescript#9182 ·
Mantenedores costumam responder em até 1 dia
-
Issues from differential semantic drift analysis (b123b7c3 to c10223e8)Talvez já em andamento @cknitt assumiu hoje. Aberta
rescript-lang/rescript#9186 · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 28/100
rescript-lang/rescript#9184 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 55/100
rescript-lang/rescript#9183 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
rescript-lang/rescript#9181 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de rescript-lang/rescript
Issues semelhantes
-
0.kind: enhancement 9.needs: package (update)
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
Mantenedores costumam responder em até 1 dia
-
Bug: the Atlas reports the five injected `$` helpers as unknown identifiers, including in the default scaffoldTalvez já em andamento @ShahadatTest assumiu hoje. Abertabug Compiler difficulty:easy good first issue help wanted Tooling
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Avenx-JS/avenx-js#1615 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
respond_to? on a poly receiver answers true for a program class's private or protected methodAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 90/100
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
AeneasVerif/aeneas#1534 ·
Mantenedores costumam responder em até 1 dia
-
arrays asr pass bug ICE intrinsic medium priority
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia