[GHC] #11265: Internal error, using pattern synonym as instance head

#11265: Internal error, using pattern synonym as instance head -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- {{{!#hs {-# LANGUAGE PatternSynonyms, DataKinds #-} pattern A = True class F a instance F A }}} when loaded in ghci it results in an internal error {{{!#hs % g internal.hs GHCi, version 7.11.20151216: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Main ( internal.hs, interpreted ) internal.hs:5:12: error: • GHC internal error: ‘A’ is not in scope during type checking, but it passed the renamer tcl_env of environment: [] • In the first argument of ‘F’, namely ‘A’ In the instance declaration for ‘F A’ Failed, modules loaded: none. Prelude> }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11265 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11265: Internal error, using pattern synonym as instance head -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by Iceland_jack: Old description:
{{{!#hs {-# LANGUAGE PatternSynonyms, DataKinds #-}
pattern A = True
class F a instance F A }}}
when loaded in ghci it results in an internal error
{{{!#hs % g internal.hs GHCi, version 7.11.20151216: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Main ( internal.hs, interpreted )
internal.hs:5:12: error: • GHC internal error: ‘A’ is not in scope during type checking, but it passed the renamer tcl_env of environment: [] • In the first argument of ‘F’, namely ‘A’ In the instance declaration for ‘F A’ Failed, modules loaded: none. Prelude> }}}
New description: {{{#!hs {-# LANGUAGE PatternSynonyms, DataKinds #-} pattern A = True class F a instance F A }}} when loaded in ghci it results in an internal error {{{#!hs % g internal.hs GHCi, version 7.11.20151216: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Main ( internal.hs, interpreted ) internal.hs:5:12: error: • GHC internal error: ‘A’ is not in scope during type checking, but it passed the renamer tcl_env of environment: [] • In the first argument of ‘F’, namely ‘A’ In the instance declaration for ‘F A’ Failed, modules loaded: none. Prelude> }}} -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11265#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11265: Internal error, using pattern synonym as instance head -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: goldfire Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by goldfire): * owner: => goldfire Comment: This smells like my fault, but it also looks quite easy to fix. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11265#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11265: Internal error, using pattern synonym as instance head -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: simonpj Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * owner: goldfire => simonpj Comment: Actually it's not your fault. I'm on it. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11265#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11265: Internal error, using pattern synonym as instance head
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner: simonpj
Type: bug | Status: closed
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.3
Resolution: fixed | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
| patsyn/should_fail/T11265
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Changes (by simonpj):
* testcase: => patsyn/should_fail/T11265
* status: new => closed
* resolution: => fixed
Comment:
Thanks for reporting this, with a nice small repro case.
Fixed by
{{{
commit c069be815aa0bce2eb2c9621a36f114badda2318
Author: Simon Peyton Jones
---------------------------------------------------------------
c069be815aa0bce2eb2c9621a36f114badda2318 compiler/hsSyn/HsBinds.hs | 15 ---- compiler/typecheck/TcBinds.hs | 53 +++-------- compiler/typecheck/TcEnv.hs | 103 +++++++++++++++++++++- compiler/typecheck/TcHsType.hs | 1 + compiler/typecheck/TcRnDriver.hs | 80 ++++++----------- compiler/typecheck/TcRnTypes.hs | 5 ++ testsuite/tests/patsyn/should_fail/T11265.hs | 6 ++ testsuite/tests/patsyn/should_fail/T11265.stderr | 6 ++ testsuite/tests/patsyn/should_fail/T9161-1.stderr | 7 +- testsuite/tests/patsyn/should_fail/T9161-2.stderr | 3 +- testsuite/tests/patsyn/should_fail/all.T | 1 + 11 files changed, 163 insertions(+), 117 deletions(-) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11265#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC