fail_expr_category.carbon 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  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: %pattern_type.5d8: type = pattern_type %array_type [concrete]
  51. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  52. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  53. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  54. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  55. // CHECK:STDOUT: %ptr.f01: type = ptr_type %array_type [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.d14: 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 = bind_symbolic_name To, 0 [symbolic]
  64. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.340: 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.1c0: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.340 = struct_value () [symbolic]
  66. // CHECK:STDOUT: %ImplicitAs.impl_witness.204: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.9e9, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  67. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.584: 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.0f0: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.584 = struct_value () [concrete]
  69. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.d14 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.204) [concrete]
  70. // CHECK:STDOUT: %.1df: type = fn_type_with_self_type %ImplicitAs.Convert.type.1b6, %ImplicitAs.facet [concrete]
  71. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.931: <bound method> = bound_method %int_0.5c6, %Core.IntLiteral.as.ImplicitAs.impl.Convert.0f0 [concrete]
  72. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.0f0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(%int_32) [concrete]
  73. // CHECK:STDOUT: %bound_method.c25: <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.8b3: type = bind_symbolic_name T, 0 [symbolic]
  78. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.type.31f: type = fn_type @ptr.as.Copy.impl.Op, @ptr.as.Copy.impl(%T.8b3) [symbolic]
  79. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.8a8: %ptr.as.Copy.impl.Op.type.31f = struct_value () [symbolic]
  80. // CHECK:STDOUT: %Copy.impl_witness.a93: <witness> = impl_witness imports.%Copy.impl_witness_table.53c, @ptr.as.Copy.impl(%i32) [concrete]
  81. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.type.b57: type = fn_type @ptr.as.Copy.impl.Op, @ptr.as.Copy.impl(%i32) [concrete]
  82. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.9fb: %ptr.as.Copy.impl.Op.type.b57 = struct_value () [concrete]
  83. // CHECK:STDOUT: %Copy.facet.7d5: %Copy.type = facet_value %ptr.235, (%Copy.impl_witness.a93) [concrete]
  84. // CHECK:STDOUT: %.9e2: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet.7d5 [concrete]
  85. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.specific_fn: <specific function> = specific_function %ptr.as.Copy.impl.Op.9fb, @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.5bb: <bound method> = bound_method %int_4.0c1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.0f0 [concrete]
  88. // CHECK:STDOUT: %bound_method.9cd: <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: %type_where: type = facet_type <type where .Self impls <CanAggregateDestroy>> [concrete]
  92. // CHECK:STDOUT: %facet_value: %type_where = facet_value %array_type, () [concrete]
  93. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.type.ffb: type = fn_type @AggregateT.as_type.as.Destroy.impl.Op, @AggregateT.as_type.as.Destroy.impl(%facet_value) [concrete]
  94. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.e7e: %AggregateT.as_type.as.Destroy.impl.Op.type.ffb = struct_value () [concrete]
  95. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.specific_fn: <specific function> = specific_function %AggregateT.as_type.as.Destroy.impl.Op.e7e, @AggregateT.as_type.as.Destroy.impl.Op(%facet_value) [concrete]
  96. // CHECK:STDOUT: %ptr.as.Destroy.impl.Op.type.142: type = fn_type @ptr.as.Destroy.impl.Op, @ptr.as.Destroy.impl(%i32) [concrete]
  97. // CHECK:STDOUT: %ptr.as.Destroy.impl.Op.c04: %ptr.as.Destroy.impl.Op.type.142 = struct_value () [concrete]
  98. // CHECK:STDOUT: %ptr.5d5: type = ptr_type %ptr.235 [concrete]
  99. // CHECK:STDOUT: %ptr.as.Destroy.impl.Op.specific_fn: <specific function> = specific_function %ptr.as.Destroy.impl.Op.c04, @ptr.as.Destroy.impl.Op(%i32) [concrete]
  100. // CHECK:STDOUT: }
  101. // CHECK:STDOUT:
  102. // CHECK:STDOUT: imports {
  103. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  104. // CHECK:STDOUT: .Int = %Core.Int
  105. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  106. // CHECK:STDOUT: .Copy = %Core.Copy
  107. // CHECK:STDOUT: .Destroy = %Core.Destroy
  108. // CHECK:STDOUT: import Core//prelude
  109. // CHECK:STDOUT: import Core//prelude/...
  110. // CHECK:STDOUT: }
  111. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  112. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  113. // CHECK:STDOUT: %Core.import_ref.ee7: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.340) = import_ref Core//prelude/parts/int, loc23_39, loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.1c0)]
  114. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.9e9 = impl_witness_table (%Core.import_ref.ee7), @Core.IntLiteral.as.ImplicitAs.impl [concrete]
  115. // CHECK:STDOUT: %Core.Copy: type = import_ref Core//prelude/parts/copy, Copy, loaded [concrete = constants.%Copy.type]
  116. // CHECK:STDOUT: %Core.import_ref.0e4: @ptr.as.Copy.impl.%ptr.as.Copy.impl.Op.type (%ptr.as.Copy.impl.Op.type.31f) = import_ref Core//prelude/parts/copy, loc36_31, loaded [symbolic = @ptr.as.Copy.impl.%ptr.as.Copy.impl.Op (constants.%ptr.as.Copy.impl.Op.8a8)]
  117. // CHECK:STDOUT: %Copy.impl_witness_table.53c = impl_witness_table (%Core.import_ref.0e4), @ptr.as.Copy.impl [concrete]
  118. // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
  119. // CHECK:STDOUT: }
  120. // CHECK:STDOUT:
  121. // CHECK:STDOUT: file {
  122. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  123. // CHECK:STDOUT: .Core = imports.%Core
  124. // CHECK:STDOUT: .F = %F.decl
  125. // CHECK:STDOUT: .G = %G.decl
  126. // CHECK:STDOUT: }
  127. // CHECK:STDOUT: %Core.import = import Core
  128. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  129. // CHECK:STDOUT: %return.patt: %pattern_type.5d8 = return_slot_pattern [concrete]
  130. // CHECK:STDOUT: %return.param_patt: %pattern_type.5d8 = out_param_pattern %return.patt, call_param0 [concrete]
  131. // CHECK:STDOUT: } {
  132. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  133. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  134. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3]
  135. // CHECK:STDOUT: %array_type: type = array_type %int_3, %i32 [concrete = constants.%array_type]
  136. // CHECK:STDOUT: %return.param: ref %array_type = out_param call_param0
  137. // CHECK:STDOUT: %return: ref %array_type = return_slot %return.param
  138. // CHECK:STDOUT: }
  139. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {
  140. // CHECK:STDOUT: %b.patt: %pattern_type.5d8 = binding_pattern b [concrete]
  141. // CHECK:STDOUT: %b.param_patt: %pattern_type.5d8 = value_param_pattern %b.patt, call_param0 [concrete]
  142. // CHECK:STDOUT: } {
  143. // CHECK:STDOUT: %b.param: %array_type = value_param call_param0
  144. // CHECK:STDOUT: %.loc17: type = splice_block %array_type [concrete = constants.%array_type] {
  145. // CHECK:STDOUT: %int_32.loc17: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  146. // CHECK:STDOUT: %i32.loc17: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  147. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3]
  148. // CHECK:STDOUT: %array_type: type = array_type %int_3, %i32.loc17 [concrete = constants.%array_type]
  149. // CHECK:STDOUT: }
  150. // CHECK:STDOUT: %b: %array_type = bind_name b, %b.param
  151. // CHECK:STDOUT: }
  152. // CHECK:STDOUT: }
  153. // CHECK:STDOUT:
  154. // CHECK:STDOUT: fn @F() -> %return.param: %array_type;
  155. // CHECK:STDOUT:
  156. // CHECK:STDOUT: fn @G(%b.param: %array_type) {
  157. // CHECK:STDOUT: !entry:
  158. // CHECK:STDOUT: name_binding_decl {
  159. // CHECK:STDOUT: %pb.patt: %pattern_type.fe8 = binding_pattern pb [concrete]
  160. // CHECK:STDOUT: %pb.var_patt: %pattern_type.fe8 = var_pattern %pb.patt [concrete]
  161. // CHECK:STDOUT: }
  162. // CHECK:STDOUT: %pb.var: ref %ptr.235 = var %pb.var_patt
  163. // CHECK:STDOUT: %b.ref.loc23: %array_type = name_ref b, %b
  164. // CHECK:STDOUT: %int_0.loc23: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
  165. // CHECK:STDOUT: %int_32.loc23_22: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  166. // CHECK:STDOUT: %i32.loc23_22: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  167. // CHECK:STDOUT: %impl.elem0.loc23_21: %.1df = impl_witness_access constants.%ImplicitAs.impl_witness.204, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0f0]
  168. // 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.931]
  169. // 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]
  170. // CHECK:STDOUT: %bound_method.loc23_21.2: <bound method> = bound_method %int_0.loc23, %specific_fn.loc23_21 [concrete = constants.%bound_method.c25]
  171. // 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]
  172. // CHECK:STDOUT: %.loc23_21.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc23 [concrete = constants.%int_0.6a9]
  173. // CHECK:STDOUT: %.loc23_21.2: %i32 = converted %int_0.loc23, %.loc23_21.1 [concrete = constants.%int_0.6a9]
  174. // CHECK:STDOUT: %.loc23_22.1: ref %array_type = value_as_ref %b.ref.loc23
  175. // CHECK:STDOUT: %.loc23_22.2: ref %i32 = array_index %.loc23_22.1, %.loc23_21.2
  176. // CHECK:STDOUT: %.loc23_22.3: %i32 = bind_value %.loc23_22.2
  177. // CHECK:STDOUT: %addr.loc23_18: %ptr.235 = addr_of <error> [concrete = <error>]
  178. // CHECK:STDOUT: %impl.elem0.loc23_18: %.9e2 = impl_witness_access constants.%Copy.impl_witness.a93, element0 [concrete = constants.%ptr.as.Copy.impl.Op.9fb]
  179. // CHECK:STDOUT: %bound_method.loc23_18.1: <bound method> = bound_method %addr.loc23_18, %impl.elem0.loc23_18 [concrete = <error>]
  180. // 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]
  181. // CHECK:STDOUT: %bound_method.loc23_18.2: <bound method> = bound_method %addr.loc23_18, %specific_fn.loc23_18 [concrete = <error>]
  182. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.call.loc23: init %ptr.235 = call %bound_method.loc23_18.2(%addr.loc23_18) [concrete = <error>]
  183. // CHECK:STDOUT: assign %pb.var, %ptr.as.Copy.impl.Op.call.loc23
  184. // CHECK:STDOUT: %.loc23_14: type = splice_block %ptr.loc23 [concrete = constants.%ptr.235] {
  185. // CHECK:STDOUT: %int_32.loc23_11: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  186. // CHECK:STDOUT: %i32.loc23_11: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  187. // CHECK:STDOUT: %ptr.loc23: type = ptr_type %i32.loc23_11 [concrete = constants.%ptr.235]
  188. // CHECK:STDOUT: }
  189. // CHECK:STDOUT: %pb: ref %ptr.235 = bind_name pb, %pb.var
  190. // CHECK:STDOUT: %b.ref.loc28: %array_type = name_ref b, %b
  191. // CHECK:STDOUT: %int_0.loc28: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
  192. // CHECK:STDOUT: %int_32.loc28: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  193. // CHECK:STDOUT: %i32.loc28: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  194. // CHECK:STDOUT: %impl.elem0.loc28_5: %.1df = impl_witness_access constants.%ImplicitAs.impl_witness.204, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0f0]
  195. // 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.931]
  196. // 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]
  197. // CHECK:STDOUT: %bound_method.loc28_5.2: <bound method> = bound_method %int_0.loc28, %specific_fn.loc28_5 [concrete = constants.%bound_method.c25]
  198. // 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]
  199. // CHECK:STDOUT: %.loc28_5.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc28_5 [concrete = constants.%int_0.6a9]
  200. // CHECK:STDOUT: %.loc28_5.2: %i32 = converted %int_0.loc28, %.loc28_5.1 [concrete = constants.%int_0.6a9]
  201. // CHECK:STDOUT: %.loc28_6.1: ref %array_type = value_as_ref %b.ref.loc28
  202. // CHECK:STDOUT: %.loc28_6.2: ref %i32 = array_index %.loc28_6.1, %.loc28_5.2
  203. // CHECK:STDOUT: %.loc28_6.3: %i32 = bind_value %.loc28_6.2
  204. // CHECK:STDOUT: %int_4.loc28: Core.IntLiteral = int_value 4 [concrete = constants.%int_4.0c1]
  205. // CHECK:STDOUT: %impl.elem0.loc28_8: %.1df = impl_witness_access constants.%ImplicitAs.impl_witness.204, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0f0]
  206. // 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.5bb]
  207. // 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]
  208. // CHECK:STDOUT: %bound_method.loc28_8.2: <bound method> = bound_method %int_4.loc28, %specific_fn.loc28_8 [concrete = constants.%bound_method.9cd]
  209. // 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]
  210. // CHECK:STDOUT: %.loc28_8: init %i32 = converted %int_4.loc28, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc28_8 [concrete = constants.%int_4.940]
  211. // CHECK:STDOUT: assign %.loc28_6.3, %.loc28_8
  212. // CHECK:STDOUT: name_binding_decl {
  213. // CHECK:STDOUT: %pf.patt: %pattern_type.fe8 = binding_pattern pf [concrete]
  214. // CHECK:STDOUT: %pf.var_patt: %pattern_type.fe8 = var_pattern %pf.patt [concrete]
  215. // CHECK:STDOUT: }
  216. // CHECK:STDOUT: %pf.var: ref %ptr.235 = var %pf.var_patt
  217. // CHECK:STDOUT: %F.ref.loc36: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
  218. // CHECK:STDOUT: %.loc36_21.1: ref %array_type = temporary_storage
  219. // CHECK:STDOUT: %F.call.loc36: init %array_type = call %F.ref.loc36() to %.loc36_21.1
  220. // CHECK:STDOUT: %int_0.loc36: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
  221. // CHECK:STDOUT: %.loc36_21.2: ref %array_type = temporary %.loc36_21.1, %F.call.loc36
  222. // CHECK:STDOUT: %int_32.loc36_24: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  223. // CHECK:STDOUT: %i32.loc36_24: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  224. // CHECK:STDOUT: %impl.elem0.loc36_23: %.1df = impl_witness_access constants.%ImplicitAs.impl_witness.204, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0f0]
  225. // 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.931]
  226. // 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]
  227. // CHECK:STDOUT: %bound_method.loc36_23.2: <bound method> = bound_method %int_0.loc36, %specific_fn.loc36_23 [concrete = constants.%bound_method.c25]
  228. // 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]
  229. // CHECK:STDOUT: %.loc36_23.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc36 [concrete = constants.%int_0.6a9]
  230. // CHECK:STDOUT: %.loc36_23.2: %i32 = converted %int_0.loc36, %.loc36_23.1 [concrete = constants.%int_0.6a9]
  231. // CHECK:STDOUT: %.loc36_24.1: ref %i32 = array_index %.loc36_21.2, %.loc36_23.2
  232. // CHECK:STDOUT: %.loc36_24.2: %i32 = bind_value %.loc36_24.1
  233. // CHECK:STDOUT: %addr.loc36_18: %ptr.235 = addr_of <error> [concrete = <error>]
  234. // CHECK:STDOUT: %impl.elem0.loc36_18: %.9e2 = impl_witness_access constants.%Copy.impl_witness.a93, element0 [concrete = constants.%ptr.as.Copy.impl.Op.9fb]
  235. // CHECK:STDOUT: %bound_method.loc36_18.1: <bound method> = bound_method %addr.loc36_18, %impl.elem0.loc36_18 [concrete = <error>]
  236. // 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]
  237. // CHECK:STDOUT: %bound_method.loc36_18.2: <bound method> = bound_method %addr.loc36_18, %specific_fn.loc36_18 [concrete = <error>]
  238. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.call.loc36: init %ptr.235 = call %bound_method.loc36_18.2(%addr.loc36_18) [concrete = <error>]
  239. // CHECK:STDOUT: assign %pf.var, %ptr.as.Copy.impl.Op.call.loc36
  240. // CHECK:STDOUT: %.loc36_14: type = splice_block %ptr.loc36 [concrete = constants.%ptr.235] {
  241. // CHECK:STDOUT: %int_32.loc36_11: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  242. // CHECK:STDOUT: %i32.loc36_11: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  243. // CHECK:STDOUT: %ptr.loc36: type = ptr_type %i32.loc36_11 [concrete = constants.%ptr.235]
  244. // CHECK:STDOUT: }
  245. // CHECK:STDOUT: %pf: ref %ptr.235 = bind_name pf, %pf.var
  246. // CHECK:STDOUT: %F.ref.loc41: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
  247. // CHECK:STDOUT: %.loc41_5.1: ref %array_type = temporary_storage
  248. // CHECK:STDOUT: %F.call.loc41: init %array_type = call %F.ref.loc41() to %.loc41_5.1
  249. // CHECK:STDOUT: %int_0.loc41: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
  250. // CHECK:STDOUT: %.loc41_5.2: ref %array_type = temporary %.loc41_5.1, %F.call.loc41
  251. // CHECK:STDOUT: %int_32.loc41: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  252. // CHECK:STDOUT: %i32.loc41: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  253. // CHECK:STDOUT: %impl.elem0.loc41_7: %.1df = impl_witness_access constants.%ImplicitAs.impl_witness.204, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0f0]
  254. // 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.931]
  255. // 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]
  256. // CHECK:STDOUT: %bound_method.loc41_7.2: <bound method> = bound_method %int_0.loc41, %specific_fn.loc41_7 [concrete = constants.%bound_method.c25]
  257. // 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]
  258. // CHECK:STDOUT: %.loc41_7.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc41_7 [concrete = constants.%int_0.6a9]
  259. // CHECK:STDOUT: %.loc41_7.2: %i32 = converted %int_0.loc41, %.loc41_7.1 [concrete = constants.%int_0.6a9]
  260. // CHECK:STDOUT: %.loc41_8.1: ref %i32 = array_index %.loc41_5.2, %.loc41_7.2
  261. // CHECK:STDOUT: %.loc41_8.2: %i32 = bind_value %.loc41_8.1
  262. // CHECK:STDOUT: %int_4.loc41: Core.IntLiteral = int_value 4 [concrete = constants.%int_4.0c1]
  263. // CHECK:STDOUT: %impl.elem0.loc41_10: %.1df = impl_witness_access constants.%ImplicitAs.impl_witness.204, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0f0]
  264. // 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.5bb]
  265. // 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]
  266. // CHECK:STDOUT: %bound_method.loc41_10.2: <bound method> = bound_method %int_4.loc41, %specific_fn.loc41_10 [concrete = constants.%bound_method.9cd]
  267. // 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]
  268. // CHECK:STDOUT: %.loc41_10: init %i32 = converted %int_4.loc41, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc41_10 [concrete = constants.%int_4.940]
  269. // CHECK:STDOUT: assign %.loc41_8.2, %.loc41_10
  270. // CHECK:STDOUT: %facet_value.loc41: %type_where = facet_value constants.%array_type, () [concrete = constants.%facet_value]
  271. // CHECK:STDOUT: %.loc41_5.3: %type_where = converted constants.%array_type, %facet_value.loc41 [concrete = constants.%facet_value]
  272. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.bound.loc41: <bound method> = bound_method %.loc41_5.2, constants.%AggregateT.as_type.as.Destroy.impl.Op.e7e
  273. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.specific_fn.1: <specific function> = specific_function constants.%AggregateT.as_type.as.Destroy.impl.Op.e7e, @AggregateT.as_type.as.Destroy.impl.Op(constants.%facet_value) [concrete = constants.%AggregateT.as_type.as.Destroy.impl.Op.specific_fn]
  274. // CHECK:STDOUT: %bound_method.loc41_5: <bound method> = bound_method %.loc41_5.2, %AggregateT.as_type.as.Destroy.impl.Op.specific_fn.1
  275. // CHECK:STDOUT: %addr.loc41: %ptr.f01 = addr_of %.loc41_5.2
  276. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.call.loc41: init %empty_tuple.type = call %bound_method.loc41_5(%addr.loc41)
  277. // CHECK:STDOUT: %facet_value.loc36: %type_where = facet_value constants.%array_type, () [concrete = constants.%facet_value]
  278. // CHECK:STDOUT: %.loc36_21.3: %type_where = converted constants.%array_type, %facet_value.loc36 [concrete = constants.%facet_value]
  279. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.bound.loc36: <bound method> = bound_method %.loc36_21.2, constants.%AggregateT.as_type.as.Destroy.impl.Op.e7e
  280. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.specific_fn.2: <specific function> = specific_function constants.%AggregateT.as_type.as.Destroy.impl.Op.e7e, @AggregateT.as_type.as.Destroy.impl.Op(constants.%facet_value) [concrete = constants.%AggregateT.as_type.as.Destroy.impl.Op.specific_fn]
  281. // CHECK:STDOUT: %bound_method.loc36_21: <bound method> = bound_method %.loc36_21.2, %AggregateT.as_type.as.Destroy.impl.Op.specific_fn.2
  282. // CHECK:STDOUT: %addr.loc36_21: %ptr.f01 = addr_of %.loc36_21.2
  283. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.call.loc36: init %empty_tuple.type = call %bound_method.loc36_21(%addr.loc36_21)
  284. // CHECK:STDOUT: %ptr.as.Destroy.impl.Op.bound.loc36: <bound method> = bound_method %pf.var, constants.%ptr.as.Destroy.impl.Op.c04
  285. // CHECK:STDOUT: %ptr.as.Destroy.impl.Op.specific_fn.1: <specific function> = specific_function constants.%ptr.as.Destroy.impl.Op.c04, @ptr.as.Destroy.impl.Op(constants.%i32) [concrete = constants.%ptr.as.Destroy.impl.Op.specific_fn]
  286. // CHECK:STDOUT: %bound_method.loc36_3: <bound method> = bound_method %pf.var, %ptr.as.Destroy.impl.Op.specific_fn.1
  287. // CHECK:STDOUT: %addr.loc36_3: %ptr.5d5 = addr_of %pf.var
  288. // CHECK:STDOUT: %ptr.as.Destroy.impl.Op.call.loc36: init %empty_tuple.type = call %bound_method.loc36_3(%addr.loc36_3)
  289. // CHECK:STDOUT: %ptr.as.Destroy.impl.Op.bound.loc23: <bound method> = bound_method %pb.var, constants.%ptr.as.Destroy.impl.Op.c04
  290. // CHECK:STDOUT: %ptr.as.Destroy.impl.Op.specific_fn.2: <specific function> = specific_function constants.%ptr.as.Destroy.impl.Op.c04, @ptr.as.Destroy.impl.Op(constants.%i32) [concrete = constants.%ptr.as.Destroy.impl.Op.specific_fn]
  291. // CHECK:STDOUT: %bound_method.loc23_3: <bound method> = bound_method %pb.var, %ptr.as.Destroy.impl.Op.specific_fn.2
  292. // CHECK:STDOUT: %addr.loc23_3: %ptr.5d5 = addr_of %pb.var
  293. // CHECK:STDOUT: %ptr.as.Destroy.impl.Op.call.loc23: init %empty_tuple.type = call %bound_method.loc23_3(%addr.loc23_3)
  294. // CHECK:STDOUT: return
  295. // CHECK:STDOUT: }
  296. // CHECK:STDOUT: