binary_op.carbon.tmpl 725 B

1234567891011121314151617181920212223242526272829303132333435
  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. // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
  6. // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
  7. //
  8. // AUTOUPDATE
  9. HEADER
  10. package User;
  11. class C {};
  12. impl C as Core.INTERFACEWith(C) where .Result = C {
  13. fn Op[self: C](other: C) -> C {
  14. return {};
  15. }
  16. }
  17. impl C as Core.INTERFACEAssignWith(C) {
  18. fn Op[addr self: C*](other: C) {}
  19. }
  20. fn TestOp(a: C, b: C) -> C {
  21. //@dump-sem-ir-begin
  22. return a OP b;
  23. //@dump-sem-ir-end
  24. }
  25. fn TestAssign(a: C*, b: C) {
  26. //@dump-sem-ir-begin
  27. *a OP= b;
  28. //@dump-sem-ir-end
  29. }