Skip to content

Splitting a variable bound in a NamedFieldPun duplicates record match #1736

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
kcsongor opened this issue Apr 16, 2021 · 1 comment · Fixed by #1739
Closed

Splitting a variable bound in a NamedFieldPun duplicates record match #1736

kcsongor opened this issue Apr 16, 2021 · 1 comment · Fixed by #1739
Assignees
Labels
component: wingman type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@kcsongor
Copy link

kcsongor commented Apr 16, 2021

Given the following code:

data Bar = Bar { ax :: Int, bax :: Bool }

bar :: Bar -> Int
bar Bar {ax, bax} = _

executing the case split on bax code action results in

data Bar = Bar { ax :: Int, bax :: Bool }

bar :: Bar -> Int
bar Bar {ax, bax} = _
bar Bar {ax, bax} = _

a workaround is turning the pattern in question into a normal record field binding first:

bar :: Bar -> Int
bar Bar {ax, bax = bax} = _

then executing the same code action results in the expected output:

bar :: Bar -> Int
bar Bar {ax, bax = False} = _
bar Bar {ax, bax = True} = _

I've tried this on both the latest master (9ae2092) and the latest release (1.1) and both exhibit this behaviour.

@isovector isovector self-assigned this Apr 16, 2021
@isovector isovector added component: wingman type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. labels Apr 16, 2021
@isovector
Copy link
Collaborator

Nice catch. Easy thing to fix.

isovector added a commit to isovector/haskell-language-server that referenced this issue Apr 16, 2021
@mergify mergify bot closed this as completed in #1739 Apr 17, 2021
mergify bot pushed a commit that referenced this issue Apr 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: wingman type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants