Skip to content

sharable mode annotation might be broken for arrow types #858

@kikofernandez

Description

@kikofernandez

In the current development version of Encore, I keep getting the error:

"test.enc" (line 13, column 5)
Cannot use linear type 'X' as type argument. Type parameter 'a' requires the type to have sharable mode
In expression: 
  appl(fun (var y : X) => consume y, consume x)

For something that I think should typecheck. The minimum code to reproduce this errors is given below:

import ParT.ParT

fun appl[sharable a, sharable b](fn : a -> b, x: a): b
  fn(consume x)
end

linear class X
end

active class Main
  def main(): unit
    var x = new X
    appl(fun (var y: X) => consume y, consume x)
  end
end

Am I doing something wrong or did I find a bug?

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions