From 85ac65c5f0b057f1b07ed7bf9a8d9aeae4ce1390 Mon Sep 17 00:00:00 2001 From: Ryan Scott <ryan.gl.scott@gmail.com> Date: Tue, 11 Jul 2017 13:59:29 -0400 Subject: [PATCH] Fix #13947 by checking for unbounded names more Commit 2484d4dae65c81f218dcfe494b963b2630bb8fa6 accidentally dropped a call to `isUnboundName` in an important location. This re-adds it. Fixes #13947. Test Plan: make test TEST=T13947 Reviewers: adamgundry, austin, bgamari Reviewed By: adamgundry Subscribers: rwbarton, thomie GHC Trac Issues: #13947 Differential Revision: https://phabricator.haskell.org/D3718 --- compiler/rename/RnTypes.hs | 5 +++-- testsuite/tests/rename/should_fail/T13947.hs | 5 +++++ testsuite/tests/rename/should_fail/T13947.stderr | 3 +++ testsuite/tests/rename/should_fail/all.T | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 testsuite/tests/rename/should_fail/T13947.hs create mode 100644 testsuite/tests/rename/should_fail/T13947.stderr diff --git a/compiler/rename/RnTypes.hs b/compiler/rename/RnTypes.hs index 35b67a2fd1b0..014d4850c853 100644 --- a/compiler/rename/RnTypes.hs +++ b/compiler/rename/RnTypes.hs @@ -1431,8 +1431,9 @@ sectionPrecErr op@(n1,_) arg_op@(n2,_) section nest 4 (text "in the section:" <+> quotes (ppr section))] is_unbound :: OpName -> Bool -is_unbound UnboundOp{} = True -is_unbound _ = False +is_unbound (NormalOp n) = isUnboundName n +is_unbound UnboundOp{} = True +is_unbound _ = False ppr_opfix :: (OpName, Fixity) -> SDoc ppr_opfix (op, fixity) = pp_op <+> brackets (ppr fixity) diff --git a/testsuite/tests/rename/should_fail/T13947.hs b/testsuite/tests/rename/should_fail/T13947.hs new file mode 100644 index 000000000000..bc435e70eb9a --- /dev/null +++ b/testsuite/tests/rename/should_fail/T13947.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE TypeOperators #-} +module T13947 where + +f :: () -> Int :~: Int +f = undefined diff --git a/testsuite/tests/rename/should_fail/T13947.stderr b/testsuite/tests/rename/should_fail/T13947.stderr new file mode 100644 index 000000000000..8a636a2bb987 --- /dev/null +++ b/testsuite/tests/rename/should_fail/T13947.stderr @@ -0,0 +1,3 @@ + +T13947.hs:4:12: error: + Not in scope: type constructor or class ‘:~:’ diff --git a/testsuite/tests/rename/should_fail/all.T b/testsuite/tests/rename/should_fail/all.T index 457f4010b127..f7f77192c846 100644 --- a/testsuite/tests/rename/should_fail/all.T +++ b/testsuite/tests/rename/should_fail/all.T @@ -127,3 +127,4 @@ test('T11592', normal, compile_fail, ['']) test('T12879', normal, compile_fail, ['']) test('T13644', expect_broken(13644), multimod_compile_fail, ['T13644','-v0']) test('T13568', normal, multimod_compile_fail, ['T13568','-v0']) +test('T13947', normal, compile_fail, ['']) -- GitLab