diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2022-04-02 07:45:00 -0400 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2022-04-30 07:12:14 -0400 |
commit | 9ae28873f14d41f00f45242a697f7790c978505b (patch) | |
tree | 55d4a1f0591e0359c56c4c36f2c615350010a351 /rts/StgMiscClosures.cmm | |
parent | 5630dde68185f96da026a4e0c722fe6631633299 (diff) | |
download | haskell-wip/T21328.tar.gz |
Make mkFunCo take AnonArgFlags into accountwip/T21328
Previously, whenever `mkFunCo` would produce reflexive coercions, it would
use `mkVisFunTy` to produce the kind of the coercion. However, `mkFunCo` is
also used to produce coercions between types of the form `ty1 => ty2` in
certain places. This has the unfortunate side effect of causing the type of
the coercion to appear as `ty1 -> ty2` in certain error messages, as spotted
in #21328.
This patch address this by changing replacing the use of `mkVisFunTy` with
`mkFunctionType` in `mkFunCo`. `mkFunctionType` checks the kind of `ty1` and
makes the function arrow `=>` instead of `->` if `ty1` has kind `Constraint`,
so this should always produce the correct `AnonArgFlag`. As a result, this
patch fixes part (2) of #21328.
This is not the only possible way to fix #21328, as the discussion on that
issue lists some possible alternatives. Ultimately, it was concluded that the
alternatives would be difficult to maintain, and since we already use
`mkFunctionType` in `coercionLKind` and `coercionRKind`, using `mkFunctionType`
in `mkFunCo` is consistent with this choice. Moreover, using `mkFunctionType`
does not regress the performance of any test case we have in GHC's test suite.
Diffstat (limited to 'rts/StgMiscClosures.cmm')
0 files changed, 0 insertions, 0 deletions