full_trace.carbon 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  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. // CHECK:STDOUT: ********** source program **********
  7. // CHECK:STDOUT: interface TestInterface {
  8. // CHECK:STDOUT: }
  9. // CHECK:STDOUT: namespace N;fn Foo (n: i32)-> i32 {
  10. // CHECK:STDOUT: {
  11. // CHECK:STDOUT: return (n + 1);
  12. // CHECK:STDOUT: }
  13. // CHECK:STDOUT:
  14. // CHECK:STDOUT: }
  15. // CHECK:STDOUT: fn Main ()-> i32 {
  16. // CHECK:STDOUT: {
  17. // CHECK:STDOUT: var x: i32 = N.Foo(0);
  18. // CHECK:STDOUT: return x;
  19. // CHECK:STDOUT: }
  20. // CHECK:STDOUT:
  21. // CHECK:STDOUT: }
  22. // CHECK:STDOUT: ********** resolving names **********
  23. package ExplorerTest api;
  24. // CHECK:STDOUT: --- declared `TestInterface` as `interface TestInterface` in `package` (full_trace.carbon:[[@LINE+1]])
  25. interface TestInterface {}
  26. // CHECK:STDOUT: --- declared `N` as `namespace N` in `package` (full_trace.carbon:[[@LINE+1]])
  27. namespace N;
  28. // CHECK:STDOUT: --- resolved `N` as `namespace N` in `package` (full_trace.carbon:[[@LINE+1]])
  29. fn N.Foo(n: i32) -> i32 {
  30. return n + 1;
  31. // CHECK:STDOUT: --- declared `Foo` as `fn N.Foo` in `namespace N` (full_trace.carbon:[[@LINE+1]])
  32. }
  33. fn Main() -> i32 {
  34. var x: i32 = N.Foo(0);
  35. return x;
  36. // CHECK:STDOUT: --- declared `Main` as `fn Main` in `package` (full_trace.carbon:[[@LINE+310]])
  37. // CHECK:STDOUT: ** resolving decl `interface TestInterface` (full_trace.carbon:[[@LINE-15]])
  38. // CHECK:STDOUT: --- marked `TestInterface` declared but not usable in `package`
  39. // CHECK:STDOUT: --- marked `TestInterface` usable in `package`
  40. // CHECK:STDOUT: --- declared `Self` as `Self` in `interface TestInterface` (full_trace.carbon:[[@LINE-18]])
  41. // CHECK:STDOUT: ** finished resolving decl `interface TestInterface` (full_trace.carbon:[[@LINE-19]])
  42. // CHECK:STDOUT: ** resolving decl `namespace N` (full_trace.carbon:[[@LINE-17]])
  43. // CHECK:STDOUT: --- marked `N` usable in `package`
  44. // CHECK:STDOUT: ** finished resolving decl `namespace N` (full_trace.carbon:[[@LINE-19]])
  45. // CHECK:STDOUT: ** resolving decl `fn N.Foo` (full_trace.carbon:[[@LINE-14]])
  46. // CHECK:STDOUT: --- resolved `N` as `namespace N` in `package` (full_trace.carbon:[[@LINE-18]])
  47. // CHECK:STDOUT: --- marked `Foo` declared but not usable in `namespace N`
  48. // CHECK:STDOUT: --- declared `n` as `n` in `fn N.Foo` (full_trace.carbon:[[@LINE-20]])
  49. // CHECK:STDOUT: --- marked `Foo` usable in `namespace N`
  50. // CHECK:STDOUT: ** resolving stmt `{return (n + 1);}` (full_trace.carbon:[[@LINE-19]])
  51. // CHECK:STDOUT: ** resolving stmt `return (n + 1);` (full_trace.carbon:[[@LINE-22]])
  52. // CHECK:STDOUT: --- resolved `n` as `n` in `fn N.Foo` (full_trace.carbon:[[@LINE-23]])
  53. // CHECK:STDOUT: ** finished resolving stmt `return (n + 1);` (full_trace.carbon:[[@LINE-24]])
  54. // CHECK:STDOUT: ** finished resolving stmt `{return (n + 1);}` (full_trace.carbon:[[@LINE-23]])
  55. // CHECK:STDOUT: ** finished resolving decl `fn N.Foo` (full_trace.carbon:[[@LINE-24]])
  56. // CHECK:STDOUT: ** resolving decl `fn Main` (full_trace.carbon:[[@LINE+290]])
  57. // CHECK:STDOUT: --- marked `Main` declared but not usable in `package`
  58. // CHECK:STDOUT: --- marked `Main` usable in `package`
  59. // CHECK:STDOUT: ** resolving stmt `{var x: i32 = N.Foo(0);return x;}` (full_trace.carbon:[[@LINE+287]])
  60. // CHECK:STDOUT: ** resolving stmt `var x: i32 = N.Foo(0);` (full_trace.carbon:[[@LINE-26]])
  61. // CHECK:STDOUT: --- resolved `N` as `namespace N` in `package` (full_trace.carbon:[[@LINE-27]])
  62. // CHECK:STDOUT: --- resolved `Foo` as `fn N.Foo` in `namespace N` (full_trace.carbon:[[@LINE-28]])
  63. // CHECK:STDOUT: --- declared `x` as `x` in `{var x: i32 = N.Foo(0);return x;}` (full_trace.carbon:[[@LINE-29]])
  64. // CHECK:STDOUT: ** finished resolving stmt `var x: i32 = N.Foo(0);` (full_trace.carbon:[[@LINE-30]])
  65. // CHECK:STDOUT: ** resolving stmt `return x;` (full_trace.carbon:[[@LINE-30]])
  66. // CHECK:STDOUT: --- resolved `x` as `x` in `{var x: i32 = N.Foo(0);return x;}` (full_trace.carbon:[[@LINE-31]])
  67. // CHECK:STDOUT: ** finished resolving stmt `return x;` (full_trace.carbon:[[@LINE-32]])
  68. // CHECK:STDOUT: ** finished resolving stmt `{var x: i32 = N.Foo(0);return x;}` (full_trace.carbon:[[@LINE+278]])
  69. // CHECK:STDOUT: ** finished resolving decl `fn Main` (full_trace.carbon:[[@LINE+277]])
  70. // CHECK:STDOUT: --- resolved `Main` as `fn Main` in `package` (<Main()>:0)
  71. // CHECK:STDOUT: ********** resolving control flow **********
  72. // CHECK:STDOUT: ********** type checking **********
  73. // CHECK:STDOUT: ** declaring interface TestInterface
  74. // CHECK:STDOUT: ** finished declaring interface TestInterface
  75. // CHECK:STDOUT: checking InterfaceDeclaration
  76. // CHECK:STDOUT: ** checking interface TestInterface
  77. // CHECK:STDOUT: impl declarations:{{ }}
  78. // CHECK:STDOUT: impl declarations: bool as interface EqWith(U = bool), i32 as interface EqWith(U = i32), String as interface EqWith(U = String), i32 as interface CompareWith(U = i32), String as interface CompareWith(U = String), i32 as interface LessWith(U = i32), String as interface LessWith(U = String), i32 as interface LessEqWith(U = i32), String as interface LessEqWith(U = String), i32 as interface GreaterWith(U = i32), String as interface GreaterWith(U = String), i32 as interface GreaterEqWith(U = i32), String as interface GreaterEqWith(U = String), i32 as interface Negate, i32 as interface AddWith(U = i32), i32 as interface SubWith(U = i32), i32 as interface MulWith(U = i32), i32 as interface DivWith(U = i32), i32 as interface ModWith(U = i32), i32 as interface BitComplement, i32 as interface BitAndWith(U = i32), i32 as interface BitOrWith(U = i32), i32 as interface BitXorWith(U = i32), i32 as interface LeftShiftWith(U = i32), i32 as interface RightShiftWith(U = i32), i32 as interface Inc, i32 as interface Dec, U as interface __EqualConverter [0], (T1,) as interface As(T = (U1,)) [0, 0, 0; 1, 1, 0, 0, 0], (T1, T2) as interface As(T = (U1, U2)) [0, 0, 0; 0, 0, 1; 1, 1, 0, 0, 0; 1, 1, 0, 0, 1], (T1, U1) as interface EqWith(U = (T2, U2)) [0, 0, 0; 0, 0, 1; 1, 1, 0, 0, 0; 1, 1, 0, 0, 1], (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], T as interface ImplicitAs(T = U) [0; 1, 1, 0], T as interface As(T = U) [0; 1, 1, 0], T as interface ImplicitAs(T = U) [0; 1, 1, 0], T as interface As(T = U) [0; 1, 1, 0], T as interface AssignWith(U = U) [0; 1, 1, 0], T as interface AddAssignWith(U = U) [0; 1, 1, 0], T as interface SubAssignWith(U = U) [0; 1, 1, 0], T as interface MulAssignWith(U = U) [0; 1, 1, 0], T as interface DivAssignWith(U = U) [0; 1, 1, 0], T as interface ModAssignWith(U = U) [0; 1, 1, 0], T as interface BitAndAssignWith(U = U) [0; 1, 1, 0], T as interface BitOrAssignWith(U = U) [0; 1, 1, 0], T as interface BitXorAssignWith(U = U) [0; 1, 1, 0], T as interface LeftShiftAssignWith(U = U) [0; 1, 1, 0], T as interface RightShiftAssignWith(U = U) [0; 1, 1, 0]
  79. // CHECK:STDOUT: ** finished checking interface TestInterface
  80. // CHECK:STDOUT: checking NamespaceDeclaration
  81. // CHECK:STDOUT: ** declaring function Foo
  82. // CHECK:STDOUT: checking TuplePattern (n: i32)
  83. // CHECK:STDOUT: checking BindingPattern n: i32
  84. // CHECK:STDOUT: checking ExpressionPattern i32
  85. // CHECK:STDOUT: checking IntTypeLiteral i32
  86. // CHECK:STDOUT: (+) stack-push: i32 .0.
  87. // CHECK:STDOUT: (+) stack-push: i32 .0.
  88. // CHECK:STDOUT: --- step exp i32 .0. (full_trace.carbon:[[@LINE-60]]) --->
  89. // CHECK:STDOUT: (-) stack-pop: i32 .0.
  90. // CHECK:STDOUT: (-) stack-pop: i32 .1. {{[[][[]}}i32]]
  91. // CHECK:STDOUT: finished checking tuple pattern field n: i32
  92. // CHECK:STDOUT: checking IntTypeLiteral i32
  93. // CHECK:STDOUT: (+) stack-push: i32 .0.
  94. // CHECK:STDOUT: (+) stack-push: i32 .0.
  95. // CHECK:STDOUT: --- step exp i32 .0. (full_trace.carbon:[[@LINE-67]]) --->
  96. // CHECK:STDOUT: (-) stack-pop: i32 .0.
  97. // CHECK:STDOUT: (-) stack-pop: i32 .1. {{[[][[]}}i32]]
  98. // CHECK:STDOUT: ** finished declaring function Foo of type fn (i32,) -> i32
  99. // CHECK:STDOUT: checking FunctionDeclaration
  100. // CHECK:STDOUT: ** checking function Foo
  101. // CHECK:STDOUT: impl declarations:{{ }}
  102. // CHECK:STDOUT: impl declarations: bool as interface EqWith(U = bool), i32 as interface EqWith(U = i32), String as interface EqWith(U = String), i32 as interface CompareWith(U = i32), String as interface CompareWith(U = String), i32 as interface LessWith(U = i32), String as interface LessWith(U = String), i32 as interface LessEqWith(U = i32), String as interface LessEqWith(U = String), i32 as interface GreaterWith(U = i32), String as interface GreaterWith(U = String), i32 as interface GreaterEqWith(U = i32), String as interface GreaterEqWith(U = String), i32 as interface Negate, i32 as interface AddWith(U = i32), i32 as interface SubWith(U = i32), i32 as interface MulWith(U = i32), i32 as interface DivWith(U = i32), i32 as interface ModWith(U = i32), i32 as interface BitComplement, i32 as interface BitAndWith(U = i32), i32 as interface BitOrWith(U = i32), i32 as interface BitXorWith(U = i32), i32 as interface LeftShiftWith(U = i32), i32 as interface RightShiftWith(U = i32), i32 as interface Inc, i32 as interface Dec, U as interface __EqualConverter [0], (T1,) as interface As(T = (U1,)) [0, 0, 0; 1, 1, 0, 0, 0], (T1, T2) as interface As(T = (U1, U2)) [0, 0, 0; 0, 0, 1; 1, 1, 0, 0, 0; 1, 1, 0, 0, 1], (T1, U1) as interface EqWith(U = (T2, U2)) [0, 0, 0; 0, 0, 1; 1, 1, 0, 0, 0; 1, 1, 0, 0, 1], (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], T as interface ImplicitAs(T = U) [0; 1, 1, 0], T as interface As(T = U) [0; 1, 1, 0], T as interface ImplicitAs(T = U) [0; 1, 1, 0], T as interface As(T = U) [0; 1, 1, 0], T as interface AssignWith(U = U) [0; 1, 1, 0], T as interface AddAssignWith(U = U) [0; 1, 1, 0], T as interface SubAssignWith(U = U) [0; 1, 1, 0], T as interface MulAssignWith(U = U) [0; 1, 1, 0], T as interface DivAssignWith(U = U) [0; 1, 1, 0], T as interface ModAssignWith(U = U) [0; 1, 1, 0], T as interface BitAndAssignWith(U = U) [0; 1, 1, 0], T as interface BitOrAssignWith(U = U) [0; 1, 1, 0], T as interface BitXorAssignWith(U = U) [0; 1, 1, 0], T as interface LeftShiftAssignWith(U = U) [0; 1, 1, 0], T as interface RightShiftAssignWith(U = U) [0; 1, 1, 0]
  103. // CHECK:STDOUT: checking Block {
  104. // CHECK:STDOUT: return (n + 1);
  105. // CHECK:STDOUT: }
  106. // CHECK:STDOUT:
  107. // CHECK:STDOUT: checking ReturnExpression return (n + 1);
  108. // CHECK:STDOUT: checking OperatorExpression (n + 1)
  109. // CHECK:STDOUT: checking IdentifierExpression n
  110. // CHECK:STDOUT: checking IntLiteral 1
  111. // CHECK:STDOUT: ** finished checking function Foo
  112. // CHECK:STDOUT: ** declaring function Main
  113. // CHECK:STDOUT: checking TuplePattern ()
  114. // CHECK:STDOUT: checking IntTypeLiteral i32
  115. // CHECK:STDOUT: (+) stack-push: i32 .0.
  116. // CHECK:STDOUT: (+) stack-push: i32 .0.
  117. // CHECK:STDOUT: --- step exp i32 .0. (full_trace.carbon:[[@LINE-84]]) --->
  118. // CHECK:STDOUT: (-) stack-pop: i32 .0.
  119. // CHECK:STDOUT: (-) stack-pop: i32 .1. {{[[][[]}}i32]]
  120. // CHECK:STDOUT: ** finished declaring function Main of type fn () -> i32
  121. // CHECK:STDOUT: checking FunctionDeclaration
  122. // CHECK:STDOUT: ** checking function Main
  123. // CHECK:STDOUT: impl declarations:{{ }}
  124. // CHECK:STDOUT: impl declarations: bool as interface EqWith(U = bool), i32 as interface EqWith(U = i32), String as interface EqWith(U = String), i32 as interface CompareWith(U = i32), String as interface CompareWith(U = String), i32 as interface LessWith(U = i32), String as interface LessWith(U = String), i32 as interface LessEqWith(U = i32), String as interface LessEqWith(U = String), i32 as interface GreaterWith(U = i32), String as interface GreaterWith(U = String), i32 as interface GreaterEqWith(U = i32), String as interface GreaterEqWith(U = String), i32 as interface Negate, i32 as interface AddWith(U = i32), i32 as interface SubWith(U = i32), i32 as interface MulWith(U = i32), i32 as interface DivWith(U = i32), i32 as interface ModWith(U = i32), i32 as interface BitComplement, i32 as interface BitAndWith(U = i32), i32 as interface BitOrWith(U = i32), i32 as interface BitXorWith(U = i32), i32 as interface LeftShiftWith(U = i32), i32 as interface RightShiftWith(U = i32), i32 as interface Inc, i32 as interface Dec, U as interface __EqualConverter [0], (T1,) as interface As(T = (U1,)) [0, 0, 0; 1, 1, 0, 0, 0], (T1, T2) as interface As(T = (U1, U2)) [0, 0, 0; 0, 0, 1; 1, 1, 0, 0, 0; 1, 1, 0, 0, 1], (T1, U1) as interface EqWith(U = (T2, U2)) [0, 0, 0; 0, 0, 1; 1, 1, 0, 0, 0; 1, 1, 0, 0, 1], (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], T as interface ImplicitAs(T = U) [0; 1, 1, 0], T as interface As(T = U) [0; 1, 1, 0], T as interface ImplicitAs(T = U) [0; 1, 1, 0], T as interface As(T = U) [0; 1, 1, 0], T as interface AssignWith(U = U) [0; 1, 1, 0], T as interface AddAssignWith(U = U) [0; 1, 1, 0], T as interface SubAssignWith(U = U) [0; 1, 1, 0], T as interface MulAssignWith(U = U) [0; 1, 1, 0], T as interface DivAssignWith(U = U) [0; 1, 1, 0], T as interface ModAssignWith(U = U) [0; 1, 1, 0], T as interface BitAndAssignWith(U = U) [0; 1, 1, 0], T as interface BitOrAssignWith(U = U) [0; 1, 1, 0], T as interface BitXorAssignWith(U = U) [0; 1, 1, 0], T as interface LeftShiftAssignWith(U = U) [0; 1, 1, 0], T as interface RightShiftAssignWith(U = U) [0; 1, 1, 0]
  125. // CHECK:STDOUT: checking Block {
  126. // CHECK:STDOUT: var x: i32 = N.Foo(0);
  127. // CHECK:STDOUT: return x;
  128. // CHECK:STDOUT: }
  129. // CHECK:STDOUT:
  130. // CHECK:STDOUT: checking VariableDefinition var x: i32 = N.Foo(0);
  131. // CHECK:STDOUT: checking CallExpression N.Foo(0)
  132. // CHECK:STDOUT: checking SimpleMemberAccessExpression N.Foo
  133. // CHECK:STDOUT: checking IdentifierExpression Foo
  134. // CHECK:STDOUT: checking TupleLiteral (0)
  135. // CHECK:STDOUT: checking IntLiteral 0
  136. // CHECK:STDOUT: checking call to function of type fn (i32,) -> i32
  137. // CHECK:STDOUT: with arguments of type: (i32,)
  138. // CHECK:STDOUT: performing argument deduction for bindings:{{ }}
  139. // CHECK:STDOUT: deducing i32 from i32
  140. // CHECK:STDOUT: deduction succeeded with results: {}
  141. // CHECK:STDOUT: checking BindingPattern x: i32, expecting i32
  142. // CHECK:STDOUT: checking ExpressionPattern i32, expecting i32
  143. // CHECK:STDOUT: checking IntTypeLiteral i32
  144. // CHECK:STDOUT: (+) stack-push: i32 .0.
  145. // CHECK:STDOUT: (+) stack-push: i32 .0.
  146. // CHECK:STDOUT: --- step exp i32 .0. (full_trace.carbon:[[@LINE-112]]) --->
  147. // CHECK:STDOUT: (-) stack-pop: i32 .0.
  148. // CHECK:STDOUT: (-) stack-pop: i32 .1. {{[[][[]}}i32]]
  149. // CHECK:STDOUT: checking ReturnExpression return x;
  150. // CHECK:STDOUT: checking IdentifierExpression x
  151. // CHECK:STDOUT: ** finished checking function Main
  152. // CHECK:STDOUT: checking CallExpression Main()
  153. // CHECK:STDOUT: checking IdentifierExpression Main
  154. // CHECK:STDOUT: checking TupleLiteral ()
  155. // CHECK:STDOUT: checking call to function of type fn () -> i32
  156. // CHECK:STDOUT: with arguments of type: ()
  157. // CHECK:STDOUT: performing argument deduction for bindings:{{ }}
  158. // CHECK:STDOUT: deduction succeeded with results: {}
  159. // CHECK:STDOUT: ********** resolving unformed variables **********
  160. // CHECK:STDOUT: ********** printing declarations **********
  161. // CHECK:STDOUT: interface TestInterface {
  162. // CHECK:STDOUT: }
  163. // CHECK:STDOUT: namespace N;fn Foo (n: i32)-> i32 {
  164. // CHECK:STDOUT: {
  165. // CHECK:STDOUT: return (n + 1);
  166. // CHECK:STDOUT: }
  167. // CHECK:STDOUT:
  168. // CHECK:STDOUT: }
  169. // CHECK:STDOUT: fn Main ()-> i32 {
  170. // CHECK:STDOUT: {
  171. // CHECK:STDOUT: var x: i32 = N.Foo(0);
  172. // CHECK:STDOUT: return x;
  173. // CHECK:STDOUT: }
  174. // CHECK:STDOUT:
  175. // CHECK:STDOUT: }
  176. // CHECK:STDOUT: ********** starting execution **********
  177. // CHECK:STDOUT: ********** initializing globals **********
  178. // CHECK:STDOUT: (+) stack-push: interface TestInterface {
  179. // CHECK:STDOUT: }
  180. // CHECK:STDOUT: .0.
  181. // CHECK:STDOUT: --- step decl interface TestInterface .0. (full_trace.carbon:[[@LINE-159]]) --->
  182. // CHECK:STDOUT: (-) stack-pop: interface TestInterface {
  183. // CHECK:STDOUT: }
  184. // CHECK:STDOUT: .0.
  185. // CHECK:STDOUT: (+) stack-push: namespace N; .0.
  186. // CHECK:STDOUT: --- step decl namespace N .0. (full_trace.carbon:[[@LINE-161]]) --->
  187. // CHECK:STDOUT: (-) stack-pop: namespace N; .0.
  188. // CHECK:STDOUT: (+) stack-push: fn Foo (n: i32)-> i32 {
  189. // CHECK:STDOUT: {
  190. // CHECK:STDOUT: return (n + 1);
  191. // CHECK:STDOUT: }
  192. // CHECK:STDOUT:
  193. // CHECK:STDOUT: }
  194. // CHECK:STDOUT: .0.
  195. // CHECK:STDOUT: --- step decl fn N.Foo .0. (full_trace.carbon:[[@LINE-164]]) --->
  196. // CHECK:STDOUT: (-) stack-pop: fn Foo (n: i32)-> i32 {
  197. // CHECK:STDOUT: {
  198. // CHECK:STDOUT: return (n + 1);
  199. // CHECK:STDOUT: }
  200. // CHECK:STDOUT:
  201. // CHECK:STDOUT: }
  202. // CHECK:STDOUT: .0.
  203. // CHECK:STDOUT: (+) stack-push: fn Main ()-> i32 {
  204. // CHECK:STDOUT: {
  205. // CHECK:STDOUT: var x: i32 = N.Foo(0);
  206. // CHECK:STDOUT: return x;
  207. // CHECK:STDOUT: }
  208. // CHECK:STDOUT:
  209. // CHECK:STDOUT: }
  210. // CHECK:STDOUT: .0.
  211. // CHECK:STDOUT: --- step decl fn Main .0. (full_trace.carbon:[[@LINE+135]]) --->
  212. // CHECK:STDOUT: (-) stack-pop: fn Main ()-> i32 {
  213. // CHECK:STDOUT: {
  214. // CHECK:STDOUT: var x: i32 = N.Foo(0);
  215. // CHECK:STDOUT: return x;
  216. // CHECK:STDOUT: }
  217. // CHECK:STDOUT:
  218. // CHECK:STDOUT: }
  219. // CHECK:STDOUT: .0.
  220. // CHECK:STDOUT: ********** calling main function **********
  221. // CHECK:STDOUT: (+) stack-push: Main() .0.
  222. // CHECK:STDOUT: (+) stack-push: Main() .0.
  223. // CHECK:STDOUT: --- step exp Main() .0. (<Main()>:0) --->
  224. // CHECK:STDOUT: (+) stack-push: Main .0.
  225. // CHECK:STDOUT: (+) stack-push: Main .0.
  226. // CHECK:STDOUT: --- step exp Main .0. (<Main()>:0) --->
  227. // CHECK:STDOUT: (-) stack-pop: Main .0.
  228. // CHECK:STDOUT: (-) stack-pop: Main .1. {{[[][[]}}fun<Main>]]
  229. // CHECK:STDOUT: --- step exp Main() .1. (<Main()>:0) --->
  230. // CHECK:STDOUT: (+) stack-push: () .0.
  231. // CHECK:STDOUT: --- step exp () .0. (<Main()>:0) --->
  232. // CHECK:STDOUT: (-) stack-pop: () .0.
  233. // CHECK:STDOUT: --- step exp Main() .2. (<Main()>:0) --->
  234. // CHECK:STDOUT: calling function: fun<Main>
  235. // CHECK:STDOUT: match pattern ()
  236. // CHECK:STDOUT: from value expression with value ()
  237. // CHECK:STDOUT: (+) stack-push: .0. {}
  238. // CHECK:STDOUT: (+) stack-push: {var x: i32 = N.Foo(0);return x;} .0.
  239. // CHECK:STDOUT: --- step stmt {var x: i32 = N.Foo(0);return x;} .0. (full_trace.carbon:[[@LINE+107]]) --->
  240. // CHECK:STDOUT: (+) stack-push: var x: i32 = N.Foo(0); .0.
  241. // CHECK:STDOUT: --- step stmt var x: i32 = N.Foo(0); .0. (full_trace.carbon:[[@LINE-207]]) --->
  242. // CHECK:STDOUT: (+) memory-alloc: #1 `Uninit<i32>` uninitialized
  243. // CHECK:STDOUT: (+) stack-push: N.Foo(0) .0.
  244. // CHECK:STDOUT: --- step exp N.Foo(0) .0. (full_trace.carbon:[[@LINE-210]]) --->
  245. // CHECK:STDOUT: (+) stack-push: N.Foo .0.
  246. // CHECK:STDOUT: (+) stack-push: N.Foo .0.
  247. // CHECK:STDOUT: --- step exp N.Foo .0. (full_trace.carbon:[[@LINE-213]]) --->
  248. // CHECK:STDOUT: (-) stack-pop: N.Foo .0.
  249. // CHECK:STDOUT: (+) stack-push: Foo .0.
  250. // CHECK:STDOUT: --- step exp Foo .0. (full_trace.carbon:[[@LINE-216]]) --->
  251. // CHECK:STDOUT: (-) stack-pop: Foo .0.
  252. // CHECK:STDOUT: (-) stack-pop: N.Foo .1. {{[[][[]}}fun<N.Foo>]]
  253. // CHECK:STDOUT: --- step exp N.Foo(0) .1. (full_trace.carbon:[[@LINE-219]]) --->
  254. // CHECK:STDOUT: (+) stack-push: (0) .0.
  255. // CHECK:STDOUT: --- step exp (0) .0. (full_trace.carbon:[[@LINE-221]]) --->
  256. // CHECK:STDOUT: (+) stack-push: 0 .0.
  257. // CHECK:STDOUT: --- step exp 0 .0. (full_trace.carbon:[[@LINE-223]]) --->
  258. // CHECK:STDOUT: (-) stack-pop: 0 .0.
  259. // CHECK:STDOUT: --- step exp (0) .1. (full_trace.carbon:[[@LINE-225]]) --->
  260. // CHECK:STDOUT: (-) stack-pop: (0) .1. {{[[][[]}}0]]
  261. // CHECK:STDOUT: --- step exp N.Foo(0) .2. (full_trace.carbon:[[@LINE-227]]) --->
  262. // CHECK:STDOUT: calling function: fun<N.Foo>
  263. // CHECK:STDOUT: match pattern (Placeholder<n>,)
  264. // CHECK:STDOUT: from value expression with value (0,)
  265. // CHECK:STDOUT: match pattern Placeholder<n>
  266. // CHECK:STDOUT: from value expression with value 0
  267. // CHECK:STDOUT: (+) memory-alloc: #2 `0`
  268. // CHECK:STDOUT: (+) stack-push: .0. {n: i32: lval<Allocation(2)>}
  269. // CHECK:STDOUT: (+) stack-push: {return (n + 1);} .0.
  270. // CHECK:STDOUT: --- step stmt {return (n + 1);} .0. (full_trace.carbon:[[@LINE-239]]) --->
  271. // CHECK:STDOUT: (+) stack-push: return (n + 1); .0.
  272. // CHECK:STDOUT: --- step stmt return (n + 1); .0. (full_trace.carbon:[[@LINE-243]]) --->
  273. // CHECK:STDOUT: (+) stack-push: (n + 1) .0.
  274. // CHECK:STDOUT: (+) stack-push: (n + 1) .0.
  275. // CHECK:STDOUT: --- step exp (n + 1) .0. (full_trace.carbon:[[@LINE-246]]) --->
  276. // CHECK:STDOUT: (+) stack-push: n .0.
  277. // CHECK:STDOUT: (+) stack-push: n .0.
  278. // CHECK:STDOUT: --- step exp n .0. (full_trace.carbon:[[@LINE-249]]) --->
  279. // CHECK:STDOUT: +++ memory-read: #2 `0`
  280. // CHECK:STDOUT: (-) stack-pop: n .0.
  281. // CHECK:STDOUT: (-) stack-pop: n .1. {{[[][[]}}0]]
  282. // CHECK:STDOUT: --- step exp (n + 1) .1. (full_trace.carbon:[[@LINE-253]]) --->
  283. // CHECK:STDOUT: (+) stack-push: 1 .0.
  284. // CHECK:STDOUT: (+) stack-push: 1 .0.
  285. // CHECK:STDOUT: --- step exp 1 .0. (full_trace.carbon:[[@LINE-256]]) --->
  286. // CHECK:STDOUT: (-) stack-pop: 1 .0.
  287. // CHECK:STDOUT: (-) stack-pop: 1 .1. {{[[][[]}}1]]
  288. // CHECK:STDOUT: --- step exp (n + 1) .2. (full_trace.carbon:[[@LINE-259]]) --->
  289. // CHECK:STDOUT: (-) stack-pop: (n + 1) .2. {{[[][[]}}0, 1]]
  290. // CHECK:STDOUT: (-) stack-pop: (n + 1) .1. {{[[][[]}}1]]
  291. // CHECK:STDOUT: --- step stmt return (n + 1); .1. (full_trace.carbon:[[@LINE-262]]) --->
  292. // CHECK:STDOUT: +++ memory-write: #1 `1`
  293. // CHECK:STDOUT: (-) stack-pop: return (n + 1); .1. {{[[][[]}}1]]
  294. // CHECK:STDOUT: (-) stack-pop: {return (n + 1);} .1. {}
  295. // CHECK:STDOUT: (-) stack-pop: .0. {n: i32: lval<Allocation(2)>}
  296. // CHECK:STDOUT: (+) stack-push: clean up.0. {n: i32: lval<Allocation(2)>}
  297. // CHECK:STDOUT: (+) stack-push: clean up.0. {}
  298. // CHECK:STDOUT: (-) stack-pop: clean up.0. {}
  299. // CHECK:STDOUT: +++ memory-read: #2 `0`
  300. // CHECK:STDOUT: (+) stack-push: destroy.0.
  301. // CHECK:STDOUT: (-) stack-pop: destroy.0.
  302. // CHECK:STDOUT: (-) memory-dealloc: #2 `0`
  303. // CHECK:STDOUT: (-) stack-pop: clean up.2. {n: i32: lval<Allocation(2)>}
  304. // CHECK:STDOUT: --- step exp N.Foo(0) .3. (full_trace.carbon:[[@LINE-270]]) --->
  305. // CHECK:STDOUT: (-) stack-pop: N.Foo(0) .3. {{[[][[]}}fun<N.Foo>, (0,), 1]] {}
  306. // CHECK:STDOUT: (+) stack-push: clean up.0. {}
  307. // CHECK:STDOUT: (-) stack-pop: clean up.0. {}
  308. // CHECK:STDOUT: --- step stmt var x: i32 = N.Foo(0); .1. (full_trace.carbon:[[@LINE-274]]) --->
  309. // CHECK:STDOUT: +++ memory-read: #1 `1`
  310. // CHECK:STDOUT: match pattern Placeholder<x>
  311. // CHECK:STDOUT: from initializing expression with value 1
  312. // CHECK:STDOUT: (-) stack-pop: var x: i32 = N.Foo(0); .1. {{[[][[]}}1]]
  313. // CHECK:STDOUT: --- step stmt {var x: i32 = N.Foo(0);return x;} .1. (full_trace.carbon:[[@LINE+33]]) --->
  314. // CHECK:STDOUT: (+) stack-push: return x; .0.
  315. // CHECK:STDOUT: --- step stmt return x; .0. (full_trace.carbon:[[@LINE-280]]) --->
  316. // CHECK:STDOUT: (+) stack-push: x .0.
  317. // CHECK:STDOUT: (+) stack-push: x .0.
  318. // CHECK:STDOUT: --- step exp x .0. (full_trace.carbon:[[@LINE-283]]) --->
  319. // CHECK:STDOUT: +++ memory-read: #1 `1`
  320. // CHECK:STDOUT: (-) stack-pop: x .0.
  321. // CHECK:STDOUT: (-) stack-pop: x .1. {{[[][[]}}ref_expr<Allocation(1)>]]
  322. // CHECK:STDOUT: --- step stmt return x; .1. (full_trace.carbon:[[@LINE-287]]) --->
  323. // CHECK:STDOUT: (-) stack-pop: return x; .1. {{[[][[]}}1]]
  324. // CHECK:STDOUT: (-) stack-pop: {var x: i32 = N.Foo(0);return x;} .2. {x: i32: lval<Allocation(1)>}
  325. // CHECK:STDOUT: (-) stack-pop: .0. {}
  326. // CHECK:STDOUT: (+) stack-push: clean up.0. {}
  327. // CHECK:STDOUT: (+) stack-push: clean up.0. {x: i32: lval<Allocation(1)>}
  328. // CHECK:STDOUT: +++ memory-read: #1 `1`
  329. // CHECK:STDOUT: (+) stack-push: destroy.0.
  330. // CHECK:STDOUT: (-) stack-pop: destroy.0.
  331. // CHECK:STDOUT: (-) memory-dealloc: #1 `1`
  332. // CHECK:STDOUT: (-) stack-pop: clean up.2. {x: i32: lval<Allocation(1)>}
  333. // CHECK:STDOUT: (-) stack-pop: clean up.0. {}
  334. // CHECK:STDOUT: --- step exp Main() .3. (<Main()>:0) --->
  335. // CHECK:STDOUT: (-) stack-pop: Main() .3. {{[[][[]}}fun<Main>, (), 1]] {}
  336. // CHECK:STDOUT: (+) stack-push: clean up.0. {}
  337. // CHECK:STDOUT: (-) stack-pop: clean up.0. {}
  338. // CHECK:STDOUT: (-) stack-pop: Main() .1. {{[[][[]}}1]]
  339. // CHECK:STDOUT: interpreter result: 1
  340. // CHECK:STDOUT: ********** printing timing **********
  341. // CHECK:STDOUT: Time elapsed in ExecProgram: {{[0-9]+}}ms
  342. // CHECK:STDOUT: Time elapsed in AnalyzeProgram: {{[0-9]+}}ms
  343. // CHECK:STDOUT: Time elapsed in AddPrelude: {{[0-9]+}}ms
  344. // CHECK:STDOUT: Time elapsed in Parse: {{[0-9]+}}ms
  345. // CHECK:STDOUT: result: 1
  346. }