ae4250e3cccc84665079618f2b1e94890c23a863 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. compilation_unit {
  2. package_statement {
  3. package_name: "ExplorerTest"
  4. }
  5. is_api: true
  6. declarations {
  7. interface {
  8. name {
  9. name: "HasAssoc"
  10. }
  11. members {
  12. let {
  13. pattern {
  14. generic_binding {
  15. name: "Assoc"
  16. type {
  17. int_type_literal {
  18. }
  19. }
  20. }
  21. }
  22. }
  23. }
  24. }
  25. }
  26. declarations {
  27. class_declaration {
  28. name {
  29. name: "X"
  30. }
  31. members {
  32. impl {
  33. kind: ExternalImpl
  34. impl_type {
  35. identifier {
  36. name: "Self"
  37. }
  38. }
  39. interface {
  40. where {
  41. base {
  42. identifier {
  43. name: "HasAssoc"
  44. }
  45. }
  46. clauses {
  47. rewrite {
  48. member_name: "Assoc"
  49. replacement {
  50. int_literal {
  51. value: 1
  52. }
  53. }
  54. }
  55. }
  56. }
  57. }
  58. }
  59. }
  60. }
  61. }
  62. declarations {
  63. alias {
  64. name {
  65. name: "WithoutRewrite"
  66. }
  67. target {
  68. where {
  69. base {
  70. identifier {
  71. name: "HasAssoc"
  72. }
  73. }
  74. clauses {
  75. equals {
  76. lhs {
  77. designator {
  78. name: "Assoc"
  79. }
  80. }
  81. rhs {
  82. int_literal {
  83. value: 1
  84. }
  85. }
  86. }
  87. }
  88. }
  89. }
  90. }
  91. }
  92. declarations {
  93. alias {
  94. name {
  95. name: "WithRewrite"
  96. }
  97. target {
  98. where {
  99. base {
  100. identifier {
  101. name: "HasAssoc"
  102. }
  103. }
  104. clauses {
  105. rewrite {
  106. member_name: "Assoc"
  107. replacement {
  108. int_literal {
  109. value: 1
  110. }
  111. }
  112. }
  113. }
  114. }
  115. }
  116. }
  117. }
  118. declarations {
  119. function {
  120. name {
  121. name: "F"
  122. }
  123. deduced_parameters {
  124. name: "T"
  125. type {
  126. identifier {
  127. name: "WithRewrite"
  128. }
  129. }
  130. }
  131. param_pattern {
  132. fields {
  133. binding_pattern {
  134. name: "x"
  135. type {
  136. expression_pattern {
  137. expression {
  138. identifier {
  139. name: "T"
  140. }
  141. }
  142. }
  143. }
  144. }
  145. }
  146. }
  147. return_term {
  148. kind: Expression
  149. type {
  150. int_type_literal {
  151. }
  152. }
  153. }
  154. body {
  155. statements {
  156. return_expression_statement {
  157. expression {
  158. compound_member_access {
  159. object {
  160. identifier {
  161. name: "x"
  162. }
  163. }
  164. path {
  165. simple_member_access {
  166. field: "Assoc"
  167. object {
  168. identifier {
  169. name: "WithoutRewrite"
  170. }
  171. }
  172. }
  173. }
  174. }
  175. }
  176. }
  177. }
  178. }
  179. }
  180. }
  181. declarations {
  182. function {
  183. name {
  184. name: "Main"
  185. }
  186. param_pattern {
  187. }
  188. return_term {
  189. kind: Expression
  190. type {
  191. int_type_literal {
  192. }
  193. }
  194. }
  195. body {
  196. statements {
  197. variable_definition {
  198. pattern {
  199. binding_pattern {
  200. name: "x"
  201. type {
  202. expression_pattern {
  203. expression {
  204. identifier {
  205. name: "X"
  206. }
  207. }
  208. }
  209. }
  210. }
  211. }
  212. init {
  213. struct_literal {
  214. }
  215. }
  216. is_returned: false
  217. }
  218. }
  219. statements {
  220. return_expression_statement {
  221. expression {
  222. call {
  223. function {
  224. identifier {
  225. name: "F"
  226. }
  227. }
  228. argument {
  229. tuple_literal {
  230. fields {
  231. identifier {
  232. name: "x"
  233. }
  234. }
  235. }
  236. }
  237. }
  238. }
  239. }
  240. }
  241. }
  242. }
  243. }
  244. }