overloaded.carbon 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  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. // AUTOUPDATE
  6. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/as/overloaded.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/as/overloaded.carbon
  10. class X {
  11. var n: i32;
  12. }
  13. impl i32 as Core.As(X) {
  14. fn Convert[self: i32]() -> X { return {.n = self}; }
  15. }
  16. impl X as Core.As(i32) {
  17. fn Convert[self: X]() -> i32 { return self.n; }
  18. }
  19. let n: i32 = ((4 as i32) as X) as i32;
  20. // CHECK:STDOUT: --- overloaded.carbon
  21. // CHECK:STDOUT:
  22. // CHECK:STDOUT: constants {
  23. // CHECK:STDOUT: %X: type = class_type @X [template]
  24. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  25. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  26. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  27. // CHECK:STDOUT: %.2: type = unbound_element_type %X, i32 [template]
  28. // CHECK:STDOUT: %.3: type = struct_type {.n: i32} [template]
  29. // CHECK:STDOUT: %.4: <witness> = complete_type_witness %.3 [template]
  30. // CHECK:STDOUT: %As.type.1: type = generic_interface_type @As [template]
  31. // CHECK:STDOUT: %As: %As.type.1 = struct_value () [template]
  32. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic]
  33. // CHECK:STDOUT: %As.type.2: type = interface_type @As, @As(%Dest) [symbolic]
  34. // CHECK:STDOUT: %Self.1: @As.%As.type (%As.type.2) = bind_symbolic_name Self, 1 [symbolic]
  35. // CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic]
  36. // CHECK:STDOUT: %Self.2: %As.type.2 = bind_symbolic_name Self, 1 [symbolic]
  37. // CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert.1, @As(%Dest) [symbolic]
  38. // CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic]
  39. // CHECK:STDOUT: %.5: type = assoc_entity_type %As.type.2, %Convert.type.1 [symbolic]
  40. // CHECK:STDOUT: %.6: %.5 = assoc_entity element0, imports.%import_ref.6 [symbolic]
  41. // CHECK:STDOUT: %As.type.3: type = interface_type @As, @As(%X) [template]
  42. // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.2 [template]
  43. // CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template]
  44. // CHECK:STDOUT: %Convert.type.3: type = fn_type @Convert.1, @As(%X) [template]
  45. // CHECK:STDOUT: %Convert.3: %Convert.type.3 = struct_value () [template]
  46. // CHECK:STDOUT: %.7: type = assoc_entity_type %As.type.3, %Convert.type.3 [template]
  47. // CHECK:STDOUT: %.8: %.7 = assoc_entity element0, imports.%import_ref.6 [template]
  48. // CHECK:STDOUT: %.9: <witness> = interface_witness (%Convert.2) [template]
  49. // CHECK:STDOUT: %.10: type = ptr_type %.3 [template]
  50. // CHECK:STDOUT: %As.type.4: type = interface_type @As, @As(i32) [template]
  51. // CHECK:STDOUT: %Convert.type.4: type = fn_type @Convert.3 [template]
  52. // CHECK:STDOUT: %Convert.4: %Convert.type.4 = struct_value () [template]
  53. // CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @As(i32) [template]
  54. // CHECK:STDOUT: %Convert.5: %Convert.type.5 = struct_value () [template]
  55. // CHECK:STDOUT: %.11: type = assoc_entity_type %As.type.4, %Convert.type.5 [template]
  56. // CHECK:STDOUT: %.12: %.11 = assoc_entity element0, imports.%import_ref.6 [template]
  57. // CHECK:STDOUT: %.13: <witness> = interface_witness (%Convert.4) [template]
  58. // CHECK:STDOUT: %.14: i32 = int_literal 4 [template]
  59. // CHECK:STDOUT: %.15: %.5 = assoc_entity element0, imports.%import_ref.7 [symbolic]
  60. // CHECK:STDOUT: %.16: <bound method> = bound_method %.14, %Convert.2 [template]
  61. // CHECK:STDOUT: }
  62. // CHECK:STDOUT:
  63. // CHECK:STDOUT: imports {
  64. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  65. // CHECK:STDOUT: .Int32 = %import_ref.1
  66. // CHECK:STDOUT: .As = %import_ref.2
  67. // CHECK:STDOUT: import Core//prelude
  68. // CHECK:STDOUT: import Core//prelude/operators
  69. // CHECK:STDOUT: import Core//prelude/types
  70. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  71. // CHECK:STDOUT: import Core//prelude/operators/as
  72. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  73. // CHECK:STDOUT: import Core//prelude/operators/comparison
  74. // CHECK:STDOUT: import Core//prelude/types/bool
  75. // CHECK:STDOUT: }
  76. // CHECK:STDOUT: %import_ref.1: %Int32.type = import_ref Core//prelude/types, inst+4, loaded [template = constants.%Int32]
  77. // CHECK:STDOUT: %import_ref.2: %As.type.1 = import_ref Core//prelude/operators/as, inst+7, loaded [template = constants.%As]
  78. // CHECK:STDOUT: %import_ref.3 = import_ref Core//prelude/operators/as, inst+14, unloaded
  79. // CHECK:STDOUT: %import_ref.4: @As.%.1 (%.5) = import_ref Core//prelude/operators/as, inst+33, loaded [symbolic = @As.%.2 (constants.%.15)]
  80. // CHECK:STDOUT: %import_ref.5: @As.%Convert.type (%Convert.type.1) = import_ref Core//prelude/operators/as, inst+26, loaded [symbolic = @As.%Convert (constants.%Convert.1)]
  81. // CHECK:STDOUT: %import_ref.6 = import_ref Core//prelude/operators/as, inst+26, unloaded
  82. // CHECK:STDOUT: %import_ref.7 = import_ref Core//prelude/operators/as, inst+26, unloaded
  83. // CHECK:STDOUT: }
  84. // CHECK:STDOUT:
  85. // CHECK:STDOUT: file {
  86. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  87. // CHECK:STDOUT: .Core = imports.%Core
  88. // CHECK:STDOUT: .X = %X.decl
  89. // CHECK:STDOUT: .n = @__global_init.%n
  90. // CHECK:STDOUT: }
  91. // CHECK:STDOUT: %Core.import = import Core
  92. // CHECK:STDOUT: %X.decl: type = class_decl @X [template = constants.%X] {} {}
  93. // CHECK:STDOUT: impl_decl @impl.1 [template] {} {
  94. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  95. // CHECK:STDOUT: %.loc15_6.1: type = value_of_initializer %int.make_type_32 [template = i32]
  96. // CHECK:STDOUT: %.loc15_6.2: type = converted %int.make_type_32, %.loc15_6.1 [template = i32]
  97. // CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [template = imports.%Core]
  98. // CHECK:STDOUT: %As.ref: %As.type.1 = name_ref As, imports.%import_ref.2 [template = constants.%As]
  99. // CHECK:STDOUT: %X.ref: type = name_ref X, file.%X.decl [template = constants.%X]
  100. // CHECK:STDOUT: %As.type: type = interface_type @As, @As(constants.%X) [template = constants.%As.type.3]
  101. // CHECK:STDOUT: }
  102. // CHECK:STDOUT: impl_decl @impl.2 [template] {} {
  103. // CHECK:STDOUT: %X.ref: type = name_ref X, file.%X.decl [template = constants.%X]
  104. // CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [template = imports.%Core]
  105. // CHECK:STDOUT: %As.ref: %As.type.1 = name_ref As, imports.%import_ref.2 [template = constants.%As]
  106. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  107. // CHECK:STDOUT: %.loc19_18.1: type = value_of_initializer %int.make_type_32 [template = i32]
  108. // CHECK:STDOUT: %.loc19_18.2: type = converted %int.make_type_32, %.loc19_18.1 [template = i32]
  109. // CHECK:STDOUT: %As.type: type = interface_type @As, @As(i32) [template = constants.%As.type.4]
  110. // CHECK:STDOUT: }
  111. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  112. // CHECK:STDOUT: %.loc23_8.1: type = value_of_initializer %int.make_type_32 [template = i32]
  113. // CHECK:STDOUT: %.loc23_8.2: type = converted %int.make_type_32, %.loc23_8.1 [template = i32]
  114. // CHECK:STDOUT: }
  115. // CHECK:STDOUT:
  116. // CHECK:STDOUT: generic interface @As(constants.%Dest: type) {
  117. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
  118. // CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)]
  119. // CHECK:STDOUT:
  120. // CHECK:STDOUT: !definition:
  121. // CHECK:STDOUT: %As.type: type = interface_type @As, @As(%Dest) [symbolic = %As.type (constants.%As.type.2)]
  122. // CHECK:STDOUT: %Self: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)]
  123. // CHECK:STDOUT: %Convert.type: type = fn_type @Convert.1, @As(%Dest) [symbolic = %Convert.type (constants.%Convert.type.1)]
  124. // CHECK:STDOUT: %Convert: @As.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)]
  125. // CHECK:STDOUT: %.1: type = assoc_entity_type @As.%As.type (%As.type.2), @As.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.5)]
  126. // CHECK:STDOUT: %.2: @As.%.1 (%.5) = assoc_entity element0, imports.%import_ref.6 [symbolic = %.2 (constants.%.6)]
  127. // CHECK:STDOUT:
  128. // CHECK:STDOUT: interface {
  129. // CHECK:STDOUT: !members:
  130. // CHECK:STDOUT: .Self = imports.%import_ref.3
  131. // CHECK:STDOUT: .Convert = imports.%import_ref.4
  132. // CHECK:STDOUT: witness = (imports.%import_ref.5)
  133. // CHECK:STDOUT: }
  134. // CHECK:STDOUT: }
  135. // CHECK:STDOUT:
  136. // CHECK:STDOUT: impl @impl.1: %.loc15_6.2 as %As.type {
  137. // CHECK:STDOUT: %Convert.decl: %Convert.type.2 = fn_decl @Convert.2 [template = constants.%Convert.2] {
  138. // CHECK:STDOUT: %self.patt: i32 = binding_pattern self
  139. // CHECK:STDOUT: %self.param_patt: i32 = param_pattern %self.patt, runtime_param0
  140. // CHECK:STDOUT: } {
  141. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  142. // CHECK:STDOUT: %.loc16_20.1: type = value_of_initializer %int.make_type_32 [template = i32]
  143. // CHECK:STDOUT: %.loc16_20.2: type = converted %int.make_type_32, %.loc16_20.1 [template = i32]
  144. // CHECK:STDOUT: %X.ref: type = name_ref X, file.%X.decl [template = constants.%X]
  145. // CHECK:STDOUT: %return: ref %X = var <return slot>
  146. // CHECK:STDOUT: %param: i32 = param runtime_param0
  147. // CHECK:STDOUT: %self: i32 = bind_name self, %param
  148. // CHECK:STDOUT: }
  149. // CHECK:STDOUT: %.loc15_24: <witness> = interface_witness (%Convert.decl) [template = constants.%.9]
  150. // CHECK:STDOUT:
  151. // CHECK:STDOUT: !members:
  152. // CHECK:STDOUT: .Convert = %Convert.decl
  153. // CHECK:STDOUT: witness = %.loc15_24
  154. // CHECK:STDOUT: }
  155. // CHECK:STDOUT:
  156. // CHECK:STDOUT: impl @impl.2: %X.ref as %As.type {
  157. // CHECK:STDOUT: %Convert.decl: %Convert.type.4 = fn_decl @Convert.3 [template = constants.%Convert.4] {
  158. // CHECK:STDOUT: %self.patt: %X = binding_pattern self
  159. // CHECK:STDOUT: %self.param_patt: %X = param_pattern %self.patt, runtime_param0
  160. // CHECK:STDOUT: } {
  161. // CHECK:STDOUT: %X.ref: type = name_ref X, file.%X.decl [template = constants.%X]
  162. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  163. // CHECK:STDOUT: %.loc20_28.1: type = value_of_initializer %int.make_type_32 [template = i32]
  164. // CHECK:STDOUT: %.loc20_28.2: type = converted %int.make_type_32, %.loc20_28.1 [template = i32]
  165. // CHECK:STDOUT: %return: ref i32 = var <return slot>
  166. // CHECK:STDOUT: %param: %X = param runtime_param0
  167. // CHECK:STDOUT: %self: %X = bind_name self, %param
  168. // CHECK:STDOUT: }
  169. // CHECK:STDOUT: %.loc19_24: <witness> = interface_witness (%Convert.decl) [template = constants.%.13]
  170. // CHECK:STDOUT:
  171. // CHECK:STDOUT: !members:
  172. // CHECK:STDOUT: .Convert = %Convert.decl
  173. // CHECK:STDOUT: witness = %.loc19_24
  174. // CHECK:STDOUT: }
  175. // CHECK:STDOUT:
  176. // CHECK:STDOUT: class @X {
  177. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  178. // CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32 [template = i32]
  179. // CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32, %.loc12_10.1 [template = i32]
  180. // CHECK:STDOUT: %.loc12_8: %.2 = field_decl n, element0 [template]
  181. // CHECK:STDOUT: %.loc13: <witness> = complete_type_witness %.3 [template = constants.%.4]
  182. // CHECK:STDOUT:
  183. // CHECK:STDOUT: !members:
  184. // CHECK:STDOUT: .Self = constants.%X
  185. // CHECK:STDOUT: .n = %.loc12_8
  186. // CHECK:STDOUT: }
  187. // CHECK:STDOUT:
  188. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  189. // CHECK:STDOUT:
  190. // CHECK:STDOUT: generic fn @Convert.1(constants.%Dest: type, constants.%Self.1: @As.%As.type (%As.type.2)) {
  191. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
  192. // CHECK:STDOUT: %As.type: type = interface_type @As, @As(%Dest) [symbolic = %As.type (constants.%As.type.2)]
  193. // CHECK:STDOUT: %Self: %As.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)]
  194. // CHECK:STDOUT:
  195. // CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self (%Self.2)]() -> @Convert.1.%Dest (%Dest);
  196. // CHECK:STDOUT: }
  197. // CHECK:STDOUT:
  198. // CHECK:STDOUT: fn @Convert.2[%self.param_patt: i32]() -> %return: %X {
  199. // CHECK:STDOUT: !entry:
  200. // CHECK:STDOUT: %self.ref: i32 = name_ref self, %self
  201. // CHECK:STDOUT: %.loc16_51.1: %.3 = struct_literal (%self.ref)
  202. // CHECK:STDOUT: %.loc16_51.2: ref i32 = class_element_access %return, element0
  203. // CHECK:STDOUT: %.loc16_51.3: init i32 = initialize_from %self.ref to %.loc16_51.2
  204. // CHECK:STDOUT: %.loc16_51.4: init %X = class_init (%.loc16_51.3), %return
  205. // CHECK:STDOUT: %.loc16_52: init %X = converted %.loc16_51.1, %.loc16_51.4
  206. // CHECK:STDOUT: return %.loc16_52 to %return
  207. // CHECK:STDOUT: }
  208. // CHECK:STDOUT:
  209. // CHECK:STDOUT: fn @Convert.3[%self.param_patt: %X]() -> i32 {
  210. // CHECK:STDOUT: !entry:
  211. // CHECK:STDOUT: %self.ref: %X = name_ref self, %self
  212. // CHECK:STDOUT: %n.ref: %.2 = name_ref n, @X.%.loc12_8 [template = @X.%.loc12_8]
  213. // CHECK:STDOUT: %.loc20_45.1: ref i32 = class_element_access %self.ref, element0
  214. // CHECK:STDOUT: %.loc20_45.2: i32 = bind_value %.loc20_45.1
  215. // CHECK:STDOUT: return %.loc20_45.2
  216. // CHECK:STDOUT: }
  217. // CHECK:STDOUT:
  218. // CHECK:STDOUT: fn @__global_init() {
  219. // CHECK:STDOUT: !entry:
  220. // CHECK:STDOUT: %.loc23_16: i32 = int_literal 4 [template = constants.%.14]
  221. // CHECK:STDOUT: %int.make_type_32.loc23_21: init type = call constants.%Int32() [template = i32]
  222. // CHECK:STDOUT: %.loc23_21.1: type = value_of_initializer %int.make_type_32.loc23_21 [template = i32]
  223. // CHECK:STDOUT: %.loc23_21.2: type = converted %int.make_type_32.loc23_21, %.loc23_21.1 [template = i32]
  224. // CHECK:STDOUT: %X.ref: type = name_ref X, file.%X.decl [template = constants.%X]
  225. // CHECK:STDOUT: %As.type.loc23_26: type = interface_type @As, @As(constants.%X) [template = constants.%As.type.3]
  226. // CHECK:STDOUT: %.loc23_26.1: %.7 = specific_constant imports.%import_ref.4, @As(constants.%X) [template = constants.%.8]
  227. // CHECK:STDOUT: %Convert.ref.loc23_26: %.7 = name_ref Convert, %.loc23_26.1 [template = constants.%.8]
  228. // CHECK:STDOUT: %.loc23_26.2: %Convert.type.3 = interface_witness_access constants.%.9, element0 [template = constants.%Convert.2]
  229. // CHECK:STDOUT: %.loc23_26.3: <bound method> = bound_method %.loc23_16, %.loc23_26.2 [template = constants.%.16]
  230. // CHECK:STDOUT: %.loc23_26.4: ref %X = temporary_storage
  231. // CHECK:STDOUT: %Convert.call.loc23_26: init %X = call %.loc23_26.3(%.loc23_16) to %.loc23_26.4
  232. // CHECK:STDOUT: %.loc23_26.5: init %X = converted %.loc23_16, %Convert.call.loc23_26
  233. // CHECK:STDOUT: %int.make_type_32.loc23_35: init type = call constants.%Int32() [template = i32]
  234. // CHECK:STDOUT: %.loc23_35.1: type = value_of_initializer %int.make_type_32.loc23_35 [template = i32]
  235. // CHECK:STDOUT: %.loc23_35.2: type = converted %int.make_type_32.loc23_35, %.loc23_35.1 [template = i32]
  236. // CHECK:STDOUT: %As.type.loc23_32: type = interface_type @As, @As(i32) [template = constants.%As.type.4]
  237. // CHECK:STDOUT: %.loc23_32.1: %.11 = specific_constant imports.%import_ref.4, @As(i32) [template = constants.%.12]
  238. // CHECK:STDOUT: %Convert.ref.loc23_32: %.11 = name_ref Convert, %.loc23_32.1 [template = constants.%.12]
  239. // CHECK:STDOUT: %.loc23_26.6: ref %X = temporary %.loc23_26.4, %.loc23_26.5
  240. // CHECK:STDOUT: %.loc23_32.2: %Convert.type.5 = interface_witness_access constants.%.13, element0 [template = constants.%Convert.4]
  241. // CHECK:STDOUT: %.loc23_32.3: <bound method> = bound_method %.loc23_26.6, %.loc23_32.2
  242. // CHECK:STDOUT: %.loc23_26.7: %X = bind_value %.loc23_26.6
  243. // CHECK:STDOUT: %Convert.call.loc23_32: init i32 = call %.loc23_32.3(%.loc23_26.7)
  244. // CHECK:STDOUT: %.loc23_32.4: init i32 = converted %.loc23_26.5, %Convert.call.loc23_32
  245. // CHECK:STDOUT: %.loc23_38.1: i32 = value_of_initializer %.loc23_32.4
  246. // CHECK:STDOUT: %.loc23_38.2: i32 = converted %.loc23_32.4, %.loc23_38.1
  247. // CHECK:STDOUT: %n: i32 = bind_name n, %.loc23_38.2
  248. // CHECK:STDOUT: return
  249. // CHECK:STDOUT: }
  250. // CHECK:STDOUT:
  251. // CHECK:STDOUT: specific @As(constants.%Dest) {
  252. // CHECK:STDOUT: %Dest => constants.%Dest
  253. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  254. // CHECK:STDOUT: }
  255. // CHECK:STDOUT:
  256. // CHECK:STDOUT: specific @As(@As.%Dest) {
  257. // CHECK:STDOUT: %Dest => constants.%Dest
  258. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  259. // CHECK:STDOUT: }
  260. // CHECK:STDOUT:
  261. // CHECK:STDOUT: specific @As(@Convert.1.%Dest) {
  262. // CHECK:STDOUT: %Dest => constants.%Dest
  263. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  264. // CHECK:STDOUT: }
  265. // CHECK:STDOUT:
  266. // CHECK:STDOUT: specific @Convert.1(constants.%Dest, constants.%Self.1) {
  267. // CHECK:STDOUT: %Dest => constants.%Dest
  268. // CHECK:STDOUT: %As.type => constants.%As.type.2
  269. // CHECK:STDOUT: %Self => constants.%Self.1
  270. // CHECK:STDOUT: }
  271. // CHECK:STDOUT:
  272. // CHECK:STDOUT: specific @As(constants.%X) {
  273. // CHECK:STDOUT: %Dest => constants.%X
  274. // CHECK:STDOUT: %Dest.patt => constants.%X
  275. // CHECK:STDOUT:
  276. // CHECK:STDOUT: !definition:
  277. // CHECK:STDOUT: %As.type => constants.%As.type.3
  278. // CHECK:STDOUT: %Self => constants.%Self.2
  279. // CHECK:STDOUT: %Convert.type => constants.%Convert.type.3
  280. // CHECK:STDOUT: %Convert => constants.%Convert.3
  281. // CHECK:STDOUT: %.1 => constants.%.7
  282. // CHECK:STDOUT: %.2 => constants.%.8
  283. // CHECK:STDOUT: }
  284. // CHECK:STDOUT:
  285. // CHECK:STDOUT: specific @Convert.1(constants.%X, i32) {
  286. // CHECK:STDOUT: %Dest => constants.%X
  287. // CHECK:STDOUT: %As.type => constants.%As.type.3
  288. // CHECK:STDOUT: %Self => i32
  289. // CHECK:STDOUT: }
  290. // CHECK:STDOUT:
  291. // CHECK:STDOUT: specific @As(i32) {
  292. // CHECK:STDOUT: %Dest => i32
  293. // CHECK:STDOUT: %Dest.patt => i32
  294. // CHECK:STDOUT:
  295. // CHECK:STDOUT: !definition:
  296. // CHECK:STDOUT: %As.type => constants.%As.type.4
  297. // CHECK:STDOUT: %Self => constants.%Self.2
  298. // CHECK:STDOUT: %Convert.type => constants.%Convert.type.5
  299. // CHECK:STDOUT: %Convert => constants.%Convert.5
  300. // CHECK:STDOUT: %.1 => constants.%.11
  301. // CHECK:STDOUT: %.2 => constants.%.12
  302. // CHECK:STDOUT: }
  303. // CHECK:STDOUT:
  304. // CHECK:STDOUT: specific @Convert.1(i32, constants.%X) {
  305. // CHECK:STDOUT: %Dest => i32
  306. // CHECK:STDOUT: %As.type => constants.%As.type.4
  307. // CHECK:STDOUT: %Self => constants.%X
  308. // CHECK:STDOUT: }
  309. // CHECK:STDOUT: