import_generic.carbon 47 KB

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