diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2020-04-27 17:08:19 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-04-28 15:40:42 -0400 |
commit | 518a63d4d7e31e49a81ad66d5e5ccb1f790f6de9 (patch) | |
tree | 2424d1fb4c64313a5e98f807789d575de9942f97 /testsuite/tests/th/T18097.hs | |
parent | 4b9764db7c190de377c06dfc71bfe6e4b37c7eb0 (diff) | |
download | haskell-518a63d4d7e31e49a81ad66d5e5ccb1f790f6de9.tar.gz |
Make boxed 1-tuples have known keys
Unlike other tuples, which use special syntax and are "known" by way
of a special `isBuiltInOcc_maybe` code path, boxed 1-tuples do not
use special syntax. Therefore, in order to make sure that the
internals of GHC are aware of the `data Unit a = Unit a` definition
in `GHC.Tuple`, we give `Unit` known keys. For the full details, see
`Note [One-tuples] (Wrinkle: Make boxed one-tuple names have known keys)`
in `GHC.Builtin.Types`.
Fixes #18097.
Diffstat (limited to 'testsuite/tests/th/T18097.hs')
-rw-r--r-- | testsuite/tests/th/T18097.hs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/testsuite/tests/th/T18097.hs b/testsuite/tests/th/T18097.hs new file mode 100644 index 0000000000..2263dfe018 --- /dev/null +++ b/testsuite/tests/th/T18097.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE TemplateHaskell #-} +module T18097 where + +import Language.Haskell.TH +import GHC.Tuple + +f = case $( tupE [ [| "ok" |] ] ) of Unit x -> putStrLn x +g = case Unit "ok" of $( tupP [ [p| x |] ] ) -> putStrLn x + +h :: $( tupleT 1 ) String +h = Unit "ok" + +i :: Unit String +i = $( tupE [ [| "ok" |] ] ) |