dont_call_in_method.carbon 673 B

123456789101112131415161718192021222324252627282930313233343536
  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. package ExplorerTest api;
  7. class B{
  8. var n : i32;
  9. }
  10. class A{
  11. destructor[self: Self]{
  12. Print("DESTRUCTOR A {0}",self.n);
  13. }
  14. fn test[self: Self](){
  15. Print("TEST");
  16. }
  17. fn test2[self: Self](){
  18. Print("TEST 2");
  19. }
  20. var n: i32;
  21. }
  22. fn Main() -> i32 {
  23. var a: A = {.n = 1 };
  24. a.test();
  25. a.test2();
  26. return 1;
  27. }
  28. // CHECK:STDOUT: TEST
  29. // CHECK:STDOUT: TEST 2
  30. // CHECK:STDOUT: DESTRUCTOR A 1
  31. // CHECK:STDOUT: result: 1