mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 19:50:14 +01:00
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 <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
05e061fe96
commit
289d05813e
@@ -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<ConstraintTypeDeclaration>(*this);
|
||||
PrintID(out);
|
||||
out << PrintAsID(*this);
|
||||
out << " {\n";
|
||||
for (Nonnull<Declaration*> 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<ImplDeclaration>(*this);
|
||||
PrintID(out);
|
||||
out << " {\n";
|
||||
out << PrintAsID(impl_decl) << " {\n";
|
||||
for (Nonnull<Declaration*> 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<MatchFirstDeclaration>(*this);
|
||||
PrintID(out);
|
||||
out << " {\n";
|
||||
out << PrintAsID(match_first_decl) << " {\n";
|
||||
for (Nonnull<const ImplDeclaration*> 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<FunctionDeclaration>(*this).PrintDepth(-1, out);
|
||||
cast<FunctionDeclaration>(*this).PrintIndent(indent_num_spaces, out);
|
||||
break;
|
||||
case DeclarationKind::DestructorDeclaration:
|
||||
cast<DestructorDeclaration>(*this).PrintDepth(-1, out);
|
||||
cast<DestructorDeclaration>(*this).PrintIndent(indent_num_spaces, out);
|
||||
break;
|
||||
case DeclarationKind::ClassDeclaration: {
|
||||
const auto& class_decl = cast<ClassDeclaration>(*this);
|
||||
PrintID(out);
|
||||
out << PrintAsID(class_decl);
|
||||
if (class_decl.type_params().has_value()) {
|
||||
out << **class_decl.type_params();
|
||||
}
|
||||
out << " {\n";
|
||||
for (Nonnull<Declaration*> 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<MixinDeclaration>(*this);
|
||||
PrintID(out);
|
||||
out << "{\n";
|
||||
out << PrintAsID(mixin_decl) << "{\n";
|
||||
for (Nonnull<Declaration*> 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<MixDeclaration>(*this);
|
||||
PrintID(out);
|
||||
out << PrintAsID(mix_decl);
|
||||
out << mix_decl.mixin() << ";";
|
||||
break;
|
||||
}
|
||||
case DeclarationKind::ChoiceDeclaration: {
|
||||
const auto& choice = cast<ChoiceDeclaration>(*this);
|
||||
PrintID(out);
|
||||
out << " {\n";
|
||||
out << PrintAsID(choice) << " {\n";
|
||||
for (Nonnull<const AlternativeSignature*> 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<VariableDeclaration>(*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<AliasDeclaration>(*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*> 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 << ";";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<Nonnull<const GenericBinding*>> {
|
||||
return deduced_parameters_;
|
||||
|
||||
@@ -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<ConstantValueLiteral>(*this).constant_value();
|
||||
break;
|
||||
case ExpressionKind::ArrayTypeLiteral:
|
||||
case ExpressionKind::FunctionTypeLiteral:
|
||||
case ExpressionKind::StructLiteral:
|
||||
case ExpressionKind::IndexExpression:
|
||||
case ExpressionKind::SimpleMemberAccessExpression:
|
||||
case ExpressionKind::CompoundMemberAccessExpression:
|
||||
|
||||
+90
-32
@@ -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<VariableDefinition>(*this);
|
||||
if (var.is_returned()) {
|
||||
out << "returned ";
|
||||
}
|
||||
out << "var ...";
|
||||
if (var.has_init()) {
|
||||
out << " = ...";
|
||||
}
|
||||
out << ";";
|
||||
break;
|
||||
}
|
||||
case StatementKind::ExpressionStatement:
|
||||
out << "<expression>;";
|
||||
break;
|
||||
case StatementKind::Assign: {
|
||||
const auto& assign = cast<Assign>(*this);
|
||||
out << "... " << AssignOperatorToString(assign.op()) << " ...;";
|
||||
break;
|
||||
}
|
||||
case StatementKind::IncrementDecrement: {
|
||||
const auto& inc_dec = cast<IncrementDecrement>(*this);
|
||||
out << (inc_dec.is_increment() ? "++" : "--") << "...;";
|
||||
break;
|
||||
}
|
||||
case StatementKind::If: {
|
||||
const auto& if_stmt = cast<If>(*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<ReturnExpression>(*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<Match>(*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<While>(*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<For>(*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<IncrementDecrement>(*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<If>(*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<Block>(*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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -28,12 +28,16 @@ auto AnalyzeProgram(Nonnull<Arena*> 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("<Main()>", 0, FileKind::Main);
|
||||
@@ -71,12 +75,16 @@ auto AnalyzeProgram(Nonnull<Arena*> 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;
|
||||
}
|
||||
|
||||
@@ -2334,7 +2334,7 @@ auto Interpreter::StepDeclaration() -> ErrorOr<Success> {
|
||||
|
||||
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()) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -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()` (<Main()>:0) --->
|
||||
|
||||
+29
-43
@@ -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` (<Main()>: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()` (<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)
|
||||
|
||||
+82
-104
@@ -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` (<Main()>: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()` (<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<n>`
|
||||
// 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<x>`
|
||||
// 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<Allocation(1)>`] (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<Allocation(1)>`] (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<Allocation(1)>`] (phase_all.carbon:17) --->
|
||||
// CHECK:STDOUT: <[] stack-pop: ValueExpressionAction pos: 1 `x` results: [`ref_expr<Allocation(1)>`] (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<Allocation(1)>`] (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<Allocation(1)>`] (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<Allocation(1)>`] (stack cleanup:1)
|
||||
|
||||
+3
-4
@@ -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
|
||||
|
||||
+27
-32
@@ -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<x>`
|
||||
// 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<Allocation(1)>`] (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<Allocation(1)>`] (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<Allocation(1)>`] (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<Allocation(1)>`] (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<Allocation(1)>`] (stack cleanup:1)
|
||||
|
||||
+4
-4
@@ -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` (<Main()>:0)
|
||||
// CHECK:STDOUT: result: 0
|
||||
|
||||
+3
-4
@@ -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
|
||||
|
||||
+7
-16
@@ -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()` (<Main()>:0)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user