[Git][ghc/ghc][master] Add testcase for #23192

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Tue Apr 4 21:13:59 UTC 2023



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
c165f079 by sheaf at 2023-04-04T17:13:40-04:00
Add testcase for #23192

This issue around solving of constraints arising from superclass
expansion using other constraints also borned from superclass expansion
was the topic of commit aed1974e. That commit made sure we don't emit
a "redundant constraint" warning in a situation in which removing the
constraint would cause errors.

Fixes #23192

- - - - -


2 changed files:

- + testsuite/tests/typecheck/should_compile/T23192.hs
- testsuite/tests/typecheck/should_compile/all.T


Changes:

=====================================
testsuite/tests/typecheck/should_compile/T23192.hs
=====================================
@@ -0,0 +1,16 @@
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# OPTIONS_GHC -Werror=redundant-constraints #-}
+
+module EventThing where
+
+class Monad m => Event m where
+  thingsForEvent :: m [Int]
+
+class Monad m => Thingy m where
+  thingies :: m [Int]
+
+-- Check that we don't get a redundant constraint warning for "Monad m".
+-- See #19690.
+instance (Monad m, Event m) => Thingy m where
+  thingies = thingsForEvent


=====================================
testsuite/tests/typecheck/should_compile/all.T
=====================================
@@ -870,3 +870,4 @@ test('T21443', normal, compile, [''])
 test('QualifiedRecordUpdate',
     [ extra_files(['QualifiedRecordUpdate_aux.hs']) ]
     , multimod_compile, ['QualifiedRecordUpdate', '-v0'])
+test('T23192', normal, compile, [''])



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c165f079a13232a44689c55a61c70e2c9aea5464

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c165f079a13232a44689c55a61c70e2c9aea5464
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230404/2c9a4735/attachment-0001.html>


More information about the ghc-commits mailing list