Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward cannot be used in a method that also uses return #845

Closed
kikofernandez opened this issue Jul 4, 2017 · 1 comment
Closed

Forward cannot be used in a method that also uses return #845

kikofernandez opened this issue Jul 4, 2017 · 1 comment

Comments

@kikofernandez
Copy link
Contributor

It seems like forward cannot be used in a method that also uses return. This example compiles to C raising an error:

active class B
  var x: String = "hola"
  def test(): (int, int)
    (3, 4)
  end
end

active class Main
  def test(): (int, int)
    val b = new B
    if true then
      return (3, 4)
    else
      forward(b!test())
    end
  end

  def main(): unit
    ()
  end
end

Error message:

encorec test.enc
test_src/Main.encore.c:264:5: error: void function '_enc__method__test_Main_test_async' should not return a value
      [-Wreturn-type]
    return _tuple_6;
    ^      ~~~~~~~~
1 error generated.
 *** Compilation failed with exit code 1 ***

@supercooldave
Copy link

Duplicate of #816.
If something written here is new, add it to the previous issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants