phase_all.carbon 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  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. package ExplorerTest api;
  5. interface TestInterface {}
  6. namespace N;
  7. fn N.Foo(n: i32) -> i32 {
  8. return n + 1;
  9. }
  10. fn Main() -> i32 {
  11. var x: i32 = N.Foo(0);
  12. return x;
  13. }
  14. // Place checks after code so that line numbers are stable, reducing merge
  15. // conflicts.
  16. // ARGS: --trace_file=- --trace_phase=all %s
  17. // AUTOUPDATE
  18. // CHECK:STDOUT: * * * * * * * * * * source program * * * * * * * * * *
  19. // CHECK:STDOUT: --------------------------------------------------------
  20. // CHECK:STDOUT: interface TestInterface {
  21. // CHECK:STDOUT: }
  22. // CHECK:STDOUT:
  23. // CHECK:STDOUT: namespace N;
  24. // CHECK:STDOUT:
  25. // CHECK:STDOUT: fn Foo (n: i32) -> i32
  26. // CHECK:STDOUT: {
  27. // CHECK:STDOUT: return (n + 1);
  28. // CHECK:STDOUT: }
  29. // CHECK:STDOUT:
  30. // CHECK:STDOUT: fn Main () -> i32
  31. // CHECK:STDOUT: {
  32. // CHECK:STDOUT: var x: i32 = N.Foo(0);
  33. // CHECK:STDOUT: return x;
  34. // CHECK:STDOUT: }
  35. // CHECK:STDOUT:
  36. // CHECK:STDOUT:
  37. // CHECK:STDOUT: * * * * * * * * * * resolving names * * * * * * * * * *
  38. // CHECK:STDOUT: ---------------------------------------------------------
  39. // CHECK:STDOUT: ==> declared `TestInterface` as `interface TestInterface` in `package` (phase_all.carbon:7)
  40. // CHECK:STDOUT: ==> declared `N` as `namespace N` in `package` (phase_all.carbon:9)
  41. // CHECK:STDOUT: ==> resolved `N` as `namespace N` in `package` (phase_all.carbon:11)
  42. // CHECK:STDOUT: ==> declared `Foo` as `fn N.Foo` in `namespace N` (phase_all.carbon:13)
  43. // CHECK:STDOUT: ==> declared `Main` as `fn Main` in `package` (phase_all.carbon:18)
  44. // CHECK:STDOUT: ->> resolving decl `interface TestInterface` (phase_all.carbon:7)
  45. // CHECK:STDOUT: ==> marked `TestInterface` declared but not usable in `package`
  46. // CHECK:STDOUT: ==> marked `TestInterface` usable in `package`
  47. // CHECK:STDOUT: ==> declared `Self` as `Self` in `interface TestInterface` (phase_all.carbon:7)
  48. // CHECK:STDOUT: <<- finished resolving decl `interface TestInterface` (phase_all.carbon:7)
  49. // CHECK:STDOUT: ->> resolving decl `namespace N` (phase_all.carbon:9)
  50. // CHECK:STDOUT: ==> marked `N` usable in `package`
  51. // CHECK:STDOUT: <<- finished resolving decl `namespace N` (phase_all.carbon:9)
  52. // CHECK:STDOUT: ->> resolving decl `fn N.Foo` (phase_all.carbon:13)
  53. // CHECK:STDOUT: ==> resolved `N` as `namespace N` in `package` (phase_all.carbon:11)
  54. // CHECK:STDOUT: ==> marked `Foo` declared but not usable in `namespace N`
  55. // CHECK:STDOUT: ==> declared `n` as `n` in `fn N.Foo` (phase_all.carbon:11)
  56. // CHECK:STDOUT: ==> marked `Foo` usable in `namespace N`
  57. // CHECK:STDOUT: ->> resolving stmt `{ ... }` (phase_all.carbon:13)
  58. // CHECK:STDOUT: ->> resolving stmt `return ...;` (phase_all.carbon:12)
  59. // CHECK:STDOUT: ==> resolved `n` as `n` in `fn N.Foo` (phase_all.carbon:12)
  60. // CHECK:STDOUT: <<- finished resolving stmt `return ...;` (phase_all.carbon:12)
  61. // CHECK:STDOUT: <<- finished resolving stmt `{ ... }` (phase_all.carbon:13)
  62. // CHECK:STDOUT: <<- finished resolving decl `fn N.Foo` (phase_all.carbon:13)
  63. // CHECK:STDOUT: ->> resolving decl `fn Main` (phase_all.carbon:18)
  64. // CHECK:STDOUT: ==> marked `Main` declared but not usable in `package`
  65. // CHECK:STDOUT: ==> marked `Main` usable in `package`
  66. // CHECK:STDOUT: ->> resolving stmt `{ ... }` (phase_all.carbon:18)
  67. // CHECK:STDOUT: ->> resolving stmt `var ... = ...;` (phase_all.carbon:16)
  68. // CHECK:STDOUT: ==> resolved `N` as `namespace N` in `package` (phase_all.carbon:16)
  69. // CHECK:STDOUT: ==> resolved `Foo` as `fn N.Foo` in `namespace N` (phase_all.carbon:16)
  70. // CHECK:STDOUT: ==> declared `x` as `x` in `{ ... }` (phase_all.carbon:16)
  71. // CHECK:STDOUT: <<- finished resolving stmt `var ... = ...;` (phase_all.carbon:16)
  72. // CHECK:STDOUT: ->> resolving stmt `return ...;` (phase_all.carbon:17)
  73. // CHECK:STDOUT: ==> resolved `x` as `x` in `{ ... }` (phase_all.carbon:17)
  74. // CHECK:STDOUT: <<- finished resolving stmt `return ...;` (phase_all.carbon:17)
  75. // CHECK:STDOUT: <<- finished resolving stmt `{ ... }` (phase_all.carbon:18)
  76. // CHECK:STDOUT: <<- finished resolving decl `fn Main` (phase_all.carbon:18)
  77. // CHECK:STDOUT: ==> resolved `Main` as `fn Main` in `package` (<Main()>:0)
  78. // CHECK:STDOUT:
  79. // CHECK:STDOUT:
  80. // CHECK:STDOUT: * * * * * * * * * * resolving control flow * * * * * * * * * *
  81. // CHECK:STDOUT: ----------------------------------------------------------------
  82. // CHECK:STDOUT: ==> flow-resolved return statement `return (n + 1);` in `fn N.Foo` (phase_all.carbon:12)
  83. // CHECK:STDOUT: ==> flow-resolved return statement `return x;` in `fn Main` (phase_all.carbon:17)
  84. // CHECK:STDOUT:
  85. // CHECK:STDOUT:
  86. // CHECK:STDOUT: * * * * * * * * * * type checking * * * * * * * * * *
  87. // CHECK:STDOUT: -------------------------------------------------------
  88. // CHECK:STDOUT:
  89. // CHECK:STDOUT: *** declaration at (phase_all.carbon:7)
  90. // CHECK:STDOUT: ```
  91. // CHECK:STDOUT: interface TestInterface {
  92. // CHECK:STDOUT: }
  93. // CHECK:STDOUT: ```
  94. // CHECK:STDOUT: ->> declaring `interface TestInterface` (phase_all.carbon:7)
  95. // CHECK:STDOUT: <<- finished declaring `interface TestInterface` (phase_all.carbon:7)
  96. // CHECK:STDOUT:
  97. // CHECK:STDOUT: *** type checking declaration at (phase_all.carbon:7)
  98. // CHECK:STDOUT: ```
  99. // CHECK:STDOUT: interface TestInterface {
  100. // CHECK:STDOUT: }
  101. // CHECK:STDOUT: ```
  102. // CHECK:STDOUT: ->> checking InterfaceDeclaration `interface TestInterface` (phase_all.carbon:7)
  103. // CHECK:STDOUT: ->> checking `interface TestInterface` (phase_all.carbon:7)
  104. // CHECK:STDOUT: ==> impl declarations for `interface TestInterface` (phase_all.carbon:7)
  105. // CHECK:STDOUT: []
  106. // CHECK:STDOUT: [`bool` as `interface EqWith(U = bool)`,
  107. // CHECK:STDOUT: `i32` as `interface EqWith(U = i32)`,
  108. // CHECK:STDOUT: `String` as `interface EqWith(U = String)`,
  109. // CHECK:STDOUT: `i32` as `interface CompareWith(U = i32)`,
  110. // CHECK:STDOUT: `String` as `interface CompareWith(U = String)`,
  111. // CHECK:STDOUT: `i32` as `interface LessWith(U = i32)`,
  112. // CHECK:STDOUT: `String` as `interface LessWith(U = String)`,
  113. // CHECK:STDOUT: `i32` as `interface LessEqWith(U = i32)`,
  114. // CHECK:STDOUT: `String` as `interface LessEqWith(U = String)`,
  115. // CHECK:STDOUT: `i32` as `interface GreaterWith(U = i32)`,
  116. // CHECK:STDOUT: `String` as `interface GreaterWith(U = String)`,
  117. // CHECK:STDOUT: `i32` as `interface GreaterEqWith(U = i32)`,
  118. // CHECK:STDOUT: `String` as `interface GreaterEqWith(U = String)`,
  119. // CHECK:STDOUT: `i32` as `interface Negate`,
  120. // CHECK:STDOUT: `i32` as `interface AddWith(U = i32)`,
  121. // CHECK:STDOUT: `i32` as `interface SubWith(U = i32)`,
  122. // CHECK:STDOUT: `i32` as `interface MulWith(U = i32)`,
  123. // CHECK:STDOUT: `i32` as `interface DivWith(U = i32)`,
  124. // CHECK:STDOUT: `i32` as `interface ModWith(U = i32)`,
  125. // CHECK:STDOUT: `i32` as `interface BitComplement`,
  126. // CHECK:STDOUT: `i32` as `interface BitAndWith(U = i32)`,
  127. // CHECK:STDOUT: `i32` as `interface BitOrWith(U = i32)`,
  128. // CHECK:STDOUT: `i32` as `interface BitXorWith(U = i32)`,
  129. // CHECK:STDOUT: `i32` as `interface LeftShiftWith(U = i32)`,
  130. // CHECK:STDOUT: `i32` as `interface RightShiftWith(U = i32)`,
  131. // CHECK:STDOUT: `i32` as `interface Inc`,
  132. // CHECK:STDOUT: `i32` as `interface Dec`,
  133. // CHECK:STDOUT: `U` as `interface __EqualConverter` [0],
  134. // CHECK:STDOUT: `(T1,)` as `interface As(T = (U1,))` [0, 0, 0; 1, 1, 0, 0, 0],
  135. // CHECK:STDOUT: `(T1, T2)` as `interface As(T = (U1, U2))` [0, 0, 0; 0, 0, 1; 1, 1, 0, 0, 0; 1, 1, 0, 0, 1],
  136. // CHECK:STDOUT: `(T1, U1)` as `interface EqWith(U = (T2, U2))` [0, 0, 0; 0, 0, 1; 1, 1, 0, 0, 0; 1, 1, 0, 0, 1],
  137. // CHECK:STDOUT: `(T1, T2, T3)` as `interface As(T = (U1, U2, U3))` [0, 0, 0; 0, 0, 1; 0, 0, 2; 1, 1, 0, 0, 0; 1, 1, 0, 0, 1; 1, 1, 0, 0, 2],
  138. // CHECK:STDOUT: `T` as `interface ImplicitAs(T = U)` [0; 1, 1, 0],
  139. // CHECK:STDOUT: `T` as `interface As(T = U)` [0; 1, 1, 0],
  140. // CHECK:STDOUT: `T` as `interface ImplicitAs(T = U)` [0; 1, 1, 0],
  141. // CHECK:STDOUT: `T` as `interface As(T = U)` [0; 1, 1, 0],
  142. // CHECK:STDOUT: `T` as `interface AssignWith(U = U)` [0; 1, 1, 0],
  143. // CHECK:STDOUT: `T` as `interface AddAssignWith(U = U)` [0; 1, 1, 0],
  144. // CHECK:STDOUT: `T` as `interface SubAssignWith(U = U)` [0; 1, 1, 0],
  145. // CHECK:STDOUT: `T` as `interface MulAssignWith(U = U)` [0; 1, 1, 0],
  146. // CHECK:STDOUT: `T` as `interface DivAssignWith(U = U)` [0; 1, 1, 0],
  147. // CHECK:STDOUT: `T` as `interface ModAssignWith(U = U)` [0; 1, 1, 0],
  148. // CHECK:STDOUT: `T` as `interface BitAndAssignWith(U = U)` [0; 1, 1, 0],
  149. // CHECK:STDOUT: `T` as `interface BitOrAssignWith(U = U)` [0; 1, 1, 0],
  150. // CHECK:STDOUT: `T` as `interface BitXorAssignWith(U = U)` [0; 1, 1, 0],
  151. // CHECK:STDOUT: `T` as `interface LeftShiftAssignWith(U = U)` [0; 1, 1, 0],
  152. // CHECK:STDOUT: `T` as `interface RightShiftAssignWith(U = U)` [0; 1, 1, 0]]
  153. // CHECK:STDOUT: <<- finished checking `interface TestInterface` (phase_all.carbon:7)
  154. // CHECK:STDOUT:
  155. // CHECK:STDOUT: *** declaration at (phase_all.carbon:9)
  156. // CHECK:STDOUT: ```
  157. // CHECK:STDOUT: namespace N;
  158. // CHECK:STDOUT: ```
  159. // CHECK:STDOUT:
  160. // CHECK:STDOUT: *** type checking declaration at (phase_all.carbon:9)
  161. // CHECK:STDOUT: ```
  162. // CHECK:STDOUT: namespace N;
  163. // CHECK:STDOUT: ```
  164. // CHECK:STDOUT: ->> checking NamespaceDeclaration `namespace N` (phase_all.carbon:9)
  165. // CHECK:STDOUT:
  166. // CHECK:STDOUT: *** declaration at (phase_all.carbon:13)
  167. // CHECK:STDOUT: ```
  168. // CHECK:STDOUT: fn Foo (n: i32) -> i32
  169. // CHECK:STDOUT: {
  170. // CHECK:STDOUT: return (n + 1);
  171. // CHECK:STDOUT: }
  172. // CHECK:STDOUT: ```
  173. // CHECK:STDOUT: ->> declaring function `Foo` (phase_all.carbon:13)
  174. // CHECK:STDOUT: ->> checking TuplePattern `(n: i32)` (phase_all.carbon:11)
  175. // CHECK:STDOUT: ->> checking BindingPattern `n: i32` (phase_all.carbon:11)
  176. // CHECK:STDOUT: ->> checking ExpressionPattern `i32` (phase_all.carbon:11)
  177. // CHECK:STDOUT: ->> checking IntTypeLiteral `i32` (phase_all.carbon:11)
  178. // CHECK:STDOUT: >[] stack-push: ValueExpressionAction pos: 0 `i32` (phase_all.carbon:11)
  179. // CHECK:STDOUT: ->> step ValueExpressionAction pos: 0 `i32` (phase_all.carbon:11) --->
  180. // CHECK:STDOUT: >[] stack-push: ExpressionAction pos: 0 `i32` (phase_all.carbon:11)
  181. // CHECK:STDOUT: ->> step ExpressionAction pos: 0 `i32` (phase_all.carbon:11) --->
  182. // CHECK:STDOUT: <[] stack-pop: ExpressionAction pos: 0 `i32` (phase_all.carbon:11)
  183. // CHECK:STDOUT: ->> step ValueExpressionAction pos: 1 `i32` results: [`i32`] (phase_all.carbon:11) --->
  184. // CHECK:STDOUT: <[] stack-pop: ValueExpressionAction pos: 1 `i32` results: [`i32`] (phase_all.carbon:11)
  185. // CHECK:STDOUT: ->> finished checking tuple pattern field `n: i32` (phase_all.carbon:11)
  186. // CHECK:STDOUT: ->> checking IntTypeLiteral `i32` (phase_all.carbon:11)
  187. // CHECK:STDOUT: >[] stack-push: ValueExpressionAction pos: 0 `i32` (phase_all.carbon:11)
  188. // CHECK:STDOUT: ->> step ValueExpressionAction pos: 0 `i32` (phase_all.carbon:11) --->
  189. // CHECK:STDOUT: >[] stack-push: ExpressionAction pos: 0 `i32` (phase_all.carbon:11)
  190. // CHECK:STDOUT: ->> step ExpressionAction pos: 0 `i32` (phase_all.carbon:11) --->
  191. // CHECK:STDOUT: <[] stack-pop: ExpressionAction pos: 0 `i32` (phase_all.carbon:11)
  192. // CHECK:STDOUT: ->> step ValueExpressionAction pos: 1 `i32` results: [`i32`] (phase_all.carbon:11) --->
  193. // CHECK:STDOUT: <[] stack-pop: ValueExpressionAction pos: 1 `i32` results: [`i32`] (phase_all.carbon:11)
  194. // CHECK:STDOUT: ->> finished declaring function `Foo` of type `fn (i32,) -> i32` (phase_all.carbon:13)
  195. // CHECK:STDOUT:
  196. // CHECK:STDOUT: *** type checking declaration at (phase_all.carbon:13)
  197. // CHECK:STDOUT: ```
  198. // CHECK:STDOUT: fn Foo (n: i32) -> i32
  199. // CHECK:STDOUT: {
  200. // CHECK:STDOUT: return (n + 1);
  201. // CHECK:STDOUT: }
  202. // CHECK:STDOUT: ```
  203. // CHECK:STDOUT: ->> checking FunctionDeclaration `fn N.Foo` (phase_all.carbon:13)
  204. // CHECK:STDOUT: ->> checking function `Foo` (phase_all.carbon:13)
  205. // CHECK:STDOUT: ==> impl declarations for `fn N.Foo` (phase_all.carbon:13)
  206. // CHECK:STDOUT: []
  207. // CHECK:STDOUT: [`bool` as `interface EqWith(U = bool)`,
  208. // CHECK:STDOUT: `i32` as `interface EqWith(U = i32)`,
  209. // CHECK:STDOUT: `String` as `interface EqWith(U = String)`,
  210. // CHECK:STDOUT: `i32` as `interface CompareWith(U = i32)`,
  211. // CHECK:STDOUT: `String` as `interface CompareWith(U = String)`,
  212. // CHECK:STDOUT: `i32` as `interface LessWith(U = i32)`,
  213. // CHECK:STDOUT: `String` as `interface LessWith(U = String)`,
  214. // CHECK:STDOUT: `i32` as `interface LessEqWith(U = i32)`,
  215. // CHECK:STDOUT: `String` as `interface LessEqWith(U = String)`,
  216. // CHECK:STDOUT: `i32` as `interface GreaterWith(U = i32)`,
  217. // CHECK:STDOUT: `String` as `interface GreaterWith(U = String)`,
  218. // CHECK:STDOUT: `i32` as `interface GreaterEqWith(U = i32)`,
  219. // CHECK:STDOUT: `String` as `interface GreaterEqWith(U = String)`,
  220. // CHECK:STDOUT: `i32` as `interface Negate`,
  221. // CHECK:STDOUT: `i32` as `interface AddWith(U = i32)`,
  222. // CHECK:STDOUT: `i32` as `interface SubWith(U = i32)`,
  223. // CHECK:STDOUT: `i32` as `interface MulWith(U = i32)`,
  224. // CHECK:STDOUT: `i32` as `interface DivWith(U = i32)`,
  225. // CHECK:STDOUT: `i32` as `interface ModWith(U = i32)`,
  226. // CHECK:STDOUT: `i32` as `interface BitComplement`,
  227. // CHECK:STDOUT: `i32` as `interface BitAndWith(U = i32)`,
  228. // CHECK:STDOUT: `i32` as `interface BitOrWith(U = i32)`,
  229. // CHECK:STDOUT: `i32` as `interface BitXorWith(U = i32)`,
  230. // CHECK:STDOUT: `i32` as `interface LeftShiftWith(U = i32)`,
  231. // CHECK:STDOUT: `i32` as `interface RightShiftWith(U = i32)`,
  232. // CHECK:STDOUT: `i32` as `interface Inc`,
  233. // CHECK:STDOUT: `i32` as `interface Dec`,
  234. // CHECK:STDOUT: `U` as `interface __EqualConverter` [0],
  235. // CHECK:STDOUT: `(T1,)` as `interface As(T = (U1,))` [0, 0, 0; 1, 1, 0, 0, 0],
  236. // CHECK:STDOUT: `(T1, T2)` as `interface As(T = (U1, U2))` [0, 0, 0; 0, 0, 1; 1, 1, 0, 0, 0; 1, 1, 0, 0, 1],
  237. // CHECK:STDOUT: `(T1, U1)` as `interface EqWith(U = (T2, U2))` [0, 0, 0; 0, 0, 1; 1, 1, 0, 0, 0; 1, 1, 0, 0, 1],
  238. // CHECK:STDOUT: `(T1, T2, T3)` as `interface As(T = (U1, U2, U3))` [0, 0, 0; 0, 0, 1; 0, 0, 2; 1, 1, 0, 0, 0; 1, 1, 0, 0, 1; 1, 1, 0, 0, 2],
  239. // CHECK:STDOUT: `T` as `interface ImplicitAs(T = U)` [0; 1, 1, 0],
  240. // CHECK:STDOUT: `T` as `interface As(T = U)` [0; 1, 1, 0],
  241. // CHECK:STDOUT: `T` as `interface ImplicitAs(T = U)` [0; 1, 1, 0],
  242. // CHECK:STDOUT: `T` as `interface As(T = U)` [0; 1, 1, 0],
  243. // CHECK:STDOUT: `T` as `interface AssignWith(U = U)` [0; 1, 1, 0],
  244. // CHECK:STDOUT: `T` as `interface AddAssignWith(U = U)` [0; 1, 1, 0],
  245. // CHECK:STDOUT: `T` as `interface SubAssignWith(U = U)` [0; 1, 1, 0],
  246. // CHECK:STDOUT: `T` as `interface MulAssignWith(U = U)` [0; 1, 1, 0],
  247. // CHECK:STDOUT: `T` as `interface DivAssignWith(U = U)` [0; 1, 1, 0],
  248. // CHECK:STDOUT: `T` as `interface ModAssignWith(U = U)` [0; 1, 1, 0],
  249. // CHECK:STDOUT: `T` as `interface BitAndAssignWith(U = U)` [0; 1, 1, 0],
  250. // CHECK:STDOUT: `T` as `interface BitOrAssignWith(U = U)` [0; 1, 1, 0],
  251. // CHECK:STDOUT: `T` as `interface BitXorAssignWith(U = U)` [0; 1, 1, 0],
  252. // CHECK:STDOUT: `T` as `interface LeftShiftAssignWith(U = U)` [0; 1, 1, 0],
  253. // CHECK:STDOUT: `T` as `interface RightShiftAssignWith(U = U)` [0; 1, 1, 0]]
  254. // CHECK:STDOUT:
  255. // CHECK:STDOUT: *** type checking stmt at (phase_all.carbon:13)
  256. // CHECK:STDOUT: ```
  257. // CHECK:STDOUT: {
  258. // CHECK:STDOUT: return (n + 1);
  259. // CHECK:STDOUT: }
  260. // CHECK:STDOUT: ```
  261. // CHECK:STDOUT: ->> checking Block `{ ... }` (phase_all.carbon:13)
  262. // CHECK:STDOUT:
  263. // CHECK:STDOUT: *** type checking stmt at (phase_all.carbon:12)
  264. // CHECK:STDOUT: ```
  265. // CHECK:STDOUT: return (n + 1);
  266. // CHECK:STDOUT: ```
  267. // CHECK:STDOUT: ->> checking ReturnExpression `return ...;` (phase_all.carbon:12)
  268. // CHECK:STDOUT: ->> checking OperatorExpression `(n + 1)` (phase_all.carbon:12)
  269. // CHECK:STDOUT: ->> checking IdentifierExpression `n` (phase_all.carbon:12)
  270. // CHECK:STDOUT: ->> checking IntLiteral `1` (phase_all.carbon:12)
  271. // CHECK:STDOUT: ->> finished checking function `Foo` (phase_all.carbon:13)
  272. // CHECK:STDOUT:
  273. // CHECK:STDOUT: *** declaration at (phase_all.carbon:18)
  274. // CHECK:STDOUT: ```
  275. // CHECK:STDOUT: fn Main () -> i32
  276. // CHECK:STDOUT: {
  277. // CHECK:STDOUT: var x: i32 = N.Foo(0);
  278. // CHECK:STDOUT: return x;
  279. // CHECK:STDOUT: }
  280. // CHECK:STDOUT: ```
  281. // CHECK:STDOUT: ->> declaring function `Main` (phase_all.carbon:18)
  282. // CHECK:STDOUT: ->> checking TuplePattern `()` (phase_all.carbon:15)
  283. // CHECK:STDOUT: ->> checking IntTypeLiteral `i32` (phase_all.carbon:15)
  284. // CHECK:STDOUT: >[] stack-push: ValueExpressionAction pos: 0 `i32` (phase_all.carbon:15)
  285. // CHECK:STDOUT: ->> step ValueExpressionAction pos: 0 `i32` (phase_all.carbon:15) --->
  286. // CHECK:STDOUT: >[] stack-push: ExpressionAction pos: 0 `i32` (phase_all.carbon:15)
  287. // CHECK:STDOUT: ->> step ExpressionAction pos: 0 `i32` (phase_all.carbon:15) --->
  288. // CHECK:STDOUT: <[] stack-pop: ExpressionAction pos: 0 `i32` (phase_all.carbon:15)
  289. // CHECK:STDOUT: ->> step ValueExpressionAction pos: 1 `i32` results: [`i32`] (phase_all.carbon:15) --->
  290. // CHECK:STDOUT: <[] stack-pop: ValueExpressionAction pos: 1 `i32` results: [`i32`] (phase_all.carbon:15)
  291. // CHECK:STDOUT: ->> finished declaring function `Main` of type `fn () -> i32` (phase_all.carbon:18)
  292. // CHECK:STDOUT:
  293. // CHECK:STDOUT: *** type checking declaration at (phase_all.carbon:18)
  294. // CHECK:STDOUT: ```
  295. // CHECK:STDOUT: fn Main () -> i32
  296. // CHECK:STDOUT: {
  297. // CHECK:STDOUT: var x: i32 = N.Foo(0);
  298. // CHECK:STDOUT: return x;
  299. // CHECK:STDOUT: }
  300. // CHECK:STDOUT: ```
  301. // CHECK:STDOUT: ->> checking FunctionDeclaration `fn Main` (phase_all.carbon:18)
  302. // CHECK:STDOUT: ->> checking function `Main` (phase_all.carbon:18)
  303. // CHECK:STDOUT: ==> impl declarations for `fn Main` (phase_all.carbon:18)
  304. // CHECK:STDOUT: []
  305. // CHECK:STDOUT: [`bool` as `interface EqWith(U = bool)`,
  306. // CHECK:STDOUT: `i32` as `interface EqWith(U = i32)`,
  307. // CHECK:STDOUT: `String` as `interface EqWith(U = String)`,
  308. // CHECK:STDOUT: `i32` as `interface CompareWith(U = i32)`,
  309. // CHECK:STDOUT: `String` as `interface CompareWith(U = String)`,
  310. // CHECK:STDOUT: `i32` as `interface LessWith(U = i32)`,
  311. // CHECK:STDOUT: `String` as `interface LessWith(U = String)`,
  312. // CHECK:STDOUT: `i32` as `interface LessEqWith(U = i32)`,
  313. // CHECK:STDOUT: `String` as `interface LessEqWith(U = String)`,
  314. // CHECK:STDOUT: `i32` as `interface GreaterWith(U = i32)`,
  315. // CHECK:STDOUT: `String` as `interface GreaterWith(U = String)`,
  316. // CHECK:STDOUT: `i32` as `interface GreaterEqWith(U = i32)`,
  317. // CHECK:STDOUT: `String` as `interface GreaterEqWith(U = String)`,
  318. // CHECK:STDOUT: `i32` as `interface Negate`,
  319. // CHECK:STDOUT: `i32` as `interface AddWith(U = i32)`,
  320. // CHECK:STDOUT: `i32` as `interface SubWith(U = i32)`,
  321. // CHECK:STDOUT: `i32` as `interface MulWith(U = i32)`,
  322. // CHECK:STDOUT: `i32` as `interface DivWith(U = i32)`,
  323. // CHECK:STDOUT: `i32` as `interface ModWith(U = i32)`,
  324. // CHECK:STDOUT: `i32` as `interface BitComplement`,
  325. // CHECK:STDOUT: `i32` as `interface BitAndWith(U = i32)`,
  326. // CHECK:STDOUT: `i32` as `interface BitOrWith(U = i32)`,
  327. // CHECK:STDOUT: `i32` as `interface BitXorWith(U = i32)`,
  328. // CHECK:STDOUT: `i32` as `interface LeftShiftWith(U = i32)`,
  329. // CHECK:STDOUT: `i32` as `interface RightShiftWith(U = i32)`,
  330. // CHECK:STDOUT: `i32` as `interface Inc`,
  331. // CHECK:STDOUT: `i32` as `interface Dec`,
  332. // CHECK:STDOUT: `U` as `interface __EqualConverter` [0],
  333. // CHECK:STDOUT: `(T1,)` as `interface As(T = (U1,))` [0, 0, 0; 1, 1, 0, 0, 0],
  334. // CHECK:STDOUT: `(T1, T2)` as `interface As(T = (U1, U2))` [0, 0, 0; 0, 0, 1; 1, 1, 0, 0, 0; 1, 1, 0, 0, 1],
  335. // CHECK:STDOUT: `(T1, U1)` as `interface EqWith(U = (T2, U2))` [0, 0, 0; 0, 0, 1; 1, 1, 0, 0, 0; 1, 1, 0, 0, 1],
  336. // CHECK:STDOUT: `(T1, T2, T3)` as `interface As(T = (U1, U2, U3))` [0, 0, 0; 0, 0, 1; 0, 0, 2; 1, 1, 0, 0, 0; 1, 1, 0, 0, 1; 1, 1, 0, 0, 2],
  337. // CHECK:STDOUT: `T` as `interface ImplicitAs(T = U)` [0; 1, 1, 0],
  338. // CHECK:STDOUT: `T` as `interface As(T = U)` [0; 1, 1, 0],
  339. // CHECK:STDOUT: `T` as `interface ImplicitAs(T = U)` [0; 1, 1, 0],
  340. // CHECK:STDOUT: `T` as `interface As(T = U)` [0; 1, 1, 0],
  341. // CHECK:STDOUT: `T` as `interface AssignWith(U = U)` [0; 1, 1, 0],
  342. // CHECK:STDOUT: `T` as `interface AddAssignWith(U = U)` [0; 1, 1, 0],
  343. // CHECK:STDOUT: `T` as `interface SubAssignWith(U = U)` [0; 1, 1, 0],
  344. // CHECK:STDOUT: `T` as `interface MulAssignWith(U = U)` [0; 1, 1, 0],
  345. // CHECK:STDOUT: `T` as `interface DivAssignWith(U = U)` [0; 1, 1, 0],
  346. // CHECK:STDOUT: `T` as `interface ModAssignWith(U = U)` [0; 1, 1, 0],
  347. // CHECK:STDOUT: `T` as `interface BitAndAssignWith(U = U)` [0; 1, 1, 0],
  348. // CHECK:STDOUT: `T` as `interface BitOrAssignWith(U = U)` [0; 1, 1, 0],
  349. // CHECK:STDOUT: `T` as `interface BitXorAssignWith(U = U)` [0; 1, 1, 0],
  350. // CHECK:STDOUT: `T` as `interface LeftShiftAssignWith(U = U)` [0; 1, 1, 0],
  351. // CHECK:STDOUT: `T` as `interface RightShiftAssignWith(U = U)` [0; 1, 1, 0]]
  352. // CHECK:STDOUT:
  353. // CHECK:STDOUT: *** type checking stmt at (phase_all.carbon:18)
  354. // CHECK:STDOUT: ```
  355. // CHECK:STDOUT: {
  356. // CHECK:STDOUT: var x: i32 = N.Foo(0);
  357. // CHECK:STDOUT: return x;
  358. // CHECK:STDOUT: }
  359. // CHECK:STDOUT: ```
  360. // CHECK:STDOUT: ->> checking Block `{ ... }` (phase_all.carbon:18)
  361. // CHECK:STDOUT:
  362. // CHECK:STDOUT: *** type checking stmt at (phase_all.carbon:16)
  363. // CHECK:STDOUT: ```
  364. // CHECK:STDOUT: var x: i32 = N.Foo(0);
  365. // CHECK:STDOUT: ```
  366. // CHECK:STDOUT: ->> checking VariableDefinition `var ... = ...;` (phase_all.carbon:16)
  367. // CHECK:STDOUT: ->> checking CallExpression `N.Foo(0)` (phase_all.carbon:16)
  368. // CHECK:STDOUT: ->> checking SimpleMemberAccessExpression `N.Foo` (phase_all.carbon:16)
  369. // CHECK:STDOUT: ->> checking IdentifierExpression `Foo` (phase_all.carbon:16)
  370. // CHECK:STDOUT: ->> checking TupleLiteral `(0)` (phase_all.carbon:16)
  371. // CHECK:STDOUT: ->> checking IntLiteral `0` (phase_all.carbon:16)
  372. // CHECK:STDOUT: ->> checking call to function of type `fn (i32,) -> i32` with arguments of type `(i32,)` (phase_all.carbon:16)
  373. // CHECK:STDOUT: ->> performing argument deduction for bindings: []
  374. // CHECK:STDOUT: ->> deducing `i32` from `i32`
  375. // CHECK:STDOUT: ==> deduction succeeded with results: []
  376. // CHECK:STDOUT: ->> checking BindingPattern `x: i32`, expecting `i32` (phase_all.carbon:16)
  377. // CHECK:STDOUT: ->> checking ExpressionPattern `i32`, expecting `i32` (phase_all.carbon:16)
  378. // CHECK:STDOUT: ->> checking IntTypeLiteral `i32` (phase_all.carbon:16)
  379. // CHECK:STDOUT: >[] stack-push: ValueExpressionAction pos: 0 `i32` (phase_all.carbon:16)
  380. // CHECK:STDOUT: ->> step ValueExpressionAction pos: 0 `i32` (phase_all.carbon:16) --->
  381. // CHECK:STDOUT: >[] stack-push: ExpressionAction pos: 0 `i32` (phase_all.carbon:16)
  382. // CHECK:STDOUT: ->> step ExpressionAction pos: 0 `i32` (phase_all.carbon:16) --->
  383. // CHECK:STDOUT: <[] stack-pop: ExpressionAction pos: 0 `i32` (phase_all.carbon:16)
  384. // CHECK:STDOUT: ->> step ValueExpressionAction pos: 1 `i32` results: [`i32`] (phase_all.carbon:16) --->
  385. // CHECK:STDOUT: <[] stack-pop: ValueExpressionAction pos: 1 `i32` results: [`i32`] (phase_all.carbon:16)
  386. // CHECK:STDOUT:
  387. // CHECK:STDOUT: *** type checking stmt at (phase_all.carbon:17)
  388. // CHECK:STDOUT: ```
  389. // CHECK:STDOUT: return x;
  390. // CHECK:STDOUT: ```
  391. // CHECK:STDOUT: ->> checking ReturnExpression `return ...;` (phase_all.carbon:17)
  392. // CHECK:STDOUT: ->> checking IdentifierExpression `x` (phase_all.carbon:17)
  393. // CHECK:STDOUT: ->> finished checking function `Main` (phase_all.carbon:18)
  394. // CHECK:STDOUT: ->> checking CallExpression `Main()` (<Main()>:0)
  395. // CHECK:STDOUT: ->> checking IdentifierExpression `Main` (<Main()>:0)
  396. // CHECK:STDOUT: ->> checking TupleLiteral `()` (<Main()>:0)
  397. // CHECK:STDOUT: ->> checking call to function of type `fn () -> i32` with arguments of type `()` (<Main()>:0)
  398. // CHECK:STDOUT: ->> performing argument deduction for bindings: []
  399. // CHECK:STDOUT: ==> deduction succeeded with results: []
  400. // CHECK:STDOUT:
  401. // CHECK:STDOUT:
  402. // CHECK:STDOUT: * * * * * * * * * * resolving unformed variables * * * * * * * * * *
  403. // CHECK:STDOUT: ----------------------------------------------------------------------
  404. // CHECK:STDOUT: ->> resolving-unformed in decl `interface TestInterface` (phase_all.carbon:7)
  405. // CHECK:STDOUT: ->> resolving-unformed in decl `namespace N` (phase_all.carbon:9)
  406. // CHECK:STDOUT: ->> resolving-unformed in decl `fn N.Foo` (phase_all.carbon:13)
  407. // CHECK:STDOUT: ->> resolving-unformed in stmt `{ ... }` (phase_all.carbon:13)
  408. // CHECK:STDOUT: ->> resolving-unformed in stmt `return ...;` (phase_all.carbon:12)
  409. // CHECK:STDOUT: ==> check `n` (phase_all.carbon:12)
  410. // CHECK:STDOUT: ->> resolving-unformed in decl `fn Main` (phase_all.carbon:18)
  411. // CHECK:STDOUT: ->> resolving-unformed in stmt `{ ... }` (phase_all.carbon:18)
  412. // CHECK:STDOUT: ->> resolving-unformed in stmt `var ... = ...;` (phase_all.carbon:16)
  413. // CHECK:STDOUT: ==> add init `x` (phase_all.carbon:16)
  414. // CHECK:STDOUT: ->> resolving-unformed in stmt `return ...;` (phase_all.carbon:17)
  415. // CHECK:STDOUT: ==> check `x` (phase_all.carbon:17)
  416. // CHECK:STDOUT:
  417. // CHECK:STDOUT:
  418. // CHECK:STDOUT: * * * * * * * * * * printing declarations * * * * * * * * * *
  419. // CHECK:STDOUT: ---------------------------------------------------------------
  420. // CHECK:STDOUT: interface TestInterface {
  421. // CHECK:STDOUT: }
  422. // CHECK:STDOUT:
  423. // CHECK:STDOUT: namespace N;
  424. // CHECK:STDOUT:
  425. // CHECK:STDOUT: fn Foo (n: i32) -> i32
  426. // CHECK:STDOUT: {
  427. // CHECK:STDOUT: return (n + 1);
  428. // CHECK:STDOUT: }
  429. // CHECK:STDOUT:
  430. // CHECK:STDOUT: fn Main () -> i32
  431. // CHECK:STDOUT: {
  432. // CHECK:STDOUT: var x: i32 = N.Foo(0);
  433. // CHECK:STDOUT: return x;
  434. // CHECK:STDOUT: }
  435. // CHECK:STDOUT:
  436. // CHECK:STDOUT:
  437. // CHECK:STDOUT: * * * * * * * * * * starting execution * * * * * * * * * *
  438. // CHECK:STDOUT: ------------------------------------------------------------
  439. // CHECK:STDOUT:
  440. // CHECK:STDOUT: - - - - - initializing globals - - - - -
  441. // CHECK:STDOUT: ------------------------------------------
  442. // CHECK:STDOUT: >[] stack-push: DeclarationAction pos: 0 `interface TestInterface` (phase_all.carbon:7)
  443. // CHECK:STDOUT: ->> step DeclarationAction pos: 0 `interface TestInterface` (phase_all.carbon:7) --->
  444. // CHECK:STDOUT:
  445. // CHECK:STDOUT: *** declaration at (phase_all.carbon:7)
  446. // CHECK:STDOUT: ```
  447. // CHECK:STDOUT: interface TestInterface {
  448. // CHECK:STDOUT: }
  449. // CHECK:STDOUT: ```
  450. // CHECK:STDOUT: <[] stack-pop: DeclarationAction pos: 0 `interface TestInterface` (phase_all.carbon:7)
  451. // CHECK:STDOUT: >[] stack-push: DeclarationAction pos: 0 `namespace N` (phase_all.carbon:9)
  452. // CHECK:STDOUT: ->> step DeclarationAction pos: 0 `namespace N` (phase_all.carbon:9) --->
  453. // CHECK:STDOUT:
  454. // CHECK:STDOUT: *** declaration at (phase_all.carbon:9)
  455. // CHECK:STDOUT: ```
  456. // CHECK:STDOUT: namespace N;
  457. // CHECK:STDOUT: ```
  458. // CHECK:STDOUT: <[] stack-pop: DeclarationAction pos: 0 `namespace N` (phase_all.carbon:9)
  459. // CHECK:STDOUT: >[] stack-push: DeclarationAction pos: 0 `fn N.Foo` (phase_all.carbon:13)
  460. // CHECK:STDOUT: ->> step DeclarationAction pos: 0 `fn N.Foo` (phase_all.carbon:13) --->
  461. // CHECK:STDOUT:
  462. // CHECK:STDOUT: *** declaration at (phase_all.carbon:13)
  463. // CHECK:STDOUT: ```
  464. // CHECK:STDOUT: fn Foo (n: i32) -> i32
  465. // CHECK:STDOUT: {
  466. // CHECK:STDOUT: return (n + 1);
  467. // CHECK:STDOUT: }
  468. // CHECK:STDOUT: ```
  469. // CHECK:STDOUT: <[] stack-pop: DeclarationAction pos: 0 `fn N.Foo` (phase_all.carbon:13)
  470. // CHECK:STDOUT: >[] stack-push: DeclarationAction pos: 0 `fn Main` (phase_all.carbon:18)
  471. // CHECK:STDOUT: ->> step DeclarationAction pos: 0 `fn Main` (phase_all.carbon:18) --->
  472. // CHECK:STDOUT:
  473. // CHECK:STDOUT: *** declaration at (phase_all.carbon:18)
  474. // CHECK:STDOUT: ```
  475. // CHECK:STDOUT: fn Main () -> i32
  476. // CHECK:STDOUT: {
  477. // CHECK:STDOUT: var x: i32 = N.Foo(0);
  478. // CHECK:STDOUT: return x;
  479. // CHECK:STDOUT: }
  480. // CHECK:STDOUT: ```
  481. // CHECK:STDOUT: <[] stack-pop: DeclarationAction pos: 0 `fn Main` (phase_all.carbon:18)
  482. // CHECK:STDOUT:
  483. // CHECK:STDOUT: - - - - - calling main function - - - - -
  484. // CHECK:STDOUT: -------------------------------------------
  485. // CHECK:STDOUT: >[] stack-push: ValueExpressionAction pos: 0 `Main()` (<Main()>:0)
  486. // CHECK:STDOUT: ->> step ValueExpressionAction pos: 0 `Main()` (<Main()>:0) --->
  487. // CHECK:STDOUT: >[] stack-push: ExpressionAction pos: 0 `Main()` (<Main()>:0)
  488. // CHECK:STDOUT: ->> step ExpressionAction pos: 0 `Main()` (<Main()>:0) --->
  489. // CHECK:STDOUT: >[] stack-push: ValueExpressionAction pos: 0 `Main` (<Main()>:0)
  490. // CHECK:STDOUT: ->> step ValueExpressionAction pos: 0 `Main` (<Main()>:0) --->
  491. // CHECK:STDOUT: >[] stack-push: ExpressionAction pos: 0 `Main` (<Main()>:0)
  492. // CHECK:STDOUT: ->> step ExpressionAction pos: 0 `Main` (<Main()>:0) --->
  493. // CHECK:STDOUT: <[] stack-pop: ExpressionAction pos: 0 `Main` (<Main()>:0)
  494. // CHECK:STDOUT: ->> step ValueExpressionAction pos: 1 `Main` results: [`fun<Main>`] (<Main()>:0) --->
  495. // CHECK:STDOUT: <[] stack-pop: ValueExpressionAction pos: 1 `Main` results: [`fun<Main>`] (<Main()>:0)
  496. // CHECK:STDOUT: ->> step ExpressionAction pos: 1 `Main()` results: [`fun<Main>`] scope: [] (<Main()>:0) --->
  497. // CHECK:STDOUT: -() calling function: fun<Main>
  498. // CHECK:STDOUT: === match pattern `()`
  499. // CHECK:STDOUT: from value expression with value `()`
  500. // CHECK:STDOUT: >[] stack-push: ScopeAction pos: 0 scope: [] (None)
  501. // CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `{ ... }` (phase_all.carbon:18)
  502. // CHECK:STDOUT: ->> step StatementAction pos: 0 `{ ... }` (phase_all.carbon:18) --->
  503. // CHECK:STDOUT:
  504. // CHECK:STDOUT: *** statement at (phase_all.carbon:18)
  505. // CHECK:STDOUT: ```
  506. // CHECK:STDOUT: {
  507. // CHECK:STDOUT: var x: i32 = N.Foo(0);
  508. // CHECK:STDOUT: return x;
  509. // CHECK:STDOUT: }
  510. // CHECK:STDOUT: ```
  511. // CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `var ... = ...;` (phase_all.carbon:16)
  512. // CHECK:STDOUT: ->> step StatementAction pos: 0 `var ... = ...;` (phase_all.carbon:16) --->
  513. // CHECK:STDOUT:
  514. // CHECK:STDOUT: *** statement at (phase_all.carbon:16)
  515. // CHECK:STDOUT: ```
  516. // CHECK:STDOUT: var x: i32 = N.Foo(0);
  517. // CHECK:STDOUT: ```
  518. // CHECK:STDOUT: ++# memory-alloc: #1 `Uninit<i32>` uninitialized
  519. // CHECK:STDOUT: >[] stack-push: ExpressionAction pos: 0 `N.Foo(0)` (phase_all.carbon:16)
  520. // CHECK:STDOUT: ->> step ExpressionAction pos: 0 `N.Foo(0)` (phase_all.carbon:16) --->
  521. // CHECK:STDOUT: >[] stack-push: ValueExpressionAction pos: 0 `N.Foo` (phase_all.carbon:16)
  522. // CHECK:STDOUT: ->> step ValueExpressionAction pos: 0 `N.Foo` (phase_all.carbon:16) --->
  523. // CHECK:STDOUT: >[] stack-push: ExpressionAction pos: 0 `N.Foo` (phase_all.carbon:16)
  524. // CHECK:STDOUT: ->> step ExpressionAction pos: 0 `N.Foo` (phase_all.carbon:16) --->
  525. // CHECK:STDOUT: <[] stack-pop: ExpressionAction pos: 0 `N.Foo` (phase_all.carbon:16)
  526. // CHECK:STDOUT: >[] stack-push: ExpressionAction pos: 0 `Foo` (phase_all.carbon:16)
  527. // CHECK:STDOUT: ->> step ExpressionAction pos: 0 `Foo` (phase_all.carbon:16) --->
  528. // CHECK:STDOUT: <[] stack-pop: ExpressionAction pos: 0 `Foo` (phase_all.carbon:16)
  529. // CHECK:STDOUT: ->> step ValueExpressionAction pos: 1 `N.Foo` results: [`fun<N.Foo>`] (phase_all.carbon:16) --->
  530. // CHECK:STDOUT: <[] stack-pop: ValueExpressionAction pos: 1 `N.Foo` results: [`fun<N.Foo>`] (phase_all.carbon:16)
  531. // CHECK:STDOUT: ->> step ExpressionAction pos: 1 `N.Foo(0)` results: [`fun<N.Foo>`] scope: [] (phase_all.carbon:16) --->
  532. // CHECK:STDOUT: >[] stack-push: ExpressionAction pos: 0 `0` (phase_all.carbon:16)
  533. // CHECK:STDOUT: ->> step ExpressionAction pos: 0 `0` (phase_all.carbon:16) --->
  534. // CHECK:STDOUT: <[] stack-pop: ExpressionAction pos: 0 `0` (phase_all.carbon:16)
  535. // CHECK:STDOUT: ->> step ExpressionAction pos: 2 `N.Foo(0)` results: [`fun<N.Foo>`, `0`] scope: [] (phase_all.carbon:16) --->
  536. // CHECK:STDOUT: -() calling function: fun<N.Foo>
  537. // CHECK:STDOUT: === match pattern `(Placeholder<n>,)`
  538. // CHECK:STDOUT: from value expression with value `(0,)`
  539. // CHECK:STDOUT: === match pattern `Placeholder<n>`
  540. // CHECK:STDOUT: from value expression with value `0`
  541. // CHECK:STDOUT: >[] stack-push: ScopeAction pos: 0 scope: [`n: i32`: `0`] (None)
  542. // CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `{ ... }` (phase_all.carbon:13)
  543. // CHECK:STDOUT: ->> step StatementAction pos: 0 `{ ... }` (phase_all.carbon:13) --->
  544. // CHECK:STDOUT:
  545. // CHECK:STDOUT: *** statement at (phase_all.carbon:13)
  546. // CHECK:STDOUT: ```
  547. // CHECK:STDOUT: {
  548. // CHECK:STDOUT: return (n + 1);
  549. // CHECK:STDOUT: }
  550. // CHECK:STDOUT: ```
  551. // CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `return ...;` (phase_all.carbon:12)
  552. // CHECK:STDOUT: ->> step StatementAction pos: 0 `return ...;` (phase_all.carbon:12) --->
  553. // CHECK:STDOUT:
  554. // CHECK:STDOUT: *** statement at (phase_all.carbon:12)
  555. // CHECK:STDOUT: ```
  556. // CHECK:STDOUT: return (n + 1);
  557. // CHECK:STDOUT: ```
  558. // CHECK:STDOUT: >[] stack-push: ValueExpressionAction pos: 0 `(n + 1)` (phase_all.carbon:12)
  559. // CHECK:STDOUT: ->> step ValueExpressionAction pos: 0 `(n + 1)` (phase_all.carbon:12) --->
  560. // CHECK:STDOUT: >[] stack-push: ExpressionAction pos: 0 `(n + 1)` (phase_all.carbon:12)
  561. // CHECK:STDOUT: ->> step ExpressionAction pos: 0 `(n + 1)` (phase_all.carbon:12) --->
  562. // CHECK:STDOUT: >[] stack-push: ValueExpressionAction pos: 0 `n` (phase_all.carbon:12)
  563. // CHECK:STDOUT: ->> step ValueExpressionAction pos: 0 `n` (phase_all.carbon:12) --->
  564. // CHECK:STDOUT: >[] stack-push: ExpressionAction pos: 0 `n` (phase_all.carbon:12)
  565. // CHECK:STDOUT: ->> step ExpressionAction pos: 0 `n` (phase_all.carbon:12) --->
  566. // CHECK:STDOUT: <[] stack-pop: ExpressionAction pos: 0 `n` (phase_all.carbon:12)
  567. // CHECK:STDOUT: ->> step ValueExpressionAction pos: 1 `n` results: [`0`] (phase_all.carbon:12) --->
  568. // CHECK:STDOUT: <[] stack-pop: ValueExpressionAction pos: 1 `n` results: [`0`] (phase_all.carbon:12)
  569. // CHECK:STDOUT: ->> step ExpressionAction pos: 1 `(n + 1)` results: [`0`] (phase_all.carbon:12) --->
  570. // CHECK:STDOUT: >[] stack-push: ValueExpressionAction pos: 0 `1` (phase_all.carbon:12)
  571. // CHECK:STDOUT: ->> step ValueExpressionAction pos: 0 `1` (phase_all.carbon:12) --->
  572. // CHECK:STDOUT: >[] stack-push: ExpressionAction pos: 0 `1` (phase_all.carbon:12)
  573. // CHECK:STDOUT: ->> step ExpressionAction pos: 0 `1` (phase_all.carbon:12) --->
  574. // CHECK:STDOUT: <[] stack-pop: ExpressionAction pos: 0 `1` (phase_all.carbon:12)
  575. // CHECK:STDOUT: ->> step ValueExpressionAction pos: 1 `1` results: [`1`] (phase_all.carbon:12) --->
  576. // CHECK:STDOUT: <[] stack-pop: ValueExpressionAction pos: 1 `1` results: [`1`] (phase_all.carbon:12)
  577. // CHECK:STDOUT: ->> step ExpressionAction pos: 2 `(n + 1)` results: [`0`, `1`] (phase_all.carbon:12) --->
  578. // CHECK:STDOUT: <[] stack-pop: ExpressionAction pos: 2 `(n + 1)` results: [`0`, `1`] (phase_all.carbon:12)
  579. // CHECK:STDOUT: ->> step ValueExpressionAction pos: 1 `(n + 1)` results: [`1`] (phase_all.carbon:12) --->
  580. // CHECK:STDOUT: <[] stack-pop: ValueExpressionAction pos: 1 `(n + 1)` results: [`1`] (phase_all.carbon:12)
  581. // CHECK:STDOUT: ->> step StatementAction pos: 1 `return ...;` results: [`1`] (phase_all.carbon:12) --->
  582. // CHECK:STDOUT:
  583. // CHECK:STDOUT: *** statement at (phase_all.carbon:12)
  584. // CHECK:STDOUT: ```
  585. // CHECK:STDOUT: return (n + 1);
  586. // CHECK:STDOUT: ```
  587. // CHECK:STDOUT: --> memory-write: #1 `1`
  588. // CHECK:STDOUT: <[] stack-pop: StatementAction pos: 1 `return ...;` results: [`1`] (phase_all.carbon:12)
  589. // CHECK:STDOUT: <[] stack-pop: StatementAction pos: 1 `{ ... }` scope: [] (phase_all.carbon:13)
  590. // CHECK:STDOUT: <[] stack-pop: ScopeAction pos: 0 scope: [`n: i32`: `0`] (None)
  591. // CHECK:STDOUT: >[] stack-push: CleanUpAction pos: 0 scope: [`n: i32`: `0`] (stack cleanup:1)
  592. // CHECK:STDOUT: >[] stack-push: CleanUpAction pos: 0 scope: [] (stack cleanup:1)
  593. // CHECK:STDOUT: ->> step CleanUpAction pos: 0 scope: [] (stack cleanup:1) --->
  594. // CHECK:STDOUT: <[] stack-pop: CleanUpAction pos: 0 scope: [] (stack cleanup:1)
  595. // CHECK:STDOUT: ->> step CleanUpAction pos: 0 scope: [`n: i32`: `0`] (stack cleanup:1) --->
  596. // CHECK:STDOUT: <[] stack-pop: CleanUpAction pos: 0 scope: [`n: i32`: `0`] (stack cleanup:1)
  597. // CHECK:STDOUT: ->> step ExpressionAction pos: 3 `N.Foo(0)` results: [`fun<N.Foo>`, `0`, `1`] scope: [] (phase_all.carbon:16) --->
  598. // CHECK:STDOUT: <[] stack-pop: ExpressionAction pos: 3 `N.Foo(0)` results: [`fun<N.Foo>`, `0`, `1`] scope: [] (phase_all.carbon:16)
  599. // CHECK:STDOUT: >[] stack-push: CleanUpAction pos: 0 scope: [] (stack cleanup:1)
  600. // CHECK:STDOUT: ->> step CleanUpAction pos: 0 scope: [] (stack cleanup:1) --->
  601. // CHECK:STDOUT: <[] stack-pop: CleanUpAction pos: 0 scope: [] (stack cleanup:1)
  602. // CHECK:STDOUT: ->> step StatementAction pos: 1 `var ... = ...;` results: [`1`] (phase_all.carbon:16) --->
  603. // CHECK:STDOUT:
  604. // CHECK:STDOUT: *** statement at (phase_all.carbon:16)
  605. // CHECK:STDOUT: ```
  606. // CHECK:STDOUT: var x: i32 = N.Foo(0);
  607. // CHECK:STDOUT: ```
  608. // CHECK:STDOUT: <-- memory-read: #1 `1`
  609. // CHECK:STDOUT: === match pattern `Placeholder<x>`
  610. // CHECK:STDOUT: from initializing expression with value `1`
  611. // CHECK:STDOUT: <[] stack-pop: StatementAction pos: 1 `var ... = ...;` results: [`1`] (phase_all.carbon:16)
  612. // CHECK:STDOUT: ->> step StatementAction pos: 1 `{ ... }` scope: [`x: i32`: `lval<Allocation(1)>`] (phase_all.carbon:18) --->
  613. // CHECK:STDOUT:
  614. // CHECK:STDOUT: *** statement at (phase_all.carbon:18)
  615. // CHECK:STDOUT: ```
  616. // CHECK:STDOUT: {
  617. // CHECK:STDOUT: var x: i32 = N.Foo(0);
  618. // CHECK:STDOUT: return x;
  619. // CHECK:STDOUT: }
  620. // CHECK:STDOUT: ```
  621. // CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `return ...;` (phase_all.carbon:17)
  622. // CHECK:STDOUT: ->> step StatementAction pos: 0 `return ...;` (phase_all.carbon:17) --->
  623. // CHECK:STDOUT:
  624. // CHECK:STDOUT: *** statement at (phase_all.carbon:17)
  625. // CHECK:STDOUT: ```
  626. // CHECK:STDOUT: return x;
  627. // CHECK:STDOUT: ```
  628. // CHECK:STDOUT: >[] stack-push: ValueExpressionAction pos: 0 `x` (phase_all.carbon:17)
  629. // CHECK:STDOUT: ->> step ValueExpressionAction pos: 0 `x` (phase_all.carbon:17) --->
  630. // CHECK:STDOUT: >[] stack-push: ExpressionAction pos: 0 `x` (phase_all.carbon:17)
  631. // CHECK:STDOUT: ->> step ExpressionAction pos: 0 `x` (phase_all.carbon:17) --->
  632. // CHECK:STDOUT: <-- memory-read: #1 `1`
  633. // CHECK:STDOUT: <[] stack-pop: ExpressionAction pos: 0 `x` (phase_all.carbon:17)
  634. // CHECK:STDOUT: ->> step ValueExpressionAction pos: 1 `x` results: [`ref_expr<Allocation(1)>`] (phase_all.carbon:17) --->
  635. // CHECK:STDOUT: <[] stack-pop: ValueExpressionAction pos: 1 `x` results: [`ref_expr<Allocation(1)>`] (phase_all.carbon:17)
  636. // CHECK:STDOUT: ->> step StatementAction pos: 1 `return ...;` results: [`1`] (phase_all.carbon:17) --->
  637. // CHECK:STDOUT:
  638. // CHECK:STDOUT: *** statement at (phase_all.carbon:17)
  639. // CHECK:STDOUT: ```
  640. // CHECK:STDOUT: return x;
  641. // CHECK:STDOUT: ```
  642. // CHECK:STDOUT: <[] stack-pop: StatementAction pos: 1 `return ...;` results: [`1`] (phase_all.carbon:17)
  643. // CHECK:STDOUT: <[] stack-pop: StatementAction pos: 2 `{ ... }` scope: [`x: i32`: `lval<Allocation(1)>`] (phase_all.carbon:18)
  644. // CHECK:STDOUT: <[] stack-pop: ScopeAction pos: 0 scope: [] (None)
  645. // CHECK:STDOUT: >[] stack-push: CleanUpAction pos: 0 scope: [] (stack cleanup:1)
  646. // CHECK:STDOUT: >[] stack-push: CleanUpAction pos: 0 scope: [`x: i32`: `lval<Allocation(1)>`] (stack cleanup:1)
  647. // CHECK:STDOUT: ->> step CleanUpAction pos: 0 scope: [`x: i32`: `lval<Allocation(1)>`] (stack cleanup:1) --->
  648. // CHECK:STDOUT: <-- memory-read: #1 `1`
  649. // CHECK:STDOUT: >[] stack-push: DestroyAction pos: 0 (None)
  650. // CHECK:STDOUT: ->> step DestroyAction pos: 0 (None) --->
  651. // CHECK:STDOUT: <[] stack-pop: DestroyAction pos: 0 (None)
  652. // CHECK:STDOUT: ->> step CleanUpAction pos: 1 scope: [`x: i32`: `lval<Allocation(1)>`] (stack cleanup:1) --->
  653. // CHECK:STDOUT: --# memory-dealloc: #1 `1`
  654. // CHECK:STDOUT: ->> step CleanUpAction pos: 2 scope: [`x: i32`: `lval<Allocation(1)>`] (stack cleanup:1) --->
  655. // CHECK:STDOUT: <[] stack-pop: CleanUpAction pos: 2 scope: [`x: i32`: `lval<Allocation(1)>`] (stack cleanup:1)
  656. // CHECK:STDOUT: ->> step CleanUpAction pos: 0 scope: [] (stack cleanup:1) --->
  657. // CHECK:STDOUT: <[] stack-pop: CleanUpAction pos: 0 scope: [] (stack cleanup:1)
  658. // CHECK:STDOUT: ->> step ExpressionAction pos: 2 `Main()` results: [`fun<Main>`, `1`] scope: [] (<Main()>:0) --->
  659. // CHECK:STDOUT: <[] stack-pop: ExpressionAction pos: 2 `Main()` results: [`fun<Main>`, `1`] scope: [] (<Main()>:0)
  660. // CHECK:STDOUT: >[] stack-push: CleanUpAction pos: 0 scope: [] (stack cleanup:1)
  661. // CHECK:STDOUT: ->> step CleanUpAction pos: 0 scope: [] (stack cleanup:1) --->
  662. // CHECK:STDOUT: <[] stack-pop: CleanUpAction pos: 0 scope: [] (stack cleanup:1)
  663. // CHECK:STDOUT: ->> step ValueExpressionAction pos: 1 `Main()` results: [`1`] (<Main()>:0) --->
  664. // CHECK:STDOUT: <[] stack-pop: ValueExpressionAction pos: 1 `Main()` results: [`1`] (<Main()>:0)
  665. // CHECK:STDOUT: ==> interpreter result: 1
  666. // CHECK:STDOUT:
  667. // CHECK:STDOUT:
  668. // CHECK:STDOUT: * * * * * * * * * * printing timing * * * * * * * * * *
  669. // CHECK:STDOUT: ---------------------------------------------------------
  670. // CHECK:STDOUT: Time elapsed in ExecProgram: {{\d+}}ms
  671. // CHECK:STDOUT: Time elapsed in AnalyzeProgram: {{\d+}}ms
  672. // CHECK:STDOUT: Time elapsed in AddPrelude: {{\d+}}ms
  673. // CHECK:STDOUT: Time elapsed in Parse: {{\d+}}ms
  674. // CHECK:STDOUT: result: 1