dfc5226bc4e3ae2646b9ebc457e2d8b5c0af703f 561 B

12345678910111213141516171819202122232425
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // AUTOUPDATE
  6. // CHECK:STDOUT: DESTRUCTOR A 0
  7. // CHECK:STDOUT: DESTRUCTOR A 1
  8. // CHECK:STDOUT: DESTRUCTOR A 2
  9. // CHECK:STDOUT: result: 1
  10. package ExplorerTest api;
  11. class A{
  12. destructor[self: Self]{
  13. Print("DESTRUCTOR A {0}",self.n);
  14. }
  15. var n: i32;
  16. }
  17. fn Main() -> i32 {
  18. var a1: A = {.n = 2};
  19. var a: [A; 2] = ({.n = 1},{.n = 0});
  20. return 1;
  21. }