import.carbon 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924
  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/class/generic/import.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/generic/import.carbon
  10. // --- foo.carbon
  11. library "[[@TEST_NAME]]";
  12. class Class(T:! type);
  13. class CompleteClass(T:! type) {
  14. var n: i32;
  15. fn F() -> i32 { return 0; }
  16. }
  17. fn F() -> CompleteClass(i32);
  18. // --- foo.impl.carbon
  19. impl library "[[@TEST_NAME]]";
  20. class Class(T:! type) {
  21. var x: T;
  22. }
  23. fn F() -> CompleteClass(i32) {
  24. return {.n = 1};
  25. }
  26. // --- use_foo.carbon
  27. library "[[@TEST_NAME]]";
  28. import library "foo";
  29. fn UseMethod() -> i32 {
  30. var v: CompleteClass(i32) = F();
  31. return v.F();
  32. }
  33. fn UseField() -> i32 {
  34. var v: CompleteClass(i32) = F();
  35. return v.n;
  36. }
  37. // --- fail_generic_arg_mismatch.carbon
  38. library "[[@TEST_NAME]]";
  39. import library "foo";
  40. fn Use() {
  41. // TODO: Include the generic arguments in the formatted type name.
  42. // CHECK:STDERR: fail_generic_arg_mismatch.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `CompleteClass` to `CompleteClass`
  43. // CHECK:STDERR: var v: CompleteClass(i32*) = F();
  44. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  45. // CHECK:STDERR: fail_generic_arg_mismatch.carbon:[[@LINE+4]]:3: note: type `CompleteClass` does not implement interface `ImplicitAs`
  46. // CHECK:STDERR: var v: CompleteClass(i32*) = F();
  47. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  48. // CHECK:STDERR:
  49. var v: CompleteClass(i32*) = F();
  50. }
  51. // --- fail_foo.impl.carbon
  52. impl library "[[@TEST_NAME]]";
  53. // CHECK:STDERR: fail_foo.impl.carbon:[[@LINE+8]]:13: error: redeclaration differs at parameter 1
  54. // CHECK:STDERR: class Class(U:! type) {
  55. // CHECK:STDERR: ^~~~~~~~
  56. // CHECK:STDERR: fail_foo.impl.carbon:[[@LINE-5]]:6: in import
  57. // CHECK:STDERR: foo.carbon:4:13: note: previous declaration's corresponding parameter here
  58. // CHECK:STDERR: class Class(T:! type);
  59. // CHECK:STDERR: ^~~~~~~~
  60. // CHECK:STDERR:
  61. class Class(U:! type) {
  62. // CHECK:STDERR: fail_foo.impl.carbon:[[@LINE+3]]:10: error: name `T` not found
  63. // CHECK:STDERR: var x: T;
  64. // CHECK:STDERR: ^
  65. var x: T;
  66. }
  67. // CHECK:STDOUT: --- foo.carbon
  68. // CHECK:STDOUT:
  69. // CHECK:STDOUT: constants {
  70. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  71. // CHECK:STDOUT: %T.patt.1: type = symbolic_binding_pattern T, 0 [symbolic]
  72. // CHECK:STDOUT: %Class.type: type = generic_class_type @Class [template]
  73. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  74. // CHECK:STDOUT: %Class.1: %Class.type = struct_value () [template]
  75. // CHECK:STDOUT: %Class.2: type = class_type @Class, @Class(%T) [symbolic]
  76. // CHECK:STDOUT: %T.patt.2: type = symbolic_binding_pattern T, 0 [symbolic]
  77. // CHECK:STDOUT: %CompleteClass.type: type = generic_class_type @CompleteClass [template]
  78. // CHECK:STDOUT: %CompleteClass.1: %CompleteClass.type = struct_value () [template]
  79. // CHECK:STDOUT: %CompleteClass.2: type = class_type @CompleteClass, @CompleteClass(%T) [symbolic]
  80. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  81. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  82. // CHECK:STDOUT: %.2: type = unbound_element_type %CompleteClass.2, i32 [symbolic]
  83. // CHECK:STDOUT: %F.type.1: type = fn_type @F.1, @CompleteClass(%T) [symbolic]
  84. // CHECK:STDOUT: %F.1: %F.type.1 = struct_value () [symbolic]
  85. // CHECK:STDOUT: %.3: type = struct_type {.n: i32} [template]
  86. // CHECK:STDOUT: %.4: <witness> = complete_type_witness %.3 [template]
  87. // CHECK:STDOUT: %.5: i32 = int_literal 0 [template]
  88. // CHECK:STDOUT: %CompleteClass.3: type = class_type @CompleteClass, @CompleteClass(i32) [template]
  89. // CHECK:STDOUT: %F.type.2: type = fn_type @F.2 [template]
  90. // CHECK:STDOUT: %F.2: %F.type.2 = struct_value () [template]
  91. // CHECK:STDOUT: }
  92. // CHECK:STDOUT:
  93. // CHECK:STDOUT: imports {
  94. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  95. // CHECK:STDOUT: .Int32 = %import_ref
  96. // CHECK:STDOUT: import Core//prelude
  97. // CHECK:STDOUT: import Core//prelude/operators
  98. // CHECK:STDOUT: import Core//prelude/types
  99. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  100. // CHECK:STDOUT: import Core//prelude/operators/as
  101. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  102. // CHECK:STDOUT: import Core//prelude/operators/comparison
  103. // CHECK:STDOUT: import Core//prelude/types/bool
  104. // CHECK:STDOUT: }
  105. // CHECK:STDOUT: %import_ref: %Int32.type = import_ref Core//prelude/types, inst+9, loaded [template = constants.%Int32]
  106. // CHECK:STDOUT: }
  107. // CHECK:STDOUT:
  108. // CHECK:STDOUT: file {
  109. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  110. // CHECK:STDOUT: .Core = imports.%Core
  111. // CHECK:STDOUT: .Class = %Class.decl
  112. // CHECK:STDOUT: .CompleteClass = %CompleteClass.decl
  113. // CHECK:STDOUT: .F = %F.decl
  114. // CHECK:STDOUT: }
  115. // CHECK:STDOUT: %Core.import = import Core
  116. // CHECK:STDOUT: %Class.decl: %Class.type = class_decl @Class [template = constants.%Class.1] {
  117. // CHECK:STDOUT: %T.patt.loc4_13.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_13.2 (constants.%T.patt.1)]
  118. // CHECK:STDOUT: %T.param_patt: type = param_pattern %T.patt.loc4_13.1, runtime_param<invalid> [symbolic = %T.patt.loc4_13.2 (constants.%T.patt.1)]
  119. // CHECK:STDOUT: } {
  120. // CHECK:STDOUT: %param: type = param runtime_param<invalid>
  121. // CHECK:STDOUT: %T.loc4_13.1: type = bind_symbolic_name T, 0, %param [symbolic = %T.loc4_13.2 (constants.%T)]
  122. // CHECK:STDOUT: }
  123. // CHECK:STDOUT: %CompleteClass.decl: %CompleteClass.type = class_decl @CompleteClass [template = constants.%CompleteClass.1] {
  124. // CHECK:STDOUT: %T.patt.loc6_21.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_21.2 (constants.%T.patt.2)]
  125. // CHECK:STDOUT: %T.param_patt: type = param_pattern %T.patt.loc6_21.1, runtime_param<invalid> [symbolic = %T.patt.loc6_21.2 (constants.%T.patt.2)]
  126. // CHECK:STDOUT: } {
  127. // CHECK:STDOUT: %param: type = param runtime_param<invalid>
  128. // CHECK:STDOUT: %T.loc6_21.1: type = bind_symbolic_name T, 0, %param [symbolic = %T.loc6_21.2 (constants.%T)]
  129. // CHECK:STDOUT: }
  130. // CHECK:STDOUT: %F.decl: %F.type.2 = fn_decl @F.2 [template = constants.%F.2] {} {
  131. // CHECK:STDOUT: %CompleteClass.ref: %CompleteClass.type = name_ref CompleteClass, file.%CompleteClass.decl [template = constants.%CompleteClass.1]
  132. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  133. // CHECK:STDOUT: %.loc11_24.1: type = value_of_initializer %int.make_type_32 [template = i32]
  134. // CHECK:STDOUT: %.loc11_24.2: type = converted %int.make_type_32, %.loc11_24.1 [template = i32]
  135. // CHECK:STDOUT: %CompleteClass: type = class_type @CompleteClass, @CompleteClass(i32) [template = constants.%CompleteClass.3]
  136. // CHECK:STDOUT: %return: ref %CompleteClass.3 = var <return slot>
  137. // CHECK:STDOUT: }
  138. // CHECK:STDOUT: }
  139. // CHECK:STDOUT:
  140. // CHECK:STDOUT: generic class @Class(%T.loc4_13.1: type) {
  141. // CHECK:STDOUT: %T.loc4_13.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_13.2 (constants.%T)]
  142. // CHECK:STDOUT: %T.patt.loc4_13.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_13.2 (constants.%T.patt.1)]
  143. // CHECK:STDOUT:
  144. // CHECK:STDOUT: class;
  145. // CHECK:STDOUT: }
  146. // CHECK:STDOUT:
  147. // CHECK:STDOUT: generic class @CompleteClass(%T.loc6_21.1: type) {
  148. // CHECK:STDOUT: %T.loc6_21.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc6_21.2 (constants.%T)]
  149. // CHECK:STDOUT: %T.patt.loc6_21.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_21.2 (constants.%T.patt.2)]
  150. // CHECK:STDOUT:
  151. // CHECK:STDOUT: !definition:
  152. // CHECK:STDOUT: %CompleteClass: type = class_type @CompleteClass, @CompleteClass(%T.loc6_21.2) [symbolic = %CompleteClass (constants.%CompleteClass.2)]
  153. // CHECK:STDOUT: %.loc7_8.2: type = unbound_element_type @CompleteClass.%CompleteClass (%CompleteClass.2), i32 [symbolic = %.loc7_8.2 (constants.%.2)]
  154. // CHECK:STDOUT: %F.type: type = fn_type @F.1, @CompleteClass(%T.loc6_21.2) [symbolic = %F.type (constants.%F.type.1)]
  155. // CHECK:STDOUT: %F: @CompleteClass.%F.type (%F.type.1) = struct_value () [symbolic = %F (constants.%F.1)]
  156. // CHECK:STDOUT:
  157. // CHECK:STDOUT: class {
  158. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  159. // CHECK:STDOUT: %.loc7_10.1: type = value_of_initializer %int.make_type_32 [template = i32]
  160. // CHECK:STDOUT: %.loc7_10.2: type = converted %int.make_type_32, %.loc7_10.1 [template = i32]
  161. // CHECK:STDOUT: %.loc7_8.1: @CompleteClass.%.loc7_8.2 (%.2) = field_decl n, element0 [template]
  162. // CHECK:STDOUT: %F.decl: @CompleteClass.%F.type (%F.type.1) = fn_decl @F.1 [symbolic = @CompleteClass.%F (constants.%F.1)] {} {
  163. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  164. // CHECK:STDOUT: %.loc8_13.1: type = value_of_initializer %int.make_type_32 [template = i32]
  165. // CHECK:STDOUT: %.loc8_13.2: type = converted %int.make_type_32, %.loc8_13.1 [template = i32]
  166. // CHECK:STDOUT: %return: ref i32 = var <return slot>
  167. // CHECK:STDOUT: }
  168. // CHECK:STDOUT: %.loc9: <witness> = complete_type_witness %.3 [template = constants.%.4]
  169. // CHECK:STDOUT:
  170. // CHECK:STDOUT: !members:
  171. // CHECK:STDOUT: .Self = constants.%CompleteClass.2
  172. // CHECK:STDOUT: .n = %.loc7_8.1
  173. // CHECK:STDOUT: .F = %F.decl
  174. // CHECK:STDOUT: }
  175. // CHECK:STDOUT: }
  176. // CHECK:STDOUT:
  177. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  178. // CHECK:STDOUT:
  179. // CHECK:STDOUT: generic fn @F.1(@CompleteClass.%T.loc6_21.1: type) {
  180. // CHECK:STDOUT: !definition:
  181. // CHECK:STDOUT:
  182. // CHECK:STDOUT: fn() -> i32 {
  183. // CHECK:STDOUT: !entry:
  184. // CHECK:STDOUT: %.loc8_26: i32 = int_literal 0 [template = constants.%.5]
  185. // CHECK:STDOUT: return %.loc8_26
  186. // CHECK:STDOUT: }
  187. // CHECK:STDOUT: }
  188. // CHECK:STDOUT:
  189. // CHECK:STDOUT: fn @F.2() -> %CompleteClass.3;
  190. // CHECK:STDOUT:
  191. // CHECK:STDOUT: specific @Class(constants.%T) {
  192. // CHECK:STDOUT: %T.loc4_13.2 => constants.%T
  193. // CHECK:STDOUT: %T.patt.loc4_13.2 => constants.%T
  194. // CHECK:STDOUT: }
  195. // CHECK:STDOUT:
  196. // CHECK:STDOUT: specific @CompleteClass(constants.%T) {
  197. // CHECK:STDOUT: %T.loc6_21.2 => constants.%T
  198. // CHECK:STDOUT: %T.patt.loc6_21.2 => constants.%T
  199. // CHECK:STDOUT:
  200. // CHECK:STDOUT: !definition:
  201. // CHECK:STDOUT: %CompleteClass => constants.%CompleteClass.2
  202. // CHECK:STDOUT: %.loc7_8.2 => constants.%.2
  203. // CHECK:STDOUT: %F.type => constants.%F.type.1
  204. // CHECK:STDOUT: %F => constants.%F.1
  205. // CHECK:STDOUT: }
  206. // CHECK:STDOUT:
  207. // CHECK:STDOUT: specific @F.1(constants.%T) {}
  208. // CHECK:STDOUT:
  209. // CHECK:STDOUT: specific @CompleteClass(@CompleteClass.%T.loc6_21.2) {
  210. // CHECK:STDOUT: %T.loc6_21.2 => constants.%T
  211. // CHECK:STDOUT: %T.patt.loc6_21.2 => constants.%T
  212. // CHECK:STDOUT: }
  213. // CHECK:STDOUT:
  214. // CHECK:STDOUT: specific @CompleteClass(i32) {
  215. // CHECK:STDOUT: %T.loc6_21.2 => i32
  216. // CHECK:STDOUT: %T.patt.loc6_21.2 => i32
  217. // CHECK:STDOUT: }
  218. // CHECK:STDOUT:
  219. // CHECK:STDOUT: --- foo.impl.carbon
  220. // CHECK:STDOUT:
  221. // CHECK:STDOUT: constants {
  222. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  223. // CHECK:STDOUT: %T.patt.1: type = symbolic_binding_pattern T, 0 [symbolic]
  224. // CHECK:STDOUT: %Class.type: type = generic_class_type @Class [template]
  225. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  226. // CHECK:STDOUT: %Class.1: %Class.type = struct_value () [template]
  227. // CHECK:STDOUT: %Class.2: type = class_type @Class, @Class(%T) [symbolic]
  228. // CHECK:STDOUT: %T.patt.2: type = symbolic_binding_pattern T, 0 [symbolic]
  229. // CHECK:STDOUT: %.2: type = unbound_element_type %Class.2, %T [symbolic]
  230. // CHECK:STDOUT: %.3: type = struct_type {.x: %T} [symbolic]
  231. // CHECK:STDOUT: %.4: <witness> = complete_type_witness %.3 [symbolic]
  232. // CHECK:STDOUT: %CompleteClass.type: type = generic_class_type @CompleteClass [template]
  233. // CHECK:STDOUT: %CompleteClass.1: %CompleteClass.type = struct_value () [template]
  234. // CHECK:STDOUT: %.5: type = struct_type {.n: i32} [template]
  235. // CHECK:STDOUT: %.6: <witness> = complete_type_witness %.5 [template]
  236. // CHECK:STDOUT: %CompleteClass.2: type = class_type @CompleteClass, @CompleteClass(%T) [symbolic]
  237. // CHECK:STDOUT: %.7: type = unbound_element_type %CompleteClass.2, i32 [symbolic]
  238. // CHECK:STDOUT: %F.type.1: type = fn_type @F.1, @CompleteClass(%T) [symbolic]
  239. // CHECK:STDOUT: %F.1: %F.type.1 = struct_value () [symbolic]
  240. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  241. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  242. // CHECK:STDOUT: %CompleteClass.3: type = class_type @CompleteClass, @CompleteClass(i32) [template]
  243. // CHECK:STDOUT: %F.type.2: type = fn_type @F.2 [template]
  244. // CHECK:STDOUT: %F.2: %F.type.2 = struct_value () [template]
  245. // CHECK:STDOUT: %.8: type = unbound_element_type %CompleteClass.3, i32 [template]
  246. // CHECK:STDOUT: %F.type.3: type = fn_type @F.1, @CompleteClass(i32) [template]
  247. // CHECK:STDOUT: %F.3: %F.type.3 = struct_value () [template]
  248. // CHECK:STDOUT: %.9: type = ptr_type %.5 [template]
  249. // CHECK:STDOUT: %.10: i32 = int_literal 1 [template]
  250. // CHECK:STDOUT: %struct: %CompleteClass.3 = struct_value (%.10) [template]
  251. // CHECK:STDOUT: }
  252. // CHECK:STDOUT:
  253. // CHECK:STDOUT: imports {
  254. // CHECK:STDOUT: %import_ref.1: %Class.type = import_ref Main//foo, inst+9, loaded [template = constants.%Class.1]
  255. // CHECK:STDOUT: %import_ref.2: %CompleteClass.type = import_ref Main//foo, inst+21, loaded [template = constants.%CompleteClass.1]
  256. // CHECK:STDOUT: %import_ref.3: %F.type.2 = import_ref Main//foo, inst+63, loaded [template = constants.%F.2]
  257. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  258. // CHECK:STDOUT: .Int32 = %import_ref.7
  259. // CHECK:STDOUT: import Core//prelude
  260. // CHECK:STDOUT: import Core//prelude/operators
  261. // CHECK:STDOUT: import Core//prelude/types
  262. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  263. // CHECK:STDOUT: import Core//prelude/operators/as
  264. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  265. // CHECK:STDOUT: import Core//prelude/operators/comparison
  266. // CHECK:STDOUT: import Core//prelude/types/bool
  267. // CHECK:STDOUT: }
  268. // CHECK:STDOUT: %import_ref.4 = import_ref Main//foo, inst+26, unloaded
  269. // CHECK:STDOUT: %import_ref.5 = import_ref Main//foo, inst+36, unloaded
  270. // CHECK:STDOUT: %import_ref.6 = import_ref Main//foo, inst+43, unloaded
  271. // CHECK:STDOUT: %import_ref.7: %Int32.type = import_ref Core//prelude/types, inst+9, loaded [template = constants.%Int32]
  272. // CHECK:STDOUT: }
  273. // CHECK:STDOUT:
  274. // CHECK:STDOUT: file {
  275. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  276. // CHECK:STDOUT: .Class = %Class.decl
  277. // CHECK:STDOUT: .CompleteClass = imports.%import_ref.2
  278. // CHECK:STDOUT: .F = %F.decl
  279. // CHECK:STDOUT: .Core = imports.%Core
  280. // CHECK:STDOUT: }
  281. // CHECK:STDOUT: %default.import.loc2_6.1 = import <invalid>
  282. // CHECK:STDOUT: %default.import.loc2_6.2 = import <invalid>
  283. // CHECK:STDOUT: %Core.import = import Core
  284. // CHECK:STDOUT: %Class.decl: %Class.type = class_decl @Class [template = constants.%Class.1] {
  285. // CHECK:STDOUT: %T.patt.loc4: type = symbolic_binding_pattern T, 0 [symbolic = constants.%T.patt.1]
  286. // CHECK:STDOUT: %T.param_patt: type = param_pattern %T.patt.loc4, runtime_param<invalid> [symbolic = constants.%T.patt.1]
  287. // CHECK:STDOUT: } {
  288. // CHECK:STDOUT: %param: type = param runtime_param<invalid>
  289. // CHECK:STDOUT: %T.loc4: type = bind_symbolic_name T, 0, %param [symbolic = constants.%T]
  290. // CHECK:STDOUT: }
  291. // CHECK:STDOUT: %F.decl: %F.type.2 = fn_decl @F.2 [template = constants.%F.2] {} {
  292. // CHECK:STDOUT: %CompleteClass.ref: %CompleteClass.type = name_ref CompleteClass, imports.%import_ref.2 [template = constants.%CompleteClass.1]
  293. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  294. // CHECK:STDOUT: %.loc8_24.1: type = value_of_initializer %int.make_type_32 [template = i32]
  295. // CHECK:STDOUT: %.loc8_24.2: type = converted %int.make_type_32, %.loc8_24.1 [template = i32]
  296. // CHECK:STDOUT: %CompleteClass: type = class_type @CompleteClass, @CompleteClass(i32) [template = constants.%CompleteClass.3]
  297. // CHECK:STDOUT: %return: ref %CompleteClass.3 = var <return slot>
  298. // CHECK:STDOUT: }
  299. // CHECK:STDOUT: }
  300. // CHECK:STDOUT:
  301. // CHECK:STDOUT: generic class @Class(constants.%T: type) {
  302. // CHECK:STDOUT: %T.1: type = bind_symbolic_name T, 0 [symbolic = %T.1 (constants.%T)]
  303. // CHECK:STDOUT: %T.patt.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.1 (constants.%T.patt.2)]
  304. // CHECK:STDOUT:
  305. // CHECK:STDOUT: !definition:
  306. // CHECK:STDOUT: %Class: type = class_type @Class, @Class(%T.1) [symbolic = %Class (constants.%Class.2)]
  307. // CHECK:STDOUT: %.loc5_8.2: type = unbound_element_type @Class.%Class (%Class.2), @Class.%T.1 (%T) [symbolic = %.loc5_8.2 (constants.%.2)]
  308. // CHECK:STDOUT: %.loc6_1.2: type = struct_type {.x: @Class.%T.1 (%T)} [symbolic = %.loc6_1.2 (constants.%.3)]
  309. // CHECK:STDOUT: %.loc6_1.3: <witness> = complete_type_witness @Class.%.loc6_1.2 (%.3) [symbolic = %.loc6_1.3 (constants.%.4)]
  310. // CHECK:STDOUT:
  311. // CHECK:STDOUT: class {
  312. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc4 [symbolic = %T.1 (constants.%T)]
  313. // CHECK:STDOUT: %.loc5_8.1: @Class.%.loc5_8.2 (%.2) = field_decl x, element0 [template]
  314. // CHECK:STDOUT: %.loc6_1.1: <witness> = complete_type_witness %.3 [symbolic = %.loc6_1.3 (constants.%.4)]
  315. // CHECK:STDOUT:
  316. // CHECK:STDOUT: !members:
  317. // CHECK:STDOUT: .Self = constants.%Class.2
  318. // CHECK:STDOUT: .x = %.loc5_8.1
  319. // CHECK:STDOUT: }
  320. // CHECK:STDOUT: }
  321. // CHECK:STDOUT:
  322. // CHECK:STDOUT: generic class @CompleteClass(constants.%T: type) {
  323. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  324. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt.2)]
  325. // CHECK:STDOUT:
  326. // CHECK:STDOUT: !definition:
  327. // CHECK:STDOUT: %CompleteClass: type = class_type @CompleteClass, @CompleteClass(%T) [symbolic = %CompleteClass (constants.%CompleteClass.2)]
  328. // CHECK:STDOUT: %.1: type = unbound_element_type @CompleteClass.%CompleteClass (%CompleteClass.2), i32 [symbolic = %.1 (constants.%.7)]
  329. // CHECK:STDOUT: %F.type: type = fn_type @F.1, @CompleteClass(%T) [symbolic = %F.type (constants.%F.type.1)]
  330. // CHECK:STDOUT: %F: @CompleteClass.%F.type (%F.type.1) = struct_value () [symbolic = %F (constants.%F.1)]
  331. // CHECK:STDOUT:
  332. // CHECK:STDOUT: class {
  333. // CHECK:STDOUT: !members:
  334. // CHECK:STDOUT: .Self = imports.%import_ref.4
  335. // CHECK:STDOUT: .n = imports.%import_ref.5
  336. // CHECK:STDOUT: .F = imports.%import_ref.6
  337. // CHECK:STDOUT: }
  338. // CHECK:STDOUT: }
  339. // CHECK:STDOUT:
  340. // CHECK:STDOUT: generic fn @F.1(constants.%T: type) {
  341. // CHECK:STDOUT: !definition:
  342. // CHECK:STDOUT:
  343. // CHECK:STDOUT: fn() -> i32;
  344. // CHECK:STDOUT: }
  345. // CHECK:STDOUT:
  346. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  347. // CHECK:STDOUT:
  348. // CHECK:STDOUT: fn @F.2() -> %return: %CompleteClass.3 {
  349. // CHECK:STDOUT: !entry:
  350. // CHECK:STDOUT: %.loc9_16: i32 = int_literal 1 [template = constants.%.10]
  351. // CHECK:STDOUT: %.loc9_17.1: %.5 = struct_literal (%.loc9_16)
  352. // CHECK:STDOUT: %.loc9_17.2: ref i32 = class_element_access %return, element0
  353. // CHECK:STDOUT: %.loc9_17.3: init i32 = initialize_from %.loc9_16 to %.loc9_17.2 [template = constants.%.10]
  354. // CHECK:STDOUT: %.loc9_17.4: init %CompleteClass.3 = class_init (%.loc9_17.3), %return [template = constants.%struct]
  355. // CHECK:STDOUT: %.loc9_18: init %CompleteClass.3 = converted %.loc9_17.1, %.loc9_17.4 [template = constants.%struct]
  356. // CHECK:STDOUT: return %.loc9_18 to %return
  357. // CHECK:STDOUT: }
  358. // CHECK:STDOUT:
  359. // CHECK:STDOUT: specific @Class(constants.%T) {
  360. // CHECK:STDOUT: %T.1 => constants.%T
  361. // CHECK:STDOUT: %T.patt.1 => constants.%T
  362. // CHECK:STDOUT: }
  363. // CHECK:STDOUT:
  364. // CHECK:STDOUT: specific @Class(@Class.%T.1) {
  365. // CHECK:STDOUT: %T.1 => constants.%T
  366. // CHECK:STDOUT: %T.patt.1 => constants.%T
  367. // CHECK:STDOUT: }
  368. // CHECK:STDOUT:
  369. // CHECK:STDOUT: specific @CompleteClass(constants.%T) {
  370. // CHECK:STDOUT: %T => constants.%T
  371. // CHECK:STDOUT: %T.patt => constants.%T
  372. // CHECK:STDOUT:
  373. // CHECK:STDOUT: !definition:
  374. // CHECK:STDOUT: %CompleteClass => constants.%CompleteClass.2
  375. // CHECK:STDOUT: %.1 => constants.%.7
  376. // CHECK:STDOUT: %F.type => constants.%F.type.1
  377. // CHECK:STDOUT: %F => constants.%F.1
  378. // CHECK:STDOUT: }
  379. // CHECK:STDOUT:
  380. // CHECK:STDOUT: specific @CompleteClass(@CompleteClass.%T) {
  381. // CHECK:STDOUT: %T => constants.%T
  382. // CHECK:STDOUT: %T.patt => constants.%T
  383. // CHECK:STDOUT: }
  384. // CHECK:STDOUT:
  385. // CHECK:STDOUT: specific @F.1(constants.%T) {}
  386. // CHECK:STDOUT:
  387. // CHECK:STDOUT: specific @CompleteClass(i32) {
  388. // CHECK:STDOUT: %T => i32
  389. // CHECK:STDOUT: %T.patt => i32
  390. // CHECK:STDOUT:
  391. // CHECK:STDOUT: !definition:
  392. // CHECK:STDOUT: %CompleteClass => constants.%CompleteClass.3
  393. // CHECK:STDOUT: %.1 => constants.%.8
  394. // CHECK:STDOUT: %F.type => constants.%F.type.3
  395. // CHECK:STDOUT: %F => constants.%F.3
  396. // CHECK:STDOUT: }
  397. // CHECK:STDOUT:
  398. // CHECK:STDOUT: --- use_foo.carbon
  399. // CHECK:STDOUT:
  400. // CHECK:STDOUT: constants {
  401. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  402. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  403. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  404. // CHECK:STDOUT: %UseMethod.type: type = fn_type @UseMethod [template]
  405. // CHECK:STDOUT: %UseMethod: %UseMethod.type = struct_value () [template]
  406. // CHECK:STDOUT: %CompleteClass.type: type = generic_class_type @CompleteClass [template]
  407. // CHECK:STDOUT: %CompleteClass.1: %CompleteClass.type = struct_value () [template]
  408. // CHECK:STDOUT: %.2: type = struct_type {.n: i32} [template]
  409. // CHECK:STDOUT: %.3: <witness> = complete_type_witness %.2 [template]
  410. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  411. // CHECK:STDOUT: %CompleteClass.2: type = class_type @CompleteClass, @CompleteClass(%T) [symbolic]
  412. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  413. // CHECK:STDOUT: %.4: type = unbound_element_type %CompleteClass.2, i32 [symbolic]
  414. // CHECK:STDOUT: %F.type.1: type = fn_type @F.1, @CompleteClass(%T) [symbolic]
  415. // CHECK:STDOUT: %F.1: %F.type.1 = struct_value () [symbolic]
  416. // CHECK:STDOUT: %CompleteClass.3: type = class_type @CompleteClass, @CompleteClass(i32) [template]
  417. // CHECK:STDOUT: %.5: type = unbound_element_type %CompleteClass.3, i32 [template]
  418. // CHECK:STDOUT: %F.type.2: type = fn_type @F.1, @CompleteClass(i32) [template]
  419. // CHECK:STDOUT: %F.2: %F.type.2 = struct_value () [template]
  420. // CHECK:STDOUT: %.6: type = ptr_type %.2 [template]
  421. // CHECK:STDOUT: %F.type.3: type = fn_type @F.2 [template]
  422. // CHECK:STDOUT: %F.3: %F.type.3 = struct_value () [template]
  423. // CHECK:STDOUT: %.7: <specific function> = specific_function %F.2, @F.1(i32) [template]
  424. // CHECK:STDOUT: %UseField.type: type = fn_type @UseField [template]
  425. // CHECK:STDOUT: %UseField: %UseField.type = struct_value () [template]
  426. // CHECK:STDOUT: }
  427. // CHECK:STDOUT:
  428. // CHECK:STDOUT: imports {
  429. // CHECK:STDOUT: %import_ref.1 = import_ref Main//foo, inst+9, unloaded
  430. // CHECK:STDOUT: %import_ref.2: %CompleteClass.type = import_ref Main//foo, inst+21, loaded [template = constants.%CompleteClass.1]
  431. // CHECK:STDOUT: %import_ref.3: %F.type.3 = import_ref Main//foo, inst+63, loaded [template = constants.%F.3]
  432. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  433. // CHECK:STDOUT: .Int32 = %import_ref.4
  434. // CHECK:STDOUT: import Core//prelude
  435. // CHECK:STDOUT: import Core//prelude/operators
  436. // CHECK:STDOUT: import Core//prelude/types
  437. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  438. // CHECK:STDOUT: import Core//prelude/operators/as
  439. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  440. // CHECK:STDOUT: import Core//prelude/operators/comparison
  441. // CHECK:STDOUT: import Core//prelude/types/bool
  442. // CHECK:STDOUT: }
  443. // CHECK:STDOUT: %import_ref.4: %Int32.type = import_ref Core//prelude/types, inst+9, loaded [template = constants.%Int32]
  444. // CHECK:STDOUT: %import_ref.5 = import_ref Main//foo, inst+26, unloaded
  445. // CHECK:STDOUT: %import_ref.6: @CompleteClass.%.1 (%.4) = import_ref Main//foo, inst+36, loaded [template = %.1]
  446. // CHECK:STDOUT: %import_ref.7: @CompleteClass.%F.type (%F.type.1) = import_ref Main//foo, inst+43, loaded [symbolic = @CompleteClass.%F (constants.%F.1)]
  447. // CHECK:STDOUT: }
  448. // CHECK:STDOUT:
  449. // CHECK:STDOUT: file {
  450. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  451. // CHECK:STDOUT: .Class = imports.%import_ref.1
  452. // CHECK:STDOUT: .CompleteClass = imports.%import_ref.2
  453. // CHECK:STDOUT: .F = imports.%import_ref.3
  454. // CHECK:STDOUT: .Core = imports.%Core
  455. // CHECK:STDOUT: .UseMethod = %UseMethod.decl
  456. // CHECK:STDOUT: .UseField = %UseField.decl
  457. // CHECK:STDOUT: }
  458. // CHECK:STDOUT: %Core.import = import Core
  459. // CHECK:STDOUT: %default.import = import <invalid>
  460. // CHECK:STDOUT: %UseMethod.decl: %UseMethod.type = fn_decl @UseMethod [template = constants.%UseMethod] {} {
  461. // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32]
  462. // CHECK:STDOUT: %.loc5_19.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32]
  463. // CHECK:STDOUT: %.loc5_19.2: type = converted %int.make_type_32.loc5, %.loc5_19.1 [template = i32]
  464. // CHECK:STDOUT: %return: ref i32 = var <return slot>
  465. // CHECK:STDOUT: }
  466. // CHECK:STDOUT: %UseField.decl: %UseField.type = fn_decl @UseField [template = constants.%UseField] {} {
  467. // CHECK:STDOUT: %int.make_type_32.loc10: init type = call constants.%Int32() [template = i32]
  468. // CHECK:STDOUT: %.loc10_18.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32]
  469. // CHECK:STDOUT: %.loc10_18.2: type = converted %int.make_type_32.loc10, %.loc10_18.1 [template = i32]
  470. // CHECK:STDOUT: %return: ref i32 = var <return slot>
  471. // CHECK:STDOUT: }
  472. // CHECK:STDOUT: }
  473. // CHECK:STDOUT:
  474. // CHECK:STDOUT: generic class @CompleteClass(constants.%T: type) {
  475. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  476. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)]
  477. // CHECK:STDOUT:
  478. // CHECK:STDOUT: !definition:
  479. // CHECK:STDOUT: %CompleteClass: type = class_type @CompleteClass, @CompleteClass(%T) [symbolic = %CompleteClass (constants.%CompleteClass.2)]
  480. // CHECK:STDOUT: %.1: type = unbound_element_type @CompleteClass.%CompleteClass (%CompleteClass.2), i32 [symbolic = %.1 (constants.%.4)]
  481. // CHECK:STDOUT: %F.type: type = fn_type @F.1, @CompleteClass(%T) [symbolic = %F.type (constants.%F.type.1)]
  482. // CHECK:STDOUT: %F: @CompleteClass.%F.type (%F.type.1) = struct_value () [symbolic = %F (constants.%F.1)]
  483. // CHECK:STDOUT:
  484. // CHECK:STDOUT: class {
  485. // CHECK:STDOUT: !members:
  486. // CHECK:STDOUT: .Self = imports.%import_ref.5
  487. // CHECK:STDOUT: .n = imports.%import_ref.6
  488. // CHECK:STDOUT: .F = imports.%import_ref.7
  489. // CHECK:STDOUT: }
  490. // CHECK:STDOUT: }
  491. // CHECK:STDOUT:
  492. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  493. // CHECK:STDOUT:
  494. // CHECK:STDOUT: fn @UseMethod() -> i32 {
  495. // CHECK:STDOUT: !entry:
  496. // CHECK:STDOUT: %CompleteClass.ref: %CompleteClass.type = name_ref CompleteClass, imports.%import_ref.2 [template = constants.%CompleteClass.1]
  497. // CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%Int32() [template = i32]
  498. // CHECK:STDOUT: %.loc6_23.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32]
  499. // CHECK:STDOUT: %.loc6_23.2: type = converted %int.make_type_32.loc6, %.loc6_23.1 [template = i32]
  500. // CHECK:STDOUT: %CompleteClass: type = class_type @CompleteClass, @CompleteClass(i32) [template = constants.%CompleteClass.3]
  501. // CHECK:STDOUT: %v.var: ref %CompleteClass.3 = var v
  502. // CHECK:STDOUT: %v: ref %CompleteClass.3 = bind_name v, %v.var
  503. // CHECK:STDOUT: %F.ref.loc6: %F.type.3 = name_ref F, imports.%import_ref.3 [template = constants.%F.3]
  504. // CHECK:STDOUT: %.loc6_7: ref %CompleteClass.3 = splice_block %v.var {}
  505. // CHECK:STDOUT: %F.call.loc6: init %CompleteClass.3 = call %F.ref.loc6() to %.loc6_7
  506. // CHECK:STDOUT: assign %v.var, %F.call.loc6
  507. // CHECK:STDOUT: %v.ref: ref %CompleteClass.3 = name_ref v, %v
  508. // CHECK:STDOUT: %.loc7_11.1: %F.type.2 = specific_constant imports.%import_ref.7, @CompleteClass(i32) [template = constants.%F.2]
  509. // CHECK:STDOUT: %F.ref.loc7: %F.type.2 = name_ref F, %.loc7_11.1 [template = constants.%F.2]
  510. // CHECK:STDOUT: %.loc7_11.2: <specific function> = specific_function %F.ref.loc7, @F.1(i32) [template = constants.%.7]
  511. // CHECK:STDOUT: %F.call.loc7: init i32 = call %.loc7_11.2()
  512. // CHECK:STDOUT: %.loc7_15.1: i32 = value_of_initializer %F.call.loc7
  513. // CHECK:STDOUT: %.loc7_15.2: i32 = converted %F.call.loc7, %.loc7_15.1
  514. // CHECK:STDOUT: return %.loc7_15.2
  515. // CHECK:STDOUT: }
  516. // CHECK:STDOUT:
  517. // CHECK:STDOUT: generic fn @F.1(constants.%T: type) {
  518. // CHECK:STDOUT: !definition:
  519. // CHECK:STDOUT:
  520. // CHECK:STDOUT: fn() -> i32;
  521. // CHECK:STDOUT: }
  522. // CHECK:STDOUT:
  523. // CHECK:STDOUT: fn @F.2() -> %CompleteClass.3;
  524. // CHECK:STDOUT:
  525. // CHECK:STDOUT: fn @UseField() -> i32 {
  526. // CHECK:STDOUT: !entry:
  527. // CHECK:STDOUT: %CompleteClass.ref: %CompleteClass.type = name_ref CompleteClass, imports.%import_ref.2 [template = constants.%CompleteClass.1]
  528. // CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%Int32() [template = i32]
  529. // CHECK:STDOUT: %.loc11_23.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32]
  530. // CHECK:STDOUT: %.loc11_23.2: type = converted %int.make_type_32.loc11, %.loc11_23.1 [template = i32]
  531. // CHECK:STDOUT: %CompleteClass: type = class_type @CompleteClass, @CompleteClass(i32) [template = constants.%CompleteClass.3]
  532. // CHECK:STDOUT: %v.var: ref %CompleteClass.3 = var v
  533. // CHECK:STDOUT: %v: ref %CompleteClass.3 = bind_name v, %v.var
  534. // CHECK:STDOUT: %F.ref: %F.type.3 = name_ref F, imports.%import_ref.3 [template = constants.%F.3]
  535. // CHECK:STDOUT: %.loc11_7: ref %CompleteClass.3 = splice_block %v.var {}
  536. // CHECK:STDOUT: %F.call: init %CompleteClass.3 = call %F.ref() to %.loc11_7
  537. // CHECK:STDOUT: assign %v.var, %F.call
  538. // CHECK:STDOUT: %v.ref: ref %CompleteClass.3 = name_ref v, %v
  539. // CHECK:STDOUT: %n.ref: %.5 = name_ref n, imports.%import_ref.6 [template = imports.%.1]
  540. // CHECK:STDOUT: %.loc12_11.1: ref i32 = class_element_access %v.ref, element0
  541. // CHECK:STDOUT: %.loc12_11.2: i32 = bind_value %.loc12_11.1
  542. // CHECK:STDOUT: return %.loc12_11.2
  543. // CHECK:STDOUT: }
  544. // CHECK:STDOUT:
  545. // CHECK:STDOUT: specific @CompleteClass(constants.%T) {
  546. // CHECK:STDOUT: %T => constants.%T
  547. // CHECK:STDOUT: %T.patt => constants.%T
  548. // CHECK:STDOUT:
  549. // CHECK:STDOUT: !definition:
  550. // CHECK:STDOUT: %CompleteClass => constants.%CompleteClass.2
  551. // CHECK:STDOUT: %.1 => constants.%.4
  552. // CHECK:STDOUT: %F.type => constants.%F.type.1
  553. // CHECK:STDOUT: %F => constants.%F.1
  554. // CHECK:STDOUT: }
  555. // CHECK:STDOUT:
  556. // CHECK:STDOUT: specific @CompleteClass(@CompleteClass.%T) {
  557. // CHECK:STDOUT: %T => constants.%T
  558. // CHECK:STDOUT: %T.patt => constants.%T
  559. // CHECK:STDOUT: }
  560. // CHECK:STDOUT:
  561. // CHECK:STDOUT: specific @F.1(constants.%T) {}
  562. // CHECK:STDOUT:
  563. // CHECK:STDOUT: specific @CompleteClass(i32) {
  564. // CHECK:STDOUT: %T => i32
  565. // CHECK:STDOUT: %T.patt => i32
  566. // CHECK:STDOUT:
  567. // CHECK:STDOUT: !definition:
  568. // CHECK:STDOUT: %CompleteClass => constants.%CompleteClass.3
  569. // CHECK:STDOUT: %.1 => constants.%.5
  570. // CHECK:STDOUT: %F.type => constants.%F.type.2
  571. // CHECK:STDOUT: %F => constants.%F.2
  572. // CHECK:STDOUT: }
  573. // CHECK:STDOUT:
  574. // CHECK:STDOUT: specific @F.1(i32) {
  575. // CHECK:STDOUT: !definition:
  576. // CHECK:STDOUT: }
  577. // CHECK:STDOUT:
  578. // CHECK:STDOUT: --- fail_generic_arg_mismatch.carbon
  579. // CHECK:STDOUT:
  580. // CHECK:STDOUT: constants {
  581. // CHECK:STDOUT: %Use.type: type = fn_type @Use [template]
  582. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  583. // CHECK:STDOUT: %Use: %Use.type = struct_value () [template]
  584. // CHECK:STDOUT: %CompleteClass.type: type = generic_class_type @CompleteClass [template]
  585. // CHECK:STDOUT: %CompleteClass.1: %CompleteClass.type = struct_value () [template]
  586. // CHECK:STDOUT: %.2: type = struct_type {.n: i32} [template]
  587. // CHECK:STDOUT: %.3: <witness> = complete_type_witness %.2 [template]
  588. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  589. // CHECK:STDOUT: %CompleteClass.2: type = class_type @CompleteClass, @CompleteClass(%T) [symbolic]
  590. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  591. // CHECK:STDOUT: %.4: type = unbound_element_type %CompleteClass.2, i32 [symbolic]
  592. // CHECK:STDOUT: %F.type.1: type = fn_type @F.1, @CompleteClass(%T) [symbolic]
  593. // CHECK:STDOUT: %F.1: %F.type.1 = struct_value () [symbolic]
  594. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  595. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  596. // CHECK:STDOUT: %.5: type = ptr_type i32 [template]
  597. // CHECK:STDOUT: %CompleteClass.3: type = class_type @CompleteClass, @CompleteClass(%.5) [template]
  598. // CHECK:STDOUT: %.6: type = unbound_element_type %CompleteClass.3, i32 [template]
  599. // CHECK:STDOUT: %F.type.2: type = fn_type @F.1, @CompleteClass(%.5) [template]
  600. // CHECK:STDOUT: %F.2: %F.type.2 = struct_value () [template]
  601. // CHECK:STDOUT: %.7: type = ptr_type %.2 [template]
  602. // CHECK:STDOUT: %F.type.3: type = fn_type @F.2 [template]
  603. // CHECK:STDOUT: %F.3: %F.type.3 = struct_value () [template]
  604. // CHECK:STDOUT: %CompleteClass.4: type = class_type @CompleteClass, @CompleteClass(i32) [template]
  605. // CHECK:STDOUT: %.8: type = unbound_element_type %CompleteClass.4, i32 [template]
  606. // CHECK:STDOUT: %F.type.4: type = fn_type @F.1, @CompleteClass(i32) [template]
  607. // CHECK:STDOUT: %F.4: %F.type.4 = struct_value () [template]
  608. // CHECK:STDOUT: %ImplicitAs.type.1: type = generic_interface_type @ImplicitAs [template]
  609. // CHECK:STDOUT: %ImplicitAs: %ImplicitAs.type.1 = struct_value () [template]
  610. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic]
  611. // CHECK:STDOUT: %ImplicitAs.type.2: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic]
  612. // CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic]
  613. // CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic]
  614. // CHECK:STDOUT: %Self.2: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic]
  615. // CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic]
  616. // CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic]
  617. // CHECK:STDOUT: %.9: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic]
  618. // CHECK:STDOUT: %.10: %.9 = assoc_entity element0, imports.%import_ref.12 [symbolic]
  619. // CHECK:STDOUT: %ImplicitAs.type.3: type = interface_type @ImplicitAs, @ImplicitAs(%CompleteClass.3) [template]
  620. // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert, @ImplicitAs(%CompleteClass.3) [template]
  621. // CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template]
  622. // CHECK:STDOUT: %.11: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template]
  623. // CHECK:STDOUT: %.12: %.11 = assoc_entity element0, imports.%import_ref.12 [template]
  624. // CHECK:STDOUT: %.13: %.9 = assoc_entity element0, imports.%import_ref.13 [symbolic]
  625. // CHECK:STDOUT: }
  626. // CHECK:STDOUT:
  627. // CHECK:STDOUT: imports {
  628. // CHECK:STDOUT: %import_ref.1 = import_ref Main//foo, inst+9, unloaded
  629. // CHECK:STDOUT: %import_ref.2: %CompleteClass.type = import_ref Main//foo, inst+21, loaded [template = constants.%CompleteClass.1]
  630. // CHECK:STDOUT: %import_ref.3: %F.type.3 = import_ref Main//foo, inst+63, loaded [template = constants.%F.3]
  631. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  632. // CHECK:STDOUT: .Int32 = %import_ref.7
  633. // CHECK:STDOUT: .ImplicitAs = %import_ref.8
  634. // CHECK:STDOUT: import Core//prelude
  635. // CHECK:STDOUT: import Core//prelude/operators
  636. // CHECK:STDOUT: import Core//prelude/types
  637. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  638. // CHECK:STDOUT: import Core//prelude/operators/as
  639. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  640. // CHECK:STDOUT: import Core//prelude/operators/comparison
  641. // CHECK:STDOUT: import Core//prelude/types/bool
  642. // CHECK:STDOUT: }
  643. // CHECK:STDOUT: %import_ref.4 = import_ref Main//foo, inst+26, unloaded
  644. // CHECK:STDOUT: %import_ref.5 = import_ref Main//foo, inst+36, unloaded
  645. // CHECK:STDOUT: %import_ref.6 = import_ref Main//foo, inst+43, unloaded
  646. // CHECK:STDOUT: %import_ref.7: %Int32.type = import_ref Core//prelude/types, inst+9, loaded [template = constants.%Int32]
  647. // CHECK:STDOUT: %import_ref.8: %ImplicitAs.type.1 = import_ref Core//prelude/operators/as, inst+46, loaded [template = constants.%ImplicitAs]
  648. // CHECK:STDOUT: %import_ref.9 = import_ref Core//prelude/operators/as, inst+52, unloaded
  649. // CHECK:STDOUT: %import_ref.10: @ImplicitAs.%.1 (%.9) = import_ref Core//prelude/operators/as, inst+71, loaded [symbolic = @ImplicitAs.%.2 (constants.%.13)]
  650. // CHECK:STDOUT: %import_ref.11 = import_ref Core//prelude/operators/as, inst+64, unloaded
  651. // CHECK:STDOUT: %import_ref.12 = import_ref Core//prelude/operators/as, inst+64, unloaded
  652. // CHECK:STDOUT: %import_ref.13 = import_ref Core//prelude/operators/as, inst+64, unloaded
  653. // CHECK:STDOUT: }
  654. // CHECK:STDOUT:
  655. // CHECK:STDOUT: file {
  656. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  657. // CHECK:STDOUT: .Class = imports.%import_ref.1
  658. // CHECK:STDOUT: .CompleteClass = imports.%import_ref.2
  659. // CHECK:STDOUT: .F = imports.%import_ref.3
  660. // CHECK:STDOUT: .Core = imports.%Core
  661. // CHECK:STDOUT: .Use = %Use.decl
  662. // CHECK:STDOUT: }
  663. // CHECK:STDOUT: %Core.import = import Core
  664. // CHECK:STDOUT: %default.import = import <invalid>
  665. // CHECK:STDOUT: %Use.decl: %Use.type = fn_decl @Use [template = constants.%Use] {} {}
  666. // CHECK:STDOUT: }
  667. // CHECK:STDOUT:
  668. // CHECK:STDOUT: generic interface @ImplicitAs(constants.%Dest: type) {
  669. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
  670. // CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)]
  671. // CHECK:STDOUT:
  672. // CHECK:STDOUT: !definition:
  673. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
  674. // CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)]
  675. // CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.1)]
  676. // CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)]
  677. // CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.9)]
  678. // CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.9) = assoc_entity element0, imports.%import_ref.12 [symbolic = %.2 (constants.%.10)]
  679. // CHECK:STDOUT:
  680. // CHECK:STDOUT: interface {
  681. // CHECK:STDOUT: !members:
  682. // CHECK:STDOUT: .Self = imports.%import_ref.9
  683. // CHECK:STDOUT: .Convert = imports.%import_ref.10
  684. // CHECK:STDOUT: witness = (imports.%import_ref.11)
  685. // CHECK:STDOUT: }
  686. // CHECK:STDOUT: }
  687. // CHECK:STDOUT:
  688. // CHECK:STDOUT: generic class @CompleteClass(constants.%T: type) {
  689. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  690. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)]
  691. // CHECK:STDOUT:
  692. // CHECK:STDOUT: !definition:
  693. // CHECK:STDOUT: %CompleteClass: type = class_type @CompleteClass, @CompleteClass(%T) [symbolic = %CompleteClass (constants.%CompleteClass.2)]
  694. // CHECK:STDOUT: %.1: type = unbound_element_type @CompleteClass.%CompleteClass (%CompleteClass.2), i32 [symbolic = %.1 (constants.%.4)]
  695. // CHECK:STDOUT: %F.type: type = fn_type @F.1, @CompleteClass(%T) [symbolic = %F.type (constants.%F.type.1)]
  696. // CHECK:STDOUT: %F: @CompleteClass.%F.type (%F.type.1) = struct_value () [symbolic = %F (constants.%F.1)]
  697. // CHECK:STDOUT:
  698. // CHECK:STDOUT: class {
  699. // CHECK:STDOUT: !members:
  700. // CHECK:STDOUT: .Self = imports.%import_ref.4
  701. // CHECK:STDOUT: .n = imports.%import_ref.5
  702. // CHECK:STDOUT: .F = imports.%import_ref.6
  703. // CHECK:STDOUT: }
  704. // CHECK:STDOUT: }
  705. // CHECK:STDOUT:
  706. // CHECK:STDOUT: fn @Use() {
  707. // CHECK:STDOUT: !entry:
  708. // CHECK:STDOUT: %CompleteClass.ref: %CompleteClass.type = name_ref CompleteClass, imports.%import_ref.2 [template = constants.%CompleteClass.1]
  709. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  710. // CHECK:STDOUT: %.loc14_27.1: type = value_of_initializer %int.make_type_32 [template = i32]
  711. // CHECK:STDOUT: %.loc14_27.2: type = converted %int.make_type_32, %.loc14_27.1 [template = i32]
  712. // CHECK:STDOUT: %.loc14_27.3: type = ptr_type i32 [template = constants.%.5]
  713. // CHECK:STDOUT: %CompleteClass: type = class_type @CompleteClass, @CompleteClass(constants.%.5) [template = constants.%CompleteClass.3]
  714. // CHECK:STDOUT: %v.var: ref %CompleteClass.3 = var v
  715. // CHECK:STDOUT: %v: ref %CompleteClass.3 = bind_name v, %v.var
  716. // CHECK:STDOUT: %F.ref: %F.type.3 = name_ref F, imports.%import_ref.3 [template = constants.%F.3]
  717. // CHECK:STDOUT: %.loc14_33.1: ref %CompleteClass.4 = temporary_storage
  718. // CHECK:STDOUT: %F.call: init %CompleteClass.4 = call %F.ref() to %.loc14_33.1
  719. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(constants.%CompleteClass.3) [template = constants.%ImplicitAs.type.3]
  720. // CHECK:STDOUT: %.loc14_35.1: %.11 = specific_constant imports.%import_ref.10, @ImplicitAs(constants.%CompleteClass.3) [template = constants.%.12]
  721. // CHECK:STDOUT: %Convert.ref: %.11 = name_ref Convert, %.loc14_35.1 [template = constants.%.12]
  722. // CHECK:STDOUT: %.loc14_33.2: ref %CompleteClass.4 = temporary %.loc14_33.1, %F.call
  723. // CHECK:STDOUT: %.loc14_35.2: %CompleteClass.3 = converted %F.call, <error> [template = <error>]
  724. // CHECK:STDOUT: assign %v.var, <error>
  725. // CHECK:STDOUT: return
  726. // CHECK:STDOUT: }
  727. // CHECK:STDOUT:
  728. // CHECK:STDOUT: generic fn @F.1(constants.%T: type) {
  729. // CHECK:STDOUT: !definition:
  730. // CHECK:STDOUT:
  731. // CHECK:STDOUT: fn() -> i32;
  732. // CHECK:STDOUT: }
  733. // CHECK:STDOUT:
  734. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  735. // CHECK:STDOUT:
  736. // CHECK:STDOUT: fn @F.2() -> %CompleteClass.4;
  737. // CHECK:STDOUT:
  738. // CHECK:STDOUT: generic fn @Convert(constants.%Dest: type, constants.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) {
  739. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
  740. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
  741. // CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)]
  742. // CHECK:STDOUT:
  743. // CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self (%Self.2)]() -> @Convert.%Dest (%Dest);
  744. // CHECK:STDOUT: }
  745. // CHECK:STDOUT:
  746. // CHECK:STDOUT: specific @CompleteClass(constants.%T) {
  747. // CHECK:STDOUT: %T => constants.%T
  748. // CHECK:STDOUT: %T.patt => constants.%T
  749. // CHECK:STDOUT:
  750. // CHECK:STDOUT: !definition:
  751. // CHECK:STDOUT: %CompleteClass => constants.%CompleteClass.2
  752. // CHECK:STDOUT: %.1 => constants.%.4
  753. // CHECK:STDOUT: %F.type => constants.%F.type.1
  754. // CHECK:STDOUT: %F => constants.%F.1
  755. // CHECK:STDOUT: }
  756. // CHECK:STDOUT:
  757. // CHECK:STDOUT: specific @CompleteClass(@CompleteClass.%T) {
  758. // CHECK:STDOUT: %T => constants.%T
  759. // CHECK:STDOUT: %T.patt => constants.%T
  760. // CHECK:STDOUT: }
  761. // CHECK:STDOUT:
  762. // CHECK:STDOUT: specific @F.1(constants.%T) {}
  763. // CHECK:STDOUT:
  764. // CHECK:STDOUT: specific @CompleteClass(constants.%.5) {
  765. // CHECK:STDOUT: %T => constants.%.5
  766. // CHECK:STDOUT: %T.patt => constants.%.5
  767. // CHECK:STDOUT:
  768. // CHECK:STDOUT: !definition:
  769. // CHECK:STDOUT: %CompleteClass => constants.%CompleteClass.3
  770. // CHECK:STDOUT: %.1 => constants.%.6
  771. // CHECK:STDOUT: %F.type => constants.%F.type.2
  772. // CHECK:STDOUT: %F => constants.%F.2
  773. // CHECK:STDOUT: }
  774. // CHECK:STDOUT:
  775. // CHECK:STDOUT: specific @CompleteClass(i32) {
  776. // CHECK:STDOUT: %T => i32
  777. // CHECK:STDOUT: %T.patt => i32
  778. // CHECK:STDOUT:
  779. // CHECK:STDOUT: !definition:
  780. // CHECK:STDOUT: %CompleteClass => constants.%CompleteClass.4
  781. // CHECK:STDOUT: %.1 => constants.%.8
  782. // CHECK:STDOUT: %F.type => constants.%F.type.4
  783. // CHECK:STDOUT: %F => constants.%F.4
  784. // CHECK:STDOUT: }
  785. // CHECK:STDOUT:
  786. // CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) {
  787. // CHECK:STDOUT: %Dest => constants.%Dest
  788. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  789. // CHECK:STDOUT: }
  790. // CHECK:STDOUT:
  791. // CHECK:STDOUT: specific @ImplicitAs(@ImplicitAs.%Dest) {
  792. // CHECK:STDOUT: %Dest => constants.%Dest
  793. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  794. // CHECK:STDOUT: }
  795. // CHECK:STDOUT:
  796. // CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {
  797. // CHECK:STDOUT: %Dest => constants.%Dest
  798. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  799. // CHECK:STDOUT: }
  800. // CHECK:STDOUT:
  801. // CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self.1) {
  802. // CHECK:STDOUT: %Dest => constants.%Dest
  803. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2
  804. // CHECK:STDOUT: %Self => constants.%Self.1
  805. // CHECK:STDOUT: }
  806. // CHECK:STDOUT:
  807. // CHECK:STDOUT: specific @ImplicitAs(constants.%CompleteClass.3) {
  808. // CHECK:STDOUT: %Dest => constants.%CompleteClass.3
  809. // CHECK:STDOUT: %Dest.patt => constants.%CompleteClass.3
  810. // CHECK:STDOUT:
  811. // CHECK:STDOUT: !definition:
  812. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3
  813. // CHECK:STDOUT: %Self => constants.%Self.2
  814. // CHECK:STDOUT: %Convert.type => constants.%Convert.type.2
  815. // CHECK:STDOUT: %Convert => constants.%Convert.2
  816. // CHECK:STDOUT: %.1 => constants.%.11
  817. // CHECK:STDOUT: %.2 => constants.%.12
  818. // CHECK:STDOUT: }
  819. // CHECK:STDOUT:
  820. // CHECK:STDOUT: --- fail_foo.impl.carbon
  821. // CHECK:STDOUT:
  822. // CHECK:STDOUT: constants {
  823. // CHECK:STDOUT: %U: type = bind_symbolic_name U, 0 [symbolic]
  824. // CHECK:STDOUT: %U.patt: type = symbolic_binding_pattern U, 0 [symbolic]
  825. // CHECK:STDOUT: %Class.type: type = generic_class_type @Class [template]
  826. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  827. // CHECK:STDOUT: %Class.1: %Class.type = struct_value () [template]
  828. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  829. // CHECK:STDOUT: %Class.2: type = class_type @Class, @Class(%T) [symbolic]
  830. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  831. // CHECK:STDOUT: %.type: type = generic_class_type @.1 [template]
  832. // CHECK:STDOUT: %.2: %.type = struct_value () [template]
  833. // CHECK:STDOUT: %.3: type = class_type @.1, @.1(%U) [symbolic]
  834. // CHECK:STDOUT: }
  835. // CHECK:STDOUT:
  836. // CHECK:STDOUT: imports {
  837. // CHECK:STDOUT: %import_ref.1: %Class.type = import_ref Main//foo, inst+9, loaded [template = constants.%Class.1]
  838. // CHECK:STDOUT: %import_ref.2 = import_ref Main//foo, inst+21, unloaded
  839. // CHECK:STDOUT: %import_ref.3 = import_ref Main//foo, inst+63, unloaded
  840. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  841. // CHECK:STDOUT: import Core//prelude
  842. // CHECK:STDOUT: import Core//prelude/operators
  843. // CHECK:STDOUT: import Core//prelude/types
  844. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  845. // CHECK:STDOUT: import Core//prelude/operators/as
  846. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  847. // CHECK:STDOUT: import Core//prelude/operators/comparison
  848. // CHECK:STDOUT: import Core//prelude/types/bool
  849. // CHECK:STDOUT: }
  850. // CHECK:STDOUT: }
  851. // CHECK:STDOUT:
  852. // CHECK:STDOUT: file {
  853. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  854. // CHECK:STDOUT: .Class = imports.%import_ref.1
  855. // CHECK:STDOUT: .CompleteClass = imports.%import_ref.2
  856. // CHECK:STDOUT: .F = imports.%import_ref.3
  857. // CHECK:STDOUT: .Core = imports.%Core
  858. // CHECK:STDOUT: }
  859. // CHECK:STDOUT: %default.import.loc2_6.1 = import <invalid>
  860. // CHECK:STDOUT: %default.import.loc2_6.2 = import <invalid>
  861. // CHECK:STDOUT: %Core.import = import Core
  862. // CHECK:STDOUT: %.decl: %.type = class_decl @.1 [template = constants.%.2] {
  863. // CHECK:STDOUT: %U.patt.loc12_13.1: type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc12_13.2 (constants.%U.patt)]
  864. // CHECK:STDOUT: %U.param_patt: type = param_pattern %U.patt.loc12_13.1, runtime_param<invalid> [symbolic = %U.patt.loc12_13.2 (constants.%U.patt)]
  865. // CHECK:STDOUT: } {
  866. // CHECK:STDOUT: %param: type = param runtime_param<invalid>
  867. // CHECK:STDOUT: %U.loc12_13.1: type = bind_symbolic_name U, 0, %param [symbolic = %U.loc12_13.2 (constants.%U)]
  868. // CHECK:STDOUT: }
  869. // CHECK:STDOUT: }
  870. // CHECK:STDOUT:
  871. // CHECK:STDOUT: generic class @Class(constants.%T: type) {
  872. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  873. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)]
  874. // CHECK:STDOUT:
  875. // CHECK:STDOUT: class;
  876. // CHECK:STDOUT: }
  877. // CHECK:STDOUT:
  878. // CHECK:STDOUT: generic class @.1(%U.loc12_13.1: type) {
  879. // CHECK:STDOUT: %U.loc12_13.2: type = bind_symbolic_name U, 0 [symbolic = %U.loc12_13.2 (constants.%U)]
  880. // CHECK:STDOUT: %U.patt.loc12_13.2: type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc12_13.2 (constants.%U.patt)]
  881. // CHECK:STDOUT:
  882. // CHECK:STDOUT: !definition:
  883. // CHECK:STDOUT:
  884. // CHECK:STDOUT: class {
  885. // CHECK:STDOUT: %T.ref: <error> = name_ref T, <error> [template = <error>]
  886. // CHECK:STDOUT: %.loc16: <error> = field_decl x, element0 [template]
  887. // CHECK:STDOUT: %.loc17: <witness> = complete_type_witness <error> [template = <error>]
  888. // CHECK:STDOUT:
  889. // CHECK:STDOUT: !members:
  890. // CHECK:STDOUT: .Self = constants.%.3
  891. // CHECK:STDOUT: .x = %.loc16
  892. // CHECK:STDOUT: }
  893. // CHECK:STDOUT: }
  894. // CHECK:STDOUT:
  895. // CHECK:STDOUT: specific @Class(constants.%T) {
  896. // CHECK:STDOUT: %T => constants.%T
  897. // CHECK:STDOUT: %T.patt => constants.%T
  898. // CHECK:STDOUT: }
  899. // CHECK:STDOUT:
  900. // CHECK:STDOUT: specific @.1(constants.%U) {
  901. // CHECK:STDOUT: %U.loc12_13.2 => constants.%U
  902. // CHECK:STDOUT: %U.patt.loc12_13.2 => constants.%U
  903. // CHECK:STDOUT: }
  904. // CHECK:STDOUT: