import_use_generic.carbon 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  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: --no-prelude-import --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/impl/import_use_generic.carbon
  11. // TIP: To dump output, run:
  12. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/import_use_generic.carbon
  13. // --- import_generic.carbon
  14. library "[[@TEST_NAME]]";
  15. class C(T:! type) {}
  16. interface I {
  17. fn F();
  18. }
  19. impl forall [T:! type] C(T) as I {
  20. fn F() {}
  21. }
  22. // --- fail_use_in_fn_decl.carbon
  23. library "[[@TEST_NAME]]";
  24. import library "import_generic";
  25. var c: C({}) = {};
  26. // We're just checking that this doesn't crash. It's not expected to compile.
  27. // CHECK:STDERR: fail_use_in_fn_decl.carbon:[[@LINE+8]]:11: error: `Core.ImplicitAs` implicitly referenced here, but package `Core` not found [CoreNotFound]
  28. // CHECK:STDERR: fn G() -> c.(I.F)() {}
  29. // CHECK:STDERR: ^~~~~~~
  30. // CHECK:STDERR:
  31. // CHECK:STDERR: fail_use_in_fn_decl.carbon:[[@LINE+4]]:22: error: missing `return` at end of function with declared return type [MissingReturnStatement]
  32. // CHECK:STDERR: fn G() -> c.(I.F)() {}
  33. // CHECK:STDERR: ^
  34. // CHECK:STDERR:
  35. fn G() -> c.(I.F)() {}
  36. // CHECK:STDERR: fail_use_in_fn_decl.carbon:[[@LINE+8]]:11: error: `Core.ImplicitAs` implicitly referenced here, but package `Core` not found [CoreNotFound]
  37. // CHECK:STDERR: fn H() -> C({}).(I.F)() {}
  38. // CHECK:STDERR: ^~~~~~~~~~~~~
  39. // CHECK:STDERR:
  40. // CHECK:STDERR: fail_use_in_fn_decl.carbon:[[@LINE+4]]:26: error: missing `return` at end of function with declared return type [MissingReturnStatement]
  41. // CHECK:STDERR: fn H() -> C({}).(I.F)() {}
  42. // CHECK:STDERR: ^
  43. // CHECK:STDERR:
  44. fn H() -> C({}).(I.F)() {}
  45. // CHECK:STDOUT: --- import_generic.carbon
  46. // CHECK:STDOUT:
  47. // CHECK:STDOUT: constants {
  48. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  49. // CHECK:STDOUT: %pattern_type: type = pattern_type type [concrete]
  50. // CHECK:STDOUT: %C.type: type = generic_class_type @C [concrete]
  51. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [concrete]
  52. // CHECK:STDOUT: %C: type = class_type @C, @C(%T) [symbolic]
  53. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  54. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  55. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  56. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  57. // CHECK:STDOUT: %F.type.cf0: type = fn_type @F.1 [concrete]
  58. // CHECK:STDOUT: %F.bc6: %F.type.cf0 = struct_value () [concrete]
  59. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  60. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%F.decl [concrete]
  61. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness file.%I.impl_witness_table, @impl(%T) [symbolic]
  62. // CHECK:STDOUT: %F.type.40c: type = fn_type @F.2, @impl(%T) [symbolic]
  63. // CHECK:STDOUT: %F.071: %F.type.40c = struct_value () [symbolic]
  64. // CHECK:STDOUT: %I.facet: %I.type = facet_value %C, (%I.impl_witness) [symbolic]
  65. // CHECK:STDOUT: }
  66. // CHECK:STDOUT:
  67. // CHECK:STDOUT: file {
  68. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  69. // CHECK:STDOUT: .C = %C.decl
  70. // CHECK:STDOUT: .I = %I.decl
  71. // CHECK:STDOUT: }
  72. // CHECK:STDOUT: %C.decl: %C.type = class_decl @C [concrete = constants.%C.generic] {
  73. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  74. // CHECK:STDOUT: } {
  75. // CHECK:STDOUT: %T.loc4_9.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_9.2 (constants.%T)]
  76. // CHECK:STDOUT: }
  77. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  78. // CHECK:STDOUT: impl_decl @impl [concrete] {
  79. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  80. // CHECK:STDOUT: } {
  81. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [concrete = constants.%C.generic]
  82. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc10_14.1 [symbolic = %T.loc10_14.2 (constants.%T)]
  83. // CHECK:STDOUT: %C.loc10_27.1: type = class_type @C, @C(constants.%T) [symbolic = %C.loc10_27.2 (constants.%C)]
  84. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  85. // CHECK:STDOUT: %T.loc10_14.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc10_14.2 (constants.%T)]
  86. // CHECK:STDOUT: }
  87. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (@impl.%F.decl), @impl [concrete]
  88. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table, @impl(constants.%T) [symbolic = @impl.%I.impl_witness (constants.%I.impl_witness)]
  89. // CHECK:STDOUT: }
  90. // CHECK:STDOUT:
  91. // CHECK:STDOUT: interface @I {
  92. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  93. // CHECK:STDOUT: %F.decl: %F.type.cf0 = fn_decl @F.1 [concrete = constants.%F.bc6] {} {}
  94. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %F.decl [concrete = constants.%assoc0]
  95. // CHECK:STDOUT:
  96. // CHECK:STDOUT: !members:
  97. // CHECK:STDOUT: .Self = %Self
  98. // CHECK:STDOUT: .F = %assoc0
  99. // CHECK:STDOUT: witness = (%F.decl)
  100. // CHECK:STDOUT: }
  101. // CHECK:STDOUT:
  102. // CHECK:STDOUT: generic impl @impl(%T.loc10_14.1: type) {
  103. // CHECK:STDOUT: %T.loc10_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc10_14.2 (constants.%T)]
  104. // CHECK:STDOUT: %C.loc10_27.2: type = class_type @C, @C(%T.loc10_14.2) [symbolic = %C.loc10_27.2 (constants.%C)]
  105. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness file.%I.impl_witness_table, @impl(%T.loc10_14.2) [symbolic = %I.impl_witness (constants.%I.impl_witness)]
  106. // CHECK:STDOUT:
  107. // CHECK:STDOUT: !definition:
  108. // CHECK:STDOUT: %F.type: type = fn_type @F.2, @impl(%T.loc10_14.2) [symbolic = %F.type (constants.%F.type.40c)]
  109. // CHECK:STDOUT: %F: @impl.%F.type (%F.type.40c) = struct_value () [symbolic = %F (constants.%F.071)]
  110. // CHECK:STDOUT:
  111. // CHECK:STDOUT: impl: %C.loc10_27.1 as %I.ref {
  112. // CHECK:STDOUT: %F.decl: @impl.%F.type (%F.type.40c) = fn_decl @F.2 [symbolic = @impl.%F (constants.%F.071)] {} {}
  113. // CHECK:STDOUT:
  114. // CHECK:STDOUT: !members:
  115. // CHECK:STDOUT: .F = %F.decl
  116. // CHECK:STDOUT: witness = file.%I.impl_witness
  117. // CHECK:STDOUT: }
  118. // CHECK:STDOUT: }
  119. // CHECK:STDOUT:
  120. // CHECK:STDOUT: generic class @C(%T.loc4_9.1: type) {
  121. // CHECK:STDOUT: %T.loc4_9.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_9.2 (constants.%T)]
  122. // CHECK:STDOUT:
  123. // CHECK:STDOUT: !definition:
  124. // CHECK:STDOUT:
  125. // CHECK:STDOUT: class {
  126. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  127. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  128. // CHECK:STDOUT: complete_type_witness = %complete_type
  129. // CHECK:STDOUT:
  130. // CHECK:STDOUT: !members:
  131. // CHECK:STDOUT: .Self = constants.%C
  132. // CHECK:STDOUT: }
  133. // CHECK:STDOUT: }
  134. // CHECK:STDOUT:
  135. // CHECK:STDOUT: generic fn @F.1(@I.%Self: %I.type) {
  136. // CHECK:STDOUT: fn();
  137. // CHECK:STDOUT: }
  138. // CHECK:STDOUT:
  139. // CHECK:STDOUT: generic fn @F.2(@impl.%T.loc10_14.1: type) {
  140. // CHECK:STDOUT: !definition:
  141. // CHECK:STDOUT:
  142. // CHECK:STDOUT: fn() {
  143. // CHECK:STDOUT: !entry:
  144. // CHECK:STDOUT: return
  145. // CHECK:STDOUT: }
  146. // CHECK:STDOUT: }
  147. // CHECK:STDOUT:
  148. // CHECK:STDOUT: specific @C(constants.%T) {
  149. // CHECK:STDOUT: %T.loc4_9.2 => constants.%T
  150. // CHECK:STDOUT: }
  151. // CHECK:STDOUT:
  152. // CHECK:STDOUT: specific @F.1(constants.%Self) {}
  153. // CHECK:STDOUT:
  154. // CHECK:STDOUT: specific @impl(constants.%T) {
  155. // CHECK:STDOUT: %T.loc10_14.2 => constants.%T
  156. // CHECK:STDOUT: %C.loc10_27.2 => constants.%C
  157. // CHECK:STDOUT: %I.impl_witness => constants.%I.impl_witness
  158. // CHECK:STDOUT:
  159. // CHECK:STDOUT: !definition:
  160. // CHECK:STDOUT: %F.type => constants.%F.type.40c
  161. // CHECK:STDOUT: %F => constants.%F.071
  162. // CHECK:STDOUT: }
  163. // CHECK:STDOUT:
  164. // CHECK:STDOUT: specific @F.2(constants.%T) {}
  165. // CHECK:STDOUT:
  166. // CHECK:STDOUT: specific @F.1(constants.%I.facet) {}
  167. // CHECK:STDOUT:
  168. // CHECK:STDOUT: --- fail_use_in_fn_decl.carbon
  169. // CHECK:STDOUT:
  170. // CHECK:STDOUT: constants {
  171. // CHECK:STDOUT: %C.type: type = generic_class_type @C [concrete]
  172. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  173. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [concrete]
  174. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  175. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  176. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  177. // CHECK:STDOUT: %C.f2e: type = class_type @C, @C(%T) [symbolic]
  178. // CHECK:STDOUT: %C.7a7: type = class_type @C, @C(%empty_struct_type) [concrete]
  179. // CHECK:STDOUT: %pattern_type.99a: type = pattern_type %C.7a7 [concrete]
  180. // CHECK:STDOUT: %C.val: %C.7a7 = struct_value () [concrete]
  181. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  182. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  183. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  184. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, imports.%Main.import_ref.e03 [concrete]
  185. // CHECK:STDOUT: %F.type.cf0: type = fn_type @F.1 [concrete]
  186. // CHECK:STDOUT: %F.bc6: %F.type.cf0 = struct_value () [concrete]
  187. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  188. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  189. // CHECK:STDOUT: %I.impl_witness.443: <witness> = impl_witness imports.%I.impl_witness_table, @impl(%T) [symbolic]
  190. // CHECK:STDOUT: %F.type.40c: type = fn_type @F.2, @impl(%T) [symbolic]
  191. // CHECK:STDOUT: %F.071: %F.type.40c = struct_value () [symbolic]
  192. // CHECK:STDOUT: %I.impl_witness.6bb: <witness> = impl_witness imports.%I.impl_witness_table, @impl(%empty_struct_type) [concrete]
  193. // CHECK:STDOUT: %F.type.4a4: type = fn_type @F.2, @impl(%empty_struct_type) [concrete]
  194. // CHECK:STDOUT: %F.9e6: %F.type.4a4 = struct_value () [concrete]
  195. // CHECK:STDOUT: %I.facet: %I.type = facet_value %C.7a7, (%I.impl_witness.6bb) [concrete]
  196. // CHECK:STDOUT: %.81d: type = fn_type_with_self_type %F.type.cf0, %I.facet [concrete]
  197. // CHECK:STDOUT: %F.specific_fn: <specific function> = specific_function %F.9e6, @F.2(%empty_struct_type) [concrete]
  198. // CHECK:STDOUT: %H.type: type = fn_type @H [concrete]
  199. // CHECK:STDOUT: %H: %H.type = struct_value () [concrete]
  200. // CHECK:STDOUT: }
  201. // CHECK:STDOUT:
  202. // CHECK:STDOUT: imports {
  203. // CHECK:STDOUT: %Main.C: %C.type = import_ref Main//import_generic, C, loaded [concrete = constants.%C.generic]
  204. // CHECK:STDOUT: %Main.I: type = import_ref Main//import_generic, I, loaded [concrete = constants.%I.type]
  205. // CHECK:STDOUT: %Main.import_ref.5ab3ec.1: type = import_ref Main//import_generic, loc4_9, loaded [symbolic = @C.%T (constants.%T)]
  206. // CHECK:STDOUT: %Main.import_ref.8f2: <witness> = import_ref Main//import_generic, loc4_20, loaded [concrete = constants.%complete_type]
  207. // CHECK:STDOUT: %Main.import_ref.4c0 = import_ref Main//import_generic, inst24 [no loc], unloaded
  208. // CHECK:STDOUT: %Main.import_ref.e5d = import_ref Main//import_generic, inst31 [no loc], unloaded
  209. // CHECK:STDOUT: %Main.import_ref.c44: %I.assoc_type = import_ref Main//import_generic, loc7_9, loaded [concrete = constants.%assoc0]
  210. // CHECK:STDOUT: %Main.F = import_ref Main//import_generic, F, unloaded
  211. // CHECK:STDOUT: %Main.import_ref.e03: %F.type.cf0 = import_ref Main//import_generic, loc7_9, loaded [concrete = constants.%F.bc6]
  212. // CHECK:STDOUT: %Main.import_ref.5dd: %I.type = import_ref Main//import_generic, inst31 [no loc], loaded [symbolic = constants.%Self]
  213. // CHECK:STDOUT: %Main.import_ref.6ac: <witness> = import_ref Main//import_generic, loc10_34, loaded [symbolic = @impl.%I.impl_witness (constants.%I.impl_witness.443)]
  214. // CHECK:STDOUT: %Main.import_ref.5ab3ec.2: type = import_ref Main//import_generic, loc10_14, loaded [symbolic = @impl.%T (constants.%T)]
  215. // CHECK:STDOUT: %Main.import_ref.499: type = import_ref Main//import_generic, loc10_27, loaded [symbolic = @impl.%C (constants.%C.f2e)]
  216. // CHECK:STDOUT: %Main.import_ref.301: type = import_ref Main//import_generic, loc10_32, loaded [concrete = constants.%I.type]
  217. // CHECK:STDOUT: %Main.import_ref.e2c: @impl.%F.type (%F.type.40c) = import_ref Main//import_generic, loc11_10, loaded [symbolic = @impl.%F (constants.%F.071)]
  218. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%Main.import_ref.e2c), @impl [concrete]
  219. // CHECK:STDOUT: %Main.import_ref.5ab3ec.3: type = import_ref Main//import_generic, loc10_14, loaded [symbolic = @impl.%T (constants.%T)]
  220. // CHECK:STDOUT: }
  221. // CHECK:STDOUT:
  222. // CHECK:STDOUT: file {
  223. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  224. // CHECK:STDOUT: .C = imports.%Main.C
  225. // CHECK:STDOUT: .I = imports.%Main.I
  226. // CHECK:STDOUT: .c = %c
  227. // CHECK:STDOUT: .G = %G.decl
  228. // CHECK:STDOUT: .H = %H.decl
  229. // CHECK:STDOUT: }
  230. // CHECK:STDOUT: %default.import = import <none>
  231. // CHECK:STDOUT: name_binding_decl {
  232. // CHECK:STDOUT: %c.patt: %pattern_type.99a = binding_pattern c [concrete]
  233. // CHECK:STDOUT: %c.var_patt: %pattern_type.99a = var_pattern %c.patt [concrete]
  234. // CHECK:STDOUT: }
  235. // CHECK:STDOUT: %c.var: ref %C.7a7 = var %c.var_patt [concrete]
  236. // CHECK:STDOUT: %.loc6_12.1: type = splice_block %C [concrete = constants.%C.7a7] {
  237. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%Main.C [concrete = constants.%C.generic]
  238. // CHECK:STDOUT: %.loc6_11: %empty_struct_type = struct_literal ()
  239. // CHECK:STDOUT: %.loc6_12.2: type = converted %.loc6_11, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  240. // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%empty_struct_type) [concrete = constants.%C.7a7]
  241. // CHECK:STDOUT: }
  242. // CHECK:STDOUT: %c: ref %C.7a7 = bind_name c, %c.var [concrete = %c.var]
  243. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {
  244. // CHECK:STDOUT: %return.patt: <error> = return_slot_pattern [concrete]
  245. // CHECK:STDOUT: %return.param_patt: <error> = out_param_pattern %return.patt, call_param0 [concrete]
  246. // CHECK:STDOUT: } {
  247. // CHECK:STDOUT: %c.ref: ref %C.7a7 = name_ref c, file.%c [concrete = file.%c.var]
  248. // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type]
  249. // CHECK:STDOUT: %F.ref: %I.assoc_type = name_ref F, imports.%Main.import_ref.c44 [concrete = constants.%assoc0]
  250. // CHECK:STDOUT: %.loc16: %I.type = converted %c.ref, <error> [concrete = <error>]
  251. // CHECK:STDOUT: %return.param: ref <error> = out_param call_param0
  252. // CHECK:STDOUT: %return: ref <error> = return_slot %return.param
  253. // CHECK:STDOUT: }
  254. // CHECK:STDOUT: %H.decl: %H.type = fn_decl @H [concrete = constants.%H] {
  255. // CHECK:STDOUT: %return.patt: <error> = return_slot_pattern [concrete]
  256. // CHECK:STDOUT: %return.param_patt: <error> = out_param_pattern %return.patt, call_param0 [concrete]
  257. // CHECK:STDOUT: } {
  258. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%Main.C [concrete = constants.%C.generic]
  259. // CHECK:STDOUT: %.loc25_14: %empty_struct_type = struct_literal ()
  260. // CHECK:STDOUT: %.loc25_15: type = converted %.loc25_14, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  261. // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%empty_struct_type) [concrete = constants.%C.7a7]
  262. // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type]
  263. // CHECK:STDOUT: %F.ref: %I.assoc_type = name_ref F, imports.%Main.import_ref.c44 [concrete = constants.%assoc0]
  264. // CHECK:STDOUT: %I.facet: %I.type = facet_value constants.%C.7a7, (constants.%I.impl_witness.6bb) [concrete = constants.%I.facet]
  265. // CHECK:STDOUT: %.loc25_16: %I.type = converted %C, %I.facet [concrete = constants.%I.facet]
  266. // CHECK:STDOUT: %impl.elem0: %.81d = impl_witness_access constants.%I.impl_witness.6bb, element0 [concrete = constants.%F.9e6]
  267. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @F.2(constants.%empty_struct_type) [concrete = constants.%F.specific_fn]
  268. // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %specific_fn()
  269. // CHECK:STDOUT: %.loc25_23.1: ref %empty_tuple.type = temporary_storage
  270. // CHECK:STDOUT: %.loc25_23.2: ref %empty_tuple.type = temporary %.loc25_23.1, %F.call
  271. // CHECK:STDOUT: %.loc25_23.3: type = converted %F.call, <error> [concrete = <error>]
  272. // CHECK:STDOUT: %return.param: ref <error> = out_param call_param0
  273. // CHECK:STDOUT: %return: ref <error> = return_slot %return.param
  274. // CHECK:STDOUT: }
  275. // CHECK:STDOUT: }
  276. // CHECK:STDOUT:
  277. // CHECK:STDOUT: interface @I [from "import_generic.carbon"] {
  278. // CHECK:STDOUT: !members:
  279. // CHECK:STDOUT: .Self = imports.%Main.import_ref.e5d
  280. // CHECK:STDOUT: .F = imports.%Main.import_ref.c44
  281. // CHECK:STDOUT: witness = (imports.%Main.F)
  282. // CHECK:STDOUT: }
  283. // CHECK:STDOUT:
  284. // CHECK:STDOUT: generic impl @impl(imports.%Main.import_ref.5ab3ec.2: type) [from "import_generic.carbon"] {
  285. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  286. // CHECK:STDOUT: %C: type = class_type @C, @C(%T) [symbolic = %C (constants.%C.f2e)]
  287. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness imports.%I.impl_witness_table, @impl(%T) [symbolic = %I.impl_witness (constants.%I.impl_witness.443)]
  288. // CHECK:STDOUT:
  289. // CHECK:STDOUT: !definition:
  290. // CHECK:STDOUT: %F.type: type = fn_type @F.2, @impl(%T) [symbolic = %F.type (constants.%F.type.40c)]
  291. // CHECK:STDOUT: %F: @impl.%F.type (%F.type.40c) = struct_value () [symbolic = %F (constants.%F.071)]
  292. // CHECK:STDOUT:
  293. // CHECK:STDOUT: impl: imports.%Main.import_ref.499 as imports.%Main.import_ref.301 {
  294. // CHECK:STDOUT: !members:
  295. // CHECK:STDOUT: witness = imports.%Main.import_ref.6ac
  296. // CHECK:STDOUT: }
  297. // CHECK:STDOUT: }
  298. // CHECK:STDOUT:
  299. // CHECK:STDOUT: generic class @C(imports.%Main.import_ref.5ab3ec.1: type) [from "import_generic.carbon"] {
  300. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  301. // CHECK:STDOUT:
  302. // CHECK:STDOUT: !definition:
  303. // CHECK:STDOUT:
  304. // CHECK:STDOUT: class {
  305. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f2
  306. // CHECK:STDOUT:
  307. // CHECK:STDOUT: !members:
  308. // CHECK:STDOUT: .Self = imports.%Main.import_ref.4c0
  309. // CHECK:STDOUT: }
  310. // CHECK:STDOUT: }
  311. // CHECK:STDOUT:
  312. // CHECK:STDOUT: generic fn @F.1(imports.%Main.import_ref.5dd: %I.type) [from "import_generic.carbon"] {
  313. // CHECK:STDOUT: fn;
  314. // CHECK:STDOUT: }
  315. // CHECK:STDOUT:
  316. // CHECK:STDOUT: fn @G() -> <error> {
  317. // CHECK:STDOUT: !entry:
  318. // CHECK:STDOUT: }
  319. // CHECK:STDOUT:
  320. // CHECK:STDOUT: generic fn @F.2(imports.%Main.import_ref.5ab3ec.3: type) [from "import_generic.carbon"] {
  321. // CHECK:STDOUT: !definition:
  322. // CHECK:STDOUT:
  323. // CHECK:STDOUT: fn;
  324. // CHECK:STDOUT: }
  325. // CHECK:STDOUT:
  326. // CHECK:STDOUT: fn @H() -> <error> {
  327. // CHECK:STDOUT: !entry:
  328. // CHECK:STDOUT: }
  329. // CHECK:STDOUT:
  330. // CHECK:STDOUT: fn @__global_init() {
  331. // CHECK:STDOUT: !entry:
  332. // CHECK:STDOUT: %.loc6_17.1: %empty_struct_type = struct_literal ()
  333. // CHECK:STDOUT: %.loc6_17.2: init %C.7a7 = class_init (), file.%c.var [concrete = constants.%C.val]
  334. // CHECK:STDOUT: %.loc6_1: init %C.7a7 = converted %.loc6_17.1, %.loc6_17.2 [concrete = constants.%C.val]
  335. // CHECK:STDOUT: assign file.%c.var, %.loc6_1
  336. // CHECK:STDOUT: return
  337. // CHECK:STDOUT: }
  338. // CHECK:STDOUT:
  339. // CHECK:STDOUT: specific @C(constants.%T) {
  340. // CHECK:STDOUT: %T => constants.%T
  341. // CHECK:STDOUT: }
  342. // CHECK:STDOUT:
  343. // CHECK:STDOUT: specific @C(constants.%empty_struct_type) {
  344. // CHECK:STDOUT: %T => constants.%empty_struct_type
  345. // CHECK:STDOUT:
  346. // CHECK:STDOUT: !definition:
  347. // CHECK:STDOUT: }
  348. // CHECK:STDOUT:
  349. // CHECK:STDOUT: specific @F.1(constants.%Self) {}
  350. // CHECK:STDOUT:
  351. // CHECK:STDOUT: specific @impl(constants.%T) {
  352. // CHECK:STDOUT: %T => constants.%T
  353. // CHECK:STDOUT: %C => constants.%C.f2e
  354. // CHECK:STDOUT: %I.impl_witness => constants.%I.impl_witness.443
  355. // CHECK:STDOUT:
  356. // CHECK:STDOUT: !definition:
  357. // CHECK:STDOUT: %F.type => constants.%F.type.40c
  358. // CHECK:STDOUT: %F => constants.%F.071
  359. // CHECK:STDOUT: }
  360. // CHECK:STDOUT:
  361. // CHECK:STDOUT: specific @F.2(constants.%T) {}
  362. // CHECK:STDOUT:
  363. // CHECK:STDOUT: specific @impl(constants.%empty_struct_type) {
  364. // CHECK:STDOUT: %T => constants.%empty_struct_type
  365. // CHECK:STDOUT: %C => constants.%C.7a7
  366. // CHECK:STDOUT: %I.impl_witness => constants.%I.impl_witness.6bb
  367. // CHECK:STDOUT:
  368. // CHECK:STDOUT: !definition:
  369. // CHECK:STDOUT: %F.type => constants.%F.type.4a4
  370. // CHECK:STDOUT: %F => constants.%F.9e6
  371. // CHECK:STDOUT: }
  372. // CHECK:STDOUT:
  373. // CHECK:STDOUT: specific @F.2(constants.%empty_struct_type) {
  374. // CHECK:STDOUT: !definition:
  375. // CHECK:STDOUT: }
  376. // CHECK:STDOUT: