import_base.carbon 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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/import_base.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/import_base.carbon
  14. // --- a.carbon
  15. library "[[@TEST_NAME]]";
  16. base class Base {
  17. fn F[self: Self]();
  18. fn Unused[self: Self]();
  19. var x: i32;
  20. var unused: i32;
  21. }
  22. class Child {
  23. extend base: Base;
  24. }
  25. // --- b.carbon
  26. library "[[@TEST_NAME]]";
  27. import library "a";
  28. fn Run() {
  29. var a: Child = {.base = {.x = 0, .unused = 1}};
  30. a.x = 2;
  31. a.F();
  32. }
  33. // CHECK:STDOUT: --- a.carbon
  34. // CHECK:STDOUT:
  35. // CHECK:STDOUT: constants {
  36. // CHECK:STDOUT: %Base: type = class_type @Base [concrete]
  37. // CHECK:STDOUT: %pattern_type.bcc: type = pattern_type %Base [concrete]
  38. // CHECK:STDOUT: %Base.F.type: type = fn_type @Base.F [concrete]
  39. // CHECK:STDOUT: %Base.F: %Base.F.type = struct_value () [concrete]
  40. // CHECK:STDOUT: %Base.Unused.type: type = fn_type @Base.Unused [concrete]
  41. // CHECK:STDOUT: %Base.Unused: %Base.Unused.type = struct_value () [concrete]
  42. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  43. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  44. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  45. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  46. // CHECK:STDOUT: %Base.elem: type = unbound_element_type %Base, %i32 [concrete]
  47. // CHECK:STDOUT: %struct_type.x.unused: type = struct_type {.x: %i32, .unused: %i32} [concrete]
  48. // CHECK:STDOUT: %complete_type.20c: <witness> = complete_type_witness %struct_type.x.unused [concrete]
  49. // CHECK:STDOUT: %Child: type = class_type @Child [concrete]
  50. // CHECK:STDOUT: %Child.elem: type = unbound_element_type %Child, %Base [concrete]
  51. // CHECK:STDOUT: %struct_type.base: type = struct_type {.base: %Base} [concrete]
  52. // CHECK:STDOUT: %complete_type.15c: <witness> = complete_type_witness %struct_type.base [concrete]
  53. // CHECK:STDOUT: }
  54. // CHECK:STDOUT:
  55. // CHECK:STDOUT: imports {
  56. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  57. // CHECK:STDOUT: .Int = %Core.Int
  58. // CHECK:STDOUT: import Core//prelude
  59. // CHECK:STDOUT: import Core//prelude/...
  60. // CHECK:STDOUT: }
  61. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  62. // CHECK:STDOUT: }
  63. // CHECK:STDOUT:
  64. // CHECK:STDOUT: file {
  65. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  66. // CHECK:STDOUT: .Core = imports.%Core
  67. // CHECK:STDOUT: .Base = %Base.decl
  68. // CHECK:STDOUT: .Child = %Child.decl
  69. // CHECK:STDOUT: }
  70. // CHECK:STDOUT: %Core.import = import Core
  71. // CHECK:STDOUT: %Base.decl: type = class_decl @Base [concrete = constants.%Base] {} {}
  72. // CHECK:STDOUT: %Child.decl: type = class_decl @Child [concrete = constants.%Child] {} {}
  73. // CHECK:STDOUT: }
  74. // CHECK:STDOUT:
  75. // CHECK:STDOUT: class @Base {
  76. // CHECK:STDOUT: %Base.F.decl: %Base.F.type = fn_decl @Base.F [concrete = constants.%Base.F] {
  77. // CHECK:STDOUT: %self.patt: %pattern_type.bcc = value_binding_pattern self [concrete]
  78. // CHECK:STDOUT: %self.param_patt: %pattern_type.bcc = value_param_pattern %self.patt, call_param0 [concrete]
  79. // CHECK:STDOUT: } {
  80. // CHECK:STDOUT: %self.param: %Base = value_param call_param0
  81. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Base [concrete = constants.%Base]
  82. // CHECK:STDOUT: %self: %Base = value_binding self, %self.param
  83. // CHECK:STDOUT: }
  84. // CHECK:STDOUT: %Base.Unused.decl: %Base.Unused.type = fn_decl @Base.Unused [concrete = constants.%Base.Unused] {
  85. // CHECK:STDOUT: %self.patt: %pattern_type.bcc = value_binding_pattern self [concrete]
  86. // CHECK:STDOUT: %self.param_patt: %pattern_type.bcc = value_param_pattern %self.patt, call_param0 [concrete]
  87. // CHECK:STDOUT: } {
  88. // CHECK:STDOUT: %self.param: %Base = value_param call_param0
  89. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Base [concrete = constants.%Base]
  90. // CHECK:STDOUT: %self: %Base = value_binding self, %self.param
  91. // CHECK:STDOUT: }
  92. // CHECK:STDOUT: %int_32.loc8: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  93. // CHECK:STDOUT: %i32.loc8: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  94. // CHECK:STDOUT: %.loc8: %Base.elem = field_decl x, element0 [concrete]
  95. // CHECK:STDOUT: %int_32.loc9: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  96. // CHECK:STDOUT: %i32.loc9: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  97. // CHECK:STDOUT: %.loc9: %Base.elem = field_decl unused, element1 [concrete]
  98. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%struct_type.x.unused [concrete = constants.%complete_type.20c]
  99. // CHECK:STDOUT: complete_type_witness = %complete_type
  100. // CHECK:STDOUT:
  101. // CHECK:STDOUT: !members:
  102. // CHECK:STDOUT: .Self = constants.%Base
  103. // CHECK:STDOUT: .F = %Base.F.decl
  104. // CHECK:STDOUT: .Unused = %Base.Unused.decl
  105. // CHECK:STDOUT: .x = %.loc8
  106. // CHECK:STDOUT: .unused = %.loc9
  107. // CHECK:STDOUT: }
  108. // CHECK:STDOUT:
  109. // CHECK:STDOUT: class @Child {
  110. // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [concrete = constants.%Base]
  111. // CHECK:STDOUT: %.loc13: %Child.elem = base_decl %Base.ref, element0 [concrete]
  112. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%struct_type.base [concrete = constants.%complete_type.15c]
  113. // CHECK:STDOUT: complete_type_witness = %complete_type
  114. // CHECK:STDOUT:
  115. // CHECK:STDOUT: !members:
  116. // CHECK:STDOUT: .Self = constants.%Child
  117. // CHECK:STDOUT: .Base = <poisoned>
  118. // CHECK:STDOUT: .base = %.loc13
  119. // CHECK:STDOUT: extend %Base.ref
  120. // CHECK:STDOUT: }
  121. // CHECK:STDOUT:
  122. // CHECK:STDOUT: fn @Base.F(%self.param: %Base);
  123. // CHECK:STDOUT:
  124. // CHECK:STDOUT: fn @Base.Unused(%self.param: %Base);
  125. // CHECK:STDOUT:
  126. // CHECK:STDOUT: --- b.carbon
  127. // CHECK:STDOUT:
  128. // CHECK:STDOUT: constants {
  129. // CHECK:STDOUT: %Run.type: type = fn_type @Run [concrete]
  130. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  131. // CHECK:STDOUT: %Run: %Run.type = struct_value () [concrete]
  132. // CHECK:STDOUT: %Child: type = class_type @Child [concrete]
  133. // CHECK:STDOUT: %Base: type = class_type @Base [concrete]
  134. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  135. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  136. // CHECK:STDOUT: %struct_type.x.unused.7d5: type = struct_type {.x: %i32, .unused: %i32} [concrete]
  137. // CHECK:STDOUT: %complete_type.90f: <witness> = complete_type_witness %struct_type.x.unused.7d5 [concrete]
  138. // CHECK:STDOUT: %struct_type.base.b1e: type = struct_type {.base: %Base} [concrete]
  139. // CHECK:STDOUT: %complete_type.15c: <witness> = complete_type_witness %struct_type.base.b1e [concrete]
  140. // CHECK:STDOUT: %pattern_type.1bd: type = pattern_type %Child [concrete]
  141. // CHECK:STDOUT: %int_0.5c6: Core.IntLiteral = int_value 0 [concrete]
  142. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  143. // CHECK:STDOUT: %struct_type.x.unused.c45: type = struct_type {.x: Core.IntLiteral, .unused: Core.IntLiteral} [concrete]
  144. // CHECK:STDOUT: %struct.9cc: %struct_type.x.unused.c45 = struct_value (%int_0.5c6, %int_1.5b8) [concrete]
  145. // CHECK:STDOUT: %struct_type.base.6c7: type = struct_type {.base: %struct_type.x.unused.c45} [concrete]
  146. // CHECK:STDOUT: %struct.133: %struct_type.base.6c7 = struct_value (%struct.9cc) [concrete]
  147. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  148. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  149. // CHECK:STDOUT: %ImplicitAs.type.bd9: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  150. // CHECK:STDOUT: %ImplicitAs.Convert.type.6da: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i32) [concrete]
  151. // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
  152. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.365: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic]
  153. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.8cf: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.365 = struct_value () [symbolic]
  154. // CHECK:STDOUT: %ImplicitAs.impl_witness.09b: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.04e, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  155. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.069: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  156. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.13e: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.069 = struct_value () [concrete]
  157. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.bd9 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.09b) [concrete]
  158. // CHECK:STDOUT: %.1a5: type = fn_type_with_self_type %ImplicitAs.Convert.type.6da, %ImplicitAs.facet [concrete]
  159. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.7ff: <bound method> = bound_method %int_0.5c6, %Core.IntLiteral.as.ImplicitAs.impl.Convert.13e [concrete]
  160. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.13e, @Core.IntLiteral.as.ImplicitAs.impl.Convert(%int_32) [concrete]
  161. // CHECK:STDOUT: %bound_method.29e: <bound method> = bound_method %int_0.5c6, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  162. // CHECK:STDOUT: %int_0.263: %i32 = int_value 0 [concrete]
  163. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.b66: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.ImplicitAs.impl.Convert.13e [concrete]
  164. // CHECK:STDOUT: %bound_method.c7c: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  165. // CHECK:STDOUT: %int_1.47b: %i32 = int_value 1 [concrete]
  166. // CHECK:STDOUT: %Base.val: %Base = struct_value (%int_0.263, %int_1.47b) [concrete]
  167. // CHECK:STDOUT: %Child.val: %Child = struct_value (%Base.val) [concrete]
  168. // CHECK:STDOUT: %Base.elem: type = unbound_element_type %Base, %i32 [concrete]
  169. // CHECK:STDOUT: %int_2.ecc: Core.IntLiteral = int_value 2 [concrete]
  170. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8e7: <bound method> = bound_method %int_2.ecc, %Core.IntLiteral.as.ImplicitAs.impl.Convert.13e [concrete]
  171. // CHECK:STDOUT: %bound_method.a94: <bound method> = bound_method %int_2.ecc, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  172. // CHECK:STDOUT: %int_2.d0d: %i32 = int_value 2 [concrete]
  173. // CHECK:STDOUT: %Base.F.type: type = fn_type @Base.F [concrete]
  174. // CHECK:STDOUT: %Base.F: %Base.F.type = struct_value () [concrete]
  175. // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
  176. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
  177. // CHECK:STDOUT: %facet_value: %type_where = facet_value %Child, () [concrete]
  178. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.d77: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value) [concrete]
  179. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.12e: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.d77 = struct_value () [concrete]
  180. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn: <specific function> = specific_function %DestroyT.binding.as_type.as.Destroy.impl.Op.12e, @DestroyT.binding.as_type.as.Destroy.impl.Op(%facet_value) [concrete]
  181. // CHECK:STDOUT: }
  182. // CHECK:STDOUT:
  183. // CHECK:STDOUT: imports {
  184. // CHECK:STDOUT: %Main.Base = import_ref Main//a, Base, unloaded
  185. // CHECK:STDOUT: %Main.Child: type = import_ref Main//a, Child, loaded [concrete = constants.%Child]
  186. // CHECK:STDOUT: %Core.ece: <namespace> = namespace file.%Core.import, [concrete] {
  187. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  188. // CHECK:STDOUT: .Destroy = %Core.Destroy
  189. // CHECK:STDOUT: import Core//prelude
  190. // CHECK:STDOUT: import Core//prelude/...
  191. // CHECK:STDOUT: }
  192. // CHECK:STDOUT: %Main.import_ref.239: <witness> = import_ref Main//a, loc10_1, loaded [concrete = constants.%complete_type.90f]
  193. // CHECK:STDOUT: %Main.import_ref.1f3 = import_ref Main//a, inst{{[0-9A-F]+}} [no loc], unloaded
  194. // CHECK:STDOUT: %Main.import_ref.e8f: %Base.F.type = import_ref Main//a, loc5_21, loaded [concrete = constants.%Base.F]
  195. // CHECK:STDOUT: %Main.import_ref.8bf = import_ref Main//a, loc6_26, unloaded
  196. // CHECK:STDOUT: %Main.import_ref.e67: %Base.elem = import_ref Main//a, loc8_8, loaded [concrete = %.720]
  197. // CHECK:STDOUT: %Main.import_ref.2e4 = import_ref Main//a, loc9_13, unloaded
  198. // CHECK:STDOUT: %Main.import_ref.c5f: <witness> = import_ref Main//a, loc14_1, loaded [concrete = constants.%complete_type.15c]
  199. // CHECK:STDOUT: %Main.import_ref.9a9 = import_ref Main//a, inst{{[0-9A-F]+}} [no loc], unloaded
  200. // CHECK:STDOUT: %Main.import_ref.7e5 = import_ref Main//a, loc13_20, unloaded
  201. // CHECK:STDOUT: %Main.import_ref.a21640.2: type = import_ref Main//a, loc13_16, loaded [concrete = constants.%Base]
  202. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  203. // CHECK:STDOUT: %Core.import_ref.7d5: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.365) = 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.8cf)]
  204. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.04e = impl_witness_table (%Core.import_ref.7d5), @Core.IntLiteral.as.ImplicitAs.impl [concrete]
  205. // CHECK:STDOUT: %.720: %Base.elem = field_decl x, element0 [concrete]
  206. // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
  207. // CHECK:STDOUT: }
  208. // CHECK:STDOUT:
  209. // CHECK:STDOUT: file {
  210. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  211. // CHECK:STDOUT: .Base = imports.%Main.Base
  212. // CHECK:STDOUT: .Child = imports.%Main.Child
  213. // CHECK:STDOUT: .Core = imports.%Core.ece
  214. // CHECK:STDOUT: .Run = %Run.decl
  215. // CHECK:STDOUT: }
  216. // CHECK:STDOUT: %Core.import = import Core
  217. // CHECK:STDOUT: %default.import = import <none>
  218. // CHECK:STDOUT: %Run.decl: %Run.type = fn_decl @Run [concrete = constants.%Run] {} {}
  219. // CHECK:STDOUT: }
  220. // CHECK:STDOUT:
  221. // CHECK:STDOUT: class @Child [from "a.carbon"] {
  222. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.c5f
  223. // CHECK:STDOUT:
  224. // CHECK:STDOUT: !members:
  225. // CHECK:STDOUT: .Self = imports.%Main.import_ref.9a9
  226. // CHECK:STDOUT: .base = imports.%Main.import_ref.7e5
  227. // CHECK:STDOUT: .x = <poisoned>
  228. // CHECK:STDOUT: .F = <poisoned>
  229. // CHECK:STDOUT: extend imports.%Main.import_ref.a21640.2
  230. // CHECK:STDOUT: }
  231. // CHECK:STDOUT:
  232. // CHECK:STDOUT: class @Base [from "a.carbon"] {
  233. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.239
  234. // CHECK:STDOUT:
  235. // CHECK:STDOUT: !members:
  236. // CHECK:STDOUT: .Self = imports.%Main.import_ref.1f3
  237. // CHECK:STDOUT: .F = imports.%Main.import_ref.e8f
  238. // CHECK:STDOUT: .Unused = imports.%Main.import_ref.8bf
  239. // CHECK:STDOUT: .x = imports.%Main.import_ref.e67
  240. // CHECK:STDOUT: .unused = imports.%Main.import_ref.2e4
  241. // CHECK:STDOUT: }
  242. // CHECK:STDOUT:
  243. // CHECK:STDOUT: fn @Run() {
  244. // CHECK:STDOUT: !entry:
  245. // CHECK:STDOUT: name_binding_decl {
  246. // CHECK:STDOUT: %a.patt: %pattern_type.1bd = ref_binding_pattern a [concrete]
  247. // CHECK:STDOUT: %a.var_patt: %pattern_type.1bd = var_pattern %a.patt [concrete]
  248. // CHECK:STDOUT: }
  249. // CHECK:STDOUT: %a.var: ref %Child = var %a.var_patt
  250. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
  251. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  252. // CHECK:STDOUT: %.loc7_47.1: %struct_type.x.unused.c45 = struct_literal (%int_0, %int_1) [concrete = constants.%struct.9cc]
  253. // CHECK:STDOUT: %.loc7_48.1: %struct_type.base.6c7 = struct_literal (%.loc7_47.1) [concrete = constants.%struct.133]
  254. // CHECK:STDOUT: %impl.elem0.loc7_47.1: %.1a5 = impl_witness_access constants.%ImplicitAs.impl_witness.09b, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.13e]
  255. // CHECK:STDOUT: %bound_method.loc7_47.1: <bound method> = bound_method %int_0, %impl.elem0.loc7_47.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.7ff]
  256. // CHECK:STDOUT: %specific_fn.loc7_47.1: <specific function> = specific_function %impl.elem0.loc7_47.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  257. // CHECK:STDOUT: %bound_method.loc7_47.2: <bound method> = bound_method %int_0, %specific_fn.loc7_47.1 [concrete = constants.%bound_method.29e]
  258. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_47.1: init %i32 = call %bound_method.loc7_47.2(%int_0) [concrete = constants.%int_0.263]
  259. // CHECK:STDOUT: %.loc7_47.2: init %i32 = converted %int_0, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_47.1 [concrete = constants.%int_0.263]
  260. // CHECK:STDOUT: %.loc7_48.2: ref %Base = class_element_access %a.var, element0
  261. // CHECK:STDOUT: %.loc7_47.3: ref %i32 = class_element_access %.loc7_48.2, element0
  262. // CHECK:STDOUT: %.loc7_47.4: init %i32 = initialize_from %.loc7_47.2 to %.loc7_47.3 [concrete = constants.%int_0.263]
  263. // CHECK:STDOUT: %impl.elem0.loc7_47.2: %.1a5 = impl_witness_access constants.%ImplicitAs.impl_witness.09b, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.13e]
  264. // CHECK:STDOUT: %bound_method.loc7_47.3: <bound method> = bound_method %int_1, %impl.elem0.loc7_47.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.b66]
  265. // CHECK:STDOUT: %specific_fn.loc7_47.2: <specific function> = specific_function %impl.elem0.loc7_47.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  266. // CHECK:STDOUT: %bound_method.loc7_47.4: <bound method> = bound_method %int_1, %specific_fn.loc7_47.2 [concrete = constants.%bound_method.c7c]
  267. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_47.2: init %i32 = call %bound_method.loc7_47.4(%int_1) [concrete = constants.%int_1.47b]
  268. // CHECK:STDOUT: %.loc7_47.5: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_47.2 [concrete = constants.%int_1.47b]
  269. // CHECK:STDOUT: %.loc7_47.6: ref %i32 = class_element_access %.loc7_48.2, element1
  270. // CHECK:STDOUT: %.loc7_47.7: init %i32 = initialize_from %.loc7_47.5 to %.loc7_47.6 [concrete = constants.%int_1.47b]
  271. // CHECK:STDOUT: %.loc7_47.8: init %Base = class_init (%.loc7_47.4, %.loc7_47.7), %.loc7_48.2 [concrete = constants.%Base.val]
  272. // CHECK:STDOUT: %.loc7_48.3: init %Base = converted %.loc7_47.1, %.loc7_47.8 [concrete = constants.%Base.val]
  273. // CHECK:STDOUT: %.loc7_48.4: init %Child = class_init (%.loc7_48.3), %a.var [concrete = constants.%Child.val]
  274. // CHECK:STDOUT: %.loc7_3: init %Child = converted %.loc7_48.1, %.loc7_48.4 [concrete = constants.%Child.val]
  275. // CHECK:STDOUT: assign %a.var, %.loc7_3
  276. // CHECK:STDOUT: %Child.ref: type = name_ref Child, imports.%Main.Child [concrete = constants.%Child]
  277. // CHECK:STDOUT: %a: ref %Child = ref_binding a, %a.var
  278. // CHECK:STDOUT: %a.ref.loc8: ref %Child = name_ref a, %a
  279. // CHECK:STDOUT: %x.ref: %Base.elem = name_ref x, imports.%Main.import_ref.e67 [concrete = imports.%.720]
  280. // CHECK:STDOUT: %.loc8_4.1: ref %Base = class_element_access %a.ref.loc8, element0
  281. // CHECK:STDOUT: %.loc8_4.2: ref %Base = converted %a.ref.loc8, %.loc8_4.1
  282. // CHECK:STDOUT: %.loc8_4.3: ref %i32 = class_element_access %.loc8_4.2, element0
  283. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc]
  284. // CHECK:STDOUT: %impl.elem0.loc8: %.1a5 = impl_witness_access constants.%ImplicitAs.impl_witness.09b, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.13e]
  285. // CHECK:STDOUT: %bound_method.loc8_7.1: <bound method> = bound_method %int_2, %impl.elem0.loc8 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8e7]
  286. // CHECK:STDOUT: %specific_fn.loc8: <specific function> = specific_function %impl.elem0.loc8, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  287. // CHECK:STDOUT: %bound_method.loc8_7.2: <bound method> = bound_method %int_2, %specific_fn.loc8 [concrete = constants.%bound_method.a94]
  288. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc8: init %i32 = call %bound_method.loc8_7.2(%int_2) [concrete = constants.%int_2.d0d]
  289. // CHECK:STDOUT: %.loc8_7: init %i32 = converted %int_2, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc8 [concrete = constants.%int_2.d0d]
  290. // CHECK:STDOUT: assign %.loc8_4.3, %.loc8_7
  291. // CHECK:STDOUT: %a.ref.loc9: ref %Child = name_ref a, %a
  292. // CHECK:STDOUT: %F.ref: %Base.F.type = name_ref F, imports.%Main.import_ref.e8f [concrete = constants.%Base.F]
  293. // CHECK:STDOUT: %Base.F.bound: <bound method> = bound_method %a.ref.loc9, %F.ref
  294. // CHECK:STDOUT: %.loc9_3.1: ref %Base = class_element_access %a.ref.loc9, element0
  295. // CHECK:STDOUT: %.loc9_3.2: ref %Base = converted %a.ref.loc9, %.loc9_3.1
  296. // CHECK:STDOUT: %.loc9_3.3: %Base = acquire_value %.loc9_3.2
  297. // CHECK:STDOUT: %Base.F.call: init %empty_tuple.type = call %Base.F.bound(%.loc9_3.3)
  298. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound: <bound method> = bound_method %a.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.12e
  299. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn: <specific function> = specific_function constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.12e, @DestroyT.binding.as_type.as.Destroy.impl.Op(constants.%facet_value) [concrete = constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn]
  300. // CHECK:STDOUT: %bound_method.loc7_3: <bound method> = bound_method %a.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn
  301. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method.loc7_3(%a.var)
  302. // CHECK:STDOUT: return
  303. // CHECK:STDOUT: }
  304. // CHECK:STDOUT:
  305. // CHECK:STDOUT: fn @Base.F [from "a.carbon"];
  306. // CHECK:STDOUT: