-
Notifications
You must be signed in to change notification settings - Fork 471
Closed
Description
When switching on numbers (like HTTP status codes), the compiled output is incorrect.
Example:
let httpResponseCode = 201
let _ =
match httpResponseCode with
| 201|200 ->
Js.log (("good response")[@reason.raw_literal "good response"])
| 500|503|506|509|598|501|504|507|510|599|502|505|508|511 ->
Js.log (("bad response")[@reason.raw_literal "bad response"])
| _ -> Js.log (("the catch all")[@reason.raw_literal "the catch all"])
In the example, if you remove all of the 5XX numbers or remove only 502 it'll work correctly. Other than that whenever the status code is 201 or 200 at least it hits the catch-all instead of the correct case.
Metadata
Metadata
Assignees
Labels
No labels