From d2471964ef06219811c03c2ed0710f9ff98e97ef Mon Sep 17 00:00:00 2001 From: Simon Peyton Jones Date: Tue, 29 Oct 2019 15:18:22 +0000 Subject: Add another test for #17267 This one came in a comment from James Payor --- testsuite/tests/quantified-constraints/T17267e.hs | 27 ++++++++++++++++++++++ .../tests/quantified-constraints/T17267e.stderr | 13 +++++++++++ testsuite/tests/quantified-constraints/all.T | 1 + 3 files changed, 41 insertions(+) create mode 100644 testsuite/tests/quantified-constraints/T17267e.hs create mode 100644 testsuite/tests/quantified-constraints/T17267e.stderr diff --git a/testsuite/tests/quantified-constraints/T17267e.hs b/testsuite/tests/quantified-constraints/T17267e.hs new file mode 100644 index 0000000000..0b00995ab2 --- /dev/null +++ b/testsuite/tests/quantified-constraints/T17267e.hs @@ -0,0 +1,27 @@ +{-# LANGUAGE QuantifiedConstraints #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE MonoLocalBinds #-} + +module Main where + +class Show a => Thing a b +instance Show a => Thing a b + +class (Show a => Thing a ()) => PseudoShow a b +instance PseudoShow a b + +pseudoShow :: PseudoShow a () => a -> String +pseudoShow = show + + +{- + [G] PseudoShow a () +(and hence by SC) + [G] Show a => Thing a () +(and hence by SC) + [G] Show a => Show a +The latter loops +-} + diff --git a/testsuite/tests/quantified-constraints/T17267e.stderr b/testsuite/tests/quantified-constraints/T17267e.stderr new file mode 100644 index 0000000000..b497fa1009 --- /dev/null +++ b/testsuite/tests/quantified-constraints/T17267e.stderr @@ -0,0 +1,13 @@ + +T17267e.hs:1:1: error: + The IO action ‘main’ is not defined in module ‘Main’ + +T17267e.hs:16:14: error: + • Reduction stack overflow; size = 201 + When simplifying the following type: Show a + Use -freduction-depth=0 to disable this check + (any upper bound you could choose might fail unpredictably with + minor updates to GHC, so disabling the check is recommended if + you're sure that type checking should terminate) + • In the expression: show + In an equation for ‘pseudoShow’: pseudoShow = show diff --git a/testsuite/tests/quantified-constraints/all.T b/testsuite/tests/quantified-constraints/all.T index 7fb728654a..6a1d41eeee 100644 --- a/testsuite/tests/quantified-constraints/all.T +++ b/testsuite/tests/quantified-constraints/all.T @@ -26,3 +26,4 @@ test('T17267a', normal, compile_fail, ['']) test('T17267b', normal, compile_fail, ['']) test('T17267c', normal, compile_fail, ['']) test('T17267d', normal, compile_and_run, ['']) +test('T17267e', normal, compile_fail, ['']) -- cgit v1.2.1