Skip to content

Symbol renaming work in simple modules without any exports does not work #3571

Closed
@halloleo

Description

@halloleo

Your environment

Using VS Code as LSP client with Haskell 9.2.5 via ghcup on macOS. HLS is on 1.9.1

Steps to reproduce

Write a simple module Cnt.hs:

-- File Cnt.hs
module Cnt where

mostFrequentChar' :: String -> Char -> Int -> (Char, Int)
mostFrequentChar' [] maxChar maxFreq = (maxChar, maxFreq)
mostFrequentChar' (c:cs) maxChar maxFreq =
    let freq = count c (c:cs)
    in if freq > maxFreq
        then mostFrequentChar' cs c freq
        else mostFrequentChar' cs maxChar maxFreq
    where count x xs = length $ filter (== x) xs

No exports needed. (I will load the file into ghci to play with it.)

Then try to rename mostFrequentChar' to mostFrequentChar.

Expected behaviour

I expected that mostFrequentChar' is changed to mostFrequentChar.

Actual behaviour

No renaming is performed, but you get (in VS Code):

f66fff2629027c4a07f98d65705df3f9284b34bf

See also

I discussed this problem first on the Haskell discourse.

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