method.carbon 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  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/convert.carbon
  6. // EXTRA-ARGS: --dump-sem-ir-ranges=ignore
  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/interop/cpp/class/method.carbon
  11. // TIP: To dump output, run:
  12. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/class/method.carbon
  13. // --- object_param_qualifiers.h
  14. struct HasQualifiers {
  15. void plain();
  16. void const_this() const;
  17. void volatile_this() volatile;
  18. void ref_this() &;
  19. void const_ref_this() const&;
  20. void ref_ref_this() &&;
  21. void const_ref_ref_this() const&&;
  22. };
  23. // --- use_object_param_qualifiers.carbon
  24. library "[[@TEST_NAME]]";
  25. import Cpp library "object_param_qualifiers.h";
  26. fn F(v: Cpp.HasQualifiers, p: Cpp.HasQualifiers*) {
  27. //@dump-sem-ir-begin
  28. v.const_this();
  29. v.const_ref_this();
  30. p->plain();
  31. p->ref_this();
  32. p->const_this();
  33. p->const_ref_this();
  34. //@dump-sem-ir-end
  35. }
  36. // --- fail_bad_object_param_qualifiers_by_value.carbon
  37. library "[[@TEST_NAME]]";
  38. import Cpp library "object_param_qualifiers.h";
  39. fn Value(v: Cpp.HasQualifiers) {
  40. // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+5]]:3: error: `addr self` method cannot be invoked on a value [AddrSelfIsNonRef]
  41. // CHECK:STDERR: v.plain();
  42. // CHECK:STDERR: ^
  43. // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon: note: initializing function parameter [InCallToFunctionParam]
  44. // CHECK:STDERR:
  45. v.plain();
  46. // TODO: This should remain invalid once we support `volatile`.
  47. // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+12]]:3: error: semantics TODO: `Unsupported: qualified type: volatile struct HasQualifiers` [SemanticsTodo]
  48. // CHECK:STDERR: v.volatile_this();
  49. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  50. // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+9]]:3: note: in `Cpp` name lookup for `volatile_this` [InCppNameLookup]
  51. // CHECK:STDERR: v.volatile_this();
  52. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  53. // CHECK:STDERR:
  54. // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+5]]:3: error: `addr self` method cannot be invoked on a value [AddrSelfIsNonRef]
  55. // CHECK:STDERR: v.volatile_this();
  56. // CHECK:STDERR: ^
  57. // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon: note: initializing function parameter [InCallToFunctionParam]
  58. // CHECK:STDERR:
  59. v.volatile_this();
  60. // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+5]]:3: error: `addr self` method cannot be invoked on a value [AddrSelfIsNonRef]
  61. // CHECK:STDERR: v.ref_this();
  62. // CHECK:STDERR: ^
  63. // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon: note: initializing function parameter [InCallToFunctionParam]
  64. // CHECK:STDERR:
  65. v.ref_this();
  66. // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: object parameter type: struct HasQualifiers &&` [SemanticsTodo]
  67. // CHECK:STDERR: v.ref_ref_this();
  68. // CHECK:STDERR: ^~~~~~~~~~~~~~
  69. // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `ref_ref_this` [InCppNameLookup]
  70. // CHECK:STDERR: v.ref_ref_this();
  71. // CHECK:STDERR: ^~~~~~~~~~~~~~
  72. // CHECK:STDERR:
  73. v.ref_ref_this();
  74. // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: object parameter type: const struct HasQualifiers &&` [SemanticsTodo]
  75. // CHECK:STDERR: v.const_ref_ref_this();
  76. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
  77. // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `const_ref_ref_this` [InCppNameLookup]
  78. // CHECK:STDERR: v.const_ref_ref_this();
  79. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
  80. // CHECK:STDERR:
  81. v.const_ref_ref_this();
  82. }
  83. // --- fail_todo_bad_object_param_qualifiers_by_ref.carbon
  84. library "[[@TEST_NAME]]";
  85. import Cpp library "object_param_qualifiers.h";
  86. fn Ref(p: Cpp.HasQualifiers*) {
  87. // TODO: This should eventually be accepted if we support `volatile`.
  88. // CHECK:STDERR: fail_todo_bad_object_param_qualifiers_by_ref.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: qualified type: volatile struct HasQualifiers` [SemanticsTodo]
  89. // CHECK:STDERR: p->volatile_this();
  90. // CHECK:STDERR: ^~~~~~~~~~~~~~~~
  91. // CHECK:STDERR: fail_todo_bad_object_param_qualifiers_by_ref.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `volatile_this` [InCppNameLookup]
  92. // CHECK:STDERR: p->volatile_this();
  93. // CHECK:STDERR: ^~~~~~~~~~~~~~~~
  94. // CHECK:STDERR:
  95. p->volatile_this();
  96. }
  97. // --- fail_bad_object_param_qualifiers_ref_ref.carbon
  98. library "[[@TEST_NAME]]";
  99. import Cpp library "object_param_qualifiers.h";
  100. fn Ref(p: Cpp.HasQualifiers*) {
  101. // CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: object parameter type: struct HasQualifiers &&` [SemanticsTodo]
  102. // CHECK:STDERR: p->ref_ref_this();
  103. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  104. // CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `ref_ref_this` [InCppNameLookup]
  105. // CHECK:STDERR: p->ref_ref_this();
  106. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  107. // CHECK:STDERR:
  108. p->ref_ref_this();
  109. // CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: object parameter type: const struct HasQualifiers &&` [SemanticsTodo]
  110. // CHECK:STDERR: p->const_ref_ref_this();
  111. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
  112. // CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `const_ref_ref_this` [InCppNameLookup]
  113. // CHECK:STDERR: p->const_ref_ref_this();
  114. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
  115. // CHECK:STDERR:
  116. p->const_ref_ref_this();
  117. }
  118. // CHECK:STDOUT: --- use_object_param_qualifiers.carbon
  119. // CHECK:STDOUT:
  120. // CHECK:STDOUT: constants {
  121. // CHECK:STDOUT: %HasQualifiers: type = class_type @HasQualifiers [concrete]
  122. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  123. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  124. // CHECK:STDOUT: %pattern_type.e15: type = pattern_type %HasQualifiers [concrete]
  125. // CHECK:STDOUT: %ptr.ec3: type = ptr_type %HasQualifiers [concrete]
  126. // CHECK:STDOUT: %pattern_type.bc1: type = pattern_type %ptr.ec3 [concrete]
  127. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  128. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  129. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  130. // CHECK:STDOUT: %HasQualifiers.const_this.type: type = fn_type @HasQualifiers.const_this [concrete]
  131. // CHECK:STDOUT: %HasQualifiers.const_this: %HasQualifiers.const_this.type = struct_value () [concrete]
  132. // CHECK:STDOUT: %HasQualifiers.const_ref_this.type: type = fn_type @HasQualifiers.const_ref_this [concrete]
  133. // CHECK:STDOUT: %HasQualifiers.const_ref_this: %HasQualifiers.const_ref_this.type = struct_value () [concrete]
  134. // CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [concrete]
  135. // CHECK:STDOUT: %HasQualifiers.plain.type: type = fn_type @HasQualifiers.plain [concrete]
  136. // CHECK:STDOUT: %HasQualifiers.plain: %HasQualifiers.plain.type = struct_value () [concrete]
  137. // CHECK:STDOUT: %HasQualifiers.ref_this.type: type = fn_type @HasQualifiers.ref_this [concrete]
  138. // CHECK:STDOUT: %HasQualifiers.ref_this: %HasQualifiers.ref_this.type = struct_value () [concrete]
  139. // CHECK:STDOUT: }
  140. // CHECK:STDOUT:
  141. // CHECK:STDOUT: imports {
  142. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  143. // CHECK:STDOUT: import Core//prelude
  144. // CHECK:STDOUT: import Core//prelude/...
  145. // CHECK:STDOUT: }
  146. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  147. // CHECK:STDOUT: .HasQualifiers = %HasQualifiers.decl
  148. // CHECK:STDOUT: import Cpp//...
  149. // CHECK:STDOUT: }
  150. // CHECK:STDOUT: %HasQualifiers.decl: type = class_decl @HasQualifiers [concrete = constants.%HasQualifiers] {} {}
  151. // CHECK:STDOUT: %HasQualifiers.const_this.decl: %HasQualifiers.const_this.type = fn_decl @HasQualifiers.const_this [concrete = constants.%HasQualifiers.const_this] {
  152. // CHECK:STDOUT: %self.patt: %pattern_type.e15 = binding_pattern self [concrete]
  153. // CHECK:STDOUT: %self.param_patt: %pattern_type.e15 = value_param_pattern %self.patt, call_param0 [concrete]
  154. // CHECK:STDOUT: } {
  155. // CHECK:STDOUT: %self.param: %HasQualifiers = value_param call_param0
  156. // CHECK:STDOUT: %self: %HasQualifiers = bind_name self, %self.param
  157. // CHECK:STDOUT: }
  158. // CHECK:STDOUT: %HasQualifiers.const_ref_this.decl: %HasQualifiers.const_ref_this.type = fn_decl @HasQualifiers.const_ref_this [concrete = constants.%HasQualifiers.const_ref_this] {
  159. // CHECK:STDOUT: %self.patt: %pattern_type.e15 = binding_pattern self [concrete]
  160. // CHECK:STDOUT: %self.param_patt: %pattern_type.e15 = value_param_pattern %self.patt, call_param0 [concrete]
  161. // CHECK:STDOUT: } {
  162. // CHECK:STDOUT: %self.param: %HasQualifiers = value_param call_param0
  163. // CHECK:STDOUT: %self: %HasQualifiers = bind_name self, %self.param
  164. // CHECK:STDOUT: }
  165. // CHECK:STDOUT: %HasQualifiers.plain.decl: %HasQualifiers.plain.type = fn_decl @HasQualifiers.plain [concrete = constants.%HasQualifiers.plain] {
  166. // CHECK:STDOUT: %self.patt: %pattern_type.bc1 = binding_pattern self [concrete]
  167. // CHECK:STDOUT: %self.param_patt: %pattern_type.bc1 = value_param_pattern %self.patt, call_param0 [concrete]
  168. // CHECK:STDOUT: %.1: %pattern_type.f6d = addr_pattern %self.param_patt [concrete]
  169. // CHECK:STDOUT: } {
  170. // CHECK:STDOUT: %self.param: %ptr.ec3 = value_param call_param0
  171. // CHECK:STDOUT: %self: %ptr.ec3 = bind_name self, %self.param
  172. // CHECK:STDOUT: }
  173. // CHECK:STDOUT: %HasQualifiers.ref_this.decl: %HasQualifiers.ref_this.type = fn_decl @HasQualifiers.ref_this [concrete = constants.%HasQualifiers.ref_this] {
  174. // CHECK:STDOUT: %self.patt: %pattern_type.bc1 = binding_pattern self [concrete]
  175. // CHECK:STDOUT: %self.param_patt: %pattern_type.bc1 = value_param_pattern %self.patt, call_param0 [concrete]
  176. // CHECK:STDOUT: %.1: %pattern_type.f6d = addr_pattern %self.param_patt [concrete]
  177. // CHECK:STDOUT: } {
  178. // CHECK:STDOUT: %self.param: %ptr.ec3 = value_param call_param0
  179. // CHECK:STDOUT: %self: %ptr.ec3 = bind_name self, %self.param
  180. // CHECK:STDOUT: }
  181. // CHECK:STDOUT: }
  182. // CHECK:STDOUT:
  183. // CHECK:STDOUT: file {
  184. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  185. // CHECK:STDOUT: .Core = imports.%Core
  186. // CHECK:STDOUT: .Cpp = imports.%Cpp
  187. // CHECK:STDOUT: .F = %F.decl
  188. // CHECK:STDOUT: }
  189. // CHECK:STDOUT: %Core.import = import Core
  190. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  191. // CHECK:STDOUT: import Cpp "object_param_qualifiers.h"
  192. // CHECK:STDOUT: }
  193. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  194. // CHECK:STDOUT: %v.patt: %pattern_type.e15 = binding_pattern v [concrete]
  195. // CHECK:STDOUT: %v.param_patt: %pattern_type.e15 = value_param_pattern %v.patt, call_param0 [concrete]
  196. // CHECK:STDOUT: %p.patt: %pattern_type.bc1 = binding_pattern p [concrete]
  197. // CHECK:STDOUT: %p.param_patt: %pattern_type.bc1 = value_param_pattern %p.patt, call_param1 [concrete]
  198. // CHECK:STDOUT: } {
  199. // CHECK:STDOUT: %v.param: %HasQualifiers = value_param call_param0
  200. // CHECK:STDOUT: %.loc6_12: type = splice_block %HasQualifiers.ref.loc6_12 [concrete = constants.%HasQualifiers] {
  201. // CHECK:STDOUT: %Cpp.ref.loc6_9: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  202. // CHECK:STDOUT: %HasQualifiers.ref.loc6_12: type = name_ref HasQualifiers, imports.%HasQualifiers.decl [concrete = constants.%HasQualifiers]
  203. // CHECK:STDOUT: }
  204. // CHECK:STDOUT: %v: %HasQualifiers = bind_name v, %v.param
  205. // CHECK:STDOUT: %p.param: %ptr.ec3 = value_param call_param1
  206. // CHECK:STDOUT: %.loc6_48: type = splice_block %ptr [concrete = constants.%ptr.ec3] {
  207. // CHECK:STDOUT: %Cpp.ref.loc6_31: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  208. // CHECK:STDOUT: %HasQualifiers.ref.loc6_34: type = name_ref HasQualifiers, imports.%HasQualifiers.decl [concrete = constants.%HasQualifiers]
  209. // CHECK:STDOUT: %ptr: type = ptr_type %HasQualifiers.ref.loc6_34 [concrete = constants.%ptr.ec3]
  210. // CHECK:STDOUT: }
  211. // CHECK:STDOUT: %p: %ptr.ec3 = bind_name p, %p.param
  212. // CHECK:STDOUT: }
  213. // CHECK:STDOUT: }
  214. // CHECK:STDOUT:
  215. // CHECK:STDOUT: class @HasQualifiers {
  216. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  217. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  218. // CHECK:STDOUT: complete_type_witness = %complete_type
  219. // CHECK:STDOUT:
  220. // CHECK:STDOUT: !members:
  221. // CHECK:STDOUT: .Self = constants.%HasQualifiers
  222. // CHECK:STDOUT: .const_this = imports.%HasQualifiers.const_this.decl
  223. // CHECK:STDOUT: .const_ref_this = imports.%HasQualifiers.const_ref_this.decl
  224. // CHECK:STDOUT: .plain = imports.%HasQualifiers.plain.decl
  225. // CHECK:STDOUT: .ref_this = imports.%HasQualifiers.ref_this.decl
  226. // CHECK:STDOUT: import Cpp//...
  227. // CHECK:STDOUT: }
  228. // CHECK:STDOUT:
  229. // CHECK:STDOUT: fn @F(%v.param: %HasQualifiers, %p.param: %ptr.ec3) {
  230. // CHECK:STDOUT: !entry:
  231. // CHECK:STDOUT: %v.ref.loc8: %HasQualifiers = name_ref v, %v
  232. // CHECK:STDOUT: %const_this.ref.loc8: %HasQualifiers.const_this.type = name_ref const_this, imports.%HasQualifiers.const_this.decl [concrete = constants.%HasQualifiers.const_this]
  233. // CHECK:STDOUT: %HasQualifiers.const_this.bound.loc8: <bound method> = bound_method %v.ref.loc8, %const_this.ref.loc8
  234. // CHECK:STDOUT: %HasQualifiers.const_this.call.loc8: init %empty_tuple.type = call %HasQualifiers.const_this.bound.loc8(%v.ref.loc8)
  235. // CHECK:STDOUT: %v.ref.loc9: %HasQualifiers = name_ref v, %v
  236. // CHECK:STDOUT: %const_ref_this.ref.loc9: %HasQualifiers.const_ref_this.type = name_ref const_ref_this, imports.%HasQualifiers.const_ref_this.decl [concrete = constants.%HasQualifiers.const_ref_this]
  237. // CHECK:STDOUT: %HasQualifiers.const_ref_this.bound.loc9: <bound method> = bound_method %v.ref.loc9, %const_ref_this.ref.loc9
  238. // CHECK:STDOUT: %HasQualifiers.const_ref_this.call.loc9: init %empty_tuple.type = call %HasQualifiers.const_ref_this.bound.loc9(%v.ref.loc9)
  239. // CHECK:STDOUT: %p.ref.loc11: %ptr.ec3 = name_ref p, %p
  240. // CHECK:STDOUT: %.loc11: ref %HasQualifiers = deref %p.ref.loc11
  241. // CHECK:STDOUT: %plain.ref: %HasQualifiers.plain.type = name_ref plain, imports.%HasQualifiers.plain.decl [concrete = constants.%HasQualifiers.plain]
  242. // CHECK:STDOUT: %HasQualifiers.plain.bound: <bound method> = bound_method %.loc11, %plain.ref
  243. // CHECK:STDOUT: %addr.loc11: %ptr.ec3 = addr_of %.loc11
  244. // CHECK:STDOUT: %HasQualifiers.plain.call: init %empty_tuple.type = call %HasQualifiers.plain.bound(%addr.loc11)
  245. // CHECK:STDOUT: %p.ref.loc12: %ptr.ec3 = name_ref p, %p
  246. // CHECK:STDOUT: %.loc12: ref %HasQualifiers = deref %p.ref.loc12
  247. // CHECK:STDOUT: %ref_this.ref: %HasQualifiers.ref_this.type = name_ref ref_this, imports.%HasQualifiers.ref_this.decl [concrete = constants.%HasQualifiers.ref_this]
  248. // CHECK:STDOUT: %HasQualifiers.ref_this.bound: <bound method> = bound_method %.loc12, %ref_this.ref
  249. // CHECK:STDOUT: %addr.loc12: %ptr.ec3 = addr_of %.loc12
  250. // CHECK:STDOUT: %HasQualifiers.ref_this.call: init %empty_tuple.type = call %HasQualifiers.ref_this.bound(%addr.loc12)
  251. // CHECK:STDOUT: %p.ref.loc13: %ptr.ec3 = name_ref p, %p
  252. // CHECK:STDOUT: %.loc13_4.1: ref %HasQualifiers = deref %p.ref.loc13
  253. // CHECK:STDOUT: %const_this.ref.loc13: %HasQualifiers.const_this.type = name_ref const_this, imports.%HasQualifiers.const_this.decl [concrete = constants.%HasQualifiers.const_this]
  254. // CHECK:STDOUT: %HasQualifiers.const_this.bound.loc13: <bound method> = bound_method %.loc13_4.1, %const_this.ref.loc13
  255. // CHECK:STDOUT: %.loc13_4.2: %HasQualifiers = bind_value %.loc13_4.1
  256. // CHECK:STDOUT: %HasQualifiers.const_this.call.loc13: init %empty_tuple.type = call %HasQualifiers.const_this.bound.loc13(%.loc13_4.2)
  257. // CHECK:STDOUT: %p.ref.loc14: %ptr.ec3 = name_ref p, %p
  258. // CHECK:STDOUT: %.loc14_4.1: ref %HasQualifiers = deref %p.ref.loc14
  259. // CHECK:STDOUT: %const_ref_this.ref.loc14: %HasQualifiers.const_ref_this.type = name_ref const_ref_this, imports.%HasQualifiers.const_ref_this.decl [concrete = constants.%HasQualifiers.const_ref_this]
  260. // CHECK:STDOUT: %HasQualifiers.const_ref_this.bound.loc14: <bound method> = bound_method %.loc14_4.1, %const_ref_this.ref.loc14
  261. // CHECK:STDOUT: %.loc14_4.2: %HasQualifiers = bind_value %.loc14_4.1
  262. // CHECK:STDOUT: %HasQualifiers.const_ref_this.call.loc14: init %empty_tuple.type = call %HasQualifiers.const_ref_this.bound.loc14(%.loc14_4.2)
  263. // CHECK:STDOUT: return
  264. // CHECK:STDOUT: }
  265. // CHECK:STDOUT:
  266. // CHECK:STDOUT: fn @HasQualifiers.const_this(%self.param: %HasQualifiers);
  267. // CHECK:STDOUT:
  268. // CHECK:STDOUT: fn @HasQualifiers.const_ref_this(%self.param: %HasQualifiers);
  269. // CHECK:STDOUT:
  270. // CHECK:STDOUT: fn @HasQualifiers.plain(%self.param: %ptr.ec3);
  271. // CHECK:STDOUT:
  272. // CHECK:STDOUT: fn @HasQualifiers.ref_this(%self.param: %ptr.ec3);
  273. // CHECK:STDOUT:
  274. // CHECK:STDOUT: --- fail_bad_object_param_qualifiers_by_value.carbon
  275. // CHECK:STDOUT:
  276. // CHECK:STDOUT: constants {
  277. // CHECK:STDOUT: %HasQualifiers: type = class_type @HasQualifiers [concrete]
  278. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  279. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  280. // CHECK:STDOUT: %pattern_type.e15: type = pattern_type %HasQualifiers [concrete]
  281. // CHECK:STDOUT: %Value.type: type = fn_type @Value [concrete]
  282. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  283. // CHECK:STDOUT: %Value: %Value.type = struct_value () [concrete]
  284. // CHECK:STDOUT: %ptr.ec3: type = ptr_type %HasQualifiers [concrete]
  285. // CHECK:STDOUT: %pattern_type.bc1: type = pattern_type %ptr.ec3 [concrete]
  286. // CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [concrete]
  287. // CHECK:STDOUT: %HasQualifiers.plain.type: type = fn_type @HasQualifiers.plain [concrete]
  288. // CHECK:STDOUT: %HasQualifiers.plain: %HasQualifiers.plain.type = struct_value () [concrete]
  289. // CHECK:STDOUT: %HasQualifiers.volatile_this.type: type = fn_type @HasQualifiers.volatile_this [concrete]
  290. // CHECK:STDOUT: %HasQualifiers.volatile_this: %HasQualifiers.volatile_this.type = struct_value () [concrete]
  291. // CHECK:STDOUT: %HasQualifiers.ref_this.type: type = fn_type @HasQualifiers.ref_this [concrete]
  292. // CHECK:STDOUT: %HasQualifiers.ref_this: %HasQualifiers.ref_this.type = struct_value () [concrete]
  293. // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
  294. // CHECK:STDOUT: %T.as.Destroy.impl.Op.type.e02: type = fn_type @T.as.Destroy.impl.Op, @T.as.Destroy.impl(%HasQualifiers) [concrete]
  295. // CHECK:STDOUT: %T.as.Destroy.impl.Op.b7c: %T.as.Destroy.impl.Op.type.e02 = struct_value () [concrete]
  296. // CHECK:STDOUT: %T.as.Destroy.impl.Op.specific_fn: <specific function> = specific_function %T.as.Destroy.impl.Op.b7c, @T.as.Destroy.impl.Op(%HasQualifiers) [concrete]
  297. // CHECK:STDOUT: }
  298. // CHECK:STDOUT:
  299. // CHECK:STDOUT: imports {
  300. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  301. // CHECK:STDOUT: .Destroy = %Core.Destroy
  302. // CHECK:STDOUT: import Core//prelude
  303. // CHECK:STDOUT: import Core//prelude/...
  304. // CHECK:STDOUT: }
  305. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  306. // CHECK:STDOUT: .HasQualifiers = %HasQualifiers.decl
  307. // CHECK:STDOUT: import Cpp//...
  308. // CHECK:STDOUT: }
  309. // CHECK:STDOUT: %HasQualifiers.decl: type = class_decl @HasQualifiers [concrete = constants.%HasQualifiers] {} {}
  310. // CHECK:STDOUT: %HasQualifiers.plain.decl: %HasQualifiers.plain.type = fn_decl @HasQualifiers.plain [concrete = constants.%HasQualifiers.plain] {
  311. // CHECK:STDOUT: %self.patt: %pattern_type.bc1 = binding_pattern self [concrete]
  312. // CHECK:STDOUT: %self.param_patt: %pattern_type.bc1 = value_param_pattern %self.patt, call_param0 [concrete]
  313. // CHECK:STDOUT: %.1: %pattern_type.f6d = addr_pattern %self.param_patt [concrete]
  314. // CHECK:STDOUT: } {
  315. // CHECK:STDOUT: %self.param: %ptr.ec3 = value_param call_param0
  316. // CHECK:STDOUT: %self: %ptr.ec3 = bind_name self, %self.param
  317. // CHECK:STDOUT: }
  318. // CHECK:STDOUT: %HasQualifiers.volatile_this.decl: %HasQualifiers.volatile_this.type = fn_decl @HasQualifiers.volatile_this [concrete = constants.%HasQualifiers.volatile_this] {
  319. // CHECK:STDOUT: %self.patt: <error> = binding_pattern self [concrete]
  320. // CHECK:STDOUT: %self.param_patt: <error> = value_param_pattern %self.patt, call_param0 [concrete]
  321. // CHECK:STDOUT: %.1: %pattern_type.f6d = addr_pattern %self.param_patt [concrete]
  322. // CHECK:STDOUT: } {
  323. // CHECK:STDOUT: %self.param: <error> = value_param call_param0
  324. // CHECK:STDOUT: %self: <error> = bind_name self, %self.param
  325. // CHECK:STDOUT: }
  326. // CHECK:STDOUT: %HasQualifiers.ref_this.decl: %HasQualifiers.ref_this.type = fn_decl @HasQualifiers.ref_this [concrete = constants.%HasQualifiers.ref_this] {
  327. // CHECK:STDOUT: %self.patt: %pattern_type.bc1 = binding_pattern self [concrete]
  328. // CHECK:STDOUT: %self.param_patt: %pattern_type.bc1 = value_param_pattern %self.patt, call_param0 [concrete]
  329. // CHECK:STDOUT: %.1: %pattern_type.f6d = addr_pattern %self.param_patt [concrete]
  330. // CHECK:STDOUT: } {
  331. // CHECK:STDOUT: %self.param: %ptr.ec3 = value_param call_param0
  332. // CHECK:STDOUT: %self: %ptr.ec3 = bind_name self, %self.param
  333. // CHECK:STDOUT: }
  334. // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
  335. // CHECK:STDOUT: }
  336. // CHECK:STDOUT:
  337. // CHECK:STDOUT: file {
  338. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  339. // CHECK:STDOUT: .Core = imports.%Core
  340. // CHECK:STDOUT: .Cpp = imports.%Cpp
  341. // CHECK:STDOUT: .Value = %Value.decl
  342. // CHECK:STDOUT: }
  343. // CHECK:STDOUT: %Core.import = import Core
  344. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  345. // CHECK:STDOUT: import Cpp "object_param_qualifiers.h"
  346. // CHECK:STDOUT: }
  347. // CHECK:STDOUT: %Value.decl: %Value.type = fn_decl @Value [concrete = constants.%Value] {
  348. // CHECK:STDOUT: %v.patt: %pattern_type.e15 = binding_pattern v [concrete]
  349. // CHECK:STDOUT: %v.param_patt: %pattern_type.e15 = value_param_pattern %v.patt, call_param0 [concrete]
  350. // CHECK:STDOUT: } {
  351. // CHECK:STDOUT: %v.param: %HasQualifiers = value_param call_param0
  352. // CHECK:STDOUT: %.loc6: type = splice_block %HasQualifiers.ref [concrete = constants.%HasQualifiers] {
  353. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  354. // CHECK:STDOUT: %HasQualifiers.ref: type = name_ref HasQualifiers, imports.%HasQualifiers.decl [concrete = constants.%HasQualifiers]
  355. // CHECK:STDOUT: }
  356. // CHECK:STDOUT: %v: %HasQualifiers = bind_name v, %v.param
  357. // CHECK:STDOUT: }
  358. // CHECK:STDOUT: }
  359. // CHECK:STDOUT:
  360. // CHECK:STDOUT: class @HasQualifiers {
  361. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  362. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357]
  363. // CHECK:STDOUT: complete_type_witness = %complete_type
  364. // CHECK:STDOUT:
  365. // CHECK:STDOUT: !members:
  366. // CHECK:STDOUT: .Self = constants.%HasQualifiers
  367. // CHECK:STDOUT: .plain = imports.%HasQualifiers.plain.decl
  368. // CHECK:STDOUT: .volatile_this = imports.%HasQualifiers.volatile_this.decl
  369. // CHECK:STDOUT: .ref_this = imports.%HasQualifiers.ref_this.decl
  370. // CHECK:STDOUT: .ref_ref_this = <error>
  371. // CHECK:STDOUT: .const_ref_ref_this = <error>
  372. // CHECK:STDOUT: import Cpp//...
  373. // CHECK:STDOUT: }
  374. // CHECK:STDOUT:
  375. // CHECK:STDOUT: fn @Value(%v.param: %HasQualifiers) {
  376. // CHECK:STDOUT: !entry:
  377. // CHECK:STDOUT: %v.ref.loc12: %HasQualifiers = name_ref v, %v
  378. // CHECK:STDOUT: %plain.ref: %HasQualifiers.plain.type = name_ref plain, imports.%HasQualifiers.plain.decl [concrete = constants.%HasQualifiers.plain]
  379. // CHECK:STDOUT: %HasQualifiers.plain.bound: <bound method> = bound_method %v.ref.loc12, %plain.ref
  380. // CHECK:STDOUT: %.loc12: ref %HasQualifiers = temporary_storage
  381. // CHECK:STDOUT: %addr.loc12_3.1: %ptr.ec3 = addr_of %.loc12
  382. // CHECK:STDOUT: %HasQualifiers.plain.call: init %empty_tuple.type = call %HasQualifiers.plain.bound(%addr.loc12_3.1)
  383. // CHECK:STDOUT: %v.ref.loc27: %HasQualifiers = name_ref v, %v
  384. // CHECK:STDOUT: %volatile_this.ref: %HasQualifiers.volatile_this.type = name_ref volatile_this, imports.%HasQualifiers.volatile_this.decl [concrete = constants.%HasQualifiers.volatile_this]
  385. // CHECK:STDOUT: %HasQualifiers.volatile_this.bound: <bound method> = bound_method %v.ref.loc27, %volatile_this.ref
  386. // CHECK:STDOUT: %.loc27: ref %HasQualifiers = temporary_storage
  387. // CHECK:STDOUT: %addr.loc27_3.1: %ptr.ec3 = addr_of %.loc27
  388. // CHECK:STDOUT: %HasQualifiers.volatile_this.call: init %empty_tuple.type = call %HasQualifiers.volatile_this.bound(<error>)
  389. // CHECK:STDOUT: %v.ref.loc34: %HasQualifiers = name_ref v, %v
  390. // CHECK:STDOUT: %ref_this.ref: %HasQualifiers.ref_this.type = name_ref ref_this, imports.%HasQualifiers.ref_this.decl [concrete = constants.%HasQualifiers.ref_this]
  391. // CHECK:STDOUT: %HasQualifiers.ref_this.bound: <bound method> = bound_method %v.ref.loc34, %ref_this.ref
  392. // CHECK:STDOUT: %.loc34: ref %HasQualifiers = temporary_storage
  393. // CHECK:STDOUT: %addr.loc34_3.1: %ptr.ec3 = addr_of %.loc34
  394. // CHECK:STDOUT: %HasQualifiers.ref_this.call: init %empty_tuple.type = call %HasQualifiers.ref_this.bound(%addr.loc34_3.1)
  395. // CHECK:STDOUT: %v.ref.loc43: %HasQualifiers = name_ref v, %v
  396. // CHECK:STDOUT: %ref_ref_this.ref: <error> = name_ref ref_ref_this, <error> [concrete = <error>]
  397. // CHECK:STDOUT: %v.ref.loc52: %HasQualifiers = name_ref v, %v
  398. // CHECK:STDOUT: %const_ref_ref_this.ref: <error> = name_ref const_ref_ref_this, <error> [concrete = <error>]
  399. // CHECK:STDOUT: %T.as.Destroy.impl.Op.bound.loc34: <bound method> = bound_method %.loc34, constants.%T.as.Destroy.impl.Op.b7c
  400. // CHECK:STDOUT: %T.as.Destroy.impl.Op.specific_fn.1: <specific function> = specific_function constants.%T.as.Destroy.impl.Op.b7c, @T.as.Destroy.impl.Op(constants.%HasQualifiers) [concrete = constants.%T.as.Destroy.impl.Op.specific_fn]
  401. // CHECK:STDOUT: %bound_method.loc34: <bound method> = bound_method %.loc34, %T.as.Destroy.impl.Op.specific_fn.1
  402. // CHECK:STDOUT: %addr.loc34_3.2: %ptr.ec3 = addr_of %.loc34
  403. // CHECK:STDOUT: %T.as.Destroy.impl.Op.call.loc34: init %empty_tuple.type = call %bound_method.loc34(%addr.loc34_3.2)
  404. // CHECK:STDOUT: %T.as.Destroy.impl.Op.bound.loc27: <bound method> = bound_method %.loc27, constants.%T.as.Destroy.impl.Op.b7c
  405. // CHECK:STDOUT: %T.as.Destroy.impl.Op.specific_fn.2: <specific function> = specific_function constants.%T.as.Destroy.impl.Op.b7c, @T.as.Destroy.impl.Op(constants.%HasQualifiers) [concrete = constants.%T.as.Destroy.impl.Op.specific_fn]
  406. // CHECK:STDOUT: %bound_method.loc27: <bound method> = bound_method %.loc27, %T.as.Destroy.impl.Op.specific_fn.2
  407. // CHECK:STDOUT: %addr.loc27_3.2: %ptr.ec3 = addr_of %.loc27
  408. // CHECK:STDOUT: %T.as.Destroy.impl.Op.call.loc27: init %empty_tuple.type = call %bound_method.loc27(%addr.loc27_3.2)
  409. // CHECK:STDOUT: %T.as.Destroy.impl.Op.bound.loc12: <bound method> = bound_method %.loc12, constants.%T.as.Destroy.impl.Op.b7c
  410. // CHECK:STDOUT: %T.as.Destroy.impl.Op.specific_fn.3: <specific function> = specific_function constants.%T.as.Destroy.impl.Op.b7c, @T.as.Destroy.impl.Op(constants.%HasQualifiers) [concrete = constants.%T.as.Destroy.impl.Op.specific_fn]
  411. // CHECK:STDOUT: %bound_method.loc12: <bound method> = bound_method %.loc12, %T.as.Destroy.impl.Op.specific_fn.3
  412. // CHECK:STDOUT: %addr.loc12_3.2: %ptr.ec3 = addr_of %.loc12
  413. // CHECK:STDOUT: %T.as.Destroy.impl.Op.call.loc12: init %empty_tuple.type = call %bound_method.loc12(%addr.loc12_3.2)
  414. // CHECK:STDOUT: return
  415. // CHECK:STDOUT: }
  416. // CHECK:STDOUT:
  417. // CHECK:STDOUT: fn @HasQualifiers.plain(%self.param: %ptr.ec3);
  418. // CHECK:STDOUT:
  419. // CHECK:STDOUT: fn @HasQualifiers.volatile_this(%self.param: <error>);
  420. // CHECK:STDOUT:
  421. // CHECK:STDOUT: fn @HasQualifiers.ref_this(%self.param: %ptr.ec3);
  422. // CHECK:STDOUT:
  423. // CHECK:STDOUT: --- fail_todo_bad_object_param_qualifiers_by_ref.carbon
  424. // CHECK:STDOUT:
  425. // CHECK:STDOUT: constants {
  426. // CHECK:STDOUT: %HasQualifiers: type = class_type @HasQualifiers [concrete]
  427. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  428. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  429. // CHECK:STDOUT: %ptr.ec3: type = ptr_type %HasQualifiers [concrete]
  430. // CHECK:STDOUT: %pattern_type.bc1: type = pattern_type %ptr.ec3 [concrete]
  431. // CHECK:STDOUT: %Ref.type: type = fn_type @Ref [concrete]
  432. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  433. // CHECK:STDOUT: %Ref: %Ref.type = struct_value () [concrete]
  434. // CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [concrete]
  435. // CHECK:STDOUT: %HasQualifiers.volatile_this.type: type = fn_type @HasQualifiers.volatile_this [concrete]
  436. // CHECK:STDOUT: %HasQualifiers.volatile_this: %HasQualifiers.volatile_this.type = struct_value () [concrete]
  437. // CHECK:STDOUT: }
  438. // CHECK:STDOUT:
  439. // CHECK:STDOUT: imports {
  440. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  441. // CHECK:STDOUT: import Core//prelude
  442. // CHECK:STDOUT: import Core//prelude/...
  443. // CHECK:STDOUT: }
  444. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  445. // CHECK:STDOUT: .HasQualifiers = %HasQualifiers.decl
  446. // CHECK:STDOUT: import Cpp//...
  447. // CHECK:STDOUT: }
  448. // CHECK:STDOUT: %HasQualifiers.decl: type = class_decl @HasQualifiers [concrete = constants.%HasQualifiers] {} {}
  449. // CHECK:STDOUT: %HasQualifiers.volatile_this.decl: %HasQualifiers.volatile_this.type = fn_decl @HasQualifiers.volatile_this [concrete = constants.%HasQualifiers.volatile_this] {
  450. // CHECK:STDOUT: %self.patt: <error> = binding_pattern self [concrete]
  451. // CHECK:STDOUT: %self.param_patt: <error> = value_param_pattern %self.patt, call_param0 [concrete]
  452. // CHECK:STDOUT: %.1: %pattern_type.f6d = addr_pattern %self.param_patt [concrete]
  453. // CHECK:STDOUT: } {
  454. // CHECK:STDOUT: %self.param: <error> = value_param call_param0
  455. // CHECK:STDOUT: %self: <error> = bind_name self, %self.param
  456. // CHECK:STDOUT: }
  457. // CHECK:STDOUT: }
  458. // CHECK:STDOUT:
  459. // CHECK:STDOUT: file {
  460. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  461. // CHECK:STDOUT: .Core = imports.%Core
  462. // CHECK:STDOUT: .Cpp = imports.%Cpp
  463. // CHECK:STDOUT: .Ref = %Ref.decl
  464. // CHECK:STDOUT: }
  465. // CHECK:STDOUT: %Core.import = import Core
  466. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  467. // CHECK:STDOUT: import Cpp "object_param_qualifiers.h"
  468. // CHECK:STDOUT: }
  469. // CHECK:STDOUT: %Ref.decl: %Ref.type = fn_decl @Ref [concrete = constants.%Ref] {
  470. // CHECK:STDOUT: %p.patt: %pattern_type.bc1 = binding_pattern p [concrete]
  471. // CHECK:STDOUT: %p.param_patt: %pattern_type.bc1 = value_param_pattern %p.patt, call_param0 [concrete]
  472. // CHECK:STDOUT: } {
  473. // CHECK:STDOUT: %p.param: %ptr.ec3 = value_param call_param0
  474. // CHECK:STDOUT: %.loc6: type = splice_block %ptr [concrete = constants.%ptr.ec3] {
  475. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  476. // CHECK:STDOUT: %HasQualifiers.ref: type = name_ref HasQualifiers, imports.%HasQualifiers.decl [concrete = constants.%HasQualifiers]
  477. // CHECK:STDOUT: %ptr: type = ptr_type %HasQualifiers.ref [concrete = constants.%ptr.ec3]
  478. // CHECK:STDOUT: }
  479. // CHECK:STDOUT: %p: %ptr.ec3 = bind_name p, %p.param
  480. // CHECK:STDOUT: }
  481. // CHECK:STDOUT: }
  482. // CHECK:STDOUT:
  483. // CHECK:STDOUT: class @HasQualifiers {
  484. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  485. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  486. // CHECK:STDOUT: complete_type_witness = %complete_type
  487. // CHECK:STDOUT:
  488. // CHECK:STDOUT: !members:
  489. // CHECK:STDOUT: .Self = constants.%HasQualifiers
  490. // CHECK:STDOUT: .volatile_this = imports.%HasQualifiers.volatile_this.decl
  491. // CHECK:STDOUT: import Cpp//...
  492. // CHECK:STDOUT: }
  493. // CHECK:STDOUT:
  494. // CHECK:STDOUT: fn @Ref(%p.param: %ptr.ec3) {
  495. // CHECK:STDOUT: !entry:
  496. // CHECK:STDOUT: %p.ref: %ptr.ec3 = name_ref p, %p
  497. // CHECK:STDOUT: %.loc15: ref %HasQualifiers = deref %p.ref
  498. // CHECK:STDOUT: %volatile_this.ref: %HasQualifiers.volatile_this.type = name_ref volatile_this, imports.%HasQualifiers.volatile_this.decl [concrete = constants.%HasQualifiers.volatile_this]
  499. // CHECK:STDOUT: %HasQualifiers.volatile_this.bound: <bound method> = bound_method %.loc15, %volatile_this.ref
  500. // CHECK:STDOUT: %addr: %ptr.ec3 = addr_of %.loc15
  501. // CHECK:STDOUT: %HasQualifiers.volatile_this.call: init %empty_tuple.type = call %HasQualifiers.volatile_this.bound(<error>)
  502. // CHECK:STDOUT: return
  503. // CHECK:STDOUT: }
  504. // CHECK:STDOUT:
  505. // CHECK:STDOUT: fn @HasQualifiers.volatile_this(%self.param: <error>);
  506. // CHECK:STDOUT:
  507. // CHECK:STDOUT: --- fail_bad_object_param_qualifiers_ref_ref.carbon
  508. // CHECK:STDOUT:
  509. // CHECK:STDOUT: constants {
  510. // CHECK:STDOUT: %HasQualifiers: type = class_type @HasQualifiers [concrete]
  511. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  512. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  513. // CHECK:STDOUT: %ptr.ec3: type = ptr_type %HasQualifiers [concrete]
  514. // CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.ec3 [concrete]
  515. // CHECK:STDOUT: %Ref.type: type = fn_type @Ref [concrete]
  516. // CHECK:STDOUT: %Ref: %Ref.type = struct_value () [concrete]
  517. // CHECK:STDOUT: }
  518. // CHECK:STDOUT:
  519. // CHECK:STDOUT: imports {
  520. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  521. // CHECK:STDOUT: import Core//prelude
  522. // CHECK:STDOUT: import Core//prelude/...
  523. // CHECK:STDOUT: }
  524. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  525. // CHECK:STDOUT: .HasQualifiers = %HasQualifiers.decl
  526. // CHECK:STDOUT: import Cpp//...
  527. // CHECK:STDOUT: }
  528. // CHECK:STDOUT: %HasQualifiers.decl: type = class_decl @HasQualifiers [concrete = constants.%HasQualifiers] {} {}
  529. // CHECK:STDOUT: }
  530. // CHECK:STDOUT:
  531. // CHECK:STDOUT: file {
  532. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  533. // CHECK:STDOUT: .Core = imports.%Core
  534. // CHECK:STDOUT: .Cpp = imports.%Cpp
  535. // CHECK:STDOUT: .Ref = %Ref.decl
  536. // CHECK:STDOUT: }
  537. // CHECK:STDOUT: %Core.import = import Core
  538. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  539. // CHECK:STDOUT: import Cpp "object_param_qualifiers.h"
  540. // CHECK:STDOUT: }
  541. // CHECK:STDOUT: %Ref.decl: %Ref.type = fn_decl @Ref [concrete = constants.%Ref] {
  542. // CHECK:STDOUT: %p.patt: %pattern_type = binding_pattern p [concrete]
  543. // CHECK:STDOUT: %p.param_patt: %pattern_type = value_param_pattern %p.patt, call_param0 [concrete]
  544. // CHECK:STDOUT: } {
  545. // CHECK:STDOUT: %p.param: %ptr.ec3 = value_param call_param0
  546. // CHECK:STDOUT: %.loc6: type = splice_block %ptr [concrete = constants.%ptr.ec3] {
  547. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  548. // CHECK:STDOUT: %HasQualifiers.ref: type = name_ref HasQualifiers, imports.%HasQualifiers.decl [concrete = constants.%HasQualifiers]
  549. // CHECK:STDOUT: %ptr: type = ptr_type %HasQualifiers.ref [concrete = constants.%ptr.ec3]
  550. // CHECK:STDOUT: }
  551. // CHECK:STDOUT: %p: %ptr.ec3 = bind_name p, %p.param
  552. // CHECK:STDOUT: }
  553. // CHECK:STDOUT: }
  554. // CHECK:STDOUT:
  555. // CHECK:STDOUT: class @HasQualifiers {
  556. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  557. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  558. // CHECK:STDOUT: complete_type_witness = %complete_type
  559. // CHECK:STDOUT:
  560. // CHECK:STDOUT: !members:
  561. // CHECK:STDOUT: .Self = constants.%HasQualifiers
  562. // CHECK:STDOUT: .ref_ref_this = <error>
  563. // CHECK:STDOUT: .const_ref_ref_this = <error>
  564. // CHECK:STDOUT: import Cpp//...
  565. // CHECK:STDOUT: }
  566. // CHECK:STDOUT:
  567. // CHECK:STDOUT: fn @Ref(%p.param: %ptr.ec3) {
  568. // CHECK:STDOUT: !entry:
  569. // CHECK:STDOUT: %p.ref.loc14: %ptr.ec3 = name_ref p, %p
  570. // CHECK:STDOUT: %.loc14: ref %HasQualifiers = deref %p.ref.loc14
  571. // CHECK:STDOUT: %ref_ref_this.ref: <error> = name_ref ref_ref_this, <error> [concrete = <error>]
  572. // CHECK:STDOUT: %p.ref.loc23: %ptr.ec3 = name_ref p, %p
  573. // CHECK:STDOUT: %.loc23: ref %HasQualifiers = deref %p.ref.loc23
  574. // CHECK:STDOUT: %const_ref_ref_this.ref: <error> = name_ref const_ref_ref_this, <error> [concrete = <error>]
  575. // CHECK:STDOUT: return
  576. // CHECK:STDOUT: }
  577. // CHECK:STDOUT: