Ticket #3908 (closed bug: wontfix)

Opened 3 years ago

Last modified 3 years ago

"Defined but not used" for variable used in Template Haskell splice

Reported by: josh Owned by:
Priority: normal Milestone:
Component: Compiler Version: 6.12.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect warning at compile-time Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

I encountered this warning on valid code using Template Haskell ; I had to change "name" to "_name" to make it compile warning-free.

Test case:

{-# LANGUAGE FlexibleInstances, TemplateHaskell #-}
import Language.Haskell.TH

main :: IO ()
main = do
    let name = mkName "name"
    decl <- runQ [d| instance Show $(conT name) where show = undefined |]
    print decl

Warnings:

TestCase.hs:6:8: Warning: Defined but not used: `name'

I found ticket #3873, but I don't know if it represents the same bug.

Change History

Changed 3 years ago by JakeWheat

I'm pretty sure it's the same bug as #3873, this seems to consistently happen whenever a variable is only referenced inside a quotation.

Changed 3 years ago by simonpj

  • status changed from new to closed
  • resolution set to wontfix

You're right. It's fine in the HEAD, and the conclusion from #3845 (which in turn fixed #3873) was that we won't fix in 6.12. So I'm marking as wont-fix, but that only applies to 6.12. The HEAD is fine.

Simon

Note: See TracTickets for help on using tickets.