Skip to content

Add GHC-17335 #490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module DsIncompleteRecSel where

data T = T1 | T2 {x :: Bool}

f :: T -> Bool
f T1 = True -- handle the T1 case
f a = x a
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module DsIncompleteRecSel where

data T = T1 | T2 {x :: Bool}

f :: T -> Bool
f a = x a
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could adding a type signature f :: T -> Bool be beneficial for readers?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed addition of type signatures to the branch.

3 changes: 3 additions & 0 deletions message-index/messages/GHC-17335/dsIncompleteRecSel/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Incomplete record selector application
---
13 changes: 13 additions & 0 deletions message-index/messages/GHC-17335/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: Incomplete record selector application
summary: A record selector application may not be successful
severity: warning
flag: -Wincomplete-record-selectors
introduced: 9.10.1
---

This warning is triggered when GHC is not certain whether a record selector
application will be successful. This happens when a record selector is not
defined for all constructors of a data type (a.k.a. partial record field
selector) and it is applied to a value whose data constructor can't be proved by
GHC to be one for which the selector is defined.