Layout rules: missing implicit semicolon after `if`
The following program is accepted by GHC, where the condition
True starts at the same column as the
-- GHC accepts, but this looks BAD according to the standard main = do if True then print () else print ()
For comparison, the following variants aren't accepted, where instead we try to do the same thing with either of the
-- BAD, and GHC rightly rejects it main = do if True then print () else print () -- BAD, and GHC rightly rejects it main = do if True then print () else print ()
Lexer.x, it might be that the logic around
MultiWayIf layout is silencing the implicit semicolon insertion, but I'm not entirely sure.
Link to the relevant section of Haskell 2010 (the layout algorithm): https://www.haskell.org/onlinereport/haskell2010/haskellch10.html#x17-17500010.3
Is that actually valid? Or is this a known bug? (I couldn't find any mention of it in a cursory search.)
- GHC version used: GHC 8.6. Read the code on master.