reorder_qualified.carbon 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  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/reorder_qualified.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/reorder_qualified.carbon
  14. class A {
  15. class B {
  16. class C;
  17. fn BF();
  18. var b: i32;
  19. }
  20. class B.C {
  21. class D {
  22. fn F();
  23. fn DF();
  24. var d: i32;
  25. }
  26. fn D.DF() {
  27. // A, B, C, and D are complete here.
  28. var unused a: A = {.a = 1};
  29. var unused b: B = {.b = 2};
  30. var unused c: C = {.c = 3};
  31. var unused d: D = {.d = 4};
  32. // Unqualified lookup looks in all of them.
  33. AF();
  34. BF();
  35. CF();
  36. DF();
  37. }
  38. fn CF();
  39. var c: i32;
  40. }
  41. fn AF();
  42. var a: i32;
  43. }
  44. // CHECK:STDOUT: --- reorder_qualified.carbon
  45. // CHECK:STDOUT:
  46. // CHECK:STDOUT: constants {
  47. // CHECK:STDOUT: %A: type = class_type @A [concrete]
  48. // CHECK:STDOUT: %B: type = class_type @B [concrete]
  49. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  50. // CHECK:STDOUT: %B.BF.type: type = fn_type @B.BF [concrete]
  51. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  52. // CHECK:STDOUT: %B.BF: %B.BF.type = struct_value () [concrete]
  53. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  54. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  55. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  56. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  57. // CHECK:STDOUT: %i32.builtin: type = int_type signed, %int_32 [concrete]
  58. // CHECK:STDOUT: %B.elem: type = unbound_element_type %B, %i32 [concrete]
  59. // CHECK:STDOUT: %struct_type.b.0a3: type = struct_type {.b: %i32} [concrete]
  60. // CHECK:STDOUT: %complete_type.ba8: <witness> = complete_type_witness %struct_type.b.0a3 [concrete]
  61. // CHECK:STDOUT: %D: type = class_type @D [concrete]
  62. // CHECK:STDOUT: %D.F.type: type = fn_type @D.F [concrete]
  63. // CHECK:STDOUT: %D.F: %D.F.type = struct_value () [concrete]
  64. // CHECK:STDOUT: %D.DF.type: type = fn_type @D.DF [concrete]
  65. // CHECK:STDOUT: %D.DF: %D.DF.type = struct_value () [concrete]
  66. // CHECK:STDOUT: %D.elem: type = unbound_element_type %D, %i32 [concrete]
  67. // CHECK:STDOUT: %struct_type.d.b7b: type = struct_type {.d: %i32} [concrete]
  68. // CHECK:STDOUT: %complete_type.860: <witness> = complete_type_witness %struct_type.d.b7b [concrete]
  69. // CHECK:STDOUT: %C.CF.type: type = fn_type @C.CF [concrete]
  70. // CHECK:STDOUT: %C.CF: %C.CF.type = struct_value () [concrete]
  71. // CHECK:STDOUT: %C.elem: type = unbound_element_type %C, %i32 [concrete]
  72. // CHECK:STDOUT: %struct_type.c.b66: type = struct_type {.c: %i32} [concrete]
  73. // CHECK:STDOUT: %complete_type.836: <witness> = complete_type_witness %struct_type.c.b66 [concrete]
  74. // CHECK:STDOUT: %A.AF.type: type = fn_type @A.AF [concrete]
  75. // CHECK:STDOUT: %A.AF: %A.AF.type = struct_value () [concrete]
  76. // CHECK:STDOUT: %A.elem: type = unbound_element_type %A, %i32 [concrete]
  77. // CHECK:STDOUT: %struct_type.a.ba9: type = struct_type {.a: %i32} [concrete]
  78. // CHECK:STDOUT: %complete_type.fd7: <witness> = complete_type_witness %struct_type.a.ba9 [concrete]
  79. // CHECK:STDOUT: %pattern_type.1ab: type = pattern_type %A [concrete]
  80. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  81. // CHECK:STDOUT: %struct_type.a.a6c: type = struct_type {.a: Core.IntLiteral} [concrete]
  82. // CHECK:STDOUT: %struct.48c: %struct_type.a.a6c = struct_value (%int_1.5b8) [concrete]
  83. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  84. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  85. // CHECK:STDOUT: %ImplicitAs.type.e8c: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  86. // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
  87. // 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]
  88. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.3c2: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.4e6 = struct_value () [symbolic]
  89. // CHECK:STDOUT: %ImplicitAs.impl_witness.6bc: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.74f, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  90. // 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]
  91. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.e0d = struct_value () [concrete]
  92. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.e8c = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.6bc) [concrete]
  93. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.type.b37: type = fn_type @ImplicitAs.WithSelf.Convert, @ImplicitAs.WithSelf(%i32, %ImplicitAs.facet) [concrete]
  94. // CHECK:STDOUT: %.545: type = fn_type_with_self_type %ImplicitAs.WithSelf.Convert.type.b37, %ImplicitAs.facet [concrete]
  95. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.215: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5 [concrete]
  96. // 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]
  97. // CHECK:STDOUT: %bound_method.38b: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  98. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  99. // CHECK:STDOUT: %A.val: %A = struct_value (%int_1.5d2) [concrete]
  100. // CHECK:STDOUT: %pattern_type.438: type = pattern_type %B [concrete]
  101. // CHECK:STDOUT: %int_2.ecc: Core.IntLiteral = int_value 2 [concrete]
  102. // CHECK:STDOUT: %struct_type.b.a15: type = struct_type {.b: Core.IntLiteral} [concrete]
  103. // CHECK:STDOUT: %struct.26f: %struct_type.b.a15 = struct_value (%int_2.ecc) [concrete]
  104. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.4e5: <bound method> = bound_method %int_2.ecc, %Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5 [concrete]
  105. // CHECK:STDOUT: %bound_method.646: <bound method> = bound_method %int_2.ecc, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  106. // CHECK:STDOUT: %int_2.ef8: %i32 = int_value 2 [concrete]
  107. // CHECK:STDOUT: %B.val: %B = struct_value (%int_2.ef8) [concrete]
  108. // CHECK:STDOUT: %pattern_type.d99: type = pattern_type %C [concrete]
  109. // CHECK:STDOUT: %int_3.1ba: Core.IntLiteral = int_value 3 [concrete]
  110. // CHECK:STDOUT: %struct_type.c.5b8: type = struct_type {.c: Core.IntLiteral} [concrete]
  111. // CHECK:STDOUT: %struct.d98: %struct_type.c.5b8 = struct_value (%int_3.1ba) [concrete]
  112. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.061: <bound method> = bound_method %int_3.1ba, %Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5 [concrete]
  113. // CHECK:STDOUT: %bound_method.fa7: <bound method> = bound_method %int_3.1ba, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  114. // CHECK:STDOUT: %int_3.822: %i32 = int_value 3 [concrete]
  115. // CHECK:STDOUT: %C.val: %C = struct_value (%int_3.822) [concrete]
  116. // CHECK:STDOUT: %pattern_type.be4: type = pattern_type %D [concrete]
  117. // CHECK:STDOUT: %int_4.0c1: Core.IntLiteral = int_value 4 [concrete]
  118. // CHECK:STDOUT: %struct_type.d.3ea: type = struct_type {.d: Core.IntLiteral} [concrete]
  119. // CHECK:STDOUT: %struct.5a9: %struct_type.d.3ea = struct_value (%int_4.0c1) [concrete]
  120. // 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]
  121. // CHECK:STDOUT: %bound_method.6d7: <bound method> = bound_method %int_4.0c1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  122. // CHECK:STDOUT: %int_4.940: %i32 = int_value 4 [concrete]
  123. // CHECK:STDOUT: %D.val: %D = struct_value (%int_4.940) [concrete]
  124. // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
  125. // CHECK:STDOUT: %Destroy.Op.type.bae255.4: type = fn_type @Destroy.Op.loc36_7.4 [concrete]
  126. // CHECK:STDOUT: %Destroy.Op.651ba6.4: %Destroy.Op.type.bae255.4 = struct_value () [concrete]
  127. // CHECK:STDOUT: %Destroy.Op.type.bae255.6: type = fn_type @Destroy.Op.loc35_7.2 [concrete]
  128. // CHECK:STDOUT: %Destroy.Op.651ba6.6: %Destroy.Op.type.bae255.6 = struct_value () [concrete]
  129. // CHECK:STDOUT: %Destroy.Op.type.bae255.8: type = fn_type @Destroy.Op.loc34_7.2 [concrete]
  130. // CHECK:STDOUT: %Destroy.Op.651ba6.8: %Destroy.Op.type.bae255.8 = struct_value () [concrete]
  131. // CHECK:STDOUT: %Destroy.Op.type.bae255.10: type = fn_type @Destroy.Op.loc33_7.2 [concrete]
  132. // CHECK:STDOUT: %Destroy.Op.651ba6.10: %Destroy.Op.type.bae255.10 = struct_value () [concrete]
  133. // CHECK:STDOUT: }
  134. // CHECK:STDOUT:
  135. // CHECK:STDOUT: imports {
  136. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  137. // CHECK:STDOUT: .Int = %Core.Int
  138. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  139. // CHECK:STDOUT: .Destroy = %Core.Destroy
  140. // CHECK:STDOUT: import Core//prelude
  141. // CHECK:STDOUT: import Core//prelude/...
  142. // CHECK:STDOUT: }
  143. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  144. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  145. // 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)]
  146. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.74f = impl_witness_table (%Core.import_ref.42d), @Core.IntLiteral.as.ImplicitAs.impl [concrete]
  147. // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
  148. // CHECK:STDOUT: }
  149. // CHECK:STDOUT:
  150. // CHECK:STDOUT: file {
  151. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  152. // CHECK:STDOUT: .Core = imports.%Core
  153. // CHECK:STDOUT: .A = %A.decl
  154. // CHECK:STDOUT: }
  155. // CHECK:STDOUT: %Core.import = import Core
  156. // CHECK:STDOUT: %A.decl: type = class_decl @A [concrete = constants.%A] {} {}
  157. // CHECK:STDOUT: }
  158. // CHECK:STDOUT:
  159. // CHECK:STDOUT: class @A {
  160. // CHECK:STDOUT: %B.decl: type = class_decl @B [concrete = constants.%B] {} {}
  161. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  162. // CHECK:STDOUT: %A.AF.decl: %A.AF.type = fn_decl @A.AF [concrete = constants.%A.AF] {} {}
  163. // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32]
  164. // CHECK:STDOUT: %.loc50: %A.elem = field_decl a, element0 [concrete]
  165. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%struct_type.a.ba9 [concrete = constants.%complete_type.fd7]
  166. // CHECK:STDOUT: complete_type_witness = %complete_type
  167. // CHECK:STDOUT:
  168. // CHECK:STDOUT: !members:
  169. // CHECK:STDOUT: .Self = constants.%A
  170. // CHECK:STDOUT: .B = %B.decl
  171. // CHECK:STDOUT: .AF = %A.AF.decl
  172. // CHECK:STDOUT: .a = %.loc50
  173. // CHECK:STDOUT: .A = <poisoned>
  174. // CHECK:STDOUT: }
  175. // CHECK:STDOUT:
  176. // CHECK:STDOUT: class @B {
  177. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  178. // CHECK:STDOUT: %B.BF.decl: %B.BF.type = fn_decl @B.BF [concrete = constants.%B.BF] {} {}
  179. // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32]
  180. // CHECK:STDOUT: %.loc20: %B.elem = field_decl b, element0 [concrete]
  181. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%struct_type.b.0a3 [concrete = constants.%complete_type.ba8]
  182. // CHECK:STDOUT: complete_type_witness = %complete_type
  183. // CHECK:STDOUT:
  184. // CHECK:STDOUT: !members:
  185. // CHECK:STDOUT: .Self = constants.%B
  186. // CHECK:STDOUT: .C = %C.decl
  187. // CHECK:STDOUT: .BF = %B.BF.decl
  188. // CHECK:STDOUT: .b = %.loc20
  189. // CHECK:STDOUT: .A = <poisoned>
  190. // CHECK:STDOUT: .B = <poisoned>
  191. // CHECK:STDOUT: .AF = <poisoned>
  192. // CHECK:STDOUT: }
  193. // CHECK:STDOUT:
  194. // CHECK:STDOUT: class @C {
  195. // CHECK:STDOUT: %D.decl: type = class_decl @D [concrete = constants.%D] {} {}
  196. // CHECK:STDOUT: %D.DF.decl: %D.DF.type = fn_decl @D.DF [concrete = constants.%D.DF] {} {}
  197. // CHECK:STDOUT: %C.CF.decl: %C.CF.type = fn_decl @C.CF [concrete = constants.%C.CF] {} {}
  198. // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32]
  199. // CHECK:STDOUT: %.loc46: %C.elem = field_decl c, element0 [concrete]
  200. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%struct_type.c.b66 [concrete = constants.%complete_type.836]
  201. // CHECK:STDOUT: complete_type_witness = %complete_type
  202. // CHECK:STDOUT:
  203. // CHECK:STDOUT: !members:
  204. // CHECK:STDOUT: .Self = constants.%C
  205. // CHECK:STDOUT: .D = %D.decl
  206. // CHECK:STDOUT: .CF = %C.CF.decl
  207. // CHECK:STDOUT: .c = %.loc46
  208. // CHECK:STDOUT: .A = <poisoned>
  209. // CHECK:STDOUT: .B = <poisoned>
  210. // CHECK:STDOUT: .C = <poisoned>
  211. // CHECK:STDOUT: .AF = <poisoned>
  212. // CHECK:STDOUT: .BF = <poisoned>
  213. // CHECK:STDOUT: }
  214. // CHECK:STDOUT:
  215. // CHECK:STDOUT: class @D {
  216. // CHECK:STDOUT: %D.F.decl: %D.F.type = fn_decl @D.F [concrete = constants.%D.F] {} {}
  217. // CHECK:STDOUT: %D.DF.decl: %D.DF.type = fn_decl @D.DF [concrete = constants.%D.DF] {} {}
  218. // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32]
  219. // CHECK:STDOUT: %.loc28: %D.elem = field_decl d, element0 [concrete]
  220. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%struct_type.d.b7b [concrete = constants.%complete_type.860]
  221. // CHECK:STDOUT: complete_type_witness = %complete_type
  222. // CHECK:STDOUT:
  223. // CHECK:STDOUT: !members:
  224. // CHECK:STDOUT: .Self = constants.%D
  225. // CHECK:STDOUT: .F = %D.F.decl
  226. // CHECK:STDOUT: .DF = %D.DF.decl
  227. // CHECK:STDOUT: .d = %.loc28
  228. // CHECK:STDOUT: .A = <poisoned>
  229. // CHECK:STDOUT: .B = <poisoned>
  230. // CHECK:STDOUT: .C = <poisoned>
  231. // CHECK:STDOUT: .D = <poisoned>
  232. // CHECK:STDOUT: .AF = <poisoned>
  233. // CHECK:STDOUT: .BF = <poisoned>
  234. // CHECK:STDOUT: .CF = <poisoned>
  235. // CHECK:STDOUT: }
  236. // CHECK:STDOUT:
  237. // CHECK:STDOUT: fn @B.BF();
  238. // CHECK:STDOUT:
  239. // CHECK:STDOUT: fn @D.F();
  240. // CHECK:STDOUT:
  241. // CHECK:STDOUT: fn @D.DF() {
  242. // CHECK:STDOUT: !entry:
  243. // CHECK:STDOUT: name_binding_decl {
  244. // CHECK:STDOUT: %a.patt: %pattern_type.1ab = ref_binding_pattern a [concrete]
  245. // CHECK:STDOUT: %a.var_patt: %pattern_type.1ab = var_pattern %a.patt [concrete]
  246. // CHECK:STDOUT: }
  247. // CHECK:STDOUT: %a.var: ref %A = var %a.var_patt
  248. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  249. // CHECK:STDOUT: %.loc33_32.1: %struct_type.a.a6c = struct_literal (%int_1) [concrete = constants.%struct.48c]
  250. // CHECK:STDOUT: %impl.elem0.loc33: %.545 = impl_witness_access constants.%ImplicitAs.impl_witness.6bc, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5]
  251. // CHECK:STDOUT: %bound_method.loc33_32.1: <bound method> = bound_method %int_1, %impl.elem0.loc33 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.215]
  252. // CHECK:STDOUT: %specific_fn.loc33: <specific function> = specific_function %impl.elem0.loc33, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  253. // CHECK:STDOUT: %bound_method.loc33_32.2: <bound method> = bound_method %int_1, %specific_fn.loc33 [concrete = constants.%bound_method.38b]
  254. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc33: init %i32 = call %bound_method.loc33_32.2(%int_1) [concrete = constants.%int_1.5d2]
  255. // CHECK:STDOUT: %.loc33_32.2: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc33 [concrete = constants.%int_1.5d2]
  256. // CHECK:STDOUT: %.loc33_32.3: ref %i32 = class_element_access %a.var, element0
  257. // CHECK:STDOUT: %.loc33_32.4: init %i32 to %.loc33_32.3 = in_place_init %.loc33_32.2 [concrete = constants.%int_1.5d2]
  258. // CHECK:STDOUT: %.loc33_32.5: init %A to %a.var = class_init (%.loc33_32.4) [concrete = constants.%A.val]
  259. // CHECK:STDOUT: %.loc33_7: init %A = converted %.loc33_32.1, %.loc33_32.5 [concrete = constants.%A.val]
  260. // CHECK:STDOUT: assign %a.var, %.loc33_7
  261. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
  262. // CHECK:STDOUT: %a: ref %A = ref_binding a, %a.var
  263. // CHECK:STDOUT: name_binding_decl {
  264. // CHECK:STDOUT: %b.patt: %pattern_type.438 = ref_binding_pattern b [concrete]
  265. // CHECK:STDOUT: %b.var_patt: %pattern_type.438 = var_pattern %b.patt [concrete]
  266. // CHECK:STDOUT: }
  267. // CHECK:STDOUT: %b.var: ref %B = var %b.var_patt
  268. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc]
  269. // CHECK:STDOUT: %.loc34_32.1: %struct_type.b.a15 = struct_literal (%int_2) [concrete = constants.%struct.26f]
  270. // CHECK:STDOUT: %impl.elem0.loc34: %.545 = impl_witness_access constants.%ImplicitAs.impl_witness.6bc, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5]
  271. // CHECK:STDOUT: %bound_method.loc34_32.1: <bound method> = bound_method %int_2, %impl.elem0.loc34 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.4e5]
  272. // CHECK:STDOUT: %specific_fn.loc34: <specific function> = specific_function %impl.elem0.loc34, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  273. // CHECK:STDOUT: %bound_method.loc34_32.2: <bound method> = bound_method %int_2, %specific_fn.loc34 [concrete = constants.%bound_method.646]
  274. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc34: init %i32 = call %bound_method.loc34_32.2(%int_2) [concrete = constants.%int_2.ef8]
  275. // CHECK:STDOUT: %.loc34_32.2: init %i32 = converted %int_2, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc34 [concrete = constants.%int_2.ef8]
  276. // CHECK:STDOUT: %.loc34_32.3: ref %i32 = class_element_access %b.var, element0
  277. // CHECK:STDOUT: %.loc34_32.4: init %i32 to %.loc34_32.3 = in_place_init %.loc34_32.2 [concrete = constants.%int_2.ef8]
  278. // CHECK:STDOUT: %.loc34_32.5: init %B to %b.var = class_init (%.loc34_32.4) [concrete = constants.%B.val]
  279. // CHECK:STDOUT: %.loc34_7: init %B = converted %.loc34_32.1, %.loc34_32.5 [concrete = constants.%B.val]
  280. // CHECK:STDOUT: assign %b.var, %.loc34_7
  281. // CHECK:STDOUT: %B.ref: type = name_ref B, @A.%B.decl [concrete = constants.%B]
  282. // CHECK:STDOUT: %b: ref %B = ref_binding b, %b.var
  283. // CHECK:STDOUT: name_binding_decl {
  284. // CHECK:STDOUT: %c.patt: %pattern_type.d99 = ref_binding_pattern c [concrete]
  285. // CHECK:STDOUT: %c.var_patt: %pattern_type.d99 = var_pattern %c.patt [concrete]
  286. // CHECK:STDOUT: }
  287. // CHECK:STDOUT: %c.var: ref %C = var %c.var_patt
  288. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba]
  289. // CHECK:STDOUT: %.loc35_32.1: %struct_type.c.5b8 = struct_literal (%int_3) [concrete = constants.%struct.d98]
  290. // CHECK:STDOUT: %impl.elem0.loc35: %.545 = impl_witness_access constants.%ImplicitAs.impl_witness.6bc, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5]
  291. // CHECK:STDOUT: %bound_method.loc35_32.1: <bound method> = bound_method %int_3, %impl.elem0.loc35 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.061]
  292. // CHECK:STDOUT: %specific_fn.loc35: <specific function> = specific_function %impl.elem0.loc35, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  293. // CHECK:STDOUT: %bound_method.loc35_32.2: <bound method> = bound_method %int_3, %specific_fn.loc35 [concrete = constants.%bound_method.fa7]
  294. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc35: init %i32 = call %bound_method.loc35_32.2(%int_3) [concrete = constants.%int_3.822]
  295. // CHECK:STDOUT: %.loc35_32.2: init %i32 = converted %int_3, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc35 [concrete = constants.%int_3.822]
  296. // CHECK:STDOUT: %.loc35_32.3: ref %i32 = class_element_access %c.var, element0
  297. // CHECK:STDOUT: %.loc35_32.4: init %i32 to %.loc35_32.3 = in_place_init %.loc35_32.2 [concrete = constants.%int_3.822]
  298. // CHECK:STDOUT: %.loc35_32.5: init %C to %c.var = class_init (%.loc35_32.4) [concrete = constants.%C.val]
  299. // CHECK:STDOUT: %.loc35_7: init %C = converted %.loc35_32.1, %.loc35_32.5 [concrete = constants.%C.val]
  300. // CHECK:STDOUT: assign %c.var, %.loc35_7
  301. // CHECK:STDOUT: %C.ref: type = name_ref C, @B.%C.decl [concrete = constants.%C]
  302. // CHECK:STDOUT: %c: ref %C = ref_binding c, %c.var
  303. // CHECK:STDOUT: name_binding_decl {
  304. // CHECK:STDOUT: %d.patt: %pattern_type.be4 = ref_binding_pattern d [concrete]
  305. // CHECK:STDOUT: %d.var_patt: %pattern_type.be4 = var_pattern %d.patt [concrete]
  306. // CHECK:STDOUT: }
  307. // CHECK:STDOUT: %d.var: ref %D = var %d.var_patt
  308. // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4.0c1]
  309. // CHECK:STDOUT: %.loc36_32.1: %struct_type.d.3ea = struct_literal (%int_4) [concrete = constants.%struct.5a9]
  310. // CHECK:STDOUT: %impl.elem0.loc36: %.545 = impl_witness_access constants.%ImplicitAs.impl_witness.6bc, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5]
  311. // CHECK:STDOUT: %bound_method.loc36_32.1: <bound method> = bound_method %int_4, %impl.elem0.loc36 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.f0c]
  312. // CHECK:STDOUT: %specific_fn.loc36: <specific function> = specific_function %impl.elem0.loc36, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  313. // CHECK:STDOUT: %bound_method.loc36_32.2: <bound method> = bound_method %int_4, %specific_fn.loc36 [concrete = constants.%bound_method.6d7]
  314. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc36: init %i32 = call %bound_method.loc36_32.2(%int_4) [concrete = constants.%int_4.940]
  315. // CHECK:STDOUT: %.loc36_32.2: init %i32 = converted %int_4, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc36 [concrete = constants.%int_4.940]
  316. // CHECK:STDOUT: %.loc36_32.3: ref %i32 = class_element_access %d.var, element0
  317. // CHECK:STDOUT: %.loc36_32.4: init %i32 to %.loc36_32.3 = in_place_init %.loc36_32.2 [concrete = constants.%int_4.940]
  318. // CHECK:STDOUT: %.loc36_32.5: init %D to %d.var = class_init (%.loc36_32.4) [concrete = constants.%D.val]
  319. // CHECK:STDOUT: %.loc36_7: init %D = converted %.loc36_32.1, %.loc36_32.5 [concrete = constants.%D.val]
  320. // CHECK:STDOUT: assign %d.var, %.loc36_7
  321. // CHECK:STDOUT: %D.ref: type = name_ref D, @C.%D.decl [concrete = constants.%D]
  322. // CHECK:STDOUT: %d: ref %D = ref_binding d, %d.var
  323. // CHECK:STDOUT: %AF.ref: %A.AF.type = name_ref AF, @A.%A.AF.decl [concrete = constants.%A.AF]
  324. // CHECK:STDOUT: %A.AF.call: init %empty_tuple.type = call %AF.ref()
  325. // CHECK:STDOUT: %BF.ref: %B.BF.type = name_ref BF, @B.%B.BF.decl [concrete = constants.%B.BF]
  326. // CHECK:STDOUT: %B.BF.call: init %empty_tuple.type = call %BF.ref()
  327. // CHECK:STDOUT: %CF.ref: %C.CF.type = name_ref CF, @C.%C.CF.decl [concrete = constants.%C.CF]
  328. // CHECK:STDOUT: %C.CF.call: init %empty_tuple.type = call %CF.ref()
  329. // CHECK:STDOUT: %DF.ref: %D.DF.type = name_ref DF, @D.%D.DF.decl [concrete = constants.%D.DF]
  330. // CHECK:STDOUT: %D.DF.call: init %empty_tuple.type = call %DF.ref()
  331. // CHECK:STDOUT: %Destroy.Op.bound.loc36: <bound method> = bound_method %d.var, constants.%Destroy.Op.651ba6.4
  332. // CHECK:STDOUT: %Destroy.Op.call.loc36: init %empty_tuple.type = call %Destroy.Op.bound.loc36(%d.var)
  333. // CHECK:STDOUT: %Destroy.Op.bound.loc35: <bound method> = bound_method %c.var, constants.%Destroy.Op.651ba6.6
  334. // CHECK:STDOUT: %Destroy.Op.call.loc35: init %empty_tuple.type = call %Destroy.Op.bound.loc35(%c.var)
  335. // CHECK:STDOUT: %Destroy.Op.bound.loc34: <bound method> = bound_method %b.var, constants.%Destroy.Op.651ba6.8
  336. // CHECK:STDOUT: %Destroy.Op.call.loc34: init %empty_tuple.type = call %Destroy.Op.bound.loc34(%b.var)
  337. // CHECK:STDOUT: %Destroy.Op.bound.loc33: <bound method> = bound_method %a.var, constants.%Destroy.Op.651ba6.10
  338. // CHECK:STDOUT: %Destroy.Op.call.loc33: init %empty_tuple.type = call %Destroy.Op.bound.loc33(%a.var)
  339. // CHECK:STDOUT: return
  340. // CHECK:STDOUT: }
  341. // CHECK:STDOUT:
  342. // CHECK:STDOUT: fn @C.CF();
  343. // CHECK:STDOUT:
  344. // CHECK:STDOUT: fn @A.AF();
  345. // CHECK:STDOUT:
  346. // CHECK:STDOUT: fn @Destroy.Op.loc36_7.1(%self.param: ref %i32.builtin) = "no_op";
  347. // CHECK:STDOUT:
  348. // CHECK:STDOUT: fn @Destroy.Op.loc36_7.2(%self.param: ref %i32) {
  349. // CHECK:STDOUT: !entry:
  350. // CHECK:STDOUT: return
  351. // CHECK:STDOUT: }
  352. // CHECK:STDOUT:
  353. // CHECK:STDOUT: fn @Destroy.Op.loc36_7.3(%self.param: ref %struct_type.d.b7b) {
  354. // CHECK:STDOUT: !entry:
  355. // CHECK:STDOUT: return
  356. // CHECK:STDOUT: }
  357. // CHECK:STDOUT:
  358. // CHECK:STDOUT: fn @Destroy.Op.loc36_7.4(%self.param: ref %D) {
  359. // CHECK:STDOUT: !entry:
  360. // CHECK:STDOUT: return
  361. // CHECK:STDOUT: }
  362. // CHECK:STDOUT:
  363. // CHECK:STDOUT: fn @Destroy.Op.loc35_7.1(%self.param: ref %struct_type.c.b66) {
  364. // CHECK:STDOUT: !entry:
  365. // CHECK:STDOUT: return
  366. // CHECK:STDOUT: }
  367. // CHECK:STDOUT:
  368. // CHECK:STDOUT: fn @Destroy.Op.loc35_7.2(%self.param: ref %C) {
  369. // CHECK:STDOUT: !entry:
  370. // CHECK:STDOUT: return
  371. // CHECK:STDOUT: }
  372. // CHECK:STDOUT:
  373. // CHECK:STDOUT: fn @Destroy.Op.loc34_7.1(%self.param: ref %struct_type.b.0a3) {
  374. // CHECK:STDOUT: !entry:
  375. // CHECK:STDOUT: return
  376. // CHECK:STDOUT: }
  377. // CHECK:STDOUT:
  378. // CHECK:STDOUT: fn @Destroy.Op.loc34_7.2(%self.param: ref %B) {
  379. // CHECK:STDOUT: !entry:
  380. // CHECK:STDOUT: return
  381. // CHECK:STDOUT: }
  382. // CHECK:STDOUT:
  383. // CHECK:STDOUT: fn @Destroy.Op.loc33_7.1(%self.param: ref %struct_type.a.ba9) {
  384. // CHECK:STDOUT: !entry:
  385. // CHECK:STDOUT: return
  386. // CHECK:STDOUT: }
  387. // CHECK:STDOUT:
  388. // CHECK:STDOUT: fn @Destroy.Op.loc33_7.2(%self.param: ref %A) {
  389. // CHECK:STDOUT: !entry:
  390. // CHECK:STDOUT: return
  391. // CHECK:STDOUT: }
  392. // CHECK:STDOUT: