import_generic.carbon 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798
  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_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_generic.carbon
  10. // --- import_generic.carbon
  11. library "[[@TEST_NAME]]";
  12. class C {}
  13. interface I(T:! type) {}
  14. // Has both declaration and definition.
  15. impl forall [T:! type] C as I(T);
  16. impl forall [T:! type] C as I(T) {}
  17. // Only has definition.
  18. impl forall [T:! type] C as I(T*) {}
  19. // --- fail_import_generic.impl.carbon
  20. impl library "[[@TEST_NAME]]";
  21. // CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl]
  22. // CHECK:STDERR: impl forall [T:! type] C as I(T);
  23. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  24. // CHECK:STDERR:
  25. impl forall [T:! type] C as I(T);
  26. // CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl]
  27. // CHECK:STDERR: impl forall [T:! type] C as I(T) {}
  28. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  29. // CHECK:STDERR:
  30. impl forall [T:! type] C as I(T) {}
  31. // CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl]
  32. // CHECK:STDERR: impl forall [T:! type] C as I(T*);
  33. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  34. // CHECK:STDERR:
  35. impl forall [T:! type] C as I(T*);
  36. // CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl]
  37. // CHECK:STDERR: impl forall [T:! type] C as I(T*) {}
  38. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  39. // CHECK:STDERR:
  40. impl forall [T:! type] C as I(T*) {}
  41. // --- fail_import_generic_decl.carbon
  42. library "[[@TEST_NAME]]";
  43. class D {}
  44. interface J(T:! type) {}
  45. // CHECK:STDERR: fail_import_generic_decl.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition]
  46. // CHECK:STDERR: impl forall [T:! type] D as J(T);
  47. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  48. // CHECK:STDERR:
  49. impl forall [T:! type] D as J(T);
  50. // CHECK:STDERR: fail_import_generic_decl.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition]
  51. // CHECK:STDERR: impl forall [T:! type] D as J(T*);
  52. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  53. // CHECK:STDERR:
  54. impl forall [T:! type] D as J(T*);
  55. // --- fail_import_generic_decl.impl.carbon
  56. impl library "[[@TEST_NAME]]";
  57. // CHECK:STDERR: fail_import_generic_decl.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl]
  58. // CHECK:STDERR: impl forall [T:! type] D as J(T);
  59. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  60. // CHECK:STDERR:
  61. impl forall [T:! type] D as J(T);
  62. // CHECK:STDERR: fail_import_generic_decl.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl]
  63. // CHECK:STDERR: impl forall [T:! type] D as J(T) {}
  64. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  65. // CHECK:STDERR:
  66. impl forall [T:! type] D as J(T) {}
  67. // CHECK:STDERR: fail_import_generic_decl.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl]
  68. // CHECK:STDERR: impl forall [T:! type] D as J(T*);
  69. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  70. // CHECK:STDERR:
  71. impl forall [T:! type] D as J(T*);
  72. // CHECK:STDERR: fail_import_generic_decl.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl]
  73. // CHECK:STDERR: impl forall [T:! type] D as J(T*) {}
  74. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  75. // CHECK:STDERR:
  76. impl forall [T:! type] D as J(T*) {}
  77. // CHECK:STDOUT: --- import_generic.carbon
  78. // CHECK:STDOUT:
  79. // CHECK:STDOUT: constants {
  80. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  81. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  82. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  83. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  84. // CHECK:STDOUT: %pattern_type: type = pattern_type type [concrete]
  85. // CHECK:STDOUT: %I.type.dac: type = generic_interface_type @I [concrete]
  86. // CHECK:STDOUT: %I.generic: %I.type.dac = struct_value () [concrete]
  87. // CHECK:STDOUT: %I.type.325: type = facet_type <@I, @I(%T)> [symbolic]
  88. // CHECK:STDOUT: %Self.209: %I.type.325 = bind_symbolic_name Self, 1 [symbolic]
  89. // CHECK:STDOUT: %I.impl_witness.1a9: <witness> = impl_witness file.%I.impl_witness_table.loc8, @impl.084(%T) [symbolic]
  90. // CHECK:STDOUT: %require_complete.cfe: <witness> = require_complete_type %I.type.325 [symbolic]
  91. // CHECK:STDOUT: %ptr: type = ptr_type %T [symbolic]
  92. // CHECK:STDOUT: %I.type.0e2: type = facet_type <@I, @I(%ptr)> [symbolic]
  93. // CHECK:STDOUT: %Self.fb4: %I.type.0e2 = bind_symbolic_name Self, 1 [symbolic]
  94. // CHECK:STDOUT: %require_complete.0e6: <witness> = require_complete_type %I.type.0e2 [symbolic]
  95. // CHECK:STDOUT: %I.impl_witness.6ad: <witness> = impl_witness file.%I.impl_witness_table.loc12, @impl.cd2(%T) [symbolic]
  96. // CHECK:STDOUT: }
  97. // CHECK:STDOUT:
  98. // CHECK:STDOUT: file {
  99. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  100. // CHECK:STDOUT: .C = %C.decl
  101. // CHECK:STDOUT: .I = %I.decl
  102. // CHECK:STDOUT: }
  103. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  104. // CHECK:STDOUT: %I.decl: %I.type.dac = interface_decl @I [concrete = constants.%I.generic] {
  105. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  106. // CHECK:STDOUT: } {
  107. // CHECK:STDOUT: %T.loc5_13.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc5_13.2 (constants.%T)]
  108. // CHECK:STDOUT: }
  109. // CHECK:STDOUT: impl_decl @impl.084 [concrete] {
  110. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  111. // CHECK:STDOUT: } {
  112. // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, file.%C.decl [concrete = constants.%C]
  113. // CHECK:STDOUT: %I.ref.loc8: %I.type.dac = name_ref I, file.%I.decl [concrete = constants.%I.generic]
  114. // CHECK:STDOUT: %T.ref.loc8: type = name_ref T, %T.loc8_14.1 [symbolic = %T.loc8_14.2 (constants.%T)]
  115. // CHECK:STDOUT: %I.type.loc8_32.1: type = facet_type <@I, @I(constants.%T)> [symbolic = %I.type.loc8_32.2 (constants.%I.type.325)]
  116. // CHECK:STDOUT: %T.loc8_14.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc8_14.2 (constants.%T)]
  117. // CHECK:STDOUT: }
  118. // CHECK:STDOUT: %I.impl_witness_table.loc8 = impl_witness_table (), @impl.084 [concrete]
  119. // CHECK:STDOUT: %I.impl_witness.loc8: <witness> = impl_witness %I.impl_witness_table.loc8, @impl.084(constants.%T) [symbolic = @impl.084.%I.impl_witness (constants.%I.impl_witness.1a9)]
  120. // CHECK:STDOUT: impl_decl @impl.084 [concrete] {
  121. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  122. // CHECK:STDOUT: } {
  123. // CHECK:STDOUT: %C.ref.loc9: type = name_ref C, file.%C.decl [concrete = constants.%C]
  124. // CHECK:STDOUT: %I.ref.loc9: %I.type.dac = name_ref I, file.%I.decl [concrete = constants.%I.generic]
  125. // CHECK:STDOUT: %T.ref.loc9: type = name_ref T, %T.loc9 [symbolic = %T.loc8_14.2 (constants.%T)]
  126. // CHECK:STDOUT: %I.type.loc9: type = facet_type <@I, @I(constants.%T)> [symbolic = %I.type.loc8_32.2 (constants.%I.type.325)]
  127. // CHECK:STDOUT: %T.loc9: type = bind_symbolic_name T, 0 [symbolic = %T.loc8_14.2 (constants.%T)]
  128. // CHECK:STDOUT: }
  129. // CHECK:STDOUT: impl_decl @impl.cd2 [concrete] {
  130. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  131. // CHECK:STDOUT: } {
  132. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  133. // CHECK:STDOUT: %I.ref: %I.type.dac = name_ref I, file.%I.decl [concrete = constants.%I.generic]
  134. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc12_14.1 [symbolic = %T.loc12_14.2 (constants.%T)]
  135. // CHECK:STDOUT: %ptr.loc12_32.1: type = ptr_type %T.ref [symbolic = %ptr.loc12_32.2 (constants.%ptr)]
  136. // CHECK:STDOUT: %I.type.loc12_33.1: type = facet_type <@I, @I(constants.%ptr)> [symbolic = %I.type.loc12_33.2 (constants.%I.type.0e2)]
  137. // CHECK:STDOUT: %T.loc12_14.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc12_14.2 (constants.%T)]
  138. // CHECK:STDOUT: }
  139. // CHECK:STDOUT: %I.impl_witness_table.loc12 = impl_witness_table (), @impl.cd2 [concrete]
  140. // CHECK:STDOUT: %I.impl_witness.loc12: <witness> = impl_witness %I.impl_witness_table.loc12, @impl.cd2(constants.%T) [symbolic = @impl.cd2.%I.impl_witness (constants.%I.impl_witness.6ad)]
  141. // CHECK:STDOUT: }
  142. // CHECK:STDOUT:
  143. // CHECK:STDOUT: generic interface @I(%T.loc5_13.1: type) {
  144. // CHECK:STDOUT: %T.loc5_13.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc5_13.2 (constants.%T)]
  145. // CHECK:STDOUT:
  146. // CHECK:STDOUT: !definition:
  147. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T.loc5_13.2)> [symbolic = %I.type (constants.%I.type.325)]
  148. // CHECK:STDOUT: %Self.2: @I.%I.type (%I.type.325) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.209)]
  149. // CHECK:STDOUT:
  150. // CHECK:STDOUT: interface {
  151. // CHECK:STDOUT: %Self.1: @I.%I.type (%I.type.325) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.209)]
  152. // CHECK:STDOUT:
  153. // CHECK:STDOUT: !members:
  154. // CHECK:STDOUT: .Self = %Self.1
  155. // CHECK:STDOUT: witness = ()
  156. // CHECK:STDOUT: }
  157. // CHECK:STDOUT: }
  158. // CHECK:STDOUT:
  159. // CHECK:STDOUT: generic impl @impl.084(%T.loc8_14.1: type) {
  160. // CHECK:STDOUT: %T.loc8_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc8_14.2 (constants.%T)]
  161. // CHECK:STDOUT: %I.type.loc8_32.2: type = facet_type <@I, @I(%T.loc8_14.2)> [symbolic = %I.type.loc8_32.2 (constants.%I.type.325)]
  162. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness file.%I.impl_witness_table.loc8, @impl.084(%T.loc8_14.2) [symbolic = %I.impl_witness (constants.%I.impl_witness.1a9)]
  163. // CHECK:STDOUT:
  164. // CHECK:STDOUT: !definition:
  165. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %I.type.loc8_32.2 [symbolic = %require_complete (constants.%require_complete.cfe)]
  166. // CHECK:STDOUT:
  167. // CHECK:STDOUT: impl: %C.ref.loc8 as %I.type.loc8_32.1 {
  168. // CHECK:STDOUT: !members:
  169. // CHECK:STDOUT: witness = file.%I.impl_witness.loc8
  170. // CHECK:STDOUT: }
  171. // CHECK:STDOUT: }
  172. // CHECK:STDOUT:
  173. // CHECK:STDOUT: generic impl @impl.cd2(%T.loc12_14.1: type) {
  174. // CHECK:STDOUT: %T.loc12_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc12_14.2 (constants.%T)]
  175. // CHECK:STDOUT: %ptr.loc12_32.2: type = ptr_type %T.loc12_14.2 [symbolic = %ptr.loc12_32.2 (constants.%ptr)]
  176. // CHECK:STDOUT: %I.type.loc12_33.2: type = facet_type <@I, @I(%ptr.loc12_32.2)> [symbolic = %I.type.loc12_33.2 (constants.%I.type.0e2)]
  177. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %I.type.loc12_33.2 [symbolic = %require_complete (constants.%require_complete.0e6)]
  178. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness file.%I.impl_witness_table.loc12, @impl.cd2(%T.loc12_14.2) [symbolic = %I.impl_witness (constants.%I.impl_witness.6ad)]
  179. // CHECK:STDOUT:
  180. // CHECK:STDOUT: !definition:
  181. // CHECK:STDOUT:
  182. // CHECK:STDOUT: impl: %C.ref as %I.type.loc12_33.1 {
  183. // CHECK:STDOUT: !members:
  184. // CHECK:STDOUT: witness = file.%I.impl_witness.loc12
  185. // CHECK:STDOUT: }
  186. // CHECK:STDOUT: }
  187. // CHECK:STDOUT:
  188. // CHECK:STDOUT: class @C {
  189. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  190. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  191. // CHECK:STDOUT: complete_type_witness = %complete_type
  192. // CHECK:STDOUT:
  193. // CHECK:STDOUT: !members:
  194. // CHECK:STDOUT: .Self = constants.%C
  195. // CHECK:STDOUT: }
  196. // CHECK:STDOUT:
  197. // CHECK:STDOUT: specific @I(constants.%T) {
  198. // CHECK:STDOUT: %T.loc5_13.2 => constants.%T
  199. // CHECK:STDOUT:
  200. // CHECK:STDOUT: !definition:
  201. // CHECK:STDOUT: %I.type => constants.%I.type.325
  202. // CHECK:STDOUT: %Self.2 => constants.%Self.209
  203. // CHECK:STDOUT: }
  204. // CHECK:STDOUT:
  205. // CHECK:STDOUT: specific @impl.084(constants.%T) {
  206. // CHECK:STDOUT: %T.loc8_14.2 => constants.%T
  207. // CHECK:STDOUT: %I.type.loc8_32.2 => constants.%I.type.325
  208. // CHECK:STDOUT: %I.impl_witness => constants.%I.impl_witness.1a9
  209. // CHECK:STDOUT: }
  210. // CHECK:STDOUT:
  211. // CHECK:STDOUT: specific @I(constants.%ptr) {
  212. // CHECK:STDOUT: %T.loc5_13.2 => constants.%ptr
  213. // CHECK:STDOUT:
  214. // CHECK:STDOUT: !definition:
  215. // CHECK:STDOUT: %I.type => constants.%I.type.0e2
  216. // CHECK:STDOUT: %Self.2 => constants.%Self.fb4
  217. // CHECK:STDOUT: }
  218. // CHECK:STDOUT:
  219. // CHECK:STDOUT: specific @impl.cd2(constants.%T) {
  220. // CHECK:STDOUT: %T.loc12_14.2 => constants.%T
  221. // CHECK:STDOUT: %ptr.loc12_32.2 => constants.%ptr
  222. // CHECK:STDOUT: %I.type.loc12_33.2 => constants.%I.type.0e2
  223. // CHECK:STDOUT: %require_complete => constants.%require_complete.0e6
  224. // CHECK:STDOUT: %I.impl_witness => constants.%I.impl_witness.6ad
  225. // CHECK:STDOUT: }
  226. // CHECK:STDOUT:
  227. // CHECK:STDOUT: --- fail_import_generic.impl.carbon
  228. // CHECK:STDOUT:
  229. // CHECK:STDOUT: constants {
  230. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  231. // CHECK:STDOUT: %I.type.dac: type = generic_interface_type @I [concrete]
  232. // CHECK:STDOUT: %I.generic: %I.type.dac = struct_value () [concrete]
  233. // CHECK:STDOUT: %I.type.325: type = facet_type <@I, @I(%T)> [symbolic]
  234. // CHECK:STDOUT: %Self.209: %I.type.325 = bind_symbolic_name Self, 1 [symbolic]
  235. // CHECK:STDOUT: %pattern_type: type = pattern_type type [concrete]
  236. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  237. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  238. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  239. // CHECK:STDOUT: %I.impl_witness.1a9: <witness> = impl_witness imports.%I.impl_witness_table.028, @impl.08450a.1(%T) [symbolic]
  240. // CHECK:STDOUT: %require_complete.cfe: <witness> = require_complete_type %I.type.325 [symbolic]
  241. // CHECK:STDOUT: %ptr: type = ptr_type %T [symbolic]
  242. // CHECK:STDOUT: %I.type.0e2: type = facet_type <@I, @I(%ptr)> [symbolic]
  243. // CHECK:STDOUT: %require_complete.0e6: <witness> = require_complete_type %I.type.0e2 [symbolic]
  244. // CHECK:STDOUT: %I.impl_witness.6ad: <witness> = impl_witness imports.%I.impl_witness_table.e14, @impl.cd2fdc.1(%T) [symbolic]
  245. // CHECK:STDOUT: %Self.fb4: %I.type.0e2 = bind_symbolic_name Self, 1 [symbolic]
  246. // CHECK:STDOUT: }
  247. // CHECK:STDOUT:
  248. // CHECK:STDOUT: imports {
  249. // CHECK:STDOUT: %Main.C: type = import_ref Main//import_generic, C, loaded [concrete = constants.%C]
  250. // CHECK:STDOUT: %Main.I: %I.type.dac = import_ref Main//import_generic, I, loaded [concrete = constants.%I.generic]
  251. // CHECK:STDOUT: %Main.import_ref.5ab3ec.1: type = import_ref Main//import_generic, loc5_13, loaded [symbolic = @I.%T (constants.%T)]
  252. // CHECK:STDOUT: %Main.import_ref.884 = import_ref Main//import_generic, inst31 [no loc], unloaded
  253. // CHECK:STDOUT: %Main.import_ref.cc6 = import_ref Main//import_generic, loc8_33, unloaded
  254. // CHECK:STDOUT: %Main.import_ref.8f2: <witness> = import_ref Main//import_generic, loc4_10, loaded [concrete = constants.%complete_type]
  255. // CHECK:STDOUT: %Main.import_ref.2c4 = import_ref Main//import_generic, inst16 [no loc], unloaded
  256. // CHECK:STDOUT: %Main.import_ref.5ab3ec.2: type = import_ref Main//import_generic, loc8_14, loaded [symbolic = @impl.08450a.1.%T (constants.%T)]
  257. // CHECK:STDOUT: %Main.import_ref.29aca8.1: type = import_ref Main//import_generic, loc8_24, loaded [concrete = constants.%C]
  258. // CHECK:STDOUT: %Main.import_ref.4be: type = import_ref Main//import_generic, loc8_32, loaded [symbolic = @impl.08450a.1.%I.type (constants.%I.type.325)]
  259. // CHECK:STDOUT: %I.impl_witness_table.028 = impl_witness_table (), @impl.08450a.1 [concrete]
  260. // CHECK:STDOUT: %Main.import_ref.fc2 = import_ref Main//import_generic, loc12_35, unloaded
  261. // CHECK:STDOUT: %Main.import_ref.5ab3ec.3: type = import_ref Main//import_generic, loc12_14, loaded [symbolic = @impl.cd2fdc.1.%T (constants.%T)]
  262. // CHECK:STDOUT: %Main.import_ref.29aca8.2: type = import_ref Main//import_generic, loc12_24, loaded [concrete = constants.%C]
  263. // CHECK:STDOUT: %Main.import_ref.3e2: type = import_ref Main//import_generic, loc12_33, loaded [symbolic = @impl.cd2fdc.1.%I.type (constants.%I.type.0e2)]
  264. // CHECK:STDOUT: %I.impl_witness_table.e14 = impl_witness_table (), @impl.cd2fdc.1 [concrete]
  265. // CHECK:STDOUT: }
  266. // CHECK:STDOUT:
  267. // CHECK:STDOUT: file {
  268. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  269. // CHECK:STDOUT: .C = imports.%Main.C
  270. // CHECK:STDOUT: .I = imports.%Main.I
  271. // CHECK:STDOUT: }
  272. // CHECK:STDOUT: %default.import.loc2_30.1 = import <none>
  273. // CHECK:STDOUT: %default.import.loc2_30.2 = import <none>
  274. // CHECK:STDOUT: impl_decl @impl.08450a.2 [concrete] {
  275. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  276. // CHECK:STDOUT: } {
  277. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C]
  278. // CHECK:STDOUT: %I.ref: %I.type.dac = name_ref I, imports.%Main.I [concrete = constants.%I.generic]
  279. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc8_14.1 [symbolic = %T.loc8_14.2 (constants.%T)]
  280. // CHECK:STDOUT: %I.type.loc8_32.1: type = facet_type <@I, @I(constants.%T)> [symbolic = %I.type.loc8_32.2 (constants.%I.type.325)]
  281. // CHECK:STDOUT: %T.loc8_14.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc8_14.2 (constants.%T)]
  282. // CHECK:STDOUT: }
  283. // CHECK:STDOUT: impl_decl @impl.08450a.3 [concrete] {
  284. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  285. // CHECK:STDOUT: } {
  286. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C]
  287. // CHECK:STDOUT: %I.ref: %I.type.dac = name_ref I, imports.%Main.I [concrete = constants.%I.generic]
  288. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc14_14.1 [symbolic = %T.loc14_14.2 (constants.%T)]
  289. // CHECK:STDOUT: %I.type.loc14_32.1: type = facet_type <@I, @I(constants.%T)> [symbolic = %I.type.loc14_32.2 (constants.%I.type.325)]
  290. // CHECK:STDOUT: %T.loc14_14.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc14_14.2 (constants.%T)]
  291. // CHECK:STDOUT: }
  292. // CHECK:STDOUT: impl_decl @impl.cd2fdc.2 [concrete] {
  293. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  294. // CHECK:STDOUT: } {
  295. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C]
  296. // CHECK:STDOUT: %I.ref: %I.type.dac = name_ref I, imports.%Main.I [concrete = constants.%I.generic]
  297. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc20_14.1 [symbolic = %T.loc20_14.2 (constants.%T)]
  298. // CHECK:STDOUT: %ptr.loc20_32.1: type = ptr_type %T.ref [symbolic = %ptr.loc20_32.2 (constants.%ptr)]
  299. // CHECK:STDOUT: %I.type.loc20_33.1: type = facet_type <@I, @I(constants.%ptr)> [symbolic = %I.type.loc20_33.2 (constants.%I.type.0e2)]
  300. // CHECK:STDOUT: %T.loc20_14.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc20_14.2 (constants.%T)]
  301. // CHECK:STDOUT: }
  302. // CHECK:STDOUT: impl_decl @impl.cd2fdc.3 [concrete] {
  303. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  304. // CHECK:STDOUT: } {
  305. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C]
  306. // CHECK:STDOUT: %I.ref: %I.type.dac = name_ref I, imports.%Main.I [concrete = constants.%I.generic]
  307. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc26_14.1 [symbolic = %T.loc26_14.2 (constants.%T)]
  308. // CHECK:STDOUT: %ptr.loc26_32.1: type = ptr_type %T.ref [symbolic = %ptr.loc26_32.2 (constants.%ptr)]
  309. // CHECK:STDOUT: %I.type.loc26_33.1: type = facet_type <@I, @I(constants.%ptr)> [symbolic = %I.type.loc26_33.2 (constants.%I.type.0e2)]
  310. // CHECK:STDOUT: %T.loc26_14.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc26_14.2 (constants.%T)]
  311. // CHECK:STDOUT: }
  312. // CHECK:STDOUT: }
  313. // CHECK:STDOUT:
  314. // CHECK:STDOUT: generic interface @I(imports.%Main.import_ref.5ab3ec.1: type) [from "import_generic.carbon"] {
  315. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  316. // CHECK:STDOUT:
  317. // CHECK:STDOUT: !definition:
  318. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T)> [symbolic = %I.type (constants.%I.type.325)]
  319. // CHECK:STDOUT: %Self: @I.%I.type (%I.type.325) = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.209)]
  320. // CHECK:STDOUT:
  321. // CHECK:STDOUT: interface {
  322. // CHECK:STDOUT: !members:
  323. // CHECK:STDOUT: .Self = imports.%Main.import_ref.884
  324. // CHECK:STDOUT: witness = ()
  325. // CHECK:STDOUT: }
  326. // CHECK:STDOUT: }
  327. // CHECK:STDOUT:
  328. // CHECK:STDOUT: generic impl @impl.08450a.1(imports.%Main.import_ref.5ab3ec.2: type) [from "import_generic.carbon"] {
  329. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  330. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T)> [symbolic = %I.type (constants.%I.type.325)]
  331. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness imports.%I.impl_witness_table.028, @impl.08450a.1(%T) [symbolic = %I.impl_witness (constants.%I.impl_witness.1a9)]
  332. // CHECK:STDOUT:
  333. // CHECK:STDOUT: !definition:
  334. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %I.type [symbolic = %require_complete (constants.%require_complete.cfe)]
  335. // CHECK:STDOUT:
  336. // CHECK:STDOUT: impl: imports.%Main.import_ref.29aca8.1 as imports.%Main.import_ref.4be {
  337. // CHECK:STDOUT: !members:
  338. // CHECK:STDOUT: witness = imports.%Main.import_ref.cc6
  339. // CHECK:STDOUT: }
  340. // CHECK:STDOUT: }
  341. // CHECK:STDOUT:
  342. // CHECK:STDOUT: generic impl @impl.cd2fdc.1(imports.%Main.import_ref.5ab3ec.3: type) [from "import_generic.carbon"] {
  343. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  344. // CHECK:STDOUT: %ptr: type = ptr_type %T [symbolic = %ptr (constants.%ptr)]
  345. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%ptr)> [symbolic = %I.type (constants.%I.type.0e2)]
  346. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %I.type [symbolic = %require_complete (constants.%require_complete.0e6)]
  347. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness imports.%I.impl_witness_table.e14, @impl.cd2fdc.1(%T) [symbolic = %I.impl_witness (constants.%I.impl_witness.6ad)]
  348. // CHECK:STDOUT:
  349. // CHECK:STDOUT: !definition:
  350. // CHECK:STDOUT:
  351. // CHECK:STDOUT: impl: imports.%Main.import_ref.29aca8.2 as imports.%Main.import_ref.3e2 {
  352. // CHECK:STDOUT: !members:
  353. // CHECK:STDOUT: witness = imports.%Main.import_ref.fc2
  354. // CHECK:STDOUT: }
  355. // CHECK:STDOUT: }
  356. // CHECK:STDOUT:
  357. // CHECK:STDOUT: generic impl @impl.08450a.2(%T.loc8_14.1: type) {
  358. // CHECK:STDOUT: %T.loc8_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc8_14.2 (constants.%T)]
  359. // CHECK:STDOUT: %I.type.loc8_32.2: type = facet_type <@I, @I(%T.loc8_14.2)> [symbolic = %I.type.loc8_32.2 (constants.%I.type.325)]
  360. // CHECK:STDOUT:
  361. // CHECK:STDOUT: impl: %C.ref as %I.type.loc8_32.1;
  362. // CHECK:STDOUT: }
  363. // CHECK:STDOUT:
  364. // CHECK:STDOUT: generic impl @impl.08450a.3(%T.loc14_14.1: type) {
  365. // CHECK:STDOUT: %T.loc14_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc14_14.2 (constants.%T)]
  366. // CHECK:STDOUT: %I.type.loc14_32.2: type = facet_type <@I, @I(%T.loc14_14.2)> [symbolic = %I.type.loc14_32.2 (constants.%I.type.325)]
  367. // CHECK:STDOUT:
  368. // CHECK:STDOUT: !definition:
  369. // CHECK:STDOUT:
  370. // CHECK:STDOUT: impl: %C.ref as %I.type.loc14_32.1 {
  371. // CHECK:STDOUT: !members:
  372. // CHECK:STDOUT: witness = <error>
  373. // CHECK:STDOUT: }
  374. // CHECK:STDOUT: }
  375. // CHECK:STDOUT:
  376. // CHECK:STDOUT: generic impl @impl.cd2fdc.2(%T.loc20_14.1: type) {
  377. // CHECK:STDOUT: %T.loc20_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc20_14.2 (constants.%T)]
  378. // CHECK:STDOUT: %ptr.loc20_32.2: type = ptr_type %T.loc20_14.2 [symbolic = %ptr.loc20_32.2 (constants.%ptr)]
  379. // CHECK:STDOUT: %I.type.loc20_33.2: type = facet_type <@I, @I(%ptr.loc20_32.2)> [symbolic = %I.type.loc20_33.2 (constants.%I.type.0e2)]
  380. // CHECK:STDOUT:
  381. // CHECK:STDOUT: impl: %C.ref as %I.type.loc20_33.1;
  382. // CHECK:STDOUT: }
  383. // CHECK:STDOUT:
  384. // CHECK:STDOUT: generic impl @impl.cd2fdc.3(%T.loc26_14.1: type) {
  385. // CHECK:STDOUT: %T.loc26_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc26_14.2 (constants.%T)]
  386. // CHECK:STDOUT: %ptr.loc26_32.2: type = ptr_type %T.loc26_14.2 [symbolic = %ptr.loc26_32.2 (constants.%ptr)]
  387. // CHECK:STDOUT: %I.type.loc26_33.2: type = facet_type <@I, @I(%ptr.loc26_32.2)> [symbolic = %I.type.loc26_33.2 (constants.%I.type.0e2)]
  388. // CHECK:STDOUT:
  389. // CHECK:STDOUT: !definition:
  390. // CHECK:STDOUT:
  391. // CHECK:STDOUT: impl: %C.ref as %I.type.loc26_33.1 {
  392. // CHECK:STDOUT: !members:
  393. // CHECK:STDOUT: witness = <error>
  394. // CHECK:STDOUT: }
  395. // CHECK:STDOUT: }
  396. // CHECK:STDOUT:
  397. // CHECK:STDOUT: class @C [from "import_generic.carbon"] {
  398. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f2
  399. // CHECK:STDOUT:
  400. // CHECK:STDOUT: !members:
  401. // CHECK:STDOUT: .Self = imports.%Main.import_ref.2c4
  402. // CHECK:STDOUT: }
  403. // CHECK:STDOUT:
  404. // CHECK:STDOUT: specific @I(constants.%T) {
  405. // CHECK:STDOUT: %T => constants.%T
  406. // CHECK:STDOUT:
  407. // CHECK:STDOUT: !definition:
  408. // CHECK:STDOUT: %I.type => constants.%I.type.325
  409. // CHECK:STDOUT: %Self => constants.%Self.209
  410. // CHECK:STDOUT: }
  411. // CHECK:STDOUT:
  412. // CHECK:STDOUT: specific @impl.08450a.1(constants.%T) {
  413. // CHECK:STDOUT: %T => constants.%T
  414. // CHECK:STDOUT: %I.type => constants.%I.type.325
  415. // CHECK:STDOUT: %I.impl_witness => constants.%I.impl_witness.1a9
  416. // CHECK:STDOUT: }
  417. // CHECK:STDOUT:
  418. // CHECK:STDOUT: specific @I(constants.%ptr) {
  419. // CHECK:STDOUT: %T => constants.%ptr
  420. // CHECK:STDOUT:
  421. // CHECK:STDOUT: !definition:
  422. // CHECK:STDOUT: %I.type => constants.%I.type.0e2
  423. // CHECK:STDOUT: %Self => constants.%Self.fb4
  424. // CHECK:STDOUT: }
  425. // CHECK:STDOUT:
  426. // CHECK:STDOUT: specific @impl.cd2fdc.1(constants.%T) {
  427. // CHECK:STDOUT: %T => constants.%T
  428. // CHECK:STDOUT: %ptr => constants.%ptr
  429. // CHECK:STDOUT: %I.type => constants.%I.type.0e2
  430. // CHECK:STDOUT: %require_complete => constants.%require_complete.0e6
  431. // CHECK:STDOUT: %I.impl_witness => constants.%I.impl_witness.6ad
  432. // CHECK:STDOUT: }
  433. // CHECK:STDOUT:
  434. // CHECK:STDOUT: specific @impl.08450a.2(constants.%T) {
  435. // CHECK:STDOUT: %T.loc8_14.2 => constants.%T
  436. // CHECK:STDOUT: %I.type.loc8_32.2 => constants.%I.type.325
  437. // CHECK:STDOUT: }
  438. // CHECK:STDOUT:
  439. // CHECK:STDOUT: specific @impl.08450a.3(constants.%T) {
  440. // CHECK:STDOUT: %T.loc14_14.2 => constants.%T
  441. // CHECK:STDOUT: %I.type.loc14_32.2 => constants.%I.type.325
  442. // CHECK:STDOUT: }
  443. // CHECK:STDOUT:
  444. // CHECK:STDOUT: specific @impl.cd2fdc.2(constants.%T) {
  445. // CHECK:STDOUT: %T.loc20_14.2 => constants.%T
  446. // CHECK:STDOUT: %ptr.loc20_32.2 => constants.%ptr
  447. // CHECK:STDOUT: %I.type.loc20_33.2 => constants.%I.type.0e2
  448. // CHECK:STDOUT: }
  449. // CHECK:STDOUT:
  450. // CHECK:STDOUT: specific @impl.cd2fdc.3(constants.%T) {
  451. // CHECK:STDOUT: %T.loc26_14.2 => constants.%T
  452. // CHECK:STDOUT: %ptr.loc26_32.2 => constants.%ptr
  453. // CHECK:STDOUT: %I.type.loc26_33.2 => constants.%I.type.0e2
  454. // CHECK:STDOUT: }
  455. // CHECK:STDOUT:
  456. // CHECK:STDOUT: --- fail_import_generic_decl.carbon
  457. // CHECK:STDOUT:
  458. // CHECK:STDOUT: constants {
  459. // CHECK:STDOUT: %D: type = class_type @D [concrete]
  460. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  461. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  462. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  463. // CHECK:STDOUT: %pattern_type: type = pattern_type type [concrete]
  464. // CHECK:STDOUT: %J.type.2b8: type = generic_interface_type @J [concrete]
  465. // CHECK:STDOUT: %J.generic: %J.type.2b8 = struct_value () [concrete]
  466. // CHECK:STDOUT: %J.type.b72: type = facet_type <@J, @J(%T)> [symbolic]
  467. // CHECK:STDOUT: %Self: %J.type.b72 = bind_symbolic_name Self, 1 [symbolic]
  468. // CHECK:STDOUT: %J.impl_witness.809: <witness> = impl_witness file.%J.impl_witness_table.loc11, @impl.199(%T) [symbolic]
  469. // CHECK:STDOUT: %ptr: type = ptr_type %T [symbolic]
  470. // CHECK:STDOUT: %J.type.628: type = facet_type <@J, @J(%ptr)> [symbolic]
  471. // CHECK:STDOUT: %J.impl_witness.5a8: <witness> = impl_witness file.%J.impl_witness_table.loc17, @impl.dfd(%T) [symbolic]
  472. // CHECK:STDOUT: }
  473. // CHECK:STDOUT:
  474. // CHECK:STDOUT: file {
  475. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  476. // CHECK:STDOUT: .D = %D.decl
  477. // CHECK:STDOUT: .J = %J.decl
  478. // CHECK:STDOUT: }
  479. // CHECK:STDOUT: %D.decl: type = class_decl @D [concrete = constants.%D] {} {}
  480. // CHECK:STDOUT: %J.decl: %J.type.2b8 = interface_decl @J [concrete = constants.%J.generic] {
  481. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  482. // CHECK:STDOUT: } {
  483. // CHECK:STDOUT: %T.loc5_13.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc5_13.2 (constants.%T)]
  484. // CHECK:STDOUT: }
  485. // CHECK:STDOUT: impl_decl @impl.199 [concrete] {
  486. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  487. // CHECK:STDOUT: } {
  488. // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [concrete = constants.%D]
  489. // CHECK:STDOUT: %J.ref: %J.type.2b8 = name_ref J, file.%J.decl [concrete = constants.%J.generic]
  490. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc11_14.1 [symbolic = %T.loc11_14.2 (constants.%T)]
  491. // CHECK:STDOUT: %J.type.loc11_32.1: type = facet_type <@J, @J(constants.%T)> [symbolic = %J.type.loc11_32.2 (constants.%J.type.b72)]
  492. // CHECK:STDOUT: %T.loc11_14.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc11_14.2 (constants.%T)]
  493. // CHECK:STDOUT: }
  494. // CHECK:STDOUT: %J.impl_witness_table.loc11 = impl_witness_table (), @impl.199 [concrete]
  495. // CHECK:STDOUT: %J.impl_witness.loc11: <witness> = impl_witness %J.impl_witness_table.loc11, @impl.199(constants.%T) [symbolic = @impl.199.%J.impl_witness (constants.%J.impl_witness.809)]
  496. // CHECK:STDOUT: impl_decl @impl.dfd [concrete] {
  497. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  498. // CHECK:STDOUT: } {
  499. // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [concrete = constants.%D]
  500. // CHECK:STDOUT: %J.ref: %J.type.2b8 = name_ref J, file.%J.decl [concrete = constants.%J.generic]
  501. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc17_14.1 [symbolic = %T.loc17_14.2 (constants.%T)]
  502. // CHECK:STDOUT: %ptr.loc17_32.1: type = ptr_type %T.ref [symbolic = %ptr.loc17_32.2 (constants.%ptr)]
  503. // CHECK:STDOUT: %J.type.loc17_33.1: type = facet_type <@J, @J(constants.%ptr)> [symbolic = %J.type.loc17_33.2 (constants.%J.type.628)]
  504. // CHECK:STDOUT: %T.loc17_14.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc17_14.2 (constants.%T)]
  505. // CHECK:STDOUT: }
  506. // CHECK:STDOUT: %J.impl_witness_table.loc17 = impl_witness_table (), @impl.dfd [concrete]
  507. // CHECK:STDOUT: %J.impl_witness.loc17: <witness> = impl_witness %J.impl_witness_table.loc17, @impl.dfd(constants.%T) [symbolic = @impl.dfd.%J.impl_witness (constants.%J.impl_witness.5a8)]
  508. // CHECK:STDOUT: }
  509. // CHECK:STDOUT:
  510. // CHECK:STDOUT: generic interface @J(%T.loc5_13.1: type) {
  511. // CHECK:STDOUT: %T.loc5_13.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc5_13.2 (constants.%T)]
  512. // CHECK:STDOUT:
  513. // CHECK:STDOUT: !definition:
  514. // CHECK:STDOUT: %J.type: type = facet_type <@J, @J(%T.loc5_13.2)> [symbolic = %J.type (constants.%J.type.b72)]
  515. // CHECK:STDOUT: %Self.2: @J.%J.type (%J.type.b72) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)]
  516. // CHECK:STDOUT:
  517. // CHECK:STDOUT: interface {
  518. // CHECK:STDOUT: %Self.1: @J.%J.type (%J.type.b72) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)]
  519. // CHECK:STDOUT:
  520. // CHECK:STDOUT: !members:
  521. // CHECK:STDOUT: .Self = %Self.1
  522. // CHECK:STDOUT: witness = ()
  523. // CHECK:STDOUT: }
  524. // CHECK:STDOUT: }
  525. // CHECK:STDOUT:
  526. // CHECK:STDOUT: generic impl @impl.199(%T.loc11_14.1: type) {
  527. // CHECK:STDOUT: %T.loc11_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc11_14.2 (constants.%T)]
  528. // CHECK:STDOUT: %J.type.loc11_32.2: type = facet_type <@J, @J(%T.loc11_14.2)> [symbolic = %J.type.loc11_32.2 (constants.%J.type.b72)]
  529. // CHECK:STDOUT: %J.impl_witness: <witness> = impl_witness file.%J.impl_witness_table.loc11, @impl.199(%T.loc11_14.2) [symbolic = %J.impl_witness (constants.%J.impl_witness.809)]
  530. // CHECK:STDOUT:
  531. // CHECK:STDOUT: impl: %D.ref as %J.type.loc11_32.1;
  532. // CHECK:STDOUT: }
  533. // CHECK:STDOUT:
  534. // CHECK:STDOUT: generic impl @impl.dfd(%T.loc17_14.1: type) {
  535. // CHECK:STDOUT: %T.loc17_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc17_14.2 (constants.%T)]
  536. // CHECK:STDOUT: %ptr.loc17_32.2: type = ptr_type %T.loc17_14.2 [symbolic = %ptr.loc17_32.2 (constants.%ptr)]
  537. // CHECK:STDOUT: %J.type.loc17_33.2: type = facet_type <@J, @J(%ptr.loc17_32.2)> [symbolic = %J.type.loc17_33.2 (constants.%J.type.628)]
  538. // CHECK:STDOUT: %J.impl_witness: <witness> = impl_witness file.%J.impl_witness_table.loc17, @impl.dfd(%T.loc17_14.2) [symbolic = %J.impl_witness (constants.%J.impl_witness.5a8)]
  539. // CHECK:STDOUT:
  540. // CHECK:STDOUT: impl: %D.ref as %J.type.loc17_33.1;
  541. // CHECK:STDOUT: }
  542. // CHECK:STDOUT:
  543. // CHECK:STDOUT: class @D {
  544. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  545. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  546. // CHECK:STDOUT: complete_type_witness = %complete_type
  547. // CHECK:STDOUT:
  548. // CHECK:STDOUT: !members:
  549. // CHECK:STDOUT: .Self = constants.%D
  550. // CHECK:STDOUT: }
  551. // CHECK:STDOUT:
  552. // CHECK:STDOUT: specific @J(constants.%T) {
  553. // CHECK:STDOUT: %T.loc5_13.2 => constants.%T
  554. // CHECK:STDOUT: }
  555. // CHECK:STDOUT:
  556. // CHECK:STDOUT: specific @impl.199(constants.%T) {
  557. // CHECK:STDOUT: %T.loc11_14.2 => constants.%T
  558. // CHECK:STDOUT: %J.type.loc11_32.2 => constants.%J.type.b72
  559. // CHECK:STDOUT: %J.impl_witness => constants.%J.impl_witness.809
  560. // CHECK:STDOUT: }
  561. // CHECK:STDOUT:
  562. // CHECK:STDOUT: specific @J(constants.%ptr) {
  563. // CHECK:STDOUT: %T.loc5_13.2 => constants.%ptr
  564. // CHECK:STDOUT: }
  565. // CHECK:STDOUT:
  566. // CHECK:STDOUT: specific @impl.dfd(constants.%T) {
  567. // CHECK:STDOUT: %T.loc17_14.2 => constants.%T
  568. // CHECK:STDOUT: %ptr.loc17_32.2 => constants.%ptr
  569. // CHECK:STDOUT: %J.type.loc17_33.2 => constants.%J.type.628
  570. // CHECK:STDOUT: %J.impl_witness => constants.%J.impl_witness.5a8
  571. // CHECK:STDOUT: }
  572. // CHECK:STDOUT:
  573. // CHECK:STDOUT: --- fail_import_generic_decl.impl.carbon
  574. // CHECK:STDOUT:
  575. // CHECK:STDOUT: constants {
  576. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  577. // CHECK:STDOUT: %J.type.2b8: type = generic_interface_type @J [concrete]
  578. // CHECK:STDOUT: %J.generic: %J.type.2b8 = struct_value () [concrete]
  579. // CHECK:STDOUT: %J.type.b72: type = facet_type <@J, @J(%T)> [symbolic]
  580. // CHECK:STDOUT: %Self: %J.type.b72 = bind_symbolic_name Self, 1 [symbolic]
  581. // CHECK:STDOUT: %pattern_type: type = pattern_type type [concrete]
  582. // CHECK:STDOUT: %D: type = class_type @D [concrete]
  583. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  584. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  585. // CHECK:STDOUT: %J.impl_witness.809: <witness> = impl_witness imports.%J.impl_witness_table.891, @impl.199bba.1(%T) [symbolic]
  586. // CHECK:STDOUT: %ptr: type = ptr_type %T [symbolic]
  587. // CHECK:STDOUT: %J.type.628: type = facet_type <@J, @J(%ptr)> [symbolic]
  588. // CHECK:STDOUT: %J.impl_witness.5a8: <witness> = impl_witness imports.%J.impl_witness_table.487, @impl.dfd2f7.1(%T) [symbolic]
  589. // CHECK:STDOUT: }
  590. // CHECK:STDOUT:
  591. // CHECK:STDOUT: imports {
  592. // CHECK:STDOUT: %Main.D: type = import_ref Main//import_generic_decl, D, loaded [concrete = constants.%D]
  593. // CHECK:STDOUT: %Main.J: %J.type.2b8 = import_ref Main//import_generic_decl, J, loaded [concrete = constants.%J.generic]
  594. // CHECK:STDOUT: %Main.import_ref.5ab3ec.1: type = import_ref Main//import_generic_decl, loc5_13, loaded [symbolic = @J.%T (constants.%T)]
  595. // CHECK:STDOUT: %Main.import_ref.ff5 = import_ref Main//import_generic_decl, inst31 [no loc], unloaded
  596. // CHECK:STDOUT: %Main.import_ref.8f2: <witness> = import_ref Main//import_generic_decl, loc4_10, loaded [concrete = constants.%complete_type]
  597. // CHECK:STDOUT: %Main.import_ref.cab = import_ref Main//import_generic_decl, inst16 [no loc], unloaded
  598. // CHECK:STDOUT: %Main.import_ref.5ab3ec.2: type = import_ref Main//import_generic_decl, loc11_14, loaded [symbolic = @impl.199bba.1.%T (constants.%T)]
  599. // CHECK:STDOUT: %Main.import_ref.aa9f8a.1: type = import_ref Main//import_generic_decl, loc11_24, loaded [concrete = constants.%D]
  600. // CHECK:STDOUT: %Main.import_ref.ded: type = import_ref Main//import_generic_decl, loc11_32, loaded [symbolic = @impl.199bba.1.%J.type (constants.%J.type.b72)]
  601. // CHECK:STDOUT: %J.impl_witness_table.891 = impl_witness_table (), @impl.199bba.1 [concrete]
  602. // CHECK:STDOUT: %Main.import_ref.5ab3ec.3: type = import_ref Main//import_generic_decl, loc17_14, loaded [symbolic = @impl.dfd2f7.1.%T (constants.%T)]
  603. // CHECK:STDOUT: %Main.import_ref.aa9f8a.2: type = import_ref Main//import_generic_decl, loc17_24, loaded [concrete = constants.%D]
  604. // CHECK:STDOUT: %Main.import_ref.0d3: type = import_ref Main//import_generic_decl, loc17_33, loaded [symbolic = @impl.dfd2f7.1.%J.type (constants.%J.type.628)]
  605. // CHECK:STDOUT: %J.impl_witness_table.487 = impl_witness_table (), @impl.dfd2f7.1 [concrete]
  606. // CHECK:STDOUT: }
  607. // CHECK:STDOUT:
  608. // CHECK:STDOUT: file {
  609. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  610. // CHECK:STDOUT: .D = imports.%Main.D
  611. // CHECK:STDOUT: .J = imports.%Main.J
  612. // CHECK:STDOUT: }
  613. // CHECK:STDOUT: %default.import.loc2_35.1 = import <none>
  614. // CHECK:STDOUT: %default.import.loc2_35.2 = import <none>
  615. // CHECK:STDOUT: impl_decl @impl.199bba.2 [concrete] {
  616. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  617. // CHECK:STDOUT: } {
  618. // CHECK:STDOUT: %D.ref: type = name_ref D, imports.%Main.D [concrete = constants.%D]
  619. // CHECK:STDOUT: %J.ref: %J.type.2b8 = name_ref J, imports.%Main.J [concrete = constants.%J.generic]
  620. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc8_14.1 [symbolic = %T.loc8_14.2 (constants.%T)]
  621. // CHECK:STDOUT: %J.type.loc8_32.1: type = facet_type <@J, @J(constants.%T)> [symbolic = %J.type.loc8_32.2 (constants.%J.type.b72)]
  622. // CHECK:STDOUT: %T.loc8_14.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc8_14.2 (constants.%T)]
  623. // CHECK:STDOUT: }
  624. // CHECK:STDOUT: impl_decl @impl.199bba.3 [concrete] {
  625. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  626. // CHECK:STDOUT: } {
  627. // CHECK:STDOUT: %D.ref: type = name_ref D, imports.%Main.D [concrete = constants.%D]
  628. // CHECK:STDOUT: %J.ref: %J.type.2b8 = name_ref J, imports.%Main.J [concrete = constants.%J.generic]
  629. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc14_14.1 [symbolic = %T.loc14_14.2 (constants.%T)]
  630. // CHECK:STDOUT: %J.type.loc14_32.1: type = facet_type <@J, @J(constants.%T)> [symbolic = %J.type.loc14_32.2 (constants.%J.type.b72)]
  631. // CHECK:STDOUT: %T.loc14_14.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc14_14.2 (constants.%T)]
  632. // CHECK:STDOUT: }
  633. // CHECK:STDOUT: impl_decl @impl.dfd2f7.2 [concrete] {
  634. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  635. // CHECK:STDOUT: } {
  636. // CHECK:STDOUT: %D.ref: type = name_ref D, imports.%Main.D [concrete = constants.%D]
  637. // CHECK:STDOUT: %J.ref: %J.type.2b8 = name_ref J, imports.%Main.J [concrete = constants.%J.generic]
  638. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc20_14.1 [symbolic = %T.loc20_14.2 (constants.%T)]
  639. // CHECK:STDOUT: %ptr.loc20_32.1: type = ptr_type %T.ref [symbolic = %ptr.loc20_32.2 (constants.%ptr)]
  640. // CHECK:STDOUT: %J.type.loc20_33.1: type = facet_type <@J, @J(constants.%ptr)> [symbolic = %J.type.loc20_33.2 (constants.%J.type.628)]
  641. // CHECK:STDOUT: %T.loc20_14.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc20_14.2 (constants.%T)]
  642. // CHECK:STDOUT: }
  643. // CHECK:STDOUT: impl_decl @impl.dfd2f7.3 [concrete] {
  644. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  645. // CHECK:STDOUT: } {
  646. // CHECK:STDOUT: %D.ref: type = name_ref D, imports.%Main.D [concrete = constants.%D]
  647. // CHECK:STDOUT: %J.ref: %J.type.2b8 = name_ref J, imports.%Main.J [concrete = constants.%J.generic]
  648. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc26_14.1 [symbolic = %T.loc26_14.2 (constants.%T)]
  649. // CHECK:STDOUT: %ptr.loc26_32.1: type = ptr_type %T.ref [symbolic = %ptr.loc26_32.2 (constants.%ptr)]
  650. // CHECK:STDOUT: %J.type.loc26_33.1: type = facet_type <@J, @J(constants.%ptr)> [symbolic = %J.type.loc26_33.2 (constants.%J.type.628)]
  651. // CHECK:STDOUT: %T.loc26_14.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc26_14.2 (constants.%T)]
  652. // CHECK:STDOUT: }
  653. // CHECK:STDOUT: }
  654. // CHECK:STDOUT:
  655. // CHECK:STDOUT: generic interface @J(imports.%Main.import_ref.5ab3ec.1: type) [from "fail_import_generic_decl.carbon"] {
  656. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  657. // CHECK:STDOUT:
  658. // CHECK:STDOUT: !definition:
  659. // CHECK:STDOUT: %J.type: type = facet_type <@J, @J(%T)> [symbolic = %J.type (constants.%J.type.b72)]
  660. // CHECK:STDOUT: %Self: @J.%J.type (%J.type.b72) = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)]
  661. // CHECK:STDOUT:
  662. // CHECK:STDOUT: interface {
  663. // CHECK:STDOUT: !members:
  664. // CHECK:STDOUT: .Self = imports.%Main.import_ref.ff5
  665. // CHECK:STDOUT: witness = ()
  666. // CHECK:STDOUT: }
  667. // CHECK:STDOUT: }
  668. // CHECK:STDOUT:
  669. // CHECK:STDOUT: generic impl @impl.199bba.1(imports.%Main.import_ref.5ab3ec.2: type) [from "fail_import_generic_decl.carbon"] {
  670. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  671. // CHECK:STDOUT: %J.type: type = facet_type <@J, @J(%T)> [symbolic = %J.type (constants.%J.type.b72)]
  672. // CHECK:STDOUT: %J.impl_witness: <witness> = impl_witness imports.%J.impl_witness_table.891, @impl.199bba.1(%T) [symbolic = %J.impl_witness (constants.%J.impl_witness.809)]
  673. // CHECK:STDOUT:
  674. // CHECK:STDOUT: impl: imports.%Main.import_ref.aa9f8a.1 as imports.%Main.import_ref.ded;
  675. // CHECK:STDOUT: }
  676. // CHECK:STDOUT:
  677. // CHECK:STDOUT: generic impl @impl.dfd2f7.1(imports.%Main.import_ref.5ab3ec.3: type) [from "fail_import_generic_decl.carbon"] {
  678. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  679. // CHECK:STDOUT: %ptr: type = ptr_type %T [symbolic = %ptr (constants.%ptr)]
  680. // CHECK:STDOUT: %J.type: type = facet_type <@J, @J(%ptr)> [symbolic = %J.type (constants.%J.type.628)]
  681. // CHECK:STDOUT: %J.impl_witness: <witness> = impl_witness imports.%J.impl_witness_table.487, @impl.dfd2f7.1(%T) [symbolic = %J.impl_witness (constants.%J.impl_witness.5a8)]
  682. // CHECK:STDOUT:
  683. // CHECK:STDOUT: impl: imports.%Main.import_ref.aa9f8a.2 as imports.%Main.import_ref.0d3;
  684. // CHECK:STDOUT: }
  685. // CHECK:STDOUT:
  686. // CHECK:STDOUT: generic impl @impl.199bba.2(%T.loc8_14.1: type) {
  687. // CHECK:STDOUT: %T.loc8_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc8_14.2 (constants.%T)]
  688. // CHECK:STDOUT: %J.type.loc8_32.2: type = facet_type <@J, @J(%T.loc8_14.2)> [symbolic = %J.type.loc8_32.2 (constants.%J.type.b72)]
  689. // CHECK:STDOUT:
  690. // CHECK:STDOUT: impl: %D.ref as %J.type.loc8_32.1;
  691. // CHECK:STDOUT: }
  692. // CHECK:STDOUT:
  693. // CHECK:STDOUT: generic impl @impl.199bba.3(%T.loc14_14.1: type) {
  694. // CHECK:STDOUT: %T.loc14_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc14_14.2 (constants.%T)]
  695. // CHECK:STDOUT: %J.type.loc14_32.2: type = facet_type <@J, @J(%T.loc14_14.2)> [symbolic = %J.type.loc14_32.2 (constants.%J.type.b72)]
  696. // CHECK:STDOUT:
  697. // CHECK:STDOUT: !definition:
  698. // CHECK:STDOUT:
  699. // CHECK:STDOUT: impl: %D.ref as %J.type.loc14_32.1 {
  700. // CHECK:STDOUT: !members:
  701. // CHECK:STDOUT: witness = <error>
  702. // CHECK:STDOUT: }
  703. // CHECK:STDOUT: }
  704. // CHECK:STDOUT:
  705. // CHECK:STDOUT: generic impl @impl.dfd2f7.2(%T.loc20_14.1: type) {
  706. // CHECK:STDOUT: %T.loc20_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc20_14.2 (constants.%T)]
  707. // CHECK:STDOUT: %ptr.loc20_32.2: type = ptr_type %T.loc20_14.2 [symbolic = %ptr.loc20_32.2 (constants.%ptr)]
  708. // CHECK:STDOUT: %J.type.loc20_33.2: type = facet_type <@J, @J(%ptr.loc20_32.2)> [symbolic = %J.type.loc20_33.2 (constants.%J.type.628)]
  709. // CHECK:STDOUT:
  710. // CHECK:STDOUT: impl: %D.ref as %J.type.loc20_33.1;
  711. // CHECK:STDOUT: }
  712. // CHECK:STDOUT:
  713. // CHECK:STDOUT: generic impl @impl.dfd2f7.3(%T.loc26_14.1: type) {
  714. // CHECK:STDOUT: %T.loc26_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc26_14.2 (constants.%T)]
  715. // CHECK:STDOUT: %ptr.loc26_32.2: type = ptr_type %T.loc26_14.2 [symbolic = %ptr.loc26_32.2 (constants.%ptr)]
  716. // CHECK:STDOUT: %J.type.loc26_33.2: type = facet_type <@J, @J(%ptr.loc26_32.2)> [symbolic = %J.type.loc26_33.2 (constants.%J.type.628)]
  717. // CHECK:STDOUT:
  718. // CHECK:STDOUT: !definition:
  719. // CHECK:STDOUT:
  720. // CHECK:STDOUT: impl: %D.ref as %J.type.loc26_33.1 {
  721. // CHECK:STDOUT: !members:
  722. // CHECK:STDOUT: witness = <error>
  723. // CHECK:STDOUT: }
  724. // CHECK:STDOUT: }
  725. // CHECK:STDOUT:
  726. // CHECK:STDOUT: class @D [from "fail_import_generic_decl.carbon"] {
  727. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f2
  728. // CHECK:STDOUT:
  729. // CHECK:STDOUT: !members:
  730. // CHECK:STDOUT: .Self = imports.%Main.import_ref.cab
  731. // CHECK:STDOUT: }
  732. // CHECK:STDOUT:
  733. // CHECK:STDOUT: specific @J(constants.%T) {
  734. // CHECK:STDOUT: %T => constants.%T
  735. // CHECK:STDOUT: }
  736. // CHECK:STDOUT:
  737. // CHECK:STDOUT: specific @impl.199bba.1(constants.%T) {
  738. // CHECK:STDOUT: %T => constants.%T
  739. // CHECK:STDOUT: %J.type => constants.%J.type.b72
  740. // CHECK:STDOUT: %J.impl_witness => constants.%J.impl_witness.809
  741. // CHECK:STDOUT: }
  742. // CHECK:STDOUT:
  743. // CHECK:STDOUT: specific @J(constants.%ptr) {
  744. // CHECK:STDOUT: %T => constants.%ptr
  745. // CHECK:STDOUT: }
  746. // CHECK:STDOUT:
  747. // CHECK:STDOUT: specific @impl.dfd2f7.1(constants.%T) {
  748. // CHECK:STDOUT: %T => constants.%T
  749. // CHECK:STDOUT: %ptr => constants.%ptr
  750. // CHECK:STDOUT: %J.type => constants.%J.type.628
  751. // CHECK:STDOUT: %J.impl_witness => constants.%J.impl_witness.5a8
  752. // CHECK:STDOUT: }
  753. // CHECK:STDOUT:
  754. // CHECK:STDOUT: specific @impl.199bba.2(constants.%T) {
  755. // CHECK:STDOUT: %T.loc8_14.2 => constants.%T
  756. // CHECK:STDOUT: %J.type.loc8_32.2 => constants.%J.type.b72
  757. // CHECK:STDOUT: }
  758. // CHECK:STDOUT:
  759. // CHECK:STDOUT: specific @impl.199bba.3(constants.%T) {
  760. // CHECK:STDOUT: %T.loc14_14.2 => constants.%T
  761. // CHECK:STDOUT: %J.type.loc14_32.2 => constants.%J.type.b72
  762. // CHECK:STDOUT: }
  763. // CHECK:STDOUT:
  764. // CHECK:STDOUT: specific @impl.dfd2f7.2(constants.%T) {
  765. // CHECK:STDOUT: %T.loc20_14.2 => constants.%T
  766. // CHECK:STDOUT: %ptr.loc20_32.2 => constants.%ptr
  767. // CHECK:STDOUT: %J.type.loc20_33.2 => constants.%J.type.628
  768. // CHECK:STDOUT: }
  769. // CHECK:STDOUT:
  770. // CHECK:STDOUT: specific @impl.dfd2f7.3(constants.%T) {
  771. // CHECK:STDOUT: %T.loc26_14.2 => constants.%T
  772. // CHECK:STDOUT: %ptr.loc26_32.2 => constants.%ptr
  773. // CHECK:STDOUT: %J.type.loc26_33.2 => constants.%J.type.628
  774. // CHECK:STDOUT: }
  775. // CHECK:STDOUT: