From 289d05813e557d1b5b8b4ffe0da214cf505a9cb1 Mon Sep 17 00:00:00 2001 From: Prabhat Sachdeva Date: Fri, 25 Aug 2023 22:47:39 +0530 Subject: [PATCH] Explorer: Remove `PrintDepth` and implement `PrintIndent`. (#3113) This PR removes `PrintDepth` from statement and declaration. Implements `PrintIndent` for better indented formatting along with various changes to make printing of statements and declarations better. --------- Co-authored-by: Jon Ross-Perkins --- explorer/ast/declaration.cpp | 92 +++++---- explorer/ast/declaration.h | 6 +- explorer/ast/expression.cpp | 6 +- explorer/ast/statement.cpp | 122 +++++++++--- explorer/ast/statement.h | 7 +- explorer/interpreter/exec_program.cpp | 12 +- explorer/interpreter/interpreter.cpp | 2 +- .../class/fail_circular_inheritance.carbon | 7 +- explorer/testdata/trace/context_all.carbon | 2 +- explorer/testdata/trace/context_main.carbon | 72 +++---- explorer/testdata/trace/phase_all.carbon | 186 ++++++++---------- .../testdata/trace/phase_declarations.carbon | 7 +- .../testdata/trace/phase_execution.carbon | 59 +++--- .../trace/phase_name_resolution.carbon | 8 +- .../trace/phase_source_program.carbon | 7 +- .../testdata/trace/phase_type_checking.carbon | 23 +-- ...phase_unformed_variables_resolution.carbon | 4 +- 17 files changed, 322 insertions(+), 300 deletions(-) diff --git a/explorer/ast/declaration.cpp b/explorer/ast/declaration.cpp index 4fb7930790f7..cf85a7a4fc34 100644 --- a/explorer/ast/declaration.cpp +++ b/explorer/ast/declaration.cpp @@ -14,105 +14,110 @@ using llvm::cast; Declaration::~Declaration() = default; -void Declaration::Print(llvm::raw_ostream& out) const { +void Declaration::Print(llvm::raw_ostream& out) const { PrintIndent(0, out); } +void Declaration::PrintIndent(int indent_num_spaces, + llvm::raw_ostream& out) const { + if (kind() != DeclarationKind::FunctionDeclaration && + kind() != DeclarationKind::DestructorDeclaration) { + out.indent(indent_num_spaces); + } + switch (kind()) { case DeclarationKind::NamespaceDeclaration: - PrintID(out); - out << ";"; + out << PrintAsID(*this) << ";"; break; case DeclarationKind::InterfaceDeclaration: case DeclarationKind::ConstraintDeclaration: { const auto& iface_decl = cast(*this); - PrintID(out); + out << PrintAsID(*this); out << " {\n"; for (Nonnull m : iface_decl.members()) { - out << *m; + out.indent(indent_num_spaces + 2) << *m << "\n"; } - out << "}\n"; + out.indent(indent_num_spaces) << "}"; break; } case DeclarationKind::ImplDeclaration: { const auto& impl_decl = cast(*this); - PrintID(out); - out << " {\n"; + out << PrintAsID(impl_decl) << " {\n"; for (Nonnull m : impl_decl.members()) { - out << *m; + m->PrintIndent(indent_num_spaces + 2, out); + out << "\n"; } - out << "}\n"; + out.indent(indent_num_spaces) << "}"; break; } case DeclarationKind::MatchFirstDeclaration: { const auto& match_first_decl = cast(*this); - PrintID(out); - out << " {\n"; + out << PrintAsID(match_first_decl) << " {\n"; for (Nonnull m : match_first_decl.impl_declarations()) { - out << *m; + m->PrintIndent(indent_num_spaces + 2, out); + out << "\n"; } - out << "}\n"; + out.indent(indent_num_spaces) << "}"; break; } case DeclarationKind::FunctionDeclaration: - cast(*this).PrintDepth(-1, out); + cast(*this).PrintIndent(indent_num_spaces, out); break; case DeclarationKind::DestructorDeclaration: - cast(*this).PrintDepth(-1, out); + cast(*this).PrintIndent(indent_num_spaces, out); break; case DeclarationKind::ClassDeclaration: { const auto& class_decl = cast(*this); - PrintID(out); + out << PrintAsID(class_decl); if (class_decl.type_params().has_value()) { out << **class_decl.type_params(); } out << " {\n"; for (Nonnull m : class_decl.members()) { - out << *m; + m->PrintIndent(indent_num_spaces + 2, out); + out << "\n"; } - out << "}\n"; + out.indent(indent_num_spaces) << "}"; break; } case DeclarationKind::MixinDeclaration: { const auto& mixin_decl = cast(*this); - PrintID(out); - out << "{\n"; + out << PrintAsID(mixin_decl) << "{\n"; for (Nonnull m : mixin_decl.members()) { - out << *m; + m->PrintIndent(indent_num_spaces + 2, out); + out << "\n"; } - out << "}\n"; + out.indent(indent_num_spaces) << "}"; break; } case DeclarationKind::MixDeclaration: { const auto& mix_decl = cast(*this); - PrintID(out); + out << PrintAsID(mix_decl); out << mix_decl.mixin() << ";"; break; } case DeclarationKind::ChoiceDeclaration: { const auto& choice = cast(*this); - PrintID(out); - out << " {\n"; + out << PrintAsID(choice) << " {\n"; for (Nonnull alt : choice.alternatives()) { - out << *alt << ";\n"; + out.indent(indent_num_spaces + 2) << *alt << ";\n"; } - out << "}\n"; + out.indent(indent_num_spaces) << "}"; break; } case DeclarationKind::VariableDeclaration: { const auto& var = cast(*this); - PrintID(out); + out << PrintAsID(var); if (var.has_initializer()) { out << " = " << var.initializer(); } - out << ";\n"; + out << ";"; break; } case DeclarationKind::InterfaceExtendDeclaration: case DeclarationKind::InterfaceRequireDeclaration: case DeclarationKind::AssociatedConstantDeclaration: { - PrintID(out); - out << ";\n"; + out << PrintAsID(*this) << ";"; break; } @@ -123,14 +128,12 @@ void Declaration::Print(llvm::raw_ostream& out) const { case DeclarationKind::AliasDeclaration: { const auto& alias = cast(*this); - PrintID(out); - out << " = " << alias.target() << ";\n"; + out << PrintAsID(alias) << " = " << alias.target() << ";"; break; } case DeclarationKind::ExtendBaseDeclaration: { - PrintID(out); - out << ";\n"; + out << PrintAsID(*this) << ";"; break; } } @@ -406,10 +409,11 @@ auto FunctionDeclaration::Create(Nonnull arena, virt_override); } -void CallableDeclaration::PrintDepth(int depth, llvm::raw_ostream& out) const { +void CallableDeclaration::PrintIndent(int indent_num_spaces, + llvm::raw_ostream& out) const { auto name = GetName(*this); CARBON_CHECK(name) << "Unexpected missing name for `" << *this << "`."; - out << "fn " << *name << " "; + out.indent(indent_num_spaces) << "fn " << *name << " "; if (!deduced_parameters_.empty()) { out << "["; llvm::ListSeparator sep; @@ -418,13 +422,15 @@ void CallableDeclaration::PrintDepth(int depth, llvm::raw_ostream& out) const { } out << "]"; } - out << *param_pattern_ << return_term_; + out << *param_pattern_; + if (!return_term_.is_omitted()) { + out << " " << return_term_; + } if (body_) { - out << " {\n"; - (*body_)->PrintDepth(depth, out); - out << "\n}\n"; + out << "\n"; + (*body_)->PrintIndent(indent_num_spaces, out); } else { - out << ";\n"; + out << ";"; } } diff --git a/explorer/ast/declaration.h b/explorer/ast/declaration.h index 26d6d32866e1..d149220f43b8 100644 --- a/explorer/ast/declaration.h +++ b/explorer/ast/declaration.h @@ -50,6 +50,8 @@ class Declaration : public AstNode { void Print(llvm::raw_ostream& out) const override; void PrintID(llvm::raw_ostream& out) const override; + virtual void PrintIndent(int indent_num_spaces, llvm::raw_ostream& out) const; + static auto classof(const AstNode* node) -> bool { return InheritsFromDeclaration(node->kind()); } @@ -238,8 +240,8 @@ class CallableDeclaration : public Declaration { body_(context.Clone(other.body_)), virt_override_(other.virt_override_) {} - void PrintDepth(int depth, llvm::raw_ostream& out) const; - + void PrintIndent(int indent_num_spaces, + llvm::raw_ostream& out) const override; auto deduced_parameters() const -> llvm::ArrayRef> { return deduced_parameters_; diff --git a/explorer/ast/expression.cpp b/explorer/ast/expression.cpp index 0342bb483a67..7b216e4a671b 100644 --- a/explorer/ast/expression.cpp +++ b/explorer/ast/expression.cpp @@ -343,12 +343,12 @@ void Expression::PrintID(llvm::raw_ostream& out) const { case ExpressionKind::TypeTypeLiteral: out << "type"; break; - case ExpressionKind::FunctionTypeLiteral: - case ExpressionKind::StructLiteral: - case ExpressionKind::ArrayTypeLiteral: case ExpressionKind::ValueLiteral: out << cast(*this).constant_value(); break; + case ExpressionKind::ArrayTypeLiteral: + case ExpressionKind::FunctionTypeLiteral: + case ExpressionKind::StructLiteral: case ExpressionKind::IndexExpression: case ExpressionKind::SimpleMemberAccessExpression: case ExpressionKind::CompoundMemberAccessExpression: diff --git a/explorer/ast/statement.cpp b/explorer/ast/statement.cpp index 830af0a20ead..48bbb32be903 100644 --- a/explorer/ast/statement.cpp +++ b/explorer/ast/statement.cpp @@ -15,39 +15,102 @@ using llvm::cast; Statement::~Statement() = default; -void Statement::PrintDepth(int depth, llvm::raw_ostream& out) const { - if (depth == 0) { - out << " ... "; - return; +void Statement::PrintID(llvm::raw_ostream& out) const { + switch (kind()) { + case StatementKind::Match: + out << "match (...) { ... }"; + break; + case StatementKind::While: + out << "while (...) { ... }"; + break; + case StatementKind::For: + out << "for (...) { ... }"; + break; + case StatementKind::Break: + out << "break;"; + break; + case StatementKind::Continue: + out << "continue;"; + break; + case StatementKind::VariableDefinition: { + const auto& var = cast(*this); + if (var.is_returned()) { + out << "returned "; + } + out << "var ..."; + if (var.has_init()) { + out << " = ..."; + } + out << ";"; + break; + } + case StatementKind::ExpressionStatement: + out << ";"; + break; + case StatementKind::Assign: { + const auto& assign = cast(*this); + out << "... " << AssignOperatorToString(assign.op()) << " ...;"; + break; + } + case StatementKind::IncrementDecrement: { + const auto& inc_dec = cast(*this); + out << (inc_dec.is_increment() ? "++" : "--") << "...;"; + break; + } + case StatementKind::If: { + const auto& if_stmt = cast(*this); + out << "if (...) { ... }"; + if (if_stmt.else_block()) { + out << " else { ... }"; + } + break; + } + case StatementKind::ReturnVar: + out << "return var;"; + break; + case StatementKind::ReturnExpression: { + const auto& ret = cast(*this); + if (ret.is_omitted_expression()) { + out << "return;"; + } else { + out << "return ...;"; + } + break; + } + case StatementKind::Block: + out << "{ ... }"; + break; } +} + +void Statement::PrintIndent(int indent_num_spaces, + llvm::raw_ostream& out) const { + out.indent(indent_num_spaces); + switch (kind()) { case StatementKind::Match: { const auto& match = cast(*this); - out << "match (" << match.expression() << ") {"; - if (depth < 0 || depth > 1) { + out << "match (" << match.expression() << ") {\n"; + for (const auto& clause : match.clauses()) { + out.indent(indent_num_spaces + 2) + << "case " << clause.pattern() << " =>\n"; + clause.statement().PrintIndent(indent_num_spaces + 2, out); out << "\n"; - for (const auto& clause : match.clauses()) { - out << "case " << clause.pattern() << " =>\n"; - clause.statement().PrintDepth(depth - 1, out); - out << "\n"; - } - } else { - out << "..."; } - out << "}"; + out.indent(indent_num_spaces) << "}"; break; } case StatementKind::While: { const auto& while_stmt = cast(*this); out << "while (" << while_stmt.condition() << ")\n"; - while_stmt.body().PrintDepth(depth - 1, out); + while_stmt.body().PrintIndent(indent_num_spaces, out); break; } case StatementKind::For: { const auto& for_stmt = cast(*this); out << "for (" << for_stmt.variable_declaration() << " in " << for_stmt.loop_target() << ")\n"; - for_stmt.body().PrintDepth(depth - 1, out); + for_stmt.body().PrintIndent(indent_num_spaces, out); break; } case StatementKind::Break: @@ -79,16 +142,18 @@ void Statement::PrintDepth(int depth, llvm::raw_ostream& out) const { } case StatementKind::IncrementDecrement: { const auto& inc_dec = cast(*this); - out << (inc_dec.is_increment() ? "++" : "--") << inc_dec.argument(); + out << (inc_dec.is_increment() ? "++" : "--") << inc_dec.argument() + << ";"; break; } case StatementKind::If: { const auto& if_stmt = cast(*this); out << "if (" << if_stmt.condition() << ")\n"; - if_stmt.then_block().PrintDepth(depth - 1, out); + if_stmt.then_block().PrintIndent(indent_num_spaces, out); if (if_stmt.else_block()) { - out << "\nelse\n"; - (*if_stmt.else_block())->PrintDepth(depth - 1, out); + out << "\n"; + out.indent(indent_num_spaces) << "else\n"; + (*if_stmt.else_block())->PrintIndent(indent_num_spaces, out); } break; } @@ -107,20 +172,13 @@ void Statement::PrintDepth(int depth, llvm::raw_ostream& out) const { } case StatementKind::Block: { const auto& block = cast(*this); - out << "{"; - if (depth < 0 || depth > 1) { - out << "\n"; - } - for (const auto* statement : block.statements()) { - statement->PrintDepth(depth, out); - if (depth < 0 || depth > 1) { - out << "\n"; - } - } - out << "}"; - if (depth < 0 || depth > 1) { + const auto statements = block.statements(); + out << "{\n"; + for (const auto* statement : statements) { + statement->PrintIndent(indent_num_spaces + 2, out); out << "\n"; } + out.indent(indent_num_spaces) << "}"; break; } } diff --git a/explorer/ast/statement.h b/explorer/ast/statement.h index a157797f2eba..2b7782ab3d26 100644 --- a/explorer/ast/statement.h +++ b/explorer/ast/statement.h @@ -29,9 +29,10 @@ class Statement : public AstNode { public: ~Statement() override = 0; - void Print(llvm::raw_ostream& out) const override { PrintDepth(-1, out); } - void PrintID(llvm::raw_ostream& out) const override { PrintDepth(1, out); } - void PrintDepth(int depth, llvm::raw_ostream& out) const; + void Print(llvm::raw_ostream& out) const override { PrintIndent(0, out); } + void PrintID(llvm::raw_ostream& out) const override; + + void PrintIndent(int indent_num_spaces, llvm::raw_ostream& out) const; static auto classof(const AstNode* node) { return InheritsFromStatement(node->kind()); diff --git a/explorer/interpreter/exec_program.cpp b/explorer/interpreter/exec_program.cpp index 21bf90fef77a..3455b8b3af09 100644 --- a/explorer/interpreter/exec_program.cpp +++ b/explorer/interpreter/exec_program.cpp @@ -28,12 +28,16 @@ auto AnalyzeProgram(Nonnull arena, AST ast, if (trace_stream->is_enabled()) { trace_stream->Heading("source program"); + llvm::ListSeparator sep("\n\n"); for (auto& declaration : ast.declarations) { set_file_ctx.update_source_loc(declaration->source_loc()); if (trace_stream->is_enabled()) { - *trace_stream << *declaration; + *trace_stream << sep << *declaration; } } + if (trace_stream->is_enabled()) { + *trace_stream << "\n"; + } } SourceLocation source_loc("", 0, FileKind::Main); @@ -71,12 +75,16 @@ auto AnalyzeProgram(Nonnull arena, AST ast, set_prog_phase.update_phase(ProgramPhase::Declarations); if (trace_stream->is_enabled()) { trace_stream->Heading("printing declarations"); + llvm::ListSeparator sep("\n\n"); for (auto& declaration : ast.declarations) { set_file_ctx.update_source_loc(declaration->source_loc()); if (trace_stream->is_enabled()) { - *trace_stream << *declaration; + *trace_stream << sep << *declaration; } } + if (trace_stream->is_enabled()) { + *trace_stream << "\n"; + } } return ast; } diff --git a/explorer/interpreter/interpreter.cpp b/explorer/interpreter/interpreter.cpp index 0b1ecd5c62a8..80fc0827a237 100644 --- a/explorer/interpreter/interpreter.cpp +++ b/explorer/interpreter/interpreter.cpp @@ -2334,7 +2334,7 @@ auto Interpreter::StepDeclaration() -> ErrorOr { if (trace_stream_->is_enabled()) { trace_stream_->Source() << "declaration at (" << decl.source_loc() << ")\n"; - *trace_stream_ << "```\n" << decl << "```\n"; + *trace_stream_ << "```\n" << decl << "\n```\n"; } switch (decl.kind()) { diff --git a/explorer/testdata/class/fail_circular_inheritance.carbon b/explorer/testdata/class/fail_circular_inheritance.carbon index 91ca3a7a3aaf..70c89edd1eac 100644 --- a/explorer/testdata/class/fail_circular_inheritance.carbon +++ b/explorer/testdata/class/fail_circular_inheritance.carbon @@ -7,10 +7,9 @@ package ExplorerTest api; class C { - // CHECK:STDERR: COMPILATION ERROR: fail_circular_inheritance.carbon:[[@LINE+4]]: could not find `class C { - // CHECK:STDERR: extend base: C; - // CHECK:STDERR: } - // CHECK:STDERR: ` + // CHECK:STDERR: COMPILATION ERROR: fail_circular_inheritance.carbon:[[@LINE+3]]: could not find `class C { + // CHECK:STDERR: extend base: C; + // CHECK:STDERR: }` extend base: C; } diff --git a/explorer/testdata/trace/context_all.carbon b/explorer/testdata/trace/context_all.carbon index 0a929243d02b..262bdfc650c8 100644 --- a/explorer/testdata/trace/context_all.carbon +++ b/explorer/testdata/trace/context_all.carbon @@ -18,5 +18,5 @@ fn Main() -> i32 { // CHECK:STDOUT: ->> declaring `interface As` (prelude.carbon:14) // CHECK:STDOUT: ->> declaring function `Main` (context_all.carbon:11) // CHECK:STDOUT: interface As { -// CHECK:STDOUT: fn Main ()-> i32 { +// CHECK:STDOUT: fn Main () -> i32 // CHECK:STDOUT: ->> step ExpressionAction pos: 0 `Main()` (:0) ---> diff --git a/explorer/testdata/trace/context_main.carbon b/explorer/testdata/trace/context_main.carbon index 34f44a50029f..8cee4611f0f7 100644 --- a/explorer/testdata/trace/context_main.carbon +++ b/explorer/testdata/trace/context_main.carbon @@ -19,11 +19,10 @@ fn Main() -> i32 { // CHECK:STDOUT: -------------------------------------------------------- // CHECK:STDOUT: interface TestInterface { // CHECK:STDOUT: } -// CHECK:STDOUT: fn Main ()-> i32 { -// CHECK:STDOUT: { -// CHECK:STDOUT: return 0; -// CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn Main () -> i32 +// CHECK:STDOUT: { +// CHECK:STDOUT: return 0; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: @@ -39,10 +38,10 @@ fn Main() -> i32 { // CHECK:STDOUT: ->> resolving decl `fn Main` (context_main.carbon:11) // CHECK:STDOUT: ==> marked `Main` declared but not usable in `package` // CHECK:STDOUT: ==> marked `Main` usable in `package` -// CHECK:STDOUT: ->> resolving stmt `{return 0;}` (context_main.carbon:11) -// CHECK:STDOUT: ->> resolving stmt `return 0;` (context_main.carbon:10) -// CHECK:STDOUT: <<- finished resolving stmt `return 0;` (context_main.carbon:10) -// CHECK:STDOUT: <<- finished resolving stmt `{return 0;}` (context_main.carbon:11) +// CHECK:STDOUT: ->> resolving stmt `{ ... }` (context_main.carbon:11) +// CHECK:STDOUT: ->> resolving stmt `return ...;` (context_main.carbon:10) +// CHECK:STDOUT: <<- finished resolving stmt `return ...;` (context_main.carbon:10) +// CHECK:STDOUT: <<- finished resolving stmt `{ ... }` (context_main.carbon:11) // CHECK:STDOUT: <<- finished resolving decl `fn Main` (context_main.carbon:11) // CHECK:STDOUT: ==> resolved `Main` as `fn Main` in `package` (:0) // CHECK:STDOUT: @@ -59,7 +58,6 @@ fn Main() -> i32 { // CHECK:STDOUT: ``` // CHECK:STDOUT: interface TestInterface { // CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ``` // CHECK:STDOUT: ->> declaring `interface TestInterface` (context_main.carbon:7) // CHECK:STDOUT: <<- finished declaring `interface TestInterface` (context_main.carbon:7) @@ -68,7 +66,6 @@ fn Main() -> i32 { // CHECK:STDOUT: ``` // CHECK:STDOUT: interface TestInterface { // CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ``` // CHECK:STDOUT: ->> checking InterfaceDeclaration `interface TestInterface` (context_main.carbon:7) // CHECK:STDOUT: ->> checking `interface TestInterface` (context_main.carbon:7) @@ -125,13 +122,10 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: *** declaration at (context_main.carbon:11) // CHECK:STDOUT: ``` -// CHECK:STDOUT: fn Main ()-> i32 { +// CHECK:STDOUT: fn Main () -> i32 // CHECK:STDOUT: { -// CHECK:STDOUT: return 0; +// CHECK:STDOUT: return 0; // CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ``` // CHECK:STDOUT: ->> declaring function `Main` (context_main.carbon:11) // CHECK:STDOUT: ->> checking TuplePattern `()` (context_main.carbon:9) @@ -147,13 +141,10 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: *** type checking declaration at (context_main.carbon:11) // CHECK:STDOUT: ``` -// CHECK:STDOUT: fn Main ()-> i32 { +// CHECK:STDOUT: fn Main () -> i32 // CHECK:STDOUT: { -// CHECK:STDOUT: return 0; +// CHECK:STDOUT: return 0; // CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ``` // CHECK:STDOUT: ->> checking FunctionDeclaration `fn Main` (context_main.carbon:11) // CHECK:STDOUT: ->> checking function `Main` (context_main.carbon:11) @@ -210,17 +201,16 @@ fn Main() -> i32 { // CHECK:STDOUT: *** type checking stmt at (context_main.carbon:11) // CHECK:STDOUT: ``` // CHECK:STDOUT: { -// CHECK:STDOUT: return 0; +// CHECK:STDOUT: return 0; // CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ``` -// CHECK:STDOUT: ->> checking Block `{return 0;}` (context_main.carbon:11) +// CHECK:STDOUT: ->> checking Block `{ ... }` (context_main.carbon:11) // CHECK:STDOUT: // CHECK:STDOUT: *** type checking stmt at (context_main.carbon:10) // CHECK:STDOUT: ``` // CHECK:STDOUT: return 0; // CHECK:STDOUT: ``` -// CHECK:STDOUT: ->> checking ReturnExpression `return 0;` (context_main.carbon:10) +// CHECK:STDOUT: ->> checking ReturnExpression `return ...;` (context_main.carbon:10) // CHECK:STDOUT: ->> checking IntLiteral `0` (context_main.carbon:10) // CHECK:STDOUT: ->> finished checking function `Main` (context_main.carbon:11) // CHECK:STDOUT: ->> checking CallExpression `Main()` (:0) @@ -235,19 +225,18 @@ fn Main() -> i32 { // CHECK:STDOUT: ---------------------------------------------------------------------- // CHECK:STDOUT: ->> resolving-unformed in decl `interface TestInterface` (context_main.carbon:7) // CHECK:STDOUT: ->> resolving-unformed in decl `fn Main` (context_main.carbon:11) -// CHECK:STDOUT: ->> resolving-unformed in stmt `{return 0;}` (context_main.carbon:11) -// CHECK:STDOUT: ->> resolving-unformed in stmt `return 0;` (context_main.carbon:10) +// CHECK:STDOUT: ->> resolving-unformed in stmt `{ ... }` (context_main.carbon:11) +// CHECK:STDOUT: ->> resolving-unformed in stmt `return ...;` (context_main.carbon:10) // CHECK:STDOUT: // CHECK:STDOUT: // CHECK:STDOUT: * * * * * * * * * * printing declarations * * * * * * * * * * // CHECK:STDOUT: --------------------------------------------------------------- // CHECK:STDOUT: interface TestInterface { // CHECK:STDOUT: } -// CHECK:STDOUT: fn Main ()-> i32 { -// CHECK:STDOUT: { -// CHECK:STDOUT: return 0; -// CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn Main () -> i32 +// CHECK:STDOUT: { +// CHECK:STDOUT: return 0; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: @@ -270,11 +259,9 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: *** declaration at (context_main.carbon:11) // CHECK:STDOUT: ``` -// CHECK:STDOUT: fn Main ()-> i32 { +// CHECK:STDOUT: fn Main () -> i32 // CHECK:STDOUT: { -// CHECK:STDOUT: return 0; -// CHECK:STDOUT: } -// CHECK:STDOUT: +// CHECK:STDOUT: return 0; // CHECK:STDOUT: } // CHECK:STDOUT: ``` // CHECK:STDOUT: <[] stack-pop: DeclarationAction pos: 0 `fn Main` (context_main.carbon:11) @@ -297,18 +284,17 @@ fn Main() -> i32 { // CHECK:STDOUT: === match pattern `()` // CHECK:STDOUT: from value expression with value `()` // CHECK:STDOUT: >[] stack-push: ScopeAction pos: 0 scope: [] (None) -// CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `{return 0;}` (context_main.carbon:11) -// CHECK:STDOUT: ->> step StatementAction pos: 0 `{return 0;}` (context_main.carbon:11) ---> +// CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `{ ... }` (context_main.carbon:11) +// CHECK:STDOUT: ->> step StatementAction pos: 0 `{ ... }` (context_main.carbon:11) ---> // CHECK:STDOUT: // CHECK:STDOUT: *** statement at (context_main.carbon:11) // CHECK:STDOUT: ``` // CHECK:STDOUT: { -// CHECK:STDOUT: return 0; +// CHECK:STDOUT: return 0; // CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ``` -// CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `return 0;` (context_main.carbon:10) -// CHECK:STDOUT: ->> step StatementAction pos: 0 `return 0;` (context_main.carbon:10) ---> +// CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `return ...;` (context_main.carbon:10) +// CHECK:STDOUT: ->> step StatementAction pos: 0 `return ...;` (context_main.carbon:10) ---> // CHECK:STDOUT: // CHECK:STDOUT: *** statement at (context_main.carbon:10) // CHECK:STDOUT: ``` @@ -321,14 +307,14 @@ fn Main() -> i32 { // CHECK:STDOUT: <[] stack-pop: ExpressionAction pos: 0 `0` (context_main.carbon:10) // CHECK:STDOUT: ->> step ValueExpressionAction pos: 1 `0` results: [`0`] (context_main.carbon:10) ---> // CHECK:STDOUT: <[] stack-pop: ValueExpressionAction pos: 1 `0` results: [`0`] (context_main.carbon:10) -// CHECK:STDOUT: ->> step StatementAction pos: 1 `return 0;` results: [`0`] (context_main.carbon:10) ---> +// CHECK:STDOUT: ->> step StatementAction pos: 1 `return ...;` results: [`0`] (context_main.carbon:10) ---> // CHECK:STDOUT: // CHECK:STDOUT: *** statement at (context_main.carbon:10) // CHECK:STDOUT: ``` // CHECK:STDOUT: return 0; // CHECK:STDOUT: ``` -// CHECK:STDOUT: <[] stack-pop: StatementAction pos: 1 `return 0;` results: [`0`] (context_main.carbon:10) -// CHECK:STDOUT: <[] stack-pop: StatementAction pos: 1 `{return 0;}` scope: [] (context_main.carbon:11) +// CHECK:STDOUT: <[] stack-pop: StatementAction pos: 1 `return ...;` results: [`0`] (context_main.carbon:10) +// CHECK:STDOUT: <[] stack-pop: StatementAction pos: 1 `{ ... }` scope: [] (context_main.carbon:11) // CHECK:STDOUT: <[] stack-pop: ScopeAction pos: 0 scope: [] (None) // CHECK:STDOUT: >[] stack-push: CleanUpAction pos: 0 scope: [] (stack cleanup:1) // CHECK:STDOUT: >[] stack-push: CleanUpAction pos: 0 scope: [] (stack cleanup:1) diff --git a/explorer/testdata/trace/phase_all.carbon b/explorer/testdata/trace/phase_all.carbon index e60d6f0b764c..624594d1c943 100644 --- a/explorer/testdata/trace/phase_all.carbon +++ b/explorer/testdata/trace/phase_all.carbon @@ -26,18 +26,18 @@ fn Main() -> i32 { // CHECK:STDOUT: -------------------------------------------------------- // CHECK:STDOUT: interface TestInterface { // CHECK:STDOUT: } -// CHECK:STDOUT: namespace N;fn Foo (n: i32)-> i32 { +// CHECK:STDOUT: +// CHECK:STDOUT: namespace N; +// CHECK:STDOUT: +// CHECK:STDOUT: fn Foo (n: i32) -> i32 // CHECK:STDOUT: { -// CHECK:STDOUT: return (n + 1); +// CHECK:STDOUT: return (n + 1); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: } -// CHECK:STDOUT: fn Main ()-> i32 { +// CHECK:STDOUT: fn Main () -> i32 // CHECK:STDOUT: { -// CHECK:STDOUT: var x: i32 = N.Foo(0); -// CHECK:STDOUT: return x; -// CHECK:STDOUT: } -// CHECK:STDOUT: +// CHECK:STDOUT: var x: i32 = N.Foo(0); +// CHECK:STDOUT: return x; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: @@ -61,25 +61,25 @@ fn Main() -> i32 { // CHECK:STDOUT: ==> marked `Foo` declared but not usable in `namespace N` // CHECK:STDOUT: ==> declared `n` as `n` in `fn N.Foo` (phase_all.carbon:11) // CHECK:STDOUT: ==> marked `Foo` usable in `namespace N` -// CHECK:STDOUT: ->> resolving stmt `{return (n + 1);}` (phase_all.carbon:13) -// CHECK:STDOUT: ->> resolving stmt `return (n + 1);` (phase_all.carbon:12) +// CHECK:STDOUT: ->> resolving stmt `{ ... }` (phase_all.carbon:13) +// CHECK:STDOUT: ->> resolving stmt `return ...;` (phase_all.carbon:12) // CHECK:STDOUT: ==> resolved `n` as `n` in `fn N.Foo` (phase_all.carbon:12) -// CHECK:STDOUT: <<- finished resolving stmt `return (n + 1);` (phase_all.carbon:12) -// CHECK:STDOUT: <<- finished resolving stmt `{return (n + 1);}` (phase_all.carbon:13) +// CHECK:STDOUT: <<- finished resolving stmt `return ...;` (phase_all.carbon:12) +// CHECK:STDOUT: <<- finished resolving stmt `{ ... }` (phase_all.carbon:13) // CHECK:STDOUT: <<- finished resolving decl `fn N.Foo` (phase_all.carbon:13) // CHECK:STDOUT: ->> resolving decl `fn Main` (phase_all.carbon:18) // CHECK:STDOUT: ==> marked `Main` declared but not usable in `package` // CHECK:STDOUT: ==> marked `Main` usable in `package` -// CHECK:STDOUT: ->> resolving stmt `{var x: i32 = N.Foo(0);return x;}` (phase_all.carbon:18) -// CHECK:STDOUT: ->> resolving stmt `var x: i32 = N.Foo(0);` (phase_all.carbon:16) +// CHECK:STDOUT: ->> resolving stmt `{ ... }` (phase_all.carbon:18) +// CHECK:STDOUT: ->> resolving stmt `var ... = ...;` (phase_all.carbon:16) // CHECK:STDOUT: ==> resolved `N` as `namespace N` in `package` (phase_all.carbon:16) // CHECK:STDOUT: ==> resolved `Foo` as `fn N.Foo` in `namespace N` (phase_all.carbon:16) -// CHECK:STDOUT: ==> declared `x` as `x` in `{var x: i32 = N.Foo(0);return x;}` (phase_all.carbon:16) -// CHECK:STDOUT: <<- finished resolving stmt `var x: i32 = N.Foo(0);` (phase_all.carbon:16) -// CHECK:STDOUT: ->> resolving stmt `return x;` (phase_all.carbon:17) -// CHECK:STDOUT: ==> resolved `x` as `x` in `{var x: i32 = N.Foo(0);return x;}` (phase_all.carbon:17) -// CHECK:STDOUT: <<- finished resolving stmt `return x;` (phase_all.carbon:17) -// CHECK:STDOUT: <<- finished resolving stmt `{var x: i32 = N.Foo(0);return x;}` (phase_all.carbon:18) +// CHECK:STDOUT: ==> declared `x` as `x` in `{ ... }` (phase_all.carbon:16) +// CHECK:STDOUT: <<- finished resolving stmt `var ... = ...;` (phase_all.carbon:16) +// CHECK:STDOUT: ->> resolving stmt `return ...;` (phase_all.carbon:17) +// CHECK:STDOUT: ==> resolved `x` as `x` in `{ ... }` (phase_all.carbon:17) +// CHECK:STDOUT: <<- finished resolving stmt `return ...;` (phase_all.carbon:17) +// CHECK:STDOUT: <<- finished resolving stmt `{ ... }` (phase_all.carbon:18) // CHECK:STDOUT: <<- finished resolving decl `fn Main` (phase_all.carbon:18) // CHECK:STDOUT: ==> resolved `Main` as `fn Main` in `package` (:0) // CHECK:STDOUT: @@ -97,7 +97,6 @@ fn Main() -> i32 { // CHECK:STDOUT: ``` // CHECK:STDOUT: interface TestInterface { // CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ``` // CHECK:STDOUT: ->> declaring `interface TestInterface` (phase_all.carbon:7) // CHECK:STDOUT: <<- finished declaring `interface TestInterface` (phase_all.carbon:7) @@ -106,7 +105,6 @@ fn Main() -> i32 { // CHECK:STDOUT: ``` // CHECK:STDOUT: interface TestInterface { // CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ``` // CHECK:STDOUT: ->> checking InterfaceDeclaration `interface TestInterface` (phase_all.carbon:7) // CHECK:STDOUT: ->> checking `interface TestInterface` (phase_all.carbon:7) @@ -174,13 +172,10 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: *** declaration at (phase_all.carbon:13) // CHECK:STDOUT: ``` -// CHECK:STDOUT: fn Foo (n: i32)-> i32 { +// CHECK:STDOUT: fn Foo (n: i32) -> i32 // CHECK:STDOUT: { -// CHECK:STDOUT: return (n + 1); +// CHECK:STDOUT: return (n + 1); // CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ``` // CHECK:STDOUT: ->> declaring function `Foo` (phase_all.carbon:13) // CHECK:STDOUT: ->> checking TuplePattern `(n: i32)` (phase_all.carbon:11) @@ -207,13 +202,10 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: *** type checking declaration at (phase_all.carbon:13) // CHECK:STDOUT: ``` -// CHECK:STDOUT: fn Foo (n: i32)-> i32 { +// CHECK:STDOUT: fn Foo (n: i32) -> i32 // CHECK:STDOUT: { -// CHECK:STDOUT: return (n + 1); +// CHECK:STDOUT: return (n + 1); // CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ``` // CHECK:STDOUT: ->> checking FunctionDeclaration `fn N.Foo` (phase_all.carbon:13) // CHECK:STDOUT: ->> checking function `Foo` (phase_all.carbon:13) @@ -270,17 +262,16 @@ fn Main() -> i32 { // CHECK:STDOUT: *** type checking stmt at (phase_all.carbon:13) // CHECK:STDOUT: ``` // CHECK:STDOUT: { -// CHECK:STDOUT: return (n + 1); +// CHECK:STDOUT: return (n + 1); // CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ``` -// CHECK:STDOUT: ->> checking Block `{return (n + 1);}` (phase_all.carbon:13) +// CHECK:STDOUT: ->> checking Block `{ ... }` (phase_all.carbon:13) // CHECK:STDOUT: // CHECK:STDOUT: *** type checking stmt at (phase_all.carbon:12) // CHECK:STDOUT: ``` // CHECK:STDOUT: return (n + 1); // CHECK:STDOUT: ``` -// CHECK:STDOUT: ->> checking ReturnExpression `return (n + 1);` (phase_all.carbon:12) +// CHECK:STDOUT: ->> checking ReturnExpression `return ...;` (phase_all.carbon:12) // CHECK:STDOUT: ->> checking OperatorExpression `(n + 1)` (phase_all.carbon:12) // CHECK:STDOUT: ->> checking IdentifierExpression `n` (phase_all.carbon:12) // CHECK:STDOUT: ->> checking IntLiteral `1` (phase_all.carbon:12) @@ -288,14 +279,11 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: *** declaration at (phase_all.carbon:18) // CHECK:STDOUT: ``` -// CHECK:STDOUT: fn Main ()-> i32 { +// CHECK:STDOUT: fn Main () -> i32 // CHECK:STDOUT: { -// CHECK:STDOUT: var x: i32 = N.Foo(0); -// CHECK:STDOUT: return x; +// CHECK:STDOUT: var x: i32 = N.Foo(0); +// CHECK:STDOUT: return x; // CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ``` // CHECK:STDOUT: ->> declaring function `Main` (phase_all.carbon:18) // CHECK:STDOUT: ->> checking TuplePattern `()` (phase_all.carbon:15) @@ -311,14 +299,11 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: *** type checking declaration at (phase_all.carbon:18) // CHECK:STDOUT: ``` -// CHECK:STDOUT: fn Main ()-> i32 { +// CHECK:STDOUT: fn Main () -> i32 // CHECK:STDOUT: { -// CHECK:STDOUT: var x: i32 = N.Foo(0); -// CHECK:STDOUT: return x; +// CHECK:STDOUT: var x: i32 = N.Foo(0); +// CHECK:STDOUT: return x; // CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ``` // CHECK:STDOUT: ->> checking FunctionDeclaration `fn Main` (phase_all.carbon:18) // CHECK:STDOUT: ->> checking function `Main` (phase_all.carbon:18) @@ -375,18 +360,17 @@ fn Main() -> i32 { // CHECK:STDOUT: *** type checking stmt at (phase_all.carbon:18) // CHECK:STDOUT: ``` // CHECK:STDOUT: { -// CHECK:STDOUT: var x: i32 = N.Foo(0); -// CHECK:STDOUT: return x; +// CHECK:STDOUT: var x: i32 = N.Foo(0); +// CHECK:STDOUT: return x; // CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ``` -// CHECK:STDOUT: ->> checking Block `{var x: i32 = N.Foo(0);return x;}` (phase_all.carbon:18) +// CHECK:STDOUT: ->> checking Block `{ ... }` (phase_all.carbon:18) // CHECK:STDOUT: // CHECK:STDOUT: *** type checking stmt at (phase_all.carbon:16) // CHECK:STDOUT: ``` // CHECK:STDOUT: var x: i32 = N.Foo(0); // CHECK:STDOUT: ``` -// CHECK:STDOUT: ->> checking VariableDefinition `var x: i32 = N.Foo(0);` (phase_all.carbon:16) +// CHECK:STDOUT: ->> checking VariableDefinition `var ... = ...;` (phase_all.carbon:16) // CHECK:STDOUT: ->> checking CallExpression `N.Foo(0)` (phase_all.carbon:16) // CHECK:STDOUT: ->> checking SimpleMemberAccessExpression `N.Foo` (phase_all.carbon:16) // CHECK:STDOUT: ->> checking IdentifierExpression `Foo` (phase_all.carbon:16) @@ -411,7 +395,7 @@ fn Main() -> i32 { // CHECK:STDOUT: ``` // CHECK:STDOUT: return x; // CHECK:STDOUT: ``` -// CHECK:STDOUT: ->> checking ReturnExpression `return x;` (phase_all.carbon:17) +// CHECK:STDOUT: ->> checking ReturnExpression `return ...;` (phase_all.carbon:17) // CHECK:STDOUT: ->> checking IdentifierExpression `x` (phase_all.carbon:17) // CHECK:STDOUT: ->> finished checking function `Main` (phase_all.carbon:18) // CHECK:STDOUT: ->> checking CallExpression `Main()` (:0) @@ -427,14 +411,14 @@ fn Main() -> i32 { // CHECK:STDOUT: ->> resolving-unformed in decl `interface TestInterface` (phase_all.carbon:7) // CHECK:STDOUT: ->> resolving-unformed in decl `namespace N` (phase_all.carbon:9) // CHECK:STDOUT: ->> resolving-unformed in decl `fn N.Foo` (phase_all.carbon:13) -// CHECK:STDOUT: ->> resolving-unformed in stmt `{return (n + 1);}` (phase_all.carbon:13) -// CHECK:STDOUT: ->> resolving-unformed in stmt `return (n + 1);` (phase_all.carbon:12) +// CHECK:STDOUT: ->> resolving-unformed in stmt `{ ... }` (phase_all.carbon:13) +// CHECK:STDOUT: ->> resolving-unformed in stmt `return ...;` (phase_all.carbon:12) // CHECK:STDOUT: ==> check `n` (phase_all.carbon:12) // CHECK:STDOUT: ->> resolving-unformed in decl `fn Main` (phase_all.carbon:18) -// CHECK:STDOUT: ->> resolving-unformed in stmt `{var x: i32 = N.Foo(0);return x;}` (phase_all.carbon:18) -// CHECK:STDOUT: ->> resolving-unformed in stmt `var x: i32 = N.Foo(0);` (phase_all.carbon:16) +// CHECK:STDOUT: ->> resolving-unformed in stmt `{ ... }` (phase_all.carbon:18) +// CHECK:STDOUT: ->> resolving-unformed in stmt `var ... = ...;` (phase_all.carbon:16) // CHECK:STDOUT: ==> add init `x` (phase_all.carbon:16) -// CHECK:STDOUT: ->> resolving-unformed in stmt `return x;` (phase_all.carbon:17) +// CHECK:STDOUT: ->> resolving-unformed in stmt `return ...;` (phase_all.carbon:17) // CHECK:STDOUT: ==> check `x` (phase_all.carbon:17) // CHECK:STDOUT: // CHECK:STDOUT: @@ -442,18 +426,18 @@ fn Main() -> i32 { // CHECK:STDOUT: --------------------------------------------------------------- // CHECK:STDOUT: interface TestInterface { // CHECK:STDOUT: } -// CHECK:STDOUT: namespace N;fn Foo (n: i32)-> i32 { +// CHECK:STDOUT: +// CHECK:STDOUT: namespace N; +// CHECK:STDOUT: +// CHECK:STDOUT: fn Foo (n: i32) -> i32 // CHECK:STDOUT: { -// CHECK:STDOUT: return (n + 1); +// CHECK:STDOUT: return (n + 1); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: } -// CHECK:STDOUT: fn Main ()-> i32 { +// CHECK:STDOUT: fn Main () -> i32 // CHECK:STDOUT: { -// CHECK:STDOUT: var x: i32 = N.Foo(0); -// CHECK:STDOUT: return x; -// CHECK:STDOUT: } -// CHECK:STDOUT: +// CHECK:STDOUT: var x: i32 = N.Foo(0); +// CHECK:STDOUT: return x; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: @@ -476,18 +460,17 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: *** declaration at (phase_all.carbon:9) // CHECK:STDOUT: ``` -// CHECK:STDOUT: namespace N;``` +// CHECK:STDOUT: namespace N; +// CHECK:STDOUT: ``` // CHECK:STDOUT: <[] stack-pop: DeclarationAction pos: 0 `namespace N` (phase_all.carbon:9) // CHECK:STDOUT: >[] stack-push: DeclarationAction pos: 0 `fn N.Foo` (phase_all.carbon:13) // CHECK:STDOUT: ->> step DeclarationAction pos: 0 `fn N.Foo` (phase_all.carbon:13) ---> // CHECK:STDOUT: // CHECK:STDOUT: *** declaration at (phase_all.carbon:13) // CHECK:STDOUT: ``` -// CHECK:STDOUT: fn Foo (n: i32)-> i32 { +// CHECK:STDOUT: fn Foo (n: i32) -> i32 // CHECK:STDOUT: { -// CHECK:STDOUT: return (n + 1); -// CHECK:STDOUT: } -// CHECK:STDOUT: +// CHECK:STDOUT: return (n + 1); // CHECK:STDOUT: } // CHECK:STDOUT: ``` // CHECK:STDOUT: <[] stack-pop: DeclarationAction pos: 0 `fn N.Foo` (phase_all.carbon:13) @@ -496,12 +479,10 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: *** declaration at (phase_all.carbon:18) // CHECK:STDOUT: ``` -// CHECK:STDOUT: fn Main ()-> i32 { +// CHECK:STDOUT: fn Main () -> i32 // CHECK:STDOUT: { -// CHECK:STDOUT: var x: i32 = N.Foo(0); -// CHECK:STDOUT: return x; -// CHECK:STDOUT: } -// CHECK:STDOUT: +// CHECK:STDOUT: var x: i32 = N.Foo(0); +// CHECK:STDOUT: return x; // CHECK:STDOUT: } // CHECK:STDOUT: ``` // CHECK:STDOUT: <[] stack-pop: DeclarationAction pos: 0 `fn Main` (phase_all.carbon:18) @@ -524,19 +505,18 @@ fn Main() -> i32 { // CHECK:STDOUT: === match pattern `()` // CHECK:STDOUT: from value expression with value `()` // CHECK:STDOUT: >[] stack-push: ScopeAction pos: 0 scope: [] (None) -// CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `{var x: i32 = N.Foo(0);return x;}` (phase_all.carbon:18) -// CHECK:STDOUT: ->> step StatementAction pos: 0 `{var x: i32 = N.Foo(0);return x;}` (phase_all.carbon:18) ---> +// CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `{ ... }` (phase_all.carbon:18) +// CHECK:STDOUT: ->> step StatementAction pos: 0 `{ ... }` (phase_all.carbon:18) ---> // CHECK:STDOUT: // CHECK:STDOUT: *** statement at (phase_all.carbon:18) // CHECK:STDOUT: ``` // CHECK:STDOUT: { -// CHECK:STDOUT: var x: i32 = N.Foo(0); -// CHECK:STDOUT: return x; +// CHECK:STDOUT: var x: i32 = N.Foo(0); +// CHECK:STDOUT: return x; // CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ``` -// CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `var x: i32 = N.Foo(0);` (phase_all.carbon:16) -// CHECK:STDOUT: ->> step StatementAction pos: 0 `var x: i32 = N.Foo(0);` (phase_all.carbon:16) ---> +// CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `var ... = ...;` (phase_all.carbon:16) +// CHECK:STDOUT: ->> step StatementAction pos: 0 `var ... = ...;` (phase_all.carbon:16) ---> // CHECK:STDOUT: // CHECK:STDOUT: *** statement at (phase_all.carbon:16) // CHECK:STDOUT: ``` @@ -566,18 +546,17 @@ fn Main() -> i32 { // CHECK:STDOUT: === match pattern `Placeholder` // CHECK:STDOUT: from value expression with value `0` // CHECK:STDOUT: >[] stack-push: ScopeAction pos: 0 scope: [`n: i32`: `0`] (None) -// CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `{return (n + 1);}` (phase_all.carbon:13) -// CHECK:STDOUT: ->> step StatementAction pos: 0 `{return (n + 1);}` (phase_all.carbon:13) ---> +// CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `{ ... }` (phase_all.carbon:13) +// CHECK:STDOUT: ->> step StatementAction pos: 0 `{ ... }` (phase_all.carbon:13) ---> // CHECK:STDOUT: // CHECK:STDOUT: *** statement at (phase_all.carbon:13) // CHECK:STDOUT: ``` // CHECK:STDOUT: { -// CHECK:STDOUT: return (n + 1); +// CHECK:STDOUT: return (n + 1); // CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ``` -// CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `return (n + 1);` (phase_all.carbon:12) -// CHECK:STDOUT: ->> step StatementAction pos: 0 `return (n + 1);` (phase_all.carbon:12) ---> +// CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `return ...;` (phase_all.carbon:12) +// CHECK:STDOUT: ->> step StatementAction pos: 0 `return ...;` (phase_all.carbon:12) ---> // CHECK:STDOUT: // CHECK:STDOUT: *** statement at (phase_all.carbon:12) // CHECK:STDOUT: ``` @@ -606,15 +585,15 @@ fn Main() -> i32 { // CHECK:STDOUT: <[] stack-pop: ExpressionAction pos: 2 `(n + 1)` results: [`0`, `1`] (phase_all.carbon:12) // CHECK:STDOUT: ->> step ValueExpressionAction pos: 1 `(n + 1)` results: [`1`] (phase_all.carbon:12) ---> // CHECK:STDOUT: <[] stack-pop: ValueExpressionAction pos: 1 `(n + 1)` results: [`1`] (phase_all.carbon:12) -// CHECK:STDOUT: ->> step StatementAction pos: 1 `return (n + 1);` results: [`1`] (phase_all.carbon:12) ---> +// CHECK:STDOUT: ->> step StatementAction pos: 1 `return ...;` results: [`1`] (phase_all.carbon:12) ---> // CHECK:STDOUT: // CHECK:STDOUT: *** statement at (phase_all.carbon:12) // CHECK:STDOUT: ``` // CHECK:STDOUT: return (n + 1); // CHECK:STDOUT: ``` // CHECK:STDOUT: --> memory-write: #1 `1` -// CHECK:STDOUT: <[] stack-pop: StatementAction pos: 1 `return (n + 1);` results: [`1`] (phase_all.carbon:12) -// CHECK:STDOUT: <[] stack-pop: StatementAction pos: 1 `{return (n + 1);}` scope: [] (phase_all.carbon:13) +// CHECK:STDOUT: <[] stack-pop: StatementAction pos: 1 `return ...;` results: [`1`] (phase_all.carbon:12) +// CHECK:STDOUT: <[] stack-pop: StatementAction pos: 1 `{ ... }` scope: [] (phase_all.carbon:13) // CHECK:STDOUT: <[] stack-pop: ScopeAction pos: 0 scope: [`n: i32`: `0`] (None) // CHECK:STDOUT: >[] stack-push: CleanUpAction pos: 0 scope: [`n: i32`: `0`] (stack cleanup:1) // CHECK:STDOUT: >[] stack-push: CleanUpAction pos: 0 scope: [] (stack cleanup:1) @@ -627,7 +606,7 @@ fn Main() -> i32 { // CHECK:STDOUT: >[] stack-push: CleanUpAction pos: 0 scope: [] (stack cleanup:1) // CHECK:STDOUT: ->> step CleanUpAction pos: 0 scope: [] (stack cleanup:1) ---> // CHECK:STDOUT: <[] stack-pop: CleanUpAction pos: 0 scope: [] (stack cleanup:1) -// CHECK:STDOUT: ->> step StatementAction pos: 1 `var x: i32 = N.Foo(0);` results: [`1`] (phase_all.carbon:16) ---> +// CHECK:STDOUT: ->> step StatementAction pos: 1 `var ... = ...;` results: [`1`] (phase_all.carbon:16) ---> // CHECK:STDOUT: // CHECK:STDOUT: *** statement at (phase_all.carbon:16) // CHECK:STDOUT: ``` @@ -636,19 +615,18 @@ fn Main() -> i32 { // CHECK:STDOUT: <-- memory-read: #1 `1` // CHECK:STDOUT: === match pattern `Placeholder` // CHECK:STDOUT: from initializing expression with value `1` -// CHECK:STDOUT: <[] stack-pop: StatementAction pos: 1 `var x: i32 = N.Foo(0);` results: [`1`] (phase_all.carbon:16) -// CHECK:STDOUT: ->> step StatementAction pos: 1 `{var x: i32 = N.Foo(0);return x;}` scope: [`x: i32`: `lval`] (phase_all.carbon:18) ---> +// CHECK:STDOUT: <[] stack-pop: StatementAction pos: 1 `var ... = ...;` results: [`1`] (phase_all.carbon:16) +// CHECK:STDOUT: ->> step StatementAction pos: 1 `{ ... }` scope: [`x: i32`: `lval`] (phase_all.carbon:18) ---> // CHECK:STDOUT: // CHECK:STDOUT: *** statement at (phase_all.carbon:18) // CHECK:STDOUT: ``` // CHECK:STDOUT: { -// CHECK:STDOUT: var x: i32 = N.Foo(0); -// CHECK:STDOUT: return x; +// CHECK:STDOUT: var x: i32 = N.Foo(0); +// CHECK:STDOUT: return x; // CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ``` -// CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `return x;` (phase_all.carbon:17) -// CHECK:STDOUT: ->> step StatementAction pos: 0 `return x;` (phase_all.carbon:17) ---> +// CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `return ...;` (phase_all.carbon:17) +// CHECK:STDOUT: ->> step StatementAction pos: 0 `return ...;` (phase_all.carbon:17) ---> // CHECK:STDOUT: // CHECK:STDOUT: *** statement at (phase_all.carbon:17) // CHECK:STDOUT: ``` @@ -662,14 +640,14 @@ fn Main() -> i32 { // CHECK:STDOUT: <[] stack-pop: ExpressionAction pos: 0 `x` (phase_all.carbon:17) // CHECK:STDOUT: ->> step ValueExpressionAction pos: 1 `x` results: [`ref_expr`] (phase_all.carbon:17) ---> // CHECK:STDOUT: <[] stack-pop: ValueExpressionAction pos: 1 `x` results: [`ref_expr`] (phase_all.carbon:17) -// CHECK:STDOUT: ->> step StatementAction pos: 1 `return x;` results: [`1`] (phase_all.carbon:17) ---> +// CHECK:STDOUT: ->> step StatementAction pos: 1 `return ...;` results: [`1`] (phase_all.carbon:17) ---> // CHECK:STDOUT: // CHECK:STDOUT: *** statement at (phase_all.carbon:17) // CHECK:STDOUT: ``` // CHECK:STDOUT: return x; // CHECK:STDOUT: ``` -// CHECK:STDOUT: <[] stack-pop: StatementAction pos: 1 `return x;` results: [`1`] (phase_all.carbon:17) -// CHECK:STDOUT: <[] stack-pop: StatementAction pos: 2 `{var x: i32 = N.Foo(0);return x;}` scope: [`x: i32`: `lval`] (phase_all.carbon:18) +// CHECK:STDOUT: <[] stack-pop: StatementAction pos: 1 `return ...;` results: [`1`] (phase_all.carbon:17) +// CHECK:STDOUT: <[] stack-pop: StatementAction pos: 2 `{ ... }` scope: [`x: i32`: `lval`] (phase_all.carbon:18) // CHECK:STDOUT: <[] stack-pop: ScopeAction pos: 0 scope: [] (None) // CHECK:STDOUT: >[] stack-push: CleanUpAction pos: 0 scope: [] (stack cleanup:1) // CHECK:STDOUT: >[] stack-push: CleanUpAction pos: 0 scope: [`x: i32`: `lval`] (stack cleanup:1) diff --git a/explorer/testdata/trace/phase_declarations.carbon b/explorer/testdata/trace/phase_declarations.carbon index fab565a352ea..6bb8103d8966 100644 --- a/explorer/testdata/trace/phase_declarations.carbon +++ b/explorer/testdata/trace/phase_declarations.carbon @@ -19,10 +19,9 @@ fn Main() -> i32 { // CHECK:STDOUT: --------------------------------------------------------------- // CHECK:STDOUT: interface TestInterface { // CHECK:STDOUT: } -// CHECK:STDOUT: fn Main ()-> i32 { -// CHECK:STDOUT: { -// CHECK:STDOUT: return 0; -// CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn Main () -> i32 +// CHECK:STDOUT: { +// CHECK:STDOUT: return 0; // CHECK:STDOUT: } // CHECK:STDOUT: result: 0 diff --git a/explorer/testdata/trace/phase_execution.carbon b/explorer/testdata/trace/phase_execution.carbon index a335b081f5ec..a135610bad18 100644 --- a/explorer/testdata/trace/phase_execution.carbon +++ b/explorer/testdata/trace/phase_execution.carbon @@ -35,12 +35,10 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: *** declaration at (phase_execution.carbon:12) // CHECK:STDOUT: ``` -// CHECK:STDOUT: fn Main ()-> i32 { +// CHECK:STDOUT: fn Main () -> i32 // CHECK:STDOUT: { -// CHECK:STDOUT: var x: T = {}.(interface ImplicitAs(T = class T).Convert)(); -// CHECK:STDOUT: return 0; -// CHECK:STDOUT: } -// CHECK:STDOUT: +// CHECK:STDOUT: var x: T = {}.(interface ImplicitAs(T = class T).Convert)(); +// CHECK:STDOUT: return 0; // CHECK:STDOUT: } // CHECK:STDOUT: ``` // CHECK:STDOUT: <[] stack-pop: DeclarationAction pos: 0 `fn Main` (phase_execution.carbon:12) @@ -63,19 +61,18 @@ fn Main() -> i32 { // CHECK:STDOUT: === match pattern `()` // CHECK:STDOUT: from value expression with value `()` // CHECK:STDOUT: >[] stack-push: ScopeAction pos: 0 scope: [] (None) -// CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `{var x: T = {}.(interface ImplicitAs(T = class T).Convert)();return 0;}` (phase_execution.carbon:12) -// CHECK:STDOUT: ->> step StatementAction pos: 0 `{var x: T = {}.(interface ImplicitAs(T = class T).Convert)();return 0;}` (phase_execution.carbon:12) ---> +// CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `{ ... }` (phase_execution.carbon:12) +// CHECK:STDOUT: ->> step StatementAction pos: 0 `{ ... }` (phase_execution.carbon:12) ---> // CHECK:STDOUT: // CHECK:STDOUT: *** statement at (phase_execution.carbon:12) // CHECK:STDOUT: ``` // CHECK:STDOUT: { -// CHECK:STDOUT: var x: T = {}.(interface ImplicitAs(T = class T).Convert)(); -// CHECK:STDOUT: return 0; +// CHECK:STDOUT: var x: T = {}.(interface ImplicitAs(T = class T).Convert)(); +// CHECK:STDOUT: return 0; // CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ``` -// CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `var x: T = {}.(interface ImplicitAs(T = class T).Convert)();` (phase_execution.carbon:10) -// CHECK:STDOUT: ->> step StatementAction pos: 0 `var x: T = {}.(interface ImplicitAs(T = class T).Convert)();` (phase_execution.carbon:10) ---> +// CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `var ... = ...;` (phase_execution.carbon:10) +// CHECK:STDOUT: ->> step StatementAction pos: 0 `var ... = ...;` (phase_execution.carbon:10) ---> // CHECK:STDOUT: // CHECK:STDOUT: *** statement at (phase_execution.carbon:10) // CHECK:STDOUT: ``` @@ -115,18 +112,17 @@ fn Main() -> i32 { // CHECK:STDOUT: === match pattern `()` // CHECK:STDOUT: from value expression with value `()` // CHECK:STDOUT: >[] stack-push: ScopeAction pos: 0 scope: [`self: Self`: `{}`] (None) -// CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `{return __intrinsic_implicit_as_convert(self, U);}` (prelude.carbon:{{\d+}}) -// CHECK:STDOUT: ->> step StatementAction pos: 0 `{return __intrinsic_implicit_as_convert(self, U);}` (prelude.carbon:{{\d+}}) ---> +// CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `{ ... }` (prelude.carbon:{{\d+}}) +// CHECK:STDOUT: ->> step StatementAction pos: 0 `{ ... }` (prelude.carbon:{{\d+}}) ---> // CHECK:STDOUT: // CHECK:STDOUT: *** statement at (prelude.carbon:{{\d+}}) // CHECK:STDOUT: ``` // CHECK:STDOUT: { -// CHECK:STDOUT: return __intrinsic_implicit_as_convert(self, U); +// CHECK:STDOUT: return __intrinsic_implicit_as_convert(self, U); // CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ``` -// CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `return __intrinsic_implicit_as_convert(self, U);` (prelude.carbon:{{\d+}}) -// CHECK:STDOUT: ->> step StatementAction pos: 0 `return __intrinsic_implicit_as_convert(self, U);` (prelude.carbon:{{\d+}}) ---> +// CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `return ...;` (prelude.carbon:{{\d+}}) +// CHECK:STDOUT: ->> step StatementAction pos: 0 `return ...;` (prelude.carbon:{{\d+}}) ---> // CHECK:STDOUT: // CHECK:STDOUT: *** statement at (prelude.carbon:{{\d+}}) // CHECK:STDOUT: ``` @@ -155,15 +151,15 @@ fn Main() -> i32 { // CHECK:STDOUT: <[] stack-pop: ExpressionAction pos: 2 `self` results: [`{}`, `class T`] (prelude.carbon:{{\d+}}) // CHECK:STDOUT: ->> step ValueExpressionAction pos: 1 `__intrinsic_implicit_as_convert(self, U)` results: [`T{}`] (prelude.carbon:{{\d+}}) ---> // CHECK:STDOUT: <[] stack-pop: ValueExpressionAction pos: 1 `__intrinsic_implicit_as_convert(self, U)` results: [`T{}`] (prelude.carbon:{{\d+}}) -// CHECK:STDOUT: ->> step StatementAction pos: 1 `return __intrinsic_implicit_as_convert(self, U);` results: [`T{}`] (prelude.carbon:{{\d+}}) ---> +// CHECK:STDOUT: ->> step StatementAction pos: 1 `return ...;` results: [`T{}`] (prelude.carbon:{{\d+}}) ---> // CHECK:STDOUT: // CHECK:STDOUT: *** statement at (prelude.carbon:{{\d+}}) // CHECK:STDOUT: ``` // CHECK:STDOUT: return __intrinsic_implicit_as_convert(self, U); // CHECK:STDOUT: ``` // CHECK:STDOUT: --> memory-write: #1 `T{}` -// CHECK:STDOUT: <[] stack-pop: StatementAction pos: 1 `return __intrinsic_implicit_as_convert(self, U);` results: [`T{}`] (prelude.carbon:{{\d+}}) -// CHECK:STDOUT: <[] stack-pop: StatementAction pos: 1 `{return __intrinsic_implicit_as_convert(self, U);}` scope: [] (prelude.carbon:{{\d+}}) +// CHECK:STDOUT: <[] stack-pop: StatementAction pos: 1 `return ...;` results: [`T{}`] (prelude.carbon:{{\d+}}) +// CHECK:STDOUT: <[] stack-pop: StatementAction pos: 1 `{ ... }` scope: [] (prelude.carbon:{{\d+}}) // CHECK:STDOUT: <[] stack-pop: ScopeAction pos: 0 scope: [`self: Self`: `{}`] (None) // CHECK:STDOUT: >[] stack-push: CleanUpAction pos: 0 scope: [`self: Self`: `{}`] (stack cleanup:1) // CHECK:STDOUT: >[] stack-push: CleanUpAction pos: 0 scope: [] (stack cleanup:1) @@ -176,7 +172,7 @@ fn Main() -> i32 { // CHECK:STDOUT: >[] stack-push: CleanUpAction pos: 0 scope: [] (stack cleanup:1) // CHECK:STDOUT: ->> step CleanUpAction pos: 0 scope: [] (stack cleanup:1) ---> // CHECK:STDOUT: <[] stack-pop: CleanUpAction pos: 0 scope: [] (stack cleanup:1) -// CHECK:STDOUT: ->> step StatementAction pos: 1 `var x: T = {}.(interface ImplicitAs(T = class T).Convert)();` results: [`T{}`] (phase_execution.carbon:10) ---> +// CHECK:STDOUT: ->> step StatementAction pos: 1 `var ... = ...;` results: [`T{}`] (phase_execution.carbon:10) ---> // CHECK:STDOUT: // CHECK:STDOUT: *** statement at (phase_execution.carbon:10) // CHECK:STDOUT: ``` @@ -185,19 +181,18 @@ fn Main() -> i32 { // CHECK:STDOUT: <-- memory-read: #1 `T{}` // CHECK:STDOUT: === match pattern `Placeholder` // CHECK:STDOUT: from initializing expression with value `T{}` -// CHECK:STDOUT: <[] stack-pop: StatementAction pos: 1 `var x: T = {}.(interface ImplicitAs(T = class T).Convert)();` results: [`T{}`] (phase_execution.carbon:10) -// CHECK:STDOUT: ->> step StatementAction pos: 1 `{var x: T = {}.(interface ImplicitAs(T = class T).Convert)();return 0;}` scope: [`x: T`: `lval`] (phase_execution.carbon:12) ---> +// CHECK:STDOUT: <[] stack-pop: StatementAction pos: 1 `var ... = ...;` results: [`T{}`] (phase_execution.carbon:10) +// CHECK:STDOUT: ->> step StatementAction pos: 1 `{ ... }` scope: [`x: T`: `lval`] (phase_execution.carbon:12) ---> // CHECK:STDOUT: // CHECK:STDOUT: *** statement at (phase_execution.carbon:12) // CHECK:STDOUT: ``` // CHECK:STDOUT: { -// CHECK:STDOUT: var x: T = {}.(interface ImplicitAs(T = class T).Convert)(); -// CHECK:STDOUT: return 0; +// CHECK:STDOUT: var x: T = {}.(interface ImplicitAs(T = class T).Convert)(); +// CHECK:STDOUT: return 0; // CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ``` -// CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `return 0;` (phase_execution.carbon:11) -// CHECK:STDOUT: ->> step StatementAction pos: 0 `return 0;` (phase_execution.carbon:11) ---> +// CHECK:STDOUT: >[] stack-push: StatementAction pos: 0 `return ...;` (phase_execution.carbon:11) +// CHECK:STDOUT: ->> step StatementAction pos: 0 `return ...;` (phase_execution.carbon:11) ---> // CHECK:STDOUT: // CHECK:STDOUT: *** statement at (phase_execution.carbon:11) // CHECK:STDOUT: ``` @@ -210,14 +205,14 @@ fn Main() -> i32 { // CHECK:STDOUT: <[] stack-pop: ExpressionAction pos: 0 `0` (phase_execution.carbon:11) // CHECK:STDOUT: ->> step ValueExpressionAction pos: 1 `0` results: [`0`] (phase_execution.carbon:11) ---> // CHECK:STDOUT: <[] stack-pop: ValueExpressionAction pos: 1 `0` results: [`0`] (phase_execution.carbon:11) -// CHECK:STDOUT: ->> step StatementAction pos: 1 `return 0;` results: [`0`] (phase_execution.carbon:11) ---> +// CHECK:STDOUT: ->> step StatementAction pos: 1 `return ...;` results: [`0`] (phase_execution.carbon:11) ---> // CHECK:STDOUT: // CHECK:STDOUT: *** statement at (phase_execution.carbon:11) // CHECK:STDOUT: ``` // CHECK:STDOUT: return 0; // CHECK:STDOUT: ``` -// CHECK:STDOUT: <[] stack-pop: StatementAction pos: 1 `return 0;` results: [`0`] (phase_execution.carbon:11) -// CHECK:STDOUT: <[] stack-pop: StatementAction pos: 2 `{var x: T = {}.(interface ImplicitAs(T = class T).Convert)();return 0;}` scope: [`x: T`: `lval`] (phase_execution.carbon:12) +// CHECK:STDOUT: <[] stack-pop: StatementAction pos: 1 `return ...;` results: [`0`] (phase_execution.carbon:11) +// CHECK:STDOUT: <[] stack-pop: StatementAction pos: 2 `{ ... }` scope: [`x: T`: `lval`] (phase_execution.carbon:12) // CHECK:STDOUT: <[] stack-pop: ScopeAction pos: 0 scope: [] (None) // CHECK:STDOUT: >[] stack-push: CleanUpAction pos: 0 scope: [] (stack cleanup:1) // CHECK:STDOUT: >[] stack-push: CleanUpAction pos: 0 scope: [`x: T`: `lval`] (stack cleanup:1) diff --git a/explorer/testdata/trace/phase_name_resolution.carbon b/explorer/testdata/trace/phase_name_resolution.carbon index 9db1b6b3a727..1698ccd8c190 100644 --- a/explorer/testdata/trace/phase_name_resolution.carbon +++ b/explorer/testdata/trace/phase_name_resolution.carbon @@ -27,10 +27,10 @@ fn Main() -> i32 { // CHECK:STDOUT: ->> resolving decl `fn Main` (phase_name_resolution.carbon:11) // CHECK:STDOUT: ==> marked `Main` declared but not usable in `package` // CHECK:STDOUT: ==> marked `Main` usable in `package` -// CHECK:STDOUT: ->> resolving stmt `{return 0;}` (phase_name_resolution.carbon:11) -// CHECK:STDOUT: ->> resolving stmt `return 0;` (phase_name_resolution.carbon:10) -// CHECK:STDOUT: <<- finished resolving stmt `return 0;` (phase_name_resolution.carbon:10) -// CHECK:STDOUT: <<- finished resolving stmt `{return 0;}` (phase_name_resolution.carbon:11) +// CHECK:STDOUT: ->> resolving stmt `{ ... }` (phase_name_resolution.carbon:11) +// CHECK:STDOUT: ->> resolving stmt `return ...;` (phase_name_resolution.carbon:10) +// CHECK:STDOUT: <<- finished resolving stmt `return ...;` (phase_name_resolution.carbon:10) +// CHECK:STDOUT: <<- finished resolving stmt `{ ... }` (phase_name_resolution.carbon:11) // CHECK:STDOUT: <<- finished resolving decl `fn Main` (phase_name_resolution.carbon:11) // CHECK:STDOUT: ==> resolved `Main` as `fn Main` in `package` (:0) // CHECK:STDOUT: result: 0 diff --git a/explorer/testdata/trace/phase_source_program.carbon b/explorer/testdata/trace/phase_source_program.carbon index 5c4fb9371617..c91498b3a012 100644 --- a/explorer/testdata/trace/phase_source_program.carbon +++ b/explorer/testdata/trace/phase_source_program.carbon @@ -19,10 +19,9 @@ fn Main() -> i32 { // CHECK:STDOUT: -------------------------------------------------------- // CHECK:STDOUT: interface TestInterface { // CHECK:STDOUT: } -// CHECK:STDOUT: fn Main ()-> i32 { -// CHECK:STDOUT: { -// CHECK:STDOUT: return 0; -// CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn Main () -> i32 +// CHECK:STDOUT: { +// CHECK:STDOUT: return 0; // CHECK:STDOUT: } // CHECK:STDOUT: result: 0 diff --git a/explorer/testdata/trace/phase_type_checking.carbon b/explorer/testdata/trace/phase_type_checking.carbon index a76dc9b93b71..c0f91a7399e6 100644 --- a/explorer/testdata/trace/phase_type_checking.carbon +++ b/explorer/testdata/trace/phase_type_checking.carbon @@ -22,7 +22,6 @@ fn Main() -> i32 { // CHECK:STDOUT: ``` // CHECK:STDOUT: interface TestInterface { // CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ``` // CHECK:STDOUT: ->> declaring `interface TestInterface` (phase_type_checking.carbon:7) // CHECK:STDOUT: <<- finished declaring `interface TestInterface` (phase_type_checking.carbon:7) @@ -31,7 +30,6 @@ fn Main() -> i32 { // CHECK:STDOUT: ``` // CHECK:STDOUT: interface TestInterface { // CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ``` // CHECK:STDOUT: ->> checking InterfaceDeclaration `interface TestInterface` (phase_type_checking.carbon:7) // CHECK:STDOUT: ->> checking `interface TestInterface` (phase_type_checking.carbon:7) @@ -88,13 +86,10 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: *** declaration at (phase_type_checking.carbon:11) // CHECK:STDOUT: ``` -// CHECK:STDOUT: fn Main ()-> i32 { +// CHECK:STDOUT: fn Main () -> i32 // CHECK:STDOUT: { -// CHECK:STDOUT: return 0; +// CHECK:STDOUT: return 0; // CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ``` // CHECK:STDOUT: ->> declaring function `Main` (phase_type_checking.carbon:11) // CHECK:STDOUT: ->> checking TuplePattern `()` (phase_type_checking.carbon:9) @@ -110,13 +105,10 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: *** type checking declaration at (phase_type_checking.carbon:11) // CHECK:STDOUT: ``` -// CHECK:STDOUT: fn Main ()-> i32 { +// CHECK:STDOUT: fn Main () -> i32 // CHECK:STDOUT: { -// CHECK:STDOUT: return 0; +// CHECK:STDOUT: return 0; // CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ``` // CHECK:STDOUT: ->> checking FunctionDeclaration `fn Main` (phase_type_checking.carbon:11) // CHECK:STDOUT: ->> checking function `Main` (phase_type_checking.carbon:11) @@ -173,17 +165,16 @@ fn Main() -> i32 { // CHECK:STDOUT: *** type checking stmt at (phase_type_checking.carbon:11) // CHECK:STDOUT: ``` // CHECK:STDOUT: { -// CHECK:STDOUT: return 0; +// CHECK:STDOUT: return 0; // CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ``` -// CHECK:STDOUT: ->> checking Block `{return 0;}` (phase_type_checking.carbon:11) +// CHECK:STDOUT: ->> checking Block `{ ... }` (phase_type_checking.carbon:11) // CHECK:STDOUT: // CHECK:STDOUT: *** type checking stmt at (phase_type_checking.carbon:10) // CHECK:STDOUT: ``` // CHECK:STDOUT: return 0; // CHECK:STDOUT: ``` -// CHECK:STDOUT: ->> checking ReturnExpression `return 0;` (phase_type_checking.carbon:10) +// CHECK:STDOUT: ->> checking ReturnExpression `return ...;` (phase_type_checking.carbon:10) // CHECK:STDOUT: ->> checking IntLiteral `0` (phase_type_checking.carbon:10) // CHECK:STDOUT: ->> finished checking function `Main` (phase_type_checking.carbon:11) // CHECK:STDOUT: ->> checking CallExpression `Main()` (:0) diff --git a/explorer/testdata/trace/phase_unformed_variables_resolution.carbon b/explorer/testdata/trace/phase_unformed_variables_resolution.carbon index 2520dfca5e99..d47c7c6c57b8 100644 --- a/explorer/testdata/trace/phase_unformed_variables_resolution.carbon +++ b/explorer/testdata/trace/phase_unformed_variables_resolution.carbon @@ -19,6 +19,6 @@ fn Main() -> i32 { // CHECK:STDOUT: ---------------------------------------------------------------------- // CHECK:STDOUT: ->> resolving-unformed in decl `interface TestInterface` (phase_unformed_variables_resolution.carbon:7) // CHECK:STDOUT: ->> resolving-unformed in decl `fn Main` (phase_unformed_variables_resolution.carbon:11) -// CHECK:STDOUT: ->> resolving-unformed in stmt `{return 0;}` (phase_unformed_variables_resolution.carbon:11) -// CHECK:STDOUT: ->> resolving-unformed in stmt `return 0;` (phase_unformed_variables_resolution.carbon:10) +// CHECK:STDOUT: ->> resolving-unformed in stmt `{ ... }` (phase_unformed_variables_resolution.carbon:11) +// CHECK:STDOUT: ->> resolving-unformed in stmt `return ...;` (phase_unformed_variables_resolution.carbon:10) // CHECK:STDOUT: result: 0