cadence
cadence copied to clipboard
Built-in members are not allowed on AnyResource/AnyStruct
Current Behavior
Consider the below program:
pub fun main(r: @AnyResource) {
r.uuid
destroy r
}
This reports an error saying
value of type `AnyResource` has no member `uuid`
Expected Behavior
Built-in members, e.g. fields such as uuid, should be allowed on the type AnyResource/AnyStruct.
Steps To Reproduce
See above
Environment
- Cadence version: Current master, and previously released versions
related: AnyResource should also have uuid
Maybe we can address this as part of the interface set FLIP: https://github.com/onflow/flips/pull/85#issuecomment-1570876248
Can be added after 1.0 release
updated from removed restricted types, which got removed in Cadence 1.0 and where the replacement, empty intersection types, are not allowed, to just the AnyResource/AnyStruct types.
I think better solution here is a native UniquelyIdentifieable interface or something similar (for uuid case)