Opened 7 months ago

Closed 6 months ago

#15324 closed bug (fixed)

-ddump-splices does not parenthesize rank-n contexts correctly

Reported by: RyanGlScott Owned by:
Priority: normal Milestone: 8.6.1
Component: Template Haskell Version: 8.4.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: th/T15324
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D4910
Wiki Page:


Ryan discovers another -ddump-splices bug—news at 11:

{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -ddump-splices #-}
module Bug where

$([d| f :: forall a. (Show a => a) -> a
      f _ = undefined
$ /opt/ghc/8.4.3/bin/ghci Bug.hs -dsuppress-uniques
GHCi, version 8.4.3:  :? for help                                                                                                                                             
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug              ( Bug.hs, interpreted )
Bug.hs:(6,3)-(8,6): Splicing declarations
    [d| f :: forall a. (Show a => a) -> a
        f _ = undefined |]
    f :: forall a. Show a => a -> a
    f _ = undefined

Notice that f's type signature is pretty-printed as forall a. Show a => a -> a, which is just wrong. Patch incoming.

Change History (4)

comment:1 Changed 7 months ago by RyanGlScott

Differential Rev(s): Phab:D4910
Status: newpatch

comment:2 Changed 7 months ago by Ryan Scott <…>

In 57733978/ghc:

Parenthesize rank-n contexts in Convert

Summary: A simple oversight.

Test Plan: make test TEST=T15324

Reviewers: goldfire, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15324

Differential Revision:

comment:3 Changed 7 months ago by RyanGlScott

Status: patchmerge
Test Case: th/T15324

comment:4 Changed 6 months ago by bgamari

Resolution: fixed
Status: mergeclosed
Note: See TracTickets for help on using tickets.