[GHC] #16183: GHC HEAD regression: -ddump-splices incorrectly parenthesizes HsKindSig applications

#16183: GHC HEAD regression: -ddump-splices incorrectly parenthesizes HsKindSig applications -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.8.1 Component: Template | Version: 8.7 Haskell | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Debugging Unknown/Multiple | information is incorrect Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- When you compile this file with GHC 8.6.3 and HEAD: {{{#!hs {-# LANGUAGE KindSignatures #-} {-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -ddump-splices #-} module Bug where import Data.Kind type F = $([t| (Maybe :: Type -> Type) Int |]) }}} You get two different results: {{{ $ /opt/ghc/8.6.3/bin/ghc -fforce-recomp Bug.hs [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) Bug.hs:8:12-45: Splicing type [t| (Maybe :: Type -> Type) Int |] ======> (Maybe :: Type -> Type) Int $ ~/Software/ghc4/inplace/bin/ghc-stage2 -fforce-recomp Bug.hs [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) Bug.hs:8:12-45: Splicing type [t| (Maybe :: Type -> Type) Int |] ======> Maybe :: Type -> Type Int }}} Notice how in the GHC HEAD output, GHC forgets to put parentheses around `Maybe :: Type -> Type`, leading to the utterly nonsensical type `Maybe :: Type -> Type Int`. The commit that introduced this regression is [https://gitlab.haskell.org/ghc/ghc/commit/ae2c9b40f5b6bf272251d1f4107c60003f... ae2c9b40f5b6bf272251d1f4107c60003f541b62]. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16183 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16183: GHC HEAD regression: -ddump-splices incorrectly parenthesizes HsKindSig applications -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.8.1 Component: Template Haskell | Version: 8.7 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Debugging | Unknown/Multiple information is incorrect | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by RyanGlScott: Old description:
When you compile this file with GHC 8.6.3 and HEAD:
{{{#!hs {-# LANGUAGE KindSignatures #-} {-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -ddump-splices #-} module Bug where
import Data.Kind
type F = $([t| (Maybe :: Type -> Type) Int |]) }}}
You get two different results:
{{{ $ /opt/ghc/8.6.3/bin/ghc -fforce-recomp Bug.hs [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) Bug.hs:8:12-45: Splicing type [t| (Maybe :: Type -> Type) Int |] ======> (Maybe :: Type -> Type) Int
$ ~/Software/ghc4/inplace/bin/ghc-stage2 -fforce-recomp Bug.hs [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) Bug.hs:8:12-45: Splicing type [t| (Maybe :: Type -> Type) Int |] ======> Maybe :: Type -> Type Int }}}
Notice how in the GHC HEAD output, GHC forgets to put parentheses around `Maybe :: Type -> Type`, leading to the utterly nonsensical type `Maybe :: Type -> Type Int`.
The commit that introduced this regression is [https://gitlab.haskell.org/ghc/ghc/commit/ae2c9b40f5b6bf272251d1f4107c60003f... ae2c9b40f5b6bf272251d1f4107c60003f541b62].
New description: When you compile this file with GHC 8.6.3 and HEAD: {{{#!hs {-# LANGUAGE KindSignatures #-} {-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -ddump-splices #-} module Bug where import Data.Kind type F = $([t| (Maybe :: Type -> Type) Int |]) }}} You get two different results: {{{ $ /opt/ghc/8.6.3/bin/ghc -fforce-recomp Bug.hs [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) Bug.hs:8:12-45: Splicing type [t| (Maybe :: Type -> Type) Int |] ======> (Maybe :: Type -> Type) Int $ ~/Software/ghc4/inplace/bin/ghc-stage2 -fforce-recomp Bug.hs [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) Bug.hs:8:12-45: Splicing type [t| (Maybe :: Type -> Type) Int |] ======> Maybe :: Type -> Type Int }}} Notice how in the GHC HEAD output, GHC forgets to put parentheses around `Maybe :: Type -> Type`, leading to the utterly nonsensical type `Maybe :: Type -> Type Int`. The commit that introduced this regression is [https://gitlab.haskell.org/ghc/ghc/commit/bace26aadaafa4064e78f9ed088c1e2217... bace26aadaafa4064e78f9ed088c1e2217221acc]. -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16183#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16183: GHC HEAD regression: -ddump-splices incorrectly parenthesizes HsKindSig applications -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.8.1 Component: Template Haskell | Version: 8.7 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Debugging | Unknown/Multiple information is incorrect | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): Function types are also affected: {{{#!hs {-# LANGUAGE KindSignatures #-} {-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -ddump-splices #-} module Bug where import Data.Kind type F = $([t| (Int :: Type) -> (Int :: Type) |]) }}} {{{ $ ~/Software/ghc4/inplace/bin/ghc-stage2 --interactive Bug.hs GHCi, version 8.7.20190114: https://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/rgscott/.ghci [1 of 1] Compiling Bug ( Bug.hs, interpreted ) Bug.hs:8:12-48: Splicing type [t| (Int :: Type) -> (Int :: Type) |] ======> Int :: Type -> Int :: Type }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16183#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16183: GHC HEAD regression: -ddump-splices incorrectly parenthesizes HsKindSig applications -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.8.1 Component: Template Haskell | Version: 8.7 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Debugging | Unknown/Multiple information is incorrect | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): So are type family equations: {{{#!hs {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -ddump-splices #-} module Bug where import Data.Kind $([d| type family F a where F (a :: Type) = Int |]) }}} {{{ $ ~/Software/ghc4/inplace/bin/ghc-stage2 --interactive Bug.hs GHCi, version 8.7.20190114: https://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/rgscott/.ghci [1 of 1] Compiling Bug ( Bug.hs, interpreted ) Bug.hs:(8,3)-(9,30): Splicing declarations [d| type family F_a1B4 a_a1B5 where F_a1B4 (a_a1B6 :: Type) = Int |] ======> type family F_a4tB a_a4tC where F_a4tB a_a4tD :: Type = Int }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16183#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16183: GHC HEAD regression: -ddump-splices incorrectly parenthesizes HsKindSig applications -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.8.1 Component: Template Haskell | Version: 8.7 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Debugging | Unknown/Multiple information is incorrect | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | https://gitlab.haskell.org/ghc/ghc/merge_requests/121 -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => patch * differential: => https://gitlab.haskell.org/ghc/ghc/merge_requests/121 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16183#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16183: GHC HEAD regression: -ddump-splices incorrectly parenthesizes HsKindSig applications -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: merge Priority: normal | Milestone: 8.8.1 Component: Template Haskell | Version: 8.7 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Debugging | Unknown/Multiple information is incorrect | Test Case: th/T16183 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | https://gitlab.haskell.org/ghc/ghc/merge_requests/121 -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: patch => merge * testcase: => th/T16183 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16183#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16183: GHC HEAD regression: -ddump-splices incorrectly parenthesizes HsKindSig
applications
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: (none)
Type: bug | Status: merge
Priority: normal | Milestone: 8.8.1
Component: Template Haskell | Version: 8.7
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Debugging | Unknown/Multiple
information is incorrect | Test Case: th/T16183
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: | https://gitlab.haskell.org/ghc/ghc/merge_requests/121
-------------------------------------+-------------------------------------
Comment (by Marge Bot
participants (1)
-
GHC