pass_equal_to_rewrite.carbon 704 B

1234567891011121314151617181920212223242526272829303132
  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: result: 1
  7. package ExplorerTest api;
  8. interface Container {
  9. let Element:! type;
  10. fn Front[self: Self]() -> Element;
  11. }
  12. fn A[T:! Container where .Element = i32](x: T) -> T.Element {
  13. return x.Front();
  14. }
  15. fn B[T:! Container where .Element == i32](x: T) -> T.Element {
  16. return A(x);
  17. }
  18. external impl (i32, i32) as Container where .Element = i32 {
  19. fn Front[self: Self]() -> i32 {
  20. let (a: i32, b: i32) = self;
  21. return a;
  22. }
  23. }
  24. fn Main() -> i32 {
  25. return B((1, 2));
  26. }