Skip to content

Inline function with guard only pick first guard case #4374

Open
@guibou

Description

@guibou

Your environment

Which OS do you use? Linux
Which version of GHC do you use and how did you install it?

Tested with ghc 9.6.5 and 9.8.2 installed with nix.

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

Single file

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

neovim + neovim-lsp

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

2.9.0.0 installed from nixpkgs.

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

No hie file, single file support

Steps to reproduce

The following file:

foo x y
  | x == 0 = y
  | otherwise = x + y

bar = foo 1 2

The code action on the foo call, called inline foo

Expected behaviour

foo (in bar)should be replaced by equivalent piece of code, so I assume something like:

bar = if 1 == 0 then 2 else 1 + 2

(or something equivalent).

Actual behaviour

Looks like only the first case of foo implementation is taken into account, and hence, I get:

bar = 2

See for yourself:

hls_inline_bug.mp4

Debug information

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: hls-refactor-pluginIssues related to the hls-refactor-plugincomponent: hls-retrie-pluginstatus: blockedNot actionable, because blocked by upstream/GHC etc.type: 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