import_use_generic.carbon 19 KB

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