import.carbon 52 KB

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