member_inline.carbon 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  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. // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
  7. // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
  8. //
  9. // AUTOUPDATE
  10. // TIP: To test this file alone, run:
  11. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/generic/member_inline.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/generic/member_inline.carbon
  14. // --- member_inline.carbon
  15. library "member_inline.carbon";
  16. class Class(T:! type) {
  17. fn F(n: T) -> T {
  18. return n;
  19. }
  20. fn G[self: Self]() -> T {
  21. return self.n;
  22. }
  23. var n: T;
  24. }
  25. // --- fail_member_inline.carbon
  26. library "fail_member_inline.carbon";
  27. class C(T:! type) {
  28. fn F() {
  29. // CHECK:STDERR: fail_member_inline.carbon:[[@LINE+4]]:5: error: expression cannot be used as a value [UseOfNonExprAsValue]
  30. // CHECK:STDERR: data;
  31. // CHECK:STDERR: ^~~~
  32. // CHECK:STDERR:
  33. data;
  34. }
  35. var data: {};
  36. }
  37. // CHECK:STDOUT: --- member_inline.carbon
  38. // CHECK:STDOUT:
  39. // CHECK:STDOUT: constants {
  40. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  41. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  42. // CHECK:STDOUT: %Class.type: type = generic_class_type @Class [concrete]
  43. // CHECK:STDOUT: %Class.generic: %Class.type = struct_value () [concrete]
  44. // CHECK:STDOUT: %Class: type = class_type @Class, @Class(%T) [symbolic]
  45. // CHECK:STDOUT: %pattern_type.7dc: type = pattern_type %T [symbolic]
  46. // CHECK:STDOUT: %Class.F.type: type = fn_type @Class.F, @Class(%T) [symbolic]
  47. // CHECK:STDOUT: %Class.F: %Class.F.type = struct_value () [symbolic]
  48. // CHECK:STDOUT: %pattern_type.3c1: type = pattern_type %Class [symbolic]
  49. // CHECK:STDOUT: %Class.G.type: type = fn_type @Class.G, @Class(%T) [symbolic]
  50. // CHECK:STDOUT: %Class.G: %Class.G.type = struct_value () [symbolic]
  51. // CHECK:STDOUT: %require_complete.4ae: <witness> = require_complete_type %T [symbolic]
  52. // CHECK:STDOUT: %Class.elem: type = unbound_element_type %Class, %T [symbolic]
  53. // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
  54. // CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [concrete]
  55. // CHECK:STDOUT: %Destroy.impl_witness: <witness> = impl_witness @Class.%Destroy.impl_witness_table, @Class.as.Destroy.impl(%T) [symbolic]
  56. // CHECK:STDOUT: %ptr.955: type = ptr_type %Class [symbolic]
  57. // CHECK:STDOUT: %pattern_type.9e0: type = pattern_type %ptr.955 [symbolic]
  58. // CHECK:STDOUT: %Class.as.Destroy.impl.Op.type: type = fn_type @Class.as.Destroy.impl.Op, @Class.as.Destroy.impl(%T) [symbolic]
  59. // CHECK:STDOUT: %Class.as.Destroy.impl.Op: %Class.as.Destroy.impl.Op.type = struct_value () [symbolic]
  60. // CHECK:STDOUT: %struct_type.n: type = struct_type {.n: %T} [symbolic]
  61. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.n [symbolic]
  62. // CHECK:STDOUT: %require_complete.4f8: <witness> = require_complete_type %Class [symbolic]
  63. // CHECK:STDOUT: }
  64. // CHECK:STDOUT:
  65. // CHECK:STDOUT: imports {
  66. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  67. // CHECK:STDOUT: .Destroy = %Core.Destroy
  68. // CHECK:STDOUT: import Core//prelude
  69. // CHECK:STDOUT: import Core//prelude/...
  70. // CHECK:STDOUT: }
  71. // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
  72. // CHECK:STDOUT: }
  73. // CHECK:STDOUT:
  74. // CHECK:STDOUT: file {
  75. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  76. // CHECK:STDOUT: .Core = imports.%Core
  77. // CHECK:STDOUT: .Class = %Class.decl
  78. // CHECK:STDOUT: }
  79. // CHECK:STDOUT: %Core.import = import Core
  80. // CHECK:STDOUT: %Class.decl: %Class.type = class_decl @Class [concrete = constants.%Class.generic] {
  81. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  82. // CHECK:STDOUT: } {
  83. // CHECK:STDOUT: %T.loc4_13.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_13.1 (constants.%T)]
  84. // CHECK:STDOUT: }
  85. // CHECK:STDOUT: }
  86. // CHECK:STDOUT:
  87. // CHECK:STDOUT: generic impl @Class.as.Destroy.impl(@Class.%T.loc4_13.2: type) {
  88. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  89. // CHECK:STDOUT: %Destroy.impl_witness: <witness> = impl_witness @Class.%Destroy.impl_witness_table, @Class.as.Destroy.impl(%T) [symbolic = %Destroy.impl_witness (constants.%Destroy.impl_witness)]
  90. // CHECK:STDOUT:
  91. // CHECK:STDOUT: !definition:
  92. // CHECK:STDOUT: %Class.as.Destroy.impl.Op.type: type = fn_type @Class.as.Destroy.impl.Op, @Class.as.Destroy.impl(%T) [symbolic = %Class.as.Destroy.impl.Op.type (constants.%Class.as.Destroy.impl.Op.type)]
  93. // CHECK:STDOUT: %Class.as.Destroy.impl.Op: @Class.as.Destroy.impl.%Class.as.Destroy.impl.Op.type (%Class.as.Destroy.impl.Op.type) = struct_value () [symbolic = %Class.as.Destroy.impl.Op (constants.%Class.as.Destroy.impl.Op)]
  94. // CHECK:STDOUT:
  95. // CHECK:STDOUT: impl: constants.%Class as constants.%Destroy.type {
  96. // CHECK:STDOUT: %Class.as.Destroy.impl.Op.decl: @Class.as.Destroy.impl.%Class.as.Destroy.impl.Op.type (%Class.as.Destroy.impl.Op.type) = fn_decl @Class.as.Destroy.impl.Op [symbolic = @Class.as.Destroy.impl.%Class.as.Destroy.impl.Op (constants.%Class.as.Destroy.impl.Op)] {
  97. // CHECK:STDOUT: %self.patt: @Class.as.Destroy.impl.Op.%pattern_type (%pattern_type.9e0) = binding_pattern self [concrete]
  98. // CHECK:STDOUT: %self.param_patt: @Class.as.Destroy.impl.Op.%pattern_type (%pattern_type.9e0) = value_param_pattern %self.patt, call_param0 [concrete]
  99. // CHECK:STDOUT: %.loc4_23.1: %pattern_type.f6d = addr_pattern %self.param_patt [concrete]
  100. // CHECK:STDOUT: } {
  101. // CHECK:STDOUT: %self.param: @Class.as.Destroy.impl.Op.%ptr (%ptr.955) = value_param call_param0
  102. // CHECK:STDOUT: %.loc4_23.2: type = splice_block %Self.ref [symbolic = %Class (constants.%Class)] {
  103. // CHECK:STDOUT: %.loc4_23.3: type = specific_constant constants.%Class, @Class(constants.%T) [symbolic = %Class (constants.%Class)]
  104. // CHECK:STDOUT: %Self.ref: type = name_ref Self, %.loc4_23.3 [symbolic = %Class (constants.%Class)]
  105. // CHECK:STDOUT: }
  106. // CHECK:STDOUT: %self: @Class.as.Destroy.impl.Op.%ptr (%ptr.955) = bind_name self, %self.param
  107. // CHECK:STDOUT: }
  108. // CHECK:STDOUT:
  109. // CHECK:STDOUT: !members:
  110. // CHECK:STDOUT: .Op = %Class.as.Destroy.impl.Op.decl
  111. // CHECK:STDOUT: witness = @Class.%Destroy.impl_witness
  112. // CHECK:STDOUT: }
  113. // CHECK:STDOUT: }
  114. // CHECK:STDOUT:
  115. // CHECK:STDOUT: generic class @Class(%T.loc4_13.2: type) {
  116. // CHECK:STDOUT: %T.loc4_13.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_13.1 (constants.%T)]
  117. // CHECK:STDOUT:
  118. // CHECK:STDOUT: !definition:
  119. // CHECK:STDOUT: %Class.F.type: type = fn_type @Class.F, @Class(%T.loc4_13.1) [symbolic = %Class.F.type (constants.%Class.F.type)]
  120. // CHECK:STDOUT: %Class.F: @Class.%Class.F.type (%Class.F.type) = struct_value () [symbolic = %Class.F (constants.%Class.F)]
  121. // CHECK:STDOUT: %Class.G.type: type = fn_type @Class.G, @Class(%T.loc4_13.1) [symbolic = %Class.G.type (constants.%Class.G.type)]
  122. // CHECK:STDOUT: %Class.G: @Class.%Class.G.type (%Class.G.type) = struct_value () [symbolic = %Class.G (constants.%Class.G)]
  123. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %T.loc4_13.1 [symbolic = %require_complete (constants.%require_complete.4ae)]
  124. // CHECK:STDOUT: %Class: type = class_type @Class, @Class(%T.loc4_13.1) [symbolic = %Class (constants.%Class)]
  125. // CHECK:STDOUT: %Class.elem: type = unbound_element_type %Class, %T.loc4_13.1 [symbolic = %Class.elem (constants.%Class.elem)]
  126. // CHECK:STDOUT: %struct_type.n.loc14_1.2: type = struct_type {.n: @Class.%T.loc4_13.1 (%T)} [symbolic = %struct_type.n.loc14_1.2 (constants.%struct_type.n)]
  127. // CHECK:STDOUT: %complete_type.loc14_1.2: <witness> = complete_type_witness %struct_type.n.loc14_1.2 [symbolic = %complete_type.loc14_1.2 (constants.%complete_type)]
  128. // CHECK:STDOUT:
  129. // CHECK:STDOUT: class {
  130. // CHECK:STDOUT: %Class.F.decl: @Class.%Class.F.type (%Class.F.type) = fn_decl @Class.F [symbolic = @Class.%Class.F (constants.%Class.F)] {
  131. // CHECK:STDOUT: %n.patt: @Class.F.%pattern_type (%pattern_type.7dc) = binding_pattern n [concrete]
  132. // CHECK:STDOUT: %n.param_patt: @Class.F.%pattern_type (%pattern_type.7dc) = value_param_pattern %n.patt, call_param0 [concrete]
  133. // CHECK:STDOUT: %return.patt: @Class.F.%pattern_type (%pattern_type.7dc) = return_slot_pattern [concrete]
  134. // CHECK:STDOUT: %return.param_patt: @Class.F.%pattern_type (%pattern_type.7dc) = out_param_pattern %return.patt, call_param1 [concrete]
  135. // CHECK:STDOUT: } {
  136. // CHECK:STDOUT: %T.ref.loc5_17: type = name_ref T, @Class.%T.loc4_13.2 [symbolic = %T (constants.%T)]
  137. // CHECK:STDOUT: %n.param: @Class.F.%T (%T) = value_param call_param0
  138. // CHECK:STDOUT: %T.ref.loc5_11: type = name_ref T, @Class.%T.loc4_13.2 [symbolic = %T (constants.%T)]
  139. // CHECK:STDOUT: %n: @Class.F.%T (%T) = bind_name n, %n.param
  140. // CHECK:STDOUT: %return.param: ref @Class.F.%T (%T) = out_param call_param1
  141. // CHECK:STDOUT: %return: ref @Class.F.%T (%T) = return_slot %return.param
  142. // CHECK:STDOUT: }
  143. // CHECK:STDOUT: %Class.G.decl: @Class.%Class.G.type (%Class.G.type) = fn_decl @Class.G [symbolic = @Class.%Class.G (constants.%Class.G)] {
  144. // CHECK:STDOUT: %self.patt: @Class.G.%pattern_type.loc9_8 (%pattern_type.3c1) = binding_pattern self [concrete]
  145. // CHECK:STDOUT: %self.param_patt: @Class.G.%pattern_type.loc9_8 (%pattern_type.3c1) = value_param_pattern %self.patt, call_param0 [concrete]
  146. // CHECK:STDOUT: %return.patt: @Class.G.%pattern_type.loc9_22 (%pattern_type.7dc) = return_slot_pattern [concrete]
  147. // CHECK:STDOUT: %return.param_patt: @Class.G.%pattern_type.loc9_22 (%pattern_type.7dc) = out_param_pattern %return.patt, call_param1 [concrete]
  148. // CHECK:STDOUT: } {
  149. // CHECK:STDOUT: %T.ref: type = name_ref T, @Class.%T.loc4_13.2 [symbolic = %T (constants.%T)]
  150. // CHECK:STDOUT: %self.param: @Class.G.%Class (%Class) = value_param call_param0
  151. // CHECK:STDOUT: %.loc9_14.1: type = splice_block %Self.ref [symbolic = %Class (constants.%Class)] {
  152. // CHECK:STDOUT: %.loc9_14.2: type = specific_constant constants.%Class, @Class(constants.%T) [symbolic = %Class (constants.%Class)]
  153. // CHECK:STDOUT: %Self.ref: type = name_ref Self, %.loc9_14.2 [symbolic = %Class (constants.%Class)]
  154. // CHECK:STDOUT: }
  155. // CHECK:STDOUT: %self: @Class.G.%Class (%Class) = bind_name self, %self.param
  156. // CHECK:STDOUT: %return.param: ref @Class.G.%T (%T) = out_param call_param1
  157. // CHECK:STDOUT: %return: ref @Class.G.%T (%T) = return_slot %return.param
  158. // CHECK:STDOUT: }
  159. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc4_13.2 [symbolic = %T.loc4_13.1 (constants.%T)]
  160. // CHECK:STDOUT: %.loc13: @Class.%Class.elem (%Class.elem) = field_decl n, element0 [concrete]
  161. // CHECK:STDOUT: impl_decl @Class.as.Destroy.impl [concrete] {} {}
  162. // CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (@Class.as.Destroy.impl.%Class.as.Destroy.impl.Op.decl), @Class.as.Destroy.impl [concrete]
  163. // CHECK:STDOUT: %Destroy.impl_witness: <witness> = impl_witness %Destroy.impl_witness_table, @Class.as.Destroy.impl(constants.%T) [symbolic = @Class.as.Destroy.impl.%Destroy.impl_witness (constants.%Destroy.impl_witness)]
  164. // CHECK:STDOUT: %struct_type.n.loc14_1.1: type = struct_type {.n: %T} [symbolic = %struct_type.n.loc14_1.2 (constants.%struct_type.n)]
  165. // CHECK:STDOUT: %complete_type.loc14_1.1: <witness> = complete_type_witness %struct_type.n.loc14_1.1 [symbolic = %complete_type.loc14_1.2 (constants.%complete_type)]
  166. // CHECK:STDOUT: complete_type_witness = %complete_type.loc14_1.1
  167. // CHECK:STDOUT:
  168. // CHECK:STDOUT: !members:
  169. // CHECK:STDOUT: .Self = constants.%Class
  170. // CHECK:STDOUT: .T = <poisoned>
  171. // CHECK:STDOUT: .F = %Class.F.decl
  172. // CHECK:STDOUT: .G = %Class.G.decl
  173. // CHECK:STDOUT: .n = %.loc13
  174. // CHECK:STDOUT: }
  175. // CHECK:STDOUT: }
  176. // CHECK:STDOUT:
  177. // CHECK:STDOUT: generic fn @Class.F(@Class.%T.loc4_13.2: type) {
  178. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  179. // CHECK:STDOUT: %pattern_type: type = pattern_type %T [symbolic = %pattern_type (constants.%pattern_type.7dc)]
  180. // CHECK:STDOUT:
  181. // CHECK:STDOUT: !definition:
  182. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %T [symbolic = %require_complete (constants.%require_complete.4ae)]
  183. // CHECK:STDOUT:
  184. // CHECK:STDOUT: fn(%n.param: @Class.F.%T (%T)) -> @Class.F.%T (%T) {
  185. // CHECK:STDOUT: !entry:
  186. // CHECK:STDOUT: %n.ref: @Class.F.%T (%T) = name_ref n, %n
  187. // CHECK:STDOUT: return %n.ref
  188. // CHECK:STDOUT: }
  189. // CHECK:STDOUT: }
  190. // CHECK:STDOUT:
  191. // CHECK:STDOUT: generic fn @Class.G(@Class.%T.loc4_13.2: type) {
  192. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  193. // CHECK:STDOUT: %Class: type = class_type @Class, @Class(%T) [symbolic = %Class (constants.%Class)]
  194. // CHECK:STDOUT: %pattern_type.loc9_8: type = pattern_type %Class [symbolic = %pattern_type.loc9_8 (constants.%pattern_type.3c1)]
  195. // CHECK:STDOUT: %pattern_type.loc9_22: type = pattern_type %T [symbolic = %pattern_type.loc9_22 (constants.%pattern_type.7dc)]
  196. // CHECK:STDOUT:
  197. // CHECK:STDOUT: !definition:
  198. // CHECK:STDOUT: %require_complete.loc9: <witness> = require_complete_type %Class [symbolic = %require_complete.loc9 (constants.%require_complete.4f8)]
  199. // CHECK:STDOUT: %Class.elem: type = unbound_element_type %Class, %T [symbolic = %Class.elem (constants.%Class.elem)]
  200. // CHECK:STDOUT: %require_complete.loc10: <witness> = require_complete_type %T [symbolic = %require_complete.loc10 (constants.%require_complete.4ae)]
  201. // CHECK:STDOUT:
  202. // CHECK:STDOUT: fn(%self.param: @Class.G.%Class (%Class)) -> @Class.G.%T (%T) {
  203. // CHECK:STDOUT: !entry:
  204. // CHECK:STDOUT: %self.ref: @Class.G.%Class (%Class) = name_ref self, %self
  205. // CHECK:STDOUT: %n.ref: @Class.G.%Class.elem (%Class.elem) = name_ref n, @Class.%.loc13 [concrete = @Class.%.loc13]
  206. // CHECK:STDOUT: %.loc10_16.1: ref @Class.G.%T (%T) = class_element_access %self.ref, element0
  207. // CHECK:STDOUT: %.loc10_16.2: @Class.G.%T (%T) = bind_value %.loc10_16.1
  208. // CHECK:STDOUT: return %.loc10_16.2
  209. // CHECK:STDOUT: }
  210. // CHECK:STDOUT: }
  211. // CHECK:STDOUT:
  212. // CHECK:STDOUT: generic fn @Class.as.Destroy.impl.Op(@Class.%T.loc4_13.2: type) {
  213. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  214. // CHECK:STDOUT: %Class: type = class_type @Class, @Class(%T) [symbolic = %Class (constants.%Class)]
  215. // CHECK:STDOUT: %ptr: type = ptr_type %Class [symbolic = %ptr (constants.%ptr.955)]
  216. // CHECK:STDOUT: %pattern_type: type = pattern_type %ptr [symbolic = %pattern_type (constants.%pattern_type.9e0)]
  217. // CHECK:STDOUT:
  218. // CHECK:STDOUT: !definition:
  219. // CHECK:STDOUT:
  220. // CHECK:STDOUT: fn(%self.param: @Class.as.Destroy.impl.Op.%ptr (%ptr.955)) = "no_op";
  221. // CHECK:STDOUT: }
  222. // CHECK:STDOUT:
  223. // CHECK:STDOUT: specific @Class(constants.%T) {
  224. // CHECK:STDOUT: %T.loc4_13.1 => constants.%T
  225. // CHECK:STDOUT:
  226. // CHECK:STDOUT: !definition:
  227. // CHECK:STDOUT: %Class.F.type => constants.%Class.F.type
  228. // CHECK:STDOUT: %Class.F => constants.%Class.F
  229. // CHECK:STDOUT: %Class.G.type => constants.%Class.G.type
  230. // CHECK:STDOUT: %Class.G => constants.%Class.G
  231. // CHECK:STDOUT: %require_complete => constants.%require_complete.4ae
  232. // CHECK:STDOUT: %Class => constants.%Class
  233. // CHECK:STDOUT: %Class.elem => constants.%Class.elem
  234. // CHECK:STDOUT: %struct_type.n.loc14_1.2 => constants.%struct_type.n
  235. // CHECK:STDOUT: %complete_type.loc14_1.2 => constants.%complete_type
  236. // CHECK:STDOUT: }
  237. // CHECK:STDOUT:
  238. // CHECK:STDOUT: specific @Class.F(constants.%T) {
  239. // CHECK:STDOUT: %T => constants.%T
  240. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.7dc
  241. // CHECK:STDOUT: }
  242. // CHECK:STDOUT:
  243. // CHECK:STDOUT: specific @Class.G(constants.%T) {
  244. // CHECK:STDOUT: %T => constants.%T
  245. // CHECK:STDOUT: %Class => constants.%Class
  246. // CHECK:STDOUT: %pattern_type.loc9_8 => constants.%pattern_type.3c1
  247. // CHECK:STDOUT: %pattern_type.loc9_22 => constants.%pattern_type.7dc
  248. // CHECK:STDOUT: }
  249. // CHECK:STDOUT:
  250. // CHECK:STDOUT: specific @Class.as.Destroy.impl(constants.%T) {
  251. // CHECK:STDOUT: %T => constants.%T
  252. // CHECK:STDOUT: %Destroy.impl_witness => constants.%Destroy.impl_witness
  253. // CHECK:STDOUT: }
  254. // CHECK:STDOUT:
  255. // CHECK:STDOUT: specific @Class.as.Destroy.impl.Op(constants.%T) {
  256. // CHECK:STDOUT: %T => constants.%T
  257. // CHECK:STDOUT: %Class => constants.%Class
  258. // CHECK:STDOUT: %ptr => constants.%ptr.955
  259. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.9e0
  260. // CHECK:STDOUT: }
  261. // CHECK:STDOUT:
  262. // CHECK:STDOUT: --- fail_member_inline.carbon
  263. // CHECK:STDOUT:
  264. // CHECK:STDOUT: constants {
  265. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  266. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  267. // CHECK:STDOUT: %C.type: type = generic_class_type @C [concrete]
  268. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [concrete]
  269. // CHECK:STDOUT: %C: type = class_type @C, @C(%T) [symbolic]
  270. // CHECK:STDOUT: %C.F.type: type = fn_type @C.F, @C(%T) [symbolic]
  271. // CHECK:STDOUT: %C.F: %C.F.type = struct_value () [symbolic]
  272. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  273. // CHECK:STDOUT: %C.elem: type = unbound_element_type %C, %empty_struct_type [symbolic]
  274. // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
  275. // CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [concrete]
  276. // CHECK:STDOUT: %Destroy.impl_witness: <witness> = impl_witness @C.%Destroy.impl_witness_table, @C.as.Destroy.impl(%T) [symbolic]
  277. // CHECK:STDOUT: %ptr.7d2: type = ptr_type %C [symbolic]
  278. // CHECK:STDOUT: %pattern_type.1d2: type = pattern_type %ptr.7d2 [symbolic]
  279. // CHECK:STDOUT: %C.as.Destroy.impl.Op.type: type = fn_type @C.as.Destroy.impl.Op, @C.as.Destroy.impl(%T) [symbolic]
  280. // CHECK:STDOUT: %C.as.Destroy.impl.Op: %C.as.Destroy.impl.Op.type = struct_value () [symbolic]
  281. // CHECK:STDOUT: %struct_type.data: type = struct_type {.data: %empty_struct_type} [concrete]
  282. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.data [concrete]
  283. // CHECK:STDOUT: }
  284. // CHECK:STDOUT:
  285. // CHECK:STDOUT: imports {
  286. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  287. // CHECK:STDOUT: .Destroy = %Core.Destroy
  288. // CHECK:STDOUT: import Core//prelude
  289. // CHECK:STDOUT: import Core//prelude/...
  290. // CHECK:STDOUT: }
  291. // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
  292. // CHECK:STDOUT: }
  293. // CHECK:STDOUT:
  294. // CHECK:STDOUT: file {
  295. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  296. // CHECK:STDOUT: .Core = imports.%Core
  297. // CHECK:STDOUT: .C = %C.decl
  298. // CHECK:STDOUT: }
  299. // CHECK:STDOUT: %Core.import = import Core
  300. // CHECK:STDOUT: %C.decl: %C.type = class_decl @C [concrete = constants.%C.generic] {
  301. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  302. // CHECK:STDOUT: } {
  303. // CHECK:STDOUT: %T.loc4_9.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_9.1 (constants.%T)]
  304. // CHECK:STDOUT: }
  305. // CHECK:STDOUT: }
  306. // CHECK:STDOUT:
  307. // CHECK:STDOUT: generic impl @C.as.Destroy.impl(@C.%T.loc4_9.2: type) {
  308. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  309. // CHECK:STDOUT: %Destroy.impl_witness: <witness> = impl_witness @C.%Destroy.impl_witness_table, @C.as.Destroy.impl(%T) [symbolic = %Destroy.impl_witness (constants.%Destroy.impl_witness)]
  310. // CHECK:STDOUT:
  311. // CHECK:STDOUT: !definition:
  312. // CHECK:STDOUT: %C.as.Destroy.impl.Op.type: type = fn_type @C.as.Destroy.impl.Op, @C.as.Destroy.impl(%T) [symbolic = %C.as.Destroy.impl.Op.type (constants.%C.as.Destroy.impl.Op.type)]
  313. // CHECK:STDOUT: %C.as.Destroy.impl.Op: @C.as.Destroy.impl.%C.as.Destroy.impl.Op.type (%C.as.Destroy.impl.Op.type) = struct_value () [symbolic = %C.as.Destroy.impl.Op (constants.%C.as.Destroy.impl.Op)]
  314. // CHECK:STDOUT:
  315. // CHECK:STDOUT: impl: constants.%C as constants.%Destroy.type {
  316. // CHECK:STDOUT: %C.as.Destroy.impl.Op.decl: @C.as.Destroy.impl.%C.as.Destroy.impl.Op.type (%C.as.Destroy.impl.Op.type) = fn_decl @C.as.Destroy.impl.Op [symbolic = @C.as.Destroy.impl.%C.as.Destroy.impl.Op (constants.%C.as.Destroy.impl.Op)] {
  317. // CHECK:STDOUT: %self.patt: @C.as.Destroy.impl.Op.%pattern_type (%pattern_type.1d2) = binding_pattern self [concrete]
  318. // CHECK:STDOUT: %self.param_patt: @C.as.Destroy.impl.Op.%pattern_type (%pattern_type.1d2) = value_param_pattern %self.patt, call_param0 [concrete]
  319. // CHECK:STDOUT: %.loc4_19.1: %pattern_type.f6d = addr_pattern %self.param_patt [concrete]
  320. // CHECK:STDOUT: } {
  321. // CHECK:STDOUT: %self.param: @C.as.Destroy.impl.Op.%ptr (%ptr.7d2) = value_param call_param0
  322. // CHECK:STDOUT: %.loc4_19.2: type = splice_block %Self.ref [symbolic = %C (constants.%C)] {
  323. // CHECK:STDOUT: %.loc4_19.3: type = specific_constant constants.%C, @C(constants.%T) [symbolic = %C (constants.%C)]
  324. // CHECK:STDOUT: %Self.ref: type = name_ref Self, %.loc4_19.3 [symbolic = %C (constants.%C)]
  325. // CHECK:STDOUT: }
  326. // CHECK:STDOUT: %self: @C.as.Destroy.impl.Op.%ptr (%ptr.7d2) = bind_name self, %self.param
  327. // CHECK:STDOUT: }
  328. // CHECK:STDOUT:
  329. // CHECK:STDOUT: !members:
  330. // CHECK:STDOUT: .Op = %C.as.Destroy.impl.Op.decl
  331. // CHECK:STDOUT: witness = @C.%Destroy.impl_witness
  332. // CHECK:STDOUT: }
  333. // CHECK:STDOUT: }
  334. // CHECK:STDOUT:
  335. // CHECK:STDOUT: generic class @C(%T.loc4_9.2: type) {
  336. // CHECK:STDOUT: %T.loc4_9.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_9.1 (constants.%T)]
  337. // CHECK:STDOUT:
  338. // CHECK:STDOUT: !definition:
  339. // CHECK:STDOUT: %C.F.type: type = fn_type @C.F, @C(%T.loc4_9.1) [symbolic = %C.F.type (constants.%C.F.type)]
  340. // CHECK:STDOUT: %C.F: @C.%C.F.type (%C.F.type) = struct_value () [symbolic = %C.F (constants.%C.F)]
  341. // CHECK:STDOUT: %C: type = class_type @C, @C(%T.loc4_9.1) [symbolic = %C (constants.%C)]
  342. // CHECK:STDOUT: %C.elem: type = unbound_element_type %C, constants.%empty_struct_type [symbolic = %C.elem (constants.%C.elem)]
  343. // CHECK:STDOUT:
  344. // CHECK:STDOUT: class {
  345. // CHECK:STDOUT: %C.F.decl: @C.%C.F.type (%C.F.type) = fn_decl @C.F [symbolic = @C.%C.F (constants.%C.F)] {} {}
  346. // CHECK:STDOUT: %.loc12_14.1: %empty_struct_type = struct_literal ()
  347. // CHECK:STDOUT: %.loc12_14.2: type = converted %.loc12_14.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  348. // CHECK:STDOUT: %.loc12_11: @C.%C.elem (%C.elem) = field_decl data, element0 [concrete]
  349. // CHECK:STDOUT: impl_decl @C.as.Destroy.impl [concrete] {} {}
  350. // CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (@C.as.Destroy.impl.%C.as.Destroy.impl.Op.decl), @C.as.Destroy.impl [concrete]
  351. // CHECK:STDOUT: %Destroy.impl_witness: <witness> = impl_witness %Destroy.impl_witness_table, @C.as.Destroy.impl(constants.%T) [symbolic = @C.as.Destroy.impl.%Destroy.impl_witness (constants.%Destroy.impl_witness)]
  352. // CHECK:STDOUT: %struct_type.data: type = struct_type {.data: %empty_struct_type} [concrete = constants.%struct_type.data]
  353. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.data [concrete = constants.%complete_type]
  354. // CHECK:STDOUT: complete_type_witness = %complete_type
  355. // CHECK:STDOUT:
  356. // CHECK:STDOUT: !members:
  357. // CHECK:STDOUT: .Self = constants.%C
  358. // CHECK:STDOUT: .F = %C.F.decl
  359. // CHECK:STDOUT: .data = %.loc12_11
  360. // CHECK:STDOUT: }
  361. // CHECK:STDOUT: }
  362. // CHECK:STDOUT:
  363. // CHECK:STDOUT: generic fn @C.F(@C.%T.loc4_9.2: type) {
  364. // CHECK:STDOUT: !definition:
  365. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  366. // CHECK:STDOUT: %C: type = class_type @C, @C(%T) [symbolic = %C (constants.%C)]
  367. // CHECK:STDOUT: %C.elem: type = unbound_element_type %C, constants.%empty_struct_type [symbolic = %C.elem (constants.%C.elem)]
  368. // CHECK:STDOUT:
  369. // CHECK:STDOUT: fn() {
  370. // CHECK:STDOUT: !entry:
  371. // CHECK:STDOUT: %data.ref: @C.F.%C.elem (%C.elem) = name_ref data, @C.%.loc12_11 [concrete = @C.%.loc12_11]
  372. // CHECK:STDOUT: return
  373. // CHECK:STDOUT: }
  374. // CHECK:STDOUT: }
  375. // CHECK:STDOUT:
  376. // CHECK:STDOUT: generic fn @C.as.Destroy.impl.Op(@C.%T.loc4_9.2: type) {
  377. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  378. // CHECK:STDOUT: %C: type = class_type @C, @C(%T) [symbolic = %C (constants.%C)]
  379. // CHECK:STDOUT: %ptr: type = ptr_type %C [symbolic = %ptr (constants.%ptr.7d2)]
  380. // CHECK:STDOUT: %pattern_type: type = pattern_type %ptr [symbolic = %pattern_type (constants.%pattern_type.1d2)]
  381. // CHECK:STDOUT:
  382. // CHECK:STDOUT: !definition:
  383. // CHECK:STDOUT:
  384. // CHECK:STDOUT: fn(%self.param: @C.as.Destroy.impl.Op.%ptr (%ptr.7d2)) = "no_op";
  385. // CHECK:STDOUT: }
  386. // CHECK:STDOUT:
  387. // CHECK:STDOUT: specific @C(constants.%T) {
  388. // CHECK:STDOUT: %T.loc4_9.1 => constants.%T
  389. // CHECK:STDOUT:
  390. // CHECK:STDOUT: !definition:
  391. // CHECK:STDOUT: %C.F.type => constants.%C.F.type
  392. // CHECK:STDOUT: %C.F => constants.%C.F
  393. // CHECK:STDOUT: %C => constants.%C
  394. // CHECK:STDOUT: %C.elem => constants.%C.elem
  395. // CHECK:STDOUT: }
  396. // CHECK:STDOUT:
  397. // CHECK:STDOUT: specific @C.F(constants.%T) {}
  398. // CHECK:STDOUT:
  399. // CHECK:STDOUT: specific @C.as.Destroy.impl(constants.%T) {
  400. // CHECK:STDOUT: %T => constants.%T
  401. // CHECK:STDOUT: %Destroy.impl_witness => constants.%Destroy.impl_witness
  402. // CHECK:STDOUT: }
  403. // CHECK:STDOUT:
  404. // CHECK:STDOUT: specific @C.as.Destroy.impl.Op(constants.%T) {
  405. // CHECK:STDOUT: %T => constants.%T
  406. // CHECK:STDOUT: %C => constants.%C
  407. // CHECK:STDOUT: %ptr => constants.%ptr.7d2
  408. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.1d2
  409. // CHECK:STDOUT: }
  410. // CHECK:STDOUT: