syntax.carbon 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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/package_expr/syntax.carbon
  11. // TIP: To dump output, run:
  12. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/package_expr/syntax.carbon
  13. // --- global.carbon
  14. package Global;
  15. var x: i32 = 0;
  16. var y: i32 = package.x;
  17. // --- inside_fn.carbon
  18. package InsideFn;
  19. var x: i32 = 0;
  20. fn Main() {
  21. var x: i32 = 1;
  22. var y: i32 = package.x;
  23. }
  24. // --- namespace.carbon
  25. package Namespace;
  26. namespace NS;
  27. class NS.C {
  28. fn Foo() {}
  29. };
  30. fn Main() {
  31. package.NS.C.Foo();
  32. }
  33. // CHECK:STDOUT: --- global.carbon
  34. // CHECK:STDOUT:
  35. // CHECK:STDOUT: constants {
  36. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  37. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  38. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  39. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  40. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  41. // CHECK:STDOUT: %int_0.5c6: Core.IntLiteral = int_value 0 [concrete]
  42. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  43. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  44. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  45. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  46. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  47. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  48. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  49. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  50. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  51. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  52. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  53. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  54. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_0.5c6, %Convert.956 [concrete]
  55. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  56. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_0.5c6, %Convert.specific_fn [concrete]
  57. // CHECK:STDOUT: %int_0.6a9: %i32 = int_value 0 [concrete]
  58. // CHECK:STDOUT: }
  59. // CHECK:STDOUT:
  60. // CHECK:STDOUT: imports {
  61. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  62. // CHECK:STDOUT: .Int = %Core.Int
  63. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  64. // CHECK:STDOUT: import Core//prelude
  65. // CHECK:STDOUT: import Core//prelude/...
  66. // CHECK:STDOUT: }
  67. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  68. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  69. // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
  70. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  71. // CHECK:STDOUT: }
  72. // CHECK:STDOUT:
  73. // CHECK:STDOUT: file {
  74. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  75. // CHECK:STDOUT: .Core = imports.%Core
  76. // CHECK:STDOUT: .x = %x
  77. // CHECK:STDOUT: .y = %y
  78. // CHECK:STDOUT: }
  79. // CHECK:STDOUT: %Core.import = import Core
  80. // CHECK:STDOUT: name_binding_decl {
  81. // CHECK:STDOUT: %x.patt: %pattern_type.7ce = binding_pattern x [concrete]
  82. // CHECK:STDOUT: %x.var_patt: %pattern_type.7ce = var_pattern %x.patt [concrete]
  83. // CHECK:STDOUT: }
  84. // CHECK:STDOUT: %x.var: ref %i32 = var %x.var_patt [concrete]
  85. // CHECK:STDOUT: %.loc4: type = splice_block %i32.loc4 [concrete = constants.%i32] {
  86. // CHECK:STDOUT: %int_32.loc4: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  87. // CHECK:STDOUT: %i32.loc4: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  88. // CHECK:STDOUT: }
  89. // CHECK:STDOUT: %x: ref %i32 = bind_name x, %x.var [concrete = %x.var]
  90. // CHECK:STDOUT: name_binding_decl {
  91. // CHECK:STDOUT: %y.patt: %pattern_type.7ce = binding_pattern y [concrete]
  92. // CHECK:STDOUT: %y.var_patt: %pattern_type.7ce = var_pattern %y.patt [concrete]
  93. // CHECK:STDOUT: }
  94. // CHECK:STDOUT: %y.var: ref %i32 = var %y.var_patt [concrete]
  95. // CHECK:STDOUT: %.loc5: type = splice_block %i32.loc5 [concrete = constants.%i32] {
  96. // CHECK:STDOUT: %int_32.loc5: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  97. // CHECK:STDOUT: %i32.loc5: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  98. // CHECK:STDOUT: }
  99. // CHECK:STDOUT: %y: ref %i32 = bind_name y, %y.var [concrete = %y.var]
  100. // CHECK:STDOUT: }
  101. // CHECK:STDOUT:
  102. // CHECK:STDOUT: fn @__global_init() {
  103. // CHECK:STDOUT: !entry:
  104. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
  105. // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  106. // CHECK:STDOUT: %bound_method.loc4_1.1: <bound method> = bound_method %int_0, %impl.elem0 [concrete = constants.%Convert.bound]
  107. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  108. // CHECK:STDOUT: %bound_method.loc4_1.2: <bound method> = bound_method %int_0, %specific_fn [concrete = constants.%bound_method]
  109. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc4_1.2(%int_0) [concrete = constants.%int_0.6a9]
  110. // CHECK:STDOUT: %.loc4: init %i32 = converted %int_0, %int.convert_checked [concrete = constants.%int_0.6a9]
  111. // CHECK:STDOUT: assign file.%x.var, %.loc4
  112. // CHECK:STDOUT: %package.ref: <namespace> = name_ref package, package [concrete = package]
  113. // CHECK:STDOUT: %x.ref: ref %i32 = name_ref x, file.%x [concrete = file.%x.var]
  114. // CHECK:STDOUT: %.loc5: %i32 = bind_value %x.ref
  115. // CHECK:STDOUT: assign file.%y.var, %.loc5
  116. // CHECK:STDOUT: return
  117. // CHECK:STDOUT: }
  118. // CHECK:STDOUT:
  119. // CHECK:STDOUT: --- inside_fn.carbon
  120. // CHECK:STDOUT:
  121. // CHECK:STDOUT: constants {
  122. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  123. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  124. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  125. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  126. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  127. // CHECK:STDOUT: %int_0.5c6: Core.IntLiteral = int_value 0 [concrete]
  128. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  129. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  130. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  131. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  132. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  133. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  134. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  135. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  136. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  137. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  138. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  139. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  140. // CHECK:STDOUT: %Convert.bound.d04: <bound method> = bound_method %int_0.5c6, %Convert.956 [concrete]
  141. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  142. // CHECK:STDOUT: %bound_method.b6e: <bound method> = bound_method %int_0.5c6, %Convert.specific_fn [concrete]
  143. // CHECK:STDOUT: %int_0.6a9: %i32 = int_value 0 [concrete]
  144. // CHECK:STDOUT: %Main.type: type = fn_type @Main [concrete]
  145. // CHECK:STDOUT: %Main: %Main.type = struct_value () [concrete]
  146. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  147. // CHECK:STDOUT: %Convert.bound.ab5: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  148. // CHECK:STDOUT: %bound_method.9a1: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  149. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  150. // CHECK:STDOUT: }
  151. // CHECK:STDOUT:
  152. // CHECK:STDOUT: imports {
  153. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  154. // CHECK:STDOUT: .Int = %Core.Int
  155. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  156. // CHECK:STDOUT: import Core//prelude
  157. // CHECK:STDOUT: import Core//prelude/...
  158. // CHECK:STDOUT: }
  159. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  160. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  161. // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
  162. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  163. // CHECK:STDOUT: }
  164. // CHECK:STDOUT:
  165. // CHECK:STDOUT: file {
  166. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  167. // CHECK:STDOUT: .Core = imports.%Core
  168. // CHECK:STDOUT: .x = %x
  169. // CHECK:STDOUT: .Main = %Main.decl
  170. // CHECK:STDOUT: }
  171. // CHECK:STDOUT: %Core.import = import Core
  172. // CHECK:STDOUT: name_binding_decl {
  173. // CHECK:STDOUT: %x.patt: %pattern_type.7ce = binding_pattern x [concrete]
  174. // CHECK:STDOUT: %x.var_patt: %pattern_type.7ce = var_pattern %x.patt [concrete]
  175. // CHECK:STDOUT: }
  176. // CHECK:STDOUT: %x.var: ref %i32 = var %x.var_patt [concrete]
  177. // CHECK:STDOUT: %.loc4: type = splice_block %i32 [concrete = constants.%i32] {
  178. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  179. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  180. // CHECK:STDOUT: }
  181. // CHECK:STDOUT: %x: ref %i32 = bind_name x, %x.var [concrete = %x.var]
  182. // CHECK:STDOUT: %Main.decl: %Main.type = fn_decl @Main [concrete = constants.%Main] {} {}
  183. // CHECK:STDOUT: }
  184. // CHECK:STDOUT:
  185. // CHECK:STDOUT: fn @Main() {
  186. // CHECK:STDOUT: !entry:
  187. // CHECK:STDOUT: name_binding_decl {
  188. // CHECK:STDOUT: %x.patt: %pattern_type.7ce = binding_pattern x [concrete]
  189. // CHECK:STDOUT: %x.var_patt: %pattern_type.7ce = var_pattern %x.patt [concrete]
  190. // CHECK:STDOUT: }
  191. // CHECK:STDOUT: %x.var: ref %i32 = var %x.var_patt
  192. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  193. // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  194. // CHECK:STDOUT: %bound_method.loc7_3.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound.ab5]
  195. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  196. // CHECK:STDOUT: %bound_method.loc7_3.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method.9a1]
  197. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_3.2(%int_1) [concrete = constants.%int_1.5d2]
  198. // CHECK:STDOUT: %.loc7_3: init %i32 = converted %int_1, %int.convert_checked [concrete = constants.%int_1.5d2]
  199. // CHECK:STDOUT: assign %x.var, %.loc7_3
  200. // CHECK:STDOUT: %.loc7_10: type = splice_block %i32.loc7 [concrete = constants.%i32] {
  201. // CHECK:STDOUT: %int_32.loc7: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  202. // CHECK:STDOUT: %i32.loc7: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  203. // CHECK:STDOUT: }
  204. // CHECK:STDOUT: %x: ref %i32 = bind_name x, %x.var
  205. // CHECK:STDOUT: name_binding_decl {
  206. // CHECK:STDOUT: %y.patt: %pattern_type.7ce = binding_pattern y [concrete]
  207. // CHECK:STDOUT: %y.var_patt: %pattern_type.7ce = var_pattern %y.patt [concrete]
  208. // CHECK:STDOUT: }
  209. // CHECK:STDOUT: %y.var: ref %i32 = var %y.var_patt
  210. // CHECK:STDOUT: %package.ref: <namespace> = name_ref package, package [concrete = package]
  211. // CHECK:STDOUT: %x.ref: ref %i32 = name_ref x, file.%x [concrete = file.%x.var]
  212. // CHECK:STDOUT: %.loc9_23: %i32 = bind_value %x.ref
  213. // CHECK:STDOUT: assign %y.var, %.loc9_23
  214. // CHECK:STDOUT: %.loc9_10: type = splice_block %i32.loc9 [concrete = constants.%i32] {
  215. // CHECK:STDOUT: %int_32.loc9: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  216. // CHECK:STDOUT: %i32.loc9: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  217. // CHECK:STDOUT: }
  218. // CHECK:STDOUT: %y: ref %i32 = bind_name y, %y.var
  219. // CHECK:STDOUT: return
  220. // CHECK:STDOUT: }
  221. // CHECK:STDOUT:
  222. // CHECK:STDOUT: fn @__global_init() {
  223. // CHECK:STDOUT: !entry:
  224. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
  225. // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  226. // CHECK:STDOUT: %bound_method.loc4_1.1: <bound method> = bound_method %int_0, %impl.elem0 [concrete = constants.%Convert.bound.d04]
  227. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  228. // CHECK:STDOUT: %bound_method.loc4_1.2: <bound method> = bound_method %int_0, %specific_fn [concrete = constants.%bound_method.b6e]
  229. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc4_1.2(%int_0) [concrete = constants.%int_0.6a9]
  230. // CHECK:STDOUT: %.loc4: init %i32 = converted %int_0, %int.convert_checked [concrete = constants.%int_0.6a9]
  231. // CHECK:STDOUT: assign file.%x.var, %.loc4
  232. // CHECK:STDOUT: return
  233. // CHECK:STDOUT: }
  234. // CHECK:STDOUT:
  235. // CHECK:STDOUT: --- namespace.carbon
  236. // CHECK:STDOUT:
  237. // CHECK:STDOUT: constants {
  238. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  239. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [concrete]
  240. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  241. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [concrete]
  242. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  243. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  244. // CHECK:STDOUT: %Main.type: type = fn_type @Main [concrete]
  245. // CHECK:STDOUT: %Main: %Main.type = struct_value () [concrete]
  246. // CHECK:STDOUT: }
  247. // CHECK:STDOUT:
  248. // CHECK:STDOUT: imports {
  249. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  250. // CHECK:STDOUT: import Core//prelude
  251. // CHECK:STDOUT: import Core//prelude/...
  252. // CHECK:STDOUT: }
  253. // CHECK:STDOUT: }
  254. // CHECK:STDOUT:
  255. // CHECK:STDOUT: file {
  256. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  257. // CHECK:STDOUT: .Core = imports.%Core
  258. // CHECK:STDOUT: .NS = %NS
  259. // CHECK:STDOUT: .Main = %Main.decl
  260. // CHECK:STDOUT: }
  261. // CHECK:STDOUT: %Core.import = import Core
  262. // CHECK:STDOUT: %NS: <namespace> = namespace [concrete] {
  263. // CHECK:STDOUT: .C = %C.decl
  264. // CHECK:STDOUT: }
  265. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  266. // CHECK:STDOUT: %Main.decl: %Main.type = fn_decl @Main [concrete = constants.%Main] {} {}
  267. // CHECK:STDOUT: }
  268. // CHECK:STDOUT:
  269. // CHECK:STDOUT: class @C {
  270. // CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [concrete = constants.%Foo] {} {}
  271. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  272. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  273. // CHECK:STDOUT: complete_type_witness = %complete_type
  274. // CHECK:STDOUT:
  275. // CHECK:STDOUT: !members:
  276. // CHECK:STDOUT: .Self = constants.%C
  277. // CHECK:STDOUT: .Foo = %Foo.decl
  278. // CHECK:STDOUT: }
  279. // CHECK:STDOUT:
  280. // CHECK:STDOUT: fn @Foo() {
  281. // CHECK:STDOUT: !entry:
  282. // CHECK:STDOUT: return
  283. // CHECK:STDOUT: }
  284. // CHECK:STDOUT:
  285. // CHECK:STDOUT: fn @Main() {
  286. // CHECK:STDOUT: !entry:
  287. // CHECK:STDOUT: %package.ref: <namespace> = name_ref package, package [concrete = package]
  288. // CHECK:STDOUT: %NS.ref: <namespace> = name_ref NS, file.%NS [concrete = file.%NS]
  289. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  290. // CHECK:STDOUT: %Foo.ref: %Foo.type = name_ref Foo, @C.%Foo.decl [concrete = constants.%Foo]
  291. // CHECK:STDOUT: %Foo.call: init %empty_tuple.type = call %Foo.ref()
  292. // CHECK:STDOUT: return
  293. // CHECK:STDOUT: }
  294. // CHECK:STDOUT: