Skip to content

panic when file contains unsupported extension

Summary

When trying to use a LANGUAGE pragma with an extension that doesn't exist, the normal error message appears, but also a GHC panic.

Steps to reproduce

Compiling

{-# LANGUAGE Extension #-}

yields

ghc: panic! (the 'impossible' happened)
  GHC version 9.3.20210529:
        non-driver message in preprocess
  /mnt/c/Users/user/haskell/foo/extension.hs:1:14: error:
      Unsupported extension: Extension
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/GHC/Utils/Panic.hs:186:37 in ghc:GHC.Utils.Panic
        pprPanic, called at compiler/GHC/Driver/Pipeline.hs:164:21 in ghc:GHC.Driver.Pipeline

Expected behavior

Show the same error message, but without panicking

Environment

  • GHC version used: 9.3.20210529

Optional:

  • Operating System: Arch on WSL2 on Windows 10
  • System Architecture: x86_64
Edited by Jakob Brünker
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information