fail_expr_category.carbon 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/int.carbon
  6. // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
  7. // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
  8. //
  9. // AUTOUPDATE
  10. // TIP: To test this file alone, run:
  11. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/index/fail_expr_category.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_expr_category.carbon
  14. fn F() -> array(i32, 3);
  15. fn G(b: array(i32, 3)) {
  16. // Indexing an array value gives a value.
  17. // CHECK:STDERR: fail_expr_category.carbon:[[@LINE+4]]:18: error: cannot take the address of non-reference expression [AddrOfNonRef]
  18. // CHECK:STDERR: var pb: i32* = &b[0];
  19. // CHECK:STDERR: ^
  20. // CHECK:STDERR:
  21. var pb: i32* = &b[0];
  22. // CHECK:STDERR: fail_expr_category.carbon:[[@LINE+4]]:3: error: expression is not assignable [AssignmentToNonAssignable]
  23. // CHECK:STDERR: b[0] = 4;
  24. // CHECK:STDERR: ^~~~
  25. // CHECK:STDERR:
  26. b[0] = 4;
  27. // Indexing an ephemeral reference (materialized from an initializing
  28. // expression) gives a value.
  29. // CHECK:STDERR: fail_expr_category.carbon:[[@LINE+4]]:18: error: cannot take the address of non-reference expression [AddrOfNonRef]
  30. // CHECK:STDERR: var pf: i32* = &F()[0];
  31. // CHECK:STDERR: ^
  32. // CHECK:STDERR:
  33. var pf: i32* = &F()[0];
  34. // CHECK:STDERR: fail_expr_category.carbon:[[@LINE+4]]:3: error: expression is not assignable [AssignmentToNonAssignable]
  35. // CHECK:STDERR: F()[0] = 4;
  36. // CHECK:STDERR: ^~~~~~
  37. // CHECK:STDERR:
  38. F()[0] = 4;
  39. }
  40. // CHECK:STDOUT: --- fail_expr_category.carbon
  41. // CHECK:STDOUT:
  42. // CHECK:STDOUT: constants {
  43. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  44. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  45. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  46. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  47. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  48. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete]
  49. // CHECK:STDOUT: %array_type: type = array_type %int_3, %i32 [concrete]
  50. // CHECK:STDOUT: %.24c: form = init_form %array_type, call_param0 [concrete]
  51. // CHECK:STDOUT: %pattern_type.5d8: type = pattern_type %array_type [concrete]
  52. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  53. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  54. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  55. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  56. // CHECK:STDOUT: %ptr.235: type = ptr_type %i32 [concrete]
  57. // CHECK:STDOUT: %pattern_type.fe8: type = pattern_type %ptr.235 [concrete]
  58. // CHECK:STDOUT: %int_0.5c6: Core.IntLiteral = int_value 0 [concrete]
  59. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  60. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  61. // CHECK:STDOUT: %ImplicitAs.type.e8c: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  62. // CHECK:STDOUT: %ImplicitAs.Convert.type.1b6: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i32) [concrete]
  63. // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
  64. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.4e6: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic]
  65. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.3c2: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.4e6 = struct_value () [symbolic]
  66. // CHECK:STDOUT: %ImplicitAs.impl_witness.6bc: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.74f, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  67. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.e0d: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  68. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.e0d = struct_value () [concrete]
  69. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.e8c = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.6bc) [concrete]
  70. // CHECK:STDOUT: %.863: type = fn_type_with_self_type %ImplicitAs.Convert.type.1b6, %ImplicitAs.facet [concrete]
  71. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.897: <bound method> = bound_method %int_0.5c6, %Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5 [concrete]
  72. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5, @Core.IntLiteral.as.ImplicitAs.impl.Convert(%int_32) [concrete]
  73. // CHECK:STDOUT: %bound_method.d2e: <bound method> = bound_method %int_0.5c6, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  74. // CHECK:STDOUT: %int_0.6a9: %i32 = int_value 0 [concrete]
  75. // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
  76. // CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete]
  77. // CHECK:STDOUT: %T.67d: type = symbolic_binding T, 0 [symbolic]
  78. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.type.2d4: type = fn_type @ptr.as.Copy.impl.Op, @ptr.as.Copy.impl(%T.67d) [symbolic]
  79. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.74e: %ptr.as.Copy.impl.Op.type.2d4 = struct_value () [symbolic]
  80. // CHECK:STDOUT: %Copy.impl_witness.843: <witness> = impl_witness imports.%Copy.impl_witness_table.c3a, @ptr.as.Copy.impl(%i32) [concrete]
  81. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.type.c3c: type = fn_type @ptr.as.Copy.impl.Op, @ptr.as.Copy.impl(%i32) [concrete]
  82. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.011: %ptr.as.Copy.impl.Op.type.c3c = struct_value () [concrete]
  83. // CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %ptr.235, (%Copy.impl_witness.843) [concrete]
  84. // CHECK:STDOUT: %.e6f: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet [concrete]
  85. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.specific_fn: <specific function> = specific_function %ptr.as.Copy.impl.Op.011, @ptr.as.Copy.impl.Op(%i32) [concrete]
  86. // CHECK:STDOUT: %int_4.0c1: Core.IntLiteral = int_value 4 [concrete]
  87. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.f0c: <bound method> = bound_method %int_4.0c1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5 [concrete]
  88. // CHECK:STDOUT: %bound_method.6d7: <bound method> = bound_method %int_4.0c1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  89. // CHECK:STDOUT: %int_4.940: %i32 = int_value 4 [concrete]
  90. // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
  91. // CHECK:STDOUT: %DestroyOp.type.3e79c2.1: type = fn_type @DestroyOp.loc41 [concrete]
  92. // CHECK:STDOUT: %DestroyOp.b0ebf8.1: %DestroyOp.type.3e79c2.1 = struct_value () [concrete]
  93. // CHECK:STDOUT: %DestroyOp.type.3e79c2.2: type = fn_type @DestroyOp.loc36 [concrete]
  94. // CHECK:STDOUT: %DestroyOp.b0ebf8.2: %DestroyOp.type.3e79c2.2 = struct_value () [concrete]
  95. // CHECK:STDOUT: }
  96. // CHECK:STDOUT:
  97. // CHECK:STDOUT: imports {
  98. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  99. // CHECK:STDOUT: .Int = %Core.Int
  100. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  101. // CHECK:STDOUT: .Copy = %Core.Copy
  102. // CHECK:STDOUT: .Destroy = %Core.Destroy
  103. // CHECK:STDOUT: import Core//prelude
  104. // CHECK:STDOUT: import Core//prelude/...
  105. // CHECK:STDOUT: }
  106. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  107. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  108. // CHECK:STDOUT: %Core.import_ref.42d: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.4e6) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.3c2)]
  109. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.74f = impl_witness_table (%Core.import_ref.42d), @Core.IntLiteral.as.ImplicitAs.impl [concrete]
  110. // CHECK:STDOUT: %Core.Copy: type = import_ref Core//prelude/parts/copy, Copy, loaded [concrete = constants.%Copy.type]
  111. // CHECK:STDOUT: %Core.import_ref.203: @ptr.as.Copy.impl.%ptr.as.Copy.impl.Op.type (%ptr.as.Copy.impl.Op.type.2d4) = import_ref Core//prelude/parts/copy, loc{{\d+_\d+}}, loaded [symbolic = @ptr.as.Copy.impl.%ptr.as.Copy.impl.Op (constants.%ptr.as.Copy.impl.Op.74e)]
  112. // CHECK:STDOUT: %Copy.impl_witness_table.c3a = impl_witness_table (%Core.import_ref.203), @ptr.as.Copy.impl [concrete]
  113. // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
  114. // CHECK:STDOUT: }
  115. // CHECK:STDOUT:
  116. // CHECK:STDOUT: file {
  117. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  118. // CHECK:STDOUT: .Core = imports.%Core
  119. // CHECK:STDOUT: .F = %F.decl
  120. // CHECK:STDOUT: .G = %G.decl
  121. // CHECK:STDOUT: }
  122. // CHECK:STDOUT: %Core.import = import Core
  123. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  124. // CHECK:STDOUT: %return.patt: %pattern_type.5d8 = return_slot_pattern [concrete]
  125. // CHECK:STDOUT: %return.param_patt: %pattern_type.5d8 = out_param_pattern %return.patt, call_param0 [concrete]
  126. // CHECK:STDOUT: } {
  127. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  128. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  129. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3]
  130. // CHECK:STDOUT: %array_type: type = array_type %int_3, %i32 [concrete = constants.%array_type]
  131. // CHECK:STDOUT: %.loc15: form = init_form %array_type, call_param0 [concrete = constants.%.24c]
  132. // CHECK:STDOUT: %return.param: ref %array_type = out_param call_param0
  133. // CHECK:STDOUT: %return: ref %array_type = return_slot %return.param
  134. // CHECK:STDOUT: }
  135. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {
  136. // CHECK:STDOUT: %b.patt: %pattern_type.5d8 = value_binding_pattern b [concrete]
  137. // CHECK:STDOUT: %b.param_patt: %pattern_type.5d8 = value_param_pattern %b.patt, call_param0 [concrete]
  138. // CHECK:STDOUT: } {
  139. // CHECK:STDOUT: %b.param: %array_type = value_param call_param0
  140. // CHECK:STDOUT: %.loc17: type = splice_block %array_type [concrete = constants.%array_type] {
  141. // CHECK:STDOUT: %int_32.loc17: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  142. // CHECK:STDOUT: %i32.loc17: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  143. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3]
  144. // CHECK:STDOUT: %array_type: type = array_type %int_3, %i32.loc17 [concrete = constants.%array_type]
  145. // CHECK:STDOUT: }
  146. // CHECK:STDOUT: %b: %array_type = value_binding b, %b.param
  147. // CHECK:STDOUT: }
  148. // CHECK:STDOUT: }
  149. // CHECK:STDOUT:
  150. // CHECK:STDOUT: fn @F() -> %return.param: %array_type;
  151. // CHECK:STDOUT:
  152. // CHECK:STDOUT: fn @G(%b.param: %array_type) {
  153. // CHECK:STDOUT: !entry:
  154. // CHECK:STDOUT: name_binding_decl {
  155. // CHECK:STDOUT: %pb.patt: %pattern_type.fe8 = ref_binding_pattern pb [concrete]
  156. // CHECK:STDOUT: %pb.var_patt: %pattern_type.fe8 = var_pattern %pb.patt [concrete]
  157. // CHECK:STDOUT: }
  158. // CHECK:STDOUT: %pb.var: ref %ptr.235 = var %pb.var_patt
  159. // CHECK:STDOUT: %b.ref.loc23: %array_type = name_ref b, %b
  160. // CHECK:STDOUT: %int_0.loc23: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
  161. // CHECK:STDOUT: %int_32.loc23_22: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  162. // CHECK:STDOUT: %i32.loc23_22: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  163. // CHECK:STDOUT: %impl.elem0.loc23_21: %.863 = impl_witness_access constants.%ImplicitAs.impl_witness.6bc, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5]
  164. // CHECK:STDOUT: %bound_method.loc23_21.1: <bound method> = bound_method %int_0.loc23, %impl.elem0.loc23_21 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.897]
  165. // CHECK:STDOUT: %specific_fn.loc23_21: <specific function> = specific_function %impl.elem0.loc23_21, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  166. // CHECK:STDOUT: %bound_method.loc23_21.2: <bound method> = bound_method %int_0.loc23, %specific_fn.loc23_21 [concrete = constants.%bound_method.d2e]
  167. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc23: init %i32 = call %bound_method.loc23_21.2(%int_0.loc23) [concrete = constants.%int_0.6a9]
  168. // CHECK:STDOUT: %.loc23_21.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc23 [concrete = constants.%int_0.6a9]
  169. // CHECK:STDOUT: %.loc23_21.2: %i32 = converted %int_0.loc23, %.loc23_21.1 [concrete = constants.%int_0.6a9]
  170. // CHECK:STDOUT: %.loc23_22.1: ref %array_type = value_as_ref %b.ref.loc23
  171. // CHECK:STDOUT: %.loc23_22.2: ref %i32 = array_index %.loc23_22.1, %.loc23_21.2
  172. // CHECK:STDOUT: %.loc23_22.3: %i32 = acquire_value %.loc23_22.2
  173. // CHECK:STDOUT: %addr.loc23: %ptr.235 = addr_of <error> [concrete = <error>]
  174. // CHECK:STDOUT: %impl.elem0.loc23_18: %.e6f = impl_witness_access constants.%Copy.impl_witness.843, element0 [concrete = constants.%ptr.as.Copy.impl.Op.011]
  175. // CHECK:STDOUT: %bound_method.loc23_18.1: <bound method> = bound_method %addr.loc23, %impl.elem0.loc23_18 [concrete = <error>]
  176. // CHECK:STDOUT: %specific_fn.loc23_18: <specific function> = specific_function %impl.elem0.loc23_18, @ptr.as.Copy.impl.Op(constants.%i32) [concrete = constants.%ptr.as.Copy.impl.Op.specific_fn]
  177. // CHECK:STDOUT: %bound_method.loc23_18.2: <bound method> = bound_method %addr.loc23, %specific_fn.loc23_18 [concrete = <error>]
  178. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.call.loc23: init %ptr.235 = call %bound_method.loc23_18.2(%addr.loc23) [concrete = <error>]
  179. // CHECK:STDOUT: assign %pb.var, %ptr.as.Copy.impl.Op.call.loc23
  180. // CHECK:STDOUT: %.loc23_14: type = splice_block %ptr.loc23 [concrete = constants.%ptr.235] {
  181. // CHECK:STDOUT: %int_32.loc23_11: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  182. // CHECK:STDOUT: %i32.loc23_11: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  183. // CHECK:STDOUT: %ptr.loc23: type = ptr_type %i32.loc23_11 [concrete = constants.%ptr.235]
  184. // CHECK:STDOUT: }
  185. // CHECK:STDOUT: %pb: ref %ptr.235 = ref_binding pb, %pb.var
  186. // CHECK:STDOUT: %b.ref.loc28: %array_type = name_ref b, %b
  187. // CHECK:STDOUT: %int_0.loc28: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
  188. // CHECK:STDOUT: %int_32.loc28: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  189. // CHECK:STDOUT: %i32.loc28: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  190. // CHECK:STDOUT: %impl.elem0.loc28_5: %.863 = impl_witness_access constants.%ImplicitAs.impl_witness.6bc, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5]
  191. // CHECK:STDOUT: %bound_method.loc28_5.1: <bound method> = bound_method %int_0.loc28, %impl.elem0.loc28_5 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.897]
  192. // CHECK:STDOUT: %specific_fn.loc28_5: <specific function> = specific_function %impl.elem0.loc28_5, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  193. // CHECK:STDOUT: %bound_method.loc28_5.2: <bound method> = bound_method %int_0.loc28, %specific_fn.loc28_5 [concrete = constants.%bound_method.d2e]
  194. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc28_5: init %i32 = call %bound_method.loc28_5.2(%int_0.loc28) [concrete = constants.%int_0.6a9]
  195. // CHECK:STDOUT: %.loc28_5.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc28_5 [concrete = constants.%int_0.6a9]
  196. // CHECK:STDOUT: %.loc28_5.2: %i32 = converted %int_0.loc28, %.loc28_5.1 [concrete = constants.%int_0.6a9]
  197. // CHECK:STDOUT: %.loc28_6.1: ref %array_type = value_as_ref %b.ref.loc28
  198. // CHECK:STDOUT: %.loc28_6.2: ref %i32 = array_index %.loc28_6.1, %.loc28_5.2
  199. // CHECK:STDOUT: %.loc28_6.3: %i32 = acquire_value %.loc28_6.2
  200. // CHECK:STDOUT: %int_4.loc28: Core.IntLiteral = int_value 4 [concrete = constants.%int_4.0c1]
  201. // CHECK:STDOUT: %impl.elem0.loc28_8: %.863 = impl_witness_access constants.%ImplicitAs.impl_witness.6bc, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5]
  202. // CHECK:STDOUT: %bound_method.loc28_8.1: <bound method> = bound_method %int_4.loc28, %impl.elem0.loc28_8 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.f0c]
  203. // CHECK:STDOUT: %specific_fn.loc28_8: <specific function> = specific_function %impl.elem0.loc28_8, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  204. // CHECK:STDOUT: %bound_method.loc28_8.2: <bound method> = bound_method %int_4.loc28, %specific_fn.loc28_8 [concrete = constants.%bound_method.6d7]
  205. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc28_8: init %i32 = call %bound_method.loc28_8.2(%int_4.loc28) [concrete = constants.%int_4.940]
  206. // CHECK:STDOUT: %.loc28_8: init %i32 = converted %int_4.loc28, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc28_8 [concrete = constants.%int_4.940]
  207. // CHECK:STDOUT: assign %.loc28_6.3, %.loc28_8
  208. // CHECK:STDOUT: name_binding_decl {
  209. // CHECK:STDOUT: %pf.patt: %pattern_type.fe8 = ref_binding_pattern pf [concrete]
  210. // CHECK:STDOUT: %pf.var_patt: %pattern_type.fe8 = var_pattern %pf.patt [concrete]
  211. // CHECK:STDOUT: }
  212. // CHECK:STDOUT: %pf.var: ref %ptr.235 = var %pf.var_patt
  213. // CHECK:STDOUT: %F.ref.loc36: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
  214. // CHECK:STDOUT: %.loc36_21.1: ref %array_type = temporary_storage
  215. // CHECK:STDOUT: %F.call.loc36: init %array_type = call %F.ref.loc36() to %.loc36_21.1
  216. // CHECK:STDOUT: %int_0.loc36: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
  217. // CHECK:STDOUT: %.loc36_21.2: ref %array_type = temporary %.loc36_21.1, %F.call.loc36
  218. // CHECK:STDOUT: %int_32.loc36_24: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  219. // CHECK:STDOUT: %i32.loc36_24: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  220. // CHECK:STDOUT: %impl.elem0.loc36_23: %.863 = impl_witness_access constants.%ImplicitAs.impl_witness.6bc, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5]
  221. // CHECK:STDOUT: %bound_method.loc36_23.1: <bound method> = bound_method %int_0.loc36, %impl.elem0.loc36_23 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.897]
  222. // CHECK:STDOUT: %specific_fn.loc36_23: <specific function> = specific_function %impl.elem0.loc36_23, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  223. // CHECK:STDOUT: %bound_method.loc36_23.2: <bound method> = bound_method %int_0.loc36, %specific_fn.loc36_23 [concrete = constants.%bound_method.d2e]
  224. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc36: init %i32 = call %bound_method.loc36_23.2(%int_0.loc36) [concrete = constants.%int_0.6a9]
  225. // CHECK:STDOUT: %.loc36_23.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc36 [concrete = constants.%int_0.6a9]
  226. // CHECK:STDOUT: %.loc36_23.2: %i32 = converted %int_0.loc36, %.loc36_23.1 [concrete = constants.%int_0.6a9]
  227. // CHECK:STDOUT: %.loc36_24.1: ref %i32 = array_index %.loc36_21.2, %.loc36_23.2
  228. // CHECK:STDOUT: %.loc36_24.2: %i32 = acquire_value %.loc36_24.1
  229. // CHECK:STDOUT: %addr.loc36: %ptr.235 = addr_of <error> [concrete = <error>]
  230. // CHECK:STDOUT: %impl.elem0.loc36_18: %.e6f = impl_witness_access constants.%Copy.impl_witness.843, element0 [concrete = constants.%ptr.as.Copy.impl.Op.011]
  231. // CHECK:STDOUT: %bound_method.loc36_18.1: <bound method> = bound_method %addr.loc36, %impl.elem0.loc36_18 [concrete = <error>]
  232. // CHECK:STDOUT: %specific_fn.loc36_18: <specific function> = specific_function %impl.elem0.loc36_18, @ptr.as.Copy.impl.Op(constants.%i32) [concrete = constants.%ptr.as.Copy.impl.Op.specific_fn]
  233. // CHECK:STDOUT: %bound_method.loc36_18.2: <bound method> = bound_method %addr.loc36, %specific_fn.loc36_18 [concrete = <error>]
  234. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.call.loc36: init %ptr.235 = call %bound_method.loc36_18.2(%addr.loc36) [concrete = <error>]
  235. // CHECK:STDOUT: assign %pf.var, %ptr.as.Copy.impl.Op.call.loc36
  236. // CHECK:STDOUT: %.loc36_14: type = splice_block %ptr.loc36 [concrete = constants.%ptr.235] {
  237. // CHECK:STDOUT: %int_32.loc36_11: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  238. // CHECK:STDOUT: %i32.loc36_11: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  239. // CHECK:STDOUT: %ptr.loc36: type = ptr_type %i32.loc36_11 [concrete = constants.%ptr.235]
  240. // CHECK:STDOUT: }
  241. // CHECK:STDOUT: %pf: ref %ptr.235 = ref_binding pf, %pf.var
  242. // CHECK:STDOUT: %F.ref.loc41: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
  243. // CHECK:STDOUT: %.loc41_5.1: ref %array_type = temporary_storage
  244. // CHECK:STDOUT: %F.call.loc41: init %array_type = call %F.ref.loc41() to %.loc41_5.1
  245. // CHECK:STDOUT: %int_0.loc41: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
  246. // CHECK:STDOUT: %.loc41_5.2: ref %array_type = temporary %.loc41_5.1, %F.call.loc41
  247. // CHECK:STDOUT: %int_32.loc41: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  248. // CHECK:STDOUT: %i32.loc41: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  249. // CHECK:STDOUT: %impl.elem0.loc41_7: %.863 = impl_witness_access constants.%ImplicitAs.impl_witness.6bc, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5]
  250. // CHECK:STDOUT: %bound_method.loc41_7.1: <bound method> = bound_method %int_0.loc41, %impl.elem0.loc41_7 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.897]
  251. // CHECK:STDOUT: %specific_fn.loc41_7: <specific function> = specific_function %impl.elem0.loc41_7, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  252. // CHECK:STDOUT: %bound_method.loc41_7.2: <bound method> = bound_method %int_0.loc41, %specific_fn.loc41_7 [concrete = constants.%bound_method.d2e]
  253. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc41_7: init %i32 = call %bound_method.loc41_7.2(%int_0.loc41) [concrete = constants.%int_0.6a9]
  254. // CHECK:STDOUT: %.loc41_7.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc41_7 [concrete = constants.%int_0.6a9]
  255. // CHECK:STDOUT: %.loc41_7.2: %i32 = converted %int_0.loc41, %.loc41_7.1 [concrete = constants.%int_0.6a9]
  256. // CHECK:STDOUT: %.loc41_8.1: ref %i32 = array_index %.loc41_5.2, %.loc41_7.2
  257. // CHECK:STDOUT: %.loc41_8.2: %i32 = acquire_value %.loc41_8.1
  258. // CHECK:STDOUT: %int_4.loc41: Core.IntLiteral = int_value 4 [concrete = constants.%int_4.0c1]
  259. // CHECK:STDOUT: %impl.elem0.loc41_10: %.863 = impl_witness_access constants.%ImplicitAs.impl_witness.6bc, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5]
  260. // CHECK:STDOUT: %bound_method.loc41_10.1: <bound method> = bound_method %int_4.loc41, %impl.elem0.loc41_10 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.f0c]
  261. // CHECK:STDOUT: %specific_fn.loc41_10: <specific function> = specific_function %impl.elem0.loc41_10, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  262. // CHECK:STDOUT: %bound_method.loc41_10.2: <bound method> = bound_method %int_4.loc41, %specific_fn.loc41_10 [concrete = constants.%bound_method.6d7]
  263. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc41_10: init %i32 = call %bound_method.loc41_10.2(%int_4.loc41) [concrete = constants.%int_4.940]
  264. // CHECK:STDOUT: %.loc41_10: init %i32 = converted %int_4.loc41, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc41_10 [concrete = constants.%int_4.940]
  265. // CHECK:STDOUT: assign %.loc41_8.2, %.loc41_10
  266. // CHECK:STDOUT: %DestroyOp.bound.loc41: <bound method> = bound_method %.loc41_5.2, constants.%DestroyOp.b0ebf8.1
  267. // CHECK:STDOUT: %DestroyOp.call.loc41: init %empty_tuple.type = call %DestroyOp.bound.loc41(%.loc41_5.2)
  268. // CHECK:STDOUT: %DestroyOp.bound.loc36_21: <bound method> = bound_method %.loc36_21.2, constants.%DestroyOp.b0ebf8.1
  269. // CHECK:STDOUT: %DestroyOp.call.loc36_21: init %empty_tuple.type = call %DestroyOp.bound.loc36_21(%.loc36_21.2)
  270. // CHECK:STDOUT: %DestroyOp.bound.loc36_3: <bound method> = bound_method %pf.var, constants.%DestroyOp.b0ebf8.2
  271. // CHECK:STDOUT: %DestroyOp.call.loc36_3: init %empty_tuple.type = call %DestroyOp.bound.loc36_3(%pf.var)
  272. // CHECK:STDOUT: %DestroyOp.bound.loc23: <bound method> = bound_method %pb.var, constants.%DestroyOp.b0ebf8.2
  273. // CHECK:STDOUT: %DestroyOp.call.loc23: init %empty_tuple.type = call %DestroyOp.bound.loc23(%pb.var)
  274. // CHECK:STDOUT: return
  275. // CHECK:STDOUT: }
  276. // CHECK:STDOUT:
  277. // CHECK:STDOUT: fn @DestroyOp.loc41(%self.param: %array_type) = "no_op";
  278. // CHECK:STDOUT:
  279. // CHECK:STDOUT: fn @DestroyOp.loc36(%self.param: %ptr.235) = "no_op";
  280. // CHECK:STDOUT: