[GHC] #15473: GHC 8.6+ loops infinitely on an UndecidableInstances error message
#15473: GHC 8.6+ loops infinitely on an UndecidableInstances error message -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: 8.6.1 Component: Compiler | Version: 8.5 (Type checker) | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Compile-time Unknown/Multiple | performance bug Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- This regression was introduced in commit e1b5a1174e42e390855b153015ce5227b3251d89 (`Fix a nasty bug in piResultTys`), which is present in the `ghc-8.6` and `master` branches. To observe the issue, try compiling the following program: {{{#!hs {-# LANGUAGE DataKinds #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} -- {-# LANGUAGE UndecidableInstances #-} module Bug where type family Undefined :: k where {} type family LetInterleave xs t ts is (a_ahkO :: [a]) (a_ahkP :: [[a]]) :: [[a]] where LetInterleave xs t ts is y z = Undefined y z }}} You'll get this far: {{{ $ ~/Software/ghc4/inplace/bin/ghc-stage2 Bug.hs [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) Bug.hs:11:3: error: • Variables ‘a, a’ occur more often in the type family application }}} Before GHC hangs. (I was unable to kill this with Ctrl+C; I had to resort to `kill -9`.) Interestingly, the commit f8618a9b15177ee8c84771b927cb3583c9cd8408 (`Remove the type-checking knot.`) does not appear to have an effect on this. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15473> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15473: GHC 8.6+ loops infinitely on an UndecidableInstances error message -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: 8.6.1 Component: Compiler (Type | Version: 8.5 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"a533a09231450b9ce0c94d2990d77749fc744baa/ghc" a533a09/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="a533a09231450b9ce0c94d2990d77749fc744baa" testsuite: Add (broken) test for #15473 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15473#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15473: GHC 8.6+ loops infinitely on an UndecidableInstances error message -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: 8.6.1 Component: Compiler (Type | Version: 8.5 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"5487f305d9dea298f0822082389d8a0225956c55/ghc" 5487f305/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="5487f305d9dea298f0822082389d8a0225956c55" testsuite: Add (broken) test for #15473 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15473#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15473: GHC 8.6+ loops infinitely on an UndecidableInstances error message -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: 8.6.1 Component: Compiler (Type | Version: 8.5 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"db6f1d9cfc74690798645a7cc5b25040c36bb35d/ghc" db6f1d9/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="db6f1d9cfc74690798645a7cc5b25040c36bb35d" Turn infinite loop into a panic In these two functions * TcIface.toIfaceAppTyArgsX * Type.piResultTys we take a type application (f t1 .. tn) and try to find its kind. It turned out that, if (f t1 .. tn) was ill-kinded the function would go into an infinite loop. That's not good: it caused the loop in Trac #15473. This patch doesn't fix the bug in #15473, but it does turn the loop into a decent panic, which is a step forward. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15473#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15473: GHC 8.6+ loops infinitely on an UndecidableInstances error message -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: 8.6.1 Component: Compiler (Type | Version: 8.5 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"8c7f90abcc1e8f9f29b751f23174e8db89ba6983/ghc" 8c7f90a/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="8c7f90abcc1e8f9f29b751f23174e8db89ba6983" Fix a typo in TcValidity.checkFamInstRhs In error message generation we were using the wrong type constructor in inst_head. Result: the type became ill-kinded, and that sent the compiler into a loop. A separate patch fixes the loop. This patch fixes the actual bug -- Trac #15473. I also improved the "occurs more often" error message a bit. But it's still pretty terrible: * Variable ‘a’ occurs more often in the type family application ‘Undefined’ than in the instance head ‘LetInterleave xs t ts is y z’ It looks like nonsense, but all becomes clear if you use -fprint-explicit-kinds. Really we should fix this by spotting when invisible arguments are involved and at least suggesting -fprint-explicit-kinds. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15473#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15473: GHC 8.6+ loops infinitely on an UndecidableInstances error message -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: closed Priority: highest | Milestone: 8.6.1 Component: Compiler (Type | Version: 8.5 checker) | Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Compile-time | Test Case: performance bug | typecheck/should_compile/T15473 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => closed * testcase: => typecheck/should_compile/T15473 * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15473#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15473: GHC 8.6+ loops infinitely on an UndecidableInstances error message -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: merge Priority: highest | Milestone: 8.6.1 Component: Compiler (Type | Version: 8.5 checker) | Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Compile-time | Test Case: performance bug | typecheck/should_compile/T15473 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: closed => merge Comment: I'll be optimistic and mark commits db6f1d9cfc74690798645a7cc5b25040c36bb35d and 8c7f90abcc1e8f9f29b751f23174e8db89ba6983 as merge candidates, since they're both fairly small. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15473#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15473: GHC 8.6+ loops infinitely on an UndecidableInstances error message -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: closed Priority: highest | Milestone: 8.6.1 Component: Compiler (Type | Version: 8.5 checker) | Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Compile-time | Test Case: performance bug | typecheck/should_compile/T15473 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed Comment: All merged. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15473#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC