-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
Description
Compiler version
main
Minimized code
import language.experimental.captureChecking
import language.experimental.separationChecking
import caps.{Mutable, freeze}
// A mutable ref and its immutable version
class Ref extends Mutable:
private var data: Int = 0
def get: Int = data
update def set(x: Int): Unit = data = x
def allocRef(): Ref^ = Ref()
type IRef = Ref^{}
def main(): Unit =
val a = allocRef()
val t1: IRef = a // should be error too, but ok
val t2: Ref^{} = a // errorOutput
Only the last line has an error, but not the IRef line.
Expectation
Both line should be an error. They should morally be equivalent.