hades-lang icon indicating copy to clipboard operation
hades-lang copied to clipboard

Expression body closures with void return type cause compiler crash

Open dhruvrajvanshi opened this issue 3 years ago • 0 comments

def nothing(): Void {}
def call(f: || -> Void): Void {
  f()
}

def main(): Void {
   call(|| nothing())
}

As a workaround, you can wrap the body in braces to force the compiler to treat it correctly

call(|| { nothing(); })

dhruvrajvanshi avatar Jul 13 '21 09:07 dhruvrajvanshi