Open
Description
match
allways picks the first arm if matching value is not defined/unknown.
I was using const
to define the values for the arms.
But the const
were places inside the main()
and the match expression was in a separate function.
I tried this code:
Uncommenting the first 2 const
gives the wanted results.
I expected to see this happen:
That the compiler finds the const values or stop compiling because the matching values are unknown.
Instead, this happened:
It just compiles.
But it gives some warnings like warning: unreachable pattern
.
It just runs but with the wrong values.
See play link. See the behavior on all the versions "Stable", "Beta" and "Nightly".