encore icon indicating copy to clipboard operation
encore copied to clipboard

Deep error when mixing forward and return

Open TobiasWrigstad opened this issue 7 years ago • 0 comments

When compiled, the following program

active class Main
  def foo(b : bool) : int
    if b then
      forward (this ! foo(b))
    else
      return this.foo(b)
    end
  end
  def main() : unit
    this.foo(false)
  end
end

generates an error at the C compiler stage:

mini_src/Main.encore.c:290:5: error: void function '_enc__method__mini_Main_foo_async' should not
      return a value [-Wreturn-type]
    return _sync_method_call_3;
    ^      ~~~~~~~~~~~~~~~~~~~
1 error generated.
 *** Compilation failed with exit code 1 ***

TobiasWrigstad avatar Jun 05 '17 19:06 TobiasWrigstad