stringify.carbon 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/int.carbon
  6. // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
  7. // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
  8. //
  9. // AUTOUPDATE
  10. // TIP: To test this file alone, run:
  11. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/generic/stringify.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/generic/stringify.carbon
  14. // --- fail_empty_params.carbon
  15. library "[[@TEST_NAME]]";
  16. class NoParams {}
  17. class EmptyParams() {}
  18. var v: NoParams;
  19. // CHECK:STDERR: fail_empty_params.carbon:[[@LINE+7]]:1: error: cannot implicitly convert expression of type `NoParams` to `EmptyParams()` [ConversionFailure]
  20. // CHECK:STDERR: var w: EmptyParams() = v;
  21. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
  22. // CHECK:STDERR: fail_empty_params.carbon:[[@LINE+4]]:1: note: type `NoParams` does not implement interface `Core.ImplicitAs(EmptyParams())` [MissingImplInMemberAccessNote]
  23. // CHECK:STDERR: var w: EmptyParams() = v;
  24. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
  25. // CHECK:STDERR:
  26. var w: EmptyParams() = v;
  27. // --- fail_nested.carbon
  28. library "[[@TEST_NAME]]";
  29. class Outer(T:! type) {
  30. class Inner(U:! type) {
  31. }
  32. }
  33. var v: Outer({}*);
  34. // TODO: It would be nice to include the `Outer({}*).` prefix in the name of `Inner`.
  35. // CHECK:STDERR: fail_nested.carbon:[[@LINE+7]]:1: error: cannot implicitly convert expression of type `Outer({}*)` to `Inner({.a: i32}*)` [ConversionFailure]
  36. // CHECK:STDERR: var w: Outer({}*).Inner({.a: i32}*) = v;
  37. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  38. // CHECK:STDERR: fail_nested.carbon:[[@LINE+4]]:1: note: type `Outer({}*)` does not implement interface `Core.ImplicitAs(Inner({.a: i32}*))` [MissingImplInMemberAccessNote]
  39. // CHECK:STDERR: var w: Outer({}*).Inner({.a: i32}*) = v;
  40. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  41. // CHECK:STDERR:
  42. var w: Outer({}*).Inner({.a: i32}*) = v;
  43. // --- fail_int_value.carbon
  44. library "[[@TEST_NAME]]";
  45. class C(N:! i32) {}
  46. // CHECK:STDERR: fail_int_value.carbon:[[@LINE+7]]:1: error: cannot implicitly convert expression of type `()` to `C(123)` [ConversionFailure]
  47. // CHECK:STDERR: var v: C(123) = ();
  48. // CHECK:STDERR: ^~~~~~~~~~~~~
  49. // CHECK:STDERR: fail_int_value.carbon:[[@LINE+4]]:1: note: type `()` does not implement interface `Core.ImplicitAs(C(123))` [MissingImplInMemberAccessNote]
  50. // CHECK:STDERR: var v: C(123) = ();
  51. // CHECK:STDERR: ^~~~~~~~~~~~~
  52. // CHECK:STDERR:
  53. var v: C(123) = ();
  54. // --- fail_class_param.carbon
  55. library "[[@TEST_NAME]]";
  56. class D {
  57. var a: i32;
  58. var b: i32;
  59. }
  60. class E(F:! D) {}
  61. // CHECK:STDERR: fail_class_param.carbon:[[@LINE+14]]:8: error: argument for generic parameter is not a compile-time constant [CompTimeArgumentNotConstant]
  62. // CHECK:STDERR: var g: E({.a = 1, .b = 2}) = {} as E({.a = 3, .b = 4} as D);
  63. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
  64. // CHECK:STDERR: fail_class_param.carbon:[[@LINE-5]]:9: note: initializing generic parameter `F` declared here [InitializingGenericParam]
  65. // CHECK:STDERR: class E(F:! D) {}
  66. // CHECK:STDERR: ^
  67. // CHECK:STDERR:
  68. // CHECK:STDERR: fail_class_param.carbon:[[@LINE+7]]:36: error: argument for generic parameter is not a compile-time constant [CompTimeArgumentNotConstant]
  69. // CHECK:STDERR: var g: E({.a = 1, .b = 2}) = {} as E({.a = 3, .b = 4} as D);
  70. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~
  71. // CHECK:STDERR: fail_class_param.carbon:[[@LINE-12]]:9: note: initializing generic parameter `F` declared here [InitializingGenericParam]
  72. // CHECK:STDERR: class E(F:! D) {}
  73. // CHECK:STDERR: ^
  74. // CHECK:STDERR:
  75. var g: E({.a = 1, .b = 2}) = {} as E({.a = 3, .b = 4} as D);
  76. // CHECK:STDOUT: --- fail_empty_params.carbon
  77. // CHECK:STDOUT:
  78. // CHECK:STDOUT: constants {
  79. // CHECK:STDOUT: %NoParams: type = class_type @NoParams [concrete]
  80. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  81. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  82. // CHECK:STDOUT: %EmptyParams.type: type = generic_class_type @EmptyParams [concrete]
  83. // CHECK:STDOUT: %EmptyParams.generic: %EmptyParams.type = struct_value () [concrete]
  84. // CHECK:STDOUT: %EmptyParams: type = class_type @EmptyParams [concrete]
  85. // CHECK:STDOUT: %pattern_type.32d: type = pattern_type %NoParams [concrete]
  86. // CHECK:STDOUT: %pattern_type.71c: type = pattern_type %EmptyParams [concrete]
  87. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  88. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  89. // CHECK:STDOUT: }
  90. // CHECK:STDOUT:
  91. // CHECK:STDOUT: imports {
  92. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  93. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  94. // CHECK:STDOUT: import Core//prelude
  95. // CHECK:STDOUT: import Core//prelude/...
  96. // CHECK:STDOUT: }
  97. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  98. // CHECK:STDOUT: }
  99. // CHECK:STDOUT:
  100. // CHECK:STDOUT: file {
  101. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  102. // CHECK:STDOUT: .Core = imports.%Core
  103. // CHECK:STDOUT: .NoParams = %NoParams.decl
  104. // CHECK:STDOUT: .EmptyParams = %EmptyParams.decl
  105. // CHECK:STDOUT: .v = %v
  106. // CHECK:STDOUT: .w = %w
  107. // CHECK:STDOUT: }
  108. // CHECK:STDOUT: %Core.import = import Core
  109. // CHECK:STDOUT: %NoParams.decl: type = class_decl @NoParams [concrete = constants.%NoParams] {} {}
  110. // CHECK:STDOUT: %EmptyParams.decl: %EmptyParams.type = class_decl @EmptyParams [concrete = constants.%EmptyParams.generic] {} {}
  111. // CHECK:STDOUT: name_binding_decl {
  112. // CHECK:STDOUT: %v.patt: %pattern_type.32d = binding_pattern v [concrete]
  113. // CHECK:STDOUT: %v.var_patt: %pattern_type.32d = var_pattern %v.patt [concrete]
  114. // CHECK:STDOUT: }
  115. // CHECK:STDOUT: %v.var: ref %NoParams = var %v.var_patt [concrete]
  116. // CHECK:STDOUT: %NoParams.ref: type = name_ref NoParams, %NoParams.decl [concrete = constants.%NoParams]
  117. // CHECK:STDOUT: %v: ref %NoParams = bind_name v, %v.var [concrete = %v.var]
  118. // CHECK:STDOUT: name_binding_decl {
  119. // CHECK:STDOUT: %w.patt: %pattern_type.71c = binding_pattern w [concrete]
  120. // CHECK:STDOUT: %w.var_patt: %pattern_type.71c = var_pattern %w.patt [concrete]
  121. // CHECK:STDOUT: }
  122. // CHECK:STDOUT: %w.var: ref %EmptyParams = var %w.var_patt [concrete]
  123. // CHECK:STDOUT: %.loc15: type = splice_block %EmptyParams [concrete = constants.%EmptyParams] {
  124. // CHECK:STDOUT: %EmptyParams.ref: %EmptyParams.type = name_ref EmptyParams, %EmptyParams.decl [concrete = constants.%EmptyParams.generic]
  125. // CHECK:STDOUT: %EmptyParams: type = class_type @EmptyParams [concrete = constants.%EmptyParams]
  126. // CHECK:STDOUT: }
  127. // CHECK:STDOUT: %w: ref %EmptyParams = bind_name w, %w.var [concrete = %w.var]
  128. // CHECK:STDOUT: }
  129. // CHECK:STDOUT:
  130. // CHECK:STDOUT: class @NoParams {
  131. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  132. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  133. // CHECK:STDOUT: complete_type_witness = %complete_type
  134. // CHECK:STDOUT:
  135. // CHECK:STDOUT: !members:
  136. // CHECK:STDOUT: .Self = constants.%NoParams
  137. // CHECK:STDOUT: }
  138. // CHECK:STDOUT:
  139. // CHECK:STDOUT: class @EmptyParams {
  140. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  141. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  142. // CHECK:STDOUT: complete_type_witness = %complete_type
  143. // CHECK:STDOUT:
  144. // CHECK:STDOUT: !members:
  145. // CHECK:STDOUT: .Self = constants.%EmptyParams
  146. // CHECK:STDOUT: }
  147. // CHECK:STDOUT:
  148. // CHECK:STDOUT: fn @__global_init() {
  149. // CHECK:STDOUT: !entry:
  150. // CHECK:STDOUT: %v.ref: ref %NoParams = name_ref v, file.%v [concrete = file.%v.var]
  151. // CHECK:STDOUT: %.loc15: %EmptyParams = converted %v.ref, <error> [concrete = <error>]
  152. // CHECK:STDOUT: assign file.%w.var, <error>
  153. // CHECK:STDOUT: return
  154. // CHECK:STDOUT: }
  155. // CHECK:STDOUT:
  156. // CHECK:STDOUT: --- fail_nested.carbon
  157. // CHECK:STDOUT:
  158. // CHECK:STDOUT: constants {
  159. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  160. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  161. // CHECK:STDOUT: %Outer.type: type = generic_class_type @Outer [concrete]
  162. // CHECK:STDOUT: %Outer.generic: %Outer.type = struct_value () [concrete]
  163. // CHECK:STDOUT: %Outer.9d6: type = class_type @Outer, @Outer(%T) [symbolic]
  164. // CHECK:STDOUT: %U: type = bind_symbolic_name U, 1 [symbolic]
  165. // CHECK:STDOUT: %Inner.type.eae: type = generic_class_type @Inner, @Outer(%T) [symbolic]
  166. // CHECK:STDOUT: %Inner.generic.137: %Inner.type.eae = struct_value () [symbolic]
  167. // CHECK:STDOUT: %Inner.c71: type = class_type @Inner, @Inner(%T, %U) [symbolic]
  168. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  169. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  170. // CHECK:STDOUT: %ptr.c28: type = ptr_type %empty_struct_type [concrete]
  171. // CHECK:STDOUT: %Outer.614: type = class_type @Outer, @Outer(%ptr.c28) [concrete]
  172. // CHECK:STDOUT: %Inner.type.5d2: type = generic_class_type @Inner, @Outer(%ptr.c28) [concrete]
  173. // CHECK:STDOUT: %Inner.generic.8e6: %Inner.type.5d2 = struct_value () [concrete]
  174. // CHECK:STDOUT: %pattern_type.828: type = pattern_type %Outer.614 [concrete]
  175. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  176. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  177. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  178. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  179. // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [concrete]
  180. // CHECK:STDOUT: %ptr.1bb: type = ptr_type %struct_type.a [concrete]
  181. // CHECK:STDOUT: %Inner.277: type = class_type @Inner, @Inner(%ptr.c28, %ptr.1bb) [concrete]
  182. // CHECK:STDOUT: %pattern_type.5fa: type = pattern_type %Inner.277 [concrete]
  183. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  184. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  185. // CHECK:STDOUT: }
  186. // CHECK:STDOUT:
  187. // CHECK:STDOUT: imports {
  188. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  189. // CHECK:STDOUT: .Int = %Core.Int
  190. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  191. // CHECK:STDOUT: import Core//prelude
  192. // CHECK:STDOUT: import Core//prelude/...
  193. // CHECK:STDOUT: }
  194. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  195. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  196. // CHECK:STDOUT: }
  197. // CHECK:STDOUT:
  198. // CHECK:STDOUT: file {
  199. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  200. // CHECK:STDOUT: .Core = imports.%Core
  201. // CHECK:STDOUT: .Outer = %Outer.decl
  202. // CHECK:STDOUT: .v = %v
  203. // CHECK:STDOUT: .w = %w
  204. // CHECK:STDOUT: }
  205. // CHECK:STDOUT: %Core.import = import Core
  206. // CHECK:STDOUT: %Outer.decl: %Outer.type = class_decl @Outer [concrete = constants.%Outer.generic] {
  207. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  208. // CHECK:STDOUT: } {
  209. // CHECK:STDOUT: %T.loc4_13.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_13.2 (constants.%T)]
  210. // CHECK:STDOUT: }
  211. // CHECK:STDOUT: name_binding_decl {
  212. // CHECK:STDOUT: %v.patt: %pattern_type.828 = binding_pattern v [concrete]
  213. // CHECK:STDOUT: %v.var_patt: %pattern_type.828 = var_pattern %v.patt [concrete]
  214. // CHECK:STDOUT: }
  215. // CHECK:STDOUT: %v.var: ref %Outer.614 = var %v.var_patt [concrete]
  216. // CHECK:STDOUT: %.loc9_17: type = splice_block %Outer.loc9 [concrete = constants.%Outer.614] {
  217. // CHECK:STDOUT: %Outer.ref.loc9: %Outer.type = name_ref Outer, %Outer.decl [concrete = constants.%Outer.generic]
  218. // CHECK:STDOUT: %.loc9_15: %empty_struct_type = struct_literal ()
  219. // CHECK:STDOUT: %.loc9_16: type = converted %.loc9_15, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  220. // CHECK:STDOUT: %ptr.loc9: type = ptr_type %.loc9_16 [concrete = constants.%ptr.c28]
  221. // CHECK:STDOUT: %Outer.loc9: type = class_type @Outer, @Outer(constants.%ptr.c28) [concrete = constants.%Outer.614]
  222. // CHECK:STDOUT: }
  223. // CHECK:STDOUT: %v: ref %Outer.614 = bind_name v, %v.var [concrete = %v.var]
  224. // CHECK:STDOUT: name_binding_decl {
  225. // CHECK:STDOUT: %w.patt: %pattern_type.5fa = binding_pattern w [concrete]
  226. // CHECK:STDOUT: %w.var_patt: %pattern_type.5fa = var_pattern %w.patt [concrete]
  227. // CHECK:STDOUT: }
  228. // CHECK:STDOUT: %w.var: ref %Inner.277 = var %w.var_patt [concrete]
  229. // CHECK:STDOUT: %.loc19_35: type = splice_block %Inner [concrete = constants.%Inner.277] {
  230. // CHECK:STDOUT: %Outer.ref.loc19: %Outer.type = name_ref Outer, %Outer.decl [concrete = constants.%Outer.generic]
  231. // CHECK:STDOUT: %.loc19_15: %empty_struct_type = struct_literal ()
  232. // CHECK:STDOUT: %.loc19_16: type = converted %.loc19_15, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  233. // CHECK:STDOUT: %ptr.loc19_16: type = ptr_type %.loc19_16 [concrete = constants.%ptr.c28]
  234. // CHECK:STDOUT: %Outer.loc19: type = class_type @Outer, @Outer(constants.%ptr.c28) [concrete = constants.%Outer.614]
  235. // CHECK:STDOUT: %.loc19_18: %Inner.type.5d2 = specific_constant @Outer.%Inner.decl, @Outer(constants.%ptr.c28) [concrete = constants.%Inner.generic.8e6]
  236. // CHECK:STDOUT: %Inner.ref: %Inner.type.5d2 = name_ref Inner, %.loc19_18 [concrete = constants.%Inner.generic.8e6]
  237. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  238. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  239. // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a]
  240. // CHECK:STDOUT: %ptr.loc19_34: type = ptr_type %struct_type.a [concrete = constants.%ptr.1bb]
  241. // CHECK:STDOUT: %Inner: type = class_type @Inner, @Inner(constants.%ptr.c28, constants.%ptr.1bb) [concrete = constants.%Inner.277]
  242. // CHECK:STDOUT: }
  243. // CHECK:STDOUT: %w: ref %Inner.277 = bind_name w, %w.var [concrete = %w.var]
  244. // CHECK:STDOUT: }
  245. // CHECK:STDOUT:
  246. // CHECK:STDOUT: generic class @Outer(%T.loc4_13.1: type) {
  247. // CHECK:STDOUT: %T.loc4_13.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_13.2 (constants.%T)]
  248. // CHECK:STDOUT:
  249. // CHECK:STDOUT: !definition:
  250. // CHECK:STDOUT: %Inner.type: type = generic_class_type @Inner, @Outer(%T.loc4_13.2) [symbolic = %Inner.type (constants.%Inner.type.eae)]
  251. // CHECK:STDOUT: %Inner.generic: @Outer.%Inner.type (%Inner.type.eae) = struct_value () [symbolic = %Inner.generic (constants.%Inner.generic.137)]
  252. // CHECK:STDOUT:
  253. // CHECK:STDOUT: class {
  254. // CHECK:STDOUT: %Inner.decl: @Outer.%Inner.type (%Inner.type.eae) = class_decl @Inner [symbolic = @Outer.%Inner.generic (constants.%Inner.generic.137)] {
  255. // CHECK:STDOUT: %U.patt: %pattern_type.98f = symbolic_binding_pattern U, 1 [concrete]
  256. // CHECK:STDOUT: } {
  257. // CHECK:STDOUT: %U.loc5_15.1: type = bind_symbolic_name U, 1 [symbolic = %U.loc5_15.2 (constants.%U)]
  258. // CHECK:STDOUT: }
  259. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  260. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357]
  261. // CHECK:STDOUT: complete_type_witness = %complete_type
  262. // CHECK:STDOUT:
  263. // CHECK:STDOUT: !members:
  264. // CHECK:STDOUT: .Self = constants.%Outer.9d6
  265. // CHECK:STDOUT: .Inner = %Inner.decl
  266. // CHECK:STDOUT: }
  267. // CHECK:STDOUT: }
  268. // CHECK:STDOUT:
  269. // CHECK:STDOUT: generic class @Inner(@Outer.%T.loc4_13.1: type, %U.loc5_15.1: type) {
  270. // CHECK:STDOUT: %U.loc5_15.2: type = bind_symbolic_name U, 1 [symbolic = %U.loc5_15.2 (constants.%U)]
  271. // CHECK:STDOUT:
  272. // CHECK:STDOUT: !definition:
  273. // CHECK:STDOUT:
  274. // CHECK:STDOUT: class {
  275. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  276. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357]
  277. // CHECK:STDOUT: complete_type_witness = %complete_type
  278. // CHECK:STDOUT:
  279. // CHECK:STDOUT: !members:
  280. // CHECK:STDOUT: .Self = constants.%Inner.c71
  281. // CHECK:STDOUT: }
  282. // CHECK:STDOUT: }
  283. // CHECK:STDOUT:
  284. // CHECK:STDOUT: fn @__global_init() {
  285. // CHECK:STDOUT: !entry:
  286. // CHECK:STDOUT: %v.ref: ref %Outer.614 = name_ref v, file.%v [concrete = file.%v.var]
  287. // CHECK:STDOUT: %.loc19: %Inner.277 = converted %v.ref, <error> [concrete = <error>]
  288. // CHECK:STDOUT: assign file.%w.var, <error>
  289. // CHECK:STDOUT: return
  290. // CHECK:STDOUT: }
  291. // CHECK:STDOUT:
  292. // CHECK:STDOUT: specific @Outer(constants.%T) {
  293. // CHECK:STDOUT: %T.loc4_13.2 => constants.%T
  294. // CHECK:STDOUT: }
  295. // CHECK:STDOUT:
  296. // CHECK:STDOUT: specific @Inner(constants.%T, constants.%U) {
  297. // CHECK:STDOUT: %U.loc5_15.2 => constants.%U
  298. // CHECK:STDOUT: }
  299. // CHECK:STDOUT:
  300. // CHECK:STDOUT: specific @Outer(constants.%ptr.c28) {
  301. // CHECK:STDOUT: %T.loc4_13.2 => constants.%ptr.c28
  302. // CHECK:STDOUT:
  303. // CHECK:STDOUT: !definition:
  304. // CHECK:STDOUT: %Inner.type => constants.%Inner.type.5d2
  305. // CHECK:STDOUT: %Inner.generic => constants.%Inner.generic.8e6
  306. // CHECK:STDOUT: }
  307. // CHECK:STDOUT:
  308. // CHECK:STDOUT: specific @Inner(constants.%ptr.c28, constants.%ptr.1bb) {
  309. // CHECK:STDOUT: %U.loc5_15.2 => constants.%ptr.1bb
  310. // CHECK:STDOUT:
  311. // CHECK:STDOUT: !definition:
  312. // CHECK:STDOUT: }
  313. // CHECK:STDOUT:
  314. // CHECK:STDOUT: --- fail_int_value.carbon
  315. // CHECK:STDOUT:
  316. // CHECK:STDOUT: constants {
  317. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  318. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  319. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  320. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  321. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  322. // CHECK:STDOUT: %N.51e: %i32 = bind_symbolic_name N, 0 [symbolic]
  323. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  324. // CHECK:STDOUT: %C.type: type = generic_class_type @C [concrete]
  325. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [concrete]
  326. // CHECK:STDOUT: %C.506: type = class_type @C, @C(%N.51e) [symbolic]
  327. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  328. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  329. // CHECK:STDOUT: %int_123.fff: Core.IntLiteral = int_value 123 [concrete]
  330. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  331. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  332. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  333. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  334. // CHECK:STDOUT: %To: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  335. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @ImplicitAs.impl.4f9(%To) [symbolic]
  336. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  337. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @ImplicitAs.impl.4f9(%int_32) [concrete]
  338. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @ImplicitAs.impl.4f9(%int_32) [concrete]
  339. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  340. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  341. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  342. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_123.fff, %Convert.956 [concrete]
  343. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  344. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_123.fff, %Convert.specific_fn [concrete]
  345. // CHECK:STDOUT: %int_123.f7f: %i32 = int_value 123 [concrete]
  346. // CHECK:STDOUT: %C.4c3: type = class_type @C, @C(%int_123.f7f) [concrete]
  347. // CHECK:STDOUT: %pattern_type.1b4: type = pattern_type %C.4c3 [concrete]
  348. // CHECK:STDOUT: }
  349. // CHECK:STDOUT:
  350. // CHECK:STDOUT: imports {
  351. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  352. // CHECK:STDOUT: .Int = %Core.Int
  353. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  354. // CHECK:STDOUT: import Core//prelude
  355. // CHECK:STDOUT: import Core//prelude/...
  356. // CHECK:STDOUT: }
  357. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  358. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  359. // CHECK:STDOUT: %Core.import_ref.a5b: @ImplicitAs.impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @ImplicitAs.impl.4f9.%Convert (constants.%Convert.f06)]
  360. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @ImplicitAs.impl.4f9 [concrete]
  361. // CHECK:STDOUT: }
  362. // CHECK:STDOUT:
  363. // CHECK:STDOUT: file {
  364. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  365. // CHECK:STDOUT: .Core = imports.%Core
  366. // CHECK:STDOUT: .C = %C.decl
  367. // CHECK:STDOUT: .v = %v
  368. // CHECK:STDOUT: }
  369. // CHECK:STDOUT: %Core.import = import Core
  370. // CHECK:STDOUT: %C.decl: %C.type = class_decl @C [concrete = constants.%C.generic] {
  371. // CHECK:STDOUT: %N.patt: %pattern_type.7ce = symbolic_binding_pattern N, 0 [concrete]
  372. // CHECK:STDOUT: } {
  373. // CHECK:STDOUT: %.loc4: type = splice_block %i32 [concrete = constants.%i32] {
  374. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  375. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  376. // CHECK:STDOUT: }
  377. // CHECK:STDOUT: %N.loc4_9.1: %i32 = bind_symbolic_name N, 0 [symbolic = %N.loc4_9.2 (constants.%N.51e)]
  378. // CHECK:STDOUT: }
  379. // CHECK:STDOUT: name_binding_decl {
  380. // CHECK:STDOUT: %v.patt: %pattern_type.1b4 = binding_pattern v [concrete]
  381. // CHECK:STDOUT: %v.var_patt: %pattern_type.1b4 = var_pattern %v.patt [concrete]
  382. // CHECK:STDOUT: }
  383. // CHECK:STDOUT: %v.var: ref %C.4c3 = var %v.var_patt [concrete]
  384. // CHECK:STDOUT: %.loc13_13.1: type = splice_block %C [concrete = constants.%C.4c3] {
  385. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, %C.decl [concrete = constants.%C.generic]
  386. // CHECK:STDOUT: %int_123: Core.IntLiteral = int_value 123 [concrete = constants.%int_123.fff]
  387. // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  388. // CHECK:STDOUT: %bound_method.loc13_13.1: <bound method> = bound_method %int_123, %impl.elem0 [concrete = constants.%Convert.bound]
  389. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  390. // CHECK:STDOUT: %bound_method.loc13_13.2: <bound method> = bound_method %int_123, %specific_fn [concrete = constants.%bound_method]
  391. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc13_13.2(%int_123) [concrete = constants.%int_123.f7f]
  392. // CHECK:STDOUT: %.loc13_13.2: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_123.f7f]
  393. // CHECK:STDOUT: %.loc13_13.3: %i32 = converted %int_123, %.loc13_13.2 [concrete = constants.%int_123.f7f]
  394. // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%int_123.f7f) [concrete = constants.%C.4c3]
  395. // CHECK:STDOUT: }
  396. // CHECK:STDOUT: %v: ref %C.4c3 = bind_name v, %v.var [concrete = %v.var]
  397. // CHECK:STDOUT: }
  398. // CHECK:STDOUT:
  399. // CHECK:STDOUT: generic class @C(%N.loc4_9.1: %i32) {
  400. // CHECK:STDOUT: %N.loc4_9.2: %i32 = bind_symbolic_name N, 0 [symbolic = %N.loc4_9.2 (constants.%N.51e)]
  401. // CHECK:STDOUT:
  402. // CHECK:STDOUT: !definition:
  403. // CHECK:STDOUT:
  404. // CHECK:STDOUT: class {
  405. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  406. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357]
  407. // CHECK:STDOUT: complete_type_witness = %complete_type
  408. // CHECK:STDOUT:
  409. // CHECK:STDOUT: !members:
  410. // CHECK:STDOUT: .Self = constants.%C.506
  411. // CHECK:STDOUT: }
  412. // CHECK:STDOUT: }
  413. // CHECK:STDOUT:
  414. // CHECK:STDOUT: fn @__global_init() {
  415. // CHECK:STDOUT: !entry:
  416. // CHECK:STDOUT: %.loc13_18: %empty_tuple.type = tuple_literal ()
  417. // CHECK:STDOUT: %.loc13_1: %C.4c3 = converted %.loc13_18, <error> [concrete = <error>]
  418. // CHECK:STDOUT: assign file.%v.var, <error>
  419. // CHECK:STDOUT: return
  420. // CHECK:STDOUT: }
  421. // CHECK:STDOUT:
  422. // CHECK:STDOUT: specific @C(constants.%N.51e) {
  423. // CHECK:STDOUT: %N.loc4_9.2 => constants.%N.51e
  424. // CHECK:STDOUT: }
  425. // CHECK:STDOUT:
  426. // CHECK:STDOUT: specific @C(constants.%int_123.f7f) {
  427. // CHECK:STDOUT: %N.loc4_9.2 => constants.%int_123.f7f
  428. // CHECK:STDOUT:
  429. // CHECK:STDOUT: !definition:
  430. // CHECK:STDOUT: }
  431. // CHECK:STDOUT:
  432. // CHECK:STDOUT: --- fail_class_param.carbon
  433. // CHECK:STDOUT:
  434. // CHECK:STDOUT: constants {
  435. // CHECK:STDOUT: %D: type = class_type @D [concrete]
  436. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  437. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  438. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  439. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  440. // CHECK:STDOUT: %D.elem: type = unbound_element_type %D, %i32 [concrete]
  441. // CHECK:STDOUT: %struct_type.a.b.501: type = struct_type {.a: %i32, .b: %i32} [concrete]
  442. // CHECK:STDOUT: %complete_type.705: <witness> = complete_type_witness %struct_type.a.b.501 [concrete]
  443. // CHECK:STDOUT: %F: %D = bind_symbolic_name F, 0 [symbolic]
  444. // CHECK:STDOUT: %pattern_type.510: type = pattern_type %D [concrete]
  445. // CHECK:STDOUT: %E.type: type = generic_class_type @E [concrete]
  446. // CHECK:STDOUT: %E.generic: %E.type = struct_value () [concrete]
  447. // CHECK:STDOUT: %E: type = class_type @E, @E(%F) [symbolic]
  448. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  449. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  450. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  451. // CHECK:STDOUT: %int_2.ecc: Core.IntLiteral = int_value 2 [concrete]
  452. // CHECK:STDOUT: %struct_type.a.b.cfd: type = struct_type {.a: Core.IntLiteral, .b: Core.IntLiteral} [concrete]
  453. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  454. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  455. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  456. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  457. // CHECK:STDOUT: %To: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  458. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @ImplicitAs.impl.4f9(%To) [symbolic]
  459. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  460. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @ImplicitAs.impl.4f9(%int_32) [concrete]
  461. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @ImplicitAs.impl.4f9(%int_32) [concrete]
  462. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  463. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  464. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  465. // CHECK:STDOUT: %Convert.bound.ab5: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  466. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  467. // CHECK:STDOUT: %bound_method.9a1: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  468. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  469. // CHECK:STDOUT: %Convert.bound.ef9: <bound method> = bound_method %int_2.ecc, %Convert.956 [concrete]
  470. // CHECK:STDOUT: %bound_method.b92: <bound method> = bound_method %int_2.ecc, %Convert.specific_fn [concrete]
  471. // CHECK:STDOUT: %int_2.ef8: %i32 = int_value 2 [concrete]
  472. // CHECK:STDOUT: %D.val.413: %D = struct_value (%int_1.5d2, %int_2.ef8) [concrete]
  473. // CHECK:STDOUT: %int_3.1ba: Core.IntLiteral = int_value 3 [concrete]
  474. // CHECK:STDOUT: %int_4.0c1: Core.IntLiteral = int_value 4 [concrete]
  475. // CHECK:STDOUT: %Convert.bound.b30: <bound method> = bound_method %int_3.1ba, %Convert.956 [concrete]
  476. // CHECK:STDOUT: %bound_method.047: <bound method> = bound_method %int_3.1ba, %Convert.specific_fn [concrete]
  477. // CHECK:STDOUT: %int_3.822: %i32 = int_value 3 [concrete]
  478. // CHECK:STDOUT: %Convert.bound.ac3: <bound method> = bound_method %int_4.0c1, %Convert.956 [concrete]
  479. // CHECK:STDOUT: %bound_method.1da: <bound method> = bound_method %int_4.0c1, %Convert.specific_fn [concrete]
  480. // CHECK:STDOUT: %int_4.940: %i32 = int_value 4 [concrete]
  481. // CHECK:STDOUT: %D.val.835: %D = struct_value (%int_3.822, %int_4.940) [concrete]
  482. // CHECK:STDOUT: }
  483. // CHECK:STDOUT:
  484. // CHECK:STDOUT: imports {
  485. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  486. // CHECK:STDOUT: .Int = %Core.Int
  487. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  488. // CHECK:STDOUT: import Core//prelude
  489. // CHECK:STDOUT: import Core//prelude/...
  490. // CHECK:STDOUT: }
  491. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  492. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  493. // CHECK:STDOUT: %Core.import_ref.a5b: @ImplicitAs.impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @ImplicitAs.impl.4f9.%Convert (constants.%Convert.f06)]
  494. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @ImplicitAs.impl.4f9 [concrete]
  495. // CHECK:STDOUT: }
  496. // CHECK:STDOUT:
  497. // CHECK:STDOUT: file {
  498. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  499. // CHECK:STDOUT: .Core = imports.%Core
  500. // CHECK:STDOUT: .D = %D.decl
  501. // CHECK:STDOUT: .E = %E.decl
  502. // CHECK:STDOUT: .g = %g
  503. // CHECK:STDOUT: }
  504. // CHECK:STDOUT: %Core.import = import Core
  505. // CHECK:STDOUT: %D.decl: type = class_decl @D [concrete = constants.%D] {} {}
  506. // CHECK:STDOUT: %E.decl: %E.type = class_decl @E [concrete = constants.%E.generic] {
  507. // CHECK:STDOUT: %F.patt: %pattern_type.510 = symbolic_binding_pattern F, 0 [concrete]
  508. // CHECK:STDOUT: } {
  509. // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [concrete = constants.%D]
  510. // CHECK:STDOUT: %F.loc9_9.1: %D = bind_symbolic_name F, 0 [symbolic = %F.loc9_9.2 (constants.%F)]
  511. // CHECK:STDOUT: }
  512. // CHECK:STDOUT: name_binding_decl {
  513. // CHECK:STDOUT: %g.patt: <error> = binding_pattern g [concrete]
  514. // CHECK:STDOUT: %g.var_patt: <error> = var_pattern %g.patt [concrete]
  515. // CHECK:STDOUT: }
  516. // CHECK:STDOUT: %g.var: ref <error> = var %g.var_patt [concrete = <error>]
  517. // CHECK:STDOUT: %.1: <error> = splice_block <error> [concrete = <error>] {
  518. // CHECK:STDOUT: %E.ref: %E.type = name_ref E, %E.decl [concrete = constants.%E.generic]
  519. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  520. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc]
  521. // CHECK:STDOUT: %.loc25_25.1: %struct_type.a.b.cfd = struct_literal (%int_1, %int_2)
  522. // CHECK:STDOUT: %impl.elem0.loc25_25.1: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  523. // CHECK:STDOUT: %bound_method.loc25_25.1: <bound method> = bound_method %int_1, %impl.elem0.loc25_25.1 [concrete = constants.%Convert.bound.ab5]
  524. // CHECK:STDOUT: %specific_fn.loc25_25.1: <specific function> = specific_function %impl.elem0.loc25_25.1, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  525. // CHECK:STDOUT: %bound_method.loc25_25.2: <bound method> = bound_method %int_1, %specific_fn.loc25_25.1 [concrete = constants.%bound_method.9a1]
  526. // CHECK:STDOUT: %int.convert_checked.loc25_25.1: init %i32 = call %bound_method.loc25_25.2(%int_1) [concrete = constants.%int_1.5d2]
  527. // CHECK:STDOUT: %.loc25_25.2: init %i32 = converted %int_1, %int.convert_checked.loc25_25.1 [concrete = constants.%int_1.5d2]
  528. // CHECK:STDOUT: %.loc25_25.3: ref %D = temporary_storage
  529. // CHECK:STDOUT: %.loc25_25.4: ref %i32 = class_element_access %.loc25_25.3, element0
  530. // CHECK:STDOUT: %.loc25_25.5: init %i32 = initialize_from %.loc25_25.2 to %.loc25_25.4 [concrete = constants.%int_1.5d2]
  531. // CHECK:STDOUT: %impl.elem0.loc25_25.2: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  532. // CHECK:STDOUT: %bound_method.loc25_25.3: <bound method> = bound_method %int_2, %impl.elem0.loc25_25.2 [concrete = constants.%Convert.bound.ef9]
  533. // CHECK:STDOUT: %specific_fn.loc25_25.2: <specific function> = specific_function %impl.elem0.loc25_25.2, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  534. // CHECK:STDOUT: %bound_method.loc25_25.4: <bound method> = bound_method %int_2, %specific_fn.loc25_25.2 [concrete = constants.%bound_method.b92]
  535. // CHECK:STDOUT: %int.convert_checked.loc25_25.2: init %i32 = call %bound_method.loc25_25.4(%int_2) [concrete = constants.%int_2.ef8]
  536. // CHECK:STDOUT: %.loc25_25.6: init %i32 = converted %int_2, %int.convert_checked.loc25_25.2 [concrete = constants.%int_2.ef8]
  537. // CHECK:STDOUT: %.loc25_25.7: ref %i32 = class_element_access %.loc25_25.3, element1
  538. // CHECK:STDOUT: %.loc25_25.8: init %i32 = initialize_from %.loc25_25.6 to %.loc25_25.7 [concrete = constants.%int_2.ef8]
  539. // CHECK:STDOUT: %.loc25_25.9: init %D = class_init (%.loc25_25.5, %.loc25_25.8), %.loc25_25.3 [concrete = constants.%D.val.413]
  540. // CHECK:STDOUT: %.loc25_25.10: ref %D = temporary %.loc25_25.3, %.loc25_25.9
  541. // CHECK:STDOUT: %.loc25_26.1: ref %D = converted %.loc25_25.1, %.loc25_25.10
  542. // CHECK:STDOUT: %.loc25_26.2: %D = bind_value %.loc25_26.1
  543. // CHECK:STDOUT: }
  544. // CHECK:STDOUT: %g: <error> = bind_name g, <error> [concrete = <error>]
  545. // CHECK:STDOUT: }
  546. // CHECK:STDOUT:
  547. // CHECK:STDOUT: class @D {
  548. // CHECK:STDOUT: %int_32.loc5: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  549. // CHECK:STDOUT: %i32.loc5: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  550. // CHECK:STDOUT: %.loc5: %D.elem = field_decl a, element0 [concrete]
  551. // CHECK:STDOUT: %int_32.loc6: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  552. // CHECK:STDOUT: %i32.loc6: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  553. // CHECK:STDOUT: %.loc6: %D.elem = field_decl b, element1 [concrete]
  554. // CHECK:STDOUT: %struct_type.a.b: type = struct_type {.a: %i32, .b: %i32} [concrete = constants.%struct_type.a.b.501]
  555. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.a.b [concrete = constants.%complete_type.705]
  556. // CHECK:STDOUT: complete_type_witness = %complete_type
  557. // CHECK:STDOUT:
  558. // CHECK:STDOUT: !members:
  559. // CHECK:STDOUT: .Self = constants.%D
  560. // CHECK:STDOUT: .a = %.loc5
  561. // CHECK:STDOUT: .b = %.loc6
  562. // CHECK:STDOUT: }
  563. // CHECK:STDOUT:
  564. // CHECK:STDOUT: generic class @E(%F.loc9_9.1: %D) {
  565. // CHECK:STDOUT: %F.loc9_9.2: %D = bind_symbolic_name F, 0 [symbolic = %F.loc9_9.2 (constants.%F)]
  566. // CHECK:STDOUT:
  567. // CHECK:STDOUT: !definition:
  568. // CHECK:STDOUT:
  569. // CHECK:STDOUT: class {
  570. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  571. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357]
  572. // CHECK:STDOUT: complete_type_witness = %complete_type
  573. // CHECK:STDOUT:
  574. // CHECK:STDOUT: !members:
  575. // CHECK:STDOUT: .Self = constants.%E
  576. // CHECK:STDOUT: }
  577. // CHECK:STDOUT: }
  578. // CHECK:STDOUT:
  579. // CHECK:STDOUT: fn @__global_init() {
  580. // CHECK:STDOUT: !entry:
  581. // CHECK:STDOUT: %.loc25_31: %empty_struct_type = struct_literal ()
  582. // CHECK:STDOUT: %E.ref: %E.type = name_ref E, file.%E.decl [concrete = constants.%E.generic]
  583. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba]
  584. // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4.0c1]
  585. // CHECK:STDOUT: %.loc25_53.1: %struct_type.a.b.cfd = struct_literal (%int_3, %int_4)
  586. // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [concrete = constants.%D]
  587. // CHECK:STDOUT: %impl.elem0.loc25_53.1: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  588. // CHECK:STDOUT: %bound_method.loc25_53.1: <bound method> = bound_method %int_3, %impl.elem0.loc25_53.1 [concrete = constants.%Convert.bound.b30]
  589. // CHECK:STDOUT: %specific_fn.loc25_53.1: <specific function> = specific_function %impl.elem0.loc25_53.1, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  590. // CHECK:STDOUT: %bound_method.loc25_53.2: <bound method> = bound_method %int_3, %specific_fn.loc25_53.1 [concrete = constants.%bound_method.047]
  591. // CHECK:STDOUT: %int.convert_checked.loc25_53.1: init %i32 = call %bound_method.loc25_53.2(%int_3) [concrete = constants.%int_3.822]
  592. // CHECK:STDOUT: %.loc25_53.2: init %i32 = converted %int_3, %int.convert_checked.loc25_53.1 [concrete = constants.%int_3.822]
  593. // CHECK:STDOUT: %.loc25_53.3: ref %D = temporary_storage
  594. // CHECK:STDOUT: %.loc25_53.4: ref %i32 = class_element_access %.loc25_53.3, element0
  595. // CHECK:STDOUT: %.loc25_53.5: init %i32 = initialize_from %.loc25_53.2 to %.loc25_53.4 [concrete = constants.%int_3.822]
  596. // CHECK:STDOUT: %impl.elem0.loc25_53.2: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  597. // CHECK:STDOUT: %bound_method.loc25_53.3: <bound method> = bound_method %int_4, %impl.elem0.loc25_53.2 [concrete = constants.%Convert.bound.ac3]
  598. // CHECK:STDOUT: %specific_fn.loc25_53.2: <specific function> = specific_function %impl.elem0.loc25_53.2, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  599. // CHECK:STDOUT: %bound_method.loc25_53.4: <bound method> = bound_method %int_4, %specific_fn.loc25_53.2 [concrete = constants.%bound_method.1da]
  600. // CHECK:STDOUT: %int.convert_checked.loc25_53.2: init %i32 = call %bound_method.loc25_53.4(%int_4) [concrete = constants.%int_4.940]
  601. // CHECK:STDOUT: %.loc25_53.6: init %i32 = converted %int_4, %int.convert_checked.loc25_53.2 [concrete = constants.%int_4.940]
  602. // CHECK:STDOUT: %.loc25_53.7: ref %i32 = class_element_access %.loc25_53.3, element1
  603. // CHECK:STDOUT: %.loc25_53.8: init %i32 = initialize_from %.loc25_53.6 to %.loc25_53.7 [concrete = constants.%int_4.940]
  604. // CHECK:STDOUT: %.loc25_53.9: init %D = class_init (%.loc25_53.5, %.loc25_53.8), %.loc25_53.3 [concrete = constants.%D.val.835]
  605. // CHECK:STDOUT: %.loc25_53.10: ref %D = temporary %.loc25_53.3, %.loc25_53.9
  606. // CHECK:STDOUT: %.loc25_55.1: ref %D = converted %.loc25_53.1, %.loc25_53.10
  607. // CHECK:STDOUT: %.loc25_55.2: %D = bind_value %.loc25_55.1
  608. // CHECK:STDOUT: assign file.%g.var, <error>
  609. // CHECK:STDOUT: return
  610. // CHECK:STDOUT: }
  611. // CHECK:STDOUT:
  612. // CHECK:STDOUT: specific @E(constants.%F) {
  613. // CHECK:STDOUT: %F.loc9_9.2 => constants.%F
  614. // CHECK:STDOUT: }
  615. // CHECK:STDOUT: