diff options
author | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2023-02-20 19:19:17 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-04-03 19:32:02 -0400 |
commit | 220a7a48cabdcfd2ef7bf5dbe3fd6df99e8d3c5b (patch) | |
tree | 56037f6ea7a13ab4fe214bc56beacb7c905aa7f2 /testsuite | |
parent | 8b092910ac18a2b5dc97a29ced9fc469c663a03b (diff) | |
download | haskell-220a7a48cabdcfd2ef7bf5dbe3fd6df99e8d3c5b.tar.gz |
Fixes around unsafeCoerce#
1. `unsafeCoerce#` was documented in `GHC.Prim`. But since the overhaul
in 74ad75e87317, `unsafeCoerce#` is no longer defined there.
I've combined the documentation in `GHC.Prim` with the `Unsafe.Coerce` module.
2. The documentation of `unsafeCoerce#` stated that you should not
cast a function to an algebraic type, even if you later cast it back
before applying it. But ghci was doing that type of cast, as can be seen
with 'ghci -ddump-ds' and typing 'x = not'. I've changed it to use Any
following the documentation.
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/ghci/should_run/T16096.stdout | 24 | ||||
-rw-r--r-- | testsuite/tests/ghci/should_run/T21052.stdout | 4 |
2 files changed, 18 insertions, 10 deletions
diff --git a/testsuite/tests/ghci/should_run/T16096.stdout b/testsuite/tests/ghci/should_run/T16096.stdout index 2749f06586..d5c11d696b 100644 --- a/testsuite/tests/ghci/should_run/T16096.stdout +++ b/testsuite/tests/ghci/should_run/T16096.stdout @@ -13,12 +13,16 @@ letrec { x = GHC.Enum.enumFrom @GHC.Types.Int $dEnum (GHC.Types.I# 1#); } in x; } in GHC.Base.returnIO - @[()] + @[GHC.Types.Any] (GHC.Types.: - @() + @GHC.Types.Any (Unsafe.Coerce.unsafeCoerce# - @GHC.Types.LiftedRep @GHC.Types.LiftedRep @[GHC.Types.Int] @() x) - (GHC.Types.[] @())) + @GHC.Types.LiftedRep + @GHC.Types.LiftedRep + @[GHC.Types.Int] + @GHC.Types.Any + x) + (GHC.Types.[] @GHC.Types.Any)) @@ -36,11 +40,15 @@ letrec { x = GHC.Enum.enumFrom @GHC.Types.Int $dEnum (GHC.Types.I# 1#); } in x; } in GHC.Base.returnIO - @[()] + @[GHC.Types.Any] (GHC.Types.: - @() + @GHC.Types.Any (Unsafe.Coerce.unsafeCoerce# - @GHC.Types.LiftedRep @GHC.Types.LiftedRep @[GHC.Types.Int] @() x) - (GHC.Types.[] @())) + @GHC.Types.LiftedRep + @GHC.Types.LiftedRep + @[GHC.Types.Int] + @GHC.Types.Any + x) + (GHC.Types.[] @GHC.Types.Any)) diff --git a/testsuite/tests/ghci/should_run/T21052.stdout b/testsuite/tests/ghci/should_run/T21052.stdout index 3822a96b6e..cb1a1a16d4 100644 --- a/testsuite/tests/ghci/should_run/T21052.stdout +++ b/testsuite/tests/ghci/should_run/T21052.stdout @@ -1,10 +1,10 @@ ==================== CodeGenInput STG: ==================== -BCO_toplevel :: GHC.Types.IO [()] +BCO_toplevel :: GHC.Types.IO [GHC.Types.Any] [LclId] = {} \u [] let { - sat :: [()] + sat :: [GHC.Types.Any] [LclId] = :! [GHC.Tuple.Prim.() GHC.Types.[]]; } in GHC.Base.returnIO sat; |