Opened 8 years ago

Closed 8 years ago

Last modified 6 years ago

#925 closed bug (fixed)

Access to old variable via Template Haskell blows up ghci

Reported by: guest Owned by:
Priority: low Milestone: 6.8.1
Component: Template Haskell Version: 6.4.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description (last modified by igloo)

When you try to access a replaced variable name via Template Haskell in GHCi, GHCi panics:

  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 6.4.2, for Haskell 98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

Loading package base-1.0 ... linking ... done.
Prelude> :set -fth
Prelude> :m +Language.Haskell.TH
Prelude Language.Haskell.TH> let f n = n * 2 :: Int
Prelude Language.Haskell.TH> fName <- runQ [| f |]
Loading package haskell98-1.0 ... linking ... done.
Loading package template-haskell-1.0 ... linking ... done.
Prelude Language.Haskell.TH> $(return $ AppE fName (LitE (IntegerL 7)))
14
Prelude Language.Haskell.TH> let f n = n * 3 :: Int
Prelude Language.Haskell.TH> fName2 <- runQ [| f |]
Prelude Language.Haskell.TH> $(return $ AppE fName2 (LitE (IntegerL 7)))
21
Prelude Language.Haskell.TH> $(return $ AppE fName (LitE (IntegerL 7)))
ghc-6.4.2: panic! (the `impossible' happened, GHC version 6.4.2):
	nameModule f{v a1WB}

Please report this as a compiler bug.  See:
  http://www.haskell.org/ghc/reportabug

Prelude Language.Haskell.TH> 

Change History (6)

comment:1 Changed 8 years ago by Lyle Kopnicky

It was me who posted the bug. lyle AT qseep DOTT net

comment:2 Changed 8 years ago by igloo

  • Description modified (diff)
  • Milestone set to 6.8

This still happens with the HEAD.
I've added :set -fth to the reproduction instructions.

comment:3 Changed 8 years ago by simonpj

  • Resolution set to fixed
  • Status changed from new to closed

Good point. Fixed in the HEAD.

Ian: pls push to 6.6.1 branch.

Simon

comment:4 Changed 6 years ago by igloo

  • Milestone changed from 6.8 branch to 6.8.1

comment:5 Changed 6 years ago by simonmar

  • Architecture changed from Unknown to Unknown/Multiple

comment:6 Changed 6 years ago by simonmar

  • Operating System changed from Unknown to Unknown/Multiple
Note: See TracTickets for help on using tickets.