Skip to content

GHC accepts program with incorrect layout

GHC accepts this program:

f x = case x of
     False -> do
    { return x; }

but according to the Haskell report the implicit { opened by the of should be closed before the explicit {.

The bug does on to say, in a comment:

Update: arguably this should be allowed.  The fix to the Haskell
layout rule to allow it is simple: in Section 9.3 in the rules that
govern the introduction of the <n> and {n} psuedo-tokens, we need
to prevent <n> being inserted before {.  This could be a simple
side-condition on the rule that introduces <n>.

I can't see a Haskell' ticket for this at first glance.

Trac metadata
Trac field Value
Version 6.6
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Parser)
Test case read027
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information