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