account_info.sol 975 B

1234567891011121314151617181920212223242526272829303132
  1. import "solana";
  2. contract c {
  3. AccountInfo ai;
  4. function pub(AccountInfo) public returns (AccountInfo) {}
  5. function f() public {
  6. AccountInfo ai;
  7. ai = AccountInfo({lamports: "x"});
  8. }
  9. function f2() public {
  10. AccountInfo ai;
  11. ai = AccountInfo(1);
  12. }
  13. function notpub(AccountInfo) private returns (AccountInfo) {
  14. AccountInfo ai = tx.accounts[1];
  15. ai.key = address(this);
  16. ai.lamports += 1;
  17. return tx.accounts[1];
  18. }
  19. }
  20. // ---- Expect: diagnostics ----
  21. // error: 4:2-13: variable cannot be of builtin type 'struct AccountInfo'
  22. // error: 6:15-26: parameter of type 'struct AccountInfo' not alowed in public or external functions
  23. // error: 6:44-55: return type 'struct AccountInfo' not allowed in public or external functions
  24. // error: 10:8-36: builtin struct 'AccountInfo' cannot be created using struct literal
  25. // error: 15:8-22: builtin struct 'AccountInfo' cannot be created using struct literal
  26. // error: 20:6-9: struct 'AccountInfo' field 'key' is readonly