Skip to content

Stale error displayed in VScode #1530

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

Closed
FrancisToth opened this issue Dec 12, 2019 · 6 comments
Closed

Stale error displayed in VScode #1530

FrancisToth opened this issue Dec 12, 2019 · 6 comments
Labels
component: ghcide type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@FrancisToth
Copy link

Hi guys, Haskell noob here. I start playing with VSCode (1.40.2) and Haskell IDE Engine (0.14.0.0) with Haskell Language Server (0.0.31) , and got a really weird behaviour. Given the following code:

module Chap9
    ( 
    )
where

loop3 :: (String, String) -> [String]
loop3 (_, (_ : _)) = loop3 $ ([], [])

foo :: String -> String
foo s = s

If I add another function named like foo

foo :: String -> String
foo s = s

wait for the error to be displayed, and then fix the name of the duplicated function like this:

foo2 :: String -> String
foo2 s = s

the code compiles (when loaded from the terminal) but the editor still shows the stale error telling there are multiple declarations of foo. I do not get the error if the loop3 function is declared like this:

loop3 :: (String, String) -> [String]
loop3 (_, _ : _) = loop3 $ ([], [])

So it looks like the problem comes from pattern matching but I cannot explain why. If this is not the right place to talk about this, I sincerely apologize. In any case, thank you in advance.

@FrancisToth
Copy link
Author

FrancisToth commented Dec 12, 2019

I actually ended up thinking that pattern matching against lists inside tuples does not work (it seems to compile though)

foo :: (String, String) -> String
foo (l , (h : t)) = l

triggers the bug and is fixed by:

foo :: (String, String) -> String
foo (l , h : t) = l

@jneira
Copy link
Member

jneira commented Jan 9, 2020

I can reproduce with latest versions of hie and the extension

@fendor
Copy link
Collaborator

fendor commented Feb 4, 2020

haskell/haskell-ide-engine#1629 seems related to this and not specific to vscode.

@jneira
Copy link
Member

jneira commented Mar 9, 2021

We are using haskell-language-server now as backend lsp server, @FrancisToth do you continue expereincing the issue with last hls (1.0.0) version?

@jneira jneira transferred this issue from haskell/vscode-haskell Mar 9, 2021
@jneira jneira added component: ghcide status: needs info Not actionable, because there's missing information type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. labels Mar 9, 2021
@jneira
Copy link
Member

jneira commented Mar 9, 2021

In fact hls does not have the quick fix for duplicate functions so the error cant be even reproduced 😟

@jneira jneira removed the status: needs info Not actionable, because there's missing information label Mar 9, 2021
@jneira
Copy link
Member

jneira commented Mar 9, 2021

Opened feature request, i hope the bug will be not present when it will be added 😉 #1532

@jneira jneira closed this as completed Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: ghcide type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

No branches or pull requests

3 participants