mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-29 19:44:57 +01:00
Remove default constructor from IndexBase (#2598)
There were some notes about default constructors being required in parse_tree.h, but they don't seem to be. Removing the default constructor forces the explicit `::Invalid` where there's no value immediately being assigned, which works fine for existing code. I think this actually reduces the chance of accidents more than the prior default-construct-as-invalid approach.
This commit is contained in:
@@ -39,11 +39,6 @@ class ParseTreeTest : public ::testing::Test {
|
||||
DiagnosticConsumer& consumer = ConsoleDiagnosticConsumer();
|
||||
};
|
||||
|
||||
TEST_F(ParseTreeTest, DefaultInvalid) {
|
||||
ParseTree::Node node;
|
||||
EXPECT_FALSE(node.is_valid());
|
||||
}
|
||||
|
||||
TEST_F(ParseTreeTest, IsValid) {
|
||||
TokenizedBuffer tokens = GetTokenizedBuffer("");
|
||||
ParseTree tree = ParseTree::Parse(tokens, consumer, /*vlog_stream=*/nullptr);
|
||||
|
||||
Reference in New Issue
Block a user