[GHC] #16133: TH can sneak in TypeApplications without enabling the extension
#16133: TH can sneak in TypeApplications without enabling the extension -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.8.1 Component: Template | Version: 8.6.3 Haskell | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: GHC accepts Unknown/Multiple | invalid program Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- This program compiles: {{{#!hs {-# LANGUAGE TemplateHaskell #-} module Bug1 where import Language.Haskell.TH $([d| f :: Int f = $(varE 'id `appTypeE` conT ''Int `appE` litE (integerL 42)) |]) }}} But it shouldn't: this splices in code that uses `TypeApplications`, but the language extension isn't enabled! What's worse, this is inconsistent with visible kind applications, since the following code //is// rejected: {{{#!hs {-# LANGUAGE PolyKinds #-} {-# LANGUAGE TemplateHaskell #-} module Bug2 where import Data.Kind import Language.Haskell.TH hiding (Type) data P (a :: k) = MkP $([d| type P' = $(conT ''P `appKindT` conT ''Type) |]) }}} {{{ $ ~/Software/ghc4/inplace/bin/ghc-stage2 Bug2.hs [1 of 1] Compiling Bug2 ( Bug2.hs, Bug2.o ) Bug2.hs:10:3: error: Illegal visible kind application ‘Type’ Perhaps you intended to use TypeApplications | 10 | $([d| type P' = $(conT ''P `appKindT` conT ''Type) |]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ }}} Let's bring the two into harmony. Patch incoming. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16133> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#16133: TH can sneak in TypeApplications without enabling the extension -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.8.1 Component: Template Haskell | Version: 8.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC accepts | Unknown/Multiple invalid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | https://gitlab.haskell.org/ghc/ghc/merge_requests/77 -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => patch * differential: => https://gitlab.haskell.org/ghc/ghc/merge_requests/77 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16133#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#16133: TH can sneak in TypeApplications without enabling the extension -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.8.1 Component: Template Haskell | Version: 8.6.3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC accepts | Unknown/Multiple invalid program | Test Case: th/T16133 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | https://gitlab.haskell.org/ghc/ghc/merge_requests/77 -------------------------------------+------------------------------------- Changes (by RyanGlScott): * testcase: => th/T16133 * status: patch => closed * resolution: => fixed Comment: Landed in [https://gitlab.haskell.org/ghc/ghc/commit/bbd58fb5f029b632e2d8977518723feee0... bbd58fb5f029b632e2d8977518723feee0737ba7]: {{{ Author: Ryan Scott <ryan.gl.scott@gmail.com> Date: Sat Jan 5 12:40:39 2019 -0500 Fix #16133 by checking for TypeApplications in rnExpr }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16133#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#16133: TH can sneak in TypeApplications without enabling the extension -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.8.1 Component: Template Haskell | Version: 8.6.3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC accepts | Unknown/Multiple invalid program | Test Case: th/T16133 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | https://gitlab.haskell.org/ghc/ghc/merge_requests/77 -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"bbd58fb5f029b632e2d8977518723feee0737ba7/ghc" bbd58fb/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="bbd58fb5f029b632e2d8977518723feee0737ba7" Fix #16133 by checking for TypeApplications in rnExpr }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16133#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC