evincarofautumn/kitten — pull request #125 by evincarofautumn (2014-06-15 01:40:18+00:00)
Title: Simplify the layout rule.

Previously, this:

foo : bar : baz
quux
blerg

Would desugar to this:

foo { bar { baz
quux
blerg } }

Because `blerg` is indented more than the line containing the most
recent colon, following `bar`. The desugaring that the programmer
almost certainly intended is this:

foo { bar { baz
quux }
blerg }

This caused problems with line-wrapped conditionals:

if (this
|| that
|| anotherThing):
take
some
actions

Here, `take some actions` would be interpreted as falling *outside* the
block, because they are indented less than the layout line, which begins
with `||` and not `if`.

The new, simplified layout rule is that all tokens in a layout block
must be indented at least as far as the first token in the block. That
leads naturally to a few legal styles:

// Colons at the end of the line with consistent spacing.
if (quux):
foo
if (bar):
baz
frob
blerg

// Colons before a block with consistent spacing.
if (quux)
: foo
if (bar)
: baz
frob
blerg

// Colons before an aligned block with inconsistent spacing.
if (quux): foo
if (bar): baz
frob
blerg