bad_accounts.sol 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. contract BeingBuilt1 {
  2. @space(1024)
  3. @payer(clock)
  4. constructor(@seed bytes my_seed) {}
  5. }
  6. contract BeingBuilt2 {
  7. @space(1024)
  8. @payer(systemProgram)
  9. constructor(@seed bytes my_seed) {}
  10. }
  11. contract BeingBuilt3 {
  12. @space(1024)
  13. @payer(associatedTokenProgram)
  14. constructor(@seed bytes my_seed) {}
  15. }
  16. contract BeingBuilt4 {
  17. @space(1024)
  18. @payer(rent)
  19. constructor(@seed bytes my_seed) {}
  20. }
  21. contract BeingBuilt5 {
  22. @space(1024)
  23. @payer(tokenProgram)
  24. constructor(@seed bytes my_seed) {}
  25. }
  26. contract BeingBuilt6 {
  27. @space(1024)
  28. @payer(dataAccount)
  29. constructor(@seed bytes my_seed) {}
  30. }
  31. contract BeingBuilt7 {
  32. @payer(SysvarInstruction)
  33. constructor(@seed bytes my_seed, @space uint64 my_space) {}
  34. }
  35. contract BeingBuilt8 {
  36. @seed("pine_tree")
  37. @space(1024)
  38. @payer(solang)
  39. @payer(solang)
  40. constructor() {}
  41. function say_this(string text) public pure {
  42. print(text);
  43. }
  44. }
  45. contract OldAnnotationSyntax {
  46. @payer(my_account)
  47. @seed(my_seed)
  48. @space(my_space)
  49. @bump(my_bump)
  50. constructor(bytes my_seed, uint64 my_space, bytes1 my_bump) {}
  51. function my_func(@myNote uint64 a) public pure returns (uint64) {
  52. return a-2;
  53. }
  54. }
  55. // ---- Expect: diagnostics ----
  56. // error: 4:12-17: 'clock' is a reserved account name
  57. // error: 10:12-25: 'systemProgram' is a reserved account name
  58. // error: 16:12-34: 'associatedTokenProgram' is a reserved account name
  59. // error: 22:12-16: 'rent' is a reserved account name
  60. // error: 28:12-24: 'tokenProgram' is a reserved account name
  61. // error: 34:12-23: 'dataAccount' is a reserved account name
  62. // error: 39:12-29: 'SysvarInstruction' is a reserved account name
  63. // error: 47:12-18: account 'solang' already defined
  64. // note 46:5-19: previous definition
  65. // error: 58:11-18: '@seed' annotation on a constructor only accepts constant values
  66. // error: 59:12-20: '@space' annotation on a constructor only accepts constant values
  67. // error: 60:11-18: '@bump' annotation on a constructor only accepts constant values
  68. // error: 63:22-29: parameter annotations are only allowed in constructors