[Git][ghc/ghc][wip/sjakobi/regression-tests-3] Add regression test for #11141
Simon Jakobi pushed to branch wip/sjakobi/regression-tests-3 at Glasgow Haskell Compiler / GHC Commits: b3d5bc61 by Simon Jakobi at 2026-03-06T14:32:49+01:00 Add regression test for #11141 Closes #11141. - - - - - 3 changed files: - + testsuite/tests/typecheck/should_compile/T11141.hs - + testsuite/tests/typecheck/should_compile/T11141.stderr - testsuite/tests/typecheck/should_compile/all.T Changes: ===================================== testsuite/tests/typecheck/should_compile/T11141.hs ===================================== @@ -0,0 +1,28 @@ +{-# LANGUAGE FunctionalDependencies #-} +{-# LANGUAGE InstanceSigs #-} +{-# LANGUAGE ScopedTypeVariables #-} +module T11141 where + +data F a = F a +instance Show a => Show (F a) where + show :: forall a. Show a => F a -> String + show (F x) = show x + +{- Previously emitted error: + + Could not deduce (Show a0) + from the context (Show a) + bound by the type signature for show :: Show a => F a -> String + at A.hs:8:13-45 + The type variable ‘a0’ is ambiguous + When checking that: + forall a. Show a => forall a1. Show a1 => F a1 -> String + is more polymorphic than: forall a. Show a => F a -> String + When checking that instance signature for ‘show’ + is more general than its signature in the class + Instance sig: forall a. + Show a => + forall a1. Show a1 => F a1 -> String + Class sig: forall a. Show a => F a -> String + In the instance declaration for ‘Show (F a)’ +-} ===================================== testsuite/tests/typecheck/should_compile/T11141.stderr ===================================== @@ -0,0 +1,4 @@ +T11141.hs:8:20: warning: [GHC-63397] [-Wname-shadowing (in -Wall)] + This binding for ‘a’ shadows the existing binding + bound at T11141.hs:7:10 + ===================================== testsuite/tests/typecheck/should_compile/all.T ===================================== @@ -496,6 +496,7 @@ test('T10770b', expect_broken(10770), compile, ['']) test('T10935', normal, compile, ['']) test('T10971a', normal, compile, ['']) test('T11062', [extra_files(['T11062.hs', 'T11062.hs-boot', 'T11062a.hs'])], multimod_compile, ['T11062', '-v0']) +test('T11141', normal, compile, ['-Wname-shadowing']) test('T11237', normal, compile, ['']) test('T10592', normal, compile, ['']) test('T11305', normal, compile, ['']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b3d5bc6112a8ec17ab30e5ac16ee69d8... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b3d5bc6112a8ec17ab30e5ac16ee69d8... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Simon Jakobi (@sjakobi2)