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,334
    • Issues 4,334
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 369
    • Merge Requests 369
  • 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
  • #19142

Closed
Open
Opened Dec 31, 2020 by Jakob Brünker@JakobBruenker

panic lookup_final_id with -fdefer-type-errors and kind error in instance definition

Summary

This file

{-# OPTIONS_GHC -fdefer-type-errors #-}
{-# LANGUAGE ExplicitForAll
           , TypeApplications
           , KindSignatures
           , FlexibleInstances
#-}

foo :: forall (f :: * -> *) . String
foo = ""

instance Show a where
  show _ = foo @Int

produces the following error:

Bug.hs:12:17: warning: [-Wdeferred-type-errors]
    • Expected kind ‘* -> *’, but ‘Int’ has kind ‘*’
    • In the type ‘Int’
      In the expression: foo @Int
      In an equation for ‘show’: show _ = foo @Int
   |
12 |   show _ = foo @Int
   |                 ^^^
ghc: panic! (the 'impossible' happened)
  (GHC version 9.0.0.20201227:
        lookup_final_id
  $fShowa
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/GHC/Utils/Outputable.hs:1230:37 in ghc:GHC.Utils.Outputable
        pprPanic, called at compiler/GHC/Iface/Tidy.hs:200:12 in ghc:GHC.Iface.Tidy

Without -fdefer-type-errors, only the kind error would be shown, not the panic.

Expected behavior

GHC shouldn't panic

Environment

  • GHC version used: 9.0.0.20201227 as well as 8.10.2

Optional:

  • Operating System: Ubuntu inside WSL2 inside Windows 10
  • System Architecture: x86_64
Edited Dec 31, 2020 by Jakob Brünker
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#19142