//# print-bytecode --input=module // Borrowing a global of a type defined as part of the same module is valid. module 0x1d6.M { import 0x1.signer; struct T has key { b: bool } f(account: signer) { let r: &Self.T; label b0: r = borrow_global(signer.address_of(&account)); return; } } //# publish module 0x2d6.M { struct T has key { b: bool } } //# print-bytecode --input=module // Borrowing a global of a type defined in a different module is invalid. module 0x2d6.N { import 0x1.signer; import 0x2d6.M; f(account: signer) { let r: &M.T; label b0: r = borrow_global(signer.address_of(&account)); return; } } //# print-bytecode // Borrowing a global of a struct type within a script (which cannot define its own struct types) // is invalid. import 0x1.signer; import 0x2d6.M; main(account: signer) { let r: &M.T; label b0: r = borrow_global(signer.address_of(&account)); return; }