Skip to content

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

Closed
@kcsongor

Description

@kcsongor

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.

Metadata

Metadata

Assignees

Labels

component: wingmantype: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions