diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2018-10-28 16:08:11 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-10-30 14:58:32 -0400 |
commit | 2567e8f341ef638b8a93054d1be75c176bfaee66 (patch) | |
tree | f98fb41a009e91224e6f635668427d2e7d863fbc /testsuite/tests/th/T13856.hs | |
parent | 377fe39888b1c711d15c94583ec83680d8ae7bf4 (diff) | |
download | haskell-2567e8f341ef638b8a93054d1be75c176bfaee66.tar.gz |
Fix #15815 by parenthesizing the arguments to infix ~
An unfortunate consequence of commit
b9483981d128f55d8dae3f434f49fa6b5b30c779 (`Remove HsEqTy and XEqTy`)
is infix uses of `~` in TH quotes now desugar differently than
before. In particular, we have that:
```haskell
a ~ (Int -> Int)
```
Now desugars to:
```haskell
HsOpTy a (~) (HsOpTy Int (->) Int)
```
Which GHC interprets as being:
```haskell
a ~ Int -> Int
```
Or, equivalently:
```haskell
(a ~ Int) -> Int
```
Which is different than what was intended! This is the cause
of #15815.
All of this has revealed that we likely need to renovate the way we
desugar infix type operators to be more consistent with the treatment
for infix expressions (see
https://ghc.haskell.org/trac/ghc/ticket/15815#comment:5 for more on
this.) Doing so would constitute a breaking change, however, so we
will likely want to wait until another major GHC release to do this.
In the meantime, this patch offers a non-invasive change to the way
that infix uses of `~` are desugared. This makes the program
in #15815 compile again by inserting extra `HsParTy`s around the
arguments to `~` if they are lacking them.
Test Plan: make test TEST=T15815
Reviewers: int-index, goldfire, bgamari
Reviewed By: int-index
Subscribers: int-e, rwbarton, carter
GHC Trac Issues: #15815
Differential Revision: https://phabricator.haskell.org/D5274
(cherry picked from commit b8a797ecc34a309bd78f5a290e3554642a3a478a)
Diffstat (limited to 'testsuite/tests/th/T13856.hs')
0 files changed, 0 insertions, 0 deletions