Admin message

Due to a large amount of spam we do not allow new users to create repositories, they are "external" users. If you are a new user and want to create a repository, for example for forking GHC, open a new issue on ghc/ghc using the "get-verified" issue template

'failed to detect OverLit' panic when reloading in ghci with deferring type errors
## Summary Loading in ghci with `-fdefer-type-errors` or `:r!` some times produces a panic depending on whether NonEmpty and continuation-like function are used together. Replacing NonEmpty with lists somehow fixes the problem which may point to something that'll help to fix it. ## Steps to reproduce Save to `Test.hs` ```hs module Test where import Data.List.NonEmpty (NonEmpty(..)) import Data.List.NonEmpty qualified as NE data T = LBrace | RBrace | EOF collectBracedBlock :: Show b => [T] -> (NonEmpty T -> [T] -> ([T], [b])) -> [T] -> Int -> (NonEmpty T, [b]) collectBracedBlock acc cont = goBraced acc where goBraced acc' [] _ = (reverse acc', []) goBraced acc' ts 0 = cont acc' ts goBraced acc' (t : ts) n = goBraced (t : acc') ts $ case t of LBrace -> n + 1 RBrace -> n - 1 _ -> n ``` Run ghci session: ``` $ ghci-9.12.2 GHCi, version 9.12.2: https://www.haskell.org/ghc/ :? for help ghci> :set -fdefer-type-errors ghci> :load Test.hs [1 of 1] Compiling Test ( Test.hs, interpreted ) <no location info>: error: panic! (the 'impossible' happened) GHC version 9.12.2: failed to detect OverLit 0 Call stack: CallStack (from HasCallStack): callStackDoc, called at compiler/GHC/Utils/Panic.hs:190:37 in ghc-9.12.2-8a0c:GHC.Utils.Panic pprPanic, called at compiler/GHC/HsToCore/Pmc/Desugar.hs:221:22 in ghc-9.12.2-8a0c:GHC.HsToCore.Pmc.Desugar Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug Failed, unloaded all modules. ``` Can also avoid `-fdefer-type-errors` and do `:load` and then `:reload!` which is how this issue was originally found: ``` ghci-9.12.2 GHCi, version 9.12.2: https://www.haskell.org/ghc/ :? for help ghci> :load Test.hs [1 of 1] Compiling Test ( Test.hs, interpreted ) Test.hs:18:31: error: [GHC-83865] • Couldn't match type: [T] with: NonEmpty T Expected: [T] -> Int -> (NonEmpty T, [b]) Actual: [T] -> Int -> ([T], [b]) • In the expression: goBraced acc In an equation for ‘collectBracedBlock’: collectBracedBlock acc cont = goBraced acc where goBraced acc' [] _ = (reverse acc', []) goBraced acc' ts 0 = cont acc' ts goBraced acc' (t : ts) n = goBraced (t : acc') ts $ case t of LBrace -> n + 1 RBrace -> n - 1 _ -> n | 18 | collectBracedBlock acc cont = goBraced acc | ^^^^^^^^^^^^ Test.hs:21:37: error: [GHC-83865] • Couldn't match expected type: NonEmpty T with actual type: [T] • In the first argument of ‘cont’, namely ‘acc'’ In the expression: cont acc' ts In an equation for ‘goBraced’: goBraced acc' ts 0 = cont acc' ts | 21 | goBraced acc' ts 0 = cont acc' ts | ^^^^ Failed, unloaded all modules. ghci> :reload! [1 of 1] Compiling Test ( Test.hs, interpreted ) <no location info>: error: panic! (the 'impossible' happened) GHC version 9.12.2: failed to detect OverLit 0 Call stack: CallStack (from HasCallStack): callStackDoc, called at compiler/GHC/Utils/Panic.hs:190:37 in ghc-9.12.2-8a0c:GHC.Utils.Panic pprPanic, called at compiler/GHC/HsToCore/Pmc/Desugar.hs:221:22 in ghc-9.12.2-8a0c:GHC.HsToCore.Pmc.Desugar Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug ``` ## Expected behavior File loads and type errors are printed just like with regular `:load` without deferring type errors. ## Environment * GHC version used: 9.12.2, built from revision 383be28ffdddf65b57b7b111bfc89808b4229ebc (i.e. the release commit for 9.12.2) * Operating System: NixOS * System Architecture: x86_64
issue