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
entitlement X
entitlement Y
entitlement mapping M {
X -> Insert
Y -> Remove
}
struct S {
access(M) var member: auth(M) &[Int]?
init() {
self.member = nil;
}
access(all) fun grantRemovePrivileges(param: auth(Insert) &[Int]): Void{
var selfRef = &self as auth(X) &S;
selfRef.member = param;
}
}
fun main(): Void {
var arr: [Int] = [123];
var arrRef = &arr as auth(Insert) &[Int];
let s = S()
s.grantRemovePrivileges(param: arrRef);
s.member?.removeLast() // Caught by checkMemberAccess type check
}
Expected Behavior
Should fail in the type checker
Steps To Reproduce
Create this as a test on stable cadence branch
Environment
- Cadence version: Stable Cadence
- Network:
The text was updated successfully, but these errors were encountered:
Current Behavior
Expected Behavior
Should fail in the type checker
Steps To Reproduce
Create this as a test on stable cadence branch
Environment
The text was updated successfully, but these errors were encountered: