Make isTcLevPoly more conservative with newtypes (#17360)
`isTcLevPoly` gives an approximate answer for when a type constructor is levity polymorphic when fully applied, where `True` means "possibly levity polymorphic" and `False` means "definitely not levity polymorphic". `isTcLevPoly` returned `False` for newtypes, which is incorrect in the presence of `UnliftedNewtypes`, leading to #17360. This patch tweaks `isTcLevPoly` to return `True` for newtypes instead. Fixes #17360.
Showing
- compiler/iface/BuildTyCl.hs 5 additions, 3 deletionscompiler/iface/BuildTyCl.hs
- compiler/types/TyCon.hs 18 additions, 3 deletionscompiler/types/TyCon.hs
- testsuite/tests/typecheck/should_fail/T17360.hs 11 additions, 0 deletionstestsuite/tests/typecheck/should_fail/T17360.hs
- testsuite/tests/typecheck/should_fail/T17360.stderr 6 additions, 0 deletionstestsuite/tests/typecheck/should_fail/T17360.stderr
- testsuite/tests/typecheck/should_fail/all.T 1 addition, 0 deletionstestsuite/tests/typecheck/should_fail/all.T
Loading
Please register or sign in to comment