Ormolu incorrectly inserts parentheses around type-level multiplication
Closed this issue · 4 comments
Describe the bug
Ormolu formats the following
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE NoStarIsType #-}
import GHC.TypeLits
test :: Blah (x * y) -> z
as:
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE NoStarIsType #-}
import GHC.TypeLits
test :: Blah (x (*) y) -> z
which causes a kind error.
To Reproduce
As above
Expected behavior
As above
Environment
Occurs online:
Version 0.7.4.0, commit 6079787, using ghc-lib-parser 9.8.1.20231009
Huh, I can't reproduce this, neither on Ormolu Live nor with Ormolu 0.7.4.0 CLI 🤔
Oh weird, neither can I now. I added the NoStarIsType
after the fact, and that seems to be the fix here. The place I originally ran into this in a real codebase which has NoStarIsType
enabled globally, but there I get the reported behavior.
Let me look into another repro. Sorry for the confusion.
Explicitly adding NoStarIsType
to my module is confirmed to fix the problem. I don't know why it's not getting picked up from the cabal file, but that's good enough for me. Thanks!
No problem! Feel free to reopen or open another issue in case you find a reproducer for NoStarIsType
not getting picked up from the cabal file. (Just tried the simplest possible example, and it works at least there.)