Hello, I'm walking through the gleam.run tutorial and I've found what appears to be a bug.
The code below does not give an error or warning about unreachable code.
Perhaps this is specific to the wasm runtime, and not present in the OTP version?
import gleam/io
// import gleam/int
pub fn main() {
let x = 3 // int.random(4)
io.debug(x)
let result = case x {
// Match specific values
0 -> "Zero"
1 -> "One"
_ -> "Other"
// Match any other value
3 -> "hi"
4 -> "no"
}
io.debug(result)
}
Reordering the cases slightly does tell me there is unreachable code:
import gleam/io
import gleam/int
pub fn main() {
let x = 3 // int.random(4)
io.debug(x)
let result = case x {
// Match specific values
_ -> "Other"
0 -> "Zero"
1 -> "One"
// Match any other value
3 -> "hi"
4 -> "no"
}
io.debug(result)
}
Hello, I'm walking through the gleam.run tutorial and I've found what appears to be a bug. The code below does not give an error or warning about unreachable code. Perhaps this is specific to the wasm runtime, and not present in the OTP version?
Reordering the cases slightly does tell me there is unreachable code: