bestImport panic on GHC HEAD (TemplateHaskell + DisambiguateRecordFields + -Wredundant-imports)
The following program causes GHC to panic due to bestImport
receiving an empty list of imports:
-- T23240_aux.hs
{-# LANGUAGE Haskell2010 #-}
{-# LANGUAGE TemplateHaskell #-}
module T23240_aux where
import Language.Haskell.TH ( CodeQ )
data D = MkD { myFld :: () }
mkD :: CodeQ D
mkD = [|| MkD { myFld = () } ||]
--------------------------------------------------------------------------------
-- T23240.hs
{-# LANGUAGE Haskell2010 #-}
{-# LANGUAGE TemplateHaskell #-}
-- Crucial to triggering the bug.
{-# LANGUAGE DisambiguateRecordFields #-}
-- Need to enable the unused imports warning to trigger the bug.
{-# OPTIONS_GHC -Wunused-imports #-}
module T23240 ( test ) where
import T23240_aux ( D, mkD )
test :: D
test = $$mkD
This issue was introduced by my refactor in 3f374399. I will fix.