designator.carbon 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  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. // AUTOUPDATE
  6. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/where_expr/no_prelude/designator.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/where_expr/no_prelude/designator.carbon
  10. // --- success.carbon
  11. library "[[@TEST_NAME]]";
  12. interface I {
  13. let Member:! type;
  14. }
  15. fn PeriodSelf(T:! I where .Self == ());
  16. fn PeriodMember(U:! I where .Member = {});
  17. fn TypeSelfImpls(V:! type where .Self impls I);
  18. // --- fail_wrong_member.carbon
  19. library "[[@TEST_NAME]]";
  20. interface J {
  21. let Member:! type;
  22. }
  23. // CHECK:STDERR: fail_wrong_member.carbon:[[@LINE+4]]:31: error: name `Mismatch` not found
  24. // CHECK:STDERR: fn PeriodMismatch(W:! J where .Mismatch = {});
  25. // CHECK:STDERR: ^~~~~~~~~
  26. // CHECK:STDERR:
  27. fn PeriodMismatch(W:! J where .Mismatch = {});
  28. // --- fail_designator_matches_var.carbon
  29. library "[[@TEST_NAME]]";
  30. fn Foo() -> () {
  31. var x: ();
  32. // CHECK:STDERR: fail_designator_matches_var.carbon:[[@LINE+5]]:10: error: name `.Self` not found
  33. // CHECK:STDERR: return .x;
  34. // CHECK:STDERR: ^~
  35. // CHECK:STDERR: fail_designator_matches_var.carbon: note: designator may only be used when `.Self` is in scope
  36. // CHECK:STDERR:
  37. return .x;
  38. }
  39. // --- fail_unknown_designator.carbon
  40. library "[[@TEST_NAME]]";
  41. fn Bar() -> () {
  42. // CHECK:STDERR: fail_unknown_designator.carbon:[[@LINE+5]]:10: error: name `.Self` not found
  43. // CHECK:STDERR: return .undef;
  44. // CHECK:STDERR: ^~~~~~
  45. // CHECK:STDERR: fail_unknown_designator.carbon: note: designator may only be used when `.Self` is in scope
  46. // CHECK:STDERR:
  47. return .undef;
  48. }
  49. // --- fail_dot_self_method_return_value.carbon
  50. library "[[@TEST_NAME]]";
  51. class C {
  52. // CHECK:STDERR: fail_dot_self_method_return_value.carbon:[[@LINE+4]]:27: error: name `.Self` not found
  53. // CHECK:STDERR: fn F() -> Self { return .Self; }
  54. // CHECK:STDERR: ^~~~~
  55. // CHECK:STDERR:
  56. fn F() -> Self { return .Self; }
  57. }
  58. // --- fail_dot_self_method_return_type.carbon
  59. library "[[@TEST_NAME]]";
  60. class D {
  61. // CHECK:STDERR: fail_dot_self_method_return_type.carbon:[[@LINE+3]]:13: error: name `.Self` not found
  62. // CHECK:STDERR: fn G() -> .Self { return Self; }
  63. // CHECK:STDERR: ^~~~~
  64. fn G() -> .Self { return Self; }
  65. }
  66. // CHECK:STDOUT: --- success.carbon
  67. // CHECK:STDOUT:
  68. // CHECK:STDOUT: constants {
  69. // CHECK:STDOUT: %.1: type = interface_type @I [template]
  70. // CHECK:STDOUT: %Self: %.1 = bind_symbolic_name Self 0 [symbolic]
  71. // CHECK:STDOUT: %.2: type = assoc_entity_type %.1, type [template]
  72. // CHECK:STDOUT: %.3: %.2 = assoc_entity element0, @I.%Member [template]
  73. // CHECK:STDOUT: %.Self.1: %.1 = bind_symbolic_name .Self 0 [symbolic]
  74. // CHECK:STDOUT: %.4: type = tuple_type () [template]
  75. // CHECK:STDOUT: %T: %.1 = bind_symbolic_name T 0 [symbolic]
  76. // CHECK:STDOUT: %PeriodSelf.type: type = fn_type @PeriodSelf [template]
  77. // CHECK:STDOUT: %PeriodSelf: %PeriodSelf.type = struct_value () [template]
  78. // CHECK:STDOUT: %.5: type = struct_type {} [template]
  79. // CHECK:STDOUT: %U: %.1 = bind_symbolic_name U 0 [symbolic]
  80. // CHECK:STDOUT: %PeriodMember.type: type = fn_type @PeriodMember [template]
  81. // CHECK:STDOUT: %PeriodMember: %PeriodMember.type = struct_value () [template]
  82. // CHECK:STDOUT: %.Self.2: type = bind_symbolic_name .Self 0 [symbolic]
  83. // CHECK:STDOUT: %V: type = bind_symbolic_name V 0 [symbolic]
  84. // CHECK:STDOUT: %TypeSelfImpls.type: type = fn_type @TypeSelfImpls [template]
  85. // CHECK:STDOUT: %TypeSelfImpls: %TypeSelfImpls.type = struct_value () [template]
  86. // CHECK:STDOUT: }
  87. // CHECK:STDOUT:
  88. // CHECK:STDOUT: file {
  89. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  90. // CHECK:STDOUT: .I = %I.decl
  91. // CHECK:STDOUT: .PeriodSelf = %PeriodSelf.decl
  92. // CHECK:STDOUT: .PeriodMember = %PeriodMember.decl
  93. // CHECK:STDOUT: .TypeSelfImpls = %TypeSelfImpls.decl
  94. // CHECK:STDOUT: }
  95. // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {} {}
  96. // CHECK:STDOUT: %PeriodSelf.decl: %PeriodSelf.type = fn_decl @PeriodSelf [template = constants.%PeriodSelf] {
  97. // CHECK:STDOUT: %T.patt: %.1 = symbolic_binding_pattern T 0
  98. // CHECK:STDOUT: } {
  99. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1]
  100. // CHECK:STDOUT: %.Self: %.1 = bind_symbolic_name .Self 0 [symbolic = constants.%.Self.1]
  101. // CHECK:STDOUT: %.Self.ref: %.1 = name_ref .Self, %.Self [symbolic = constants.%.Self.1]
  102. // CHECK:STDOUT: %.loc8_37: %.4 = tuple_literal ()
  103. // CHECK:STDOUT: %.loc8_21: type = where_expr %.Self [template = constants.%.1] {
  104. // CHECK:STDOUT: requirement_equivalent %.Self.ref, %.loc8_37
  105. // CHECK:STDOUT: }
  106. // CHECK:STDOUT: %T.param: %.1 = param T, runtime_param<invalid>
  107. // CHECK:STDOUT: %T.loc8: %.1 = bind_symbolic_name T 0, %T.param [symbolic = %T.1 (constants.%T)]
  108. // CHECK:STDOUT: }
  109. // CHECK:STDOUT: %PeriodMember.decl: %PeriodMember.type = fn_decl @PeriodMember [template = constants.%PeriodMember] {
  110. // CHECK:STDOUT: %U.patt: %.1 = symbolic_binding_pattern U 0
  111. // CHECK:STDOUT: } {
  112. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1]
  113. // CHECK:STDOUT: %.Self: %.1 = bind_symbolic_name .Self 0 [symbolic = constants.%.Self.1]
  114. // CHECK:STDOUT: %.Self.ref: %.1 = name_ref .Self, %.Self [symbolic = constants.%.Self.1]
  115. // CHECK:STDOUT: %Member.ref: %.2 = name_ref Member, @I.%.loc5 [template = constants.%.3]
  116. // CHECK:STDOUT: %.loc10_40: %.5 = struct_literal ()
  117. // CHECK:STDOUT: %.loc10_23: type = where_expr %.Self [template = constants.%.1] {
  118. // CHECK:STDOUT: requirement_rewrite %Member.ref, %.loc10_40
  119. // CHECK:STDOUT: }
  120. // CHECK:STDOUT: %U.param: %.1 = param U, runtime_param<invalid>
  121. // CHECK:STDOUT: %U.loc10: %.1 = bind_symbolic_name U 0, %U.param [symbolic = %U.1 (constants.%U)]
  122. // CHECK:STDOUT: }
  123. // CHECK:STDOUT: %TypeSelfImpls.decl: %TypeSelfImpls.type = fn_decl @TypeSelfImpls [template = constants.%TypeSelfImpls] {
  124. // CHECK:STDOUT: %V.patt: type = symbolic_binding_pattern V 0
  125. // CHECK:STDOUT: } {
  126. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self 0 [symbolic = constants.%.Self.2]
  127. // CHECK:STDOUT: %.Self.ref: type = name_ref .Self, %.Self [symbolic = constants.%.Self.2]
  128. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1]
  129. // CHECK:STDOUT: %.loc12: type = where_expr %.Self [template = type] {
  130. // CHECK:STDOUT: requirement_impls %.Self.ref, %I.ref
  131. // CHECK:STDOUT: }
  132. // CHECK:STDOUT: %V.param: type = param V, runtime_param<invalid>
  133. // CHECK:STDOUT: %V.loc12: type = bind_symbolic_name V 0, %V.param [symbolic = %V.1 (constants.%V)]
  134. // CHECK:STDOUT: }
  135. // CHECK:STDOUT: }
  136. // CHECK:STDOUT:
  137. // CHECK:STDOUT: interface @I {
  138. // CHECK:STDOUT: %Self: %.1 = bind_symbolic_name Self 0 [symbolic = constants.%Self]
  139. // CHECK:STDOUT: %Member: type = assoc_const_decl Member [template]
  140. // CHECK:STDOUT: %.loc5: %.2 = assoc_entity element0, %Member [template = constants.%.3]
  141. // CHECK:STDOUT:
  142. // CHECK:STDOUT: !members:
  143. // CHECK:STDOUT: .Self = %Self
  144. // CHECK:STDOUT: .Member = %.loc5
  145. // CHECK:STDOUT: witness = (%Member)
  146. // CHECK:STDOUT: }
  147. // CHECK:STDOUT:
  148. // CHECK:STDOUT: generic fn @PeriodSelf(%T.loc8: %.1) {
  149. // CHECK:STDOUT: %T.1: %.1 = bind_symbolic_name T 0 [symbolic = %T.1 (constants.%T)]
  150. // CHECK:STDOUT:
  151. // CHECK:STDOUT: fn(%T.loc8: %.1);
  152. // CHECK:STDOUT: }
  153. // CHECK:STDOUT:
  154. // CHECK:STDOUT: generic fn @PeriodMember(%U.loc10: %.1) {
  155. // CHECK:STDOUT: %U.1: %.1 = bind_symbolic_name U 0 [symbolic = %U.1 (constants.%U)]
  156. // CHECK:STDOUT:
  157. // CHECK:STDOUT: fn(%U.loc10: %.1);
  158. // CHECK:STDOUT: }
  159. // CHECK:STDOUT:
  160. // CHECK:STDOUT: generic fn @TypeSelfImpls(%V.loc12: type) {
  161. // CHECK:STDOUT: %V.1: type = bind_symbolic_name V 0 [symbolic = %V.1 (constants.%V)]
  162. // CHECK:STDOUT:
  163. // CHECK:STDOUT: fn(%V.loc12: type);
  164. // CHECK:STDOUT: }
  165. // CHECK:STDOUT:
  166. // CHECK:STDOUT: specific @PeriodSelf(constants.%T) {
  167. // CHECK:STDOUT: %T.1 => constants.%T
  168. // CHECK:STDOUT: }
  169. // CHECK:STDOUT:
  170. // CHECK:STDOUT: specific @PeriodMember(constants.%U) {
  171. // CHECK:STDOUT: %U.1 => constants.%U
  172. // CHECK:STDOUT: }
  173. // CHECK:STDOUT:
  174. // CHECK:STDOUT: specific @TypeSelfImpls(constants.%V) {
  175. // CHECK:STDOUT: %V.1 => constants.%V
  176. // CHECK:STDOUT: }
  177. // CHECK:STDOUT:
  178. // CHECK:STDOUT: --- fail_wrong_member.carbon
  179. // CHECK:STDOUT:
  180. // CHECK:STDOUT: constants {
  181. // CHECK:STDOUT: %.1: type = interface_type @J [template]
  182. // CHECK:STDOUT: %Self: %.1 = bind_symbolic_name Self 0 [symbolic]
  183. // CHECK:STDOUT: %.2: type = assoc_entity_type %.1, type [template]
  184. // CHECK:STDOUT: %.3: %.2 = assoc_entity element0, @J.%Member [template]
  185. // CHECK:STDOUT: %.Self: %.1 = bind_symbolic_name .Self 0 [symbolic]
  186. // CHECK:STDOUT: %.4: type = tuple_type () [template]
  187. // CHECK:STDOUT: %.5: type = struct_type {} [template]
  188. // CHECK:STDOUT: %W: %.1 = bind_symbolic_name W 0 [symbolic]
  189. // CHECK:STDOUT: %PeriodMismatch.type: type = fn_type @PeriodMismatch [template]
  190. // CHECK:STDOUT: %PeriodMismatch: %PeriodMismatch.type = struct_value () [template]
  191. // CHECK:STDOUT: }
  192. // CHECK:STDOUT:
  193. // CHECK:STDOUT: file {
  194. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  195. // CHECK:STDOUT: .J = %J.decl
  196. // CHECK:STDOUT: .PeriodMismatch = %PeriodMismatch.decl
  197. // CHECK:STDOUT: }
  198. // CHECK:STDOUT: %J.decl: type = interface_decl @J [template = constants.%.1] {} {}
  199. // CHECK:STDOUT: %PeriodMismatch.decl: %PeriodMismatch.type = fn_decl @PeriodMismatch [template = constants.%PeriodMismatch] {
  200. // CHECK:STDOUT: %W.patt: %.1 = symbolic_binding_pattern W 0
  201. // CHECK:STDOUT: } {
  202. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.1]
  203. // CHECK:STDOUT: %.Self: %.1 = bind_symbolic_name .Self 0 [symbolic = constants.%.Self]
  204. // CHECK:STDOUT: %.Self.ref: %.1 = name_ref .Self, %.Self [symbolic = constants.%.Self]
  205. // CHECK:STDOUT: %Mismatch.ref: <error> = name_ref Mismatch, <error> [template = <error>]
  206. // CHECK:STDOUT: %.loc12_44: %.5 = struct_literal ()
  207. // CHECK:STDOUT: %.loc12_25: type = where_expr %.Self [template = constants.%.1] {
  208. // CHECK:STDOUT: requirement_rewrite %Mismatch.ref, %.loc12_44
  209. // CHECK:STDOUT: }
  210. // CHECK:STDOUT: %W.param: %.1 = param W, runtime_param<invalid>
  211. // CHECK:STDOUT: %W.loc12: %.1 = bind_symbolic_name W 0, %W.param [symbolic = %W.1 (constants.%W)]
  212. // CHECK:STDOUT: }
  213. // CHECK:STDOUT: }
  214. // CHECK:STDOUT:
  215. // CHECK:STDOUT: interface @J {
  216. // CHECK:STDOUT: %Self: %.1 = bind_symbolic_name Self 0 [symbolic = constants.%Self]
  217. // CHECK:STDOUT: %Member: type = assoc_const_decl Member [template]
  218. // CHECK:STDOUT: %.loc5: %.2 = assoc_entity element0, %Member [template = constants.%.3]
  219. // CHECK:STDOUT:
  220. // CHECK:STDOUT: !members:
  221. // CHECK:STDOUT: .Self = %Self
  222. // CHECK:STDOUT: .Member = %.loc5
  223. // CHECK:STDOUT: witness = (%Member)
  224. // CHECK:STDOUT: }
  225. // CHECK:STDOUT:
  226. // CHECK:STDOUT: generic fn @PeriodMismatch(%W.loc12: %.1) {
  227. // CHECK:STDOUT: %W.1: %.1 = bind_symbolic_name W 0 [symbolic = %W.1 (constants.%W)]
  228. // CHECK:STDOUT:
  229. // CHECK:STDOUT: fn(%W.loc12: %.1);
  230. // CHECK:STDOUT: }
  231. // CHECK:STDOUT:
  232. // CHECK:STDOUT: specific @PeriodMismatch(constants.%W) {
  233. // CHECK:STDOUT: %W.1 => constants.%W
  234. // CHECK:STDOUT: }
  235. // CHECK:STDOUT:
  236. // CHECK:STDOUT: --- fail_designator_matches_var.carbon
  237. // CHECK:STDOUT:
  238. // CHECK:STDOUT: constants {
  239. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  240. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  241. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  242. // CHECK:STDOUT: }
  243. // CHECK:STDOUT:
  244. // CHECK:STDOUT: file {
  245. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  246. // CHECK:STDOUT: .Foo = %Foo.decl
  247. // CHECK:STDOUT: }
  248. // CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [template = constants.%Foo] {} {
  249. // CHECK:STDOUT: %.loc4_14.1: %.1 = tuple_literal ()
  250. // CHECK:STDOUT: %.loc4_14.2: type = converted %.loc4_14.1, constants.%.1 [template = constants.%.1]
  251. // CHECK:STDOUT: %return: ref %.1 = var <return slot>
  252. // CHECK:STDOUT: }
  253. // CHECK:STDOUT: }
  254. // CHECK:STDOUT:
  255. // CHECK:STDOUT: fn @Foo() -> %.1 {
  256. // CHECK:STDOUT: !entry:
  257. // CHECK:STDOUT: %.loc5_11.1: %.1 = tuple_literal ()
  258. // CHECK:STDOUT: %.loc5_11.2: type = converted %.loc5_11.1, constants.%.1 [template = constants.%.1]
  259. // CHECK:STDOUT: %x.var: ref %.1 = var x
  260. // CHECK:STDOUT: %x: ref %.1 = bind_name x, %x.var
  261. // CHECK:STDOUT: %.Self.ref: <error> = name_ref .Self, <error> [template = <error>]
  262. // CHECK:STDOUT: return <error>
  263. // CHECK:STDOUT: }
  264. // CHECK:STDOUT:
  265. // CHECK:STDOUT: --- fail_unknown_designator.carbon
  266. // CHECK:STDOUT:
  267. // CHECK:STDOUT: constants {
  268. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  269. // CHECK:STDOUT: %Bar.type: type = fn_type @Bar [template]
  270. // CHECK:STDOUT: %Bar: %Bar.type = struct_value () [template]
  271. // CHECK:STDOUT: }
  272. // CHECK:STDOUT:
  273. // CHECK:STDOUT: file {
  274. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  275. // CHECK:STDOUT: .Bar = %Bar.decl
  276. // CHECK:STDOUT: }
  277. // CHECK:STDOUT: %Bar.decl: %Bar.type = fn_decl @Bar [template = constants.%Bar] {} {
  278. // CHECK:STDOUT: %.loc4_14.1: %.1 = tuple_literal ()
  279. // CHECK:STDOUT: %.loc4_14.2: type = converted %.loc4_14.1, constants.%.1 [template = constants.%.1]
  280. // CHECK:STDOUT: %return: ref %.1 = var <return slot>
  281. // CHECK:STDOUT: }
  282. // CHECK:STDOUT: }
  283. // CHECK:STDOUT:
  284. // CHECK:STDOUT: fn @Bar() -> %.1 {
  285. // CHECK:STDOUT: !entry:
  286. // CHECK:STDOUT: %.Self.ref: <error> = name_ref .Self, <error> [template = <error>]
  287. // CHECK:STDOUT: return <error>
  288. // CHECK:STDOUT: }
  289. // CHECK:STDOUT:
  290. // CHECK:STDOUT: --- fail_dot_self_method_return_value.carbon
  291. // CHECK:STDOUT:
  292. // CHECK:STDOUT: constants {
  293. // CHECK:STDOUT: %C: type = class_type @C [template]
  294. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  295. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  296. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  297. // CHECK:STDOUT: %.2: type = struct_type {} [template]
  298. // CHECK:STDOUT: %.3: <witness> = complete_type_witness %.2 [template]
  299. // CHECK:STDOUT: %.4: type = ptr_type %.2 [template]
  300. // CHECK:STDOUT: }
  301. // CHECK:STDOUT:
  302. // CHECK:STDOUT: file {
  303. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  304. // CHECK:STDOUT: .C = %C.decl
  305. // CHECK:STDOUT: }
  306. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  307. // CHECK:STDOUT: }
  308. // CHECK:STDOUT:
  309. // CHECK:STDOUT: class @C {
  310. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {
  311. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [template = constants.%C]
  312. // CHECK:STDOUT: %return: ref %C = var <return slot>
  313. // CHECK:STDOUT: }
  314. // CHECK:STDOUT: %.loc10: <witness> = complete_type_witness %.2 [template = constants.%.3]
  315. // CHECK:STDOUT:
  316. // CHECK:STDOUT: !members:
  317. // CHECK:STDOUT: .Self = constants.%C
  318. // CHECK:STDOUT: .F = %F.decl
  319. // CHECK:STDOUT: }
  320. // CHECK:STDOUT:
  321. // CHECK:STDOUT: fn @F() -> %return: %C {
  322. // CHECK:STDOUT: !entry:
  323. // CHECK:STDOUT: %.Self.ref: <error> = name_ref .Self, <error> [template = <error>]
  324. // CHECK:STDOUT: return <error> to %return
  325. // CHECK:STDOUT: }
  326. // CHECK:STDOUT:
  327. // CHECK:STDOUT: --- fail_dot_self_method_return_type.carbon
  328. // CHECK:STDOUT:
  329. // CHECK:STDOUT: constants {
  330. // CHECK:STDOUT: %D: type = class_type @D [template]
  331. // CHECK:STDOUT: %G.type: type = fn_type @G [template]
  332. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  333. // CHECK:STDOUT: %G: %G.type = struct_value () [template]
  334. // CHECK:STDOUT: %.2: type = struct_type {} [template]
  335. // CHECK:STDOUT: %.3: <witness> = complete_type_witness %.2 [template]
  336. // CHECK:STDOUT: }
  337. // CHECK:STDOUT:
  338. // CHECK:STDOUT: file {
  339. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  340. // CHECK:STDOUT: .D = %D.decl
  341. // CHECK:STDOUT: }
  342. // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} {}
  343. // CHECK:STDOUT: }
  344. // CHECK:STDOUT:
  345. // CHECK:STDOUT: class @D {
  346. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {} {
  347. // CHECK:STDOUT: %.Self.ref: <error> = name_ref .Self, <error> [template = <error>]
  348. // CHECK:STDOUT: %return: ref <error> = var <return slot>
  349. // CHECK:STDOUT: }
  350. // CHECK:STDOUT: %.loc9: <witness> = complete_type_witness %.2 [template = constants.%.3]
  351. // CHECK:STDOUT:
  352. // CHECK:STDOUT: !members:
  353. // CHECK:STDOUT: .Self = constants.%D
  354. // CHECK:STDOUT: .G = %G.decl
  355. // CHECK:STDOUT: }
  356. // CHECK:STDOUT:
  357. // CHECK:STDOUT: fn @G() -> <error> {
  358. // CHECK:STDOUT: !entry:
  359. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%D [template = constants.%D]
  360. // CHECK:STDOUT: return <error>
  361. // CHECK:STDOUT: }
  362. // CHECK:STDOUT: