Skip to content

Update methods can call consume methods #24462

@natsukagami

Description

@natsukagami

Compiler version

main

Minimized code

import language.experimental.captureChecking
import language.experimental.separationChecking

import caps.*

class B extends Mutable:
  var x = 0

class A extends Mutable:
  val b = B()
  consume def f(): B^ = this.b

  update def g() =
    val t = f() // should error, but doesn't
    t

def par(x: B^, y: B^) = println("boom!")

@main def main() =
  val a = A()
  val x = a.g()
  val y = a.g()
  par(x, y)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions