Make UnsafeSNat et al. into pattern synonyms
...so that they do not cause coerce to bypass the nominal role on the corresponding singleton types when they are imported. See Note [Preventing unsafe coercions for singleton types] and the discussion at #23478. This also introduces unsafeWithSNatCo (and analogues for Char and Symbol) so that users can still access the dangerous coercions that importing the real constructors would allow, but only in a very localized way.
Showing
- libraries/ghc-internal/src/GHC/Internal/TypeLits.hs 55 additions, 4 deletionslibraries/ghc-internal/src/GHC/Internal/TypeLits.hs
- libraries/ghc-internal/src/GHC/Internal/TypeNats.hs 76 additions, 2 deletionslibraries/ghc-internal/src/GHC/Internal/TypeNats.hs
- testsuite/tests/ghci/scripts/T9181.stdout 3 additions, 3 deletionstestsuite/tests/ghci/scripts/T9181.stdout
Loading
Please register or sign in to comment