-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Labels
Description
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