convert.carbon 541 B

1234567891011121314151617181920212223242526
  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. // NOAUTOUPDATE
  6. package ExplorerTest api;
  7. class A {}
  8. impl A as ImplicitAs(i32) {
  9. fn Convert[self: Self]() -> i32 { return 1; }
  10. }
  11. fn Main() -> i32 {
  12. var a: A = {};
  13. match ((a, a)) {
  14. case (0, n: i32) => { return 1; }
  15. case (n: i32, 0) => { return 1; }
  16. case (1, 1) => { return 0; }
  17. }
  18. return 1;
  19. }
  20. // CHECK:STDOUT: result: 0