import.carbon 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  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. //
  7. // AUTOUPDATE
  8. // TIP: To test this file alone, run:
  9. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/tuple/import.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuple/import.carbon
  12. // --- implicit.carbon
  13. package Implicit;
  14. var a_ref: (i32,) = (0,);
  15. var b_ref: (((i32,), i32), (i32, i32)) = (((0,), 1), (2, 3));
  16. class C(X:! (i32, i32)) {}
  17. fn F() -> C((1, 2));
  18. // --- implicit.impl.carbon
  19. impl package Implicit;
  20. //@dump-sem-ir-begin
  21. var a: (i32,) = a_ref;
  22. var b: (((i32,), i32), (i32, i32)) = b_ref;
  23. var c: C((1, 2)) = F();
  24. //@dump-sem-ir-end
  25. // --- fail_bad_type.impl.carbon
  26. impl package Implicit;
  27. // CHECK:STDERR: fail_bad_type.impl.carbon:[[@LINE+8]]:14: error: cannot initialize tuple of 2 elements from tuple with 3 elements [TupleInitElementCountMismatch]
  28. // CHECK:STDERR: var c_bad: C((1, 2, 3)) = F();
  29. // CHECK:STDERR: ^~~~~~~~~
  30. // CHECK:STDERR: fail_bad_type.impl.carbon:[[@LINE-5]]:1: in import [InImport]
  31. // CHECK:STDERR: implicit.carbon:7:9: note: initializing generic parameter `X` declared here [InitializingGenericParam]
  32. // CHECK:STDERR: class C(X:! (i32, i32)) {}
  33. // CHECK:STDERR: ^
  34. // CHECK:STDERR:
  35. var c_bad: C((1, 2, 3)) = F();
  36. // --- fail_bad_value.impl.carbon
  37. impl package Implicit;
  38. // CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+7]]:1: error: cannot implicitly convert expression of type `C((1, 2))` to `C((3, 4))` [ConversionFailure]
  39. // CHECK:STDERR: var c_bad: C((3, 4)) = F();
  40. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
  41. // CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+4]]:1: note: type `C((1, 2))` does not implement interface `Core.ImplicitAs(C((3, 4)))` [MissingImplInMemberAccessNote]
  42. // CHECK:STDERR: var c_bad: C((3, 4)) = F();
  43. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
  44. // CHECK:STDERR:
  45. var c_bad: C((3, 4)) = F();
  46. // --- symbolic_decl.carbon
  47. library "[[@TEST_NAME]]";
  48. interface I {
  49. let val:! (i32,);
  50. }
  51. class C {}
  52. impl C as I where .val = (1,) {}
  53. // --- import_symbolic_decl.carbon
  54. library "[[@TEST_NAME]]";
  55. import library "symbolic_decl";
  56. fn F() -> (i32,) {
  57. //@dump-sem-ir-begin
  58. return (C as I).val;
  59. //@dump-sem-ir-end
  60. }
  61. // CHECK:STDOUT: --- implicit.impl.carbon
  62. // CHECK:STDOUT:
  63. // CHECK:STDOUT: constants {
  64. // CHECK:STDOUT: %To: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  65. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.9a6: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic]
  66. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.458: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.9a6 = struct_value () [symbolic]
  67. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  68. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  69. // CHECK:STDOUT: %tuple.type.c2c: type = tuple_type (%i32, %i32) [concrete]
  70. // CHECK:STDOUT: %C.type: type = generic_class_type @C [concrete]
  71. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [concrete]
  72. // CHECK:STDOUT: %tuple.type.85c: type = tuple_type (type) [concrete]
  73. // CHECK:STDOUT: %tuple.type.dd4: type = tuple_type (%i32) [concrete]
  74. // CHECK:STDOUT: %pattern_type.2e8: type = pattern_type %tuple.type.dd4 [concrete]
  75. // CHECK:STDOUT: %tuple.elem0.994: ref %i32 = tuple_access imports.%a_ref.var, element0 [concrete]
  76. // CHECK:STDOUT: %tuple.type.8c7: type = tuple_type (%tuple.type.85c, type) [concrete]
  77. // CHECK:STDOUT: %tuple.type.24b: type = tuple_type (type, type) [concrete]
  78. // CHECK:STDOUT: %tuple.type.58c: type = tuple_type (%tuple.type.8c7, %tuple.type.24b) [concrete]
  79. // CHECK:STDOUT: %tuple.type.154: type = tuple_type (%tuple.type.dd4, %i32) [concrete]
  80. // CHECK:STDOUT: %tuple.type.cfa: type = tuple_type (%tuple.type.154, %tuple.type.c2c) [concrete]
  81. // CHECK:STDOUT: %pattern_type.ab9: type = pattern_type %tuple.type.cfa [concrete]
  82. // CHECK:STDOUT: %tuple.elem0.693: ref %tuple.type.154 = tuple_access imports.%b_ref.var, element0 [concrete]
  83. // CHECK:STDOUT: %tuple.elem0.76a: ref %tuple.type.154 = tuple_access file.%b.var, element0 [concrete]
  84. // CHECK:STDOUT: %tuple.elem0.4c9: ref %tuple.type.dd4 = tuple_access %tuple.elem0.693, element0 [concrete]
  85. // CHECK:STDOUT: %tuple.elem0.6fd: ref %tuple.type.dd4 = tuple_access %tuple.elem0.76a, element0 [concrete]
  86. // CHECK:STDOUT: %tuple.elem0.390: ref %i32 = tuple_access %tuple.elem0.4c9, element0 [concrete]
  87. // CHECK:STDOUT: %tuple.elem1.723: ref %i32 = tuple_access %tuple.elem0.693, element1 [concrete]
  88. // CHECK:STDOUT: %tuple.elem1.ae3: ref %i32 = tuple_access %tuple.elem0.76a, element1 [concrete]
  89. // CHECK:STDOUT: %tuple.elem1.92b: ref %tuple.type.c2c = tuple_access imports.%b_ref.var, element1 [concrete]
  90. // CHECK:STDOUT: %tuple.elem1.4f3: ref %tuple.type.c2c = tuple_access file.%b.var, element1 [concrete]
  91. // CHECK:STDOUT: %tuple.elem0.2ff: ref %i32 = tuple_access %tuple.elem1.92b, element0 [concrete]
  92. // CHECK:STDOUT: %tuple.elem0.790: ref %i32 = tuple_access %tuple.elem1.4f3, element0 [concrete]
  93. // CHECK:STDOUT: %tuple.elem1.282: ref %i32 = tuple_access %tuple.elem1.92b, element1 [concrete]
  94. // CHECK:STDOUT: %tuple.elem1.822: ref %i32 = tuple_access %tuple.elem1.4f3, element1 [concrete]
  95. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  96. // CHECK:STDOUT: %int_2.ecc: Core.IntLiteral = int_value 2 [concrete]
  97. // CHECK:STDOUT: %tuple.type.f94: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [concrete]
  98. // CHECK:STDOUT: %ImplicitAs.type.b9e: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  99. // CHECK:STDOUT: %ImplicitAs.Convert.type.ea0: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i32) [concrete]
  100. // CHECK:STDOUT: %ImplicitAs.impl_witness.2ce: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.1ad, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  101. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.e14: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  102. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.4cb: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.e14 = struct_value () [concrete]
  103. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.b9e = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.2ce) [concrete]
  104. // CHECK:STDOUT: %.940: type = fn_type_with_self_type %ImplicitAs.Convert.type.ea0, %ImplicitAs.facet [concrete]
  105. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.dc5: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.ImplicitAs.impl.Convert.4cb [concrete]
  106. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.4cb, @Core.IntLiteral.as.ImplicitAs.impl.Convert(%int_32) [concrete]
  107. // CHECK:STDOUT: %bound_method.c37: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  108. // CHECK:STDOUT: %int_1.47b: %i32 = int_value 1 [concrete]
  109. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.30f: <bound method> = bound_method %int_2.ecc, %Core.IntLiteral.as.ImplicitAs.impl.Convert.4cb [concrete]
  110. // CHECK:STDOUT: %bound_method.62b: <bound method> = bound_method %int_2.ecc, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  111. // CHECK:STDOUT: %int_2.d0d: %i32 = int_value 2 [concrete]
  112. // CHECK:STDOUT: %tuple: %tuple.type.c2c = tuple_value (%int_1.47b, %int_2.d0d) [concrete]
  113. // CHECK:STDOUT: %C.cf0: type = class_type @C, @C(%tuple) [concrete]
  114. // CHECK:STDOUT: %pattern_type.7e2: type = pattern_type %C.cf0 [concrete]
  115. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  116. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  117. // CHECK:STDOUT: }
  118. // CHECK:STDOUT:
  119. // CHECK:STDOUT: imports {
  120. // CHECK:STDOUT: %Implicit.a_ref: ref %tuple.type.dd4 = import_ref Implicit//default, a_ref, loaded [concrete = %a_ref.var]
  121. // CHECK:STDOUT: %Implicit.b_ref: ref %tuple.type.cfa = import_ref Implicit//default, b_ref, loaded [concrete = %b_ref.var]
  122. // CHECK:STDOUT: %Implicit.C: %C.type = import_ref Implicit//default, C, loaded [concrete = constants.%C.generic]
  123. // CHECK:STDOUT: %Implicit.F: %F.type = import_ref Implicit//default, F, loaded [concrete = constants.%F]
  124. // CHECK:STDOUT: %Implicit.import_ref.773: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.9a6) = import_ref Implicit//default, inst152 [indirect], loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.458)]
  125. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.1ad = impl_witness_table (%Implicit.import_ref.773), @Core.IntLiteral.as.ImplicitAs.impl [concrete]
  126. // CHECK:STDOUT: %a_ref.patt: %pattern_type.2e8 = binding_pattern a_ref [concrete]
  127. // CHECK:STDOUT: %a_ref.var_patt: %pattern_type.2e8 = var_pattern %a_ref.patt [concrete]
  128. // CHECK:STDOUT: %a_ref.var: ref %tuple.type.dd4 = var %a_ref.var_patt [concrete]
  129. // CHECK:STDOUT: %b_ref.patt: %pattern_type.ab9 = binding_pattern b_ref [concrete]
  130. // CHECK:STDOUT: %b_ref.var_patt: %pattern_type.ab9 = var_pattern %b_ref.patt [concrete]
  131. // CHECK:STDOUT: %b_ref.var: ref %tuple.type.cfa = var %b_ref.var_patt [concrete]
  132. // CHECK:STDOUT: }
  133. // CHECK:STDOUT:
  134. // CHECK:STDOUT: file {
  135. // CHECK:STDOUT: name_binding_decl {
  136. // CHECK:STDOUT: %a.patt: %pattern_type.2e8 = binding_pattern a [concrete]
  137. // CHECK:STDOUT: %a.var_patt: %pattern_type.2e8 = var_pattern %a.patt [concrete]
  138. // CHECK:STDOUT: }
  139. // CHECK:STDOUT: %a.var: ref %tuple.type.dd4 = var %a.var_patt [concrete]
  140. // CHECK:STDOUT: %.loc5_13.1: type = splice_block %.loc5_13.3 [concrete = constants.%tuple.type.dd4] {
  141. // CHECK:STDOUT: %int_32.loc5: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  142. // CHECK:STDOUT: %i32.loc5: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  143. // CHECK:STDOUT: %.loc5_13.2: %tuple.type.85c = tuple_literal (%i32.loc5)
  144. // CHECK:STDOUT: %.loc5_13.3: type = converted %.loc5_13.2, constants.%tuple.type.dd4 [concrete = constants.%tuple.type.dd4]
  145. // CHECK:STDOUT: }
  146. // CHECK:STDOUT: %a: ref %tuple.type.dd4 = bind_name a, %a.var [concrete = %a.var]
  147. // CHECK:STDOUT: name_binding_decl {
  148. // CHECK:STDOUT: %b.patt: %pattern_type.ab9 = binding_pattern b [concrete]
  149. // CHECK:STDOUT: %b.var_patt: %pattern_type.ab9 = var_pattern %b.patt [concrete]
  150. // CHECK:STDOUT: }
  151. // CHECK:STDOUT: %b.var: ref %tuple.type.cfa = var %b.var_patt [concrete]
  152. // CHECK:STDOUT: %.loc6_34.1: type = splice_block %.loc6_34.6 [concrete = constants.%tuple.type.cfa] {
  153. // CHECK:STDOUT: %int_32.loc6_11: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  154. // CHECK:STDOUT: %i32.loc6_11: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  155. // CHECK:STDOUT: %.loc6_15: %tuple.type.85c = tuple_literal (%i32.loc6_11)
  156. // CHECK:STDOUT: %int_32.loc6_18: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  157. // CHECK:STDOUT: %i32.loc6_18: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  158. // CHECK:STDOUT: %.loc6_21: %tuple.type.8c7 = tuple_literal (%.loc6_15, %i32.loc6_18)
  159. // CHECK:STDOUT: %int_32.loc6_25: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  160. // CHECK:STDOUT: %i32.loc6_25: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  161. // CHECK:STDOUT: %int_32.loc6_30: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  162. // CHECK:STDOUT: %i32.loc6_30: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  163. // CHECK:STDOUT: %.loc6_33: %tuple.type.24b = tuple_literal (%i32.loc6_25, %i32.loc6_30)
  164. // CHECK:STDOUT: %.loc6_34.2: %tuple.type.58c = tuple_literal (%.loc6_21, %.loc6_33)
  165. // CHECK:STDOUT: %.loc6_34.3: type = converted %.loc6_15, constants.%tuple.type.dd4 [concrete = constants.%tuple.type.dd4]
  166. // CHECK:STDOUT: %.loc6_34.4: type = converted %.loc6_21, constants.%tuple.type.154 [concrete = constants.%tuple.type.154]
  167. // CHECK:STDOUT: %.loc6_34.5: type = converted %.loc6_33, constants.%tuple.type.c2c [concrete = constants.%tuple.type.c2c]
  168. // CHECK:STDOUT: %.loc6_34.6: type = converted %.loc6_34.2, constants.%tuple.type.cfa [concrete = constants.%tuple.type.cfa]
  169. // CHECK:STDOUT: }
  170. // CHECK:STDOUT: %b: ref %tuple.type.cfa = bind_name b, %b.var [concrete = %b.var]
  171. // CHECK:STDOUT: name_binding_decl {
  172. // CHECK:STDOUT: %c.patt: %pattern_type.7e2 = binding_pattern c [concrete]
  173. // CHECK:STDOUT: %c.var_patt: %pattern_type.7e2 = var_pattern %c.patt [concrete]
  174. // CHECK:STDOUT: }
  175. // CHECK:STDOUT: %c.var: ref %C.cf0 = var %c.var_patt [concrete]
  176. // CHECK:STDOUT: %.loc7_16.1: type = splice_block %C [concrete = constants.%C.cf0] {
  177. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%Implicit.C [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: %.loc7_15.1: %tuple.type.f94 = tuple_literal (%int_1, %int_2)
  181. // CHECK:STDOUT: %impl.elem0.loc7_15.1: %.940 = impl_witness_access constants.%ImplicitAs.impl_witness.2ce, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.4cb]
  182. // CHECK:STDOUT: %bound_method.loc7_15.1: <bound method> = bound_method %int_1, %impl.elem0.loc7_15.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.dc5]
  183. // CHECK:STDOUT: %specific_fn.loc7_15.1: <specific function> = specific_function %impl.elem0.loc7_15.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  184. // CHECK:STDOUT: %bound_method.loc7_15.2: <bound method> = bound_method %int_1, %specific_fn.loc7_15.1 [concrete = constants.%bound_method.c37]
  185. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_15.1: init %i32 = call %bound_method.loc7_15.2(%int_1) [concrete = constants.%int_1.47b]
  186. // CHECK:STDOUT: %.loc7_15.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_15.1 [concrete = constants.%int_1.47b]
  187. // CHECK:STDOUT: %.loc7_15.3: %i32 = converted %int_1, %.loc7_15.2 [concrete = constants.%int_1.47b]
  188. // CHECK:STDOUT: %impl.elem0.loc7_15.2: %.940 = impl_witness_access constants.%ImplicitAs.impl_witness.2ce, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.4cb]
  189. // CHECK:STDOUT: %bound_method.loc7_15.3: <bound method> = bound_method %int_2, %impl.elem0.loc7_15.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.30f]
  190. // CHECK:STDOUT: %specific_fn.loc7_15.2: <specific function> = specific_function %impl.elem0.loc7_15.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  191. // CHECK:STDOUT: %bound_method.loc7_15.4: <bound method> = bound_method %int_2, %specific_fn.loc7_15.2 [concrete = constants.%bound_method.62b]
  192. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_15.2: init %i32 = call %bound_method.loc7_15.4(%int_2) [concrete = constants.%int_2.d0d]
  193. // CHECK:STDOUT: %.loc7_15.4: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_15.2 [concrete = constants.%int_2.d0d]
  194. // CHECK:STDOUT: %.loc7_15.5: %i32 = converted %int_2, %.loc7_15.4 [concrete = constants.%int_2.d0d]
  195. // CHECK:STDOUT: %tuple: %tuple.type.c2c = tuple_value (%.loc7_15.3, %.loc7_15.5) [concrete = constants.%tuple]
  196. // CHECK:STDOUT: %.loc7_16.2: %tuple.type.c2c = converted %.loc7_15.1, %tuple [concrete = constants.%tuple]
  197. // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%tuple) [concrete = constants.%C.cf0]
  198. // CHECK:STDOUT: }
  199. // CHECK:STDOUT: %c: ref %C.cf0 = bind_name c, %c.var [concrete = %c.var]
  200. // CHECK:STDOUT: }
  201. // CHECK:STDOUT:
  202. // CHECK:STDOUT: fn @__global_init() {
  203. // CHECK:STDOUT: !entry:
  204. // CHECK:STDOUT: %a_ref.ref: ref %tuple.type.dd4 = name_ref a_ref, imports.%Implicit.a_ref [concrete = imports.%a_ref.var]
  205. // CHECK:STDOUT: %tuple.elem0.loc5: ref %i32 = tuple_access %a_ref.ref, element0 [concrete = constants.%tuple.elem0.994]
  206. // CHECK:STDOUT: %.loc5_17.1: %i32 = bind_value %tuple.elem0.loc5
  207. // CHECK:STDOUT: %.loc5_17.2: init %tuple.type.dd4 = tuple_init (%.loc5_17.1) to file.%a.var
  208. // CHECK:STDOUT: %.loc5_1: init %tuple.type.dd4 = converted %a_ref.ref, %.loc5_17.2
  209. // CHECK:STDOUT: assign file.%a.var, %.loc5_1
  210. // CHECK:STDOUT: %b_ref.ref: ref %tuple.type.cfa = name_ref b_ref, imports.%Implicit.b_ref [concrete = imports.%b_ref.var]
  211. // CHECK:STDOUT: %tuple.elem0.loc6_38.1: ref %tuple.type.154 = tuple_access %b_ref.ref, element0 [concrete = constants.%tuple.elem0.693]
  212. // CHECK:STDOUT: %tuple.elem0.loc6_38.2: ref %tuple.type.dd4 = tuple_access %tuple.elem0.loc6_38.1, element0 [concrete = constants.%tuple.elem0.4c9]
  213. // CHECK:STDOUT: %tuple.elem0.loc6_38.3: ref %i32 = tuple_access %tuple.elem0.loc6_38.2, element0 [concrete = constants.%tuple.elem0.390]
  214. // CHECK:STDOUT: %.loc6_38.1: %i32 = bind_value %tuple.elem0.loc6_38.3
  215. // CHECK:STDOUT: %tuple.elem0.loc6_38.4: ref %tuple.type.154 = tuple_access file.%b.var, element0 [concrete = constants.%tuple.elem0.76a]
  216. // CHECK:STDOUT: %tuple.elem0.loc6_38.5: ref %tuple.type.dd4 = tuple_access %tuple.elem0.loc6_38.4, element0 [concrete = constants.%tuple.elem0.6fd]
  217. // CHECK:STDOUT: %.loc6_38.2: init %tuple.type.dd4 = tuple_init (%.loc6_38.1) to %tuple.elem0.loc6_38.5
  218. // CHECK:STDOUT: %.loc6_38.3: init %tuple.type.dd4 = converted %tuple.elem0.loc6_38.2, %.loc6_38.2
  219. // CHECK:STDOUT: %.loc6_38.4: init %tuple.type.dd4 = initialize_from %.loc6_38.3 to %tuple.elem0.loc6_38.5
  220. // CHECK:STDOUT: %tuple.elem1.loc6_38.1: ref %i32 = tuple_access %tuple.elem0.loc6_38.1, element1 [concrete = constants.%tuple.elem1.723]
  221. // CHECK:STDOUT: %.loc6_38.5: %i32 = bind_value %tuple.elem1.loc6_38.1
  222. // CHECK:STDOUT: %tuple.elem1.loc6_38.2: ref %i32 = tuple_access %tuple.elem0.loc6_38.4, element1 [concrete = constants.%tuple.elem1.ae3]
  223. // CHECK:STDOUT: %.loc6_38.6: init %i32 = initialize_from %.loc6_38.5 to %tuple.elem1.loc6_38.2
  224. // CHECK:STDOUT: %.loc6_38.7: init %tuple.type.154 = tuple_init (%.loc6_38.4, %.loc6_38.6) to %tuple.elem0.loc6_38.4
  225. // CHECK:STDOUT: %.loc6_38.8: init %tuple.type.154 = converted %tuple.elem0.loc6_38.1, %.loc6_38.7
  226. // CHECK:STDOUT: %tuple.elem1.loc6_38.3: ref %tuple.type.c2c = tuple_access %b_ref.ref, element1 [concrete = constants.%tuple.elem1.92b]
  227. // CHECK:STDOUT: %tuple.elem0.loc6_38.6: ref %i32 = tuple_access %tuple.elem1.loc6_38.3, element0 [concrete = constants.%tuple.elem0.2ff]
  228. // CHECK:STDOUT: %.loc6_38.9: %i32 = bind_value %tuple.elem0.loc6_38.6
  229. // CHECK:STDOUT: %tuple.elem1.loc6_38.4: ref %tuple.type.c2c = tuple_access file.%b.var, element1 [concrete = constants.%tuple.elem1.4f3]
  230. // CHECK:STDOUT: %tuple.elem0.loc6_38.7: ref %i32 = tuple_access %tuple.elem1.loc6_38.4, element0 [concrete = constants.%tuple.elem0.790]
  231. // CHECK:STDOUT: %.loc6_38.10: init %i32 = initialize_from %.loc6_38.9 to %tuple.elem0.loc6_38.7
  232. // CHECK:STDOUT: %tuple.elem1.loc6_38.5: ref %i32 = tuple_access %tuple.elem1.loc6_38.3, element1 [concrete = constants.%tuple.elem1.282]
  233. // CHECK:STDOUT: %.loc6_38.11: %i32 = bind_value %tuple.elem1.loc6_38.5
  234. // CHECK:STDOUT: %tuple.elem1.loc6_38.6: ref %i32 = tuple_access %tuple.elem1.loc6_38.4, element1 [concrete = constants.%tuple.elem1.822]
  235. // CHECK:STDOUT: %.loc6_38.12: init %i32 = initialize_from %.loc6_38.11 to %tuple.elem1.loc6_38.6
  236. // CHECK:STDOUT: %.loc6_38.13: init %tuple.type.c2c = tuple_init (%.loc6_38.10, %.loc6_38.12) to %tuple.elem1.loc6_38.4
  237. // CHECK:STDOUT: %.loc6_38.14: init %tuple.type.c2c = converted %tuple.elem1.loc6_38.3, %.loc6_38.13
  238. // CHECK:STDOUT: %.loc6_38.15: init %tuple.type.cfa = tuple_init (%.loc6_38.8, %.loc6_38.14) to file.%b.var
  239. // CHECK:STDOUT: %.loc6_1: init %tuple.type.cfa = converted %b_ref.ref, %.loc6_38.15
  240. // CHECK:STDOUT: assign file.%b.var, %.loc6_1
  241. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%Implicit.F [concrete = constants.%F]
  242. // CHECK:STDOUT: %.loc7: ref %C.cf0 = splice_block file.%c.var [concrete = file.%c.var] {}
  243. // CHECK:STDOUT: %F.call: init %C.cf0 = call %F.ref() to %.loc7
  244. // CHECK:STDOUT: assign file.%c.var, %F.call
  245. // CHECK:STDOUT: <elided>
  246. // CHECK:STDOUT: }
  247. // CHECK:STDOUT:
  248. // CHECK:STDOUT: --- import_symbolic_decl.carbon
  249. // CHECK:STDOUT:
  250. // CHECK:STDOUT: constants {
  251. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  252. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  253. // CHECK:STDOUT: %tuple.type.a1c: type = tuple_type (%i32) [concrete]
  254. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  255. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  256. // CHECK:STDOUT: %int_1: %i32 = int_value 1 [concrete]
  257. // CHECK:STDOUT: %tuple: %tuple.type.a1c = tuple_value (%int_1) [concrete]
  258. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness imports.%I.impl_witness_table [concrete]
  259. // CHECK:STDOUT: %I.facet: %I.type = facet_value %C, (%I.impl_witness) [concrete]
  260. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  261. // CHECK:STDOUT: %assoc0.2ff: %I.assoc_type = assoc_entity element0, imports.%Main.import_ref.23f [concrete]
  262. // CHECK:STDOUT: }
  263. // CHECK:STDOUT:
  264. // CHECK:STDOUT: imports {
  265. // CHECK:STDOUT: %Main.I: type = import_ref Main//symbolic_decl, I, loaded [concrete = constants.%I.type]
  266. // CHECK:STDOUT: %Main.C: type = import_ref Main//symbolic_decl, C, loaded [concrete = constants.%C]
  267. // CHECK:STDOUT: %Main.import_ref.c77: %I.assoc_type = import_ref Main//symbolic_decl, loc5_10, loaded [concrete = constants.%assoc0.2ff]
  268. // CHECK:STDOUT: %Main.import_ref.fd7: %tuple.type.a1c = import_ref Main//symbolic_decl, loc10_31, loaded [concrete = constants.%tuple]
  269. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%Main.import_ref.fd7), @C.as.I.impl [concrete]
  270. // CHECK:STDOUT: %Main.import_ref.23f: %tuple.type.a1c = import_ref Main//symbolic_decl, loc5_10, loaded [concrete = %val]
  271. // CHECK:STDOUT: %val: %tuple.type.a1c = assoc_const_decl @val [concrete] {}
  272. // CHECK:STDOUT: }
  273. // CHECK:STDOUT:
  274. // CHECK:STDOUT: fn @F() -> %tuple.type.a1c {
  275. // CHECK:STDOUT: !entry:
  276. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C]
  277. // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type]
  278. // CHECK:STDOUT: %I.facet: %I.type = facet_value constants.%C, (constants.%I.impl_witness) [concrete = constants.%I.facet]
  279. // CHECK:STDOUT: %.loc7_13: %I.type = converted %C.ref, %I.facet [concrete = constants.%I.facet]
  280. // CHECK:STDOUT: %val.ref: %I.assoc_type = name_ref val, imports.%Main.import_ref.c77 [concrete = constants.%assoc0.2ff]
  281. // CHECK:STDOUT: %as_type: type = facet_access_type %.loc7_13 [concrete = constants.%C]
  282. // CHECK:STDOUT: %.loc7_18: type = converted %.loc7_13, %as_type [concrete = constants.%C]
  283. // CHECK:STDOUT: %impl.elem0: %tuple.type.a1c = impl_witness_access constants.%I.impl_witness, element0 [concrete = constants.%tuple]
  284. // CHECK:STDOUT: return %impl.elem0
  285. // CHECK:STDOUT: }
  286. // CHECK:STDOUT: