unboxedSum{Type,Data}Name: Use GHC.Types as the module
Unboxed sum constructors are now defined in the `GHC.Types` module, so if you manually quote an unboxed sum (e.g., `''Sum2#`), you will get a `Name` like: ```hs GHC.Types.Sum2# ``` The `unboxedSumTypeName` function in `template-haskell`, however, mistakenly believes that unboxed sum constructors are defined in `GHC.Prim`, so `unboxedSumTypeName 2` would return an entirely different `Name`: ```hs GHC.Prim.(#|#) ``` This is a problem for Template Haskell users, as it means that they can't be sure which `Name` is the correct one. (Similarly for `unboxedSumDataName`.) This patch fixes the implementations of `unboxedSum{Type,Data}Name` to use `GHC.Types` as the module. For consistency with `unboxedTupleTypeName`, the `unboxedSumTypeName` function now uses the non-punned syntax for unboxed sums (`Sum<N>#`) as the `OccName`. Fixes #24750.
Showing
- libraries/template-haskell/Language/Haskell/TH/Lib/Syntax.hs 3 additions, 3 deletionslibraries/template-haskell/Language/Haskell/TH/Lib/Syntax.hs
- testsuite/tests/quotes/T24750.hs 35 additions, 0 deletionstestsuite/tests/quotes/T24750.hs
- testsuite/tests/quotes/all.T 1 addition, 0 deletionstestsuite/tests/quotes/all.T
Loading
Please register or sign in to comment