Skip to content

Rename plugin doesn't work with NamedFieldPuns #2970

Closed
@santiweight

Description

@santiweight

The environment doesn't matter here: just a plugin bug...

Steps to reproduce

Rename the following field to something else using the rename plugin

{-# LANGUAGE NamedFieldPuns #-}
newtype Foo = Foo { field :: Int }

unFoo :: Foo -> Int
unFoo Foo{field} = field

Expected behaviour

I think the best UX should be that renames compose with bindings incurred by NamedFieldPuns

Actual behaviour

The output is instead:

{-# LANGUAGE NamedFieldPuns #-}
newtype Foo = Foo { bleh :: Int }

unFoo :: Foo -> Int
unFoo Foo{bleh} = field

i.e. the field reference in the binding site is renamed, but not the subsequent reference on the RHS of unFoo

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: hls-rename-plugintype: 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