#12411 closed bug (fixed)

GHC panic on TypeApplications + TemplateHaskell

Reported by: Iceland_jack Owned by:
Priority: normal Milestone: 8.0.2
Component: Compiler Version: 8.0.1
Keywords: TypeApplications, TemplateHaskell Cc: goldfire
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time crash Test Case: th/T12411
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

This fails

$ ghci -XTemplateHaskell -ignore-dot-ghci
GHCi, version 8.0.1: http://www.haskell.org/ghc/  :? for help
Prelude> import Control.Lens
Prelude Control.Lens> data A = B { _int :: Int }
Prelude Control.Lens> pure @Q []; makeLenses ''A
ghc: panic! (the 'impossible' happened)
(GHC version 8.0.1 for x86_64-unknown-linux):
tcMonoExpr _

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

Prelude Control.Lens>

sorry, don't have time for more detail

Change History (11)

comment:1 Changed 15 months ago by RyanGlScott

Note that not enabling -XTypeApplications is critical for this bug to trigger. When -XTypeApplications is enabled, the above code works as intended.

comment:2 Changed 15 months ago by bgamari

Cc: goldfire added
Type of failure: None/UnknownCompile-time crash

Bringing in Richard.

comment:3 Changed 15 months ago by goldfire

I will take a look in due course.

comment:4 Changed 13 months ago by Shayan-Najd

As RyanGlScott pointed out in #12584, essentially the problem is with patterns (here "as" pattern) being accepted (temporarily in the renamer) as expressions. Here is a minimal way to trigger the same error:

GHCi, version 8.0.1: http://www.haskell.org/ghc/  :? for help
Prelude> :set -XTemplateHaskell
Prelude> pure @Q [];return ()
ghc: panic! (the 'impossible' happened)
  (GHC version 8.0.1 for x86_64-unknown-linux):
	tcMonoExpr _

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

comment:5 Changed 13 months ago by simonpj

Should be fixed by #12584. Let's wait for that to land (it's a tiny patch) and check

comment:6 Changed 13 months ago by Ryan Scott <ryan.gl.scott@…>

In 184d7cb8/ghc:

Add test for #12411

The fix for #12584 also fixed the problem in #12411. Let's add a test to ensure
that it stays fixed.

comment:7 Changed 13 months ago by RyanGlScott

Resolution: fixed
Status: newclosed
Test Case: th/T12411

comment:8 Changed 13 months ago by RyanGlScott

Status: closedmerge

Since #12584 was merged into GHC 8.0.2, this can be safely merged too.

comment:9 Changed 13 months ago by RyanGlScott

Milestone: 8.0.2

comment:10 Changed 13 months ago by bgamari

Merged test to ghc-8.0 as d84a824cebe94711528727bcb587bfc369ec36a2.

comment:11 Changed 13 months ago by bgamari

Status: mergeclosed
Note: See TracTickets for help on using tickets.