haskell / haskell/haskell-language-server

Incorrect result for nested constructors

Open
#5,081 3 comments 0 reactions 0 assignees View on GitHub
component: hls-case-split-plugin type: bug
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
4d 3h
Merged PRs (30d)
12

Description

In a case as simple as this
```haskell
{-# LANGUAGE EmptyCase #-}
{-# OPTIONS_GHC -Wall -fmax-uncovered-patterns=99 #-}
module T where

foo :: Int
foo = case (_ :: Bool, _ :: Bool) of
```
where the diagnostic has good suggestions,
```none
╔══════════════════════════════════════════════════╗
║ Pattern match(es) are non-exhaustive ║
║ In a case alternative: ║
║ Patterns of type ‘(Bool, Bool)’ not matched: ║
║ (False, False) ║
║ (False, True) ║
║ (True, False) ║
║ (True, True) [GHC-62161] ║
╚══════════════════════════════════════════════════╝
```
the completion is erroneous:
```haskell
foo = case (_ :: Bool, _ :: Bool) of
(,) _ _ -> _
(,) _ _ -> _
(,) _ _ -> _
(,) _ _ -> _
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the Haskell snippet from the issue and inspect the completion entry point that handles the non-exhaustive-pattern diagnostic. Compare the generated clauses with the four missing `(Bool, Bool)` patterns shown in the report; done means completion produces distinct, correct suggestions instead of four identical `(,) _ _` clauses.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.