diff options
author | Dominik Bollmann <bollmann@seas.upenn.edu> | 2016-04-10 18:57:38 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-04-10 20:09:04 +0200 |
commit | 2f82da761defba2cfdc55ca08d774ca7e1240463 (patch) | |
tree | 9e7713c95e09fa7bdbbcca5215c60c0762e4c066 /testsuite/tests/th | |
parent | 6d7fda5eebbb2f79d19953947ba7da5fb9c96db4 (diff) | |
download | haskell-2f82da761defba2cfdc55ca08d774ca7e1240463.tar.gz |
Fix Template Haskell bug reported in #11809.
Record selectors of data types spliced in with Template Haskell are not
renamer-resolved correctly in GHC HEAD. The culprit is
`newRecordSelector` which violates notes `Note [Binders in Template
Haskell] in Convert.hs` and `Note [Looking up Exact RdrNames] in
RnEnv.hs`. This commit fixes `newRecordSelector` accordingly.
Test Plan: ./validate
Reviewers: thomie, mpickering, bgamari, austin, simonpj, goldfire
Reviewed By: goldfire
Differential Revision: https://phabricator.haskell.org/D2091
GHC Trac Issues: #11809
Diffstat (limited to 'testsuite/tests/th')
-rw-r--r-- | testsuite/tests/th/T11809.hs | 13 | ||||
-rw-r--r-- | testsuite/tests/th/all.T | 2 |
2 files changed, 14 insertions, 1 deletions
diff --git a/testsuite/tests/th/T11809.hs b/testsuite/tests/th/T11809.hs new file mode 100644 index 0000000000..bbb65fa83b --- /dev/null +++ b/testsuite/tests/th/T11809.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE TemplateHaskell #-} +module T11809 where + +{- Test splicing in a data type with records -} + +[d| + data D a = MkD { unD :: a } + + someD = MkD "Hello" + getD = unD someD -- unD should resolve to the record selector above! + |] + +getD' = unD someD -- dito here outside of the splice! diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 3939880008..621e2f8cfa 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -391,9 +391,9 @@ test('T10819', test('T10820', normal, compile_and_run, ['-v0']) test('T11341', normal, compile, ['-v0 -dsuppress-uniques']) test('T11345', normal, compile_and_run, ['-v0 -dsuppress-uniques']) - test('TH_finalizer', normal, compile, ['-v0']) test('T10603', normal, compile, ['-ddump-splices -dsuppress-uniques']) test('T11452', normal, compile_fail, ['-v0']) test('T9022', normal, compile_and_run, ['-v0']) test('T11145', normal, compile_fail, ['-v0 -dsuppress-uniques']) +test('T11809', normal, compile, ['-v0']) |