b6faa454160b04a71aebd4eefba1074e82f6b991 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. compilation_unit {
  2. package_statement {
  3. package_name: "ExplorerTest"
  4. }
  5. is_api: true
  6. declarations {
  7. interface {
  8. name {
  9. name: "A"
  10. }
  11. members {
  12. function {
  13. name {
  14. name: "F"
  15. }
  16. param_pattern {
  17. }
  18. return_term {
  19. kind: Expression
  20. type {
  21. int_type_literal {
  22. }
  23. }
  24. }
  25. }
  26. }
  27. }
  28. }
  29. declarations {
  30. interface {
  31. name {
  32. name: "B"
  33. }
  34. members {
  35. function {
  36. name {
  37. name: "F"
  38. }
  39. param_pattern {
  40. }
  41. return_term {
  42. kind: Expression
  43. type {
  44. int_type_literal {
  45. }
  46. }
  47. }
  48. }
  49. }
  50. }
  51. }
  52. declarations {
  53. impl {
  54. kind: InternalImpl
  55. impl_type {
  56. int_type_literal {
  57. }
  58. }
  59. interface {
  60. identifier {
  61. name: "A"
  62. }
  63. }
  64. members {
  65. function {
  66. name {
  67. name: "F"
  68. }
  69. param_pattern {
  70. }
  71. return_term {
  72. kind: Expression
  73. type {
  74. int_type_literal {
  75. }
  76. }
  77. }
  78. body {
  79. statements {
  80. return_expression_statement {
  81. expression {
  82. int_literal {
  83. value: 1
  84. }
  85. }
  86. }
  87. }
  88. }
  89. }
  90. }
  91. }
  92. }
  93. declarations {
  94. impl {
  95. kind: InternalImpl
  96. impl_type {
  97. int_type_literal {
  98. }
  99. }
  100. interface {
  101. identifier {
  102. name: "B"
  103. }
  104. }
  105. members {
  106. function {
  107. name {
  108. name: "F"
  109. }
  110. param_pattern {
  111. }
  112. return_term {
  113. kind: Expression
  114. type {
  115. int_type_literal {
  116. }
  117. }
  118. }
  119. body {
  120. statements {
  121. return_expression_statement {
  122. expression {
  123. int_literal {
  124. value: 2
  125. }
  126. }
  127. }
  128. }
  129. }
  130. }
  131. }
  132. }
  133. }
  134. declarations {
  135. function {
  136. name {
  137. name: "GetA"
  138. }
  139. deduced_parameters {
  140. name: "T"
  141. type {
  142. identifier {
  143. name: "A"
  144. }
  145. }
  146. }
  147. param_pattern {
  148. fields {
  149. binding_pattern {
  150. name: "x"
  151. type {
  152. expression_pattern {
  153. expression {
  154. identifier {
  155. name: "T"
  156. }
  157. }
  158. }
  159. }
  160. }
  161. }
  162. }
  163. return_term {
  164. kind: Expression
  165. type {
  166. int_type_literal {
  167. }
  168. }
  169. }
  170. body {
  171. statements {
  172. return_expression_statement {
  173. expression {
  174. call {
  175. function {
  176. simple_member_access {
  177. field: "F"
  178. object {
  179. identifier {
  180. name: "x"
  181. }
  182. }
  183. }
  184. }
  185. argument {
  186. tuple_literal {
  187. }
  188. }
  189. }
  190. }
  191. }
  192. }
  193. }
  194. }
  195. }
  196. declarations {
  197. function {
  198. name {
  199. name: "GetAB"
  200. }
  201. deduced_parameters {
  202. name: "T"
  203. type {
  204. where {
  205. base {
  206. identifier {
  207. name: "B"
  208. }
  209. }
  210. clauses {
  211. impls {
  212. type {
  213. designator {
  214. name: "Self"
  215. }
  216. }
  217. constraint {
  218. identifier {
  219. name: "A"
  220. }
  221. }
  222. }
  223. }
  224. }
  225. }
  226. }
  227. param_pattern {
  228. fields {
  229. binding_pattern {
  230. name: "x"
  231. type {
  232. expression_pattern {
  233. expression {
  234. identifier {
  235. name: "T"
  236. }
  237. }
  238. }
  239. }
  240. }
  241. }
  242. }
  243. return_term {
  244. kind: Expression
  245. type {
  246. int_type_literal {
  247. }
  248. }
  249. }
  250. body {
  251. statements {
  252. return_expression_statement {
  253. expression {
  254. operator {
  255. op: Add
  256. arguments {
  257. operator {
  258. op: Mul
  259. arguments {
  260. int_literal {
  261. value: 10
  262. }
  263. }
  264. arguments {
  265. call {
  266. function {
  267. identifier {
  268. name: "GetA"
  269. }
  270. }
  271. argument {
  272. tuple_literal {
  273. fields {
  274. identifier {
  275. name: "x"
  276. }
  277. }
  278. }
  279. }
  280. }
  281. }
  282. }
  283. }
  284. arguments {
  285. call {
  286. function {
  287. simple_member_access {
  288. field: "F"
  289. object {
  290. identifier {
  291. name: "x"
  292. }
  293. }
  294. }
  295. }
  296. argument {
  297. tuple_literal {
  298. }
  299. }
  300. }
  301. }
  302. }
  303. }
  304. }
  305. }
  306. }
  307. }
  308. }
  309. declarations {
  310. function {
  311. name {
  312. name: "Main"
  313. }
  314. param_pattern {
  315. }
  316. return_term {
  317. kind: Expression
  318. type {
  319. int_type_literal {
  320. }
  321. }
  322. }
  323. body {
  324. statements {
  325. variable_definition {
  326. pattern {
  327. binding_pattern {
  328. name: "v"
  329. type {
  330. expression_pattern {
  331. expression {
  332. int_type_literal {
  333. }
  334. }
  335. }
  336. }
  337. }
  338. }
  339. init {
  340. int_literal {
  341. value: 0
  342. }
  343. }
  344. is_returned: false
  345. }
  346. }
  347. statements {
  348. return_expression_statement {
  349. expression {
  350. call {
  351. function {
  352. identifier {
  353. name: "GetAB"
  354. }
  355. }
  356. argument {
  357. tuple_literal {
  358. fields {
  359. identifier {
  360. name: "v"
  361. }
  362. }
  363. }
  364. }
  365. }
  366. }
  367. }
  368. }
  369. }
  370. }
  371. }
  372. }