You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importlanguage.experimental.captureCheckingimportcaps.*classCell[T](init: T) extendsMutable:privatevar_data:T= init
defget:T= _data
mut defset(x: T) = _data = x
defswap[T](a: Cell[T]^, b: Cell[T]^):Unit=valt:T= a.get
a.set(b.get)
b.set(t)
deftest1(a: Cell[Int]^):Unit=
swap(a, a) // errorvalb= a
swap(a, b) // error
a matchcasea0: Cell[Int]^=>
swap(a, a0) // should be error, but ok
Output
Two errors are emitted but the last line passed.
Expectation
The last line should be an error, since a and a0 are really aliases.
The text was updated successfully, but these errors were encountered:
Compiler version
main
Minimized code
Output
Two errors are emitted but the last line passed.
Expectation
The last line should be an error, since
a
anda0
are really aliases.The text was updated successfully, but these errors were encountered: