complete_in_conversion.carbon 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  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/class/generic/complete_in_conversion.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/generic/complete_in_conversion.carbon
  14. // --- fail_derived_to_base.carbon
  15. fn Int(N: Core.IntLiteral()) -> type = "int.make_type_signed";
  16. base class B {}
  17. class A(N:! i32) {
  18. extend base: B;
  19. // CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+3]]:10: error: integer type width of 0 is not positive [IntWidthNotPositive]
  20. // CHECK:STDERR: var n: Int(N);
  21. // CHECK:STDERR: ^~~~~~
  22. var n: Int(N);
  23. }
  24. fn F(a: A(0)*) {
  25. // CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+4]]:15: note: in `A(0)` used here [ResolvingSpecificHere]
  26. // CHECK:STDERR: let b: B* = a;
  27. // CHECK:STDERR: ^
  28. // CHECK:STDERR:
  29. let b: B* = a;
  30. }
  31. // CHECK:STDOUT: --- fail_derived_to_base.carbon
  32. // CHECK:STDOUT:
  33. // CHECK:STDOUT: constants {
  34. // CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [concrete]
  35. // CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [concrete]
  36. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  37. // CHECK:STDOUT: %pattern_type.dc0: type = pattern_type Core.IntLiteral [concrete]
  38. // CHECK:STDOUT: %Int.type.913: type = fn_type @Int.loc2 [concrete]
  39. // CHECK:STDOUT: %Int.779: %Int.type.913 = struct_value () [concrete]
  40. // CHECK:STDOUT: %B: type = class_type @B [concrete]
  41. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  42. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  43. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  44. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self]
  45. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  46. // CHECK:STDOUT: %Int.type.878: type = generic_class_type @Int.1 [concrete]
  47. // CHECK:STDOUT: %Int.generic: %Int.type.878 = struct_value () [concrete]
  48. // CHECK:STDOUT: %i32: type = class_type @Int.1, @Int.1(%int_32) [concrete]
  49. // CHECK:STDOUT: %N.fe8: %i32 = symbolic_binding N, 0 [symbolic]
  50. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  51. // CHECK:STDOUT: %A.type: type = generic_class_type @A [concrete]
  52. // CHECK:STDOUT: %A.generic: %A.type = struct_value () [concrete]
  53. // CHECK:STDOUT: %A.496: type = class_type @A, @A(%N.fe8) [symbolic]
  54. // CHECK:STDOUT: %A.elem.57d: type = unbound_element_type %A.496, %B [symbolic]
  55. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  56. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  57. // CHECK:STDOUT: %ImplicitAs.type.7a9: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [concrete]
  58. // CHECK:STDOUT: %ImplicitAs.Convert.type.71e: type = fn_type @ImplicitAs.Convert, @ImplicitAs(Core.IntLiteral) [concrete]
  59. // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
  60. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic]
  61. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.2a1: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51 = struct_value () [symbolic]
  62. // CHECK:STDOUT: %From: Core.IntLiteral = symbolic_binding From, 0 [symbolic]
  63. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.type.2c2: type = fn_type @Int.as.ImplicitAs.impl.Convert, @Int.as.ImplicitAs.impl(%From) [symbolic]
  64. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.cdf: %Int.as.ImplicitAs.impl.Convert.type.2c2 = struct_value () [symbolic]
  65. // CHECK:STDOUT: %ImplicitAs.impl_witness.972: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.783, @Int.as.ImplicitAs.impl(%int_32) [concrete]
  66. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.type.592: type = fn_type @Int.as.ImplicitAs.impl.Convert, @Int.as.ImplicitAs.impl(%int_32) [concrete]
  67. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.047: %Int.as.ImplicitAs.impl.Convert.type.592 = struct_value () [concrete]
  68. // CHECK:STDOUT: %ImplicitAs.facet.64a: %ImplicitAs.type.7a9 = facet_value %i32, (%ImplicitAs.impl_witness.972) [concrete]
  69. // CHECK:STDOUT: %.63b: type = fn_type_with_self_type %ImplicitAs.Convert.type.71e, %ImplicitAs.facet.64a [concrete]
  70. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.bound.0e0: <bound method> = bound_method %N.fe8, %Int.as.ImplicitAs.impl.Convert.047 [symbolic]
  71. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Int.as.ImplicitAs.impl.Convert.047, @Int.as.ImplicitAs.impl.Convert(%int_32) [concrete]
  72. // CHECK:STDOUT: %bound_method.490: <bound method> = bound_method %N.fe8, %Int.as.ImplicitAs.impl.Convert.specific_fn [symbolic]
  73. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.call: init Core.IntLiteral = call %bound_method.490(%N.fe8) [symbolic]
  74. // CHECK:STDOUT: %iN.builtin.3f2: type = int_type signed, %Int.as.ImplicitAs.impl.Convert.call [symbolic]
  75. // CHECK:STDOUT: %require_complete.3d7: <witness> = require_complete_type %iN.builtin.3f2 [symbolic]
  76. // CHECK:STDOUT: %A.elem.1ed: type = unbound_element_type %A.496, %iN.builtin.3f2 [symbolic]
  77. // CHECK:STDOUT: %struct_type.base.n: type = struct_type {.base: %B, .n: %iN.builtin.3f2} [symbolic]
  78. // CHECK:STDOUT: %complete_type.8ef: <witness> = complete_type_witness %struct_type.base.n [symbolic]
  79. // CHECK:STDOUT: %int_0.5c6: Core.IntLiteral = int_value 0 [concrete]
  80. // CHECK:STDOUT: %ImplicitAs.type.d14: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  81. // CHECK:STDOUT: %ImplicitAs.Convert.type.1b6: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i32) [concrete]
  82. // CHECK:STDOUT: %ImplicitAs.impl_witness.bc9: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.132, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  83. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.51e: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  84. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.51e = struct_value () [concrete]
  85. // CHECK:STDOUT: %ImplicitAs.facet.3ad: %ImplicitAs.type.d14 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.bc9) [concrete]
  86. // CHECK:STDOUT: %.322: type = fn_type_with_self_type %ImplicitAs.Convert.type.1b6, %ImplicitAs.facet.3ad [concrete]
  87. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound: <bound method> = bound_method %int_0.5c6, %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b [concrete]
  88. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b, @Core.IntLiteral.as.ImplicitAs.impl.Convert(%int_32) [concrete]
  89. // CHECK:STDOUT: %bound_method.9be: <bound method> = bound_method %int_0.5c6, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  90. // CHECK:STDOUT: %int_0.6a9: %i32 = int_value 0 [concrete]
  91. // CHECK:STDOUT: %A.6fc: type = class_type @A, @A(%int_0.6a9) [concrete]
  92. // CHECK:STDOUT: %ptr.b65: type = ptr_type %A.6fc [concrete]
  93. // CHECK:STDOUT: %pattern_type.213: type = pattern_type %ptr.b65 [concrete]
  94. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  95. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  96. // CHECK:STDOUT: %ptr.e79: type = ptr_type %B [concrete]
  97. // CHECK:STDOUT: %pattern_type.960: type = pattern_type %ptr.e79 [concrete]
  98. // CHECK:STDOUT: %A.elem.d81: type = unbound_element_type %A.6fc, %B [concrete]
  99. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.bound.c51: <bound method> = bound_method %int_0.6a9, %Int.as.ImplicitAs.impl.Convert.047 [concrete]
  100. // CHECK:STDOUT: %bound_method.27e: <bound method> = bound_method %int_0.6a9, %Int.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  101. // CHECK:STDOUT: }
  102. // CHECK:STDOUT:
  103. // CHECK:STDOUT: imports {
  104. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  105. // CHECK:STDOUT: .IntLiteral = %Core.IntLiteral
  106. // CHECK:STDOUT: .Int = %Core.Int
  107. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  108. // CHECK:STDOUT: import Core//prelude
  109. // CHECK:STDOUT: import Core//prelude/...
  110. // CHECK:STDOUT: }
  111. // CHECK:STDOUT: %Core.IntLiteral: %IntLiteral.type = import_ref Core//prelude/parts/int_literal, IntLiteral, loaded [concrete = constants.%IntLiteral]
  112. // CHECK:STDOUT: %Core.Int: %Int.type.878 = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  113. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  114. // CHECK:STDOUT: %Core.import_ref.e24: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51) = 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.2a1)]
  115. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.132 = impl_witness_table (%Core.import_ref.e24), @Core.IntLiteral.as.ImplicitAs.impl [concrete]
  116. // CHECK:STDOUT: %Core.import_ref.a86: @Int.as.ImplicitAs.impl.%Int.as.ImplicitAs.impl.Convert.type (%Int.as.ImplicitAs.impl.Convert.type.2c2) = 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.cdf)]
  117. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.783 = impl_witness_table (%Core.import_ref.a86), @Int.as.ImplicitAs.impl [concrete]
  118. // CHECK:STDOUT: }
  119. // CHECK:STDOUT:
  120. // CHECK:STDOUT: file {
  121. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  122. // CHECK:STDOUT: .Core = imports.%Core
  123. // CHECK:STDOUT: .Int = %Int.decl
  124. // CHECK:STDOUT: .B = %B.decl
  125. // CHECK:STDOUT: .A = %A.decl
  126. // CHECK:STDOUT: .F = %F.decl
  127. // CHECK:STDOUT: }
  128. // CHECK:STDOUT: %Core.import = import Core
  129. // CHECK:STDOUT: %Int.decl: %Int.type.913 = fn_decl @Int.loc2 [concrete = constants.%Int.779] {
  130. // CHECK:STDOUT: %N.patt: %pattern_type.dc0 = value_binding_pattern N [concrete]
  131. // CHECK:STDOUT: %N.param_patt: %pattern_type.dc0 = value_param_pattern %N.patt, call_param0 [concrete]
  132. // CHECK:STDOUT: %return.patt: %pattern_type.98f = return_slot_pattern [concrete]
  133. // CHECK:STDOUT: %return.param_patt: %pattern_type.98f = out_param_pattern %return.patt, call_param1 [concrete]
  134. // CHECK:STDOUT: } {
  135. // CHECK:STDOUT: %N.param: Core.IntLiteral = value_param call_param0
  136. // CHECK:STDOUT: %.loc2_27.1: type = splice_block %.loc2_27.3 [concrete = Core.IntLiteral] {
  137. // CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
  138. // CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%Core.IntLiteral [concrete = constants.%IntLiteral]
  139. // CHECK:STDOUT: %IntLiteral.call: init type = call %IntLiteral.ref() [concrete = Core.IntLiteral]
  140. // CHECK:STDOUT: %.loc2_27.2: type = value_of_initializer %IntLiteral.call [concrete = Core.IntLiteral]
  141. // CHECK:STDOUT: %.loc2_27.3: type = converted %IntLiteral.call, %.loc2_27.2 [concrete = Core.IntLiteral]
  142. // CHECK:STDOUT: }
  143. // CHECK:STDOUT: %N: Core.IntLiteral = value_binding N, %N.param
  144. // CHECK:STDOUT: %return.param: ref type = out_param call_param1
  145. // CHECK:STDOUT: %return: ref type = return_slot %return.param
  146. // CHECK:STDOUT: }
  147. // CHECK:STDOUT: %B.decl: type = class_decl @B [concrete = constants.%B] {} {}
  148. // CHECK:STDOUT: %A.decl: %A.type = class_decl @A [concrete = constants.%A.generic] {
  149. // CHECK:STDOUT: %N.patt: %pattern_type.7ce = symbolic_binding_pattern N, 0 [concrete]
  150. // CHECK:STDOUT: } {
  151. // CHECK:STDOUT: %.loc6: type = splice_block %i32 [concrete = constants.%i32] {
  152. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  153. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  154. // CHECK:STDOUT: %i32: type = class_type @Int.1, @Int.1(constants.%int_32) [concrete = constants.%i32]
  155. // CHECK:STDOUT: }
  156. // CHECK:STDOUT: %N.loc6_9.2: %i32 = symbolic_binding N, 0 [symbolic = %N.loc6_9.1 (constants.%N.fe8)]
  157. // CHECK:STDOUT: }
  158. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  159. // CHECK:STDOUT: %a.patt: %pattern_type.213 = value_binding_pattern a [concrete]
  160. // CHECK:STDOUT: %a.param_patt: %pattern_type.213 = value_param_pattern %a.patt, call_param0 [concrete]
  161. // CHECK:STDOUT: } {
  162. // CHECK:STDOUT: %a.param: %ptr.b65 = value_param call_param0
  163. // CHECK:STDOUT: %.loc15_13: type = splice_block %ptr.loc15 [concrete = constants.%ptr.b65] {
  164. // CHECK:STDOUT: %A.ref: %A.type = name_ref A, file.%A.decl [concrete = constants.%A.generic]
  165. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
  166. // CHECK:STDOUT: %impl.elem0: %.322 = impl_witness_access constants.%ImplicitAs.impl_witness.bc9, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b]
  167. // CHECK:STDOUT: %bound_method.loc15_12.1: <bound method> = bound_method %int_0, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
  168. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  169. // CHECK:STDOUT: %bound_method.loc15_12.2: <bound method> = bound_method %int_0, %specific_fn [concrete = constants.%bound_method.9be]
  170. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc15_12.2(%int_0) [concrete = constants.%int_0.6a9]
  171. // CHECK:STDOUT: %.loc15_12.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.6a9]
  172. // CHECK:STDOUT: %.loc15_12.2: %i32 = converted %int_0, %.loc15_12.1 [concrete = constants.%int_0.6a9]
  173. // CHECK:STDOUT: %A: type = class_type @A, @A(constants.%int_0.6a9) [concrete = constants.%A.6fc]
  174. // CHECK:STDOUT: %ptr.loc15: type = ptr_type %A [concrete = constants.%ptr.b65]
  175. // CHECK:STDOUT: }
  176. // CHECK:STDOUT: %a: %ptr.b65 = value_binding a, %a.param
  177. // CHECK:STDOUT: }
  178. // CHECK:STDOUT: }
  179. // CHECK:STDOUT:
  180. // CHECK:STDOUT: class @B {
  181. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357]
  182. // CHECK:STDOUT: complete_type_witness = %complete_type
  183. // CHECK:STDOUT:
  184. // CHECK:STDOUT: !members:
  185. // CHECK:STDOUT: .Self = constants.%B
  186. // CHECK:STDOUT: .Int = <poisoned>
  187. // CHECK:STDOUT: .N = <poisoned>
  188. // CHECK:STDOUT: }
  189. // CHECK:STDOUT:
  190. // CHECK:STDOUT: generic class @A(%N.loc6_9.2: %i32) {
  191. // CHECK:STDOUT: %N.loc6_9.1: %i32 = symbolic_binding N, 0 [symbolic = %N.loc6_9.1 (constants.%N.fe8)]
  192. // CHECK:STDOUT:
  193. // CHECK:STDOUT: !definition:
  194. // CHECK:STDOUT: %A: type = class_type @A, @A(%N.loc6_9.1) [symbolic = %A (constants.%A.496)]
  195. // CHECK:STDOUT: %A.elem.loc7: type = unbound_element_type %A, constants.%B [symbolic = %A.elem.loc7 (constants.%A.elem.57d)]
  196. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.bound: <bound method> = bound_method %N.loc6_9.1, constants.%Int.as.ImplicitAs.impl.Convert.047 [symbolic = %Int.as.ImplicitAs.impl.Convert.bound (constants.%Int.as.ImplicitAs.impl.Convert.bound.0e0)]
  197. // CHECK:STDOUT: %bound_method.loc12_14.3: <bound method> = bound_method %N.loc6_9.1, constants.%Int.as.ImplicitAs.impl.Convert.specific_fn [symbolic = %bound_method.loc12_14.3 (constants.%bound_method.490)]
  198. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.call.loc12_14.2: init Core.IntLiteral = call %bound_method.loc12_14.3(%N.loc6_9.1) [symbolic = %Int.as.ImplicitAs.impl.Convert.call.loc12_14.2 (constants.%Int.as.ImplicitAs.impl.Convert.call)]
  199. // CHECK:STDOUT: %iN.builtin: type = int_type signed, %Int.as.ImplicitAs.impl.Convert.call.loc12_14.2 [symbolic = %iN.builtin (constants.%iN.builtin.3f2)]
  200. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %iN.builtin [symbolic = %require_complete (constants.%require_complete.3d7)]
  201. // CHECK:STDOUT: %A.elem.loc12: type = unbound_element_type %A, %iN.builtin [symbolic = %A.elem.loc12 (constants.%A.elem.1ed)]
  202. // CHECK:STDOUT: %struct_type.base.n: type = struct_type {.base: %B, .n: @A.%iN.builtin (%iN.builtin.3f2)} [symbolic = %struct_type.base.n (constants.%struct_type.base.n)]
  203. // CHECK:STDOUT: %complete_type.loc13_1.2: <witness> = complete_type_witness %struct_type.base.n [symbolic = %complete_type.loc13_1.2 (constants.%complete_type.8ef)]
  204. // CHECK:STDOUT:
  205. // CHECK:STDOUT: class {
  206. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B]
  207. // CHECK:STDOUT: %.loc7: @A.%A.elem.loc7 (%A.elem.57d) = base_decl %B.ref, element0 [concrete]
  208. // CHECK:STDOUT: %Int.ref: %Int.type.913 = name_ref Int, file.%Int.decl [concrete = constants.%Int.779]
  209. // CHECK:STDOUT: %N.ref: %i32 = name_ref N, %N.loc6_9.2 [symbolic = %N.loc6_9.1 (constants.%N.fe8)]
  210. // CHECK:STDOUT: %impl.elem0: %.63b = impl_witness_access constants.%ImplicitAs.impl_witness.972, element0 [concrete = constants.%Int.as.ImplicitAs.impl.Convert.047]
  211. // CHECK:STDOUT: %bound_method.loc12_14.1: <bound method> = bound_method %N.ref, %impl.elem0 [symbolic = %Int.as.ImplicitAs.impl.Convert.bound (constants.%Int.as.ImplicitAs.impl.Convert.bound.0e0)]
  212. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Int.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Int.as.ImplicitAs.impl.Convert.specific_fn]
  213. // CHECK:STDOUT: %bound_method.loc12_14.2: <bound method> = bound_method %N.ref, %specific_fn [symbolic = %bound_method.loc12_14.3 (constants.%bound_method.490)]
  214. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.call.loc12_14.1: init Core.IntLiteral = call %bound_method.loc12_14.2(%N.ref) [symbolic = %Int.as.ImplicitAs.impl.Convert.call.loc12_14.2 (constants.%Int.as.ImplicitAs.impl.Convert.call)]
  215. // CHECK:STDOUT: %.loc12_14.1: Core.IntLiteral = value_of_initializer %Int.as.ImplicitAs.impl.Convert.call.loc12_14.1 [symbolic = %Int.as.ImplicitAs.impl.Convert.call.loc12_14.2 (constants.%Int.as.ImplicitAs.impl.Convert.call)]
  216. // CHECK:STDOUT: %.loc12_14.2: Core.IntLiteral = converted %N.ref, %.loc12_14.1 [symbolic = %Int.as.ImplicitAs.impl.Convert.call.loc12_14.2 (constants.%Int.as.ImplicitAs.impl.Convert.call)]
  217. // CHECK:STDOUT: %Int.call: init type = call %Int.ref(%.loc12_14.2) [symbolic = %iN.builtin (constants.%iN.builtin.3f2)]
  218. // CHECK:STDOUT: %.loc12_15.1: type = value_of_initializer %Int.call [symbolic = %iN.builtin (constants.%iN.builtin.3f2)]
  219. // CHECK:STDOUT: %.loc12_15.2: type = converted %Int.call, %.loc12_15.1 [symbolic = %iN.builtin (constants.%iN.builtin.3f2)]
  220. // CHECK:STDOUT: %.loc12_8: @A.%A.elem.loc12 (%A.elem.1ed) = field_decl n, element1 [concrete]
  221. // CHECK:STDOUT: %complete_type.loc13_1.1: <witness> = complete_type_witness constants.%struct_type.base.n [symbolic = %complete_type.loc13_1.2 (constants.%complete_type.8ef)]
  222. // CHECK:STDOUT: complete_type_witness = %complete_type.loc13_1.1
  223. // CHECK:STDOUT:
  224. // CHECK:STDOUT: !members:
  225. // CHECK:STDOUT: .Self = constants.%A.496
  226. // CHECK:STDOUT: .B = <poisoned>
  227. // CHECK:STDOUT: .base = %.loc7
  228. // CHECK:STDOUT: .Int = <poisoned>
  229. // CHECK:STDOUT: .N = <poisoned>
  230. // CHECK:STDOUT: .n = %.loc12_8
  231. // CHECK:STDOUT: extend %B.ref
  232. // CHECK:STDOUT: }
  233. // CHECK:STDOUT: }
  234. // CHECK:STDOUT:
  235. // CHECK:STDOUT: fn @Int.loc2(%N.param: Core.IntLiteral) -> type = "int.make_type_signed";
  236. // CHECK:STDOUT:
  237. // CHECK:STDOUT: fn @F(%a.param: %ptr.b65) {
  238. // CHECK:STDOUT: !entry:
  239. // CHECK:STDOUT: name_binding_decl {
  240. // CHECK:STDOUT: %b.patt: %pattern_type.960 = value_binding_pattern b [concrete]
  241. // CHECK:STDOUT: }
  242. // CHECK:STDOUT: %a.ref: %ptr.b65 = name_ref a, %a
  243. // CHECK:STDOUT: %.loc20_11: type = splice_block %ptr.loc20 [concrete = constants.%ptr.e79] {
  244. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B]
  245. // CHECK:STDOUT: %ptr.loc20: type = ptr_type %B.ref [concrete = constants.%ptr.e79]
  246. // CHECK:STDOUT: }
  247. // CHECK:STDOUT: %.loc20_15.1: ref %A.6fc = deref %a.ref
  248. // CHECK:STDOUT: %.loc20_15.2: ref %B = class_element_access %.loc20_15.1, element0
  249. // CHECK:STDOUT: %addr: %ptr.e79 = addr_of %.loc20_15.2
  250. // CHECK:STDOUT: %.loc20_15.3: %ptr.e79 = converted %a.ref, %addr
  251. // CHECK:STDOUT: %b: %ptr.e79 = value_binding b, %.loc20_15.3
  252. // CHECK:STDOUT: return
  253. // CHECK:STDOUT: }
  254. // CHECK:STDOUT:
  255. // CHECK:STDOUT: specific @A(constants.%N.fe8) {
  256. // CHECK:STDOUT: %N.loc6_9.1 => constants.%N.fe8
  257. // CHECK:STDOUT: }
  258. // CHECK:STDOUT:
  259. // CHECK:STDOUT: specific @A(constants.%int_0.6a9) {
  260. // CHECK:STDOUT: %N.loc6_9.1 => constants.%int_0.6a9
  261. // CHECK:STDOUT:
  262. // CHECK:STDOUT: !definition:
  263. // CHECK:STDOUT: %A => constants.%A.6fc
  264. // CHECK:STDOUT: %A.elem.loc7 => constants.%A.elem.d81
  265. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.bound => constants.%Int.as.ImplicitAs.impl.Convert.bound.c51
  266. // CHECK:STDOUT: %bound_method.loc12_14.3 => constants.%bound_method.27e
  267. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.call.loc12_14.2 => constants.%int_0.5c6
  268. // CHECK:STDOUT: %iN.builtin => <error>
  269. // CHECK:STDOUT: %require_complete => <error>
  270. // CHECK:STDOUT: %A.elem.loc12 => <error>
  271. // CHECK:STDOUT: %struct_type.base.n => <error>
  272. // CHECK:STDOUT: %complete_type.loc13_1.2 => <error>
  273. // CHECK:STDOUT: }
  274. // CHECK:STDOUT: