[GHC] #15898: Promoted type constructors don't print right in HsType

#15898: Promoted type constructors don't print right in HsType -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 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: -------------------------------------+------------------------------------- Consider this {{{ ghci> import Data.Proxy ghci> undefined :: '() -> Int <interactive>:11:14: error: • Expected a type, but ‘ '()’ has kind ‘()’ • In an expression type signature: '() -> Int }}} What is that strange space doing before the `'()`? Similarly {{{ undefined :: Proxy '() Int <interactive>:12:14: error: • Expected kind ‘* -> *’, but ‘Proxy '()’ has kind ‘*’ • In an expression type signature: Proxy '() Int }}} Again, the strange space. It comes from the `HsType` pretty printer, which is worried about printing the type {{{ '['K] }}} That is, a promoted list with one element `K`. The trouble is that looks like a character literal `'['`. So we add an extra space, thus `'[ 'K]`. ''But we add it before every promoded data constructor!" Hence the spurious spaces. In `IfaceType` exactly the same thing happens, but we are more clever, and only print the leading space if the promoted data con immediately follows `'[` or `'(`. We should do the same thing for `HsType`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15898 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15898: Promoted type constructors don't print right in HsType
-------------------------------------+-------------------------------------
Reporter: simonpj | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.6.3
Component: Compiler | Version: 8.6.2
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: |
-------------------------------------+-------------------------------------
Comment (by Simon Peyton Jones

#15898: Promoted type constructors don't print right in HsType -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | ghci/scripts/T15898 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * testcase: => ghci/scripts/T15898 * status: new => closed * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15898#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15898: Promoted type constructors don't print right in HsType -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | ghci/scripts/T15898 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by alpmestan): * cc: alpmestan (added) Comment: As you can see in this validate run: https://circleci.com/gh/ghc/ghc/11395 {{{#!hs Actual stderr output differs from expected: --- /dev/null 2018-11-16 06:39:05.702159000 +0000 +++ ghci/scripts/T15898.run/T15898.run.stderr.normalised 2018-11-16 09:54:38.995083401 +0000 @@ -0,0 +1,52 @@ + +<interactive>:3:1: + Couldn't match kind ‘()’ with ‘*’ + When matching types + a0 :: * + '() :: () + In the expression: undefined :: '() + In an equation for ‘it’: it = undefined :: '() + +<interactive>:3:14: + Expected a type, but ‘'()’ has kind ‘()’ + In an expression type signature: '() + In the expression: undefined :: '() + In an equation for ‘it’: it = undefined :: '() + +<interactive>:4:14: + Expected kind ‘* -> *’, but ‘Proxy '()’ has kind ‘*’ + In an expression type signature: Proxy '() Int + In the expression: undefined :: Proxy '() Int + In an equation for ‘it’: it = undefined :: Proxy '() Int + +<interactive>:5:1: + Couldn't match kind ‘[*]’ with ‘*’ + When matching types + a0 :: * + '[(), ()] :: [*] + In the expression: undefined :: [(), ()] + In an equation for ‘it’: it = undefined :: [(), ()] + +<interactive>:5:14: + Expected a type, but ‘[(), ()]’ has kind ‘[*]’ + In an expression type signature: [(), ()] + In the expression: undefined :: [(), ()] + In an equation for ‘it’: it = undefined :: [(), ()] + +<interactive>:6:1: + Couldn't match kind ‘([k0], [k1])’ with ‘*’ + When matching types + a0 :: * + '( '[], '[]) :: ([k0], [k1]) + In the expression: undefined :: '( '[], '[]) + In an equation for ‘it’: it = undefined :: '( '[], '[]) + Relevant bindings include + it :: '( '[], '[]) (bound at <interactive>:6:1) + +<interactive>:6:14: + Expected a type, but ‘'( '[], '[])’ has kind ‘([k0], [k1])’ + In an expression type signature: '( '[], '[]) + In the expression: undefined :: '( '[], '[]) + In an equation for ‘it’: it = undefined :: '( '[], '[]) + Relevant bindings include + it :: '( '[], '[]) (bound at <interactive>:6:1) *** unexpected failure for T15898(ghci) }}} T15898 doesn't pass in the ghci way on HEAD. Should we re-open this ticket, or is it a new problem? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15898#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15898: Promoted type constructors don't print right in HsType
-------------------------------------+-------------------------------------
Reporter: simonpj | Owner: (none)
Type: bug | Status: closed
Priority: normal | Milestone: 8.6.3
Component: Compiler | Version: 8.6.2
Resolution: fixed | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
| ghci/scripts/T15898
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Simon Peyton Jones

#15898: Promoted type constructors don't print right in HsType -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | ghci/scripts/T15898 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Ah. I had the stderr file in my build tree, but not in my source tree, so I failed to add it. Sorry. Now pushed. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15898#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC