From 1d56e165efaea78d11caef9d0c617e41cf20ed5a Mon Sep 17 00:00:00 2001 From: Jon Ross-Perkins Date: Fri, 26 May 2023 10:16:38 -0700 Subject: [PATCH] Start refactoring type handling to track which types are in-use. (#2848) This is the first step to refactoring types into a SemanticsTypeId. This only tracks what's in-use, but as a consequence starts funneling type information through in ways similar to how I'd want it to do SemanticsTypeId. --- .../testdata/semantics_builtin_nodes.carbon | 2 + toolchain/semantics/semantics_context.cpp | 19 ++++- toolchain/semantics/semantics_context.h | 40 ++++----- toolchain/semantics/semantics_handle.cpp | 25 ++++-- .../semantics/semantics_handle_struct.cpp | 17 ++-- toolchain/semantics/semantics_ir.cpp | 1 + toolchain/semantics/semantics_ir.h | 11 +++ toolchain/semantics/semantics_ir_test.cpp | 1 + toolchain/semantics/semantics_node.h | 82 ++++++++++++------- .../testdata/basics/builtin_types.carbon | 5 ++ .../semantics/testdata/basics/empty.carbon | 2 + .../testdata/basics/empty_decl.carbon | 2 + .../testdata/basics/fail_name_lookup.carbon | 2 + .../designators/fail_unsupported.carbon | 3 + .../function/call/empty_struct.carbon | 3 + .../function/call/fail_param_count.carbon | 3 + .../function/call/fail_param_type.carbon | 4 + .../call/fail_return_type_mismatch.carbon | 4 + .../testdata/function/call/i32.carbon | 3 + .../function/call/more_param_ir.carbon | 3 + .../testdata/function/call/params_one.carbon | 3 + .../function/call/params_one_comma.carbon | 3 + .../testdata/function/call/params_two.carbon | 3 + .../function/call/params_two_comma.carbon | 3 + .../testdata/function/call/params_zero.carbon | 2 + .../fail_param_name_conflict.carbon | 3 + .../testdata/function/definition/order.carbon | 2 + .../function/definition/params_one.carbon | 3 + .../definition/params_one_comma.carbon | 3 + .../function/definition/params_two.carbon | 3 + .../definition/params_two_comma.carbon | 3 + .../function/definition/params_zero.carbon | 2 + .../definition/same_param_name.carbon | 3 + .../testdata/operators/binary_op.carbon | 3 + .../operators/fail_type_mismatch.carbon | 4 + .../operators/fail_type_mismatch_once.carbon | 4 + .../testdata/return/fail_type_mismatch.carbon | 4 + .../return/fail_value_disallowed.carbon | 3 + .../testdata/return/fail_value_missing.carbon | 3 + .../semantics/testdata/return/no_value.carbon | 2 + .../semantics/testdata/return/struct.carbon | 5 ++ .../semantics/testdata/return/value.carbon | 3 + .../semantics/testdata/struct/empty.carbon | 3 + .../testdata/struct/fail_assign_empty.carbon | 4 + .../struct/fail_assign_to_empty.carbon | 5 ++ .../struct/fail_field_name_mismatch.carbon | 5 ++ .../struct/fail_field_type_mismatch.carbon | 6 ++ .../struct/fail_member_access_type.carbon | 6 ++ .../struct/fail_non_member_access.carbon | 5 ++ .../struct/fail_too_few_values.carbon | 5 ++ .../testdata/struct/fail_type_assign.carbon | 4 + .../testdata/struct/fail_value_as_type.carbon | 4 + .../testdata/struct/member_access.carbon | 6 ++ .../testdata/struct/one_entry.carbon | 6 ++ .../testdata/struct/two_entries.carbon | 6 ++ toolchain/semantics/testdata/var/decl.carbon | 3 + .../testdata/var/decl_with_init.carbon | 3 + .../testdata/var/fail_duplicate_decl.carbon | 3 + .../var/fail_init_type_mismatch.carbon | 4 + .../testdata/var/fail_init_with_self.carbon | 3 + .../var/fail_lookup_outside_scope.carbon | 3 + .../var/fail_storage_is_literal.carbon | 3 + .../semantics/testdata/var/global_decl.carbon | 3 + .../testdata/var/global_decl_with_init.carbon | 3 + .../testdata/var/global_lookup.carbon | 3 + .../var/global_lookup_in_scope.carbon | 3 + .../semantics/testdata/var/lookup.carbon | 3 + 67 files changed, 335 insertions(+), 66 deletions(-) diff --git a/toolchain/driver/testdata/semantics_builtin_nodes.carbon b/toolchain/driver/testdata/semantics_builtin_nodes.carbon index 4b95b89cb8c8..0db414ef1b0b 100644 --- a/toolchain/driver/testdata/semantics_builtin_nodes.carbon +++ b/toolchain/driver/testdata/semantics_builtin_nodes.carbon @@ -13,6 +13,8 @@ // CHECK:STDOUT: ] // CHECK:STDOUT: strings: [ // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: CrossReference, arg0: ir0, arg1: nodeTypeType, type: nodeTypeType}, // CHECK:STDOUT: {kind: CrossReference, arg0: ir0, arg1: nodeInvalidType, type: nodeInvalidType}, diff --git a/toolchain/semantics/semantics_context.cpp b/toolchain/semantics/semantics_context.cpp index 1ca8a3657eef..8cb19f0d8be2 100644 --- a/toolchain/semantics/semantics_context.cpp +++ b/toolchain/semantics/semantics_context.cpp @@ -33,7 +33,12 @@ SemanticsContext::SemanticsContext(const TokenizedBuffer& tokens, params_or_args_stack_("params_or_args_stack_", semantics.node_blocks(), vlog_stream), args_type_info_stack_("args_type_info_stack_", semantics.node_blocks(), - vlog_stream) {} + vlog_stream) { + // Inserts the "Invalid" and "Type" types as "used types" so that + // canonicalization can skip them. We don't emit either for lowering. + canonical_types_.insert(SemanticsNodeId::BuiltinInvalidType); + canonical_types_.insert(SemanticsNodeId::BuiltinTypeType); +} auto SemanticsContext::TODO(ParseTree::Node parse_node, std::string label) -> bool { @@ -54,6 +59,10 @@ auto SemanticsContext::VerifyOnFinish() -> void { } auto SemanticsContext::AddNode(SemanticsNode node) -> SemanticsNodeId { + CARBON_CHECK(!node.type_id().is_valid() || + node.type_id() == SemanticsNodeId::BuiltinInvalidType || + canonical_types_.contains(node.type_id())) + << "Added node without canonicalizing its type: " << node; auto block = node_block_stack_.PeekForAdd(); CARBON_VLOG() << "AddNode " << block << ": " << node << "\n"; return semantics_->AddNode(block, node); @@ -359,6 +368,14 @@ auto SemanticsContext::ParamOrArgSave(bool for_args) -> void { params_or_args.push_back(param_or_arg_id); } +auto SemanticsContext::CanonicalizeType(SemanticsNodeId node_id) + -> SemanticsNodeId { + if (canonical_types_.insert(node_id).second) { + semantics_->AddType(node_id); + } + return node_id; +} + auto SemanticsContext::PrintForStackDump(llvm::raw_ostream& output) const -> void { node_stack_.PrintForStackDump(output); diff --git a/toolchain/semantics/semantics_context.h b/toolchain/semantics/semantics_context.h index b5d4db56247c..f36b750d825c 100644 --- a/toolchain/semantics/semantics_context.h +++ b/toolchain/semantics/semantics_context.h @@ -93,6 +93,18 @@ class SemanticsContext { auto ImplicitAsRequired(ParseTree::Node parse_node, SemanticsNodeId value_id, SemanticsNodeId as_type_id) -> SemanticsNodeId; + // Canonicalizes a type which is tracked as a single node. + // TODO: This should eventually return a type ID. + auto CanonicalizeType(SemanticsNodeId node_id) -> SemanticsNodeId; + + // Converts an expression for use as a type. + // TODO: This should eventually return a type ID. + auto ExpressionAsType(ParseTree::Node parse_node, SemanticsNodeId value_id) + -> SemanticsNodeId { + return CanonicalizeType(ImplicitAsRequired( + parse_node, value_id, SemanticsNodeId::BuiltinTypeType)); + } + // Starts handling parameters or arguments. auto ParamOrArgStart() -> void; @@ -149,30 +161,11 @@ class SemanticsContext { Compatible, }; - // Provides DenseMapInfo for SemanticsStringId. - struct SemanticsStringIdMapInfo { - static inline auto getEmptyKey() -> SemanticsStringId { - return SemanticsStringId(llvm::DenseMapInfo::getEmptyKey()); - } - static inline auto getTombstoneKey() -> SemanticsStringId { - return SemanticsStringId(llvm::DenseMapInfo::getTombstoneKey()); - } - - static auto getHashValue(const SemanticsStringId& val) -> unsigned { - return llvm::DenseMapInfo::getHashValue(val.index); - } - - static auto isEqual(const SemanticsStringId& lhs, - const SemanticsStringId& rhs) -> bool { - return lhs == rhs; - } - }; - // An entry in scope_stack_. struct ScopeStackEntry { // Names which are registered with name_lookup_, and will need to be // deregistered when the scope ends. - llvm::DenseSet names; + llvm::DenseSet names; // TODO: This likely needs to track things which need to be destructed. }; @@ -245,9 +238,12 @@ class SemanticsContext { // reference. // // Names which no longer have lookup results are erased. - llvm::DenseMap, - SemanticsStringIdMapInfo> + llvm::DenseMap> name_lookup_; + + // Tracks types which have been used, so that they aren't repeatedly added to + // SemanticsIR. + llvm::DenseSet canonical_types_; }; // Parse node handlers. Returns false for unrecoverable errors. diff --git a/toolchain/semantics/semantics_handle.cpp b/toolchain/semantics/semantics_handle.cpp index cb8acc9b148b..cb1db8604524 100644 --- a/toolchain/semantics/semantics_handle.cpp +++ b/toolchain/semantics/semantics_handle.cpp @@ -223,7 +223,11 @@ auto SemanticsHandleLiteral(SemanticsContext& context, auto id = context.semantics().AddIntegerLiteral( context.tokens().GetIntegerLiteral(token)); context.AddNodeAndPush( - parse_node, SemanticsNode::IntegerLiteral::Make(parse_node, id)); + parse_node, + SemanticsNode::IntegerLiteral::Make( + parse_node, + context.CanonicalizeType(SemanticsNodeId::BuiltinIntegerType), + id)); break; } case TokenKind::RealLiteral: { @@ -233,14 +237,22 @@ auto SemanticsHandleLiteral(SemanticsContext& context, .exponent = token_value.Exponent(), .is_decimal = token_value.IsDecimal()}); context.AddNodeAndPush(parse_node, - SemanticsNode::RealLiteral::Make(parse_node, id)); + SemanticsNode::RealLiteral::Make( + parse_node, + context.CanonicalizeType( + SemanticsNodeId::BuiltinFloatingPointType), + id)); break; } case TokenKind::StringLiteral: { auto id = context.semantics().AddString( context.tokens().GetStringLiteral(token)); context.AddNodeAndPush( - parse_node, SemanticsNode::StringLiteral::Make(parse_node, id)); + parse_node, + SemanticsNode::StringLiteral::Make( + parse_node, + context.CanonicalizeType(SemanticsNodeId::BuiltinStringType), + id)); break; } case TokenKind::IntegerTypeLiteral: { @@ -352,8 +364,8 @@ auto SemanticsHandlePatternBinding(SemanticsContext& context, ParseTree::Node parse_node) -> bool { auto [type_node, parsed_type_id] = context.node_stack().PopForParseNodeAndNodeId(); - SemanticsNodeId cast_type_id = context.ImplicitAsRequired( - type_node, parsed_type_id, SemanticsNodeId::BuiltinTypeType); + SemanticsNodeId cast_type_id = + context.ExpressionAsType(type_node, parsed_type_id); // Get the name. auto name_node = context.node_stack().PopForSoloParseNode(); @@ -447,8 +459,7 @@ auto SemanticsHandleReturnType(SemanticsContext& context, // Propagate the type expression. auto [type_parse_node, type_node_id] = context.node_stack().PopForParseNodeAndNodeId(); - auto cast_node_id = context.ImplicitAsRequired( - type_parse_node, type_node_id, SemanticsNodeId::BuiltinTypeType); + auto cast_node_id = context.ExpressionAsType(type_parse_node, type_node_id); context.node_stack().Push(parse_node, cast_node_id); return true; } diff --git a/toolchain/semantics/semantics_handle_struct.cpp b/toolchain/semantics/semantics_handle_struct.cpp index 0f7e584ce9ab..854146acbf68 100644 --- a/toolchain/semantics/semantics_handle_struct.cpp +++ b/toolchain/semantics/semantics_handle_struct.cpp @@ -28,8 +28,7 @@ auto SemanticsHandleStructFieldDesignator(SemanticsContext& context, auto SemanticsHandleStructFieldType(SemanticsContext& context, ParseTree::Node parse_node) -> bool { auto [type_node, type_id] = context.node_stack().PopForParseNodeAndNodeId(); - SemanticsNodeId cast_type_id = context.ImplicitAsRequired( - type_node, type_id, SemanticsNodeId::BuiltinTypeType); + SemanticsNodeId cast_type_id = context.ExpressionAsType(type_node, type_id); auto [name_node, name_id] = context.node_stack().PopForParseNodeAndNameId( ParseNodeKind::DesignatedName); @@ -82,9 +81,14 @@ auto SemanticsHandleStructLiteral(SemanticsContext& context, } // Construct a type for the literal. + // TODO: This should try to canonicalize the struct form before adding the + // node. auto refs = context.semantics().GetNodeBlock(refs_id); - auto type_id = context.AddNode( - SemanticsNode::StructType::Make(parse_node, type_block_id)); + auto type_id = + context.CanonicalizeType(context.AddNode(SemanticsNode::StructType::Make( + parse_node, + context.CanonicalizeType(SemanticsNodeId::BuiltinTypeType), + type_block_id))); auto value_id = context.AddNode( SemanticsNode::StructValue::Make(parse_node, type_id, refs_id)); @@ -118,8 +122,9 @@ auto SemanticsHandleStructTypeLiteral(SemanticsContext& context, CARBON_CHECK(refs_id != SemanticsNodeBlockId::Empty) << "{} is handled by StructLiteral."; - auto type_id = - context.AddNode(SemanticsNode::StructType::Make(parse_node, refs_id)); + auto type_id = context.AddNode(SemanticsNode::StructType::Make( + parse_node, context.CanonicalizeType(SemanticsNodeId::BuiltinTypeType), + refs_id)); context.node_stack().Push(parse_node, type_id); return true; } diff --git a/toolchain/semantics/semantics_ir.cpp b/toolchain/semantics/semantics_ir.cpp index 98d0e48f7a06..e0bd085498d4 100644 --- a/toolchain/semantics/semantics_ir.cpp +++ b/toolchain/semantics/semantics_ir.cpp @@ -109,6 +109,7 @@ auto SemanticsIR::Print(llvm::raw_ostream& out, bool include_builtins) const PrintList(out, "integer_literals", integer_literals_); PrintList(out, "real_literals", real_literals_); PrintList(out, "strings", strings_); + PrintList(out, "types", types_); out << "nodes: [\n"; for (int i = include_builtins ? 0 : SemanticsBuiltinKind::ValidCount; diff --git a/toolchain/semantics/semantics_ir.h b/toolchain/semantics/semantics_ir.h index 4354891997bb..94165475c014 100644 --- a/toolchain/semantics/semantics_ir.h +++ b/toolchain/semantics/semantics_ir.h @@ -160,12 +160,19 @@ class SemanticsIR { return std::nullopt; } + // Adds a type. + auto AddType(SemanticsNodeId node_id) -> void { types_.push_back(node_id); } + // Produces a string version of a node. auto StringifyNode(SemanticsNodeId node_id) -> std::string; auto callables_size() const -> int { return callables_.size(); } auto nodes_size() const -> int { return nodes_.size(); } + auto types() const -> const llvm::SmallVector& { + return types_; + } + // The node blocks, for direct mutation. auto node_blocks() -> llvm::SmallVector>& { return node_blocks_; @@ -206,6 +213,10 @@ class SemanticsIR { llvm::StringMap string_to_id_; llvm::SmallVector strings_; + // Nodes which correspond to in-use types. Stored separately for easy access + // by lowering. + llvm::SmallVector types_; + // All nodes. The first entries will always be cross-references to builtins, // at indices matching SemanticsBuiltinKind ordering. llvm::SmallVector nodes_; diff --git a/toolchain/semantics/semantics_ir_test.cpp b/toolchain/semantics/semantics_ir_test.cpp index e7bb5f5beda9..571e18fd9fd0 100644 --- a/toolchain/semantics/semantics_ir_test.cpp +++ b/toolchain/semantics/semantics_ir_test.cpp @@ -54,6 +54,7 @@ TEST(SemanticsIRTest, YAML) { Pair("integer_literals", Yaml::Sequence(ElementsAre("0"))), Pair("real_literals", Yaml::Sequence(IsEmpty())), Pair("strings", Yaml::Sequence(ElementsAre("x"))), + Pair("types", Yaml::Sequence(ElementsAre(node_builtin))), Pair( "nodes", Yaml::Sequence(AllOf( diff --git a/toolchain/semantics/semantics_node.h b/toolchain/semantics/semantics_node.h index b098611b7229..1662d90d2362 100644 --- a/toolchain/semantics/semantics_node.h +++ b/toolchain/semantics/semantics_node.h @@ -199,12 +199,12 @@ class SemanticsNode { }; // Provides Get along with a Make that assumes a non-changing type. - template - class FactoryPreTyped : public FactoryBase { + template + class FactoryNoType : public FactoryBase { public: static auto Make(ParseTree::Node parse_node, ArgTypes... args) { - SemanticsNodeId type_id(TypeIndex); - return FactoryBase::Make(parse_node, type_id, args...); + return FactoryBase::Make( + parse_node, SemanticsNodeId::Invalid, args...); } using FactoryBase::Get; }; @@ -251,9 +251,8 @@ class SemanticsNode { Factory; - using CodeBlock = FactoryPreTyped; + using CodeBlock = FactoryNoType; class CrossReference : public FactoryBase; + using FunctionDeclaration = + FactoryNoType; - using FunctionDefinition = FactoryPreTyped< - SemanticsNodeKind::FunctionDefinition, SemanticsNodeId::InvalidIndex, - SemanticsNodeId /*decl_id*/, SemanticsNodeBlockId /*node_block_id*/>; + using FunctionDefinition = + FactoryNoType; - using IntegerLiteral = - FactoryPreTyped; + using IntegerLiteral = Factory; - using RealLiteral = - FactoryPreTyped; + using RealLiteral = Factory; - using Return = - FactoryPreTyped; + using Return = FactoryNoType; using ReturnExpression = Factory; - using StringLiteral = - FactoryPreTyped; + using StringLiteral = Factory; using StructMemberAccess = Factory; - using StructType = FactoryPreTyped; + using StructType = + Factory; using StructTypeField = Factory; @@ -365,6 +358,35 @@ class SemanticsNode { // may be worth investigating further. static_assert(sizeof(SemanticsNode) == 20, "Unexpected SemanticsNode size"); +// Provides base support for use of Id types as DenseMap/DenseSet keys. +// Instantiated below. +template +struct SemanticsIdMapInfo { + static inline auto getEmptyKey() -> Id { + return Id(llvm::DenseMapInfo::getEmptyKey()); + } + + static inline auto getTombstoneKey() -> Id { + return Id(llvm::DenseMapInfo::getTombstoneKey()); + } + + static auto getHashValue(const Id& val) -> unsigned { + return llvm::DenseMapInfo::getHashValue(val.index); + } + + static auto isEqual(const Id& lhs, const Id& rhs) -> bool { + return lhs == rhs; + } +}; + } // namespace Carbon +// Support use of Id types as DenseMap/DenseSet keys. +template <> +struct llvm::DenseMapInfo + : public Carbon::SemanticsIdMapInfo {}; +template <> +struct llvm::DenseMapInfo + : public Carbon::SemanticsIdMapInfo {}; + #endif // CARBON_TOOLCHAIN_SEMANTICS_SEMANTICS_NODE_H_ diff --git a/toolchain/semantics/testdata/basics/builtin_types.carbon b/toolchain/semantics/testdata/basics/builtin_types.carbon index 3b2d4f5e63a9..7c6f9a6bde53 100644 --- a/toolchain/semantics/testdata/basics/builtin_types.carbon +++ b/toolchain/semantics/testdata/basics/builtin_types.carbon @@ -18,6 +18,11 @@ // CHECK:STDOUT: test_str, // CHECK:STDOUT: Test, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: nodeFloatingPointType, +// CHECK:STDOUT: nodeStringType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: nodeIntegerType}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/basics/empty.carbon b/toolchain/semantics/testdata/basics/empty.carbon index 40e3cf1f52b0..c901e09d9281 100644 --- a/toolchain/semantics/testdata/basics/empty.carbon +++ b/toolchain/semantics/testdata/basics/empty.carbon @@ -12,6 +12,8 @@ // CHECK:STDOUT: ] // CHECK:STDOUT: strings: [ // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ diff --git a/toolchain/semantics/testdata/basics/empty_decl.carbon b/toolchain/semantics/testdata/basics/empty_decl.carbon index 5fc73d814d61..383a20dd2162 100644 --- a/toolchain/semantics/testdata/basics/empty_decl.carbon +++ b/toolchain/semantics/testdata/basics/empty_decl.carbon @@ -12,6 +12,8 @@ // CHECK:STDOUT: ] // CHECK:STDOUT: strings: [ // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ diff --git a/toolchain/semantics/testdata/basics/fail_name_lookup.carbon b/toolchain/semantics/testdata/basics/fail_name_lookup.carbon index afe740e8daee..4c856c8f0874 100644 --- a/toolchain/semantics/testdata/basics/fail_name_lookup.carbon +++ b/toolchain/semantics/testdata/basics/fail_name_lookup.carbon @@ -14,6 +14,8 @@ // CHECK:STDOUT: strings: [ // CHECK:STDOUT: Main, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, // CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+0, arg1: block0}, diff --git a/toolchain/semantics/testdata/designators/fail_unsupported.carbon b/toolchain/semantics/testdata/designators/fail_unsupported.carbon index c63dc7700f8a..2422b73fc6b1 100644 --- a/toolchain/semantics/testdata/designators/fail_unsupported.carbon +++ b/toolchain/semantics/testdata/designators/fail_unsupported.carbon @@ -15,6 +15,9 @@ // CHECK:STDOUT: y, // CHECK:STDOUT: b, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: nodeIntegerType}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/function/call/empty_struct.carbon b/toolchain/semantics/testdata/function/call/empty_struct.carbon index eb628dfa3b0e..b867678d944a 100644 --- a/toolchain/semantics/testdata/function/call/empty_struct.carbon +++ b/toolchain/semantics/testdata/function/call/empty_struct.carbon @@ -17,6 +17,9 @@ // CHECK:STDOUT: Echo, // CHECK:STDOUT: Main, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeEmptyStructType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: nodeEmptyStructType}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: nodeEmptyStructType}, diff --git a/toolchain/semantics/testdata/function/call/fail_param_count.carbon b/toolchain/semantics/testdata/function/call/fail_param_count.carbon index 6a82734c6f33..8299794d0ad7 100644 --- a/toolchain/semantics/testdata/function/call/fail_param_count.carbon +++ b/toolchain/semantics/testdata/function/call/fail_param_count.carbon @@ -28,6 +28,9 @@ // CHECK:STDOUT: Run2, // CHECK:STDOUT: Main, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, // CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+0, arg1: block0}, diff --git a/toolchain/semantics/testdata/function/call/fail_param_type.carbon b/toolchain/semantics/testdata/function/call/fail_param_type.carbon index 6fc7e9912595..164ffdd504c7 100644 --- a/toolchain/semantics/testdata/function/call/fail_param_type.carbon +++ b/toolchain/semantics/testdata/function/call/fail_param_type.carbon @@ -18,6 +18,10 @@ // CHECK:STDOUT: Run, // CHECK:STDOUT: Main, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: nodeFloatingPointType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: nodeIntegerType}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/function/call/fail_return_type_mismatch.carbon b/toolchain/semantics/testdata/function/call/fail_return_type_mismatch.carbon index d1fe6f35c7dc..709369f95e94 100644 --- a/toolchain/semantics/testdata/function/call/fail_return_type_mismatch.carbon +++ b/toolchain/semantics/testdata/function/call/fail_return_type_mismatch.carbon @@ -18,6 +18,10 @@ // CHECK:STDOUT: Run, // CHECK:STDOUT: x, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeFloatingPointType, +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, // CHECK:STDOUT: {kind: RealLiteral, arg0: real0, type: nodeFloatingPointType}, diff --git a/toolchain/semantics/testdata/function/call/i32.carbon b/toolchain/semantics/testdata/function/call/i32.carbon index e20487e3277e..2c521708f67f 100644 --- a/toolchain/semantics/testdata/function/call/i32.carbon +++ b/toolchain/semantics/testdata/function/call/i32.carbon @@ -19,6 +19,9 @@ // CHECK:STDOUT: Main, // CHECK:STDOUT: b, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: nodeIntegerType}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/function/call/more_param_ir.carbon b/toolchain/semantics/testdata/function/call/more_param_ir.carbon index 078948fee729..c82cea7c43fb 100644 --- a/toolchain/semantics/testdata/function/call/more_param_ir.carbon +++ b/toolchain/semantics/testdata/function/call/more_param_ir.carbon @@ -25,6 +25,9 @@ // CHECK:STDOUT: Foo, // CHECK:STDOUT: Main, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: nodeIntegerType}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/function/call/params_one.carbon b/toolchain/semantics/testdata/function/call/params_one.carbon index 0c264436ff4b..fb8dd69ac269 100644 --- a/toolchain/semantics/testdata/function/call/params_one.carbon +++ b/toolchain/semantics/testdata/function/call/params_one.carbon @@ -18,6 +18,9 @@ // CHECK:STDOUT: Foo, // CHECK:STDOUT: Main, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: nodeIntegerType}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/function/call/params_one_comma.carbon b/toolchain/semantics/testdata/function/call/params_one_comma.carbon index ebc70fe97248..e178716ddf7b 100644 --- a/toolchain/semantics/testdata/function/call/params_one_comma.carbon +++ b/toolchain/semantics/testdata/function/call/params_one_comma.carbon @@ -19,6 +19,9 @@ // CHECK:STDOUT: Foo, // CHECK:STDOUT: Main, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: nodeIntegerType}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/function/call/params_two.carbon b/toolchain/semantics/testdata/function/call/params_two.carbon index 6e84a68b60bb..108dfa03f705 100644 --- a/toolchain/semantics/testdata/function/call/params_two.carbon +++ b/toolchain/semantics/testdata/function/call/params_two.carbon @@ -20,6 +20,9 @@ // CHECK:STDOUT: Foo, // CHECK:STDOUT: Main, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: nodeIntegerType}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/function/call/params_two_comma.carbon b/toolchain/semantics/testdata/function/call/params_two_comma.carbon index e69360ee65d4..50a12d429f80 100644 --- a/toolchain/semantics/testdata/function/call/params_two_comma.carbon +++ b/toolchain/semantics/testdata/function/call/params_two_comma.carbon @@ -22,6 +22,9 @@ // CHECK:STDOUT: Foo, // CHECK:STDOUT: Main, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: nodeIntegerType}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/function/call/params_zero.carbon b/toolchain/semantics/testdata/function/call/params_zero.carbon index b17b44cbf340..1160eabcfffd 100644 --- a/toolchain/semantics/testdata/function/call/params_zero.carbon +++ b/toolchain/semantics/testdata/function/call/params_zero.carbon @@ -16,6 +16,8 @@ // CHECK:STDOUT: Foo, // CHECK:STDOUT: Main, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, // CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+0, arg1: block0}, diff --git a/toolchain/semantics/testdata/function/definition/fail_param_name_conflict.carbon b/toolchain/semantics/testdata/function/definition/fail_param_name_conflict.carbon index b070cd8061d3..59fc0a4674f6 100644 --- a/toolchain/semantics/testdata/function/definition/fail_param_name_conflict.carbon +++ b/toolchain/semantics/testdata/function/definition/fail_param_name_conflict.carbon @@ -15,6 +15,9 @@ // CHECK:STDOUT: a, // CHECK:STDOUT: Bar, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: nodeIntegerType}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/function/definition/order.carbon b/toolchain/semantics/testdata/function/definition/order.carbon index fdc7906beb61..38f1e9b8dd77 100644 --- a/toolchain/semantics/testdata/function/definition/order.carbon +++ b/toolchain/semantics/testdata/function/definition/order.carbon @@ -18,6 +18,8 @@ // CHECK:STDOUT: Bar, // CHECK:STDOUT: Baz, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, // CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+0, arg1: block0}, diff --git a/toolchain/semantics/testdata/function/definition/params_one.carbon b/toolchain/semantics/testdata/function/definition/params_one.carbon index 53d726ce72f3..06819c2733f1 100644 --- a/toolchain/semantics/testdata/function/definition/params_one.carbon +++ b/toolchain/semantics/testdata/function/definition/params_one.carbon @@ -15,6 +15,9 @@ // CHECK:STDOUT: a, // CHECK:STDOUT: Foo, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: nodeIntegerType}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/function/definition/params_one_comma.carbon b/toolchain/semantics/testdata/function/definition/params_one_comma.carbon index 33d424745092..43c7c96465da 100644 --- a/toolchain/semantics/testdata/function/definition/params_one_comma.carbon +++ b/toolchain/semantics/testdata/function/definition/params_one_comma.carbon @@ -15,6 +15,9 @@ // CHECK:STDOUT: a, // CHECK:STDOUT: Foo, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: nodeIntegerType}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/function/definition/params_two.carbon b/toolchain/semantics/testdata/function/definition/params_two.carbon index 88d923a7d5a8..3e13da4b2f16 100644 --- a/toolchain/semantics/testdata/function/definition/params_two.carbon +++ b/toolchain/semantics/testdata/function/definition/params_two.carbon @@ -16,6 +16,9 @@ // CHECK:STDOUT: b, // CHECK:STDOUT: Foo, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: nodeIntegerType}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/function/definition/params_two_comma.carbon b/toolchain/semantics/testdata/function/definition/params_two_comma.carbon index 0fb4eded972f..b13b71537862 100644 --- a/toolchain/semantics/testdata/function/definition/params_two_comma.carbon +++ b/toolchain/semantics/testdata/function/definition/params_two_comma.carbon @@ -16,6 +16,9 @@ // CHECK:STDOUT: b, // CHECK:STDOUT: Foo, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: nodeIntegerType}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/function/definition/params_zero.carbon b/toolchain/semantics/testdata/function/definition/params_zero.carbon index fed13ce3855f..151d9df57737 100644 --- a/toolchain/semantics/testdata/function/definition/params_zero.carbon +++ b/toolchain/semantics/testdata/function/definition/params_zero.carbon @@ -14,6 +14,8 @@ // CHECK:STDOUT: strings: [ // CHECK:STDOUT: Foo, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, // CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+0, arg1: block0}, diff --git a/toolchain/semantics/testdata/function/definition/same_param_name.carbon b/toolchain/semantics/testdata/function/definition/same_param_name.carbon index 9571c110a3d3..8fbdaddcbe31 100644 --- a/toolchain/semantics/testdata/function/definition/same_param_name.carbon +++ b/toolchain/semantics/testdata/function/definition/same_param_name.carbon @@ -17,6 +17,9 @@ // CHECK:STDOUT: Foo, // CHECK:STDOUT: Bar, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: nodeIntegerType}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/operators/binary_op.carbon b/toolchain/semantics/testdata/operators/binary_op.carbon index b1c504155d6e..2b61b4c5a701 100644 --- a/toolchain/semantics/testdata/operators/binary_op.carbon +++ b/toolchain/semantics/testdata/operators/binary_op.carbon @@ -16,6 +16,9 @@ // CHECK:STDOUT: strings: [ // CHECK:STDOUT: Main, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int0, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/operators/fail_type_mismatch.carbon b/toolchain/semantics/testdata/operators/fail_type_mismatch.carbon index 46843d8fe55d..17ef41ce7c3d 100644 --- a/toolchain/semantics/testdata/operators/fail_type_mismatch.carbon +++ b/toolchain/semantics/testdata/operators/fail_type_mismatch.carbon @@ -16,6 +16,10 @@ // CHECK:STDOUT: strings: [ // CHECK:STDOUT: Main, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: nodeFloatingPointType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int0, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/operators/fail_type_mismatch_once.carbon b/toolchain/semantics/testdata/operators/fail_type_mismatch_once.carbon index 18249bdb707e..a280324e6c66 100644 --- a/toolchain/semantics/testdata/operators/fail_type_mismatch_once.carbon +++ b/toolchain/semantics/testdata/operators/fail_type_mismatch_once.carbon @@ -17,6 +17,10 @@ // CHECK:STDOUT: strings: [ // CHECK:STDOUT: Main, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: nodeFloatingPointType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int0, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/return/fail_type_mismatch.carbon b/toolchain/semantics/testdata/return/fail_type_mismatch.carbon index e60985969ed0..9728408366e4 100644 --- a/toolchain/semantics/testdata/return/fail_type_mismatch.carbon +++ b/toolchain/semantics/testdata/return/fail_type_mismatch.carbon @@ -15,6 +15,10 @@ // CHECK:STDOUT: strings: [ // CHECK:STDOUT: Main, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: nodeFloatingPointType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, // CHECK:STDOUT: {kind: RealLiteral, arg0: real0, type: nodeFloatingPointType}, diff --git a/toolchain/semantics/testdata/return/fail_value_disallowed.carbon b/toolchain/semantics/testdata/return/fail_value_disallowed.carbon index 3fcf7a136792..a33c7dbe99fd 100644 --- a/toolchain/semantics/testdata/return/fail_value_disallowed.carbon +++ b/toolchain/semantics/testdata/return/fail_value_disallowed.carbon @@ -15,6 +15,9 @@ // CHECK:STDOUT: strings: [ // CHECK:STDOUT: Main, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int0, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/return/fail_value_missing.carbon b/toolchain/semantics/testdata/return/fail_value_missing.carbon index ed696477913f..ea77937dd1ab 100644 --- a/toolchain/semantics/testdata/return/fail_value_missing.carbon +++ b/toolchain/semantics/testdata/return/fail_value_missing.carbon @@ -14,6 +14,9 @@ // CHECK:STDOUT: strings: [ // CHECK:STDOUT: Main, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, // CHECK:STDOUT: {kind: Return}, diff --git a/toolchain/semantics/testdata/return/no_value.carbon b/toolchain/semantics/testdata/return/no_value.carbon index c8392357d036..d8821872a1f6 100644 --- a/toolchain/semantics/testdata/return/no_value.carbon +++ b/toolchain/semantics/testdata/return/no_value.carbon @@ -14,6 +14,8 @@ // CHECK:STDOUT: strings: [ // CHECK:STDOUT: Main, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, // CHECK:STDOUT: {kind: Return}, diff --git a/toolchain/semantics/testdata/return/struct.carbon b/toolchain/semantics/testdata/return/struct.carbon index 6050565be446..64c107c5f68b 100644 --- a/toolchain/semantics/testdata/return/struct.carbon +++ b/toolchain/semantics/testdata/return/struct.carbon @@ -16,6 +16,11 @@ // CHECK:STDOUT: a, // CHECK:STDOUT: Main, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: node+1, +// CHECK:STDOUT: node+6, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: StructTypeField, arg0: str0, type: nodeIntegerType}, // CHECK:STDOUT: {kind: StructType, arg0: block2, type: nodeTypeType}, diff --git a/toolchain/semantics/testdata/return/value.carbon b/toolchain/semantics/testdata/return/value.carbon index fece93dc9fd0..ac8785d2da9a 100644 --- a/toolchain/semantics/testdata/return/value.carbon +++ b/toolchain/semantics/testdata/return/value.carbon @@ -15,6 +15,9 @@ // CHECK:STDOUT: strings: [ // CHECK:STDOUT: Main, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int0, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/struct/empty.carbon b/toolchain/semantics/testdata/struct/empty.carbon index 4858554d02c4..50cedb5e0b04 100644 --- a/toolchain/semantics/testdata/struct/empty.carbon +++ b/toolchain/semantics/testdata/struct/empty.carbon @@ -14,6 +14,9 @@ // CHECK:STDOUT: x, // CHECK:STDOUT: y, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeEmptyStructType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: nodeEmptyStructType}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: nodeEmptyStructType}, diff --git a/toolchain/semantics/testdata/struct/fail_assign_empty.carbon b/toolchain/semantics/testdata/struct/fail_assign_empty.carbon index 20afa70accba..c555ee1e9d01 100644 --- a/toolchain/semantics/testdata/struct/fail_assign_empty.carbon +++ b/toolchain/semantics/testdata/struct/fail_assign_empty.carbon @@ -14,6 +14,10 @@ // CHECK:STDOUT: a, // CHECK:STDOUT: x, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: node+1, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: StructTypeField, arg0: str0, type: nodeIntegerType}, // CHECK:STDOUT: {kind: StructType, arg0: block2, type: nodeTypeType}, diff --git a/toolchain/semantics/testdata/struct/fail_assign_to_empty.carbon b/toolchain/semantics/testdata/struct/fail_assign_to_empty.carbon index a7596653ab2c..97088af51bd4 100644 --- a/toolchain/semantics/testdata/struct/fail_assign_to_empty.carbon +++ b/toolchain/semantics/testdata/struct/fail_assign_to_empty.carbon @@ -15,6 +15,11 @@ // CHECK:STDOUT: x, // CHECK:STDOUT: a, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeEmptyStructType, +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: node+5, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: nodeEmptyStructType}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: nodeEmptyStructType}, diff --git a/toolchain/semantics/testdata/struct/fail_field_name_mismatch.carbon b/toolchain/semantics/testdata/struct/fail_field_name_mismatch.carbon index 4bf7c2b6a80e..df11d3ab288f 100644 --- a/toolchain/semantics/testdata/struct/fail_field_name_mismatch.carbon +++ b/toolchain/semantics/testdata/struct/fail_field_name_mismatch.carbon @@ -16,6 +16,11 @@ // CHECK:STDOUT: x, // CHECK:STDOUT: b, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: node+1, +// CHECK:STDOUT: node+7, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: StructTypeField, arg0: str0, type: nodeIntegerType}, // CHECK:STDOUT: {kind: StructType, arg0: block2, type: nodeTypeType}, diff --git a/toolchain/semantics/testdata/struct/fail_field_type_mismatch.carbon b/toolchain/semantics/testdata/struct/fail_field_type_mismatch.carbon index 0332187158f5..e5e5a7664a09 100644 --- a/toolchain/semantics/testdata/struct/fail_field_type_mismatch.carbon +++ b/toolchain/semantics/testdata/struct/fail_field_type_mismatch.carbon @@ -16,6 +16,12 @@ // CHECK:STDOUT: x, // CHECK:STDOUT: b, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: node+1, +// CHECK:STDOUT: nodeFloatingPointType, +// CHECK:STDOUT: node+7, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: StructTypeField, arg0: str0, type: nodeIntegerType}, // CHECK:STDOUT: {kind: StructType, arg0: block2, type: nodeTypeType}, diff --git a/toolchain/semantics/testdata/struct/fail_member_access_type.carbon b/toolchain/semantics/testdata/struct/fail_member_access_type.carbon index c6f76a8c37de..800d56954d13 100644 --- a/toolchain/semantics/testdata/struct/fail_member_access_type.carbon +++ b/toolchain/semantics/testdata/struct/fail_member_access_type.carbon @@ -17,6 +17,12 @@ // CHECK:STDOUT: y, // CHECK:STDOUT: b, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeFloatingPointType, +// CHECK:STDOUT: node+1, +// CHECK:STDOUT: node+7, +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: StructTypeField, arg0: str0, type: nodeFloatingPointType}, // CHECK:STDOUT: {kind: StructType, arg0: block2, type: nodeTypeType}, diff --git a/toolchain/semantics/testdata/struct/fail_non_member_access.carbon b/toolchain/semantics/testdata/struct/fail_non_member_access.carbon index 397345431a28..3efbb353d508 100644 --- a/toolchain/semantics/testdata/struct/fail_non_member_access.carbon +++ b/toolchain/semantics/testdata/struct/fail_non_member_access.carbon @@ -17,6 +17,11 @@ // CHECK:STDOUT: y, // CHECK:STDOUT: b, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: node+1, +// CHECK:STDOUT: node+7, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: StructTypeField, arg0: str0, type: nodeIntegerType}, // CHECK:STDOUT: {kind: StructType, arg0: block2, type: nodeTypeType}, diff --git a/toolchain/semantics/testdata/struct/fail_too_few_values.carbon b/toolchain/semantics/testdata/struct/fail_too_few_values.carbon index 2daee645343c..7db69fbe7e22 100644 --- a/toolchain/semantics/testdata/struct/fail_too_few_values.carbon +++ b/toolchain/semantics/testdata/struct/fail_too_few_values.carbon @@ -16,6 +16,11 @@ // CHECK:STDOUT: b, // CHECK:STDOUT: x, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: node+2, +// CHECK:STDOUT: node+8, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: StructTypeField, arg0: str0, type: nodeIntegerType}, // CHECK:STDOUT: {kind: StructTypeField, arg0: str1, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/struct/fail_type_assign.carbon b/toolchain/semantics/testdata/struct/fail_type_assign.carbon index 8c0f6d00c4d5..50b91fcd226d 100644 --- a/toolchain/semantics/testdata/struct/fail_type_assign.carbon +++ b/toolchain/semantics/testdata/struct/fail_type_assign.carbon @@ -14,6 +14,10 @@ // CHECK:STDOUT: a, // CHECK:STDOUT: x, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: node+1, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: StructTypeField, arg0: str0, type: nodeIntegerType}, // CHECK:STDOUT: {kind: StructType, arg0: block2, type: nodeTypeType}, diff --git a/toolchain/semantics/testdata/struct/fail_value_as_type.carbon b/toolchain/semantics/testdata/struct/fail_value_as_type.carbon index 55d35735a39b..282a727b371d 100644 --- a/toolchain/semantics/testdata/struct/fail_value_as_type.carbon +++ b/toolchain/semantics/testdata/struct/fail_value_as_type.carbon @@ -15,6 +15,10 @@ // CHECK:STDOUT: a, // CHECK:STDOUT: x, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: node+3, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int0, type: nodeIntegerType}, // CHECK:STDOUT: {kind: StructTypeField, arg0: str0, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/struct/member_access.carbon b/toolchain/semantics/testdata/struct/member_access.carbon index 171f9e566d95..d559785c175a 100644 --- a/toolchain/semantics/testdata/struct/member_access.carbon +++ b/toolchain/semantics/testdata/struct/member_access.carbon @@ -19,6 +19,12 @@ // CHECK:STDOUT: y, // CHECK:STDOUT: z, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeFloatingPointType, +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: node+2, +// CHECK:STDOUT: node+11, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: StructTypeField, arg0: str0, type: nodeFloatingPointType}, // CHECK:STDOUT: {kind: StructTypeField, arg0: str1, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/struct/one_entry.carbon b/toolchain/semantics/testdata/struct/one_entry.carbon index b0f487bc0c67..106da884de76 100644 --- a/toolchain/semantics/testdata/struct/one_entry.carbon +++ b/toolchain/semantics/testdata/struct/one_entry.carbon @@ -16,6 +16,12 @@ // CHECK:STDOUT: x, // CHECK:STDOUT: y, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: node+1, +// CHECK:STDOUT: node+7, +// CHECK:STDOUT: node+11, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: StructTypeField, arg0: str0, type: nodeIntegerType}, // CHECK:STDOUT: {kind: StructType, arg0: block2, type: nodeTypeType}, diff --git a/toolchain/semantics/testdata/struct/two_entries.carbon b/toolchain/semantics/testdata/struct/two_entries.carbon index 39292cf6143f..7cd0ed5c3b77 100644 --- a/toolchain/semantics/testdata/struct/two_entries.carbon +++ b/toolchain/semantics/testdata/struct/two_entries.carbon @@ -18,6 +18,12 @@ // CHECK:STDOUT: x, // CHECK:STDOUT: y, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: node+2, +// CHECK:STDOUT: node+11, +// CHECK:STDOUT: node+16, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: StructTypeField, arg0: str0, type: nodeIntegerType}, // CHECK:STDOUT: {kind: StructTypeField, arg0: str1, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/var/decl.carbon b/toolchain/semantics/testdata/var/decl.carbon index aaf15e883ee7..57dc099dde2b 100644 --- a/toolchain/semantics/testdata/var/decl.carbon +++ b/toolchain/semantics/testdata/var/decl.carbon @@ -15,6 +15,9 @@ // CHECK:STDOUT: Main, // CHECK:STDOUT: x, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, // CHECK:STDOUT: {kind: VarStorage, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/var/decl_with_init.carbon b/toolchain/semantics/testdata/var/decl_with_init.carbon index a71ce3c54030..9c8885046eb1 100644 --- a/toolchain/semantics/testdata/var/decl_with_init.carbon +++ b/toolchain/semantics/testdata/var/decl_with_init.carbon @@ -16,6 +16,9 @@ // CHECK:STDOUT: Main, // CHECK:STDOUT: x, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, // CHECK:STDOUT: {kind: VarStorage, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/var/fail_duplicate_decl.carbon b/toolchain/semantics/testdata/var/fail_duplicate_decl.carbon index b3d226cacb24..4ac1a6d51457 100644 --- a/toolchain/semantics/testdata/var/fail_duplicate_decl.carbon +++ b/toolchain/semantics/testdata/var/fail_duplicate_decl.carbon @@ -17,6 +17,9 @@ // CHECK:STDOUT: Main, // CHECK:STDOUT: x, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, // CHECK:STDOUT: {kind: VarStorage, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/var/fail_init_type_mismatch.carbon b/toolchain/semantics/testdata/var/fail_init_type_mismatch.carbon index a294e178d391..d12ddb4dc4eb 100644 --- a/toolchain/semantics/testdata/var/fail_init_type_mismatch.carbon +++ b/toolchain/semantics/testdata/var/fail_init_type_mismatch.carbon @@ -16,6 +16,10 @@ // CHECK:STDOUT: Main, // CHECK:STDOUT: x, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: nodeFloatingPointType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, // CHECK:STDOUT: {kind: VarStorage, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/var/fail_init_with_self.carbon b/toolchain/semantics/testdata/var/fail_init_with_self.carbon index f273594efb01..30b965171676 100644 --- a/toolchain/semantics/testdata/var/fail_init_with_self.carbon +++ b/toolchain/semantics/testdata/var/fail_init_with_self.carbon @@ -15,6 +15,9 @@ // CHECK:STDOUT: Main, // CHECK:STDOUT: x, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, // CHECK:STDOUT: {kind: VarStorage, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/var/fail_lookup_outside_scope.carbon b/toolchain/semantics/testdata/var/fail_lookup_outside_scope.carbon index f21b0fa5ce08..ab7a3ec18f84 100644 --- a/toolchain/semantics/testdata/var/fail_lookup_outside_scope.carbon +++ b/toolchain/semantics/testdata/var/fail_lookup_outside_scope.carbon @@ -16,6 +16,9 @@ // CHECK:STDOUT: x, // CHECK:STDOUT: y, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, // CHECK:STDOUT: {kind: VarStorage, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/var/fail_storage_is_literal.carbon b/toolchain/semantics/testdata/var/fail_storage_is_literal.carbon index d605cefa4daf..3792d3f61ea9 100644 --- a/toolchain/semantics/testdata/var/fail_storage_is_literal.carbon +++ b/toolchain/semantics/testdata/var/fail_storage_is_literal.carbon @@ -17,6 +17,9 @@ // CHECK:STDOUT: Main, // CHECK:STDOUT: x, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int0, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/var/global_decl.carbon b/toolchain/semantics/testdata/var/global_decl.carbon index 820dd0d8ac83..efc90cbe3c28 100644 --- a/toolchain/semantics/testdata/var/global_decl.carbon +++ b/toolchain/semantics/testdata/var/global_decl.carbon @@ -13,6 +13,9 @@ // CHECK:STDOUT: strings: [ // CHECK:STDOUT: x, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: nodeIntegerType}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/var/global_decl_with_init.carbon b/toolchain/semantics/testdata/var/global_decl_with_init.carbon index 6390b172b48e..de8c1209d6b9 100644 --- a/toolchain/semantics/testdata/var/global_decl_with_init.carbon +++ b/toolchain/semantics/testdata/var/global_decl_with_init.carbon @@ -14,6 +14,9 @@ // CHECK:STDOUT: strings: [ // CHECK:STDOUT: x, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: nodeIntegerType}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/var/global_lookup.carbon b/toolchain/semantics/testdata/var/global_lookup.carbon index b0cf73b78e8b..9bee92e41443 100644 --- a/toolchain/semantics/testdata/var/global_lookup.carbon +++ b/toolchain/semantics/testdata/var/global_lookup.carbon @@ -15,6 +15,9 @@ // CHECK:STDOUT: x, // CHECK:STDOUT: y, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: nodeIntegerType}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/var/global_lookup_in_scope.carbon b/toolchain/semantics/testdata/var/global_lookup_in_scope.carbon index da438af568ab..f89b9d6384c7 100644 --- a/toolchain/semantics/testdata/var/global_lookup_in_scope.carbon +++ b/toolchain/semantics/testdata/var/global_lookup_in_scope.carbon @@ -17,6 +17,9 @@ // CHECK:STDOUT: Main, // CHECK:STDOUT: y, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: nodeIntegerType}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: nodeIntegerType}, diff --git a/toolchain/semantics/testdata/var/lookup.carbon b/toolchain/semantics/testdata/var/lookup.carbon index 82a49c90561e..78b9219b4920 100644 --- a/toolchain/semantics/testdata/var/lookup.carbon +++ b/toolchain/semantics/testdata/var/lookup.carbon @@ -16,6 +16,9 @@ // CHECK:STDOUT: Main, // CHECK:STDOUT: x, // CHECK:STDOUT: ] +// CHECK:STDOUT: types: [ +// CHECK:STDOUT: nodeIntegerType, +// CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, // CHECK:STDOUT: {kind: VarStorage, type: nodeIntegerType},