self.carbon 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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/class/self.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/self.carbon
  10. // --- self.carbon
  11. library "[[@TEST_NAME]]";
  12. class Class {
  13. fn F[self: Self]() -> i32;
  14. fn G[addr self: Self*]() -> i32;
  15. var n: i32;
  16. }
  17. fn Class.F[self: Self]() -> i32 {
  18. return self.n;
  19. }
  20. fn Class.G[addr self: Self*]() -> i32 {
  21. return (*self).n;
  22. }
  23. // --- fail_return_self_value.carbon
  24. library "[[@TEST_NAME]]";
  25. class Class {
  26. // CHECK:STDERR: fail_return_self_value.carbon:[[@LINE+13]]:25: error: invalid use of incomplete type `Class` [IncompleteTypeInConversion]
  27. // CHECK:STDERR: fn F[self: Self]() -> self;
  28. // CHECK:STDERR: ^~~~
  29. // CHECK:STDERR: fail_return_self_value.carbon:[[@LINE-4]]:1: note: class is incomplete within its definition [ClassIncompleteWithinDefinition]
  30. // CHECK:STDERR: class Class {
  31. // CHECK:STDERR: ^~~~~~~~~~~~~
  32. // CHECK:STDERR:
  33. // CHECK:STDERR: fail_return_self_value.carbon:[[@LINE+6]]:25: error: cannot implicitly convert from `Class` to `type` [ImplicitAsConversionFailure]
  34. // CHECK:STDERR: fn F[self: Self]() -> self;
  35. // CHECK:STDERR: ^~~~
  36. // CHECK:STDERR: fail_return_self_value.carbon:[[@LINE+3]]:25: note: type `<error>` does not implement interface `ImplicitAs` [MissingImplInMemberAccessNote]
  37. // CHECK:STDERR: fn F[self: Self]() -> self;
  38. // CHECK:STDERR: ^~~~
  39. fn F[self: Self]() -> self;
  40. }
  41. // CHECK:STDOUT: --- self.carbon
  42. // CHECK:STDOUT:
  43. // CHECK:STDOUT: constants {
  44. // CHECK:STDOUT: %Class: type = class_type @Class [template]
  45. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  46. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  47. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  48. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  49. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  50. // CHECK:STDOUT: %.2: type = ptr_type %Class [template]
  51. // CHECK:STDOUT: %G.type: type = fn_type @G [template]
  52. // CHECK:STDOUT: %G: %G.type = struct_value () [template]
  53. // CHECK:STDOUT: %.3: type = unbound_element_type %Class, i32 [template]
  54. // CHECK:STDOUT: %.4: type = struct_type {.n: i32} [template]
  55. // CHECK:STDOUT: %.5: <witness> = complete_type_witness %.4 [template]
  56. // CHECK:STDOUT: %.6: type = ptr_type %.4 [template]
  57. // CHECK:STDOUT: }
  58. // CHECK:STDOUT:
  59. // CHECK:STDOUT: imports {
  60. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  61. // CHECK:STDOUT: .Int32 = %import_ref
  62. // CHECK:STDOUT: import Core//prelude
  63. // CHECK:STDOUT: import Core//prelude/...
  64. // CHECK:STDOUT: }
  65. // CHECK:STDOUT: %import_ref: %Int32.type = import_ref Core//prelude/types, inst+15, loaded [template = constants.%Int32]
  66. // CHECK:STDOUT: }
  67. // CHECK:STDOUT:
  68. // CHECK:STDOUT: file {
  69. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  70. // CHECK:STDOUT: .Core = imports.%Core
  71. // CHECK:STDOUT: .Class = %Class.decl
  72. // CHECK:STDOUT: }
  73. // CHECK:STDOUT: %Core.import = import Core
  74. // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} {}
  75. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  76. // CHECK:STDOUT: %self.patt: %Class = binding_pattern self
  77. // CHECK:STDOUT: %self.param_patt: %Class = value_param_pattern %self.patt, runtime_param0
  78. // CHECK:STDOUT: %return.patt: i32 = return_slot_pattern
  79. // CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param1
  80. // CHECK:STDOUT: } {
  81. // CHECK:STDOUT: %Self.ref.loc11: type = name_ref Self, constants.%Class [template = constants.%Class]
  82. // CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%Int32() [template = i32]
  83. // CHECK:STDOUT: %.loc11_29.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32]
  84. // CHECK:STDOUT: %.loc11_29.2: type = converted %int.make_type_32.loc11, %.loc11_29.1 [template = i32]
  85. // CHECK:STDOUT: %self.param.loc11: %Class = value_param runtime_param0
  86. // CHECK:STDOUT: %self.loc11: %Class = bind_name self, %self.param.loc11
  87. // CHECK:STDOUT: %return.param.loc11: ref i32 = out_param runtime_param1
  88. // CHECK:STDOUT: %return: ref i32 = return_slot %return.param.loc11
  89. // CHECK:STDOUT: }
  90. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
  91. // CHECK:STDOUT: %self.patt: %.2 = binding_pattern self
  92. // CHECK:STDOUT: %self.param_patt: %.2 = value_param_pattern %self.patt, runtime_param0
  93. // CHECK:STDOUT: %.loc15_12: auto = addr_pattern %self.param_patt
  94. // CHECK:STDOUT: %return.patt: i32 = return_slot_pattern
  95. // CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param1
  96. // CHECK:STDOUT: } {
  97. // CHECK:STDOUT: %Self.ref.loc15: type = name_ref Self, constants.%Class [template = constants.%Class]
  98. // CHECK:STDOUT: %.loc15_27: type = ptr_type %Class [template = constants.%.2]
  99. // CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%Int32() [template = i32]
  100. // CHECK:STDOUT: %.loc15_35.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32]
  101. // CHECK:STDOUT: %.loc15_35.2: type = converted %int.make_type_32.loc15, %.loc15_35.1 [template = i32]
  102. // CHECK:STDOUT: %self.param.loc15: %.2 = value_param runtime_param0
  103. // CHECK:STDOUT: %self.loc15: %.2 = bind_name self, %self.param.loc15
  104. // CHECK:STDOUT: %return.param.loc15: ref i32 = out_param runtime_param1
  105. // CHECK:STDOUT: %return: ref i32 = return_slot %return.param.loc15
  106. // CHECK:STDOUT: }
  107. // CHECK:STDOUT: }
  108. // CHECK:STDOUT:
  109. // CHECK:STDOUT: class @Class {
  110. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  111. // CHECK:STDOUT: %self.patt: %Class = binding_pattern self
  112. // CHECK:STDOUT: %self.param_patt: %Class = value_param_pattern %self.patt, runtime_param0
  113. // CHECK:STDOUT: %return.patt: i32 = return_slot_pattern
  114. // CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param1
  115. // CHECK:STDOUT: } {
  116. // CHECK:STDOUT: %Self.ref.loc5: type = name_ref Self, constants.%Class [template = constants.%Class]
  117. // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32]
  118. // CHECK:STDOUT: %.loc5_25.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32]
  119. // CHECK:STDOUT: %.loc5_25.2: type = converted %int.make_type_32.loc5, %.loc5_25.1 [template = i32]
  120. // CHECK:STDOUT: %self.param.loc5: %Class = value_param runtime_param0
  121. // CHECK:STDOUT: %self.loc5: %Class = bind_name self, %self.param.loc5
  122. // CHECK:STDOUT: %return.param.loc5: ref i32 = out_param runtime_param1
  123. // CHECK:STDOUT: %.loc5_22: ref i32 = return_slot %return.param.loc5
  124. // CHECK:STDOUT: }
  125. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
  126. // CHECK:STDOUT: %self.patt: %.2 = binding_pattern self
  127. // CHECK:STDOUT: %self.param_patt: %.2 = value_param_pattern %self.patt, runtime_param0
  128. // CHECK:STDOUT: %.loc15_12: auto = addr_pattern %self.param_patt
  129. // CHECK:STDOUT: %return.patt: i32 = return_slot_pattern
  130. // CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param1
  131. // CHECK:STDOUT: } {
  132. // CHECK:STDOUT: %Self.ref.loc6: type = name_ref Self, constants.%Class [template = constants.%Class]
  133. // CHECK:STDOUT: %.loc6_23: type = ptr_type %Class [template = constants.%.2]
  134. // CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%Int32() [template = i32]
  135. // CHECK:STDOUT: %.loc6_31.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32]
  136. // CHECK:STDOUT: %.loc6_31.2: type = converted %int.make_type_32.loc6, %.loc6_31.1 [template = i32]
  137. // CHECK:STDOUT: %self.param.loc6: %.2 = value_param runtime_param0
  138. // CHECK:STDOUT: %self.loc6: %.2 = bind_name self, %self.param.loc6
  139. // CHECK:STDOUT: %return.param.loc6: ref i32 = out_param runtime_param1
  140. // CHECK:STDOUT: %.loc6_28: ref i32 = return_slot %return.param.loc6
  141. // CHECK:STDOUT: }
  142. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  143. // CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32]
  144. // CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32]
  145. // CHECK:STDOUT: %.loc8_8: %.3 = field_decl n, element0 [template]
  146. // CHECK:STDOUT: %.loc9: <witness> = complete_type_witness %.4 [template = constants.%.5]
  147. // CHECK:STDOUT:
  148. // CHECK:STDOUT: !members:
  149. // CHECK:STDOUT: .Self = constants.%Class
  150. // CHECK:STDOUT: .F = %F.decl
  151. // CHECK:STDOUT: .G = %G.decl
  152. // CHECK:STDOUT: .n = %.loc8_8
  153. // CHECK:STDOUT: }
  154. // CHECK:STDOUT:
  155. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  156. // CHECK:STDOUT:
  157. // CHECK:STDOUT: fn @F[%self.param_patt: %Class]() -> i32 {
  158. // CHECK:STDOUT: !entry:
  159. // CHECK:STDOUT: %self.ref: %Class = name_ref self, %self.loc11
  160. // CHECK:STDOUT: %n.ref: %.3 = name_ref n, @Class.%.loc8_8 [template = @Class.%.loc8_8]
  161. // CHECK:STDOUT: %.loc12_14.1: ref i32 = class_element_access %self.ref, element0
  162. // CHECK:STDOUT: %.loc12_14.2: i32 = bind_value %.loc12_14.1
  163. // CHECK:STDOUT: return %.loc12_14.2
  164. // CHECK:STDOUT: }
  165. // CHECK:STDOUT:
  166. // CHECK:STDOUT: fn @G[addr %self.param_patt: %.2]() -> i32 {
  167. // CHECK:STDOUT: !entry:
  168. // CHECK:STDOUT: %self.ref: %.2 = name_ref self, %self.loc15
  169. // CHECK:STDOUT: %.loc16_11: ref %Class = deref %self.ref
  170. // CHECK:STDOUT: %n.ref: %.3 = name_ref n, @Class.%.loc8_8 [template = @Class.%.loc8_8]
  171. // CHECK:STDOUT: %.loc16_17.1: ref i32 = class_element_access %.loc16_11, element0
  172. // CHECK:STDOUT: %.loc16_17.2: i32 = bind_value %.loc16_17.1
  173. // CHECK:STDOUT: return %.loc16_17.2
  174. // CHECK:STDOUT: }
  175. // CHECK:STDOUT:
  176. // CHECK:STDOUT: --- fail_return_self_value.carbon
  177. // CHECK:STDOUT:
  178. // CHECK:STDOUT: constants {
  179. // CHECK:STDOUT: %Class: type = class_type @Class [template]
  180. // CHECK:STDOUT: %ImplicitAs.type.1: type = generic_interface_type @ImplicitAs [template]
  181. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  182. // CHECK:STDOUT: %ImplicitAs: %ImplicitAs.type.1 = struct_value () [template]
  183. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic]
  184. // CHECK:STDOUT: %ImplicitAs.type.2: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic]
  185. // CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic]
  186. // CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic]
  187. // CHECK:STDOUT: %Self.2: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic]
  188. // CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic]
  189. // CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic]
  190. // CHECK:STDOUT: %.2: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic]
  191. // CHECK:STDOUT: %.3: %.2 = assoc_entity element0, imports.%import_ref.5 [symbolic]
  192. // CHECK:STDOUT: %ImplicitAs.type.3: type = interface_type @ImplicitAs, @ImplicitAs(type) [template]
  193. // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert, @ImplicitAs(type) [template]
  194. // CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template]
  195. // CHECK:STDOUT: %.4: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template]
  196. // CHECK:STDOUT: %.5: %.4 = assoc_entity element0, imports.%import_ref.5 [template]
  197. // CHECK:STDOUT: %.6: %.2 = assoc_entity element0, imports.%import_ref.6 [symbolic]
  198. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  199. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  200. // CHECK:STDOUT: %.7: type = struct_type {} [template]
  201. // CHECK:STDOUT: %.8: <witness> = complete_type_witness %.7 [template]
  202. // CHECK:STDOUT: }
  203. // CHECK:STDOUT:
  204. // CHECK:STDOUT: imports {
  205. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  206. // CHECK:STDOUT: .ImplicitAs = %import_ref.1
  207. // CHECK:STDOUT: import Core//prelude
  208. // CHECK:STDOUT: import Core//prelude/...
  209. // CHECK:STDOUT: }
  210. // CHECK:STDOUT: %import_ref.1: %ImplicitAs.type.1 = import_ref Core//prelude/operators/as, inst+49, loaded [template = constants.%ImplicitAs]
  211. // CHECK:STDOUT: %import_ref.2 = import_ref Core//prelude/operators/as, inst+55, unloaded
  212. // CHECK:STDOUT: %import_ref.3: @ImplicitAs.%.1 (%.2) = import_ref Core//prelude/operators/as, inst+77, loaded [symbolic = @ImplicitAs.%.2 (constants.%.6)]
  213. // CHECK:STDOUT: %import_ref.4 = import_ref Core//prelude/operators/as, inst+70, unloaded
  214. // CHECK:STDOUT: %import_ref.5 = import_ref Core//prelude/operators/as, inst+70, unloaded
  215. // CHECK:STDOUT: %import_ref.6 = import_ref Core//prelude/operators/as, inst+70, unloaded
  216. // CHECK:STDOUT: }
  217. // CHECK:STDOUT:
  218. // CHECK:STDOUT: file {
  219. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  220. // CHECK:STDOUT: .Core = imports.%Core
  221. // CHECK:STDOUT: .Class = %Class.decl
  222. // CHECK:STDOUT: }
  223. // CHECK:STDOUT: %Core.import = import Core
  224. // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} {}
  225. // CHECK:STDOUT: }
  226. // CHECK:STDOUT:
  227. // CHECK:STDOUT: generic interface @ImplicitAs(constants.%Dest: type) {
  228. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
  229. // CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)]
  230. // CHECK:STDOUT:
  231. // CHECK:STDOUT: !definition:
  232. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
  233. // CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)]
  234. // CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.1)]
  235. // CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)]
  236. // CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.2)]
  237. // CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.2) = assoc_entity element0, imports.%import_ref.5 [symbolic = %.2 (constants.%.3)]
  238. // CHECK:STDOUT:
  239. // CHECK:STDOUT: interface {
  240. // CHECK:STDOUT: !members:
  241. // CHECK:STDOUT: .Self = imports.%import_ref.2
  242. // CHECK:STDOUT: .Convert = imports.%import_ref.3
  243. // CHECK:STDOUT: witness = (imports.%import_ref.4)
  244. // CHECK:STDOUT: }
  245. // CHECK:STDOUT: }
  246. // CHECK:STDOUT:
  247. // CHECK:STDOUT: class @Class {
  248. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  249. // CHECK:STDOUT: %self.patt: %Class = binding_pattern self
  250. // CHECK:STDOUT: %self.param_patt: %Class = value_param_pattern %self.patt, runtime_param0
  251. // CHECK:STDOUT: %return.patt: <error> = return_slot_pattern
  252. // CHECK:STDOUT: %return.param_patt: <error> = out_param_pattern %return.patt, runtime_param1
  253. // CHECK:STDOUT: } {
  254. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class]
  255. // CHECK:STDOUT: %self.ref: %Class = name_ref self, %self
  256. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(type) [template = constants.%ImplicitAs.type.3]
  257. // CHECK:STDOUT: %.loc18_25.1: %.4 = specific_constant imports.%import_ref.3, @ImplicitAs(type) [template = constants.%.5]
  258. // CHECK:STDOUT: %Convert.ref: %.4 = name_ref Convert, %.loc18_25.1 [template = constants.%.5]
  259. // CHECK:STDOUT: %.loc18_25.2: type = converted %self.ref, <error> [template = <error>]
  260. // CHECK:STDOUT: %self.param: %Class = value_param runtime_param0
  261. // CHECK:STDOUT: %self: %Class = bind_name self, %self.param
  262. // CHECK:STDOUT: %return.param: ref <error> = out_param runtime_param1
  263. // CHECK:STDOUT: %return: ref <error> = return_slot %return.param
  264. // CHECK:STDOUT: }
  265. // CHECK:STDOUT: %.loc19: <witness> = complete_type_witness %.7 [template = constants.%.8]
  266. // CHECK:STDOUT:
  267. // CHECK:STDOUT: !members:
  268. // CHECK:STDOUT: .Self = constants.%Class
  269. // CHECK:STDOUT: .F = %F.decl
  270. // CHECK:STDOUT: }
  271. // CHECK:STDOUT:
  272. // CHECK:STDOUT: generic fn @Convert(constants.%Dest: type, constants.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) {
  273. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
  274. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
  275. // CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)]
  276. // CHECK:STDOUT:
  277. // CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self (%Self.2)]() -> @Convert.%Dest (%Dest);
  278. // CHECK:STDOUT: }
  279. // CHECK:STDOUT:
  280. // CHECK:STDOUT: fn @F[%self.param_patt: %Class]() -> <error>;
  281. // CHECK:STDOUT:
  282. // CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) {
  283. // CHECK:STDOUT: %Dest => constants.%Dest
  284. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  285. // CHECK:STDOUT: }
  286. // CHECK:STDOUT:
  287. // CHECK:STDOUT: specific @ImplicitAs(@ImplicitAs.%Dest) {
  288. // CHECK:STDOUT: %Dest => constants.%Dest
  289. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  290. // CHECK:STDOUT: }
  291. // CHECK:STDOUT:
  292. // CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {
  293. // CHECK:STDOUT: %Dest => constants.%Dest
  294. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  295. // CHECK:STDOUT: }
  296. // CHECK:STDOUT:
  297. // CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self.1) {
  298. // CHECK:STDOUT: %Dest => constants.%Dest
  299. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2
  300. // CHECK:STDOUT: %Self => constants.%Self.1
  301. // CHECK:STDOUT: }
  302. // CHECK:STDOUT:
  303. // CHECK:STDOUT: specific @ImplicitAs(type) {
  304. // CHECK:STDOUT: %Dest => type
  305. // CHECK:STDOUT: %Dest.patt => type
  306. // CHECK:STDOUT:
  307. // CHECK:STDOUT: !definition:
  308. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3
  309. // CHECK:STDOUT: %Self => constants.%Self.2
  310. // CHECK:STDOUT: %Convert.type => constants.%Convert.type.2
  311. // CHECK:STDOUT: %Convert => constants.%Convert.2
  312. // CHECK:STDOUT: %.1 => constants.%.4
  313. // CHECK:STDOUT: %.2 => constants.%.5
  314. // CHECK:STDOUT: }
  315. // CHECK:STDOUT: