parapluu / encore

The Encore compiler.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect translation of polymorphic type

PhucVH888 opened this issue · comments

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 ***