diff options
author | Adam Gundry <adam@well-typed.com> | 2017-02-14 09:35:06 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-02-14 10:53:01 -0500 |
commit | 2484d4dae65c81f218dcfe494b963b2630bb8fa6 (patch) | |
tree | cc06edb56ad404116a1725311d0df84665a5d3ce /testsuite | |
parent | 6626242ba334d81ecf5fe6dd4ef964f74656e541 (diff) | |
download | haskell-2484d4dae65c81f218dcfe494b963b2630bb8fa6.tar.gz |
Refactor renaming of operators/sections to fix DuplicateRecordFields bugs
A variety of panics were possible because the get_op function in
RnTypes didn't handle the possibility that its argument might be an
ambiguous record field. I've made its return type more informative to
correctly handle occurrences of record fields. Fixes Trac #13132.
Test Plan: new test
overloadedrecflds/should_fail/T13132_duplicaterecflds
Reviewers: bgamari, simonpj, austin
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D3126
Diffstat (limited to 'testsuite')
3 files changed, 16 insertions, 0 deletions
diff --git a/testsuite/tests/overloadedrecflds/should_fail/T13132_duplicaterecflds.hs b/testsuite/tests/overloadedrecflds/should_fail/T13132_duplicaterecflds.hs new file mode 100644 index 0000000000..a094bff05b --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/T13132_duplicaterecflds.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE DuplicateRecordFields #-} +module Bug where + +newtype ContT r m a = ContT { runContT :: (a -> m r) -> m r } +newtype ContT2 r m a = ContT2 { runContT :: (a -> m r) -> m r } + +foo bar baz = (`runContT` bar.baz) + +woo x y = (`runContT` x `y` x) diff --git a/testsuite/tests/overloadedrecflds/should_fail/T13132_duplicaterecflds.stderr b/testsuite/tests/overloadedrecflds/should_fail/T13132_duplicaterecflds.stderr new file mode 100644 index 0000000000..391ccde4c1 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/T13132_duplicaterecflds.stderr @@ -0,0 +1,6 @@ + +T13132_duplicaterecflds.hs:9:11: error: + The operator ‘runContT’ [infixl 9] of a section + must have lower precedence than that of the operand, + namely ‘y’ [infixl 9] + in the section: ‘`runContT` x `y` x’ diff --git a/testsuite/tests/overloadedrecflds/should_fail/all.T b/testsuite/tests/overloadedrecflds/should_fail/all.T index 95a2d9b81e..f036ad0b63 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/all.T +++ b/testsuite/tests/overloadedrecflds/should_fail/all.T @@ -21,4 +21,5 @@ test('overloadedlabelsfail01', normal, compile_fail, ['']) test('T11103', normal, compile_fail, ['']) test('T11167_ambiguous_fixity', [], multimod_compile_fail, ['T11167_ambiguous_fixity', '']) +test('T13132_duplicaterecflds', normal, compile_fail, ['']) test('NoParent', normal, compile_fail, ['']) |