[GHC] #15527: TypeApplications error message doesn't parenthesize infix name
#15527: TypeApplications error message doesn't parenthesize infix name -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.3 Keywords: | Operating System: Unknown/Multiple TypeApplications | Architecture: | Type of failure: Poor/confusing Unknown/Multiple | error message Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- If you compile the following program: {{{#!hs module Bug where f :: (Int -> Int) -> (Int -> Int) -> (Int -> Int) f = (.) @Int }}} You'll get this error: {{{ $ /opt/ghc/8.4.3/bin/ghc Bug.hs [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) Bug.hs:4:6: error: Pattern syntax in expression context: .@Int Did you mean to enable TypeApplications? | 4 | f = (.) @Int | ^^^^^^^^ }}} I was taken aback by this strange `.@` thing before I realized what was actually going on: the error message simply forgot to parenthesize `.`. This is `ppr_expr`'s fault, since it calls `ppr` on an `RdrName` instead of `pprPrefixOcc`. Patch incoming. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15527> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15527: TypeApplications error message doesn't parenthesize infix name -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.3 Resolution: | Keywords: | TypeApplications 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:D5071 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => patch * differential: => Phab:D5071 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15527#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15527: TypeApplications error message doesn't parenthesize infix name -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.3 Resolution: | Keywords: | TypeApplications 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:D5071 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Krzysztof Gogolewski <krz.gogolewski@…>): In [changeset:"5238f204482ac7f05f4e2d2e92576288cc00d42d/ghc" 5238f204/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="5238f204482ac7f05f4e2d2e92576288cc00d42d" Fix #15527 by pretty-printing an RdrName prefixly Summary: When `(.) @Int` is used without enabling `TypeApplications`, the resulting error message will pretty-print the (symbolic) `RdrName` `(.)`. However, it does so without parenthesizing it, which causes the pretty-printed expression to appear as `.@Int`. Yuck. Since the expression in a type application will always be prefix, we can fix this issue by using `pprPrefixOcc` instead of plain ol' `ppr`. Test Plan: make test TEST=T15527 Reviewers: bgamari, monoidal, simonpj Reviewed By: monoidal, simonpj Subscribers: rwbarton, carter GHC Trac Issues: #15527 Differential Revision: https://phabricator.haskell.org/D5071 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15527#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15527: TypeApplications error message doesn't parenthesize infix name -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: merge Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.3 Resolution: | Keywords: | TypeApplications 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:D5071 Wiki Page: | -------------------------------------+------------------------------------- Changes (by monoidal): * status: patch => merge -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15527#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15527: TypeApplications error message doesn't parenthesize infix name -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.3 Resolution: fixed | Keywords: | TypeApplications 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:D5071 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: Merged with fb8b2cb11023dd453b22ba49b7535b6ae8a8b506. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15527#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC