summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorRichard Eisenberg <rae@richarde.dev>2022-12-05 10:14:02 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-01-26 20:06:53 -0500
commit3e827c3f74ef76d90d79ab6c4e71aa954a1a6b90 (patch)
tree3fd3c6b74e1c0e226f54ea688c0d633d29570e19 /testsuite
parent5640cb1d84d3cce4ce0a9e90d29b2b20d2b38c2f (diff)
downloadhaskell-3e827c3f74ef76d90d79ab6c4e71aa954a1a6b90.tar.gz
Do newtype unwrapping in the canonicaliser and rewriter
See Note [Unwrap newtypes first], which has the details. Close #22519.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/typecheck/should_compile/T22519.hs21
-rw-r--r--testsuite/tests/typecheck/should_compile/all.T1
2 files changed, 22 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/T22519.hs b/testsuite/tests/typecheck/should_compile/T22519.hs
new file mode 100644
index 0000000000..86ab824a1a
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/T22519.hs
@@ -0,0 +1,21 @@
+{-# LANGUAGE Haskell2010 #-}
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+module Bug where
+
+import Data.Coerce (coerce)
+import Data.Kind (Type)
+import GHC.TypeNats (Nat, type (<=))
+
+f :: (1 <= w)
+ => IO (SymBV' sym w)
+ -> IO (SymBV sym w)
+f = coerce
+
+----
+
+data BaseType = BaseBVType Nat
+type family SymExpr (sym :: Type) :: BaseType -> Type
+type SymBV sym n = SymExpr sym (BaseBVType n)
+newtype SymBV' sym w = MkSymBV' (SymBV sym w)
diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T
index fc5ce4936b..416345e526 100644
--- a/testsuite/tests/typecheck/should_compile/all.T
+++ b/testsuite/tests/typecheck/should_compile/all.T
@@ -457,6 +457,7 @@ test('T10335', normal, compile, [''])
test('Improvement', normal, compile, [''])
test('T10009', normal, compile, [''])
test('T10390', normal, compile, [''])
+test('T22519', normal, compile, [''])
test('T8555', normal, compile, [''])
test('T8799', normal, compile, [''])
test('T10432', normal, compile, [''])