stringify.carbon 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  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/stringify.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/generic/stringify.carbon
  10. // --- fail_empty_params.carbon
  11. library "[[@TEST_NAME]]";
  12. class NoParams {}
  13. class EmptyParams() {}
  14. var v: NoParams;
  15. // CHECK:STDERR: fail_empty_params.carbon:[[@LINE+7]]:1: error: cannot implicitly convert from `NoParams` to `EmptyParams()` [ImplicitAsConversionFailure]
  16. // CHECK:STDERR: var w: EmptyParams() = v;
  17. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
  18. // CHECK:STDERR: fail_empty_params.carbon:[[@LINE+4]]:1: note: type `NoParams` does not implement interface `ImplicitAs(EmptyParams())` [MissingImplInMemberAccessNote]
  19. // CHECK:STDERR: var w: EmptyParams() = v;
  20. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
  21. // CHECK:STDERR:
  22. var w: EmptyParams() = v;
  23. // --- fail_nested.carbon
  24. library "[[@TEST_NAME]]";
  25. class Outer(T:! type) {
  26. class Inner(U:! type) {
  27. }
  28. }
  29. var v: Outer({}*);
  30. // TODO: It would be nice to include the `Outer({}*).` prefix in the name of `Inner`.
  31. // CHECK:STDERR: fail_nested.carbon:[[@LINE+7]]:1: error: cannot implicitly convert from `Outer({}*)` to `Inner({.a: i32}*)` [ImplicitAsConversionFailure]
  32. // CHECK:STDERR: var w: Outer({}*).Inner({.a: i32}*) = v;
  33. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  34. // CHECK:STDERR: fail_nested.carbon:[[@LINE+4]]:1: note: type `Outer({}*)` does not implement interface `ImplicitAs(Inner({.a: i32}*))` [MissingImplInMemberAccessNote]
  35. // CHECK:STDERR: var w: Outer({}*).Inner({.a: i32}*) = v;
  36. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  37. // CHECK:STDERR:
  38. var w: Outer({}*).Inner({.a: i32}*) = v;
  39. // --- fail_int_value.carbon
  40. library "[[@TEST_NAME]]";
  41. class C(N:! i32) {}
  42. // CHECK:STDERR: fail_int_value.carbon:[[@LINE+6]]:1: error: cannot implicitly convert from `()` to `C(123)` [ImplicitAsConversionFailure]
  43. // CHECK:STDERR: var v: C(123) = ();
  44. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
  45. // CHECK:STDERR: fail_int_value.carbon:[[@LINE+3]]:1: note: type `()` does not implement interface `ImplicitAs(C(123))` [MissingImplInMemberAccessNote]
  46. // CHECK:STDERR: var v: C(123) = ();
  47. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
  48. var v: C(123) = ();
  49. // CHECK:STDOUT: --- fail_empty_params.carbon
  50. // CHECK:STDOUT:
  51. // CHECK:STDOUT: constants {
  52. // CHECK:STDOUT: %NoParams: type = class_type @NoParams [template]
  53. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  54. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  55. // CHECK:STDOUT: %EmptyParams.type: type = generic_class_type @EmptyParams [template]
  56. // CHECK:STDOUT: %EmptyParams.generic: %EmptyParams.type = struct_value () [template]
  57. // CHECK:STDOUT: %EmptyParams: type = class_type @EmptyParams [template]
  58. // CHECK:STDOUT: }
  59. // CHECK:STDOUT:
  60. // CHECK:STDOUT: imports {
  61. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  62. // CHECK:STDOUT: .ImplicitAs = %import_ref.1
  63. // CHECK:STDOUT: import Core//prelude
  64. // CHECK:STDOUT: import Core//prelude/...
  65. // CHECK:STDOUT: }
  66. // CHECK:STDOUT: }
  67. // CHECK:STDOUT:
  68. // CHECK:STDOUT: file {
  69. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  70. // CHECK:STDOUT: .Core = imports.%Core
  71. // CHECK:STDOUT: .NoParams = %NoParams.decl
  72. // CHECK:STDOUT: .EmptyParams = %EmptyParams.decl
  73. // CHECK:STDOUT: .v = %v
  74. // CHECK:STDOUT: .w = %w
  75. // CHECK:STDOUT: }
  76. // CHECK:STDOUT: %Core.import = import Core
  77. // CHECK:STDOUT: %NoParams.decl: type = class_decl @NoParams [template = constants.%NoParams] {} {}
  78. // CHECK:STDOUT: %EmptyParams.decl: %EmptyParams.type = class_decl @EmptyParams [template = constants.%EmptyParams.generic] {} {}
  79. // CHECK:STDOUT: %NoParams.ref: type = name_ref NoParams, %NoParams.decl [template = constants.%NoParams]
  80. // CHECK:STDOUT: %v.var: ref %NoParams = var v
  81. // CHECK:STDOUT: %v: ref %NoParams = bind_name v, %v.var
  82. // CHECK:STDOUT: %EmptyParams.ref: %EmptyParams.type = name_ref EmptyParams, %EmptyParams.decl [template = constants.%EmptyParams.generic]
  83. // CHECK:STDOUT: %EmptyParams: type = class_type @EmptyParams [template = constants.%EmptyParams]
  84. // CHECK:STDOUT: %w.var: ref %EmptyParams = var w
  85. // CHECK:STDOUT: %w: ref %EmptyParams = bind_name w, %w.var
  86. // CHECK:STDOUT: }
  87. // CHECK:STDOUT:
  88. // CHECK:STDOUT: class @NoParams {
  89. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  90. // CHECK:STDOUT:
  91. // CHECK:STDOUT: !members:
  92. // CHECK:STDOUT: .Self = constants.%NoParams
  93. // CHECK:STDOUT: complete_type_witness = %complete_type
  94. // CHECK:STDOUT: }
  95. // CHECK:STDOUT:
  96. // CHECK:STDOUT: class @EmptyParams {
  97. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  98. // CHECK:STDOUT:
  99. // CHECK:STDOUT: !members:
  100. // CHECK:STDOUT: .Self = constants.%EmptyParams
  101. // CHECK:STDOUT: complete_type_witness = %complete_type
  102. // CHECK:STDOUT: }
  103. // CHECK:STDOUT:
  104. // CHECK:STDOUT: fn @__global_init() {
  105. // CHECK:STDOUT: !entry:
  106. // CHECK:STDOUT: %v.ref: ref %NoParams = name_ref v, file.%v
  107. // CHECK:STDOUT: %.loc15: %EmptyParams = converted %v.ref, <error> [template = <error>]
  108. // CHECK:STDOUT: assign file.%w.var, <error>
  109. // CHECK:STDOUT: return
  110. // CHECK:STDOUT: }
  111. // CHECK:STDOUT:
  112. // CHECK:STDOUT: --- fail_nested.carbon
  113. // CHECK:STDOUT:
  114. // CHECK:STDOUT: constants {
  115. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  116. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  117. // CHECK:STDOUT: %Outer.type: type = generic_class_type @Outer [template]
  118. // CHECK:STDOUT: %Outer.generic: %Outer.type = struct_value () [template]
  119. // CHECK:STDOUT: %Outer.1: type = class_type @Outer, @Outer(%T) [symbolic]
  120. // CHECK:STDOUT: %U: type = bind_symbolic_name U, 1 [symbolic]
  121. // CHECK:STDOUT: %U.patt: type = symbolic_binding_pattern U, 1 [symbolic]
  122. // CHECK:STDOUT: %Inner.type.1: type = generic_class_type @Inner, @Outer(%T) [symbolic]
  123. // CHECK:STDOUT: %Inner.generic.1: %Inner.type.1 = struct_value () [symbolic]
  124. // CHECK:STDOUT: %Inner.1: type = class_type @Inner, @Inner(%T, %U) [symbolic]
  125. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  126. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  127. // CHECK:STDOUT: %ptr.1: type = ptr_type %empty_struct_type [template]
  128. // CHECK:STDOUT: %Outer.2: type = class_type @Outer, @Outer(%ptr.1) [template]
  129. // CHECK:STDOUT: %Inner.type.2: type = generic_class_type @Inner, @Outer(%ptr.1) [template]
  130. // CHECK:STDOUT: %Inner.generic.2: %Inner.type.2 = struct_value () [template]
  131. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  132. // CHECK:STDOUT: %Int.type: type = fn_type @Int [template]
  133. // CHECK:STDOUT: %Int: %Int.type = struct_value () [template]
  134. // CHECK:STDOUT: %i32: type = int_type signed, %int_32 [template]
  135. // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [template]
  136. // CHECK:STDOUT: %ptr.2: type = ptr_type %struct_type.a [template]
  137. // CHECK:STDOUT: %Inner.2: type = class_type @Inner, @Inner(%ptr.1, %ptr.2) [template]
  138. // CHECK:STDOUT: }
  139. // CHECK:STDOUT:
  140. // CHECK:STDOUT: imports {
  141. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  142. // CHECK:STDOUT: .Int = %import_ref.1
  143. // CHECK:STDOUT: .ImplicitAs = %import_ref.2
  144. // CHECK:STDOUT: import Core//prelude
  145. // CHECK:STDOUT: import Core//prelude/...
  146. // CHECK:STDOUT: }
  147. // CHECK:STDOUT: }
  148. // CHECK:STDOUT:
  149. // CHECK:STDOUT: file {
  150. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  151. // CHECK:STDOUT: .Core = imports.%Core
  152. // CHECK:STDOUT: .Outer = %Outer.decl
  153. // CHECK:STDOUT: .v = %v
  154. // CHECK:STDOUT: .w = %w
  155. // CHECK:STDOUT: }
  156. // CHECK:STDOUT: %Core.import = import Core
  157. // CHECK:STDOUT: %Outer.decl: %Outer.type = class_decl @Outer [template = constants.%Outer.generic] {
  158. // CHECK:STDOUT: %T.patt.loc4_13.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_13.2 (constants.%T.patt)]
  159. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc4_13.1, runtime_param<invalid> [symbolic = %T.patt.loc4_13.2 (constants.%T.patt)]
  160. // CHECK:STDOUT: } {
  161. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  162. // CHECK:STDOUT: %T.loc4_13.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc4_13.2 (constants.%T)]
  163. // CHECK:STDOUT: }
  164. // CHECK:STDOUT: %Outer.ref.loc9: %Outer.type = name_ref Outer, %Outer.decl [template = constants.%Outer.generic]
  165. // CHECK:STDOUT: %.loc9_15: %empty_struct_type = struct_literal ()
  166. // CHECK:STDOUT: %.loc9_16: type = converted %.loc9_15, constants.%empty_struct_type [template = constants.%empty_struct_type]
  167. // CHECK:STDOUT: %ptr.loc9: type = ptr_type %empty_struct_type [template = constants.%ptr.1]
  168. // CHECK:STDOUT: %Outer.loc9: type = class_type @Outer, @Outer(constants.%ptr.1) [template = constants.%Outer.2]
  169. // CHECK:STDOUT: %v.var: ref %Outer.2 = var v
  170. // CHECK:STDOUT: %v: ref %Outer.2 = bind_name v, %v.var
  171. // CHECK:STDOUT: %Outer.ref.loc19: %Outer.type = name_ref Outer, %Outer.decl [template = constants.%Outer.generic]
  172. // CHECK:STDOUT: %.loc19_15: %empty_struct_type = struct_literal ()
  173. // CHECK:STDOUT: %.loc19_16: type = converted %.loc19_15, constants.%empty_struct_type [template = constants.%empty_struct_type]
  174. // CHECK:STDOUT: %ptr.loc19_16: type = ptr_type %empty_struct_type [template = constants.%ptr.1]
  175. // CHECK:STDOUT: %Outer.loc19: type = class_type @Outer, @Outer(constants.%ptr.1) [template = constants.%Outer.2]
  176. // CHECK:STDOUT: %.loc19_18: %Inner.type.2 = specific_constant @Outer.%Inner.decl, @Outer(constants.%ptr.1) [template = constants.%Inner.generic.2]
  177. // CHECK:STDOUT: %Inner.ref: %Inner.type.2 = name_ref Inner, %.loc19_18 [template = constants.%Inner.generic.2]
  178. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  179. // CHECK:STDOUT: %int.make_type_signed: init type = call constants.%Int(%int_32) [template = constants.%i32]
  180. // CHECK:STDOUT: %.loc19_30.1: type = value_of_initializer %int.make_type_signed [template = constants.%i32]
  181. // CHECK:STDOUT: %.loc19_30.2: type = converted %int.make_type_signed, %.loc19_30.1 [template = constants.%i32]
  182. // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [template = constants.%struct_type.a]
  183. // CHECK:STDOUT: %ptr.loc19_34: type = ptr_type %struct_type.a [template = constants.%ptr.2]
  184. // CHECK:STDOUT: %Inner: type = class_type @Inner, @Inner(constants.%ptr.1, constants.%ptr.2) [template = constants.%Inner.2]
  185. // CHECK:STDOUT: %w.var: ref %Inner.2 = var w
  186. // CHECK:STDOUT: %w: ref %Inner.2 = bind_name w, %w.var
  187. // CHECK:STDOUT: }
  188. // CHECK:STDOUT:
  189. // CHECK:STDOUT: generic class @Outer(%T.loc4_13.1: type) {
  190. // CHECK:STDOUT: %T.loc4_13.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_13.2 (constants.%T)]
  191. // CHECK:STDOUT: %T.patt.loc4_13.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_13.2 (constants.%T.patt)]
  192. // CHECK:STDOUT:
  193. // CHECK:STDOUT: !definition:
  194. // CHECK:STDOUT: %Inner.type: type = generic_class_type @Inner, @Outer(%T.loc4_13.2) [symbolic = %Inner.type (constants.%Inner.type.1)]
  195. // CHECK:STDOUT: %Inner.generic: @Outer.%Inner.type (%Inner.type.1) = struct_value () [symbolic = %Inner.generic (constants.%Inner.generic.1)]
  196. // CHECK:STDOUT:
  197. // CHECK:STDOUT: class {
  198. // CHECK:STDOUT: %Inner.decl: @Outer.%Inner.type (%Inner.type.1) = class_decl @Inner [symbolic = @Outer.%Inner.generic (constants.%Inner.generic.1)] {
  199. // CHECK:STDOUT: %U.patt.loc5_15.1: type = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc5_15.2 (constants.%U.patt)]
  200. // CHECK:STDOUT: %U.param_patt: type = value_param_pattern %U.patt.loc5_15.1, runtime_param<invalid> [symbolic = %U.patt.loc5_15.2 (constants.%U.patt)]
  201. // CHECK:STDOUT: } {
  202. // CHECK:STDOUT: %U.param: type = value_param runtime_param<invalid>
  203. // CHECK:STDOUT: %U.loc5_15.1: type = bind_symbolic_name U, 1, %U.param [symbolic = %U.loc5_15.2 (constants.%U)]
  204. // CHECK:STDOUT: }
  205. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  206. // CHECK:STDOUT:
  207. // CHECK:STDOUT: !members:
  208. // CHECK:STDOUT: .Self = constants.%Outer.1
  209. // CHECK:STDOUT: .Inner = %Inner.decl
  210. // CHECK:STDOUT: complete_type_witness = %complete_type
  211. // CHECK:STDOUT: }
  212. // CHECK:STDOUT: }
  213. // CHECK:STDOUT:
  214. // CHECK:STDOUT: generic class @Inner(@Outer.%T.loc4_13.1: type, %U.loc5_15.1: type) {
  215. // CHECK:STDOUT: %U.loc5_15.2: type = bind_symbolic_name U, 1 [symbolic = %U.loc5_15.2 (constants.%U)]
  216. // CHECK:STDOUT: %U.patt.loc5_15.2: type = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc5_15.2 (constants.%U.patt)]
  217. // CHECK:STDOUT:
  218. // CHECK:STDOUT: !definition:
  219. // CHECK:STDOUT:
  220. // CHECK:STDOUT: class {
  221. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  222. // CHECK:STDOUT:
  223. // CHECK:STDOUT: !members:
  224. // CHECK:STDOUT: .Self = constants.%Inner.1
  225. // CHECK:STDOUT: complete_type_witness = %complete_type
  226. // CHECK:STDOUT: }
  227. // CHECK:STDOUT: }
  228. // CHECK:STDOUT:
  229. // CHECK:STDOUT: fn @__global_init() {
  230. // CHECK:STDOUT: !entry:
  231. // CHECK:STDOUT: %v.ref: ref %Outer.2 = name_ref v, file.%v
  232. // CHECK:STDOUT: %.loc19: %Inner.2 = converted %v.ref, <error> [template = <error>]
  233. // CHECK:STDOUT: assign file.%w.var, <error>
  234. // CHECK:STDOUT: return
  235. // CHECK:STDOUT: }
  236. // CHECK:STDOUT:
  237. // CHECK:STDOUT: specific @Outer(constants.%T) {
  238. // CHECK:STDOUT: %T.loc4_13.2 => constants.%T
  239. // CHECK:STDOUT: %T.patt.loc4_13.2 => constants.%T
  240. // CHECK:STDOUT: }
  241. // CHECK:STDOUT:
  242. // CHECK:STDOUT: specific @Inner(constants.%T, constants.%U) {
  243. // CHECK:STDOUT: %U.loc5_15.2 => constants.%U
  244. // CHECK:STDOUT: %U.patt.loc5_15.2 => constants.%U
  245. // CHECK:STDOUT: }
  246. // CHECK:STDOUT:
  247. // CHECK:STDOUT: specific @Outer(%T.loc4_13.2) {
  248. // CHECK:STDOUT: %T.loc4_13.2 => constants.%T
  249. // CHECK:STDOUT: %T.patt.loc4_13.2 => constants.%T
  250. // CHECK:STDOUT: }
  251. // CHECK:STDOUT:
  252. // CHECK:STDOUT: specific @Outer(constants.%ptr.1) {
  253. // CHECK:STDOUT: %T.loc4_13.2 => constants.%ptr.1
  254. // CHECK:STDOUT: %T.patt.loc4_13.2 => constants.%ptr.1
  255. // CHECK:STDOUT:
  256. // CHECK:STDOUT: !definition:
  257. // CHECK:STDOUT: %Inner.type => constants.%Inner.type.2
  258. // CHECK:STDOUT: %Inner.generic => constants.%Inner.generic.2
  259. // CHECK:STDOUT: }
  260. // CHECK:STDOUT:
  261. // CHECK:STDOUT: specific @Inner(constants.%ptr.1, constants.%ptr.2) {
  262. // CHECK:STDOUT: %U.loc5_15.2 => constants.%ptr.2
  263. // CHECK:STDOUT: %U.patt.loc5_15.2 => constants.%ptr.2
  264. // CHECK:STDOUT:
  265. // CHECK:STDOUT: !definition:
  266. // CHECK:STDOUT: }
  267. // CHECK:STDOUT:
  268. // CHECK:STDOUT: --- fail_int_value.carbon
  269. // CHECK:STDOUT:
  270. // CHECK:STDOUT: constants {
  271. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  272. // CHECK:STDOUT: %Int.type: type = fn_type @Int [template]
  273. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  274. // CHECK:STDOUT: %Int: %Int.type = struct_value () [template]
  275. // CHECK:STDOUT: %i32: type = int_type signed, %int_32 [template]
  276. // CHECK:STDOUT: %N.1: %i32 = bind_symbolic_name N, 0 [symbolic]
  277. // CHECK:STDOUT: %N.patt.1: %i32 = symbolic_binding_pattern N, 0 [symbolic]
  278. // CHECK:STDOUT: %C.type: type = generic_class_type @C [template]
  279. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [template]
  280. // CHECK:STDOUT: %C.1: type = class_type @C, @C(%N.1) [symbolic]
  281. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  282. // CHECK:STDOUT: %complete_type.1: <witness> = complete_type_witness %empty_struct_type [template]
  283. // CHECK:STDOUT: %int_123.1: Core.IntLiteral = int_value 123 [template]
  284. // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template]
  285. // CHECK:STDOUT: %Convert.type.14: type = fn_type @Convert.2, @impl.1(%int_32) [template]
  286. // CHECK:STDOUT: %Convert.14: %Convert.type.14 = struct_value () [template]
  287. // CHECK:STDOUT: %interface.9: <witness> = interface_witness (%Convert.14) [template]
  288. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_123.1, %Convert.14 [template]
  289. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.bound, @Convert.2(%int_32) [template]
  290. // CHECK:STDOUT: %int_123.2: %i32 = int_value 123 [template]
  291. // CHECK:STDOUT: %C.2: type = class_type @C, @C(%int_123.2) [template]
  292. // CHECK:STDOUT: }
  293. // CHECK:STDOUT:
  294. // CHECK:STDOUT: imports {
  295. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  296. // CHECK:STDOUT: .Int = %import_ref.1
  297. // CHECK:STDOUT: .ImplicitAs = %import_ref.2
  298. // CHECK:STDOUT: import Core//prelude
  299. // CHECK:STDOUT: import Core//prelude/...
  300. // CHECK:STDOUT: }
  301. // CHECK:STDOUT: }
  302. // CHECK:STDOUT:
  303. // CHECK:STDOUT: file {
  304. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  305. // CHECK:STDOUT: .Core = imports.%Core
  306. // CHECK:STDOUT: .C = %C.decl
  307. // CHECK:STDOUT: .v = %v
  308. // CHECK:STDOUT: }
  309. // CHECK:STDOUT: %Core.import = import Core
  310. // CHECK:STDOUT: %C.decl: %C.type = class_decl @C [template = constants.%C.generic] {
  311. // CHECK:STDOUT: %N.patt.loc4_9.1: %i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc4_9.2 (constants.%N.patt.1)]
  312. // CHECK:STDOUT: %N.param_patt: %i32 = value_param_pattern %N.patt.loc4_9.1, runtime_param<invalid> [symbolic = %N.patt.loc4_9.2 (constants.%N.patt.1)]
  313. // CHECK:STDOUT: } {
  314. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  315. // CHECK:STDOUT: %int.make_type_signed: init type = call constants.%Int(%int_32) [template = constants.%i32]
  316. // CHECK:STDOUT: %.loc4_13.1: type = value_of_initializer %int.make_type_signed [template = constants.%i32]
  317. // CHECK:STDOUT: %.loc4_13.2: type = converted %int.make_type_signed, %.loc4_13.1 [template = constants.%i32]
  318. // CHECK:STDOUT: %N.param: %i32 = value_param runtime_param<invalid>
  319. // CHECK:STDOUT: %N.loc4_9.1: %i32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc4_9.2 (constants.%N.1)]
  320. // CHECK:STDOUT: }
  321. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, %C.decl [template = constants.%C.generic]
  322. // CHECK:STDOUT: %int_123: Core.IntLiteral = int_value 123 [template = constants.%int_123.1]
  323. // CHECK:STDOUT: %impl.elem0: %Convert.type.2 = interface_witness_access constants.%interface.9, element0 [template = constants.%Convert.14]
  324. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_123, %impl.elem0 [template = constants.%Convert.bound]
  325. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.bound, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn]
  326. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %Convert.specific_fn(%int_123) [template = constants.%int_123.2]
  327. // CHECK:STDOUT: %.loc12_13.1: %i32 = value_of_initializer %int.convert_checked [template = constants.%int_123.2]
  328. // CHECK:STDOUT: %.loc12_13.2: %i32 = converted %int_123, %.loc12_13.1 [template = constants.%int_123.2]
  329. // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%int_123.2) [template = constants.%C.2]
  330. // CHECK:STDOUT: %v.var: ref %C.2 = var v
  331. // CHECK:STDOUT: %v: ref %C.2 = bind_name v, %v.var
  332. // CHECK:STDOUT: }
  333. // CHECK:STDOUT:
  334. // CHECK:STDOUT: generic class @C(%N.loc4_9.1: %i32) {
  335. // CHECK:STDOUT: %N.loc4_9.2: %i32 = bind_symbolic_name N, 0 [symbolic = %N.loc4_9.2 (constants.%N.1)]
  336. // CHECK:STDOUT: %N.patt.loc4_9.2: %i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc4_9.2 (constants.%N.patt.1)]
  337. // CHECK:STDOUT:
  338. // CHECK:STDOUT: !definition:
  339. // CHECK:STDOUT:
  340. // CHECK:STDOUT: class {
  341. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type.1]
  342. // CHECK:STDOUT:
  343. // CHECK:STDOUT: !members:
  344. // CHECK:STDOUT: .Self = constants.%C.1
  345. // CHECK:STDOUT: complete_type_witness = %complete_type
  346. // CHECK:STDOUT: }
  347. // CHECK:STDOUT: }
  348. // CHECK:STDOUT:
  349. // CHECK:STDOUT: fn @__global_init() {
  350. // CHECK:STDOUT: !entry:
  351. // CHECK:STDOUT: %.loc12_18: %empty_tuple.type = tuple_literal ()
  352. // CHECK:STDOUT: %.loc12_19: %C.2 = converted %.loc12_18, <error> [template = <error>]
  353. // CHECK:STDOUT: assign file.%v.var, <error>
  354. // CHECK:STDOUT: return
  355. // CHECK:STDOUT: }
  356. // CHECK:STDOUT:
  357. // CHECK:STDOUT: specific @C(constants.%N.1) {
  358. // CHECK:STDOUT: %N.loc4_9.2 => constants.%N.1
  359. // CHECK:STDOUT: %N.patt.loc4_9.2 => constants.%N.1
  360. // CHECK:STDOUT: }
  361. // CHECK:STDOUT:
  362. // CHECK:STDOUT: specific @C(constants.%int_123.2) {
  363. // CHECK:STDOUT: %N.loc4_9.2 => constants.%int_123.2
  364. // CHECK:STDOUT: %N.patt.loc4_9.2 => constants.%int_123.2
  365. // CHECK:STDOUT:
  366. // CHECK:STDOUT: !definition:
  367. // CHECK:STDOUT: }
  368. // CHECK:STDOUT: