Skip to content

Renaming a variable that gets used in a record wild card will rename the field of that record. #5032

Description

@MangoIV

Your environment

Which OS do you use? nixos

Which version of GHC do you use and how did you install it? 9.12.3, nixpkgs

How is your project built (alternative: link to the project)? single module

Which LSP client (editor/plugin) do you use? n/a

Which version of HLS do you use and how did you install it? 2.13.0.0, nixpkgs

Have you configured HLS in any way (especially: a hie.yaml file)?

Steps to reproduce

{-# LANGUAGE RecordWildCards #-}
module Rename where

data Foo = MkFoo {foo :: Int}

y = foo (MkFoo 2)

x = MkFoo {..} 
  where 
    foo = 3

when renaming foo to bar in the where clause on the last line, we get:

{-# LANGUAGE RecordWildCards #-}
module Rename where

data Foo = MkFoo {bar  :: Int}

y = bar  (MkFoo 2)

x = MkFoo {..} 
  where 
    bar  = 3

which is a valid program but arguably not what the user might have intended (definitely not what I intended... ^^')

Expected behaviour

only the bar's scope should rename, i.e. resulting in an invalid program or (more complicated, inserting {foo = bar, ..} into the record wild card.

Debug information

I haven't tried on 2.14.0.0.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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