module MinusErr exposing (..)
errFun : Int -> Int
errFun x =
case x of
(-1) ->
0
(-2) ->
0
_ ->
1
compiles but after elm-format is converted to:
module MinusErr exposing (..)
errFun : Int -> Int
errFun x =
case x of
-1 ->
0
-2 ->
0
_ ->
1
which does not compile.
Good catch!
I have accidentally reported this in elm-dev 0.18 topic as a parser error.
Shouldn't the formatted version be legal?
It seems to be illegal in 0.17.1 as well, so regardless of whether the compiler changes to allow it in the future, I think it's good for elm-format to work around it until then.
Is the version without parens legal in Elm 0.18?
It is still illegal in final 0.18 release.
This is also the case for Floats, as well as Ints. Interestingly, it is allowed by elm-compiler for the first case clause, but not for subsequent case clauses.
FYI, the relevant elm-compiler issue is https://github.com/elm-lang/elm-compiler/issues/1261
Fixed in 5ee5460...784de8f. This will be included in 0.5.2-alpha.