generic.carbon 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  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/interface/no_prelude/generic.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/generic.carbon
  10. // --- generic.carbon
  11. library "generic";
  12. interface Simple(T:! type) {}
  13. class X {}
  14. interface WithAssocFn(T:! type) {
  15. // TODO: Take `Self`, return `T`, once that works.
  16. fn F() -> X;
  17. }
  18. class C {
  19. impl as Simple(C) {}
  20. impl as WithAssocFn(C) {
  21. fn F() -> X {
  22. return {};
  23. }
  24. }
  25. }
  26. interface WithImplicitArgs[T:! type](N:! T);
  27. fn Receive(T:! Simple(C));
  28. fn Pass(T:! Simple(C)) {
  29. Receive(T);
  30. }
  31. // --- fail_mismatched_args.carbon
  32. library "fail_mismatched_args";
  33. interface Generic(T:! type) {}
  34. class A {}
  35. class B {}
  36. fn F(T:! Generic(A));
  37. fn G(T:! Generic(B)) {
  38. // TODO: Include generic arguments in the type name.
  39. // CHECK:STDERR: fail_mismatched_args.carbon:[[@LINE+6]]:3: ERROR: Cannot implicitly convert from `Generic` to `Generic`.
  40. // CHECK:STDERR: F(T);
  41. // CHECK:STDERR: ^~
  42. // CHECK:STDERR: fail_mismatched_args.carbon:[[@LINE-6]]:1: Initializing parameter 1 of function declared here.
  43. // CHECK:STDERR: fn F(T:! Generic(A));
  44. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
  45. F(T);
  46. }
  47. // CHECK:STDOUT: --- generic.carbon
  48. // CHECK:STDOUT:
  49. // CHECK:STDOUT: constants {
  50. // CHECK:STDOUT: %T.1: type = bind_symbolic_name T 0 [symbolic]
  51. // CHECK:STDOUT: %Simple.type: type = generic_interface_type @Simple [template]
  52. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  53. // CHECK:STDOUT: %Simple: %Simple.type = struct_value () [template]
  54. // CHECK:STDOUT: %.2: type = interface_type @Simple, (%T.1) [symbolic]
  55. // CHECK:STDOUT: %Self.1: %.2 = bind_symbolic_name Self 1 [symbolic]
  56. // CHECK:STDOUT: %X: type = class_type @X [template]
  57. // CHECK:STDOUT: %.3: type = struct_type {} [template]
  58. // CHECK:STDOUT: %WithAssocFn.type: type = generic_interface_type @WithAssocFn [template]
  59. // CHECK:STDOUT: %WithAssocFn: %WithAssocFn.type = struct_value () [template]
  60. // CHECK:STDOUT: %.4: type = interface_type @WithAssocFn, (%T.1) [symbolic]
  61. // CHECK:STDOUT: %Self.2: %.4 = bind_symbolic_name Self 1 [symbolic]
  62. // CHECK:STDOUT: %F.type.1: type = fn_type @F.1 [template]
  63. // CHECK:STDOUT: %F.1: %F.type.1 = struct_value () [template]
  64. // CHECK:STDOUT: %.5: type = assoc_entity_type @WithAssocFn, %F.type.1 [template]
  65. // CHECK:STDOUT: %.6: %.5 = assoc_entity element0, @WithAssocFn.%F.decl [template]
  66. // CHECK:STDOUT: %C: type = class_type @C [template]
  67. // CHECK:STDOUT: %.7: type = interface_type @Simple, (%C) [template]
  68. // CHECK:STDOUT: %.8: <witness> = interface_witness () [template]
  69. // CHECK:STDOUT: %.9: type = interface_type @WithAssocFn, (%C) [template]
  70. // CHECK:STDOUT: %F.type.2: type = fn_type @F.2 [template]
  71. // CHECK:STDOUT: %F.2: %F.type.2 = struct_value () [template]
  72. // CHECK:STDOUT: %.10: <witness> = interface_witness (%F.2) [template]
  73. // CHECK:STDOUT: %.11: type = ptr_type %.3 [template]
  74. // CHECK:STDOUT: %struct: %X = struct_value () [template]
  75. // CHECK:STDOUT: %N: %T.1 = bind_symbolic_name N 1 [symbolic]
  76. // CHECK:STDOUT: %WithImplicitArgs.type: type = generic_interface_type @WithImplicitArgs [template]
  77. // CHECK:STDOUT: %WithImplicitArgs: %WithImplicitArgs.type = struct_value () [template]
  78. // CHECK:STDOUT: %T.2: %.7 = bind_symbolic_name T 0 [symbolic]
  79. // CHECK:STDOUT: %Receive.type: type = fn_type @Receive [template]
  80. // CHECK:STDOUT: %Receive: %Receive.type = struct_value () [template]
  81. // CHECK:STDOUT: %Pass.type: type = fn_type @Pass [template]
  82. // CHECK:STDOUT: %Pass: %Pass.type = struct_value () [template]
  83. // CHECK:STDOUT: }
  84. // CHECK:STDOUT:
  85. // CHECK:STDOUT: file {
  86. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  87. // CHECK:STDOUT: .Simple = %Simple.decl
  88. // CHECK:STDOUT: .X = %X.decl
  89. // CHECK:STDOUT: .WithAssocFn = %WithAssocFn.decl
  90. // CHECK:STDOUT: .C = %C.decl
  91. // CHECK:STDOUT: .WithImplicitArgs = %WithImplicitArgs.decl
  92. // CHECK:STDOUT: .Receive = %Receive.decl
  93. // CHECK:STDOUT: .Pass = %Pass.decl
  94. // CHECK:STDOUT: }
  95. // CHECK:STDOUT: %Simple.decl: %Simple.type = interface_decl @Simple [template = constants.%Simple] {
  96. // CHECK:STDOUT: %T.loc4_18.1: type = param T
  97. // CHECK:STDOUT: %T.loc4_18.2: type = bind_symbolic_name T 0, %T.loc4_18.1 [symbolic = constants.%T.1]
  98. // CHECK:STDOUT: }
  99. // CHECK:STDOUT: %X.decl: type = class_decl @X [template = constants.%X] {}
  100. // CHECK:STDOUT: %WithAssocFn.decl: %WithAssocFn.type = interface_decl @WithAssocFn [template = constants.%WithAssocFn] {
  101. // CHECK:STDOUT: %T.loc8_23.1: type = param T
  102. // CHECK:STDOUT: %T.loc8_23.2: type = bind_symbolic_name T 0, %T.loc8_23.1 [symbolic = constants.%T.1]
  103. // CHECK:STDOUT: }
  104. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {}
  105. // CHECK:STDOUT: %WithImplicitArgs.decl: %WithImplicitArgs.type = interface_decl @WithImplicitArgs [template = constants.%WithImplicitArgs] {
  106. // CHECK:STDOUT: %T.loc22_28.1: type = param T
  107. // CHECK:STDOUT: %T.loc22_28.2: type = bind_symbolic_name T 0, %T.loc22_28.1 [symbolic = constants.%T.1]
  108. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc22_28.2 [symbolic = constants.%T.1]
  109. // CHECK:STDOUT: %N.loc22_38.1: %T.1 = param N
  110. // CHECK:STDOUT: %N.loc22_38.2: %T.1 = bind_symbolic_name N 1, %N.loc22_38.1 [symbolic = constants.%N]
  111. // CHECK:STDOUT: }
  112. // CHECK:STDOUT: %Receive.decl: %Receive.type = fn_decl @Receive [template = constants.%Receive] {
  113. // CHECK:STDOUT: %Simple.ref.loc24: %Simple.type = name_ref Simple, %Simple.decl [template = constants.%Simple]
  114. // CHECK:STDOUT: %C.ref.loc24: type = name_ref C, %C.decl [template = constants.%C]
  115. // CHECK:STDOUT: %.loc24_22: init type = call %Simple.ref.loc24(%C.ref.loc24) [template = constants.%.7]
  116. // CHECK:STDOUT: %.loc24_24.1: type = value_of_initializer %.loc24_22 [template = constants.%.7]
  117. // CHECK:STDOUT: %.loc24_24.2: type = converted %.loc24_22, %.loc24_24.1 [template = constants.%.7]
  118. // CHECK:STDOUT: %T.loc24_12.1: %.7 = param T
  119. // CHECK:STDOUT: @Receive.%T: %.7 = bind_symbolic_name T 0, %T.loc24_12.1 [symbolic = constants.%T.2]
  120. // CHECK:STDOUT: }
  121. // CHECK:STDOUT: %Pass.decl: %Pass.type = fn_decl @Pass [template = constants.%Pass] {
  122. // CHECK:STDOUT: %Simple.ref.loc25: %Simple.type = name_ref Simple, %Simple.decl [template = constants.%Simple]
  123. // CHECK:STDOUT: %C.ref.loc25: type = name_ref C, %C.decl [template = constants.%C]
  124. // CHECK:STDOUT: %.loc25_19: init type = call %Simple.ref.loc25(%C.ref.loc25) [template = constants.%.7]
  125. // CHECK:STDOUT: %.loc25_21.1: type = value_of_initializer %.loc25_19 [template = constants.%.7]
  126. // CHECK:STDOUT: %.loc25_21.2: type = converted %.loc25_19, %.loc25_21.1 [template = constants.%.7]
  127. // CHECK:STDOUT: %T.loc25_9.1: %.7 = param T
  128. // CHECK:STDOUT: @Pass.%T: %.7 = bind_symbolic_name T 0, %T.loc25_9.1 [symbolic = constants.%T.2]
  129. // CHECK:STDOUT: }
  130. // CHECK:STDOUT: }
  131. // CHECK:STDOUT:
  132. // CHECK:STDOUT: interface @Simple
  133. // CHECK:STDOUT: generic [file.%T.loc4_18.2: type] {
  134. // CHECK:STDOUT: %Self: %.2 = bind_symbolic_name Self 1 [symbolic = constants.%Self.1]
  135. // CHECK:STDOUT:
  136. // CHECK:STDOUT: !members:
  137. // CHECK:STDOUT: .Self = %Self
  138. // CHECK:STDOUT: witness = ()
  139. // CHECK:STDOUT: }
  140. // CHECK:STDOUT:
  141. // CHECK:STDOUT: interface @WithAssocFn
  142. // CHECK:STDOUT: generic [file.%T.loc8_23.2: type] {
  143. // CHECK:STDOUT: %Self: %.4 = bind_symbolic_name Self 1 [symbolic = constants.%Self.2]
  144. // CHECK:STDOUT: %F.decl: %F.type.1 = fn_decl @F.1 [template = constants.%F.1] {
  145. // CHECK:STDOUT: %X.ref: type = name_ref X, file.%X.decl [template = constants.%X]
  146. // CHECK:STDOUT: %return.var: ref %X = var <return slot>
  147. // CHECK:STDOUT: }
  148. // CHECK:STDOUT: %.loc10: %.5 = assoc_entity element0, %F.decl [template = constants.%.6]
  149. // CHECK:STDOUT:
  150. // CHECK:STDOUT: !members:
  151. // CHECK:STDOUT: .Self = %Self
  152. // CHECK:STDOUT: .F = %.loc10
  153. // CHECK:STDOUT: witness = (%F.decl)
  154. // CHECK:STDOUT: }
  155. // CHECK:STDOUT:
  156. // CHECK:STDOUT: interface @WithImplicitArgs
  157. // CHECK:STDOUT: generic [file.%T.loc22_28.2: type, file.%N.loc22_38.2: %T.1];
  158. // CHECK:STDOUT:
  159. // CHECK:STDOUT: impl @impl.1: %C as %.7 {
  160. // CHECK:STDOUT: %.1: <witness> = interface_witness () [template = constants.%.8]
  161. // CHECK:STDOUT:
  162. // CHECK:STDOUT: !members:
  163. // CHECK:STDOUT: witness = %.1
  164. // CHECK:STDOUT: }
  165. // CHECK:STDOUT:
  166. // CHECK:STDOUT: impl @impl.2: %C as %.9 {
  167. // CHECK:STDOUT: %F.decl: %F.type.2 = fn_decl @F.2 [template = constants.%F.2] {
  168. // CHECK:STDOUT: %X.ref: type = name_ref X, file.%X.decl [template = constants.%X]
  169. // CHECK:STDOUT: %return.var: ref %X = var <return slot>
  170. // CHECK:STDOUT: }
  171. // CHECK:STDOUT: %.1: <witness> = interface_witness (%F.decl) [template = constants.%.10]
  172. // CHECK:STDOUT:
  173. // CHECK:STDOUT: !members:
  174. // CHECK:STDOUT: .F = %F.decl
  175. // CHECK:STDOUT: witness = %.1
  176. // CHECK:STDOUT: }
  177. // CHECK:STDOUT:
  178. // CHECK:STDOUT: class @X {
  179. // CHECK:STDOUT: !members:
  180. // CHECK:STDOUT: .Self = constants.%X
  181. // CHECK:STDOUT: }
  182. // CHECK:STDOUT:
  183. // CHECK:STDOUT: class @C {
  184. // CHECK:STDOUT: %.loc14_19.1: type = value_of_initializer %.loc14_17 [template = constants.%.7]
  185. // CHECK:STDOUT: %.loc14_19.2: type = converted %.loc14_17, %.loc14_19.1 [template = constants.%.7]
  186. // CHECK:STDOUT: impl_decl @impl.1 {
  187. // CHECK:STDOUT: %Simple.ref: %Simple.type = name_ref Simple, file.%Simple.decl [template = constants.%Simple]
  188. // CHECK:STDOUT: %C.ref.loc14: type = name_ref C, file.%C.decl [template = constants.%C]
  189. // CHECK:STDOUT: %.loc14_17: init type = call %Simple.ref(%C.ref.loc14) [template = constants.%.7]
  190. // CHECK:STDOUT: }
  191. // CHECK:STDOUT: %.loc15_24.1: type = value_of_initializer %.loc15_22 [template = constants.%.9]
  192. // CHECK:STDOUT: %.loc15_24.2: type = converted %.loc15_22, %.loc15_24.1 [template = constants.%.9]
  193. // CHECK:STDOUT: impl_decl @impl.2 {
  194. // CHECK:STDOUT: %WithAssocFn.ref: %WithAssocFn.type = name_ref WithAssocFn, file.%WithAssocFn.decl [template = constants.%WithAssocFn]
  195. // CHECK:STDOUT: %C.ref.loc15: type = name_ref C, file.%C.decl [template = constants.%C]
  196. // CHECK:STDOUT: %.loc15_22: init type = call %WithAssocFn.ref(%C.ref.loc15) [template = constants.%.9]
  197. // CHECK:STDOUT: }
  198. // CHECK:STDOUT:
  199. // CHECK:STDOUT: !members:
  200. // CHECK:STDOUT: .Self = constants.%C
  201. // CHECK:STDOUT: }
  202. // CHECK:STDOUT:
  203. // CHECK:STDOUT: fn @F.1() -> %X
  204. // CHECK:STDOUT: generic [file.%T.loc8_23.2: type, @WithAssocFn.%Self: %.4];
  205. // CHECK:STDOUT:
  206. // CHECK:STDOUT: fn @F.2() -> @impl.2.%return.var: %X {
  207. // CHECK:STDOUT: !entry:
  208. // CHECK:STDOUT: %.loc17_15.1: %.3 = struct_literal ()
  209. // CHECK:STDOUT: %.loc17_15.2: init %X = class_init (), @impl.2.%return.var [template = constants.%struct]
  210. // CHECK:STDOUT: %.loc17_16: init %X = converted %.loc17_15.1, %.loc17_15.2 [template = constants.%struct]
  211. // CHECK:STDOUT: return %.loc17_16 to @impl.2.%return.var
  212. // CHECK:STDOUT: }
  213. // CHECK:STDOUT:
  214. // CHECK:STDOUT: fn @Receive(%T: %.7)
  215. // CHECK:STDOUT: generic [%T: %.7];
  216. // CHECK:STDOUT:
  217. // CHECK:STDOUT: fn @Pass(%T: %.7)
  218. // CHECK:STDOUT: generic [%T: %.7] {
  219. // CHECK:STDOUT: !entry:
  220. // CHECK:STDOUT: %Receive.ref: %Receive.type = name_ref Receive, file.%Receive.decl [template = constants.%Receive]
  221. // CHECK:STDOUT: %T.ref: %.7 = name_ref T, %T [symbolic = constants.%T.2]
  222. // CHECK:STDOUT: %Receive.call: init %.1 = call %Receive.ref(%T.ref)
  223. // CHECK:STDOUT: return
  224. // CHECK:STDOUT: }
  225. // CHECK:STDOUT:
  226. // CHECK:STDOUT: --- fail_mismatched_args.carbon
  227. // CHECK:STDOUT:
  228. // CHECK:STDOUT: constants {
  229. // CHECK:STDOUT: %T.1: type = bind_symbolic_name T 0 [symbolic]
  230. // CHECK:STDOUT: %Generic.type: type = generic_interface_type @Generic [template]
  231. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  232. // CHECK:STDOUT: %Generic: %Generic.type = struct_value () [template]
  233. // CHECK:STDOUT: %.2: type = interface_type @Generic, (%T.1) [symbolic]
  234. // CHECK:STDOUT: %Self: %.2 = bind_symbolic_name Self 1 [symbolic]
  235. // CHECK:STDOUT: %A: type = class_type @A [template]
  236. // CHECK:STDOUT: %.3: type = struct_type {} [template]
  237. // CHECK:STDOUT: %B: type = class_type @B [template]
  238. // CHECK:STDOUT: %.4: type = interface_type @Generic, (%A) [template]
  239. // CHECK:STDOUT: %T.2: %.4 = bind_symbolic_name T 0 [symbolic]
  240. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  241. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  242. // CHECK:STDOUT: %.5: type = interface_type @Generic, (%B) [template]
  243. // CHECK:STDOUT: %T.3: %.5 = bind_symbolic_name T 0 [symbolic]
  244. // CHECK:STDOUT: %G.type: type = fn_type @G [template]
  245. // CHECK:STDOUT: %G: %G.type = struct_value () [template]
  246. // CHECK:STDOUT: }
  247. // CHECK:STDOUT:
  248. // CHECK:STDOUT: file {
  249. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  250. // CHECK:STDOUT: .Generic = %Generic.decl
  251. // CHECK:STDOUT: .A = %A.decl
  252. // CHECK:STDOUT: .B = %B.decl
  253. // CHECK:STDOUT: .F = %F.decl
  254. // CHECK:STDOUT: .G = %G.decl
  255. // CHECK:STDOUT: }
  256. // CHECK:STDOUT: %Generic.decl: %Generic.type = interface_decl @Generic [template = constants.%Generic] {
  257. // CHECK:STDOUT: %T.loc4_19.1: type = param T
  258. // CHECK:STDOUT: %T.loc4_19.2: type = bind_symbolic_name T 0, %T.loc4_19.1 [symbolic = constants.%T.1]
  259. // CHECK:STDOUT: }
  260. // CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {}
  261. // CHECK:STDOUT: %B.decl: type = class_decl @B [template = constants.%B] {}
  262. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  263. // CHECK:STDOUT: %Generic.ref.loc9: %Generic.type = name_ref Generic, %Generic.decl [template = constants.%Generic]
  264. // CHECK:STDOUT: %A.ref: type = name_ref A, %A.decl [template = constants.%A]
  265. // CHECK:STDOUT: %.loc9_17: init type = call %Generic.ref.loc9(%A.ref) [template = constants.%.4]
  266. // CHECK:STDOUT: %.loc9_19.1: type = value_of_initializer %.loc9_17 [template = constants.%.4]
  267. // CHECK:STDOUT: %.loc9_19.2: type = converted %.loc9_17, %.loc9_19.1 [template = constants.%.4]
  268. // CHECK:STDOUT: %T.loc9_6.1: %.4 = param T
  269. // CHECK:STDOUT: @F.%T: %.4 = bind_symbolic_name T 0, %T.loc9_6.1 [symbolic = constants.%T.2]
  270. // CHECK:STDOUT: }
  271. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
  272. // CHECK:STDOUT: %Generic.ref.loc10: %Generic.type = name_ref Generic, %Generic.decl [template = constants.%Generic]
  273. // CHECK:STDOUT: %B.ref: type = name_ref B, %B.decl [template = constants.%B]
  274. // CHECK:STDOUT: %.loc10_17: init type = call %Generic.ref.loc10(%B.ref) [template = constants.%.5]
  275. // CHECK:STDOUT: %.loc10_19.1: type = value_of_initializer %.loc10_17 [template = constants.%.5]
  276. // CHECK:STDOUT: %.loc10_19.2: type = converted %.loc10_17, %.loc10_19.1 [template = constants.%.5]
  277. // CHECK:STDOUT: %T.loc10_6.1: %.5 = param T
  278. // CHECK:STDOUT: @G.%T: %.5 = bind_symbolic_name T 0, %T.loc10_6.1 [symbolic = constants.%T.3]
  279. // CHECK:STDOUT: }
  280. // CHECK:STDOUT: }
  281. // CHECK:STDOUT:
  282. // CHECK:STDOUT: interface @Generic
  283. // CHECK:STDOUT: generic [file.%T.loc4_19.2: type] {
  284. // CHECK:STDOUT: %Self: %.2 = bind_symbolic_name Self 1 [symbolic = constants.%Self]
  285. // CHECK:STDOUT:
  286. // CHECK:STDOUT: !members:
  287. // CHECK:STDOUT: .Self = %Self
  288. // CHECK:STDOUT: witness = ()
  289. // CHECK:STDOUT: }
  290. // CHECK:STDOUT:
  291. // CHECK:STDOUT: class @A {
  292. // CHECK:STDOUT: !members:
  293. // CHECK:STDOUT: .Self = constants.%A
  294. // CHECK:STDOUT: }
  295. // CHECK:STDOUT:
  296. // CHECK:STDOUT: class @B {
  297. // CHECK:STDOUT: !members:
  298. // CHECK:STDOUT: .Self = constants.%B
  299. // CHECK:STDOUT: }
  300. // CHECK:STDOUT:
  301. // CHECK:STDOUT: fn @F(%T: %.4)
  302. // CHECK:STDOUT: generic [%T: %.4];
  303. // CHECK:STDOUT:
  304. // CHECK:STDOUT: fn @G(%T: %.5)
  305. // CHECK:STDOUT: generic [%T: %.5] {
  306. // CHECK:STDOUT: !entry:
  307. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F]
  308. // CHECK:STDOUT: %T.ref: %.5 = name_ref T, %T [symbolic = constants.%T.3]
  309. // CHECK:STDOUT: %F.call: init %.1 = call %F.ref(<invalid>) [template = <error>]
  310. // CHECK:STDOUT: return
  311. // CHECK:STDOUT: }
  312. // CHECK:STDOUT: