Fixed bug where implicit semicolon insertion was messing up returns.

Rebased with:
Fixed indentation for #2052 fix
Added new line at end of file to ticket2052 unit test