Open
Description
example : IO Unit := do
try
for _ in [1] do
try
pure ()
catch _ => unreachable!
catch _ => unreachable!
produces the error invalid `try`, it must have a `catch` or `finally`
, tested on 4.20.0-rc2
. It appears the issue is that it is parsed as a try
-catch
-catch
block like this:
example : IO Unit := do
try
for _ in [1] do
try
pure ()
catch _ => unreachable!
catch _ => unreachable!
and so the first try
is left orphaned. (Are multiple catch blocks like this actually used in practice? I would not expect this to be legal even without the weird indentation.)