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
public type Foo : Deinitializable {
public memberwise init
public vardata:Intpublic subscript(_ arg: sink Int): Int {inout{
yield &data
}}}
public fun f(_ arg: sink Int){}public fun main(){varobj=Foo(data:1)letx=1;
lety=2;
// This should relocate x.
inout d = obj[x]&d =50;
// Can still print x. Why no error?
print(x);
// This should relocate y.
f(y);
// Error!
print(y);
}
I can use x after passing it to a subscript taking a sink parameter.
I cannot use y after passing it to a normal function taking a sink parameter.
The text was updated successfully, but these errors were encountered:
I can use x after passing it to a subscript taking a sink parameter.
I cannot use y after passing it to a normal function taking a sink parameter.
The text was updated successfully, but these errors were encountered: