Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,273
    • Issues 4,273
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 413
    • Merge Requests 413
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #14575

Closed
Open
Opened Dec 12, 2017 by Pauly@trac-Pauly

ghc: panic! (the 'impossible' happened)

I got:

ghc: panic! (the 'impossible' happened)

(GHC version 8.0.2 for x86_64-unknown-linux):

initTc: unsolved constraints

WC {wc_insol = [W] spec_a86Q :: t_a86P[tau:1] (CHoleCan: spec)}

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

This happens after adding of this call in test file (called SimpleTaggingSpec.hs):

$(shrinkEnumTag AnyJT)

Implementation of this shrinkEnumTag looks:

shrinkEnumTag :: forall a. (Data a, IsTag a) => a -> Q [Dec]
shrinkEnumTag enm = do
  let dt = dataTypeOf enm
      ty = mkName $ dataTypeName dt
      tickAdd = (++"'")
      nameWith f = mkName . f . show
      derivs' = ConT . mkName <$> ["Eq", "Ord", "Enum"]
      mkShow tn tn' =
        [d|instance Show $(conT tn') where
             show a = show $ (toEnum $ fromEnum a :: $(conT tn))|]
  AlgRep algCs <- pure $ dataTypeRep dt
  let algCs' = [mkName $ show c | c <- algCs, fromConstr c /= (anyTag::a)]
      newCs = [NormalC (nameWith tickAdd n) [] | n <- algCs']
  TyConI tyCon <- reify ty
  decs <- case tyCon of
    DataD _cxt _nm tyVars _mbKind _cs _derivs -> do
      let ty' = nameWith tickAdd ty
      when (null newCs) $ fail "Can't find normal constructors"
      showInst <- mkShow ty ty'
      return $ [DataD [] ty' tyVars Nothing newCs derivs'] ++ showInst
    _ -> fail "expected Enum-like data type"
  return decs

If I add this call in not-test module, all is good, compilation is fine, application works. I use GHC 8.0.2, this happened with LTS-8.13 and LTS-9.18. Project uses stack tool. OS is Linux OpenSUSE Tumbleweed. I updated stack to the last version (1.6.1) but this did not help.

Trac metadata
Trac field Value
Version 8.0.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
⊥
Milestone
⊥
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#14575