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