method.carbon 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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/function/builtin/method.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/builtin/method.carbon
  14. interface I {
  15. fn F[self: Self](other: Self) -> Self;
  16. }
  17. impl i32 as I {
  18. fn F[self: i32](other: i32) -> i32 = "int.sadd";
  19. }
  20. var arr: array(i32, (1 as i32).(I.F)(2));
  21. // CHECK:STDOUT: --- method.carbon
  22. // CHECK:STDOUT:
  23. // CHECK:STDOUT: constants {
  24. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  25. // CHECK:STDOUT: %Self.7ee: %I.type = bind_symbolic_name Self, 0 [symbolic]
  26. // CHECK:STDOUT: %Self.binding.as_type.1b7: type = symbolic_binding_type Self, 0, %Self.7ee [symbolic]
  27. // CHECK:STDOUT: %pattern_type.3f7: type = pattern_type %Self.binding.as_type.1b7 [symbolic]
  28. // CHECK:STDOUT: %I.F.type: type = fn_type @I.F [concrete]
  29. // CHECK:STDOUT: %I.F: %I.F.type = struct_value () [concrete]
  30. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  31. // CHECK:STDOUT: %assoc0.82e: %I.assoc_type = assoc_entity element0, @I.%I.F.decl [concrete]
  32. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  33. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  34. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  35. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  36. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness file.%I.impl_witness_table [concrete]
  37. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  38. // CHECK:STDOUT: %i32.as.I.impl.F.type: type = fn_type @i32.as.I.impl.F [concrete]
  39. // CHECK:STDOUT: %i32.as.I.impl.F: %i32.as.I.impl.F.type = struct_value () [concrete]
  40. // CHECK:STDOUT: %I.facet: %I.type = facet_value %i32, (%I.impl_witness) [concrete]
  41. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  42. // CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete]
  43. // CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete]
  44. // CHECK:STDOUT: %As.type.dbd: type = facet_type <@As, @As(%i32)> [concrete]
  45. // CHECK:STDOUT: %As.Convert.type.99b: type = fn_type @As.Convert, @As(%i32) [concrete]
  46. // CHECK:STDOUT: %To: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  47. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.565: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%To) [symbolic]
  48. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.d2c: %Core.IntLiteral.as.As.impl.Convert.type.565 = struct_value () [symbolic]
  49. // CHECK:STDOUT: %From: Core.IntLiteral = bind_symbolic_name From, 0 [symbolic]
  50. // CHECK:STDOUT: %As.impl_witness.080: <witness> = impl_witness imports.%As.impl_witness_table.5ad, @Core.IntLiteral.as.As.impl(%int_32) [concrete]
  51. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.aaf: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%int_32) [concrete]
  52. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.414: %Core.IntLiteral.as.As.impl.Convert.type.aaf = struct_value () [concrete]
  53. // CHECK:STDOUT: %As.facet: %As.type.dbd = facet_value Core.IntLiteral, (%As.impl_witness.080) [concrete]
  54. // CHECK:STDOUT: %.351: type = fn_type_with_self_type %As.Convert.type.99b, %As.facet [concrete]
  55. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.bound: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.414 [concrete]
  56. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.As.impl.Convert.414, @Core.IntLiteral.as.As.impl.Convert(%int_32) [concrete]
  57. // CHECK:STDOUT: %bound_method.fb8: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.specific_fn [concrete]
  58. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  59. // CHECK:STDOUT: %.e0f: type = fn_type_with_self_type %I.F.type, %I.facet [concrete]
  60. // CHECK:STDOUT: %i32.as.I.impl.F.bound: <bound method> = bound_method %int_1.5d2, %i32.as.I.impl.F [concrete]
  61. // CHECK:STDOUT: %int_2.ecc: Core.IntLiteral = int_value 2 [concrete]
  62. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  63. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  64. // CHECK:STDOUT: %ImplicitAs.type.d14: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  65. // CHECK:STDOUT: %ImplicitAs.Convert.type.1b6: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i32) [concrete]
  66. // 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]
  67. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.1c0: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.340 = struct_value () [symbolic]
  68. // CHECK:STDOUT: %ImplicitAs.type.7a9: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [concrete]
  69. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.type.543: type = fn_type @Int.as.ImplicitAs.impl.Convert, @Int.as.ImplicitAs.impl(%From) [symbolic]
  70. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.c08: %Int.as.ImplicitAs.impl.Convert.type.543 = struct_value () [symbolic]
  71. // CHECK:STDOUT: %ImplicitAs.Convert.type.71e: type = fn_type @ImplicitAs.Convert, @ImplicitAs(Core.IntLiteral) [concrete]
  72. // CHECK:STDOUT: %ImplicitAs.impl_witness.204: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.9e9, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  73. // 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]
  74. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.0f0: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.584 = struct_value () [concrete]
  75. // CHECK:STDOUT: %ImplicitAs.facet.7f1: %ImplicitAs.type.d14 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.204) [concrete]
  76. // CHECK:STDOUT: %.1df: type = fn_type_with_self_type %ImplicitAs.Convert.type.1b6, %ImplicitAs.facet.7f1 [concrete]
  77. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound: <bound method> = bound_method %int_2.ecc, %Core.IntLiteral.as.ImplicitAs.impl.Convert.0f0 [concrete]
  78. // 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]
  79. // CHECK:STDOUT: %bound_method.8bd: <bound method> = bound_method %int_2.ecc, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  80. // CHECK:STDOUT: %int_2.ef8: %i32 = int_value 2 [concrete]
  81. // CHECK:STDOUT: %int_3.822: %i32 = int_value 3 [concrete]
  82. // CHECK:STDOUT: %ImplicitAs.impl_witness.6bf: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.e99, @Int.as.ImplicitAs.impl(%int_32) [concrete]
  83. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.type.516: type = fn_type @Int.as.ImplicitAs.impl.Convert, @Int.as.ImplicitAs.impl(%int_32) [concrete]
  84. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.b09: %Int.as.ImplicitAs.impl.Convert.type.516 = struct_value () [concrete]
  85. // CHECK:STDOUT: %ImplicitAs.facet.1a1: %ImplicitAs.type.7a9 = facet_value %i32, (%ImplicitAs.impl_witness.6bf) [concrete]
  86. // CHECK:STDOUT: %.81e: type = fn_type_with_self_type %ImplicitAs.Convert.type.71e, %ImplicitAs.facet.1a1 [concrete]
  87. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.bound: <bound method> = bound_method %int_3.822, %Int.as.ImplicitAs.impl.Convert.b09 [concrete]
  88. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Int.as.ImplicitAs.impl.Convert.b09, @Int.as.ImplicitAs.impl.Convert(%int_32) [concrete]
  89. // CHECK:STDOUT: %bound_method.e83: <bound method> = bound_method %int_3.822, %Int.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  90. // CHECK:STDOUT: %int_3.1ba: Core.IntLiteral = int_value 3 [concrete]
  91. // CHECK:STDOUT: %array_type: type = array_type %int_3.1ba, %i32 [concrete]
  92. // CHECK:STDOUT: %pattern_type.5d8: type = pattern_type %array_type [concrete]
  93. // CHECK:STDOUT: }
  94. // CHECK:STDOUT:
  95. // CHECK:STDOUT: imports {
  96. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  97. // CHECK:STDOUT: .Int = %Core.Int
  98. // CHECK:STDOUT: .As = %Core.As
  99. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  100. // CHECK:STDOUT: import Core//prelude
  101. // CHECK:STDOUT: import Core//prelude/...
  102. // CHECK:STDOUT: }
  103. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  104. // CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/parts/as, As, loaded [concrete = constants.%As.generic]
  105. // CHECK:STDOUT: %Core.import_ref.99c: @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert.type (%Core.IntLiteral.as.As.impl.Convert.type.565) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert (constants.%Core.IntLiteral.as.As.impl.Convert.d2c)]
  106. // CHECK:STDOUT: %As.impl_witness_table.5ad = impl_witness_table (%Core.import_ref.99c), @Core.IntLiteral.as.As.impl [concrete]
  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.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, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.1c0)]
  109. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.9e9 = impl_witness_table (%Core.import_ref.ee7), @Core.IntLiteral.as.ImplicitAs.impl [concrete]
  110. // CHECK:STDOUT: %Core.import_ref.25c: @Int.as.ImplicitAs.impl.%Int.as.ImplicitAs.impl.Convert.type (%Int.as.ImplicitAs.impl.Convert.type.543) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Int.as.ImplicitAs.impl.%Int.as.ImplicitAs.impl.Convert (constants.%Int.as.ImplicitAs.impl.Convert.c08)]
  111. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.e99 = impl_witness_table (%Core.import_ref.25c), @Int.as.ImplicitAs.impl [concrete]
  112. // CHECK:STDOUT: }
  113. // CHECK:STDOUT:
  114. // CHECK:STDOUT: file {
  115. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  116. // CHECK:STDOUT: .Core = imports.%Core
  117. // CHECK:STDOUT: .I = %I.decl
  118. // CHECK:STDOUT: .arr = %arr
  119. // CHECK:STDOUT: }
  120. // CHECK:STDOUT: %Core.import = import Core
  121. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  122. // CHECK:STDOUT: impl_decl @i32.as.I.impl [concrete] {} {
  123. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  124. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  125. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  126. // CHECK:STDOUT: }
  127. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (@i32.as.I.impl.%i32.as.I.impl.F.decl), @i32.as.I.impl [concrete]
  128. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness]
  129. // CHECK:STDOUT: name_binding_decl {
  130. // CHECK:STDOUT: %arr.patt: %pattern_type.5d8 = binding_pattern arr [concrete]
  131. // CHECK:STDOUT: %arr.var_patt: %pattern_type.5d8 = var_pattern %arr.patt [concrete]
  132. // CHECK:STDOUT: }
  133. // CHECK:STDOUT: %arr.var: ref %array_type = var %arr.var_patt [concrete]
  134. // CHECK:STDOUT: %.loc23_40: type = splice_block %array_type [concrete = constants.%array_type] {
  135. // CHECK:STDOUT: %int_32.loc23_16: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  136. // CHECK:STDOUT: %i32.loc23_16: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  137. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  138. // CHECK:STDOUT: %int_32.loc23_27: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  139. // CHECK:STDOUT: %i32.loc23_27: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  140. // CHECK:STDOUT: %impl.elem0.loc23_24: %.351 = impl_witness_access constants.%As.impl_witness.080, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.414]
  141. // CHECK:STDOUT: %bound_method.loc23_24.1: <bound method> = bound_method %int_1, %impl.elem0.loc23_24 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound]
  142. // CHECK:STDOUT: %specific_fn.loc23_24: <specific function> = specific_function %impl.elem0.loc23_24, @Core.IntLiteral.as.As.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.specific_fn]
  143. // CHECK:STDOUT: %bound_method.loc23_24.2: <bound method> = bound_method %int_1, %specific_fn.loc23_24 [concrete = constants.%bound_method.fb8]
  144. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call: init %i32 = call %bound_method.loc23_24.2(%int_1) [concrete = constants.%int_1.5d2]
  145. // CHECK:STDOUT: %.loc23_24.1: %i32 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call [concrete = constants.%int_1.5d2]
  146. // CHECK:STDOUT: %.loc23_24.2: %i32 = converted %int_1, %.loc23_24.1 [concrete = constants.%int_1.5d2]
  147. // CHECK:STDOUT: %I.ref: type = name_ref I, %I.decl [concrete = constants.%I.type]
  148. // CHECK:STDOUT: %F.ref: %I.assoc_type = name_ref F, @I.%assoc0 [concrete = constants.%assoc0.82e]
  149. // CHECK:STDOUT: %impl.elem0.loc23_31: %.e0f = impl_witness_access constants.%I.impl_witness, element0 [concrete = constants.%i32.as.I.impl.F]
  150. // CHECK:STDOUT: %bound_method.loc23_31: <bound method> = bound_method %.loc23_24.2, %impl.elem0.loc23_31 [concrete = constants.%i32.as.I.impl.F.bound]
  151. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc]
  152. // CHECK:STDOUT: %impl.elem0.loc23_38: %.1df = impl_witness_access constants.%ImplicitAs.impl_witness.204, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0f0]
  153. // CHECK:STDOUT: %bound_method.loc23_38.1: <bound method> = bound_method %int_2, %impl.elem0.loc23_38 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
  154. // CHECK:STDOUT: %specific_fn.loc23_38: <specific function> = specific_function %impl.elem0.loc23_38, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  155. // CHECK:STDOUT: %bound_method.loc23_38.2: <bound method> = bound_method %int_2, %specific_fn.loc23_38 [concrete = constants.%bound_method.8bd]
  156. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc23_38.2(%int_2) [concrete = constants.%int_2.ef8]
  157. // CHECK:STDOUT: %.loc23_38.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_2.ef8]
  158. // CHECK:STDOUT: %.loc23_38.2: %i32 = converted %int_2, %.loc23_38.1 [concrete = constants.%int_2.ef8]
  159. // CHECK:STDOUT: %i32.as.I.impl.F.call: init %i32 = call %bound_method.loc23_31(%.loc23_24.2, %.loc23_38.2) [concrete = constants.%int_3.822]
  160. // CHECK:STDOUT: %impl.elem0.loc23_39: %.81e = impl_witness_access constants.%ImplicitAs.impl_witness.6bf, element0 [concrete = constants.%Int.as.ImplicitAs.impl.Convert.b09]
  161. // CHECK:STDOUT: %bound_method.loc23_39.1: <bound method> = bound_method %i32.as.I.impl.F.call, %impl.elem0.loc23_39 [concrete = constants.%Int.as.ImplicitAs.impl.Convert.bound]
  162. // CHECK:STDOUT: %specific_fn.loc23_39: <specific function> = specific_function %impl.elem0.loc23_39, @Int.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Int.as.ImplicitAs.impl.Convert.specific_fn]
  163. // CHECK:STDOUT: %bound_method.loc23_39.2: <bound method> = bound_method %i32.as.I.impl.F.call, %specific_fn.loc23_39 [concrete = constants.%bound_method.e83]
  164. // CHECK:STDOUT: %.loc23_39.1: %i32 = value_of_initializer %i32.as.I.impl.F.call [concrete = constants.%int_3.822]
  165. // CHECK:STDOUT: %.loc23_39.2: %i32 = converted %i32.as.I.impl.F.call, %.loc23_39.1 [concrete = constants.%int_3.822]
  166. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.call: init Core.IntLiteral = call %bound_method.loc23_39.2(%.loc23_39.2) [concrete = constants.%int_3.1ba]
  167. // CHECK:STDOUT: %.loc23_39.3: Core.IntLiteral = value_of_initializer %Int.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_3.1ba]
  168. // CHECK:STDOUT: %.loc23_39.4: Core.IntLiteral = converted %i32.as.I.impl.F.call, %.loc23_39.3 [concrete = constants.%int_3.1ba]
  169. // CHECK:STDOUT: %array_type: type = array_type %.loc23_39.4, %i32.loc23_16 [concrete = constants.%array_type]
  170. // CHECK:STDOUT: }
  171. // CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var [concrete = %arr.var]
  172. // CHECK:STDOUT: }
  173. // CHECK:STDOUT:
  174. // CHECK:STDOUT: interface @I {
  175. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.7ee]
  176. // CHECK:STDOUT: %I.F.decl: %I.F.type = fn_decl @I.F [concrete = constants.%I.F] {
  177. // CHECK:STDOUT: %self.patt: @I.F.%pattern_type (%pattern_type.3f7) = binding_pattern self [concrete]
  178. // CHECK:STDOUT: %self.param_patt: @I.F.%pattern_type (%pattern_type.3f7) = value_param_pattern %self.patt, call_param0 [concrete]
  179. // CHECK:STDOUT: %other.patt: @I.F.%pattern_type (%pattern_type.3f7) = binding_pattern other [concrete]
  180. // CHECK:STDOUT: %other.param_patt: @I.F.%pattern_type (%pattern_type.3f7) = value_param_pattern %other.patt, call_param1 [concrete]
  181. // CHECK:STDOUT: %return.patt: @I.F.%pattern_type (%pattern_type.3f7) = return_slot_pattern [concrete]
  182. // CHECK:STDOUT: %return.param_patt: @I.F.%pattern_type (%pattern_type.3f7) = out_param_pattern %return.patt, call_param2 [concrete]
  183. // CHECK:STDOUT: } {
  184. // CHECK:STDOUT: %Self.ref.loc16_36: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self.7ee)]
  185. // CHECK:STDOUT: %Self.as_type.loc16_36: type = facet_access_type %Self.ref.loc16_36 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.1b7)]
  186. // CHECK:STDOUT: %.loc16_36: type = converted %Self.ref.loc16_36, %Self.as_type.loc16_36 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.1b7)]
  187. // CHECK:STDOUT: %self.param: @I.F.%Self.binding.as_type (%Self.binding.as_type.1b7) = value_param call_param0
  188. // CHECK:STDOUT: %.loc16_14.1: type = splice_block %.loc16_14.2 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.1b7)] {
  189. // CHECK:STDOUT: %Self.ref.loc16_14: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self.7ee)]
  190. // CHECK:STDOUT: %Self.as_type.loc16_14: type = facet_access_type %Self.ref.loc16_14 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.1b7)]
  191. // CHECK:STDOUT: %.loc16_14.2: type = converted %Self.ref.loc16_14, %Self.as_type.loc16_14 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.1b7)]
  192. // CHECK:STDOUT: }
  193. // CHECK:STDOUT: %self: @I.F.%Self.binding.as_type (%Self.binding.as_type.1b7) = bind_name self, %self.param
  194. // CHECK:STDOUT: %other.param: @I.F.%Self.binding.as_type (%Self.binding.as_type.1b7) = value_param call_param1
  195. // CHECK:STDOUT: %.loc16_27.1: type = splice_block %.loc16_27.2 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.1b7)] {
  196. // CHECK:STDOUT: %Self.ref.loc16_27: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self.7ee)]
  197. // CHECK:STDOUT: %Self.as_type.loc16_27: type = facet_access_type %Self.ref.loc16_27 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.1b7)]
  198. // CHECK:STDOUT: %.loc16_27.2: type = converted %Self.ref.loc16_27, %Self.as_type.loc16_27 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.1b7)]
  199. // CHECK:STDOUT: }
  200. // CHECK:STDOUT: %other: @I.F.%Self.binding.as_type (%Self.binding.as_type.1b7) = bind_name other, %other.param
  201. // CHECK:STDOUT: %return.param: ref @I.F.%Self.binding.as_type (%Self.binding.as_type.1b7) = out_param call_param2
  202. // CHECK:STDOUT: %return: ref @I.F.%Self.binding.as_type (%Self.binding.as_type.1b7) = return_slot %return.param
  203. // CHECK:STDOUT: }
  204. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %I.F.decl [concrete = constants.%assoc0.82e]
  205. // CHECK:STDOUT:
  206. // CHECK:STDOUT: !members:
  207. // CHECK:STDOUT: .Self = %Self
  208. // CHECK:STDOUT: .F = %assoc0
  209. // CHECK:STDOUT: witness = (%I.F.decl)
  210. // CHECK:STDOUT: }
  211. // CHECK:STDOUT:
  212. // CHECK:STDOUT: impl @i32.as.I.impl: %i32 as %I.ref {
  213. // CHECK:STDOUT: %i32.as.I.impl.F.decl: %i32.as.I.impl.F.type = fn_decl @i32.as.I.impl.F [concrete = constants.%i32.as.I.impl.F] {
  214. // CHECK:STDOUT: %self.patt: %pattern_type.7ce = binding_pattern self [concrete]
  215. // CHECK:STDOUT: %self.param_patt: %pattern_type.7ce = value_param_pattern %self.patt, call_param0 [concrete]
  216. // CHECK:STDOUT: %other.patt: %pattern_type.7ce = binding_pattern other [concrete]
  217. // CHECK:STDOUT: %other.param_patt: %pattern_type.7ce = value_param_pattern %other.patt, call_param1 [concrete]
  218. // CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
  219. // CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param2 [concrete]
  220. // CHECK:STDOUT: } {
  221. // CHECK:STDOUT: %int_32.loc20_34: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  222. // CHECK:STDOUT: %i32.loc20_34: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  223. // CHECK:STDOUT: %self.param: %i32 = value_param call_param0
  224. // CHECK:STDOUT: %.loc20_14: type = splice_block %i32.loc20_14 [concrete = constants.%i32] {
  225. // CHECK:STDOUT: %int_32.loc20_14: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  226. // CHECK:STDOUT: %i32.loc20_14: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  227. // CHECK:STDOUT: }
  228. // CHECK:STDOUT: %self: %i32 = bind_name self, %self.param
  229. // CHECK:STDOUT: %other.param: %i32 = value_param call_param1
  230. // CHECK:STDOUT: %.loc20_26: type = splice_block %i32.loc20_26 [concrete = constants.%i32] {
  231. // CHECK:STDOUT: %int_32.loc20_26: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  232. // CHECK:STDOUT: %i32.loc20_26: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  233. // CHECK:STDOUT: }
  234. // CHECK:STDOUT: %other: %i32 = bind_name other, %other.param
  235. // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param2
  236. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  237. // CHECK:STDOUT: }
  238. // CHECK:STDOUT:
  239. // CHECK:STDOUT: !members:
  240. // CHECK:STDOUT: .F = %i32.as.I.impl.F.decl
  241. // CHECK:STDOUT: witness = file.%I.impl_witness
  242. // CHECK:STDOUT: }
  243. // CHECK:STDOUT:
  244. // CHECK:STDOUT: generic fn @I.F(@I.%Self: %I.type) {
  245. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.7ee)]
  246. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.1b7)]
  247. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.3f7)]
  248. // CHECK:STDOUT:
  249. // CHECK:STDOUT: fn(%self.param: @I.F.%Self.binding.as_type (%Self.binding.as_type.1b7), %other.param: @I.F.%Self.binding.as_type (%Self.binding.as_type.1b7)) -> @I.F.%Self.binding.as_type (%Self.binding.as_type.1b7);
  250. // CHECK:STDOUT: }
  251. // CHECK:STDOUT:
  252. // CHECK:STDOUT: fn @i32.as.I.impl.F(%self.param: %i32, %other.param: %i32) -> %i32 = "int.sadd";
  253. // CHECK:STDOUT:
  254. // CHECK:STDOUT: specific @I.F(constants.%Self.7ee) {
  255. // CHECK:STDOUT: %Self => constants.%Self.7ee
  256. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type.1b7
  257. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.3f7
  258. // CHECK:STDOUT: }
  259. // CHECK:STDOUT:
  260. // CHECK:STDOUT: specific @I.F(constants.%I.facet) {
  261. // CHECK:STDOUT: %Self => constants.%I.facet
  262. // CHECK:STDOUT: %Self.binding.as_type => constants.%i32
  263. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.7ce
  264. // CHECK:STDOUT: }
  265. // CHECK:STDOUT: