import.carbon 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  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/tuple/import.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuple/import.carbon
  10. // --- implicit.carbon
  11. package Implicit;
  12. var a_ref: (i32,) = (0,);
  13. var b_ref: (((i32,), i32), (i32, i32)) = (((0,), 1), (2, 3));
  14. class C(X:! (i32, i32)) {}
  15. fn F() -> C((1, 2));
  16. // --- implicit.impl.carbon
  17. impl package Implicit;
  18. var a: (i32,) = a_ref;
  19. var b: (((i32,), i32), (i32, i32)) = b_ref;
  20. var c: C((1, 2)) = F();
  21. // --- fail_bad_type.impl.carbon
  22. impl package Implicit;
  23. // CHECK:STDERR: fail_bad_type.impl.carbon:[[@LINE+8]]:14: error: cannot initialize tuple of 2 elements from tuple with 3 elements [TupleInitElementCountMismatch]
  24. // CHECK:STDERR: var c_bad: C((1, 2, 3)) = F();
  25. // CHECK:STDERR: ^~~~~~~~~
  26. // CHECK:STDERR: fail_bad_type.impl.carbon:[[@LINE-5]]:6: in import [InImport]
  27. // CHECK:STDERR: implicit.carbon:7:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
  28. // CHECK:STDERR: class C(X:! (i32, i32)) {}
  29. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
  30. // CHECK:STDERR:
  31. var c_bad: C((1, 2, 3)) = F();
  32. // --- fail_bad_value.impl.carbon
  33. impl package Implicit;
  34. // CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+6]]:1: error: cannot implicitly convert from `C((1, 2))` to `C((3, 4))` [ImplicitAsConversionFailure]
  35. // CHECK:STDERR: var c_bad: C((3, 4)) = F();
  36. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  37. // CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+3]]:1: note: type `C((1, 2))` does not implement interface `Core.ImplicitAs(C((3, 4)))` [MissingImplInMemberAccessNote]
  38. // CHECK:STDERR: var c_bad: C((3, 4)) = F();
  39. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  40. var c_bad: C((3, 4)) = F();
  41. // CHECK:STDOUT: --- implicit.carbon
  42. // CHECK:STDOUT:
  43. // CHECK:STDOUT: constants {
  44. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  45. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  46. // CHECK:STDOUT: %tuple.type.0e4: type = tuple_type (%i32) [template]
  47. // CHECK:STDOUT: %int_0.5c6: Core.IntLiteral = int_value 0 [template]
  48. // CHECK:STDOUT: %tuple.type.985: type = tuple_type (Core.IntLiteral) [template]
  49. // CHECK:STDOUT: %Convert.type.cd1: type = fn_type @Convert.1, @ImplicitAs(%i32) [template]
  50. // CHECK:STDOUT: %impl_witness.5b0: <witness> = impl_witness (imports.%import_ref.723), @impl.1(%int_32) [template]
  51. // CHECK:STDOUT: %Convert.type.466: type = fn_type @Convert.2, @impl.1(%int_32) [template]
  52. // CHECK:STDOUT: %Convert.925: %Convert.type.466 = struct_value () [template]
  53. // CHECK:STDOUT: %Convert.bound.b41: <bound method> = bound_method %int_0.5c6, %Convert.925 [template]
  54. // CHECK:STDOUT: %Convert.specific_fn.c35: <specific function> = specific_function %Convert.bound.b41, @Convert.2(%int_32) [template]
  55. // CHECK:STDOUT: %int_0.f61: %i32 = int_value 0 [template]
  56. // CHECK:STDOUT: %tuple.2c2: %tuple.type.0e4 = tuple_value (%int_0.f61) [template]
  57. // CHECK:STDOUT: %tuple.type.24b: type = tuple_type (type, type) [template]
  58. // CHECK:STDOUT: %tuple.type.0e1: type = tuple_type (%tuple.type.0e4, %i32) [template]
  59. // CHECK:STDOUT: %tuple.type.471: type = tuple_type (%i32, %i32) [template]
  60. // CHECK:STDOUT: %tuple.type.b19: type = tuple_type (%tuple.type.0e1, %tuple.type.471) [template]
  61. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [template]
  62. // CHECK:STDOUT: %tuple.type.186: type = tuple_type (%tuple.type.985, Core.IntLiteral) [template]
  63. // CHECK:STDOUT: %int_2.ecc: Core.IntLiteral = int_value 2 [template]
  64. // CHECK:STDOUT: %int_3.1ba: Core.IntLiteral = int_value 3 [template]
  65. // CHECK:STDOUT: %tuple.type.f94: type = tuple_type (Core.IntLiteral, Core.IntLiteral) [template]
  66. // CHECK:STDOUT: %tuple.type.d47: type = tuple_type (%tuple.type.186, %tuple.type.f94) [template]
  67. // CHECK:STDOUT: %Convert.bound.afd: <bound method> = bound_method %int_1.5b8, %Convert.925 [template]
  68. // CHECK:STDOUT: %Convert.specific_fn.b73: <specific function> = specific_function %Convert.bound.afd, @Convert.2(%int_32) [template]
  69. // CHECK:STDOUT: %int_1.c60: %i32 = int_value 1 [template]
  70. // CHECK:STDOUT: %tuple.20c: %tuple.type.0e1 = tuple_value (%tuple.2c2, %int_1.c60) [template]
  71. // CHECK:STDOUT: %Convert.bound.f0b: <bound method> = bound_method %int_2.ecc, %Convert.925 [template]
  72. // CHECK:STDOUT: %Convert.specific_fn.20e: <specific function> = specific_function %Convert.bound.f0b, @Convert.2(%int_32) [template]
  73. // CHECK:STDOUT: %int_2.166: %i32 = int_value 2 [template]
  74. // CHECK:STDOUT: %Convert.bound.0db: <bound method> = bound_method %int_3.1ba, %Convert.925 [template]
  75. // CHECK:STDOUT: %Convert.specific_fn.456: <specific function> = specific_function %Convert.bound.0db, @Convert.2(%int_32) [template]
  76. // CHECK:STDOUT: %int_3.25b: %i32 = int_value 3 [template]
  77. // CHECK:STDOUT: %tuple.44c: %tuple.type.471 = tuple_value (%int_2.166, %int_3.25b) [template]
  78. // CHECK:STDOUT: %tuple.125: %tuple.type.b19 = tuple_value (%tuple.20c, %tuple.44c) [template]
  79. // CHECK:STDOUT: %X: %tuple.type.471 = bind_symbolic_name X, 0 [symbolic]
  80. // CHECK:STDOUT: %X.patt: %tuple.type.471 = symbolic_binding_pattern X, 0 [symbolic]
  81. // CHECK:STDOUT: %C.type: type = generic_class_type @C [template]
  82. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [template]
  83. // CHECK:STDOUT: %C.617: type = class_type @C, @C(%X) [symbolic]
  84. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  85. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [template]
  86. // CHECK:STDOUT: %tuple.58e: %tuple.type.471 = tuple_value (%int_1.c60, %int_2.166) [template]
  87. // CHECK:STDOUT: %C.614: type = class_type @C, @C(%tuple.58e) [template]
  88. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  89. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  90. // CHECK:STDOUT: }
  91. // CHECK:STDOUT:
  92. // CHECK:STDOUT: imports {
  93. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  94. // CHECK:STDOUT: .Int = %import_ref.187
  95. // CHECK:STDOUT: .ImplicitAs = %import_ref.a69
  96. // CHECK:STDOUT: import Core//prelude
  97. // CHECK:STDOUT: import Core//prelude/...
  98. // CHECK:STDOUT: }
  99. // CHECK:STDOUT: }
  100. // CHECK:STDOUT:
  101. // CHECK:STDOUT: file {
  102. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  103. // CHECK:STDOUT: .Core = imports.%Core
  104. // CHECK:STDOUT: .a_ref = %a_ref
  105. // CHECK:STDOUT: .b_ref = %b_ref
  106. // CHECK:STDOUT: .C = %C.decl
  107. // CHECK:STDOUT: .F = %F.decl
  108. // CHECK:STDOUT: }
  109. // CHECK:STDOUT: %Core.import = import Core
  110. // CHECK:STDOUT: %a_ref.var: ref %tuple.type.0e4 = var a_ref
  111. // CHECK:STDOUT: %a_ref: ref %tuple.type.0e4 = bind_name a_ref, %a_ref.var
  112. // CHECK:STDOUT: %b_ref.var: ref %tuple.type.b19 = var b_ref
  113. // CHECK:STDOUT: %b_ref: ref %tuple.type.b19 = bind_name b_ref, %b_ref.var
  114. // CHECK:STDOUT: %C.decl: %C.type = class_decl @C [template = constants.%C.generic] {
  115. // CHECK:STDOUT: %X.patt.loc7_9.1: %tuple.type.471 = symbolic_binding_pattern X, 0 [symbolic = %X.patt.loc7_9.2 (constants.%X.patt)]
  116. // CHECK:STDOUT: %X.param_patt: %tuple.type.471 = value_param_pattern %X.patt.loc7_9.1, runtime_param<invalid> [symbolic = %X.patt.loc7_9.2 (constants.%X.patt)]
  117. // CHECK:STDOUT: } {
  118. // CHECK:STDOUT: %X.param: %tuple.type.471 = value_param runtime_param<invalid>
  119. // CHECK:STDOUT: %.loc7_22.1: type = splice_block %.loc7_22.3 [template = constants.%tuple.type.471] {
  120. // CHECK:STDOUT: %int_32.loc7_14: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  121. // CHECK:STDOUT: %i32.loc7_14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  122. // CHECK:STDOUT: %int_32.loc7_19: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  123. // CHECK:STDOUT: %i32.loc7_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  124. // CHECK:STDOUT: %.loc7_22.2: %tuple.type.24b = tuple_literal (%i32.loc7_14, %i32.loc7_19)
  125. // CHECK:STDOUT: %.loc7_22.3: type = converted %.loc7_22.2, constants.%tuple.type.471 [template = constants.%tuple.type.471]
  126. // CHECK:STDOUT: }
  127. // CHECK:STDOUT: %X.loc7_9.1: %tuple.type.471 = bind_symbolic_name X, 0, %X.param [symbolic = %X.loc7_9.2 (constants.%X)]
  128. // CHECK:STDOUT: }
  129. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  130. // CHECK:STDOUT: %return.patt: %C.614 = return_slot_pattern
  131. // CHECK:STDOUT: %return.param_patt: %C.614 = out_param_pattern %return.patt, runtime_param0
  132. // CHECK:STDOUT: } {
  133. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [template = constants.%C.generic]
  134. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1.5b8]
  135. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.ecc]
  136. // CHECK:STDOUT: %.loc9_18.1: %tuple.type.f94 = tuple_literal (%int_1, %int_2)
  137. // CHECK:STDOUT: %impl.elem0.loc9_18.1: %Convert.type.cd1 = impl_witness_access constants.%impl_witness.5b0, element0 [template = constants.%Convert.925]
  138. // CHECK:STDOUT: %Convert.bound.loc9_18.1: <bound method> = bound_method %int_1, %impl.elem0.loc9_18.1 [template = constants.%Convert.bound.afd]
  139. // CHECK:STDOUT: %Convert.specific_fn.loc9_18.1: <specific function> = specific_function %Convert.bound.loc9_18.1, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.b73]
  140. // CHECK:STDOUT: %int.convert_checked.loc9_18.1: init %i32 = call %Convert.specific_fn.loc9_18.1(%int_1) [template = constants.%int_1.c60]
  141. // CHECK:STDOUT: %.loc9_18.2: %i32 = value_of_initializer %int.convert_checked.loc9_18.1 [template = constants.%int_1.c60]
  142. // CHECK:STDOUT: %.loc9_18.3: %i32 = converted %int_1, %.loc9_18.2 [template = constants.%int_1.c60]
  143. // CHECK:STDOUT: %impl.elem0.loc9_18.2: %Convert.type.cd1 = impl_witness_access constants.%impl_witness.5b0, element0 [template = constants.%Convert.925]
  144. // CHECK:STDOUT: %Convert.bound.loc9_18.2: <bound method> = bound_method %int_2, %impl.elem0.loc9_18.2 [template = constants.%Convert.bound.f0b]
  145. // CHECK:STDOUT: %Convert.specific_fn.loc9_18.2: <specific function> = specific_function %Convert.bound.loc9_18.2, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.20e]
  146. // CHECK:STDOUT: %int.convert_checked.loc9_18.2: init %i32 = call %Convert.specific_fn.loc9_18.2(%int_2) [template = constants.%int_2.166]
  147. // CHECK:STDOUT: %.loc9_18.4: %i32 = value_of_initializer %int.convert_checked.loc9_18.2 [template = constants.%int_2.166]
  148. // CHECK:STDOUT: %.loc9_18.5: %i32 = converted %int_2, %.loc9_18.4 [template = constants.%int_2.166]
  149. // CHECK:STDOUT: %tuple: %tuple.type.471 = tuple_value (%.loc9_18.3, %.loc9_18.5) [template = constants.%tuple.58e]
  150. // CHECK:STDOUT: %.loc9_19: %tuple.type.471 = converted %.loc9_18.1, %tuple [template = constants.%tuple.58e]
  151. // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%tuple.58e) [template = constants.%C.614]
  152. // CHECK:STDOUT: %return.param: ref %C.614 = out_param runtime_param0
  153. // CHECK:STDOUT: %return: ref %C.614 = return_slot %return.param
  154. // CHECK:STDOUT: }
  155. // CHECK:STDOUT: }
  156. // CHECK:STDOUT:
  157. // CHECK:STDOUT: generic class @C(%X.loc7_9.1: %tuple.type.471) {
  158. // CHECK:STDOUT: %X.loc7_9.2: %tuple.type.471 = bind_symbolic_name X, 0 [symbolic = %X.loc7_9.2 (constants.%X)]
  159. // CHECK:STDOUT: %X.patt.loc7_9.2: %tuple.type.471 = symbolic_binding_pattern X, 0 [symbolic = %X.patt.loc7_9.2 (constants.%X.patt)]
  160. // CHECK:STDOUT:
  161. // CHECK:STDOUT: !definition:
  162. // CHECK:STDOUT:
  163. // CHECK:STDOUT: class {
  164. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type.357]
  165. // CHECK:STDOUT:
  166. // CHECK:STDOUT: !members:
  167. // CHECK:STDOUT: .Self = constants.%C.617
  168. // CHECK:STDOUT: complete_type_witness = %complete_type
  169. // CHECK:STDOUT: }
  170. // CHECK:STDOUT: }
  171. // CHECK:STDOUT:
  172. // CHECK:STDOUT: fn @F() -> %C.614;
  173. // CHECK:STDOUT:
  174. // CHECK:STDOUT: fn @__global_init() {
  175. // CHECK:STDOUT: !entry:
  176. // CHECK:STDOUT: %int_0.loc4: Core.IntLiteral = int_value 0 [template = constants.%int_0.5c6]
  177. // CHECK:STDOUT: %.loc4_24.1: %tuple.type.985 = tuple_literal (%int_0.loc4)
  178. // CHECK:STDOUT: %impl.elem0.loc4: %Convert.type.cd1 = impl_witness_access constants.%impl_witness.5b0, element0 [template = constants.%Convert.925]
  179. // CHECK:STDOUT: %Convert.bound.loc4: <bound method> = bound_method %int_0.loc4, %impl.elem0.loc4 [template = constants.%Convert.bound.b41]
  180. // CHECK:STDOUT: %Convert.specific_fn.loc4: <specific function> = specific_function %Convert.bound.loc4, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.c35]
  181. // CHECK:STDOUT: %int.convert_checked.loc4: init %i32 = call %Convert.specific_fn.loc4(%int_0.loc4) [template = constants.%int_0.f61]
  182. // CHECK:STDOUT: %.loc4_24.2: init %i32 = converted %int_0.loc4, %int.convert_checked.loc4 [template = constants.%int_0.f61]
  183. // CHECK:STDOUT: %.loc4_24.3: init %tuple.type.0e4 = tuple_init (%.loc4_24.2) to file.%a_ref.var [template = constants.%tuple.2c2]
  184. // CHECK:STDOUT: %.loc4_25: init %tuple.type.0e4 = converted %.loc4_24.1, %.loc4_24.3 [template = constants.%tuple.2c2]
  185. // CHECK:STDOUT: assign file.%a_ref.var, %.loc4_25
  186. // CHECK:STDOUT: %int_0.loc5: Core.IntLiteral = int_value 0 [template = constants.%int_0.5c6]
  187. // CHECK:STDOUT: %.loc5_47.1: %tuple.type.985 = tuple_literal (%int_0.loc5)
  188. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1.5b8]
  189. // CHECK:STDOUT: %.loc5_51.1: %tuple.type.186 = tuple_literal (%.loc5_47.1, %int_1)
  190. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.ecc]
  191. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template = constants.%int_3.1ba]
  192. // CHECK:STDOUT: %.loc5_59.1: %tuple.type.f94 = tuple_literal (%int_2, %int_3)
  193. // CHECK:STDOUT: %.loc5_60.1: %tuple.type.d47 = tuple_literal (%.loc5_51.1, %.loc5_59.1)
  194. // CHECK:STDOUT: %impl.elem0.loc5_47: %Convert.type.cd1 = impl_witness_access constants.%impl_witness.5b0, element0 [template = constants.%Convert.925]
  195. // CHECK:STDOUT: %Convert.bound.loc5_47: <bound method> = bound_method %int_0.loc5, %impl.elem0.loc5_47 [template = constants.%Convert.bound.b41]
  196. // CHECK:STDOUT: %Convert.specific_fn.loc5_47: <specific function> = specific_function %Convert.bound.loc5_47, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.c35]
  197. // CHECK:STDOUT: %int.convert_checked.loc5_47: init %i32 = call %Convert.specific_fn.loc5_47(%int_0.loc5) [template = constants.%int_0.f61]
  198. // CHECK:STDOUT: %.loc5_47.2: init %i32 = converted %int_0.loc5, %int.convert_checked.loc5_47 [template = constants.%int_0.f61]
  199. // CHECK:STDOUT: %tuple.elem0.loc5_60: ref %tuple.type.0e1 = tuple_access file.%b_ref.var, element0
  200. // CHECK:STDOUT: %tuple.elem0.loc5_51: ref %tuple.type.0e4 = tuple_access %tuple.elem0.loc5_60, element0
  201. // CHECK:STDOUT: %.loc5_47.3: init %tuple.type.0e4 = tuple_init (%.loc5_47.2) to %tuple.elem0.loc5_51 [template = constants.%tuple.2c2]
  202. // CHECK:STDOUT: %.loc5_51.2: init %tuple.type.0e4 = converted %.loc5_47.1, %.loc5_47.3 [template = constants.%tuple.2c2]
  203. // CHECK:STDOUT: %.loc5_51.3: init %tuple.type.0e4 = initialize_from %.loc5_51.2 to %tuple.elem0.loc5_51 [template = constants.%tuple.2c2]
  204. // CHECK:STDOUT: %impl.elem0.loc5_51: %Convert.type.cd1 = impl_witness_access constants.%impl_witness.5b0, element0 [template = constants.%Convert.925]
  205. // CHECK:STDOUT: %Convert.bound.loc5_51: <bound method> = bound_method %int_1, %impl.elem0.loc5_51 [template = constants.%Convert.bound.afd]
  206. // CHECK:STDOUT: %Convert.specific_fn.loc5_51: <specific function> = specific_function %Convert.bound.loc5_51, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.b73]
  207. // CHECK:STDOUT: %int.convert_checked.loc5_51: init %i32 = call %Convert.specific_fn.loc5_51(%int_1) [template = constants.%int_1.c60]
  208. // CHECK:STDOUT: %.loc5_51.4: init %i32 = converted %int_1, %int.convert_checked.loc5_51 [template = constants.%int_1.c60]
  209. // CHECK:STDOUT: %tuple.elem1.loc5_51: ref %i32 = tuple_access %tuple.elem0.loc5_60, element1
  210. // CHECK:STDOUT: %.loc5_51.5: init %i32 = initialize_from %.loc5_51.4 to %tuple.elem1.loc5_51 [template = constants.%int_1.c60]
  211. // CHECK:STDOUT: %.loc5_51.6: init %tuple.type.0e1 = tuple_init (%.loc5_51.3, %.loc5_51.5) to %tuple.elem0.loc5_60 [template = constants.%tuple.20c]
  212. // CHECK:STDOUT: %.loc5_60.2: init %tuple.type.0e1 = converted %.loc5_51.1, %.loc5_51.6 [template = constants.%tuple.20c]
  213. // CHECK:STDOUT: %impl.elem0.loc5_59.1: %Convert.type.cd1 = impl_witness_access constants.%impl_witness.5b0, element0 [template = constants.%Convert.925]
  214. // CHECK:STDOUT: %Convert.bound.loc5_59.1: <bound method> = bound_method %int_2, %impl.elem0.loc5_59.1 [template = constants.%Convert.bound.f0b]
  215. // CHECK:STDOUT: %Convert.specific_fn.loc5_59.1: <specific function> = specific_function %Convert.bound.loc5_59.1, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.20e]
  216. // CHECK:STDOUT: %int.convert_checked.loc5_59.1: init %i32 = call %Convert.specific_fn.loc5_59.1(%int_2) [template = constants.%int_2.166]
  217. // CHECK:STDOUT: %.loc5_59.2: init %i32 = converted %int_2, %int.convert_checked.loc5_59.1 [template = constants.%int_2.166]
  218. // CHECK:STDOUT: %tuple.elem1.loc5_60: ref %tuple.type.471 = tuple_access file.%b_ref.var, element1
  219. // CHECK:STDOUT: %tuple.elem0.loc5_59: ref %i32 = tuple_access %tuple.elem1.loc5_60, element0
  220. // CHECK:STDOUT: %.loc5_59.3: init %i32 = initialize_from %.loc5_59.2 to %tuple.elem0.loc5_59 [template = constants.%int_2.166]
  221. // CHECK:STDOUT: %impl.elem0.loc5_59.2: %Convert.type.cd1 = impl_witness_access constants.%impl_witness.5b0, element0 [template = constants.%Convert.925]
  222. // CHECK:STDOUT: %Convert.bound.loc5_59.2: <bound method> = bound_method %int_3, %impl.elem0.loc5_59.2 [template = constants.%Convert.bound.0db]
  223. // CHECK:STDOUT: %Convert.specific_fn.loc5_59.2: <specific function> = specific_function %Convert.bound.loc5_59.2, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.456]
  224. // CHECK:STDOUT: %int.convert_checked.loc5_59.2: init %i32 = call %Convert.specific_fn.loc5_59.2(%int_3) [template = constants.%int_3.25b]
  225. // CHECK:STDOUT: %.loc5_59.4: init %i32 = converted %int_3, %int.convert_checked.loc5_59.2 [template = constants.%int_3.25b]
  226. // CHECK:STDOUT: %tuple.elem1.loc5_59: ref %i32 = tuple_access %tuple.elem1.loc5_60, element1
  227. // CHECK:STDOUT: %.loc5_59.5: init %i32 = initialize_from %.loc5_59.4 to %tuple.elem1.loc5_59 [template = constants.%int_3.25b]
  228. // CHECK:STDOUT: %.loc5_59.6: init %tuple.type.471 = tuple_init (%.loc5_59.3, %.loc5_59.5) to %tuple.elem1.loc5_60 [template = constants.%tuple.44c]
  229. // CHECK:STDOUT: %.loc5_60.3: init %tuple.type.471 = converted %.loc5_59.1, %.loc5_59.6 [template = constants.%tuple.44c]
  230. // CHECK:STDOUT: %.loc5_60.4: init %tuple.type.b19 = tuple_init (%.loc5_60.2, %.loc5_60.3) to file.%b_ref.var [template = constants.%tuple.125]
  231. // CHECK:STDOUT: %.loc5_61: init %tuple.type.b19 = converted %.loc5_60.1, %.loc5_60.4 [template = constants.%tuple.125]
  232. // CHECK:STDOUT: assign file.%b_ref.var, %.loc5_61
  233. // CHECK:STDOUT: return
  234. // CHECK:STDOUT: }
  235. // CHECK:STDOUT:
  236. // CHECK:STDOUT: specific @C(constants.%X) {
  237. // CHECK:STDOUT: %X.loc7_9.2 => constants.%X
  238. // CHECK:STDOUT: %X.patt.loc7_9.2 => constants.%X
  239. // CHECK:STDOUT: }
  240. // CHECK:STDOUT:
  241. // CHECK:STDOUT: specific @C(constants.%tuple.58e) {
  242. // CHECK:STDOUT: %X.loc7_9.2 => constants.%tuple.58e
  243. // CHECK:STDOUT: %X.patt.loc7_9.2 => constants.%tuple.58e
  244. // CHECK:STDOUT: }
  245. // CHECK:STDOUT:
  246. // CHECK:STDOUT: --- implicit.impl.carbon
  247. // CHECK:STDOUT:
  248. // CHECK:STDOUT: constants {
  249. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  250. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  251. // CHECK:STDOUT: %tuple.type.590: type = tuple_type (%i32) [template]
  252. // CHECK:STDOUT: %tuple.type.7c4: type = tuple_type (%tuple.type.590, %i32) [template]
  253. // CHECK:STDOUT: %tuple.type.e07: type = tuple_type (%i32, %i32) [template]
  254. // CHECK:STDOUT: %tuple.type.fce: type = tuple_type (%tuple.type.7c4, %tuple.type.e07) [template]
  255. // CHECK:STDOUT: %C.type: type = generic_class_type @C [template]
  256. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [template]
  257. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  258. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [template]
  259. // CHECK:STDOUT: %X: %tuple.type.e07 = bind_symbolic_name X, 0 [symbolic]
  260. // CHECK:STDOUT: %X.patt: %tuple.type.e07 = symbolic_binding_pattern X, 0 [symbolic]
  261. // CHECK:STDOUT: %int_1.059: %i32 = int_value 1 [template]
  262. // CHECK:STDOUT: %int_2.ed9: %i32 = int_value 2 [template]
  263. // CHECK:STDOUT: %tuple: %tuple.type.e07 = tuple_value (%int_1.059, %int_2.ed9) [template]
  264. // CHECK:STDOUT: %C.fd9: type = class_type @C, @C(%tuple) [template]
  265. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  266. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  267. // CHECK:STDOUT: }
  268. // CHECK:STDOUT:
  269. // CHECK:STDOUT: imports {
  270. // CHECK:STDOUT: %import_ref.c6d: ref %tuple.type.590 = import_ref Implicit//default, a_ref, loaded
  271. // CHECK:STDOUT: %import_ref.1fe: ref %tuple.type.fce = import_ref Implicit//default, b_ref, loaded
  272. // CHECK:STDOUT: %import_ref.c9b: %C.type = import_ref Implicit//default, C, loaded [template = constants.%C.generic]
  273. // CHECK:STDOUT: %import_ref.0dc: %F.type = import_ref Implicit//default, F, loaded [template = constants.%F]
  274. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  275. // CHECK:STDOUT: .Int = %import_ref.d69
  276. // CHECK:STDOUT: .ImplicitAs = %import_ref.edd
  277. // CHECK:STDOUT: import Core//prelude
  278. // CHECK:STDOUT: import Core//prelude/...
  279. // CHECK:STDOUT: }
  280. // CHECK:STDOUT: %import_ref.8f2: <witness> = import_ref Implicit//default, loc7_26, loaded [template = constants.%complete_type.357]
  281. // CHECK:STDOUT: %import_ref.2e0 = import_ref Implicit//default, inst1096 [no loc], unloaded
  282. // CHECK:STDOUT: }
  283. // CHECK:STDOUT:
  284. // CHECK:STDOUT: file {
  285. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  286. // CHECK:STDOUT: .a_ref = imports.%import_ref.c6d
  287. // CHECK:STDOUT: .b_ref = imports.%import_ref.1fe
  288. // CHECK:STDOUT: .C = imports.%import_ref.c9b
  289. // CHECK:STDOUT: .F = imports.%import_ref.0dc
  290. // CHECK:STDOUT: .Core = imports.%Core
  291. // CHECK:STDOUT: .a = %a
  292. // CHECK:STDOUT: .b = %b
  293. // CHECK:STDOUT: .c = %c
  294. // CHECK:STDOUT: }
  295. // CHECK:STDOUT: %Implicit.import = import Implicit
  296. // CHECK:STDOUT: %default.import = import <invalid>
  297. // CHECK:STDOUT: %Core.import = import Core
  298. // CHECK:STDOUT: %a.var: ref %tuple.type.590 = var a
  299. // CHECK:STDOUT: %a: ref %tuple.type.590 = bind_name a, %a.var
  300. // CHECK:STDOUT: %b.var: ref %tuple.type.fce = var b
  301. // CHECK:STDOUT: %b: ref %tuple.type.fce = bind_name b, %b.var
  302. // CHECK:STDOUT: %c.var: ref %C.fd9 = var c
  303. // CHECK:STDOUT: %c: ref %C.fd9 = bind_name c, %c.var
  304. // CHECK:STDOUT: }
  305. // CHECK:STDOUT:
  306. // CHECK:STDOUT: generic class @C(constants.%X: %tuple.type.e07) [from "implicit.carbon"] {
  307. // CHECK:STDOUT: %X: %tuple.type.e07 = bind_symbolic_name X, 0 [symbolic = %X (constants.%X)]
  308. // CHECK:STDOUT: %X.patt: %tuple.type.e07 = symbolic_binding_pattern X, 0 [symbolic = %X.patt (constants.%X.patt)]
  309. // CHECK:STDOUT:
  310. // CHECK:STDOUT: !definition:
  311. // CHECK:STDOUT:
  312. // CHECK:STDOUT: class {
  313. // CHECK:STDOUT: !members:
  314. // CHECK:STDOUT: .Self = imports.%import_ref.2e0
  315. // CHECK:STDOUT: complete_type_witness = imports.%import_ref.8f2
  316. // CHECK:STDOUT: }
  317. // CHECK:STDOUT: }
  318. // CHECK:STDOUT:
  319. // CHECK:STDOUT: fn @F() -> %C.fd9 [from "implicit.carbon"];
  320. // CHECK:STDOUT:
  321. // CHECK:STDOUT: fn @__global_init() {
  322. // CHECK:STDOUT: !entry:
  323. // CHECK:STDOUT: %a_ref.ref: ref %tuple.type.590 = name_ref a_ref, imports.%import_ref.c6d
  324. // CHECK:STDOUT: %tuple.elem0.loc4: ref %i32 = tuple_access %a_ref.ref, element0
  325. // CHECK:STDOUT: %.loc4_17.1: %i32 = bind_value %tuple.elem0.loc4
  326. // CHECK:STDOUT: %.loc4_17.2: init %tuple.type.590 = tuple_init (%.loc4_17.1) to file.%a.var
  327. // CHECK:STDOUT: %.loc4_22: init %tuple.type.590 = converted %a_ref.ref, %.loc4_17.2
  328. // CHECK:STDOUT: assign file.%a.var, %.loc4_22
  329. // CHECK:STDOUT: %b_ref.ref: ref %tuple.type.fce = name_ref b_ref, imports.%import_ref.1fe
  330. // CHECK:STDOUT: %tuple.elem0.loc5_38.1: ref %tuple.type.7c4 = tuple_access %b_ref.ref, element0
  331. // CHECK:STDOUT: %tuple.elem0.loc5_38.2: ref %tuple.type.590 = tuple_access %tuple.elem0.loc5_38.1, element0
  332. // CHECK:STDOUT: %tuple.elem0.loc5_38.3: ref %i32 = tuple_access %tuple.elem0.loc5_38.2, element0
  333. // CHECK:STDOUT: %.loc5_38.1: %i32 = bind_value %tuple.elem0.loc5_38.3
  334. // CHECK:STDOUT: %tuple.elem0.loc5_38.4: ref %tuple.type.7c4 = tuple_access file.%b.var, element0
  335. // CHECK:STDOUT: %tuple.elem0.loc5_38.5: ref %tuple.type.590 = tuple_access %tuple.elem0.loc5_38.4, element0
  336. // CHECK:STDOUT: %.loc5_38.2: init %tuple.type.590 = tuple_init (%.loc5_38.1) to %tuple.elem0.loc5_38.5
  337. // CHECK:STDOUT: %.loc5_38.3: init %tuple.type.590 = converted %tuple.elem0.loc5_38.2, %.loc5_38.2
  338. // CHECK:STDOUT: %.loc5_38.4: init %tuple.type.590 = initialize_from %.loc5_38.3 to %tuple.elem0.loc5_38.5
  339. // CHECK:STDOUT: %tuple.elem1.loc5_38.1: ref %i32 = tuple_access %tuple.elem0.loc5_38.1, element1
  340. // CHECK:STDOUT: %.loc5_38.5: %i32 = bind_value %tuple.elem1.loc5_38.1
  341. // CHECK:STDOUT: %tuple.elem1.loc5_38.2: ref %i32 = tuple_access %tuple.elem0.loc5_38.4, element1
  342. // CHECK:STDOUT: %.loc5_38.6: init %i32 = initialize_from %.loc5_38.5 to %tuple.elem1.loc5_38.2
  343. // CHECK:STDOUT: %.loc5_38.7: init %tuple.type.7c4 = tuple_init (%.loc5_38.4, %.loc5_38.6) to %tuple.elem0.loc5_38.4
  344. // CHECK:STDOUT: %.loc5_38.8: init %tuple.type.7c4 = converted %tuple.elem0.loc5_38.1, %.loc5_38.7
  345. // CHECK:STDOUT: %tuple.elem1.loc5_38.3: ref %tuple.type.e07 = tuple_access %b_ref.ref, element1
  346. // CHECK:STDOUT: %tuple.elem0.loc5_38.6: ref %i32 = tuple_access %tuple.elem1.loc5_38.3, element0
  347. // CHECK:STDOUT: %.loc5_38.9: %i32 = bind_value %tuple.elem0.loc5_38.6
  348. // CHECK:STDOUT: %tuple.elem1.loc5_38.4: ref %tuple.type.e07 = tuple_access file.%b.var, element1
  349. // CHECK:STDOUT: %tuple.elem0.loc5_38.7: ref %i32 = tuple_access %tuple.elem1.loc5_38.4, element0
  350. // CHECK:STDOUT: %.loc5_38.10: init %i32 = initialize_from %.loc5_38.9 to %tuple.elem0.loc5_38.7
  351. // CHECK:STDOUT: %tuple.elem1.loc5_38.5: ref %i32 = tuple_access %tuple.elem1.loc5_38.3, element1
  352. // CHECK:STDOUT: %.loc5_38.11: %i32 = bind_value %tuple.elem1.loc5_38.5
  353. // CHECK:STDOUT: %tuple.elem1.loc5_38.6: ref %i32 = tuple_access %tuple.elem1.loc5_38.4, element1
  354. // CHECK:STDOUT: %.loc5_38.12: init %i32 = initialize_from %.loc5_38.11 to %tuple.elem1.loc5_38.6
  355. // CHECK:STDOUT: %.loc5_38.13: init %tuple.type.e07 = tuple_init (%.loc5_38.10, %.loc5_38.12) to %tuple.elem1.loc5_38.4
  356. // CHECK:STDOUT: %.loc5_38.14: init %tuple.type.e07 = converted %tuple.elem1.loc5_38.3, %.loc5_38.13
  357. // CHECK:STDOUT: %.loc5_38.15: init %tuple.type.fce = tuple_init (%.loc5_38.8, %.loc5_38.14) to file.%b.var
  358. // CHECK:STDOUT: %.loc5_43: init %tuple.type.fce = converted %b_ref.ref, %.loc5_38.15
  359. // CHECK:STDOUT: assign file.%b.var, %.loc5_43
  360. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%import_ref.0dc [template = constants.%F]
  361. // CHECK:STDOUT: %.loc6: ref %C.fd9 = splice_block file.%c.var {}
  362. // CHECK:STDOUT: %F.call: init %C.fd9 = call %F.ref() to %.loc6
  363. // CHECK:STDOUT: assign file.%c.var, %F.call
  364. // CHECK:STDOUT: return
  365. // CHECK:STDOUT: }
  366. // CHECK:STDOUT:
  367. // CHECK:STDOUT: specific @C(constants.%X) {
  368. // CHECK:STDOUT: %X => constants.%X
  369. // CHECK:STDOUT: %X.patt => constants.%X
  370. // CHECK:STDOUT: }
  371. // CHECK:STDOUT:
  372. // CHECK:STDOUT: specific @C(constants.%tuple) {
  373. // CHECK:STDOUT: %X => constants.%tuple
  374. // CHECK:STDOUT: %X.patt => constants.%tuple
  375. // CHECK:STDOUT:
  376. // CHECK:STDOUT: !definition:
  377. // CHECK:STDOUT: }
  378. // CHECK:STDOUT:
  379. // CHECK:STDOUT: --- fail_bad_type.impl.carbon
  380. // CHECK:STDOUT:
  381. // CHECK:STDOUT: constants {
  382. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  383. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  384. // CHECK:STDOUT: %C.type: type = generic_class_type @C [template]
  385. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [template]
  386. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  387. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [template]
  388. // CHECK:STDOUT: %tuple.type.e07: type = tuple_type (%i32, %i32) [template]
  389. // CHECK:STDOUT: %X: %tuple.type.e07 = bind_symbolic_name X, 0 [symbolic]
  390. // CHECK:STDOUT: %X.patt: %tuple.type.e07 = symbolic_binding_pattern X, 0 [symbolic]
  391. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  392. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  393. // CHECK:STDOUT: %int_2.ed9: %i32 = int_value 2 [template]
  394. // CHECK:STDOUT: %int_1.059: %i32 = int_value 1 [template]
  395. // CHECK:STDOUT: %tuple: %tuple.type.e07 = tuple_value (%int_1.059, %int_2.ed9) [template]
  396. // CHECK:STDOUT: %C.fd9: type = class_type @C, @C(%tuple) [template]
  397. // CHECK:STDOUT: }
  398. // CHECK:STDOUT:
  399. // CHECK:STDOUT: imports {
  400. // CHECK:STDOUT: %import_ref.b53 = import_ref Implicit//default, a_ref, unloaded
  401. // CHECK:STDOUT: %import_ref.a35 = import_ref Implicit//default, b_ref, unloaded
  402. // CHECK:STDOUT: %import_ref.c9b: %C.type = import_ref Implicit//default, C, loaded [template = constants.%C.generic]
  403. // CHECK:STDOUT: %import_ref.0dc: %F.type = import_ref Implicit//default, F, loaded [template = constants.%F]
  404. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  405. // CHECK:STDOUT: import Core//prelude
  406. // CHECK:STDOUT: import Core//prelude/...
  407. // CHECK:STDOUT: }
  408. // CHECK:STDOUT: %import_ref.8f2: <witness> = import_ref Implicit//default, loc7_26, loaded [template = constants.%complete_type.357]
  409. // CHECK:STDOUT: %import_ref.2e0 = import_ref Implicit//default, inst1096 [no loc], unloaded
  410. // CHECK:STDOUT: }
  411. // CHECK:STDOUT:
  412. // CHECK:STDOUT: file {
  413. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  414. // CHECK:STDOUT: .a_ref = imports.%import_ref.b53
  415. // CHECK:STDOUT: .b_ref = imports.%import_ref.a35
  416. // CHECK:STDOUT: .C = imports.%import_ref.c9b
  417. // CHECK:STDOUT: .F = imports.%import_ref.0dc
  418. // CHECK:STDOUT: .Core = imports.%Core
  419. // CHECK:STDOUT: .c_bad = %c_bad
  420. // CHECK:STDOUT: }
  421. // CHECK:STDOUT: %Implicit.import = import Implicit
  422. // CHECK:STDOUT: %default.import = import <invalid>
  423. // CHECK:STDOUT: %Core.import = import Core
  424. // CHECK:STDOUT: %c_bad.var: ref <error> = var c_bad
  425. // CHECK:STDOUT: %c_bad: ref <error> = bind_name c_bad, %c_bad.var
  426. // CHECK:STDOUT: }
  427. // CHECK:STDOUT:
  428. // CHECK:STDOUT: generic class @C(constants.%X: %tuple.type.e07) [from "implicit.carbon"] {
  429. // CHECK:STDOUT: %X: %tuple.type.e07 = bind_symbolic_name X, 0 [symbolic = %X (constants.%X)]
  430. // CHECK:STDOUT: %X.patt: %tuple.type.e07 = symbolic_binding_pattern X, 0 [symbolic = %X.patt (constants.%X.patt)]
  431. // CHECK:STDOUT:
  432. // CHECK:STDOUT: !definition:
  433. // CHECK:STDOUT:
  434. // CHECK:STDOUT: class {
  435. // CHECK:STDOUT: !members:
  436. // CHECK:STDOUT: .Self = imports.%import_ref.2e0
  437. // CHECK:STDOUT: complete_type_witness = imports.%import_ref.8f2
  438. // CHECK:STDOUT: }
  439. // CHECK:STDOUT: }
  440. // CHECK:STDOUT:
  441. // CHECK:STDOUT: fn @F() -> %C.fd9 [from "implicit.carbon"];
  442. // CHECK:STDOUT:
  443. // CHECK:STDOUT: fn @__global_init() {
  444. // CHECK:STDOUT: !entry:
  445. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%import_ref.0dc [template = constants.%F]
  446. // CHECK:STDOUT: %.loc12: ref %C.fd9 = temporary_storage
  447. // CHECK:STDOUT: %F.call: init %C.fd9 = call %F.ref() to %.loc12
  448. // CHECK:STDOUT: assign file.%c_bad.var, <error>
  449. // CHECK:STDOUT: return
  450. // CHECK:STDOUT: }
  451. // CHECK:STDOUT:
  452. // CHECK:STDOUT: specific @C(constants.%X) {
  453. // CHECK:STDOUT: %X => constants.%X
  454. // CHECK:STDOUT: %X.patt => constants.%X
  455. // CHECK:STDOUT: }
  456. // CHECK:STDOUT:
  457. // CHECK:STDOUT: specific @C(constants.%tuple) {
  458. // CHECK:STDOUT: %X => constants.%tuple
  459. // CHECK:STDOUT: %X.patt => constants.%tuple
  460. // CHECK:STDOUT:
  461. // CHECK:STDOUT: !definition:
  462. // CHECK:STDOUT: }
  463. // CHECK:STDOUT:
  464. // CHECK:STDOUT: --- fail_bad_value.impl.carbon
  465. // CHECK:STDOUT:
  466. // CHECK:STDOUT: constants {
  467. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  468. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  469. // CHECK:STDOUT: %C.type: type = generic_class_type @C [template]
  470. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [template]
  471. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  472. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [template]
  473. // CHECK:STDOUT: %tuple.type.e07: type = tuple_type (%i32, %i32) [template]
  474. // CHECK:STDOUT: %X: %tuple.type.e07 = bind_symbolic_name X, 0 [symbolic]
  475. // CHECK:STDOUT: %X.patt: %tuple.type.e07 = symbolic_binding_pattern X, 0 [symbolic]
  476. // CHECK:STDOUT: %int_3.781: %i32 = int_value 3 [template]
  477. // CHECK:STDOUT: %int_4.1ad: %i32 = int_value 4 [template]
  478. // CHECK:STDOUT: %tuple.96b: %tuple.type.e07 = tuple_value (%int_3.781, %int_4.1ad) [template]
  479. // CHECK:STDOUT: %C.586: type = class_type @C, @C(%tuple.96b) [template]
  480. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  481. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  482. // CHECK:STDOUT: %int_2: %i32 = int_value 2 [template]
  483. // CHECK:STDOUT: %int_1: %i32 = int_value 1 [template]
  484. // CHECK:STDOUT: %tuple.b20: %tuple.type.e07 = tuple_value (%int_1, %int_2) [template]
  485. // CHECK:STDOUT: %C.fd9: type = class_type @C, @C(%tuple.b20) [template]
  486. // CHECK:STDOUT: }
  487. // CHECK:STDOUT:
  488. // CHECK:STDOUT: imports {
  489. // CHECK:STDOUT: %import_ref.b53 = import_ref Implicit//default, a_ref, unloaded
  490. // CHECK:STDOUT: %import_ref.a35 = import_ref Implicit//default, b_ref, unloaded
  491. // CHECK:STDOUT: %import_ref.c9b: %C.type = import_ref Implicit//default, C, loaded [template = constants.%C.generic]
  492. // CHECK:STDOUT: %import_ref.0dc: %F.type = import_ref Implicit//default, F, loaded [template = constants.%F]
  493. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  494. // CHECK:STDOUT: .ImplicitAs = %import_ref.edd
  495. // CHECK:STDOUT: import Core//prelude
  496. // CHECK:STDOUT: import Core//prelude/...
  497. // CHECK:STDOUT: }
  498. // CHECK:STDOUT: %import_ref.8f2: <witness> = import_ref Implicit//default, loc7_26, loaded [template = constants.%complete_type.357]
  499. // CHECK:STDOUT: %import_ref.2e0 = import_ref Implicit//default, inst1096 [no loc], unloaded
  500. // CHECK:STDOUT: }
  501. // CHECK:STDOUT:
  502. // CHECK:STDOUT: file {
  503. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  504. // CHECK:STDOUT: .a_ref = imports.%import_ref.b53
  505. // CHECK:STDOUT: .b_ref = imports.%import_ref.a35
  506. // CHECK:STDOUT: .C = imports.%import_ref.c9b
  507. // CHECK:STDOUT: .F = imports.%import_ref.0dc
  508. // CHECK:STDOUT: .Core = imports.%Core
  509. // CHECK:STDOUT: .c_bad = %c_bad
  510. // CHECK:STDOUT: }
  511. // CHECK:STDOUT: %Implicit.import = import Implicit
  512. // CHECK:STDOUT: %default.import = import <invalid>
  513. // CHECK:STDOUT: %Core.import = import Core
  514. // CHECK:STDOUT: %c_bad.var: ref %C.586 = var c_bad
  515. // CHECK:STDOUT: %c_bad: ref %C.586 = bind_name c_bad, %c_bad.var
  516. // CHECK:STDOUT: }
  517. // CHECK:STDOUT:
  518. // CHECK:STDOUT: generic class @C(constants.%X: %tuple.type.e07) [from "implicit.carbon"] {
  519. // CHECK:STDOUT: %X: %tuple.type.e07 = bind_symbolic_name X, 0 [symbolic = %X (constants.%X)]
  520. // CHECK:STDOUT: %X.patt: %tuple.type.e07 = symbolic_binding_pattern X, 0 [symbolic = %X.patt (constants.%X.patt)]
  521. // CHECK:STDOUT:
  522. // CHECK:STDOUT: !definition:
  523. // CHECK:STDOUT:
  524. // CHECK:STDOUT: class {
  525. // CHECK:STDOUT: !members:
  526. // CHECK:STDOUT: .Self = imports.%import_ref.2e0
  527. // CHECK:STDOUT: complete_type_witness = imports.%import_ref.8f2
  528. // CHECK:STDOUT: }
  529. // CHECK:STDOUT: }
  530. // CHECK:STDOUT:
  531. // CHECK:STDOUT: fn @F() -> %C.fd9 [from "implicit.carbon"];
  532. // CHECK:STDOUT:
  533. // CHECK:STDOUT: fn @__global_init() {
  534. // CHECK:STDOUT: !entry:
  535. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%import_ref.0dc [template = constants.%F]
  536. // CHECK:STDOUT: %.loc10_26: ref %C.fd9 = temporary_storage
  537. // CHECK:STDOUT: %F.call: init %C.fd9 = call %F.ref() to %.loc10_26
  538. // CHECK:STDOUT: %.loc10_27: %C.586 = converted %F.call, <error> [template = <error>]
  539. // CHECK:STDOUT: assign file.%c_bad.var, <error>
  540. // CHECK:STDOUT: return
  541. // CHECK:STDOUT: }
  542. // CHECK:STDOUT:
  543. // CHECK:STDOUT: specific @C(constants.%X) {
  544. // CHECK:STDOUT: %X => constants.%X
  545. // CHECK:STDOUT: %X.patt => constants.%X
  546. // CHECK:STDOUT: }
  547. // CHECK:STDOUT:
  548. // CHECK:STDOUT: specific @C(constants.%tuple.96b) {
  549. // CHECK:STDOUT: %X => constants.%tuple.96b
  550. // CHECK:STDOUT: %X.patt => constants.%tuple.96b
  551. // CHECK:STDOUT:
  552. // CHECK:STDOUT: !definition:
  553. // CHECK:STDOUT: }
  554. // CHECK:STDOUT:
  555. // CHECK:STDOUT: specific @C(constants.%tuple.b20) {
  556. // CHECK:STDOUT: %X => constants.%tuple.b20
  557. // CHECK:STDOUT: %X.patt => constants.%tuple.b20
  558. // CHECK:STDOUT:
  559. // CHECK:STDOUT: !definition:
  560. // CHECK:STDOUT: }
  561. // CHECK:STDOUT: