[GHC] #14458: ghc: panic! -- initTc: unsolved constraints

#14458: ghc: panic! -- initTc: unsolved constraints -------------------------------------+------------------------------------- Reporter: lijero | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Keywords: | Operating System: Linux Architecture: x86_64 | Type of failure: Compile-time (amd64) | crash or panic Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- So this is an interesting bug. If I mistype parse' as parse, /and/ do not have main defined, the error occurs, but not with either individual one. I'm sure the code sucks, but I wasn't intending for this to end up anywhere, it just happened to trigger the crash. {{{ lijero@desktop:~/code/ab$ ghc AB.hs [1 of 1] Compiling Main ( AB.hs, AB.o ) ghc: panic! (the 'impossible' happened) (GHC version 8.0.2 for x86_64-unknown-linux): initTc: unsolved constraints WC {wc_insol = [W] parse_ay8 :: t_ay7[tau:1] (CHoleCan: parse) [W] parse_ayp :: t_ayo[tau:1] (CHoleCan: parse)} Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} {{{#!hs module Main where data Token = KUnit | KApp | KLam | KVar String data Ast = AUnit | AApp Ast Ast | ALam Ast Ast | AVar String parse' :: [Token] -> ([Token] -> Ast -> Maybe Ast) -> Maybe Ast parse' (KUnit:xs) fail = fail xs AUnit -- GHC does not crash when parse is correctly written parse' in both of the below instances parse' (KApp:xs) fail = parse' xs (\ xs' f -> AApp f <$> parse xs' fail) parse' (KLam:xs) fail = parse' xs (\ xs' a -> ALam a <$> parse xs' fail) parse' (KVar n:xs) fail = fail xs (AVar n) -- GHC does not crash when main is defined --main :: IO () --main = putStrLn "" }}} With main defined, GHC correctly reports "variable not in scope". With parse corrected to parse', GHC correctly reports that main is not defined. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14458 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14458: ghc: panic! -- initTc: unsolved constraints -------------------------------------+------------------------------------- Reporter: lijero | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: duplicate | Keywords: Operating System: Linux | Architecture: x86_64 Type of failure: Compile-time | (amd64) crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #13106 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => closed * resolution: => duplicate * related: => #13106 Comment: Thanks for the bug report. This is a duplicate of #13106, and has been fixed in GHC 8.2: {{{ $ /opt/ghc/8.2.1/bin/ghc Bug.hs [1 of 1] Compiling Main ( Bug.hs, Bug.o ) Bug.hs:1:1: error: The IO action ‘main’ is not defined in module ‘Main’ | 1 | module Main where | ^ Bug.hs:17:36: error: • Variable not in scope: parse :: [Main.Token] -> ([Main.Token] -> Main.Ast -> Maybe Main.Ast) -> Maybe Main.Ast • Perhaps you meant ‘parse'’ (line 14) | 17 | parse' xs (\ xs' f -> AApp f <$> parse xs' fail) | ^^^^^ Bug.hs:19:36: error: • Variable not in scope: parse :: [Main.Token] -> ([Main.Token] -> Main.Ast -> Maybe Main.Ast) -> Maybe Main.Ast • Perhaps you meant ‘parse'’ (line 14) | 19 | parse' xs (\ xs' a -> ALam a <$> parse xs' fail) | ^^^^^ }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14458#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC