Commit eaf9cc42 authored by Ryan Scott's avatar Ryan Scott Committed by Ben Gamari

Fix collect_lpat's treatment of HsSplicedPats

`collect_lpat` was missing a case for `HsSplicedPat`, which caused
incorrect renaming of TH-spliced pattern variables.

Fixes #13473.

Test Plan: make test TEST=T13473

Reviewers: facundominguez, austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13473

Differential Revision: https://phabricator.haskell.org/D3572
parent 2277172a
......@@ -965,6 +965,9 @@ collect_lpat (L _ pat) bndrs
go (SigPatIn pat _) = collect_lpat pat bndrs
go (SigPatOut pat _) = collect_lpat pat bndrs
go (SplicePat (HsSpliced _ (HsSplicedPat pat)))
= go pat
go (SplicePat _) = bndrs
go (CoPat _ pat _) = go pat
......
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
module Main where
import Language.Haskell.TH
import T13473a
[quoter|y|] = 1
main :: IO ()
main = do
let $(varP $ mkName "x") = 1 in print x
print y
module T13473a where
import Language.Haskell.TH
import Language.Haskell.TH.Quote
quoter :: QuasiQuoter
quoter = QuasiQuoter { quotePat = varP . mkName
, quoteExp = undefined
, quoteDec = undefined
, quoteType = undefined }
......@@ -381,6 +381,8 @@ test('T13123', normal, compile, ['-v0'])
test('T13098', normal, compile, ['-v0'])
test('T11046', normal, multimod_compile, ['T11046','-v0'])
test('T13366', normal, compile_and_run, ['-lstdc++ -v0'])
test('T13473', normal, multimod_compile_and_run,
['T13473.hs', '-v0 ' + config.ghc_th_way_flags])
test('T13587', expect_broken(13587), compile_and_run, ['-v0'])
test('T13618', normal, compile_and_run, ['-v0'])
test('T13642', normal, compile_fail, ['-v0'])
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment