import.carbon 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  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/struct/import.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/import.carbon
  10. // --- implicit.carbon
  11. package Implicit;
  12. var a_ref: {.a: i32} = {.a = 0};
  13. var b_ref: {.a: {.b: i32, .c: (i32,)}, .d: i32} =
  14. {.a = {.b = 0, .c = (0,)}, .d = 0};
  15. class C(S:! {.a: i32, .b: i32}) {}
  16. fn F() -> C({.a = 1, .b = 2});
  17. // --- implicit.impl.carbon
  18. impl package Implicit;
  19. var a: {.a: i32} = a_ref;
  20. var b: {.a: {.b: i32, .c: (i32,)}, .d: i32} = b_ref;
  21. var c: C({.a = 1, .b = 2}) = F();
  22. // --- fail_bad_type.impl.carbon
  23. impl package Implicit;
  24. // CHECK:STDERR: fail_bad_type.impl.carbon:[[@LINE+8]]:14: error: missing value for field `a` in struct initialization [StructInitMissingFieldInLiteral]
  25. // CHECK:STDERR: var c_bad: C({.c = 1, .d = 2}) = F();
  26. // CHECK:STDERR: ^~~~~~~~~~~~~~~~
  27. // CHECK:STDERR: fail_bad_type.impl.carbon:[[@LINE-4]]:1: in import [InImport]
  28. // CHECK:STDERR: implicit.carbon:8:9: note: initializing generic parameter `S` declared here [InitializingGenericParam]
  29. // CHECK:STDERR: class C(S:! {.a: i32, .b: i32}) {}
  30. // CHECK:STDERR: ^
  31. // CHECK:STDERR:
  32. var c_bad: C({.c = 1, .d = 2}) = F();
  33. // --- fail_bad_value.impl.carbon
  34. impl package Implicit;
  35. // CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+7]]:1: error: cannot implicitly convert expression of type `C({.a = 1, .b = 2})` to `C({.a = 3, .b = 4})` [ConversionFailure]
  36. // CHECK:STDERR: var c_bad: C({.a = 3, .b = 4}) = F();
  37. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  38. // CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+4]]:1: note: type `C({.a = 1, .b = 2})` does not implement interface `Core.ImplicitAs(C({.a = 3, .b = 4}))` [MissingImplInMemberAccessNote]
  39. // CHECK:STDERR: var c_bad: C({.a = 3, .b = 4}) = F();
  40. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  41. // CHECK:STDERR:
  42. var c_bad: C({.a = 3, .b = 4}) = F();
  43. // CHECK:STDOUT: --- implicit.carbon
  44. // CHECK:STDOUT:
  45. // CHECK:STDOUT: constants {
  46. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  47. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  48. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  49. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  50. // CHECK:STDOUT: %struct_type.a.ba9: type = struct_type {.a: %i32} [concrete]
  51. // CHECK:STDOUT: %pattern_type.268: type = pattern_type %struct_type.a.ba9 [concrete]
  52. // CHECK:STDOUT: %int_0.5c6: Core.IntLiteral = int_value 0 [concrete]
  53. // CHECK:STDOUT: %struct_type.a.a6c: type = struct_type {.a: Core.IntLiteral} [concrete]
  54. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  55. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  56. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  57. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  58. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  59. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  60. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  61. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  62. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  63. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  64. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  65. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  66. // CHECK:STDOUT: %Convert.bound.d04: <bound method> = bound_method %int_0.5c6, %Convert.956 [concrete]
  67. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  68. // CHECK:STDOUT: %bound_method.b6e: <bound method> = bound_method %int_0.5c6, %Convert.specific_fn [concrete]
  69. // CHECK:STDOUT: %int_0.6a9: %i32 = int_value 0 [concrete]
  70. // CHECK:STDOUT: %struct.92d: %struct_type.a.ba9 = struct_value (%int_0.6a9) [concrete]
  71. // CHECK:STDOUT: %tuple.type.85c: type = tuple_type (type) [concrete]
  72. // CHECK:STDOUT: %tuple.type.a1c: type = tuple_type (%i32) [concrete]
  73. // CHECK:STDOUT: %struct_type.b.c.929: type = struct_type {.b: %i32, .c: %tuple.type.a1c} [concrete]
  74. // CHECK:STDOUT: %struct_type.a.d.3d9: type = struct_type {.a: %struct_type.b.c.929, .d: %i32} [concrete]
  75. // CHECK:STDOUT: %pattern_type.665: type = pattern_type %struct_type.a.d.3d9 [concrete]
  76. // CHECK:STDOUT: %tuple.type.985: type = tuple_type (Core.IntLiteral) [concrete]
  77. // CHECK:STDOUT: %struct_type.b.c.9af: type = struct_type {.b: Core.IntLiteral, .c: %tuple.type.985} [concrete]
  78. // CHECK:STDOUT: %struct_type.a.d.b82: type = struct_type {.a: %struct_type.b.c.9af, .d: Core.IntLiteral} [concrete]
  79. // CHECK:STDOUT: %.042: ref %struct_type.b.c.929 = struct_access file.%b_ref.var, element0 [concrete]
  80. // CHECK:STDOUT: %.643: ref %i32 = struct_access %.042, element0 [concrete]
  81. // CHECK:STDOUT: %.66d: ref %tuple.type.a1c = struct_access %.042, element1 [concrete]
  82. // CHECK:STDOUT: %tuple: %tuple.type.a1c = tuple_value (%int_0.6a9) [concrete]
  83. // CHECK:STDOUT: %struct.381: %struct_type.b.c.929 = struct_value (%int_0.6a9, %tuple) [concrete]
  84. // CHECK:STDOUT: %.c6b: ref %i32 = struct_access file.%b_ref.var, element1 [concrete]
  85. // CHECK:STDOUT: %struct.20d: %struct_type.a.d.3d9 = struct_value (%struct.381, %int_0.6a9) [concrete]
  86. // CHECK:STDOUT: %struct_type.a.b.501: type = struct_type {.a: %i32, .b: %i32} [concrete]
  87. // CHECK:STDOUT: %S: %struct_type.a.b.501 = bind_symbolic_name S, 0 [symbolic]
  88. // CHECK:STDOUT: %pattern_type.851: type = pattern_type %struct_type.a.b.501 [concrete]
  89. // CHECK:STDOUT: %C.type: type = generic_class_type @C [concrete]
  90. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [concrete]
  91. // CHECK:STDOUT: %C.775: type = class_type @C, @C(%S) [symbolic]
  92. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  93. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  94. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  95. // CHECK:STDOUT: %int_2.ecc: Core.IntLiteral = int_value 2 [concrete]
  96. // CHECK:STDOUT: %struct_type.a.b.cfd: type = struct_type {.a: Core.IntLiteral, .b: Core.IntLiteral} [concrete]
  97. // CHECK:STDOUT: %Convert.bound.ab5: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  98. // CHECK:STDOUT: %bound_method.9a1: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  99. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  100. // CHECK:STDOUT: %Convert.bound.ef9: <bound method> = bound_method %int_2.ecc, %Convert.956 [concrete]
  101. // CHECK:STDOUT: %bound_method.b92: <bound method> = bound_method %int_2.ecc, %Convert.specific_fn [concrete]
  102. // CHECK:STDOUT: %int_2.ef8: %i32 = int_value 2 [concrete]
  103. // CHECK:STDOUT: %struct.ed5: %struct_type.a.b.501 = struct_value (%int_1.5d2, %int_2.ef8) [concrete]
  104. // CHECK:STDOUT: %C.c8f: type = class_type @C, @C(%struct.ed5) [concrete]
  105. // CHECK:STDOUT: %pattern_type.4f9: type = pattern_type %C.c8f [concrete]
  106. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  107. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  108. // CHECK:STDOUT: }
  109. // CHECK:STDOUT:
  110. // CHECK:STDOUT: imports {
  111. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  112. // CHECK:STDOUT: .Int = %Core.Int
  113. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  114. // CHECK:STDOUT: import Core//prelude
  115. // CHECK:STDOUT: import Core//prelude/...
  116. // CHECK:STDOUT: }
  117. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  118. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  119. // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
  120. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  121. // CHECK:STDOUT: }
  122. // CHECK:STDOUT:
  123. // CHECK:STDOUT: file {
  124. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  125. // CHECK:STDOUT: .Core = imports.%Core
  126. // CHECK:STDOUT: .a_ref = %a_ref
  127. // CHECK:STDOUT: .b_ref = %b_ref
  128. // CHECK:STDOUT: .C = %C.decl
  129. // CHECK:STDOUT: .F = %F.decl
  130. // CHECK:STDOUT: }
  131. // CHECK:STDOUT: %Core.import = import Core
  132. // CHECK:STDOUT: name_binding_decl {
  133. // CHECK:STDOUT: %a_ref.patt: %pattern_type.268 = binding_pattern a_ref [concrete]
  134. // CHECK:STDOUT: %a_ref.var_patt: %pattern_type.268 = var_pattern %a_ref.patt [concrete]
  135. // CHECK:STDOUT: }
  136. // CHECK:STDOUT: %a_ref.var: ref %struct_type.a.ba9 = var %a_ref.var_patt [concrete]
  137. // CHECK:STDOUT: %.loc4: type = splice_block %struct_type.a [concrete = constants.%struct_type.a.ba9] {
  138. // CHECK:STDOUT: %int_32.loc4: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  139. // CHECK:STDOUT: %i32.loc4: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  140. // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a.ba9]
  141. // CHECK:STDOUT: }
  142. // CHECK:STDOUT: %a_ref: ref %struct_type.a.ba9 = bind_name a_ref, %a_ref.var
  143. // CHECK:STDOUT: name_binding_decl {
  144. // CHECK:STDOUT: %b_ref.patt: %pattern_type.665 = binding_pattern b_ref [concrete]
  145. // CHECK:STDOUT: %b_ref.var_patt: %pattern_type.665 = var_pattern %b_ref.patt [concrete]
  146. // CHECK:STDOUT: }
  147. // CHECK:STDOUT: %b_ref.var: ref %struct_type.a.d.3d9 = var %b_ref.var_patt [concrete]
  148. // CHECK:STDOUT: %.loc5_47: type = splice_block %struct_type.a.d [concrete = constants.%struct_type.a.d.3d9] {
  149. // CHECK:STDOUT: %int_32.loc5_22: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  150. // CHECK:STDOUT: %i32.loc5_22: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  151. // CHECK:STDOUT: %int_32.loc5_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  152. // CHECK:STDOUT: %i32.loc5_32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  153. // CHECK:STDOUT: %.loc5_36.1: %tuple.type.85c = tuple_literal (%i32.loc5_32)
  154. // CHECK:STDOUT: %.loc5_36.2: type = converted %.loc5_36.1, constants.%tuple.type.a1c [concrete = constants.%tuple.type.a1c]
  155. // CHECK:STDOUT: %struct_type.b.c: type = struct_type {.b: %i32, .c: %tuple.type.a1c} [concrete = constants.%struct_type.b.c.929]
  156. // CHECK:STDOUT: %int_32.loc5_44: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  157. // CHECK:STDOUT: %i32.loc5_44: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  158. // CHECK:STDOUT: %struct_type.a.d: type = struct_type {.a: %struct_type.b.c.929, .d: %i32} [concrete = constants.%struct_type.a.d.3d9]
  159. // CHECK:STDOUT: }
  160. // CHECK:STDOUT: %b_ref: ref %struct_type.a.d.3d9 = bind_name b_ref, %b_ref.var
  161. // CHECK:STDOUT: %C.decl: %C.type = class_decl @C [concrete = constants.%C.generic] {
  162. // CHECK:STDOUT: %S.patt: %pattern_type.851 = symbolic_binding_pattern S, 0 [concrete]
  163. // CHECK:STDOUT: } {
  164. // CHECK:STDOUT: %.loc8: type = splice_block %struct_type.a.b [concrete = constants.%struct_type.a.b.501] {
  165. // CHECK:STDOUT: %int_32.loc8_18: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  166. // CHECK:STDOUT: %i32.loc8_18: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  167. // CHECK:STDOUT: %int_32.loc8_27: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  168. // CHECK:STDOUT: %i32.loc8_27: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  169. // CHECK:STDOUT: %struct_type.a.b: type = struct_type {.a: %i32, .b: %i32} [concrete = constants.%struct_type.a.b.501]
  170. // CHECK:STDOUT: }
  171. // CHECK:STDOUT: %S.loc8_9.1: %struct_type.a.b.501 = bind_symbolic_name S, 0 [symbolic = %S.loc8_9.2 (constants.%S)]
  172. // CHECK:STDOUT: }
  173. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  174. // CHECK:STDOUT: %return.patt: %pattern_type.4f9 = return_slot_pattern [concrete]
  175. // CHECK:STDOUT: %return.param_patt: %pattern_type.4f9 = out_param_pattern %return.patt, call_param0 [concrete]
  176. // CHECK:STDOUT: } {
  177. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [concrete = constants.%C.generic]
  178. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  179. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc]
  180. // CHECK:STDOUT: %.loc9_28.1: %struct_type.a.b.cfd = struct_literal (%int_1, %int_2)
  181. // CHECK:STDOUT: %impl.elem0.loc9_28.1: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  182. // CHECK:STDOUT: %bound_method.loc9_28.1: <bound method> = bound_method %int_1, %impl.elem0.loc9_28.1 [concrete = constants.%Convert.bound.ab5]
  183. // CHECK:STDOUT: %specific_fn.loc9_28.1: <specific function> = specific_function %impl.elem0.loc9_28.1, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  184. // CHECK:STDOUT: %bound_method.loc9_28.2: <bound method> = bound_method %int_1, %specific_fn.loc9_28.1 [concrete = constants.%bound_method.9a1]
  185. // CHECK:STDOUT: %int.convert_checked.loc9_28.1: init %i32 = call %bound_method.loc9_28.2(%int_1) [concrete = constants.%int_1.5d2]
  186. // CHECK:STDOUT: %.loc9_28.2: %i32 = value_of_initializer %int.convert_checked.loc9_28.1 [concrete = constants.%int_1.5d2]
  187. // CHECK:STDOUT: %.loc9_28.3: %i32 = converted %int_1, %.loc9_28.2 [concrete = constants.%int_1.5d2]
  188. // CHECK:STDOUT: %impl.elem0.loc9_28.2: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  189. // CHECK:STDOUT: %bound_method.loc9_28.3: <bound method> = bound_method %int_2, %impl.elem0.loc9_28.2 [concrete = constants.%Convert.bound.ef9]
  190. // CHECK:STDOUT: %specific_fn.loc9_28.2: <specific function> = specific_function %impl.elem0.loc9_28.2, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  191. // CHECK:STDOUT: %bound_method.loc9_28.4: <bound method> = bound_method %int_2, %specific_fn.loc9_28.2 [concrete = constants.%bound_method.b92]
  192. // CHECK:STDOUT: %int.convert_checked.loc9_28.2: init %i32 = call %bound_method.loc9_28.4(%int_2) [concrete = constants.%int_2.ef8]
  193. // CHECK:STDOUT: %.loc9_28.4: %i32 = value_of_initializer %int.convert_checked.loc9_28.2 [concrete = constants.%int_2.ef8]
  194. // CHECK:STDOUT: %.loc9_28.5: %i32 = converted %int_2, %.loc9_28.4 [concrete = constants.%int_2.ef8]
  195. // CHECK:STDOUT: %struct: %struct_type.a.b.501 = struct_value (%.loc9_28.3, %.loc9_28.5) [concrete = constants.%struct.ed5]
  196. // CHECK:STDOUT: %.loc9_29: %struct_type.a.b.501 = converted %.loc9_28.1, %struct [concrete = constants.%struct.ed5]
  197. // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%struct.ed5) [concrete = constants.%C.c8f]
  198. // CHECK:STDOUT: %return.param: ref %C.c8f = out_param call_param0
  199. // CHECK:STDOUT: %return: ref %C.c8f = return_slot %return.param
  200. // CHECK:STDOUT: }
  201. // CHECK:STDOUT: }
  202. // CHECK:STDOUT:
  203. // CHECK:STDOUT: generic class @C(%S.loc8_9.1: %struct_type.a.b.501) {
  204. // CHECK:STDOUT: %S.loc8_9.2: %struct_type.a.b.501 = bind_symbolic_name S, 0 [symbolic = %S.loc8_9.2 (constants.%S)]
  205. // CHECK:STDOUT:
  206. // CHECK:STDOUT: !definition:
  207. // CHECK:STDOUT:
  208. // CHECK:STDOUT: class {
  209. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  210. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357]
  211. // CHECK:STDOUT: complete_type_witness = %complete_type
  212. // CHECK:STDOUT:
  213. // CHECK:STDOUT: !members:
  214. // CHECK:STDOUT: .Self = constants.%C.775
  215. // CHECK:STDOUT: }
  216. // CHECK:STDOUT: }
  217. // CHECK:STDOUT:
  218. // CHECK:STDOUT: fn @F() -> %C.c8f;
  219. // CHECK:STDOUT:
  220. // CHECK:STDOUT: fn @__global_init() {
  221. // CHECK:STDOUT: !entry:
  222. // CHECK:STDOUT: %int_0.loc4: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
  223. // CHECK:STDOUT: %.loc4_31.1: %struct_type.a.a6c = struct_literal (%int_0.loc4)
  224. // CHECK:STDOUT: %impl.elem0.loc4: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  225. // CHECK:STDOUT: %bound_method.loc4_31.1: <bound method> = bound_method %int_0.loc4, %impl.elem0.loc4 [concrete = constants.%Convert.bound.d04]
  226. // CHECK:STDOUT: %specific_fn.loc4: <specific function> = specific_function %impl.elem0.loc4, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  227. // CHECK:STDOUT: %bound_method.loc4_31.2: <bound method> = bound_method %int_0.loc4, %specific_fn.loc4 [concrete = constants.%bound_method.b6e]
  228. // CHECK:STDOUT: %int.convert_checked.loc4: init %i32 = call %bound_method.loc4_31.2(%int_0.loc4) [concrete = constants.%int_0.6a9]
  229. // CHECK:STDOUT: %.loc4_31.2: init %i32 = converted %int_0.loc4, %int.convert_checked.loc4 [concrete = constants.%int_0.6a9]
  230. // CHECK:STDOUT: %.loc4_31.3: init %struct_type.a.ba9 = struct_init (%.loc4_31.2) to file.%a_ref.var [concrete = constants.%struct.92d]
  231. // CHECK:STDOUT: %.loc4_1: init %struct_type.a.ba9 = converted %.loc4_31.1, %.loc4_31.3 [concrete = constants.%struct.92d]
  232. // CHECK:STDOUT: assign file.%a_ref.var, %.loc4_1
  233. // CHECK:STDOUT: %int_0.loc6_17: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
  234. // CHECK:STDOUT: %int_0.loc6_26: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
  235. // CHECK:STDOUT: %.loc6_28.1: %tuple.type.985 = tuple_literal (%int_0.loc6_26)
  236. // CHECK:STDOUT: %.loc6_29.1: %struct_type.b.c.9af = struct_literal (%int_0.loc6_17, %.loc6_28.1)
  237. // CHECK:STDOUT: %int_0.loc6_37: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
  238. // CHECK:STDOUT: %.loc6_38.1: %struct_type.a.d.b82 = struct_literal (%.loc6_29.1, %int_0.loc6_37)
  239. // CHECK:STDOUT: %impl.elem0.loc6_29: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  240. // CHECK:STDOUT: %bound_method.loc6_29.1: <bound method> = bound_method %int_0.loc6_17, %impl.elem0.loc6_29 [concrete = constants.%Convert.bound.d04]
  241. // CHECK:STDOUT: %specific_fn.loc6_29: <specific function> = specific_function %impl.elem0.loc6_29, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  242. // CHECK:STDOUT: %bound_method.loc6_29.2: <bound method> = bound_method %int_0.loc6_17, %specific_fn.loc6_29 [concrete = constants.%bound_method.b6e]
  243. // CHECK:STDOUT: %int.convert_checked.loc6_29: init %i32 = call %bound_method.loc6_29.2(%int_0.loc6_17) [concrete = constants.%int_0.6a9]
  244. // CHECK:STDOUT: %.loc6_29.2: init %i32 = converted %int_0.loc6_17, %int.convert_checked.loc6_29 [concrete = constants.%int_0.6a9]
  245. // CHECK:STDOUT: %.loc6_38.2: ref %struct_type.b.c.929 = struct_access file.%b_ref.var, element0 [concrete = constants.%.042]
  246. // CHECK:STDOUT: %.loc6_29.3: ref %i32 = struct_access %.loc6_38.2, element0 [concrete = constants.%.643]
  247. // CHECK:STDOUT: %.loc6_29.4: init %i32 = initialize_from %.loc6_29.2 to %.loc6_29.3 [concrete = constants.%int_0.6a9]
  248. // CHECK:STDOUT: %impl.elem0.loc6_28: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  249. // CHECK:STDOUT: %bound_method.loc6_28.1: <bound method> = bound_method %int_0.loc6_26, %impl.elem0.loc6_28 [concrete = constants.%Convert.bound.d04]
  250. // CHECK:STDOUT: %specific_fn.loc6_28: <specific function> = specific_function %impl.elem0.loc6_28, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  251. // CHECK:STDOUT: %bound_method.loc6_28.2: <bound method> = bound_method %int_0.loc6_26, %specific_fn.loc6_28 [concrete = constants.%bound_method.b6e]
  252. // CHECK:STDOUT: %int.convert_checked.loc6_28: init %i32 = call %bound_method.loc6_28.2(%int_0.loc6_26) [concrete = constants.%int_0.6a9]
  253. // CHECK:STDOUT: %.loc6_28.2: init %i32 = converted %int_0.loc6_26, %int.convert_checked.loc6_28 [concrete = constants.%int_0.6a9]
  254. // CHECK:STDOUT: %.loc6_29.5: ref %tuple.type.a1c = struct_access %.loc6_38.2, element1 [concrete = constants.%.66d]
  255. // CHECK:STDOUT: %.loc6_28.3: init %tuple.type.a1c = tuple_init (%.loc6_28.2) to %.loc6_29.5 [concrete = constants.%tuple]
  256. // CHECK:STDOUT: %.loc6_29.6: init %tuple.type.a1c = converted %.loc6_28.1, %.loc6_28.3 [concrete = constants.%tuple]
  257. // CHECK:STDOUT: %.loc6_29.7: init %tuple.type.a1c = initialize_from %.loc6_29.6 to %.loc6_29.5 [concrete = constants.%tuple]
  258. // CHECK:STDOUT: %.loc6_29.8: init %struct_type.b.c.929 = struct_init (%.loc6_29.4, %.loc6_29.7) to %.loc6_38.2 [concrete = constants.%struct.381]
  259. // CHECK:STDOUT: %.loc6_38.3: init %struct_type.b.c.929 = converted %.loc6_29.1, %.loc6_29.8 [concrete = constants.%struct.381]
  260. // CHECK:STDOUT: %impl.elem0.loc6_38: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  261. // CHECK:STDOUT: %bound_method.loc6_38.1: <bound method> = bound_method %int_0.loc6_37, %impl.elem0.loc6_38 [concrete = constants.%Convert.bound.d04]
  262. // CHECK:STDOUT: %specific_fn.loc6_38: <specific function> = specific_function %impl.elem0.loc6_38, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  263. // CHECK:STDOUT: %bound_method.loc6_38.2: <bound method> = bound_method %int_0.loc6_37, %specific_fn.loc6_38 [concrete = constants.%bound_method.b6e]
  264. // CHECK:STDOUT: %int.convert_checked.loc6_38: init %i32 = call %bound_method.loc6_38.2(%int_0.loc6_37) [concrete = constants.%int_0.6a9]
  265. // CHECK:STDOUT: %.loc6_38.4: init %i32 = converted %int_0.loc6_37, %int.convert_checked.loc6_38 [concrete = constants.%int_0.6a9]
  266. // CHECK:STDOUT: %.loc6_38.5: ref %i32 = struct_access file.%b_ref.var, element1 [concrete = constants.%.c6b]
  267. // CHECK:STDOUT: %.loc6_38.6: init %i32 = initialize_from %.loc6_38.4 to %.loc6_38.5 [concrete = constants.%int_0.6a9]
  268. // CHECK:STDOUT: %.loc6_38.7: init %struct_type.a.d.3d9 = struct_init (%.loc6_38.3, %.loc6_38.6) to file.%b_ref.var [concrete = constants.%struct.20d]
  269. // CHECK:STDOUT: %.loc5: init %struct_type.a.d.3d9 = converted %.loc6_38.1, %.loc6_38.7 [concrete = constants.%struct.20d]
  270. // CHECK:STDOUT: assign file.%b_ref.var, %.loc5
  271. // CHECK:STDOUT: return
  272. // CHECK:STDOUT: }
  273. // CHECK:STDOUT:
  274. // CHECK:STDOUT: specific @C(constants.%S) {
  275. // CHECK:STDOUT: %S.loc8_9.2 => constants.%S
  276. // CHECK:STDOUT: }
  277. // CHECK:STDOUT:
  278. // CHECK:STDOUT: specific @C(constants.%struct.ed5) {
  279. // CHECK:STDOUT: %S.loc8_9.2 => constants.%struct.ed5
  280. // CHECK:STDOUT: }
  281. // CHECK:STDOUT:
  282. // CHECK:STDOUT: --- implicit.impl.carbon
  283. // CHECK:STDOUT:
  284. // CHECK:STDOUT: constants {
  285. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  286. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  287. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  288. // CHECK:STDOUT: %ImplicitAs.type.595: type = generic_interface_type @ImplicitAs [concrete]
  289. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.595 = struct_value () [concrete]
  290. // CHECK:STDOUT: %Convert.type.9a6: type = fn_type @Convert.2, @impl.a8d(%To.c80) [symbolic]
  291. // CHECK:STDOUT: %Convert.458: %Convert.type.9a6 = struct_value () [symbolic]
  292. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  293. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  294. // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [concrete]
  295. // CHECK:STDOUT: %pattern_type.b54: type = pattern_type %struct_type.a [concrete]
  296. // CHECK:STDOUT: %tuple.type.85c: type = tuple_type (type) [concrete]
  297. // CHECK:STDOUT: %tuple.type.dd4: type = tuple_type (%i32) [concrete]
  298. // CHECK:STDOUT: %struct_type.b.c: type = struct_type {.b: %i32, .c: %tuple.type.dd4} [concrete]
  299. // CHECK:STDOUT: %struct_type.a.d.9db: type = struct_type {.a: %struct_type.b.c, .d: %i32} [concrete]
  300. // CHECK:STDOUT: %pattern_type.020: type = pattern_type %struct_type.a.d.9db [concrete]
  301. // CHECK:STDOUT: %.92c: ref %struct_type.b.c = struct_access file.%b.var, element0 [concrete]
  302. // CHECK:STDOUT: %.9dd: ref %i32 = struct_access %.92c, element0 [concrete]
  303. // CHECK:STDOUT: %.bbf: ref %tuple.type.dd4 = struct_access %.92c, element1 [concrete]
  304. // CHECK:STDOUT: %.607: ref %i32 = struct_access file.%b.var, element1 [concrete]
  305. // CHECK:STDOUT: %C.type: type = generic_class_type @C [concrete]
  306. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [concrete]
  307. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  308. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  309. // CHECK:STDOUT: %struct_type.a.b.5ca: type = struct_type {.a: %i32, .b: %i32} [concrete]
  310. // CHECK:STDOUT: %S: %struct_type.a.b.5ca = bind_symbolic_name S, 0 [symbolic]
  311. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  312. // CHECK:STDOUT: %int_2.ecc: Core.IntLiteral = int_value 2 [concrete]
  313. // CHECK:STDOUT: %struct_type.a.b.cfd: type = struct_type {.a: Core.IntLiteral, .b: Core.IntLiteral} [concrete]
  314. // CHECK:STDOUT: %ImplicitAs.type.b9e: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  315. // CHECK:STDOUT: %Convert.type.ea0: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  316. // CHECK:STDOUT: %ImplicitAs.impl_witness.2ce: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.1ad, @impl.a8d(%int_32) [concrete]
  317. // CHECK:STDOUT: %Convert.type.e14: type = fn_type @Convert.2, @impl.a8d(%int_32) [concrete]
  318. // CHECK:STDOUT: %Convert.4cb: %Convert.type.e14 = struct_value () [concrete]
  319. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.b9e = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.2ce) [concrete]
  320. // CHECK:STDOUT: %.940: type = fn_type_with_self_type %Convert.type.ea0, %ImplicitAs.facet [concrete]
  321. // CHECK:STDOUT: %Convert.bound.dc5: <bound method> = bound_method %int_1.5b8, %Convert.4cb [concrete]
  322. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.4cb, @Convert.2(%int_32) [concrete]
  323. // CHECK:STDOUT: %bound_method.c37: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  324. // CHECK:STDOUT: %int_1.47b: %i32 = int_value 1 [concrete]
  325. // CHECK:STDOUT: %Convert.bound.30f: <bound method> = bound_method %int_2.ecc, %Convert.4cb [concrete]
  326. // CHECK:STDOUT: %bound_method.62b: <bound method> = bound_method %int_2.ecc, %Convert.specific_fn [concrete]
  327. // CHECK:STDOUT: %int_2.d0d: %i32 = int_value 2 [concrete]
  328. // CHECK:STDOUT: %struct: %struct_type.a.b.5ca = struct_value (%int_1.47b, %int_2.d0d) [concrete]
  329. // CHECK:STDOUT: %C.a8a: type = class_type @C, @C(%struct) [concrete]
  330. // CHECK:STDOUT: %pattern_type.a5a: type = pattern_type %C.a8a [concrete]
  331. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  332. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  333. // CHECK:STDOUT: }
  334. // CHECK:STDOUT:
  335. // CHECK:STDOUT: imports {
  336. // CHECK:STDOUT: %Implicit.a_ref: ref %struct_type.a = import_ref Implicit//default, a_ref, loaded
  337. // CHECK:STDOUT: %Implicit.b_ref: ref %struct_type.a.d.9db = import_ref Implicit//default, b_ref, loaded
  338. // CHECK:STDOUT: %Implicit.C: %C.type = import_ref Implicit//default, C, loaded [concrete = constants.%C.generic]
  339. // CHECK:STDOUT: %Implicit.F: %F.type = import_ref Implicit//default, F, loaded [concrete = constants.%F]
  340. // CHECK:STDOUT: %Core.ece: <namespace> = namespace file.%Core.import, [concrete] {
  341. // CHECK:STDOUT: .Int = %Core.Int
  342. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  343. // CHECK:STDOUT: import Core//prelude
  344. // CHECK:STDOUT: import Core//prelude/...
  345. // CHECK:STDOUT: }
  346. // CHECK:STDOUT: %Implicit.import_ref.773: @impl.a8d.%Convert.type (%Convert.type.9a6) = import_ref Implicit//default, inst117 [indirect], loaded [symbolic = @impl.a8d.%Convert (constants.%Convert.458)]
  347. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.1ad = impl_witness_table (%Implicit.import_ref.773), @impl.a8d [concrete]
  348. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  349. // CHECK:STDOUT: %Implicit.import_ref.c81: %struct_type.a.b.5ca = import_ref Implicit//default, loc8_9, loaded [symbolic = @C.%S (constants.%S)]
  350. // CHECK:STDOUT: %Implicit.import_ref.8f2: <witness> = import_ref Implicit//default, loc8_34, loaded [concrete = constants.%complete_type.357]
  351. // CHECK:STDOUT: %Implicit.import_ref.b8b = import_ref Implicit//default, inst1424 [no loc], unloaded
  352. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.595 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  353. // CHECK:STDOUT: }
  354. // CHECK:STDOUT:
  355. // CHECK:STDOUT: file {
  356. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  357. // CHECK:STDOUT: .a_ref = imports.%Implicit.a_ref
  358. // CHECK:STDOUT: .b_ref = imports.%Implicit.b_ref
  359. // CHECK:STDOUT: .C = imports.%Implicit.C
  360. // CHECK:STDOUT: .F = imports.%Implicit.F
  361. // CHECK:STDOUT: .Core = imports.%Core.ece
  362. // CHECK:STDOUT: .a = %a
  363. // CHECK:STDOUT: .b = %b
  364. // CHECK:STDOUT: .c = %c
  365. // CHECK:STDOUT: }
  366. // CHECK:STDOUT: %Implicit.import = import Implicit
  367. // CHECK:STDOUT: %default.import = import <none>
  368. // CHECK:STDOUT: %Core.import = import Core
  369. // CHECK:STDOUT: name_binding_decl {
  370. // CHECK:STDOUT: %a.patt: %pattern_type.b54 = binding_pattern a [concrete]
  371. // CHECK:STDOUT: %a.var_patt: %pattern_type.b54 = var_pattern %a.patt [concrete]
  372. // CHECK:STDOUT: }
  373. // CHECK:STDOUT: %a.var: ref %struct_type.a = var %a.var_patt [concrete]
  374. // CHECK:STDOUT: %.loc4: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] {
  375. // CHECK:STDOUT: %int_32.loc4: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  376. // CHECK:STDOUT: %i32.loc4: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  377. // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a]
  378. // CHECK:STDOUT: }
  379. // CHECK:STDOUT: %a: ref %struct_type.a = bind_name a, %a.var
  380. // CHECK:STDOUT: name_binding_decl {
  381. // CHECK:STDOUT: %b.patt: %pattern_type.020 = binding_pattern b [concrete]
  382. // CHECK:STDOUT: %b.var_patt: %pattern_type.020 = var_pattern %b.patt [concrete]
  383. // CHECK:STDOUT: }
  384. // CHECK:STDOUT: %b.var: ref %struct_type.a.d.9db = var %b.var_patt [concrete]
  385. // CHECK:STDOUT: %.loc5_43: type = splice_block %struct_type.a.d [concrete = constants.%struct_type.a.d.9db] {
  386. // CHECK:STDOUT: %int_32.loc5_18: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  387. // CHECK:STDOUT: %i32.loc5_18: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  388. // CHECK:STDOUT: %int_32.loc5_28: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  389. // CHECK:STDOUT: %i32.loc5_28: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  390. // CHECK:STDOUT: %.loc5_32.1: %tuple.type.85c = tuple_literal (%i32.loc5_28)
  391. // CHECK:STDOUT: %.loc5_32.2: type = converted %.loc5_32.1, constants.%tuple.type.dd4 [concrete = constants.%tuple.type.dd4]
  392. // CHECK:STDOUT: %struct_type.b.c: type = struct_type {.b: %i32, .c: %tuple.type.dd4} [concrete = constants.%struct_type.b.c]
  393. // CHECK:STDOUT: %int_32.loc5_40: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  394. // CHECK:STDOUT: %i32.loc5_40: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  395. // CHECK:STDOUT: %struct_type.a.d: type = struct_type {.a: %struct_type.b.c, .d: %i32} [concrete = constants.%struct_type.a.d.9db]
  396. // CHECK:STDOUT: }
  397. // CHECK:STDOUT: %b: ref %struct_type.a.d.9db = bind_name b, %b.var
  398. // CHECK:STDOUT: name_binding_decl {
  399. // CHECK:STDOUT: %c.patt: %pattern_type.a5a = binding_pattern c [concrete]
  400. // CHECK:STDOUT: %c.var_patt: %pattern_type.a5a = var_pattern %c.patt [concrete]
  401. // CHECK:STDOUT: }
  402. // CHECK:STDOUT: %c.var: ref %C.a8a = var %c.var_patt [concrete]
  403. // CHECK:STDOUT: %.loc6_26.1: type = splice_block %C [concrete = constants.%C.a8a] {
  404. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%Implicit.C [concrete = constants.%C.generic]
  405. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  406. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc]
  407. // CHECK:STDOUT: %.loc6_25.1: %struct_type.a.b.cfd = struct_literal (%int_1, %int_2)
  408. // CHECK:STDOUT: %impl.elem0.loc6_25.1: %.940 = impl_witness_access constants.%ImplicitAs.impl_witness.2ce, element0 [concrete = constants.%Convert.4cb]
  409. // CHECK:STDOUT: %bound_method.loc6_25.1: <bound method> = bound_method %int_1, %impl.elem0.loc6_25.1 [concrete = constants.%Convert.bound.dc5]
  410. // CHECK:STDOUT: %specific_fn.loc6_25.1: <specific function> = specific_function %impl.elem0.loc6_25.1, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  411. // CHECK:STDOUT: %bound_method.loc6_25.2: <bound method> = bound_method %int_1, %specific_fn.loc6_25.1 [concrete = constants.%bound_method.c37]
  412. // CHECK:STDOUT: %int.convert_checked.loc6_25.1: init %i32 = call %bound_method.loc6_25.2(%int_1) [concrete = constants.%int_1.47b]
  413. // CHECK:STDOUT: %.loc6_25.2: %i32 = value_of_initializer %int.convert_checked.loc6_25.1 [concrete = constants.%int_1.47b]
  414. // CHECK:STDOUT: %.loc6_25.3: %i32 = converted %int_1, %.loc6_25.2 [concrete = constants.%int_1.47b]
  415. // CHECK:STDOUT: %impl.elem0.loc6_25.2: %.940 = impl_witness_access constants.%ImplicitAs.impl_witness.2ce, element0 [concrete = constants.%Convert.4cb]
  416. // CHECK:STDOUT: %bound_method.loc6_25.3: <bound method> = bound_method %int_2, %impl.elem0.loc6_25.2 [concrete = constants.%Convert.bound.30f]
  417. // CHECK:STDOUT: %specific_fn.loc6_25.2: <specific function> = specific_function %impl.elem0.loc6_25.2, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  418. // CHECK:STDOUT: %bound_method.loc6_25.4: <bound method> = bound_method %int_2, %specific_fn.loc6_25.2 [concrete = constants.%bound_method.62b]
  419. // CHECK:STDOUT: %int.convert_checked.loc6_25.2: init %i32 = call %bound_method.loc6_25.4(%int_2) [concrete = constants.%int_2.d0d]
  420. // CHECK:STDOUT: %.loc6_25.4: %i32 = value_of_initializer %int.convert_checked.loc6_25.2 [concrete = constants.%int_2.d0d]
  421. // CHECK:STDOUT: %.loc6_25.5: %i32 = converted %int_2, %.loc6_25.4 [concrete = constants.%int_2.d0d]
  422. // CHECK:STDOUT: %struct: %struct_type.a.b.5ca = struct_value (%.loc6_25.3, %.loc6_25.5) [concrete = constants.%struct]
  423. // CHECK:STDOUT: %.loc6_26.2: %struct_type.a.b.5ca = converted %.loc6_25.1, %struct [concrete = constants.%struct]
  424. // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%struct) [concrete = constants.%C.a8a]
  425. // CHECK:STDOUT: }
  426. // CHECK:STDOUT: %c: ref %C.a8a = bind_name c, %c.var
  427. // CHECK:STDOUT: }
  428. // CHECK:STDOUT:
  429. // CHECK:STDOUT: generic class @C(imports.%Implicit.import_ref.c81: %struct_type.a.b.5ca) [from "implicit.carbon"] {
  430. // CHECK:STDOUT: %S: %struct_type.a.b.5ca = bind_symbolic_name S, 0 [symbolic = %S (constants.%S)]
  431. // CHECK:STDOUT:
  432. // CHECK:STDOUT: !definition:
  433. // CHECK:STDOUT:
  434. // CHECK:STDOUT: class {
  435. // CHECK:STDOUT: complete_type_witness = imports.%Implicit.import_ref.8f2
  436. // CHECK:STDOUT:
  437. // CHECK:STDOUT: !members:
  438. // CHECK:STDOUT: .Self = imports.%Implicit.import_ref.b8b
  439. // CHECK:STDOUT: }
  440. // CHECK:STDOUT: }
  441. // CHECK:STDOUT:
  442. // CHECK:STDOUT: fn @F [from "implicit.carbon"];
  443. // CHECK:STDOUT:
  444. // CHECK:STDOUT: fn @__global_init() {
  445. // CHECK:STDOUT: !entry:
  446. // CHECK:STDOUT: %a_ref.ref: ref %struct_type.a = name_ref a_ref, imports.%Implicit.a_ref
  447. // CHECK:STDOUT: %.loc4_20.1: ref %i32 = struct_access %a_ref.ref, element0
  448. // CHECK:STDOUT: %.loc4_20.2: %i32 = bind_value %.loc4_20.1
  449. // CHECK:STDOUT: %.loc4_20.3: init %struct_type.a = struct_init (%.loc4_20.2) to file.%a.var
  450. // CHECK:STDOUT: %.loc4_1: init %struct_type.a = converted %a_ref.ref, %.loc4_20.3
  451. // CHECK:STDOUT: assign file.%a.var, %.loc4_1
  452. // CHECK:STDOUT: %b_ref.ref: ref %struct_type.a.d.9db = name_ref b_ref, imports.%Implicit.b_ref
  453. // CHECK:STDOUT: %.loc5_47.1: ref %struct_type.b.c = struct_access %b_ref.ref, element0
  454. // CHECK:STDOUT: %.loc5_47.2: ref %i32 = struct_access %.loc5_47.1, element0
  455. // CHECK:STDOUT: %.loc5_47.3: %i32 = bind_value %.loc5_47.2
  456. // CHECK:STDOUT: %.loc5_47.4: ref %struct_type.b.c = struct_access file.%b.var, element0 [concrete = constants.%.92c]
  457. // CHECK:STDOUT: %.loc5_47.5: ref %i32 = struct_access %.loc5_47.4, element0 [concrete = constants.%.9dd]
  458. // CHECK:STDOUT: %.loc5_47.6: init %i32 = initialize_from %.loc5_47.3 to %.loc5_47.5
  459. // CHECK:STDOUT: %.loc5_47.7: ref %tuple.type.dd4 = struct_access %.loc5_47.1, element1
  460. // CHECK:STDOUT: %tuple.elem0: ref %i32 = tuple_access %.loc5_47.7, element0
  461. // CHECK:STDOUT: %.loc5_47.8: %i32 = bind_value %tuple.elem0
  462. // CHECK:STDOUT: %.loc5_47.9: ref %tuple.type.dd4 = struct_access %.loc5_47.4, element1 [concrete = constants.%.bbf]
  463. // CHECK:STDOUT: %.loc5_47.10: init %tuple.type.dd4 = tuple_init (%.loc5_47.8) to %.loc5_47.9
  464. // CHECK:STDOUT: %.loc5_47.11: init %tuple.type.dd4 = converted %.loc5_47.7, %.loc5_47.10
  465. // CHECK:STDOUT: %.loc5_47.12: init %tuple.type.dd4 = initialize_from %.loc5_47.11 to %.loc5_47.9
  466. // CHECK:STDOUT: %.loc5_47.13: init %struct_type.b.c = struct_init (%.loc5_47.6, %.loc5_47.12) to %.loc5_47.4
  467. // CHECK:STDOUT: %.loc5_47.14: init %struct_type.b.c = converted %.loc5_47.1, %.loc5_47.13
  468. // CHECK:STDOUT: %.loc5_47.15: ref %i32 = struct_access %b_ref.ref, element1
  469. // CHECK:STDOUT: %.loc5_47.16: %i32 = bind_value %.loc5_47.15
  470. // CHECK:STDOUT: %.loc5_47.17: ref %i32 = struct_access file.%b.var, element1 [concrete = constants.%.607]
  471. // CHECK:STDOUT: %.loc5_47.18: init %i32 = initialize_from %.loc5_47.16 to %.loc5_47.17
  472. // CHECK:STDOUT: %.loc5_47.19: init %struct_type.a.d.9db = struct_init (%.loc5_47.14, %.loc5_47.18) to file.%b.var
  473. // CHECK:STDOUT: %.loc5_1: init %struct_type.a.d.9db = converted %b_ref.ref, %.loc5_47.19
  474. // CHECK:STDOUT: assign file.%b.var, %.loc5_1
  475. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%Implicit.F [concrete = constants.%F]
  476. // CHECK:STDOUT: %.loc6: ref %C.a8a = splice_block file.%c.var [concrete = file.%c.var] {}
  477. // CHECK:STDOUT: %F.call: init %C.a8a = call %F.ref() to %.loc6
  478. // CHECK:STDOUT: assign file.%c.var, %F.call
  479. // CHECK:STDOUT: return
  480. // CHECK:STDOUT: }
  481. // CHECK:STDOUT:
  482. // CHECK:STDOUT: specific @C(constants.%S) {
  483. // CHECK:STDOUT: %S => constants.%S
  484. // CHECK:STDOUT: }
  485. // CHECK:STDOUT:
  486. // CHECK:STDOUT: specific @C(constants.%struct) {
  487. // CHECK:STDOUT: %S => constants.%struct
  488. // CHECK:STDOUT:
  489. // CHECK:STDOUT: !definition:
  490. // CHECK:STDOUT: }
  491. // CHECK:STDOUT:
  492. // CHECK:STDOUT: --- fail_bad_type.impl.carbon
  493. // CHECK:STDOUT:
  494. // CHECK:STDOUT: constants {
  495. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  496. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  497. // CHECK:STDOUT: %C.type: type = generic_class_type @C [concrete]
  498. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [concrete]
  499. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  500. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  501. // CHECK:STDOUT: %struct_type.a.b: type = struct_type {.a: %i32, .b: %i32} [concrete]
  502. // CHECK:STDOUT: %S: %struct_type.a.b = bind_symbolic_name S, 0 [symbolic]
  503. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  504. // CHECK:STDOUT: %int_2.ecc: Core.IntLiteral = int_value 2 [concrete]
  505. // CHECK:STDOUT: %struct_type.c.d: type = struct_type {.c: Core.IntLiteral, .d: Core.IntLiteral} [concrete]
  506. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  507. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  508. // CHECK:STDOUT: %int_2.d0d: %i32 = int_value 2 [concrete]
  509. // CHECK:STDOUT: %int_1.47b: %i32 = int_value 1 [concrete]
  510. // CHECK:STDOUT: %struct: %struct_type.a.b = struct_value (%int_1.47b, %int_2.d0d) [concrete]
  511. // CHECK:STDOUT: %C.a8a: type = class_type @C, @C(%struct) [concrete]
  512. // CHECK:STDOUT: }
  513. // CHECK:STDOUT:
  514. // CHECK:STDOUT: imports {
  515. // CHECK:STDOUT: %Implicit.a_ref = import_ref Implicit//default, a_ref, unloaded
  516. // CHECK:STDOUT: %Implicit.b_ref = import_ref Implicit//default, b_ref, unloaded
  517. // CHECK:STDOUT: %Implicit.C: %C.type = import_ref Implicit//default, C, loaded [concrete = constants.%C.generic]
  518. // CHECK:STDOUT: %Implicit.F: %F.type = import_ref Implicit//default, F, loaded [concrete = constants.%F]
  519. // CHECK:STDOUT: %Core.ece: <namespace> = namespace file.%Core.import, [concrete] {
  520. // CHECK:STDOUT: import Core//prelude
  521. // CHECK:STDOUT: import Core//prelude/...
  522. // CHECK:STDOUT: }
  523. // CHECK:STDOUT: %Implicit.import_ref.c81: %struct_type.a.b = import_ref Implicit//default, loc8_9, loaded [symbolic = @C.%S (constants.%S)]
  524. // CHECK:STDOUT: %Implicit.import_ref.8f2: <witness> = import_ref Implicit//default, loc8_34, loaded [concrete = constants.%complete_type.357]
  525. // CHECK:STDOUT: %Implicit.import_ref.b8b = import_ref Implicit//default, inst1424 [no loc], unloaded
  526. // CHECK:STDOUT: }
  527. // CHECK:STDOUT:
  528. // CHECK:STDOUT: file {
  529. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  530. // CHECK:STDOUT: .a_ref = imports.%Implicit.a_ref
  531. // CHECK:STDOUT: .b_ref = imports.%Implicit.b_ref
  532. // CHECK:STDOUT: .C = imports.%Implicit.C
  533. // CHECK:STDOUT: .F = imports.%Implicit.F
  534. // CHECK:STDOUT: .Core = imports.%Core.ece
  535. // CHECK:STDOUT: .c_bad = %c_bad
  536. // CHECK:STDOUT: }
  537. // CHECK:STDOUT: %Implicit.import = import Implicit
  538. // CHECK:STDOUT: %default.import = import <none>
  539. // CHECK:STDOUT: %Core.import = import Core
  540. // CHECK:STDOUT: name_binding_decl {
  541. // CHECK:STDOUT: %c_bad.patt: <error> = binding_pattern c_bad [concrete]
  542. // CHECK:STDOUT: %c_bad.var_patt: <error> = var_pattern %c_bad.patt [concrete]
  543. // CHECK:STDOUT: }
  544. // CHECK:STDOUT: %c_bad.var: ref <error> = var %c_bad.var_patt [concrete = <error>]
  545. // CHECK:STDOUT: %.1: <error> = splice_block <error> [concrete = <error>] {
  546. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%Implicit.C [concrete = constants.%C.generic]
  547. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  548. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc]
  549. // CHECK:STDOUT: %.loc11: %struct_type.c.d = struct_literal (%int_1, %int_2)
  550. // CHECK:STDOUT: }
  551. // CHECK:STDOUT: %c_bad: <error> = bind_name c_bad, <error>
  552. // CHECK:STDOUT: }
  553. // CHECK:STDOUT:
  554. // CHECK:STDOUT: generic class @C(imports.%Implicit.import_ref.c81: %struct_type.a.b) [from "implicit.carbon"] {
  555. // CHECK:STDOUT: %S: %struct_type.a.b = bind_symbolic_name S, 0 [symbolic = %S (constants.%S)]
  556. // CHECK:STDOUT:
  557. // CHECK:STDOUT: !definition:
  558. // CHECK:STDOUT:
  559. // CHECK:STDOUT: class {
  560. // CHECK:STDOUT: complete_type_witness = imports.%Implicit.import_ref.8f2
  561. // CHECK:STDOUT:
  562. // CHECK:STDOUT: !members:
  563. // CHECK:STDOUT: .Self = imports.%Implicit.import_ref.b8b
  564. // CHECK:STDOUT: }
  565. // CHECK:STDOUT: }
  566. // CHECK:STDOUT:
  567. // CHECK:STDOUT: fn @F [from "implicit.carbon"];
  568. // CHECK:STDOUT:
  569. // CHECK:STDOUT: fn @__global_init() {
  570. // CHECK:STDOUT: !entry:
  571. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%Implicit.F [concrete = constants.%F]
  572. // CHECK:STDOUT: %.loc11: ref %C.a8a = temporary_storage
  573. // CHECK:STDOUT: %F.call: init %C.a8a = call %F.ref() to %.loc11
  574. // CHECK:STDOUT: assign file.%c_bad.var, <error>
  575. // CHECK:STDOUT: return
  576. // CHECK:STDOUT: }
  577. // CHECK:STDOUT:
  578. // CHECK:STDOUT: specific @C(constants.%S) {
  579. // CHECK:STDOUT: %S => constants.%S
  580. // CHECK:STDOUT: }
  581. // CHECK:STDOUT:
  582. // CHECK:STDOUT: specific @C(constants.%struct) {
  583. // CHECK:STDOUT: %S => constants.%struct
  584. // CHECK:STDOUT:
  585. // CHECK:STDOUT: !definition:
  586. // CHECK:STDOUT: }
  587. // CHECK:STDOUT:
  588. // CHECK:STDOUT: --- fail_bad_value.impl.carbon
  589. // CHECK:STDOUT:
  590. // CHECK:STDOUT: constants {
  591. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  592. // CHECK:STDOUT: %ImplicitAs.type.595: type = generic_interface_type @ImplicitAs [concrete]
  593. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.595 = struct_value () [concrete]
  594. // CHECK:STDOUT: %Convert.type.9a6: type = fn_type @Convert.2, @impl.a8d(%To.c80) [symbolic]
  595. // CHECK:STDOUT: %Convert.458: %Convert.type.9a6 = struct_value () [symbolic]
  596. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  597. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  598. // CHECK:STDOUT: %C.type: type = generic_class_type @C [concrete]
  599. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [concrete]
  600. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  601. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  602. // CHECK:STDOUT: %struct_type.a.b.5ca: type = struct_type {.a: %i32, .b: %i32} [concrete]
  603. // CHECK:STDOUT: %S: %struct_type.a.b.5ca = bind_symbolic_name S, 0 [symbolic]
  604. // CHECK:STDOUT: %int_3.1ba: Core.IntLiteral = int_value 3 [concrete]
  605. // CHECK:STDOUT: %int_4.0c1: Core.IntLiteral = int_value 4 [concrete]
  606. // CHECK:STDOUT: %struct_type.a.b.cfd: type = struct_type {.a: Core.IntLiteral, .b: Core.IntLiteral} [concrete]
  607. // CHECK:STDOUT: %ImplicitAs.type.b9e: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  608. // CHECK:STDOUT: %Convert.type.ea0: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  609. // CHECK:STDOUT: %ImplicitAs.impl_witness.2ce: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.1ad, @impl.a8d(%int_32) [concrete]
  610. // CHECK:STDOUT: %Convert.type.e14: type = fn_type @Convert.2, @impl.a8d(%int_32) [concrete]
  611. // CHECK:STDOUT: %Convert.4cb: %Convert.type.e14 = struct_value () [concrete]
  612. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.b9e = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.2ce) [concrete]
  613. // CHECK:STDOUT: %.940: type = fn_type_with_self_type %Convert.type.ea0, %ImplicitAs.facet [concrete]
  614. // CHECK:STDOUT: %Convert.bound.a00: <bound method> = bound_method %int_3.1ba, %Convert.4cb [concrete]
  615. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.4cb, @Convert.2(%int_32) [concrete]
  616. // CHECK:STDOUT: %bound_method.fc5: <bound method> = bound_method %int_3.1ba, %Convert.specific_fn [concrete]
  617. // CHECK:STDOUT: %int_3.d47: %i32 = int_value 3 [concrete]
  618. // CHECK:STDOUT: %Convert.bound.694: <bound method> = bound_method %int_4.0c1, %Convert.4cb [concrete]
  619. // CHECK:STDOUT: %bound_method.b6e: <bound method> = bound_method %int_4.0c1, %Convert.specific_fn [concrete]
  620. // CHECK:STDOUT: %int_4.ea3: %i32 = int_value 4 [concrete]
  621. // CHECK:STDOUT: %struct.8e6: %struct_type.a.b.5ca = struct_value (%int_3.d47, %int_4.ea3) [concrete]
  622. // CHECK:STDOUT: %C.5a7: type = class_type @C, @C(%struct.8e6) [concrete]
  623. // CHECK:STDOUT: %pattern_type.366: type = pattern_type %C.5a7 [concrete]
  624. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  625. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  626. // CHECK:STDOUT: %int_2: %i32 = int_value 2 [concrete]
  627. // CHECK:STDOUT: %int_1: %i32 = int_value 1 [concrete]
  628. // CHECK:STDOUT: %struct.cd9: %struct_type.a.b.5ca = struct_value (%int_1, %int_2) [concrete]
  629. // CHECK:STDOUT: %C.a8a: type = class_type @C, @C(%struct.cd9) [concrete]
  630. // CHECK:STDOUT: }
  631. // CHECK:STDOUT:
  632. // CHECK:STDOUT: imports {
  633. // CHECK:STDOUT: %Implicit.a_ref = import_ref Implicit//default, a_ref, unloaded
  634. // CHECK:STDOUT: %Implicit.b_ref = import_ref Implicit//default, b_ref, unloaded
  635. // CHECK:STDOUT: %Implicit.C: %C.type = import_ref Implicit//default, C, loaded [concrete = constants.%C.generic]
  636. // CHECK:STDOUT: %Implicit.F: %F.type = import_ref Implicit//default, F, loaded [concrete = constants.%F]
  637. // CHECK:STDOUT: %Core.ece: <namespace> = namespace file.%Core.import, [concrete] {
  638. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  639. // CHECK:STDOUT: import Core//prelude
  640. // CHECK:STDOUT: import Core//prelude/...
  641. // CHECK:STDOUT: }
  642. // CHECK:STDOUT: %Implicit.import_ref.773: @impl.a8d.%Convert.type (%Convert.type.9a6) = import_ref Implicit//default, inst117 [indirect], loaded [symbolic = @impl.a8d.%Convert (constants.%Convert.458)]
  643. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.1ad = impl_witness_table (%Implicit.import_ref.773), @impl.a8d [concrete]
  644. // CHECK:STDOUT: %Implicit.import_ref.c81: %struct_type.a.b.5ca = import_ref Implicit//default, loc8_9, loaded [symbolic = @C.%S (constants.%S)]
  645. // CHECK:STDOUT: %Implicit.import_ref.8f2: <witness> = import_ref Implicit//default, loc8_34, loaded [concrete = constants.%complete_type.357]
  646. // CHECK:STDOUT: %Implicit.import_ref.b8b = import_ref Implicit//default, inst1424 [no loc], unloaded
  647. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.595 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  648. // CHECK:STDOUT: }
  649. // CHECK:STDOUT:
  650. // CHECK:STDOUT: file {
  651. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  652. // CHECK:STDOUT: .a_ref = imports.%Implicit.a_ref
  653. // CHECK:STDOUT: .b_ref = imports.%Implicit.b_ref
  654. // CHECK:STDOUT: .C = imports.%Implicit.C
  655. // CHECK:STDOUT: .F = imports.%Implicit.F
  656. // CHECK:STDOUT: .Core = imports.%Core.ece
  657. // CHECK:STDOUT: .c_bad = %c_bad
  658. // CHECK:STDOUT: }
  659. // CHECK:STDOUT: %Implicit.import = import Implicit
  660. // CHECK:STDOUT: %default.import = import <none>
  661. // CHECK:STDOUT: %Core.import = import Core
  662. // CHECK:STDOUT: name_binding_decl {
  663. // CHECK:STDOUT: %c_bad.patt: %pattern_type.366 = binding_pattern c_bad [concrete]
  664. // CHECK:STDOUT: %c_bad.var_patt: %pattern_type.366 = var_pattern %c_bad.patt [concrete]
  665. // CHECK:STDOUT: }
  666. // CHECK:STDOUT: %c_bad.var: ref %C.5a7 = var %c_bad.var_patt [concrete]
  667. // CHECK:STDOUT: %.loc10_30.1: type = splice_block %C [concrete = constants.%C.5a7] {
  668. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%Implicit.C [concrete = constants.%C.generic]
  669. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba]
  670. // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4.0c1]
  671. // CHECK:STDOUT: %.loc10_29.1: %struct_type.a.b.cfd = struct_literal (%int_3, %int_4)
  672. // CHECK:STDOUT: %impl.elem0.loc10_29.1: %.940 = impl_witness_access constants.%ImplicitAs.impl_witness.2ce, element0 [concrete = constants.%Convert.4cb]
  673. // CHECK:STDOUT: %bound_method.loc10_29.1: <bound method> = bound_method %int_3, %impl.elem0.loc10_29.1 [concrete = constants.%Convert.bound.a00]
  674. // CHECK:STDOUT: %specific_fn.loc10_29.1: <specific function> = specific_function %impl.elem0.loc10_29.1, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  675. // CHECK:STDOUT: %bound_method.loc10_29.2: <bound method> = bound_method %int_3, %specific_fn.loc10_29.1 [concrete = constants.%bound_method.fc5]
  676. // CHECK:STDOUT: %int.convert_checked.loc10_29.1: init %i32 = call %bound_method.loc10_29.2(%int_3) [concrete = constants.%int_3.d47]
  677. // CHECK:STDOUT: %.loc10_29.2: %i32 = value_of_initializer %int.convert_checked.loc10_29.1 [concrete = constants.%int_3.d47]
  678. // CHECK:STDOUT: %.loc10_29.3: %i32 = converted %int_3, %.loc10_29.2 [concrete = constants.%int_3.d47]
  679. // CHECK:STDOUT: %impl.elem0.loc10_29.2: %.940 = impl_witness_access constants.%ImplicitAs.impl_witness.2ce, element0 [concrete = constants.%Convert.4cb]
  680. // CHECK:STDOUT: %bound_method.loc10_29.3: <bound method> = bound_method %int_4, %impl.elem0.loc10_29.2 [concrete = constants.%Convert.bound.694]
  681. // CHECK:STDOUT: %specific_fn.loc10_29.2: <specific function> = specific_function %impl.elem0.loc10_29.2, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  682. // CHECK:STDOUT: %bound_method.loc10_29.4: <bound method> = bound_method %int_4, %specific_fn.loc10_29.2 [concrete = constants.%bound_method.b6e]
  683. // CHECK:STDOUT: %int.convert_checked.loc10_29.2: init %i32 = call %bound_method.loc10_29.4(%int_4) [concrete = constants.%int_4.ea3]
  684. // CHECK:STDOUT: %.loc10_29.4: %i32 = value_of_initializer %int.convert_checked.loc10_29.2 [concrete = constants.%int_4.ea3]
  685. // CHECK:STDOUT: %.loc10_29.5: %i32 = converted %int_4, %.loc10_29.4 [concrete = constants.%int_4.ea3]
  686. // CHECK:STDOUT: %struct: %struct_type.a.b.5ca = struct_value (%.loc10_29.3, %.loc10_29.5) [concrete = constants.%struct.8e6]
  687. // CHECK:STDOUT: %.loc10_30.2: %struct_type.a.b.5ca = converted %.loc10_29.1, %struct [concrete = constants.%struct.8e6]
  688. // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%struct.8e6) [concrete = constants.%C.5a7]
  689. // CHECK:STDOUT: }
  690. // CHECK:STDOUT: %c_bad: ref %C.5a7 = bind_name c_bad, %c_bad.var
  691. // CHECK:STDOUT: }
  692. // CHECK:STDOUT:
  693. // CHECK:STDOUT: generic class @C(imports.%Implicit.import_ref.c81: %struct_type.a.b.5ca) [from "implicit.carbon"] {
  694. // CHECK:STDOUT: %S: %struct_type.a.b.5ca = bind_symbolic_name S, 0 [symbolic = %S (constants.%S)]
  695. // CHECK:STDOUT:
  696. // CHECK:STDOUT: !definition:
  697. // CHECK:STDOUT:
  698. // CHECK:STDOUT: class {
  699. // CHECK:STDOUT: complete_type_witness = imports.%Implicit.import_ref.8f2
  700. // CHECK:STDOUT:
  701. // CHECK:STDOUT: !members:
  702. // CHECK:STDOUT: .Self = imports.%Implicit.import_ref.b8b
  703. // CHECK:STDOUT: }
  704. // CHECK:STDOUT: }
  705. // CHECK:STDOUT:
  706. // CHECK:STDOUT: fn @F [from "implicit.carbon"];
  707. // CHECK:STDOUT:
  708. // CHECK:STDOUT: fn @__global_init() {
  709. // CHECK:STDOUT: !entry:
  710. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%Implicit.F [concrete = constants.%F]
  711. // CHECK:STDOUT: %.loc10_36: ref %C.a8a = temporary_storage
  712. // CHECK:STDOUT: %F.call: init %C.a8a = call %F.ref() to %.loc10_36
  713. // CHECK:STDOUT: %.loc10_1: %C.5a7 = converted %F.call, <error> [concrete = <error>]
  714. // CHECK:STDOUT: assign file.%c_bad.var, <error>
  715. // CHECK:STDOUT: return
  716. // CHECK:STDOUT: }
  717. // CHECK:STDOUT:
  718. // CHECK:STDOUT: specific @C(constants.%S) {
  719. // CHECK:STDOUT: %S => constants.%S
  720. // CHECK:STDOUT: }
  721. // CHECK:STDOUT:
  722. // CHECK:STDOUT: specific @C(constants.%struct.8e6) {
  723. // CHECK:STDOUT: %S => constants.%struct.8e6
  724. // CHECK:STDOUT:
  725. // CHECK:STDOUT: !definition:
  726. // CHECK:STDOUT: }
  727. // CHECK:STDOUT:
  728. // CHECK:STDOUT: specific @C(constants.%struct.cd9) {
  729. // CHECK:STDOUT: %S => constants.%struct.cd9
  730. // CHECK:STDOUT:
  731. // CHECK:STDOUT: !definition:
  732. // CHECK:STDOUT: }
  733. // CHECK:STDOUT: