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

Restrictive forward's type #792

Open
PhucVH888 opened this issue May 3, 2017 · 1 comment · May be fixed by #846
Open

Restrictive forward's type #792

PhucVH888 opened this issue May 3, 2017 · 1 comment · May be fixed by #846
Labels

Comments

@PhucVH888
Copy link
Contributor

The forward's type is too restrictive. When using nested forward in the following example, an extra variable arg1 is necessary for passing the typecheck. A better way is to relax the forward's type so that no extra variable is used to do the trick.

active class Base
  def base() : int
    42
  end
end

active class Bar
  def bar() : int
    24
  end
end

active class Foo
  def foo(b : bool) : int
    val arg1 = (new Bar) ! bar()
    val arg2 = (new Base) ! base()
    forward(if b then
              forward(arg1)
              arg1 -- required to make typecheck
            else
              arg2
            end)
  end
end

active class Main
  def main() : unit
    println("{}", get((new Foo) ! foo(true)))
    println("{}", get((new Foo) ! foo(false)))
  end
end
@supercooldave
Copy link

It seems that return and abort() have the same problem.

@supercooldave supercooldave linked a pull request Jul 10, 2017 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants