incorrect `-Wunused-imports` when module exports multiple records with the same accessor names
Summary
GHC emits unused imports warnings when the module that is imported from has DuplicatRecordFields
activated and exports Records with same acessor fields
Steps to reproduce
{-# LANGUAGE DuplicateRecordFields #-}
module A where
data R = MkR {ra :: Int, rb :: Bool}
data R' = MkR' {ra :: Int, rb :: Bool}
{-# LANGUAGE OverloadedRecordDot #-}
{-# OPTIONS_GHC -Wall #-}
module B where
import A (R (ra), rb) -- this line emits the warnings for `rb`
x :: R -> Bool
x a = a.rb
y :: R -> Int
y a = a.ra
Expected behavior
No unused import warning
Environment
- GHC version used: ghc 9.6.2
Optional:
- Operating System: NixOS 23.11
- System Architecture: x86_64-linux
Edited by Magnus Viernickel