Unused variable `pect`
Closed this issue · 4 comments
I get these messages: "Unused variable pect
inside pattern at ((189,24),(189,28))".
However, I am not using any variables called pect
. At the mentioned line there is however a variable called 'aspect'.
I assume somewhere in elm-analyse the as
of the variable aspect
is omitted as a reserved word for example. To verify the assumption I changed the variable aspect
to waspect
and elm-analyse does not report an 'unused variable' anymore ;-)
@berry Thanks for your report. I guess your assumption is correct. However, could you add a small scale example (possibly anonymised) to reproduce this? At this point you have more context to where the unused variable was located in the file (parameter, top level, or destructuring expression). By giving me an example of the false positive you would really help me out.
I had some time to create an example. While creating the example I found out the "as" bug does not occur when the parameter name is the only parameter name in the function. When the parameter starting with "as" is the second or third parameter then elm-analyse trips over the name.
module Main exposing (main)
import Html exposing (Html, div, text)
main : Html msg
main =
div []
[ text <| withAnalyseError "with" "error"
, text <| withAnalyseError2 "with" "an" "error"
, text <| withoutAnalyseError "without error"
]
withAnalyseError : String -> String -> String
withAnalyseError x aspect =
"Elm-analyse bug #167: " ++ x ++ " " ++ aspect
withAnalyseError2 : String -> String -> String -> String
withAnalyseError2 x y aspect =
"Elm-analyse bug #167: " ++ x ++ " " ++ y ++ " " ++ aspect
withoutAnalyseError : String -> String
withoutAnalyseError aspect =
"Elm-analyse bug #167: " ++ aspect
This is the output of elm-analyse:
INFO: No configuration provided. Using default configuration.
INFO: Load dependency elm-lang/html 2.0.0
INFO: Load dependency elm-lang/core 5.1.1
INFO: Loaded elm-lang/html from cache
INFO: Loaded elm-lang/core from cache
INFO: Load file Main.elm...
Messages:
- Main.elm
> Unused variable `pect` inside pattern at ((15,21),(15,25))
> Unused variable `pect` inside pattern at ((20,24),(20,28))
I hope this clarifies the bug report. Oh, and I should mention I am on 0.15.0-alpha.3 of elm-analyse.
Great. Thanks for the details. This help a lot :)
Fixed the issue. Its origin was https://github.com/stil4m/elm-syntax. It will be released in 0.15.0.