-
-
Notifications
You must be signed in to change notification settings - Fork 351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Applying hlint lint causes TypeApplication expressions to turn into holes _
#1242
Comments
Many thanks for the detailed report, that is a really ugly bug, will take a look |
I think there is a If I put that example into a file Foo.hs I get a = readMaybe @Int content
b = (5) errors
|
Related: should there be a code action to enable |
I cant reproduce with this cradle:
direct:
arguments:
- "-XTypeApplications"
- "ApplyRefact1" and this
hls built from master and ghc-8.10.3 (maybe you are using the released 0.8.0 version?). There had been a big change in the hlint plugin since the 0.8.0 release. |
Sorry: for my use case I did not have a My point is, a type application turning into a wildcard is something that happens from the parser. Precisely mkHsAsPatPV l v e = do
opt_TypeApplications <- getBit TypeApplicationsBit
let msg | opt_TypeApplications
= "Type application syntax requires a space before '@'"
| otherwise
= "Did you mean to enable TypeApplications?"
patSynErr l (pprPrefixOcc (unLoc v) <> text "@" <> ppr e) (text msg)
mkHsLazyPatPV l e = patSynErr l (text "~" <> ppr e) empty
mkSumOrTuplePV = mkSumOrTupleExpr
patSynErr :: SrcSpan -> SDoc -> SDoc -> PV (LHsExpr GhcPs)
patSynErr l e explanation =
do { addError l $
sep [text "Pattern syntax in expression context:",
nest 4 (ppr e)] $$
explanation
; return (cL l hsHoleExpr) } So hlint/applyrefact is not seeing the |
I see, thanks for the info. |
I've added the test case presented above in #1244 |
Yes @jneira, I am using the just released 0.8.0 release. |
Indeed @alanz adding the pragma explicitly fixed the problem. However I already have the pragma set in both |
I think so. |
Your environment
Output of
haskell-language-server --probe-tools
orhaskell-language-server-wrapper --probe-tools
:haskell-language-server version: 0.8.0.0 (GHC: 8.10.3) (PATH: /nix/store/px0cwk7xl79yq4b1pvkwaxfkwaswhis1-haskell-language-server-0.8.0.0/bin/haskell-language-server-wrapper) Tool versions found on the $PATH cabal: 3.2.0.0 stack: 2.5.1 ghc: 8.10.3
Which lsp-client do you use:
Neovim
Describe your project (alternative: link to the project):
A cabal project
Contents of
hie.yaml
:Steps to reproduce
With the following code apply the suggested lint to remove redundant bracket
Expected behaviour
This appears
Actual behaviour
This appears
a = _ content
This happens in the file so even this:
Turns into this:
When invoking hlint with apply-refact by themselves through the CLI the
correct behaviour is demonstrated, and so I opened the issue in
haskell-language-server
and not in
hlint
orapply-refact
.The problem seems to be with
TypeApplications
. The extension IS enabledin hie.yaml's
cradle
->direct
->arguments
->XTypeApplications
It doesn't matter which hlint lint is applied, as far as I can tell.
The text was updated successfully, but these errors were encountered: