dec.carbon 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. // TIP: To test this file alone, run:
  10. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/overloaded/dec.carbon
  11. // TIP: To dump output, run:
  12. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/overloaded/dec.carbon
  13. // This file was generated from unary_stmt.carbon.tmpl. Run make_tests.sh to regenerate.
  14. package User;
  15. class C {};
  16. impl C as Core.Dec {
  17. fn Op[addr self: C*]();
  18. }
  19. fn TestOp() {
  20. var c: C = {};
  21. //@dump-sem-ir-begin
  22. --c;
  23. //@dump-sem-ir-end
  24. }
  25. // CHECK:STDOUT: --- dec.carbon
  26. // CHECK:STDOUT:
  27. // CHECK:STDOUT: constants {
  28. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  29. // CHECK:STDOUT: %Dec.type: type = facet_type <@Dec> [concrete]
  30. // CHECK:STDOUT: %Op.type.633: type = fn_type @Op.1 [concrete]
  31. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  32. // CHECK:STDOUT: %Dec.impl_witness: <witness> = impl_witness file.%Dec.impl_witness_table [concrete]
  33. // CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete]
  34. // CHECK:STDOUT: %Op.type.9e0: type = fn_type @Op.loc21 [concrete]
  35. // CHECK:STDOUT: %Op.cf9: %Op.type.9e0 = struct_value () [concrete]
  36. // CHECK:STDOUT: %Dec.facet: %Dec.type = facet_value %C, (%Dec.impl_witness) [concrete]
  37. // CHECK:STDOUT: %.859: type = fn_type_with_self_type %Op.type.633, %Dec.facet [concrete]
  38. // CHECK:STDOUT: }
  39. // CHECK:STDOUT:
  40. // CHECK:STDOUT: imports {
  41. // CHECK:STDOUT: }
  42. // CHECK:STDOUT:
  43. // CHECK:STDOUT: fn @TestOp() {
  44. // CHECK:STDOUT: !entry:
  45. // CHECK:STDOUT: <elided>
  46. // CHECK:STDOUT: %c.ref: ref %C = name_ref c, %c
  47. // CHECK:STDOUT: %impl.elem0: %.859 = impl_witness_access constants.%Dec.impl_witness, element0 [concrete = constants.%Op.cf9]
  48. // CHECK:STDOUT: %bound_method.loc27: <bound method> = bound_method %c.ref, %impl.elem0
  49. // CHECK:STDOUT: %addr.loc27: %ptr.019 = addr_of %c.ref
  50. // CHECK:STDOUT: %Op.call: init %empty_tuple.type = call %bound_method.loc27(%addr.loc27)
  51. // CHECK:STDOUT: <elided>
  52. // CHECK:STDOUT: }
  53. // CHECK:STDOUT: