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

Incorrect translation of polymorphic type #809

Open
PhucVH888 opened this issue May 29, 2017 · 0 comments · May be fixed by #815
Open

Incorrect translation of polymorphic type #809

PhucVH888 opened this issue May 29, 2017 · 0 comments · May be fixed by #815
Labels

Comments

@PhucVH888
Copy link
Contributor

The polymorphic type is translated incorrectly according to the following example test.enc.

active class Base[t]
  var v  : t

  def init(v : t) : unit
    this.v = v
  end

  def base() : t
    this.v
  end
end

active class Foo
  def foo[sharable ty](arg : Fut[ty]) : ty
    get(arg ~~> fun(x : ty) : ty => get((new Base[ty](x)) ! base()))
  end
end

active class Main
  def main() : unit
    val arg = (new Base[int](42)) ! base()
    println("{}", get((new Foo) ! foo[int](arg)))
  end
end

Here is the error message.

$ encorec --run test.enc
test_src/Foo.encore.c:208:38: error: use of undeclared identifier '_enc__type_ty'
  _enc__type_init__test_Base(_new_0, _enc__type_ty);
                                     ^
1 error generated.
 *** Compilation failed with exit code 1 ***
@PhucVH888 PhucVH888 added the bug label May 29, 2017
EliasC added a commit to EliasC/encore that referenced this issue Jun 1, 2017
This commit fixes a bug where closures did not properly capture
type parameters of methods. A test has been added.

Fixes parapluu#809.
@EliasC EliasC linked a pull request Jun 1, 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.

1 participant