[GHC] #13947: GHC 8.2 gives misleading error message for out-of-scope infix type constructor
#13947: GHC 8.2 gives misleading error message for out-of-scope infix type constructor -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Poor/confusing Unknown/Multiple | error message Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- {{{#!hs {-# LANGUAGE TypeOperators #-} module Bug where f :: () -> Int :~: Int f = undefined }}} GHC 8.0.2 gives a reasonable error message: {{{ $ /opt/ghc/8.0.2/bin/ghc Bug.hs [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) Bug.hs:4:12: error: Not in scope: type constructor or class ‘:~:’ }}} But GHC 8.2.1's error message is much more confusing: {{{ $ /opt/ghc/8.2.1/bin/ghc Bug.hs [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) Bug.hs:4:6: error: Precedence parsing error cannot mix ‘(->)’ [infixr 0] and ‘:~:’ [infixl 0] in the same infix expression | 4 | f :: () -> Int :~: Int | ^^^^^^^^^^^^^^^^^ Bug.hs:4:12: error: Not in scope: type constructor or class ‘:~:’ A data constructor of that name is in scope; did you mean DataKinds? | 4 | f :: () -> Int :~: Int | ^^^^^^^^^^^ }}} I was thrown akilter by the claim that `:~:` was `infixl 0`, since it was displayed before the real cause of the error (that it's out-of-scope). Adding `import Data.Type.Equality` fixes the error, but GHC really shouldn't be making claims about the fixities of out-of-scope type constructors in the first place. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13947> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13947: GHC 8.2 gives misleading error message for out-of-scope infix type constructor -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * cc: adamgundry (added) Comment: This started occurring in commit 2484d4dae65c81f218dcfe494b963b2630bb8fa6 (`Refactor renaming of operators/sections to fix DuplicateRecordFields bugs`). -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13947#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13947: GHC 8.2 gives misleading error message for out-of-scope infix type constructor -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: ORF Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by adamgundry): * keywords: => ORF -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13947#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13947: GHC 8.2 gives misleading error message for out-of-scope infix type constructor -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: RyanGlScott Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: ORF Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * owner: (none) => RyanGlScott Comment: After skimming the commitdiff, I'm reasonably confident I know what is happening, and how fix it. I'll post a Phab Diff after I've validated. Also, I just realized that there's another problem with the error message in GHC 8.2: it claims that a constructor `:~:` is in scope, but that's untrue. I'll submit a separate ticket for this later. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13947#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13947: GHC 8.2 gives misleading error message for out-of-scope infix type constructor -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: RyanGlScott Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: ORF Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3718 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => patch * differential: => Phab:D3718 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13947#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13947: GHC 8.2 gives misleading error message for out-of-scope infix type constructor -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: RyanGlScott Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: ORF Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3718 Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): I've opened #13948 for the `A data constructor of that name is in scope` issue. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13947#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13947: GHC 8.2 gives misleading error message for out-of-scope infix type constructor -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: RyanGlScott Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: ORF Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3718 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"85ac65c5f0b057f1b07ed7bf9a8d9aeae4ce1390/ghc" 85ac65c/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="85ac65c5f0b057f1b07ed7bf9a8d9aeae4ce1390" Fix #13947 by checking for unbounded names more Commit 2484d4dae65c81f218dcfe494b963b2630bb8fa6 accidentally dropped a call to `isUnboundName` in an important location. This re-adds it. Fixes #13947. Test Plan: make test TEST=T13947 Reviewers: adamgundry, austin, bgamari Reviewed By: adamgundry Subscribers: rwbarton, thomie GHC Trac Issues: #13947 Differential Revision: https://phabricator.haskell.org/D3718 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13947#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13947: GHC 8.2 gives misleading error message for out-of-scope infix type constructor -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: RyanGlScott Type: bug | Status: merge Priority: normal | Milestone: 8.2.2 Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: ORF Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3718 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => merge * milestone: => 8.2.2 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13947#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13947: GHC 8.2 gives misleading error message for out-of-scope infix type constructor -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: RyanGlScott Type: bug | Status: closed Priority: normal | Milestone: 8.2.2 Component: Compiler | Version: 8.2.1-rc2 Resolution: fixed | Keywords: ORF Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3718 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: Merged to `ghc-8.2` with 77dab28d9bac76b0f0e5e4aae52b7ee683849e04. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13947#comment:8> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC