Skip to content

keyword return and consume do not play along well #835

@kikofernandez

Description

@kikofernandez

Given a linear reference:

  • if I return the linear reference without consuming it, the typechecker complains
  • if I return the linear reference and consume it, the typechecker complains
  • if I just consume the reference and have it as the last expression in the method, everything is good

The following example shows these cases:

linear class B
  var x: String = "hola"
end

active class Main
  def test(): B
    new B
  end

  def main(): B
    var b = this.test()
    -- return b  --complains
    -- return consume b -- complains
    consume b -- OK
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions