call.carbon 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813
  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/call.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/generic/call.carbon
  10. // --- call.carbon
  11. library "[[@TEST_NAME]]";
  12. class Class(T:! type, N:! i32) {}
  13. var a: Class(i32*, 5);
  14. // Requires an implicit conversion to type `type`.
  15. var b: Class((), 0);
  16. // --- fail_too_few.carbon
  17. library "[[@TEST_NAME]]";
  18. class Class(T:! type, N:! i32) {}
  19. // CHECK:STDERR: fail_too_few.carbon:[[@LINE+7]]:8: error: 1 argument passed to generic class expecting 2 arguments [CallArgCountMismatch]
  20. // CHECK:STDERR: var a: Class(i32*);
  21. // CHECK:STDERR: ^~~~~~~~~~~
  22. // CHECK:STDERR: fail_too_few.carbon:[[@LINE-5]]:1: note: calling generic class declared here [InCallToEntity]
  23. // CHECK:STDERR: class Class(T:! type, N:! i32) {}
  24. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  25. // CHECK:STDERR:
  26. var a: Class(i32*);
  27. // --- fail_too_many.carbon
  28. library "[[@TEST_NAME]]";
  29. class Class(T:! type, N:! i32) {}
  30. // CHECK:STDERR: fail_too_many.carbon:[[@LINE+7]]:8: error: 3 arguments passed to generic class expecting 2 arguments [CallArgCountMismatch]
  31. // CHECK:STDERR: var a: Class(i32*, 1, 2);
  32. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~
  33. // CHECK:STDERR: fail_too_many.carbon:[[@LINE-5]]:1: note: calling generic class declared here [InCallToEntity]
  34. // CHECK:STDERR: class Class(T:! type, N:! i32) {}
  35. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  36. // CHECK:STDERR:
  37. var a: Class(i32*, 1, 2);
  38. // --- fail_no_conversion.carbon
  39. library "[[@TEST_NAME]]";
  40. class Class(T:! type, N:! i32) {}
  41. // CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+10]]:8: error: cannot implicitly convert value of type `Core.IntLiteral` to `type` [ImplicitAsConversionFailure]
  42. // CHECK:STDERR: var a: Class(5, i32*);
  43. // CHECK:STDERR: ^~~~~~~~~~~~~~
  44. // CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+7]]:8: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote]
  45. // CHECK:STDERR: var a: Class(5, i32*);
  46. // CHECK:STDERR: ^~~~~~~~~~~~~~
  47. // CHECK:STDERR: fail_no_conversion.carbon:[[@LINE-8]]:13: note: initializing generic parameter `T` declared here [InitializingGenericParam]
  48. // CHECK:STDERR: class Class(T:! type, N:! i32) {}
  49. // CHECK:STDERR: ^
  50. // CHECK:STDERR:
  51. var a: Class(5, i32*);
  52. // --- call_in_nested_return_type.carbon
  53. class Outer(T:! type) {
  54. class Inner(U:! type) {
  55. fn A() -> Outer(T) {
  56. return {};
  57. }
  58. fn B() -> Outer(U) {
  59. return {};
  60. }
  61. fn C() -> Inner(T) {
  62. return {};
  63. }
  64. fn D() -> Inner(U) {
  65. return {};
  66. }
  67. }
  68. }
  69. // CHECK:STDOUT: --- call.carbon
  70. // CHECK:STDOUT:
  71. // CHECK:STDOUT: constants {
  72. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  73. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  74. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  75. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  76. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  77. // CHECK:STDOUT: %N.356: %i32 = bind_symbolic_name N, 1 [symbolic]
  78. // CHECK:STDOUT: %N.patt.8cf: %i32 = symbolic_binding_pattern N, 1 [symbolic]
  79. // CHECK:STDOUT: %Class.type: type = generic_class_type @Class [concrete]
  80. // CHECK:STDOUT: %Class.generic: %Class.type = struct_value () [concrete]
  81. // CHECK:STDOUT: %Class.ab2: type = class_type @Class, @Class(%T, %N.356) [symbolic]
  82. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  83. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  84. // CHECK:STDOUT: %ptr.235: type = ptr_type %i32 [concrete]
  85. // CHECK:STDOUT: %int_5.64b: Core.IntLiteral = int_value 5 [concrete]
  86. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  87. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  88. // CHECK:STDOUT: %impl_witness.d39: <witness> = impl_witness (imports.%Core.import_ref.a5b), @impl.4f9(%int_32) [concrete]
  89. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  90. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  91. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, %impl_witness.d39 [concrete]
  92. // CHECK:STDOUT: %.a0b: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  93. // CHECK:STDOUT: %Convert.bound.4e6: <bound method> = bound_method %int_5.64b, %Convert.956 [concrete]
  94. // CHECK:STDOUT: %Convert.specific_fn.ba9: <specific function> = specific_function %Convert.bound.4e6, @Convert.2(%int_32) [concrete]
  95. // CHECK:STDOUT: %int_5.0f6: %i32 = int_value 5 [concrete]
  96. // CHECK:STDOUT: %Class.f29: type = class_type @Class, @Class(%ptr.235, %int_5.0f6) [concrete]
  97. // CHECK:STDOUT: %int_0.5c6: Core.IntLiteral = int_value 0 [concrete]
  98. // CHECK:STDOUT: %Convert.bound.d04: <bound method> = bound_method %int_0.5c6, %Convert.956 [concrete]
  99. // CHECK:STDOUT: %Convert.specific_fn.d62: <specific function> = specific_function %Convert.bound.d04, @Convert.2(%int_32) [concrete]
  100. // CHECK:STDOUT: %int_0.6a9: %i32 = int_value 0 [concrete]
  101. // CHECK:STDOUT: %Class.dd4: type = class_type @Class, @Class(%empty_tuple.type, %int_0.6a9) [concrete]
  102. // CHECK:STDOUT: }
  103. // CHECK:STDOUT:
  104. // CHECK:STDOUT: imports {
  105. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  106. // CHECK:STDOUT: .Int = %Core.Int
  107. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  108. // CHECK:STDOUT: import Core//prelude
  109. // CHECK:STDOUT: import Core//prelude/...
  110. // CHECK:STDOUT: }
  111. // CHECK:STDOUT: }
  112. // CHECK:STDOUT:
  113. // CHECK:STDOUT: file {
  114. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  115. // CHECK:STDOUT: .Core = imports.%Core
  116. // CHECK:STDOUT: .Class = %Class.decl
  117. // CHECK:STDOUT: .a = %a
  118. // CHECK:STDOUT: .b = %b
  119. // CHECK:STDOUT: }
  120. // CHECK:STDOUT: %Core.import = import Core
  121. // CHECK:STDOUT: %Class.decl: %Class.type = class_decl @Class [concrete = constants.%Class.generic] {
  122. // CHECK:STDOUT: %T.patt.loc4_13.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_13.2 (constants.%T.patt)]
  123. // CHECK:STDOUT: %N.patt.loc4_23.1: %i32 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_23.2 (constants.%N.patt.8cf)]
  124. // CHECK:STDOUT: } {
  125. // CHECK:STDOUT: %T.loc4_13.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_13.2 (constants.%T)]
  126. // CHECK:STDOUT: %.loc4: type = splice_block %i32 [concrete = constants.%i32] {
  127. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  128. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  129. // CHECK:STDOUT: }
  130. // CHECK:STDOUT: %N.loc4_23.1: %i32 = bind_symbolic_name N, 1 [symbolic = %N.loc4_23.2 (constants.%N.356)]
  131. // CHECK:STDOUT: }
  132. // CHECK:STDOUT: name_binding_decl {
  133. // CHECK:STDOUT: %a.patt: %Class.f29 = binding_pattern a
  134. // CHECK:STDOUT: %.loc6_1: %Class.f29 = var_pattern %a.patt
  135. // CHECK:STDOUT: }
  136. // CHECK:STDOUT: %a.var: ref %Class.f29 = var a
  137. // CHECK:STDOUT: %.loc6_21.1: type = splice_block %Class.loc6 [concrete = constants.%Class.f29] {
  138. // CHECK:STDOUT: %Class.ref.loc6: %Class.type = name_ref Class, %Class.decl [concrete = constants.%Class.generic]
  139. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  140. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  141. // CHECK:STDOUT: %ptr: type = ptr_type %i32 [concrete = constants.%ptr.235]
  142. // CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [concrete = constants.%int_5.64b]
  143. // CHECK:STDOUT: %impl.elem0.loc6: %.a0b = impl_witness_access constants.%impl_witness.d39, element0 [concrete = constants.%Convert.956]
  144. // CHECK:STDOUT: %bound_method.loc6: <bound method> = bound_method %int_5, %impl.elem0.loc6 [concrete = constants.%Convert.bound.4e6]
  145. // CHECK:STDOUT: %specific_fn.loc6: <specific function> = specific_function %bound_method.loc6, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn.ba9]
  146. // CHECK:STDOUT: %int.convert_checked.loc6: init %i32 = call %specific_fn.loc6(%int_5) [concrete = constants.%int_5.0f6]
  147. // CHECK:STDOUT: %.loc6_21.2: %i32 = value_of_initializer %int.convert_checked.loc6 [concrete = constants.%int_5.0f6]
  148. // CHECK:STDOUT: %.loc6_21.3: %i32 = converted %int_5, %.loc6_21.2 [concrete = constants.%int_5.0f6]
  149. // CHECK:STDOUT: %Class.loc6: type = class_type @Class, @Class(constants.%ptr.235, constants.%int_5.0f6) [concrete = constants.%Class.f29]
  150. // CHECK:STDOUT: }
  151. // CHECK:STDOUT: %a: ref %Class.f29 = bind_name a, %a.var
  152. // CHECK:STDOUT: name_binding_decl {
  153. // CHECK:STDOUT: %b.patt: %Class.dd4 = binding_pattern b
  154. // CHECK:STDOUT: %.loc9_1: %Class.dd4 = var_pattern %b.patt
  155. // CHECK:STDOUT: }
  156. // CHECK:STDOUT: %b.var: ref %Class.dd4 = var b
  157. // CHECK:STDOUT: %.loc9_19.1: type = splice_block %Class.loc9 [concrete = constants.%Class.dd4] {
  158. // CHECK:STDOUT: %Class.ref.loc9: %Class.type = name_ref Class, %Class.decl [concrete = constants.%Class.generic]
  159. // CHECK:STDOUT: %.loc9_15: %empty_tuple.type = tuple_literal ()
  160. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
  161. // CHECK:STDOUT: %.loc9_19.2: type = converted %.loc9_15, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  162. // CHECK:STDOUT: %impl.elem0.loc9: %.a0b = impl_witness_access constants.%impl_witness.d39, element0 [concrete = constants.%Convert.956]
  163. // CHECK:STDOUT: %bound_method.loc9: <bound method> = bound_method %int_0, %impl.elem0.loc9 [concrete = constants.%Convert.bound.d04]
  164. // CHECK:STDOUT: %specific_fn.loc9: <specific function> = specific_function %bound_method.loc9, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn.d62]
  165. // CHECK:STDOUT: %int.convert_checked.loc9: init %i32 = call %specific_fn.loc9(%int_0) [concrete = constants.%int_0.6a9]
  166. // CHECK:STDOUT: %.loc9_19.3: %i32 = value_of_initializer %int.convert_checked.loc9 [concrete = constants.%int_0.6a9]
  167. // CHECK:STDOUT: %.loc9_19.4: %i32 = converted %int_0, %.loc9_19.3 [concrete = constants.%int_0.6a9]
  168. // CHECK:STDOUT: %Class.loc9: type = class_type @Class, @Class(constants.%empty_tuple.type, constants.%int_0.6a9) [concrete = constants.%Class.dd4]
  169. // CHECK:STDOUT: }
  170. // CHECK:STDOUT: %b: ref %Class.dd4 = bind_name b, %b.var
  171. // CHECK:STDOUT: }
  172. // CHECK:STDOUT:
  173. // CHECK:STDOUT: generic class @Class(%T.loc4_13.1: type, %N.loc4_23.1: %i32) {
  174. // CHECK:STDOUT: %T.loc4_13.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_13.2 (constants.%T)]
  175. // CHECK:STDOUT: %T.patt.loc4_13.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_13.2 (constants.%T.patt)]
  176. // CHECK:STDOUT: %N.loc4_23.2: %i32 = bind_symbolic_name N, 1 [symbolic = %N.loc4_23.2 (constants.%N.356)]
  177. // CHECK:STDOUT: %N.patt.loc4_23.2: %i32 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_23.2 (constants.%N.patt.8cf)]
  178. // CHECK:STDOUT:
  179. // CHECK:STDOUT: !definition:
  180. // CHECK:STDOUT:
  181. // CHECK:STDOUT: class {
  182. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357]
  183. // CHECK:STDOUT: complete_type_witness = %complete_type
  184. // CHECK:STDOUT:
  185. // CHECK:STDOUT: !members:
  186. // CHECK:STDOUT: .Self = constants.%Class.ab2
  187. // CHECK:STDOUT: }
  188. // CHECK:STDOUT: }
  189. // CHECK:STDOUT:
  190. // CHECK:STDOUT: specific @Class(constants.%T, constants.%N.356) {
  191. // CHECK:STDOUT: %T.loc4_13.2 => constants.%T
  192. // CHECK:STDOUT: %T.patt.loc4_13.2 => constants.%T
  193. // CHECK:STDOUT: %N.loc4_23.2 => constants.%N.356
  194. // CHECK:STDOUT: %N.patt.loc4_23.2 => constants.%N.356
  195. // CHECK:STDOUT: }
  196. // CHECK:STDOUT:
  197. // CHECK:STDOUT: specific @Class(constants.%ptr.235, constants.%int_5.0f6) {
  198. // CHECK:STDOUT: %T.loc4_13.2 => constants.%ptr.235
  199. // CHECK:STDOUT: %T.patt.loc4_13.2 => constants.%ptr.235
  200. // CHECK:STDOUT: %N.loc4_23.2 => constants.%int_5.0f6
  201. // CHECK:STDOUT: %N.patt.loc4_23.2 => constants.%int_5.0f6
  202. // CHECK:STDOUT:
  203. // CHECK:STDOUT: !definition:
  204. // CHECK:STDOUT: }
  205. // CHECK:STDOUT:
  206. // CHECK:STDOUT: specific @Class(constants.%empty_tuple.type, constants.%int_0.6a9) {
  207. // CHECK:STDOUT: %T.loc4_13.2 => constants.%empty_tuple.type
  208. // CHECK:STDOUT: %T.patt.loc4_13.2 => constants.%empty_tuple.type
  209. // CHECK:STDOUT: %N.loc4_23.2 => constants.%int_0.6a9
  210. // CHECK:STDOUT: %N.patt.loc4_23.2 => constants.%int_0.6a9
  211. // CHECK:STDOUT:
  212. // CHECK:STDOUT: !definition:
  213. // CHECK:STDOUT: }
  214. // CHECK:STDOUT:
  215. // CHECK:STDOUT: --- fail_too_few.carbon
  216. // CHECK:STDOUT:
  217. // CHECK:STDOUT: constants {
  218. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  219. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  220. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  221. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  222. // CHECK:STDOUT: %N.356: %i32 = bind_symbolic_name N, 1 [symbolic]
  223. // CHECK:STDOUT: %N.patt.8cf: %i32 = symbolic_binding_pattern N, 1 [symbolic]
  224. // CHECK:STDOUT: %Class.type: type = generic_class_type @Class [concrete]
  225. // CHECK:STDOUT: %Class.generic: %Class.type = struct_value () [concrete]
  226. // CHECK:STDOUT: %Class: type = class_type @Class, @Class(%T, %N.356) [symbolic]
  227. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  228. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  229. // CHECK:STDOUT: %ptr: type = ptr_type %i32 [concrete]
  230. // CHECK:STDOUT: }
  231. // CHECK:STDOUT:
  232. // CHECK:STDOUT: imports {
  233. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  234. // CHECK:STDOUT: .Int = %Core.Int
  235. // CHECK:STDOUT: import Core//prelude
  236. // CHECK:STDOUT: import Core//prelude/...
  237. // CHECK:STDOUT: }
  238. // CHECK:STDOUT: }
  239. // CHECK:STDOUT:
  240. // CHECK:STDOUT: file {
  241. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  242. // CHECK:STDOUT: .Core = imports.%Core
  243. // CHECK:STDOUT: .Class = %Class.decl
  244. // CHECK:STDOUT: .a = %a
  245. // CHECK:STDOUT: }
  246. // CHECK:STDOUT: %Core.import = import Core
  247. // CHECK:STDOUT: %Class.decl: %Class.type = class_decl @Class [concrete = constants.%Class.generic] {
  248. // CHECK:STDOUT: %T.patt.loc4_13.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_13.2 (constants.%T.patt)]
  249. // CHECK:STDOUT: %N.patt.loc4_23.1: %i32 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_23.2 (constants.%N.patt.8cf)]
  250. // CHECK:STDOUT: } {
  251. // CHECK:STDOUT: %T.loc4_13.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_13.2 (constants.%T)]
  252. // CHECK:STDOUT: %.loc4: type = splice_block %i32 [concrete = constants.%i32] {
  253. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  254. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  255. // CHECK:STDOUT: }
  256. // CHECK:STDOUT: %N.loc4_23.1: %i32 = bind_symbolic_name N, 1 [symbolic = %N.loc4_23.2 (constants.%N.356)]
  257. // CHECK:STDOUT: }
  258. // CHECK:STDOUT: name_binding_decl {
  259. // CHECK:STDOUT: %a.patt: <error> = binding_pattern a
  260. // CHECK:STDOUT: %.loc13: <error> = var_pattern %a.patt
  261. // CHECK:STDOUT: }
  262. // CHECK:STDOUT: %a.var: ref <error> = var a
  263. // CHECK:STDOUT: %.1: <error> = splice_block <error> [concrete = <error>] {
  264. // CHECK:STDOUT: %Class.ref: %Class.type = name_ref Class, %Class.decl [concrete = constants.%Class.generic]
  265. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  266. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  267. // CHECK:STDOUT: %ptr: type = ptr_type %i32 [concrete = constants.%ptr]
  268. // CHECK:STDOUT: }
  269. // CHECK:STDOUT: %a: <error> = bind_name a, <error>
  270. // CHECK:STDOUT: }
  271. // CHECK:STDOUT:
  272. // CHECK:STDOUT: generic class @Class(%T.loc4_13.1: type, %N.loc4_23.1: %i32) {
  273. // CHECK:STDOUT: %T.loc4_13.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_13.2 (constants.%T)]
  274. // CHECK:STDOUT: %T.patt.loc4_13.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_13.2 (constants.%T.patt)]
  275. // CHECK:STDOUT: %N.loc4_23.2: %i32 = bind_symbolic_name N, 1 [symbolic = %N.loc4_23.2 (constants.%N.356)]
  276. // CHECK:STDOUT: %N.patt.loc4_23.2: %i32 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_23.2 (constants.%N.patt.8cf)]
  277. // CHECK:STDOUT:
  278. // CHECK:STDOUT: !definition:
  279. // CHECK:STDOUT:
  280. // CHECK:STDOUT: class {
  281. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357]
  282. // CHECK:STDOUT: complete_type_witness = %complete_type
  283. // CHECK:STDOUT:
  284. // CHECK:STDOUT: !members:
  285. // CHECK:STDOUT: .Self = constants.%Class
  286. // CHECK:STDOUT: }
  287. // CHECK:STDOUT: }
  288. // CHECK:STDOUT:
  289. // CHECK:STDOUT: specific @Class(constants.%T, constants.%N.356) {
  290. // CHECK:STDOUT: %T.loc4_13.2 => constants.%T
  291. // CHECK:STDOUT: %T.patt.loc4_13.2 => constants.%T
  292. // CHECK:STDOUT: %N.loc4_23.2 => constants.%N.356
  293. // CHECK:STDOUT: %N.patt.loc4_23.2 => constants.%N.356
  294. // CHECK:STDOUT: }
  295. // CHECK:STDOUT:
  296. // CHECK:STDOUT: --- fail_too_many.carbon
  297. // CHECK:STDOUT:
  298. // CHECK:STDOUT: constants {
  299. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  300. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  301. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  302. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  303. // CHECK:STDOUT: %N.356: %i32 = bind_symbolic_name N, 1 [symbolic]
  304. // CHECK:STDOUT: %N.patt.8cf: %i32 = symbolic_binding_pattern N, 1 [symbolic]
  305. // CHECK:STDOUT: %Class.type: type = generic_class_type @Class [concrete]
  306. // CHECK:STDOUT: %Class.generic: %Class.type = struct_value () [concrete]
  307. // CHECK:STDOUT: %Class: type = class_type @Class, @Class(%T, %N.356) [symbolic]
  308. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  309. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  310. // CHECK:STDOUT: %ptr: type = ptr_type %i32 [concrete]
  311. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete]
  312. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete]
  313. // CHECK:STDOUT: }
  314. // CHECK:STDOUT:
  315. // CHECK:STDOUT: imports {
  316. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  317. // CHECK:STDOUT: .Int = %Core.Int
  318. // CHECK:STDOUT: import Core//prelude
  319. // CHECK:STDOUT: import Core//prelude/...
  320. // CHECK:STDOUT: }
  321. // CHECK:STDOUT: }
  322. // CHECK:STDOUT:
  323. // CHECK:STDOUT: file {
  324. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  325. // CHECK:STDOUT: .Core = imports.%Core
  326. // CHECK:STDOUT: .Class = %Class.decl
  327. // CHECK:STDOUT: .a = %a
  328. // CHECK:STDOUT: }
  329. // CHECK:STDOUT: %Core.import = import Core
  330. // CHECK:STDOUT: %Class.decl: %Class.type = class_decl @Class [concrete = constants.%Class.generic] {
  331. // CHECK:STDOUT: %T.patt.loc4_13.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_13.2 (constants.%T.patt)]
  332. // CHECK:STDOUT: %N.patt.loc4_23.1: %i32 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_23.2 (constants.%N.patt.8cf)]
  333. // CHECK:STDOUT: } {
  334. // CHECK:STDOUT: %T.loc4_13.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_13.2 (constants.%T)]
  335. // CHECK:STDOUT: %.loc4: type = splice_block %i32 [concrete = constants.%i32] {
  336. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  337. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  338. // CHECK:STDOUT: }
  339. // CHECK:STDOUT: %N.loc4_23.1: %i32 = bind_symbolic_name N, 1 [symbolic = %N.loc4_23.2 (constants.%N.356)]
  340. // CHECK:STDOUT: }
  341. // CHECK:STDOUT: name_binding_decl {
  342. // CHECK:STDOUT: %a.patt: <error> = binding_pattern a
  343. // CHECK:STDOUT: %.loc13: <error> = var_pattern %a.patt
  344. // CHECK:STDOUT: }
  345. // CHECK:STDOUT: %a.var: ref <error> = var a
  346. // CHECK:STDOUT: %.1: <error> = splice_block <error> [concrete = <error>] {
  347. // CHECK:STDOUT: %Class.ref: %Class.type = name_ref Class, %Class.decl [concrete = constants.%Class.generic]
  348. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  349. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  350. // CHECK:STDOUT: %ptr: type = ptr_type %i32 [concrete = constants.%ptr]
  351. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
  352. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
  353. // CHECK:STDOUT: }
  354. // CHECK:STDOUT: %a: <error> = bind_name a, <error>
  355. // CHECK:STDOUT: }
  356. // CHECK:STDOUT:
  357. // CHECK:STDOUT: generic class @Class(%T.loc4_13.1: type, %N.loc4_23.1: %i32) {
  358. // CHECK:STDOUT: %T.loc4_13.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_13.2 (constants.%T)]
  359. // CHECK:STDOUT: %T.patt.loc4_13.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_13.2 (constants.%T.patt)]
  360. // CHECK:STDOUT: %N.loc4_23.2: %i32 = bind_symbolic_name N, 1 [symbolic = %N.loc4_23.2 (constants.%N.356)]
  361. // CHECK:STDOUT: %N.patt.loc4_23.2: %i32 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_23.2 (constants.%N.patt.8cf)]
  362. // CHECK:STDOUT:
  363. // CHECK:STDOUT: !definition:
  364. // CHECK:STDOUT:
  365. // CHECK:STDOUT: class {
  366. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357]
  367. // CHECK:STDOUT: complete_type_witness = %complete_type
  368. // CHECK:STDOUT:
  369. // CHECK:STDOUT: !members:
  370. // CHECK:STDOUT: .Self = constants.%Class
  371. // CHECK:STDOUT: }
  372. // CHECK:STDOUT: }
  373. // CHECK:STDOUT:
  374. // CHECK:STDOUT: specific @Class(constants.%T, constants.%N.356) {
  375. // CHECK:STDOUT: %T.loc4_13.2 => constants.%T
  376. // CHECK:STDOUT: %T.patt.loc4_13.2 => constants.%T
  377. // CHECK:STDOUT: %N.loc4_23.2 => constants.%N.356
  378. // CHECK:STDOUT: %N.patt.loc4_23.2 => constants.%N.356
  379. // CHECK:STDOUT: }
  380. // CHECK:STDOUT:
  381. // CHECK:STDOUT: --- fail_no_conversion.carbon
  382. // CHECK:STDOUT:
  383. // CHECK:STDOUT: constants {
  384. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  385. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  386. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  387. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  388. // CHECK:STDOUT: %N.356: %i32 = bind_symbolic_name N, 1 [symbolic]
  389. // CHECK:STDOUT: %N.patt.8cf: %i32 = symbolic_binding_pattern N, 1 [symbolic]
  390. // CHECK:STDOUT: %Class.type: type = generic_class_type @Class [concrete]
  391. // CHECK:STDOUT: %Class.generic: %Class.type = struct_value () [concrete]
  392. // CHECK:STDOUT: %Class: type = class_type @Class, @Class(%T, %N.356) [symbolic]
  393. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  394. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  395. // CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [concrete]
  396. // CHECK:STDOUT: %ptr: type = ptr_type %i32 [concrete]
  397. // CHECK:STDOUT: }
  398. // CHECK:STDOUT:
  399. // CHECK:STDOUT: imports {
  400. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  401. // CHECK:STDOUT: .Int = %Core.Int
  402. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  403. // CHECK:STDOUT: import Core//prelude
  404. // CHECK:STDOUT: import Core//prelude/...
  405. // CHECK:STDOUT: }
  406. // CHECK:STDOUT: }
  407. // CHECK:STDOUT:
  408. // CHECK:STDOUT: file {
  409. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  410. // CHECK:STDOUT: .Core = imports.%Core
  411. // CHECK:STDOUT: .Class = %Class.decl
  412. // CHECK:STDOUT: .a = %a
  413. // CHECK:STDOUT: }
  414. // CHECK:STDOUT: %Core.import = import Core
  415. // CHECK:STDOUT: %Class.decl: %Class.type = class_decl @Class [concrete = constants.%Class.generic] {
  416. // CHECK:STDOUT: %T.patt.loc4_13.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_13.2 (constants.%T.patt)]
  417. // CHECK:STDOUT: %N.patt.loc4_23.1: %i32 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_23.2 (constants.%N.patt.8cf)]
  418. // CHECK:STDOUT: } {
  419. // CHECK:STDOUT: %T.loc4_13.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_13.2 (constants.%T)]
  420. // CHECK:STDOUT: %.loc4: type = splice_block %i32 [concrete = constants.%i32] {
  421. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  422. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  423. // CHECK:STDOUT: }
  424. // CHECK:STDOUT: %N.loc4_23.1: %i32 = bind_symbolic_name N, 1 [symbolic = %N.loc4_23.2 (constants.%N.356)]
  425. // CHECK:STDOUT: }
  426. // CHECK:STDOUT: name_binding_decl {
  427. // CHECK:STDOUT: %a.patt: <error> = binding_pattern a
  428. // CHECK:STDOUT: %.loc16_1: <error> = var_pattern %a.patt
  429. // CHECK:STDOUT: }
  430. // CHECK:STDOUT: %a.var: ref <error> = var a
  431. // CHECK:STDOUT: %.1: <error> = splice_block <error> [concrete = <error>] {
  432. // CHECK:STDOUT: %Class.ref: %Class.type = name_ref Class, %Class.decl [concrete = constants.%Class.generic]
  433. // CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [concrete = constants.%int_5]
  434. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  435. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  436. // CHECK:STDOUT: %ptr: type = ptr_type %i32 [concrete = constants.%ptr]
  437. // CHECK:STDOUT: %.loc16_21: type = converted %int_5, <error> [concrete = <error>]
  438. // CHECK:STDOUT: }
  439. // CHECK:STDOUT: %a: <error> = bind_name a, <error>
  440. // CHECK:STDOUT: }
  441. // CHECK:STDOUT:
  442. // CHECK:STDOUT: generic class @Class(%T.loc4_13.1: type, %N.loc4_23.1: %i32) {
  443. // CHECK:STDOUT: %T.loc4_13.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_13.2 (constants.%T)]
  444. // CHECK:STDOUT: %T.patt.loc4_13.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_13.2 (constants.%T.patt)]
  445. // CHECK:STDOUT: %N.loc4_23.2: %i32 = bind_symbolic_name N, 1 [symbolic = %N.loc4_23.2 (constants.%N.356)]
  446. // CHECK:STDOUT: %N.patt.loc4_23.2: %i32 = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc4_23.2 (constants.%N.patt.8cf)]
  447. // CHECK:STDOUT:
  448. // CHECK:STDOUT: !definition:
  449. // CHECK:STDOUT:
  450. // CHECK:STDOUT: class {
  451. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357]
  452. // CHECK:STDOUT: complete_type_witness = %complete_type
  453. // CHECK:STDOUT:
  454. // CHECK:STDOUT: !members:
  455. // CHECK:STDOUT: .Self = constants.%Class
  456. // CHECK:STDOUT: }
  457. // CHECK:STDOUT: }
  458. // CHECK:STDOUT:
  459. // CHECK:STDOUT: specific @Class(constants.%T, constants.%N.356) {
  460. // CHECK:STDOUT: %T.loc4_13.2 => constants.%T
  461. // CHECK:STDOUT: %T.patt.loc4_13.2 => constants.%T
  462. // CHECK:STDOUT: %N.loc4_23.2 => constants.%N.356
  463. // CHECK:STDOUT: %N.patt.loc4_23.2 => constants.%N.356
  464. // CHECK:STDOUT: }
  465. // CHECK:STDOUT:
  466. // CHECK:STDOUT: --- call_in_nested_return_type.carbon
  467. // CHECK:STDOUT:
  468. // CHECK:STDOUT: constants {
  469. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  470. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  471. // CHECK:STDOUT: %Outer.type: type = generic_class_type @Outer [concrete]
  472. // CHECK:STDOUT: %Outer.generic: %Outer.type = struct_value () [concrete]
  473. // CHECK:STDOUT: %Outer.9d6: type = class_type @Outer, @Outer(%T) [symbolic]
  474. // CHECK:STDOUT: %U: type = bind_symbolic_name U, 1 [symbolic]
  475. // CHECK:STDOUT: %U.patt: type = symbolic_binding_pattern U, 1 [symbolic]
  476. // CHECK:STDOUT: %Inner.type.eae: type = generic_class_type @Inner, @Outer(%T) [symbolic]
  477. // CHECK:STDOUT: %Inner.generic.137: %Inner.type.eae = struct_value () [symbolic]
  478. // CHECK:STDOUT: %Inner.c71: type = class_type @Inner, @Inner(%T, %U) [symbolic]
  479. // CHECK:STDOUT: %A.type.8d7: type = fn_type @A, @Inner(%T, %U) [symbolic]
  480. // CHECK:STDOUT: %A.d0e: %A.type.8d7 = struct_value () [symbolic]
  481. // CHECK:STDOUT: %Outer.99f: type = class_type @Outer, @Outer(%U) [symbolic]
  482. // CHECK:STDOUT: %B.type.880: type = fn_type @B, @Inner(%T, %U) [symbolic]
  483. // CHECK:STDOUT: %B.c7b: %B.type.880 = struct_value () [symbolic]
  484. // CHECK:STDOUT: %Inner.13a: type = class_type @Inner, @Inner(%T, %T) [symbolic]
  485. // CHECK:STDOUT: %C.type.714: type = fn_type @C, @Inner(%T, %U) [symbolic]
  486. // CHECK:STDOUT: %C.e62: %C.type.714 = struct_value () [symbolic]
  487. // CHECK:STDOUT: %D.type.102: type = fn_type @D, @Inner(%T, %U) [symbolic]
  488. // CHECK:STDOUT: %D.d85: %D.type.102 = struct_value () [symbolic]
  489. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  490. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  491. // CHECK:STDOUT: %require_complete.127: <witness> = require_complete_type %Outer.9d6 [symbolic]
  492. // CHECK:STDOUT: %Outer.val.234: %Outer.9d6 = struct_value () [symbolic]
  493. // CHECK:STDOUT: %Inner.type.a71: type = generic_class_type @Inner, @Outer(%U) [symbolic]
  494. // CHECK:STDOUT: %Inner.generic.e3b: %Inner.type.a71 = struct_value () [symbolic]
  495. // CHECK:STDOUT: %require_complete.964: <witness> = require_complete_type %Outer.99f [symbolic]
  496. // CHECK:STDOUT: %Outer.val.a2f: %Outer.99f = struct_value () [symbolic]
  497. // CHECK:STDOUT: %A.type.5c8: type = fn_type @A, @Inner(%T, %T) [symbolic]
  498. // CHECK:STDOUT: %A.7e2: %A.type.5c8 = struct_value () [symbolic]
  499. // CHECK:STDOUT: %B.type.ec0: type = fn_type @B, @Inner(%T, %T) [symbolic]
  500. // CHECK:STDOUT: %B.051: %B.type.ec0 = struct_value () [symbolic]
  501. // CHECK:STDOUT: %C.type.1cf: type = fn_type @C, @Inner(%T, %T) [symbolic]
  502. // CHECK:STDOUT: %C.cf5: %C.type.1cf = struct_value () [symbolic]
  503. // CHECK:STDOUT: %D.type.7bc: type = fn_type @D, @Inner(%T, %T) [symbolic]
  504. // CHECK:STDOUT: %D.aa3: %D.type.7bc = struct_value () [symbolic]
  505. // CHECK:STDOUT: %require_complete.7b1: <witness> = require_complete_type %Inner.13a [symbolic]
  506. // CHECK:STDOUT: %Inner.val.69d: %Inner.13a = struct_value () [symbolic]
  507. // CHECK:STDOUT: %require_complete.e7e: <witness> = require_complete_type %Inner.c71 [symbolic]
  508. // CHECK:STDOUT: %Inner.val.dfa: %Inner.c71 = struct_value () [symbolic]
  509. // CHECK:STDOUT: }
  510. // CHECK:STDOUT:
  511. // CHECK:STDOUT: imports {
  512. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  513. // CHECK:STDOUT: import Core//prelude
  514. // CHECK:STDOUT: import Core//prelude/...
  515. // CHECK:STDOUT: }
  516. // CHECK:STDOUT: }
  517. // CHECK:STDOUT:
  518. // CHECK:STDOUT: file {
  519. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  520. // CHECK:STDOUT: .Core = imports.%Core
  521. // CHECK:STDOUT: .Outer = %Outer.decl
  522. // CHECK:STDOUT: }
  523. // CHECK:STDOUT: %Core.import = import Core
  524. // CHECK:STDOUT: %Outer.decl: %Outer.type = class_decl @Outer [concrete = constants.%Outer.generic] {
  525. // CHECK:STDOUT: %T.patt.loc2_13.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc2_13.2 (constants.%T.patt)]
  526. // CHECK:STDOUT: } {
  527. // CHECK:STDOUT: %T.loc2_13.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc2_13.2 (constants.%T)]
  528. // CHECK:STDOUT: }
  529. // CHECK:STDOUT: }
  530. // CHECK:STDOUT:
  531. // CHECK:STDOUT: generic class @Outer(%T.loc2_13.1: type) {
  532. // CHECK:STDOUT: %T.loc2_13.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc2_13.2 (constants.%T)]
  533. // CHECK:STDOUT: %T.patt.loc2_13.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc2_13.2 (constants.%T.patt)]
  534. // CHECK:STDOUT:
  535. // CHECK:STDOUT: !definition:
  536. // CHECK:STDOUT: %Inner.type: type = generic_class_type @Inner, @Outer(%T.loc2_13.2) [symbolic = %Inner.type (constants.%Inner.type.eae)]
  537. // CHECK:STDOUT: %Inner.generic: @Outer.%Inner.type (%Inner.type.eae) = struct_value () [symbolic = %Inner.generic (constants.%Inner.generic.137)]
  538. // CHECK:STDOUT:
  539. // CHECK:STDOUT: class {
  540. // CHECK:STDOUT: %Inner.decl: @Outer.%Inner.type (%Inner.type.eae) = class_decl @Inner [symbolic = @Outer.%Inner.generic (constants.%Inner.generic.137)] {
  541. // CHECK:STDOUT: %U.patt.loc3_15.1: type = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc3_15.2 (constants.%U.patt)]
  542. // CHECK:STDOUT: } {
  543. // CHECK:STDOUT: %U.loc3_15.1: type = bind_symbolic_name U, 1 [symbolic = %U.loc3_15.2 (constants.%U)]
  544. // CHECK:STDOUT: }
  545. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  546. // CHECK:STDOUT: complete_type_witness = %complete_type
  547. // CHECK:STDOUT:
  548. // CHECK:STDOUT: !members:
  549. // CHECK:STDOUT: .Self = constants.%Outer.9d6
  550. // CHECK:STDOUT: .Inner = %Inner.decl
  551. // CHECK:STDOUT: .Outer = <poisoned>
  552. // CHECK:STDOUT: .T = <poisoned>
  553. // CHECK:STDOUT: }
  554. // CHECK:STDOUT: }
  555. // CHECK:STDOUT:
  556. // CHECK:STDOUT: generic class @Inner(@Outer.%T.loc2_13.1: type, %U.loc3_15.1: type) {
  557. // CHECK:STDOUT: %U.loc3_15.2: type = bind_symbolic_name U, 1 [symbolic = %U.loc3_15.2 (constants.%U)]
  558. // CHECK:STDOUT: %U.patt.loc3_15.2: type = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc3_15.2 (constants.%U.patt)]
  559. // CHECK:STDOUT:
  560. // CHECK:STDOUT: !definition:
  561. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  562. // CHECK:STDOUT: %A.type: type = fn_type @A, @Inner(%T, %U.loc3_15.2) [symbolic = %A.type (constants.%A.type.8d7)]
  563. // CHECK:STDOUT: %A: @Inner.%A.type (%A.type.8d7) = struct_value () [symbolic = %A (constants.%A.d0e)]
  564. // CHECK:STDOUT: %B.type: type = fn_type @B, @Inner(%T, %U.loc3_15.2) [symbolic = %B.type (constants.%B.type.880)]
  565. // CHECK:STDOUT: %B: @Inner.%B.type (%B.type.880) = struct_value () [symbolic = %B (constants.%B.c7b)]
  566. // CHECK:STDOUT: %C.type: type = fn_type @C, @Inner(%T, %U.loc3_15.2) [symbolic = %C.type (constants.%C.type.714)]
  567. // CHECK:STDOUT: %C: @Inner.%C.type (%C.type.714) = struct_value () [symbolic = %C (constants.%C.e62)]
  568. // CHECK:STDOUT: %D.type: type = fn_type @D, @Inner(%T, %U.loc3_15.2) [symbolic = %D.type (constants.%D.type.102)]
  569. // CHECK:STDOUT: %D: @Inner.%D.type (%D.type.102) = struct_value () [symbolic = %D (constants.%D.d85)]
  570. // CHECK:STDOUT:
  571. // CHECK:STDOUT: class {
  572. // CHECK:STDOUT: %A.decl: @Inner.%A.type (%A.type.8d7) = fn_decl @A [symbolic = @Inner.%A (constants.%A.d0e)] {
  573. // CHECK:STDOUT: %return.patt: @A.%Outer.loc4_22.1 (%Outer.9d6) = return_slot_pattern
  574. // CHECK:STDOUT: %return.param_patt: @A.%Outer.loc4_22.1 (%Outer.9d6) = out_param_pattern %return.patt, call_param0
  575. // CHECK:STDOUT: } {
  576. // CHECK:STDOUT: %Outer.ref: %Outer.type = name_ref Outer, file.%Outer.decl [concrete = constants.%Outer.generic]
  577. // CHECK:STDOUT: %T.ref: type = name_ref T, @Outer.%T.loc2_13.1 [symbolic = %T (constants.%T)]
  578. // CHECK:STDOUT: %Outer.loc4_22.2: type = class_type @Outer, @Outer(constants.%T) [symbolic = %Outer.loc4_22.1 (constants.%Outer.9d6)]
  579. // CHECK:STDOUT: %return.param: ref @A.%Outer.loc4_22.1 (%Outer.9d6) = out_param call_param0
  580. // CHECK:STDOUT: %return: ref @A.%Outer.loc4_22.1 (%Outer.9d6) = return_slot %return.param
  581. // CHECK:STDOUT: }
  582. // CHECK:STDOUT: %B.decl: @Inner.%B.type (%B.type.880) = fn_decl @B [symbolic = @Inner.%B (constants.%B.c7b)] {
  583. // CHECK:STDOUT: %return.patt: @B.%Outer.loc7_22.1 (%Outer.99f) = return_slot_pattern
  584. // CHECK:STDOUT: %return.param_patt: @B.%Outer.loc7_22.1 (%Outer.99f) = out_param_pattern %return.patt, call_param0
  585. // CHECK:STDOUT: } {
  586. // CHECK:STDOUT: %Outer.ref: %Outer.type = name_ref Outer, file.%Outer.decl [concrete = constants.%Outer.generic]
  587. // CHECK:STDOUT: %U.ref: type = name_ref U, @Inner.%U.loc3_15.1 [symbolic = %U (constants.%U)]
  588. // CHECK:STDOUT: %Outer.loc7_22.2: type = class_type @Outer, @Outer(constants.%U) [symbolic = %Outer.loc7_22.1 (constants.%Outer.99f)]
  589. // CHECK:STDOUT: %return.param: ref @B.%Outer.loc7_22.1 (%Outer.99f) = out_param call_param0
  590. // CHECK:STDOUT: %return: ref @B.%Outer.loc7_22.1 (%Outer.99f) = return_slot %return.param
  591. // CHECK:STDOUT: }
  592. // CHECK:STDOUT: %C.decl: @Inner.%C.type (%C.type.714) = fn_decl @C [symbolic = @Inner.%C (constants.%C.e62)] {
  593. // CHECK:STDOUT: %return.patt: @C.%Inner.loc10_22.1 (%Inner.13a) = return_slot_pattern
  594. // CHECK:STDOUT: %return.param_patt: @C.%Inner.loc10_22.1 (%Inner.13a) = out_param_pattern %return.patt, call_param0
  595. // CHECK:STDOUT: } {
  596. // CHECK:STDOUT: %.loc10: @C.%Inner.type (%Inner.type.eae) = specific_constant @Outer.%Inner.decl, @Outer(constants.%T) [symbolic = %Inner.generic (constants.%Inner.generic.137)]
  597. // CHECK:STDOUT: %Inner.ref: @C.%Inner.type (%Inner.type.eae) = name_ref Inner, %.loc10 [symbolic = %Inner.generic (constants.%Inner.generic.137)]
  598. // CHECK:STDOUT: %T.ref: type = name_ref T, @Outer.%T.loc2_13.1 [symbolic = %T (constants.%T)]
  599. // CHECK:STDOUT: %Inner.loc10_22.2: type = class_type @Inner, @Inner(constants.%T, constants.%T) [symbolic = %Inner.loc10_22.1 (constants.%Inner.13a)]
  600. // CHECK:STDOUT: %return.param: ref @C.%Inner.loc10_22.1 (%Inner.13a) = out_param call_param0
  601. // CHECK:STDOUT: %return: ref @C.%Inner.loc10_22.1 (%Inner.13a) = return_slot %return.param
  602. // CHECK:STDOUT: }
  603. // CHECK:STDOUT: %D.decl: @Inner.%D.type (%D.type.102) = fn_decl @D [symbolic = @Inner.%D (constants.%D.d85)] {
  604. // CHECK:STDOUT: %return.patt: @D.%Inner.loc13_22.1 (%Inner.c71) = return_slot_pattern
  605. // CHECK:STDOUT: %return.param_patt: @D.%Inner.loc13_22.1 (%Inner.c71) = out_param_pattern %return.patt, call_param0
  606. // CHECK:STDOUT: } {
  607. // CHECK:STDOUT: %.loc13: @D.%Inner.type (%Inner.type.eae) = specific_constant @Outer.%Inner.decl, @Outer(constants.%T) [symbolic = %Inner.generic (constants.%Inner.generic.137)]
  608. // CHECK:STDOUT: %Inner.ref: @D.%Inner.type (%Inner.type.eae) = name_ref Inner, %.loc13 [symbolic = %Inner.generic (constants.%Inner.generic.137)]
  609. // CHECK:STDOUT: %U.ref: type = name_ref U, @Inner.%U.loc3_15.1 [symbolic = %U (constants.%U)]
  610. // CHECK:STDOUT: %Inner.loc13_22.2: type = class_type @Inner, @Inner(constants.%T, constants.%U) [symbolic = %Inner.loc13_22.1 (constants.%Inner.c71)]
  611. // CHECK:STDOUT: %return.param: ref @D.%Inner.loc13_22.1 (%Inner.c71) = out_param call_param0
  612. // CHECK:STDOUT: %return: ref @D.%Inner.loc13_22.1 (%Inner.c71) = return_slot %return.param
  613. // CHECK:STDOUT: }
  614. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  615. // CHECK:STDOUT: complete_type_witness = %complete_type
  616. // CHECK:STDOUT:
  617. // CHECK:STDOUT: !members:
  618. // CHECK:STDOUT: .Self = constants.%Inner.c71
  619. // CHECK:STDOUT: .Outer = <poisoned>
  620. // CHECK:STDOUT: .T = <poisoned>
  621. // CHECK:STDOUT: .A = %A.decl
  622. // CHECK:STDOUT: .U = <poisoned>
  623. // CHECK:STDOUT: .B = %B.decl
  624. // CHECK:STDOUT: .Inner = <poisoned>
  625. // CHECK:STDOUT: .C = %C.decl
  626. // CHECK:STDOUT: .D = %D.decl
  627. // CHECK:STDOUT: }
  628. // CHECK:STDOUT: }
  629. // CHECK:STDOUT:
  630. // CHECK:STDOUT: generic fn @A(@Outer.%T.loc2_13.1: type, @Inner.%U.loc3_15.1: type) {
  631. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  632. // CHECK:STDOUT: %Outer.loc4_22.1: type = class_type @Outer, @Outer(%T) [symbolic = %Outer.loc4_22.1 (constants.%Outer.9d6)]
  633. // CHECK:STDOUT:
  634. // CHECK:STDOUT: !definition:
  635. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type @A.%Outer.loc4_22.1 (%Outer.9d6) [symbolic = %require_complete (constants.%require_complete.127)]
  636. // CHECK:STDOUT: %Outer.val: @A.%Outer.loc4_22.1 (%Outer.9d6) = struct_value () [symbolic = %Outer.val (constants.%Outer.val.234)]
  637. // CHECK:STDOUT:
  638. // CHECK:STDOUT: fn() -> %return.param_patt: @A.%Outer.loc4_22.1 (%Outer.9d6) {
  639. // CHECK:STDOUT: !entry:
  640. // CHECK:STDOUT: %.loc5_15.1: %empty_struct_type = struct_literal ()
  641. // CHECK:STDOUT: %.loc5_15.2: init @A.%Outer.loc4_22.1 (%Outer.9d6) = class_init (), %return [symbolic = %Outer.val (constants.%Outer.val.234)]
  642. // CHECK:STDOUT: %.loc5_16: init @A.%Outer.loc4_22.1 (%Outer.9d6) = converted %.loc5_15.1, %.loc5_15.2 [symbolic = %Outer.val (constants.%Outer.val.234)]
  643. // CHECK:STDOUT: return %.loc5_16 to %return
  644. // CHECK:STDOUT: }
  645. // CHECK:STDOUT: }
  646. // CHECK:STDOUT:
  647. // CHECK:STDOUT: generic fn @B(@Outer.%T.loc2_13.1: type, @Inner.%U.loc3_15.1: type) {
  648. // CHECK:STDOUT: %U: type = bind_symbolic_name U, 1 [symbolic = %U (constants.%U)]
  649. // CHECK:STDOUT: %Outer.loc7_22.1: type = class_type @Outer, @Outer(%U) [symbolic = %Outer.loc7_22.1 (constants.%Outer.99f)]
  650. // CHECK:STDOUT:
  651. // CHECK:STDOUT: !definition:
  652. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type @B.%Outer.loc7_22.1 (%Outer.99f) [symbolic = %require_complete (constants.%require_complete.964)]
  653. // CHECK:STDOUT: %Outer.val: @B.%Outer.loc7_22.1 (%Outer.99f) = struct_value () [symbolic = %Outer.val (constants.%Outer.val.a2f)]
  654. // CHECK:STDOUT:
  655. // CHECK:STDOUT: fn() -> %return.param_patt: @B.%Outer.loc7_22.1 (%Outer.99f) {
  656. // CHECK:STDOUT: !entry:
  657. // CHECK:STDOUT: %.loc8_15.1: %empty_struct_type = struct_literal ()
  658. // CHECK:STDOUT: %.loc8_15.2: init @B.%Outer.loc7_22.1 (%Outer.99f) = class_init (), %return [symbolic = %Outer.val (constants.%Outer.val.a2f)]
  659. // CHECK:STDOUT: %.loc8_16: init @B.%Outer.loc7_22.1 (%Outer.99f) = converted %.loc8_15.1, %.loc8_15.2 [symbolic = %Outer.val (constants.%Outer.val.a2f)]
  660. // CHECK:STDOUT: return %.loc8_16 to %return
  661. // CHECK:STDOUT: }
  662. // CHECK:STDOUT: }
  663. // CHECK:STDOUT:
  664. // CHECK:STDOUT: generic fn @C(@Outer.%T.loc2_13.1: type, @Inner.%U.loc3_15.1: type) {
  665. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  666. // CHECK:STDOUT: %Inner.type: type = generic_class_type @Inner, @Outer(%T) [symbolic = %Inner.type (constants.%Inner.type.eae)]
  667. // CHECK:STDOUT: %Inner.generic: @C.%Inner.type (%Inner.type.eae) = struct_value () [symbolic = %Inner.generic (constants.%Inner.generic.137)]
  668. // CHECK:STDOUT: %Inner.loc10_22.1: type = class_type @Inner, @Inner(%T, %T) [symbolic = %Inner.loc10_22.1 (constants.%Inner.13a)]
  669. // CHECK:STDOUT:
  670. // CHECK:STDOUT: !definition:
  671. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type @C.%Inner.loc10_22.1 (%Inner.13a) [symbolic = %require_complete (constants.%require_complete.7b1)]
  672. // CHECK:STDOUT: %Inner.val: @C.%Inner.loc10_22.1 (%Inner.13a) = struct_value () [symbolic = %Inner.val (constants.%Inner.val.69d)]
  673. // CHECK:STDOUT:
  674. // CHECK:STDOUT: fn() -> %return.param_patt: @C.%Inner.loc10_22.1 (%Inner.13a) {
  675. // CHECK:STDOUT: !entry:
  676. // CHECK:STDOUT: %.loc11_15.1: %empty_struct_type = struct_literal ()
  677. // CHECK:STDOUT: %.loc11_15.2: init @C.%Inner.loc10_22.1 (%Inner.13a) = class_init (), %return [symbolic = %Inner.val (constants.%Inner.val.69d)]
  678. // CHECK:STDOUT: %.loc11_16: init @C.%Inner.loc10_22.1 (%Inner.13a) = converted %.loc11_15.1, %.loc11_15.2 [symbolic = %Inner.val (constants.%Inner.val.69d)]
  679. // CHECK:STDOUT: return %.loc11_16 to %return
  680. // CHECK:STDOUT: }
  681. // CHECK:STDOUT: }
  682. // CHECK:STDOUT:
  683. // CHECK:STDOUT: generic fn @D(@Outer.%T.loc2_13.1: type, @Inner.%U.loc3_15.1: type) {
  684. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  685. // CHECK:STDOUT: %Inner.type: type = generic_class_type @Inner, @Outer(%T) [symbolic = %Inner.type (constants.%Inner.type.eae)]
  686. // CHECK:STDOUT: %Inner.generic: @D.%Inner.type (%Inner.type.eae) = struct_value () [symbolic = %Inner.generic (constants.%Inner.generic.137)]
  687. // CHECK:STDOUT: %U: type = bind_symbolic_name U, 1 [symbolic = %U (constants.%U)]
  688. // CHECK:STDOUT: %Inner.loc13_22.1: type = class_type @Inner, @Inner(%T, %U) [symbolic = %Inner.loc13_22.1 (constants.%Inner.c71)]
  689. // CHECK:STDOUT:
  690. // CHECK:STDOUT: !definition:
  691. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type @D.%Inner.loc13_22.1 (%Inner.c71) [symbolic = %require_complete (constants.%require_complete.e7e)]
  692. // CHECK:STDOUT: %Inner.val: @D.%Inner.loc13_22.1 (%Inner.c71) = struct_value () [symbolic = %Inner.val (constants.%Inner.val.dfa)]
  693. // CHECK:STDOUT:
  694. // CHECK:STDOUT: fn() -> %return.param_patt: @D.%Inner.loc13_22.1 (%Inner.c71) {
  695. // CHECK:STDOUT: !entry:
  696. // CHECK:STDOUT: %.loc14_15.1: %empty_struct_type = struct_literal ()
  697. // CHECK:STDOUT: %.loc14_15.2: init @D.%Inner.loc13_22.1 (%Inner.c71) = class_init (), %return [symbolic = %Inner.val (constants.%Inner.val.dfa)]
  698. // CHECK:STDOUT: %.loc14_16: init @D.%Inner.loc13_22.1 (%Inner.c71) = converted %.loc14_15.1, %.loc14_15.2 [symbolic = %Inner.val (constants.%Inner.val.dfa)]
  699. // CHECK:STDOUT: return %.loc14_16 to %return
  700. // CHECK:STDOUT: }
  701. // CHECK:STDOUT: }
  702. // CHECK:STDOUT:
  703. // CHECK:STDOUT: specific @Outer(constants.%T) {
  704. // CHECK:STDOUT: %T.loc2_13.2 => constants.%T
  705. // CHECK:STDOUT: %T.patt.loc2_13.2 => constants.%T
  706. // CHECK:STDOUT:
  707. // CHECK:STDOUT: !definition:
  708. // CHECK:STDOUT: %Inner.type => constants.%Inner.type.eae
  709. // CHECK:STDOUT: %Inner.generic => constants.%Inner.generic.137
  710. // CHECK:STDOUT: }
  711. // CHECK:STDOUT:
  712. // CHECK:STDOUT: specific @Inner(constants.%T, constants.%U) {
  713. // CHECK:STDOUT: %U.loc3_15.2 => constants.%U
  714. // CHECK:STDOUT: %U.patt.loc3_15.2 => constants.%U
  715. // CHECK:STDOUT:
  716. // CHECK:STDOUT: !definition:
  717. // CHECK:STDOUT: %T => constants.%T
  718. // CHECK:STDOUT: %A.type => constants.%A.type.8d7
  719. // CHECK:STDOUT: %A => constants.%A.d0e
  720. // CHECK:STDOUT: %B.type => constants.%B.type.880
  721. // CHECK:STDOUT: %B => constants.%B.c7b
  722. // CHECK:STDOUT: %C.type => constants.%C.type.714
  723. // CHECK:STDOUT: %C => constants.%C.e62
  724. // CHECK:STDOUT: %D.type => constants.%D.type.102
  725. // CHECK:STDOUT: %D => constants.%D.d85
  726. // CHECK:STDOUT: }
  727. // CHECK:STDOUT:
  728. // CHECK:STDOUT: specific @A(constants.%T, constants.%U) {
  729. // CHECK:STDOUT: %T => constants.%T
  730. // CHECK:STDOUT: %Outer.loc4_22.1 => constants.%Outer.9d6
  731. // CHECK:STDOUT: }
  732. // CHECK:STDOUT:
  733. // CHECK:STDOUT: specific @Outer(@A.%T) {}
  734. // CHECK:STDOUT:
  735. // CHECK:STDOUT: specific @Outer(constants.%U) {
  736. // CHECK:STDOUT: %T.loc2_13.2 => constants.%U
  737. // CHECK:STDOUT: %T.patt.loc2_13.2 => constants.%U
  738. // CHECK:STDOUT:
  739. // CHECK:STDOUT: !definition:
  740. // CHECK:STDOUT: %Inner.type => constants.%Inner.type.a71
  741. // CHECK:STDOUT: %Inner.generic => constants.%Inner.generic.e3b
  742. // CHECK:STDOUT: }
  743. // CHECK:STDOUT:
  744. // CHECK:STDOUT: specific @B(constants.%T, constants.%U) {
  745. // CHECK:STDOUT: %U => constants.%U
  746. // CHECK:STDOUT: %Outer.loc7_22.1 => constants.%Outer.99f
  747. // CHECK:STDOUT: }
  748. // CHECK:STDOUT:
  749. // CHECK:STDOUT: specific @Outer(@B.%U) {}
  750. // CHECK:STDOUT:
  751. // CHECK:STDOUT: specific @Inner(constants.%T, constants.%T) {
  752. // CHECK:STDOUT: %U.loc3_15.2 => constants.%T
  753. // CHECK:STDOUT: %U.patt.loc3_15.2 => constants.%T
  754. // CHECK:STDOUT:
  755. // CHECK:STDOUT: !definition:
  756. // CHECK:STDOUT: %T => constants.%T
  757. // CHECK:STDOUT: %A.type => constants.%A.type.5c8
  758. // CHECK:STDOUT: %A => constants.%A.7e2
  759. // CHECK:STDOUT: %B.type => constants.%B.type.ec0
  760. // CHECK:STDOUT: %B => constants.%B.051
  761. // CHECK:STDOUT: %C.type => constants.%C.type.1cf
  762. // CHECK:STDOUT: %C => constants.%C.cf5
  763. // CHECK:STDOUT: %D.type => constants.%D.type.7bc
  764. // CHECK:STDOUT: %D => constants.%D.aa3
  765. // CHECK:STDOUT: }
  766. // CHECK:STDOUT:
  767. // CHECK:STDOUT: specific @C(constants.%T, constants.%U) {
  768. // CHECK:STDOUT: %T => constants.%T
  769. // CHECK:STDOUT: %Inner.type => constants.%Inner.type.eae
  770. // CHECK:STDOUT: %Inner.generic => constants.%Inner.generic.137
  771. // CHECK:STDOUT: %Inner.loc10_22.1 => constants.%Inner.13a
  772. // CHECK:STDOUT: }
  773. // CHECK:STDOUT:
  774. // CHECK:STDOUT: specific @Outer(@C.%T) {}
  775. // CHECK:STDOUT:
  776. // CHECK:STDOUT: specific @Inner(@C.%T, @C.%T) {}
  777. // CHECK:STDOUT:
  778. // CHECK:STDOUT: specific @D(constants.%T, constants.%U) {
  779. // CHECK:STDOUT: %T => constants.%T
  780. // CHECK:STDOUT: %Inner.type => constants.%Inner.type.eae
  781. // CHECK:STDOUT: %Inner.generic => constants.%Inner.generic.137
  782. // CHECK:STDOUT: %U => constants.%U
  783. // CHECK:STDOUT: %Inner.loc13_22.1 => constants.%Inner.c71
  784. // CHECK:STDOUT: }
  785. // CHECK:STDOUT:
  786. // CHECK:STDOUT: specific @Outer(@D.%T) {}
  787. // CHECK:STDOUT:
  788. // CHECK:STDOUT: specific @Inner(@D.%T, @D.%U) {}
  789. // CHECK:STDOUT:
  790. // CHECK:STDOUT: specific @Inner(%T, %U.loc3_15.2) {}
  791. // CHECK:STDOUT:
  792. // CHECK:STDOUT: specific @Outer(%T.loc2_13.2) {}
  793. // CHECK:STDOUT: