Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#10466 closed bug (fixed)

Bogus multiple-declaration error in GHCi + Template Haskell

Reported by: simonpj Owned by:
Priority: normal Milestone: 8.0.1
Component: Compiler Version: 7.8.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: ghci/scripts/T10466
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Try this (with ghc 7.8.3)

th% ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.8.3
th $ ghc --interactive -XTemplateHaskell
GHCi, version 7.8.3:  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> let x = True
Prelude> let y = [d| x = 'c' |]

    Multiple declarations of ‘x’
    Declared at: <interactive>:2:5
    In the Template Haskell quotation [d| x = 'c' |]

This is obviously wrong, a failure of the name-shadwing code in RnNames.extendGlobalRdrEnvRn.

I suspect that this afflicts 7.10 too, but I can't check that right now.

Working on a fix.

Change History (3)

comment:1 Changed 3 years ago by Simon Peyton Jones <simonpj@…>

comment:2 Changed 3 years ago by simonpj

Resolution: fixed
Status: newclosed
Test Case: ghci/scripts/T10466

Fixed by 9b73cb16485f331d9dc1f37826c6d503e24a5b0b/ghc:

Refactor the GlobalRdrEnv, fixing #7672
Last edited 3 years ago by simonpj (previous) (diff)

comment:3 Changed 3 years ago by thomie

Milestone: 8.0.1
Note: See TracTickets for help on using tickets.