Integer range patterns on record fields match values below the range
Mantenedores costumam responder em até 1 dia
Um pull request relacionado já foi integrado.
- #8714 de @mvaled — integrado
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 76/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- javascript, ocaml
- Domínio
- compilers
Direção de pesquisa
Start in Js_exp_make.is_out and compare its fallback handling with commit 6d78c5832781165685b45bb2092d8edf170b75ae, where to_uint32 was removed. Reproduce the record-field range example and inspect the generated JavaScript. Done means values below 502 no longer match the 502–504 range while the valid range still does.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Reported in the forum: https://forum.rescript-lang.org/t/potential-bug-in-code-generation-of-subpattern-of-integers-httperror-status-502-503-504-rescript-12-and-13/7598
Matching a contiguous range of integers on a value that is not a plain variable (e.g. a record field) generates a signed comparison, so every value below the range also matches.
type response = {status: int}
let isRetriable = error =>
switch error {
| {status: 502 | 503 | 504} => true
| _ => false
}
ReScript 12 and 13 (alpha) generate:
function isRetriable(error) {
return (error.status - 502 | 0) <= 2;
}
which returns true for 404, 500, 501, etc. ReScript 10 and 11 generated (error.status - 502 >>> 0) <= 2, which is correct.
A bare switch x { | 502 | 503 | 504 => ... } is not affected; it compiles to !(x > 504 || x < 502).
The unsigned conversion in the fallback case of Js_exp_make.is_out was lost in https://github.com/rescript-lang/rescript/commit/6d78c5832781165685b45bb2092d8edf170b75ae when to_uint32 was removed.
- Linguagem predominante
- OCaml
- Estrelas
- 7.5k
- Forks
- 484
- Merge médio
- 20h 27min
- PRs com merge (30d)
- 120
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
- Sem 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 5/5 Mais de uma semana Facilidade para iniciantes 25/100
rescript-lang/rescript#8833 · 1 reação ·
Mantenedores costumam responder em até 1 dia
-
rewatch watch on Linux stops watching a source folder when an overlapping recursive source folder is removed from rescript.jsonTalvez já em andamento @cknitt assumiu há 2 dias. Aberta
Dificuldade 4/5 1-2 dias Facilidade para iniciantes 35/100
rescript-lang/rescript#8825 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 35/100
rescript-lang/rescript#8806 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 35/100
rescript-lang/rescript#8798 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 3/5 Meio dia Facilidade para iniciantes 58/100
rescript-lang/rescript#8757 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de rescript-lang/rescript
Issues semelhantes
-
draft
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 66/100
Mantenedores costumam responder em até 1 dia
-
bot-triaged module: activation checkpointing module: inductor oncall: pt2 triaged
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
calcit-lang/calcit#2075 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 5 dias
-
area:observer enhancement found-by:cold-read good first issue
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
InauguralSystems/EigenScript#1781 ·
Mantenedores costumam responder em até 1 dia