Skip to content

Commit 5594752

Browse files
jnthntatumcopybara-github
authored andcommitted
Minor naming changes to AstImpl for consistency
In a follow-up, we will replace the opaque Ast with AstImpl. PiperOrigin-RevId: 795656660
1 parent a47b990 commit 5594752

15 files changed

+230
-193
lines changed

checker/internal/type_checker_impl.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,8 +1329,9 @@ absl::StatusOr<ValidationResult> TypeCheckerImpl::Check(
13291329
// Happens in a second pass to simplify validating that pointers haven't
13301330
// been invalidated by other updates.
13311331
ResolveRewriter rewriter(visitor, type_inference_context, options_,
1332-
ast_impl.reference_map(), ast_impl.type_map());
1333-
AstRewrite(ast_impl.root_expr(), rewriter);
1332+
ast_impl.mutable_reference_map(),
1333+
ast_impl.mutable_type_map());
1334+
AstRewrite(ast_impl.mutable_root_expr(), rewriter);
13341335

13351336
CEL_RETURN_IF_ERROR(rewriter.status());
13361337

checker/internal/type_checker_impl_test.cc

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,8 @@ TEST_P(PrimitiveLiteralsTest, LiteralsTypeInferred) {
867867
ASSERT_TRUE(result.IsValid());
868868
ASSERT_OK_AND_ASSIGN(auto checked_ast, result.ReleaseAst());
869869
auto& ast_impl = AstImpl::CastFromPublicAst(*checked_ast);
870-
EXPECT_EQ(ast_impl.type_map()[1].primitive(), test_case.expected_type);
870+
EXPECT_EQ(ast_impl.mutable_type_map()[1].primitive(),
871+
test_case.expected_type);
871872
}
872873

873874
INSTANTIATE_TEST_SUITE_P(
@@ -917,7 +918,7 @@ TEST_P(AstTypeConversionTest, TypeConversion) {
917918
ASSERT_TRUE(result.IsValid());
918919
ASSERT_OK_AND_ASSIGN(auto checked_ast, result.ReleaseAst());
919920
auto& ast_impl = AstImpl::CastFromPublicAst(*checked_ast);
920-
EXPECT_EQ(ast_impl.type_map()[1], test_case.expected_type)
921+
EXPECT_EQ(ast_impl.mutable_type_map()[1], test_case.expected_type)
921922
<< GetParam().decl_type.DebugString();
922923
}
923924

@@ -1041,7 +1042,7 @@ TEST(TypeCheckerImplTest, NullLiteral) {
10411042
ASSERT_TRUE(result.IsValid());
10421043
ASSERT_OK_AND_ASSIGN(auto checked_ast, result.ReleaseAst());
10431044
auto& ast_impl = AstImpl::CastFromPublicAst(*checked_ast);
1044-
EXPECT_TRUE(ast_impl.type_map()[1].has_null());
1045+
EXPECT_TRUE(ast_impl.mutable_type_map()[1].has_null());
10451046
}
10461047

10471048
TEST(TypeCheckerImplTest, ExpressionLimitInclusive) {
@@ -1114,7 +1115,7 @@ TEST(TypeCheckerImplTest, BasicOvlResolution) {
11141115
// Assumes parser numbering: + should always be id 2.
11151116
ASSERT_OK_AND_ASSIGN(auto checked_ast, result.ReleaseAst());
11161117
auto& ast_impl = AstImpl::CastFromPublicAst(*checked_ast);
1117-
EXPECT_THAT(ast_impl.reference_map()[2],
1118+
EXPECT_THAT(ast_impl.mutable_reference_map()[2],
11181119
IsFunctionReference(
11191120
"_+_", std::vector<std::string>{"add_double_double"}));
11201121
}
@@ -1138,7 +1139,7 @@ TEST(TypeCheckerImplTest, OvlResolutionMultipleOverloads) {
11381139
// Assumes parser numbering: + should always be id 3.
11391140
ASSERT_OK_AND_ASSIGN(auto checked_ast, result.ReleaseAst());
11401141
auto& ast_impl = AstImpl::CastFromPublicAst(*checked_ast);
1141-
EXPECT_THAT(ast_impl.reference_map()[3],
1142+
EXPECT_THAT(ast_impl.mutable_reference_map()[3],
11421143
IsFunctionReference("_+_", std::vector<std::string>{
11431144
"add_double_double", "add_int_int",
11441145
"add_list", "add_uint_uint"}));
@@ -1164,14 +1165,14 @@ TEST(TypeCheckerImplTest, BasicFunctionResultTypeResolution) {
11641165
// Assumes parser numbering: + should always be id 2 and 4.
11651166
ASSERT_OK_AND_ASSIGN(auto checked_ast, result.ReleaseAst());
11661167
auto& ast_impl = AstImpl::CastFromPublicAst(*checked_ast);
1167-
EXPECT_THAT(ast_impl.reference_map()[2],
1168+
EXPECT_THAT(ast_impl.mutable_reference_map()[2],
11681169
IsFunctionReference(
11691170
"_+_", std::vector<std::string>{"add_double_double"}));
1170-
EXPECT_THAT(ast_impl.reference_map()[4],
1171+
EXPECT_THAT(ast_impl.mutable_reference_map()[4],
11711172
IsFunctionReference(
11721173
"_+_", std::vector<std::string>{"add_double_double"}));
11731174
int64_t root_id = ast_impl.root_expr().id();
1174-
EXPECT_EQ(ast_impl.type_map()[root_id].primitive(),
1175+
EXPECT_EQ(ast_impl.mutable_type_map()[root_id].primitive(),
11751176
ast_internal::PrimitiveType::kDouble);
11761177
}
11771178

@@ -1335,7 +1336,7 @@ TEST(TypeCheckerImplTest, BadSourcePosition) {
13351336
TypeCheckerImpl impl(std::move(env));
13361337
ASSERT_OK_AND_ASSIGN(auto ast, MakeTestParsedAst("foo"));
13371338
auto& ast_impl = AstImpl::CastFromPublicAst(*ast);
1338-
ast_impl.source_info().mutable_positions()[1] = -42;
1339+
ast_impl.mutable_source_info().mutable_positions()[1] = -42;
13391340
ASSERT_OK_AND_ASSIGN(ValidationResult result, impl.Check(std::move(ast)));
13401341
ASSERT_OK_AND_ASSIGN(auto source, NewSource("foo"));
13411342

@@ -1365,7 +1366,7 @@ TEST(TypeCheckerImplTest, FailsIfNoTypeDeduced) {
13651366
// Assume that an unspecified expr kind is not deducible.
13661367
Expr unspecified_expr;
13671368
unspecified_expr.set_id(3);
1368-
ast_impl.root_expr().mutable_call_expr().mutable_args()[1] =
1369+
ast_impl.mutable_root_expr().mutable_call_expr().mutable_args()[1] =
13691370
std::move(unspecified_expr);
13701371

13711372
ASSERT_THAT(impl.Check(std::move(ast)),
@@ -1382,7 +1383,7 @@ TEST(TypeCheckerImplTest, BadLineOffsets) {
13821383
{
13831384
ASSERT_OK_AND_ASSIGN(auto ast, MakeTestParsedAst("\nfoo"));
13841385
auto& ast_impl = AstImpl::CastFromPublicAst(*ast);
1385-
ast_impl.source_info().mutable_line_offsets()[1] = 1;
1386+
ast_impl.mutable_source_info().mutable_line_offsets()[1] = 1;
13861387
ASSERT_OK_AND_ASSIGN(ValidationResult result, impl.Check(std::move(ast)));
13871388

13881389
EXPECT_FALSE(result.IsValid());
@@ -1395,9 +1396,9 @@ TEST(TypeCheckerImplTest, BadLineOffsets) {
13951396
{
13961397
ASSERT_OK_AND_ASSIGN(auto ast, MakeTestParsedAst("\nfoo"));
13971398
auto& ast_impl = AstImpl::CastFromPublicAst(*ast);
1398-
ast_impl.source_info().mutable_line_offsets().clear();
1399-
ast_impl.source_info().mutable_line_offsets().push_back(-1);
1400-
ast_impl.source_info().mutable_line_offsets().push_back(2);
1399+
ast_impl.mutable_source_info().mutable_line_offsets().clear();
1400+
ast_impl.mutable_source_info().mutable_line_offsets().push_back(-1);
1401+
ast_impl.mutable_source_info().mutable_line_offsets().push_back(2);
14011402

14021403
ASSERT_OK_AND_ASSIGN(ValidationResult result, impl.Check(std::move(ast)));
14031404

checker/optional_test.cc

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,8 @@ using ::testing::Not;
4949
using ::testing::Property;
5050
using ::testing::SizeIs;
5151

52-
using AstType = ast_internal::Type;
53-
5452
MATCHER_P(IsOptionalType, inner_type, "") {
55-
const ast_internal::Type& type = arg;
53+
const TypeSpec& type = arg;
5654
if (!type.has_abstract_type()) {
5755
return false;
5856
}
@@ -100,13 +98,13 @@ TEST(OptionalTest, OptSelectDoesNotAnnotateFieldType) {
10098
EXPECT_NE(field_id, 0);
10199

102100
EXPECT_THAT(ast_impl.type_map(), Not(Contains(Key(field_id))));
103-
EXPECT_THAT(ast_impl.GetType(ast_impl.root_expr().id()),
104-
IsOptionalType(AstType(ast_internal::PrimitiveType::kInt64)));
101+
EXPECT_THAT(ast_impl.GetTypeOrDyn(ast_impl.root_expr().id()),
102+
IsOptionalType(TypeSpec(ast_internal::PrimitiveType::kInt64)));
105103
}
106104

107105
struct TestCase {
108106
std::string expr;
109-
testing::Matcher<ast_internal::Type> result_type_matcher;
107+
testing::Matcher<TypeSpec> result_type_matcher;
110108
std::string error_substring;
111109
};
112110

@@ -144,7 +142,7 @@ TEST_P(OptionalTest, Runner) {
144142

145143
int64_t root_id = ast_impl.root_expr().id();
146144

147-
EXPECT_THAT(ast_impl.GetType(root_id), test_case.result_type_matcher)
145+
EXPECT_THAT(ast_impl.GetTypeOrDyn(root_id), test_case.result_type_matcher)
148146
<< "for expression: " << test_case.expr;
149147
}
150148

@@ -153,130 +151,132 @@ INSTANTIATE_TEST_SUITE_P(
153151
::testing::Values(
154152
TestCase{
155153
"optional.of('abc')",
156-
IsOptionalType(AstType(ast_internal::PrimitiveType::kString)),
154+
IsOptionalType(TypeSpec(ast_internal::PrimitiveType::kString)),
157155
},
158156
TestCase{
159157
"optional.ofNonZeroValue('')",
160-
IsOptionalType(AstType(ast_internal::PrimitiveType::kString)),
158+
IsOptionalType(TypeSpec(ast_internal::PrimitiveType::kString)),
161159
},
162160
TestCase{
163161
"optional.none()",
164-
IsOptionalType(AstType(ast_internal::DynamicType())),
162+
IsOptionalType(TypeSpec(ast_internal::DynamicType())),
165163
},
166164
TestCase{
167165
"optional.of('abc').hasValue()",
168-
Eq(AstType(ast_internal::PrimitiveType::kBool)),
166+
Eq(TypeSpec(ast_internal::PrimitiveType::kBool)),
169167
},
170168
TestCase{
171169
"optional.of('abc').value()",
172-
Eq(AstType(ast_internal::PrimitiveType::kString)),
170+
Eq(TypeSpec(ast_internal::PrimitiveType::kString)),
173171
},
174172
TestCase{
175173
"type(optional.of('abc')) == optional_type",
176-
Eq(AstType(ast_internal::PrimitiveType::kBool)),
174+
Eq(TypeSpec(ast_internal::PrimitiveType::kBool)),
177175
},
178176
TestCase{
179177
"type(optional.of('abc')) == optional_type",
180-
Eq(AstType(ast_internal::PrimitiveType::kBool)),
178+
Eq(TypeSpec(ast_internal::PrimitiveType::kBool)),
181179
},
182180
TestCase{
183181
"optional.of('abc').or(optional.of('def'))",
184-
IsOptionalType(AstType(ast_internal::PrimitiveType::kString)),
182+
IsOptionalType(TypeSpec(ast_internal::PrimitiveType::kString)),
185183
},
186184
TestCase{"optional.of('abc').or(optional.of(1))", _,
187185
"no matching overload for 'or'"},
188186
TestCase{
189187
"optional.of('abc').orValue('def')",
190-
Eq(AstType(ast_internal::PrimitiveType::kString)),
188+
Eq(TypeSpec(ast_internal::PrimitiveType::kString)),
191189
},
192190
TestCase{"optional.of('abc').orValue(1)", _,
193191
"no matching overload for 'orValue'"},
194192
TestCase{
195193
"{'k': 'v'}.?k",
196-
IsOptionalType(AstType(ast_internal::PrimitiveType::kString)),
194+
IsOptionalType(TypeSpec(ast_internal::PrimitiveType::kString)),
197195
},
198196
TestCase{"1.?k", _,
199197
"expression of type 'int' cannot be the operand of a select "
200198
"operation"},
201199
TestCase{
202200
"{'k': {'k': 'v'}}.?k.?k2",
203-
IsOptionalType(AstType(ast_internal::PrimitiveType::kString)),
201+
IsOptionalType(TypeSpec(ast_internal::PrimitiveType::kString)),
204202
},
205203
TestCase{
206204
"{'k': {'k': 'v'}}.?k.k2",
207-
IsOptionalType(AstType(ast_internal::PrimitiveType::kString)),
205+
IsOptionalType(TypeSpec(ast_internal::PrimitiveType::kString)),
208206
},
209207
TestCase{"{?'k': optional.of('v')}",
210-
Eq(AstType(ast_internal::MapType(
211-
std::unique_ptr<AstType>(
212-
new AstType(ast_internal::PrimitiveType::kString)),
213-
std::unique_ptr<AstType>(
214-
new AstType(ast_internal::PrimitiveType::kString)))))},
208+
Eq(TypeSpec(ast_internal::MapType(
209+
std::unique_ptr<TypeSpec>(
210+
new TypeSpec(ast_internal::PrimitiveType::kString)),
211+
std::unique_ptr<TypeSpec>(new TypeSpec(
212+
ast_internal::PrimitiveType::kString)))))},
215213
TestCase{"{'k': 'v', ?'k2': optional.none()}",
216-
Eq(AstType(ast_internal::MapType(
217-
std::unique_ptr<AstType>(
218-
new AstType(ast_internal::PrimitiveType::kString)),
219-
std::unique_ptr<AstType>(
220-
new AstType(ast_internal::PrimitiveType::kString)))))},
214+
Eq(TypeSpec(ast_internal::MapType(
215+
std::unique_ptr<TypeSpec>(
216+
new TypeSpec(ast_internal::PrimitiveType::kString)),
217+
std::unique_ptr<TypeSpec>(new TypeSpec(
218+
ast_internal::PrimitiveType::kString)))))},
221219
TestCase{"{'k': 'v', ?'k2': 'v'}", _,
222220
"expected type 'optional_type(string)' but found 'string'"},
223221
TestCase{"[?optional.of('v')]",
224-
Eq(AstType(ast_internal::ListType(std::unique_ptr<AstType>(
225-
new AstType(ast_internal::PrimitiveType::kString)))))},
222+
Eq(TypeSpec(ast_internal::ListType(std::unique_ptr<TypeSpec>(
223+
new TypeSpec(ast_internal::PrimitiveType::kString)))))},
226224
TestCase{"['v', ?optional.none()]",
227-
Eq(AstType(ast_internal::ListType(std::unique_ptr<AstType>(
228-
new AstType(ast_internal::PrimitiveType::kString)))))},
225+
Eq(TypeSpec(ast_internal::ListType(std::unique_ptr<TypeSpec>(
226+
new TypeSpec(ast_internal::PrimitiveType::kString)))))},
229227
TestCase{"['v1', ?'v2']", _,
230228
"expected type 'optional_type(string)' but found 'string'"},
231229
TestCase{"[optional.of(dyn('1')), optional.of('2')][0]",
232-
IsOptionalType(AstType(ast_internal::DynamicType()))},
230+
IsOptionalType(TypeSpec(ast_internal::DynamicType()))},
233231
TestCase{"[optional.of('1'), optional.of(dyn('2'))][0]",
234-
IsOptionalType(AstType(ast_internal::DynamicType()))},
232+
IsOptionalType(TypeSpec(ast_internal::DynamicType()))},
235233
TestCase{"[{1: optional.of(1)}, {1: optional.of(dyn(1))}][0][1]",
236-
IsOptionalType(AstType(ast_internal::DynamicType()))},
234+
IsOptionalType(TypeSpec(ast_internal::DynamicType()))},
237235
TestCase{"[{1: optional.of(dyn(1))}, {1: optional.of(1)}][0][1]",
238-
IsOptionalType(AstType(ast_internal::DynamicType()))},
236+
IsOptionalType(TypeSpec(ast_internal::DynamicType()))},
239237
TestCase{"[optional.of('1'), optional.of(2)][0]",
240-
Eq(AstType(ast_internal::DynamicType()))},
238+
Eq(TypeSpec(ast_internal::DynamicType()))},
241239
TestCase{"['v1', ?'v2']", _,
242240
"expected type 'optional_type(string)' but found 'string'"},
243241
TestCase{"cel.expr.conformance.proto3.TestAllTypes{?single_int64: "
244242
"optional.of(1)}",
245-
Eq(AstType(ast_internal::MessageType(
243+
Eq(TypeSpec(ast_internal::MessageType(
246244
"cel.expr.conformance.proto3.TestAllTypes")))},
247245
TestCase{"[0][?1]",
248-
IsOptionalType(AstType(ast_internal::PrimitiveType::kInt64))},
246+
IsOptionalType(TypeSpec(ast_internal::PrimitiveType::kInt64))},
249247
TestCase{"[[0]][?1][?1]",
250-
IsOptionalType(AstType(ast_internal::PrimitiveType::kInt64))},
248+
IsOptionalType(TypeSpec(ast_internal::PrimitiveType::kInt64))},
251249
TestCase{"[[0]][?1][1]",
252-
IsOptionalType(AstType(ast_internal::PrimitiveType::kInt64))},
250+
IsOptionalType(TypeSpec(ast_internal::PrimitiveType::kInt64))},
253251
TestCase{"{0: 1}[?1]",
254-
IsOptionalType(AstType(ast_internal::PrimitiveType::kInt64))},
252+
IsOptionalType(TypeSpec(ast_internal::PrimitiveType::kInt64))},
255253
TestCase{"{0: {0: 1}}[?1][?1]",
256-
IsOptionalType(AstType(ast_internal::PrimitiveType::kInt64))},
254+
IsOptionalType(TypeSpec(ast_internal::PrimitiveType::kInt64))},
257255
TestCase{"{0: {0: 1}}[?1][1]",
258-
IsOptionalType(AstType(ast_internal::PrimitiveType::kInt64))},
256+
IsOptionalType(TypeSpec(ast_internal::PrimitiveType::kInt64))},
259257
TestCase{"{0: {0: 1}}[?1]['']", _, "no matching overload for '_[_]'"},
260258
TestCase{"{0: {0: 1}}[?1][?'']", _, "no matching overload for '_[?_]'"},
261-
TestCase{"optional.of('abc').optMap(x, x + 'def')",
262-
IsOptionalType(AstType(ast_internal::PrimitiveType::kString))},
263-
TestCase{"optional.of('abc').optFlatMap(x, optional.of(x + 'def'))",
264-
IsOptionalType(AstType(ast_internal::PrimitiveType::kString))},
259+
TestCase{
260+
"optional.of('abc').optMap(x, x + 'def')",
261+
IsOptionalType(TypeSpec(ast_internal::PrimitiveType::kString))},
262+
TestCase{
263+
"optional.of('abc').optFlatMap(x, optional.of(x + 'def'))",
264+
IsOptionalType(TypeSpec(ast_internal::PrimitiveType::kString))},
265265
// Legacy nullability behaviors.
266266
TestCase{"cel.expr.conformance.proto3.TestAllTypes{?null_value: "
267267
"optional.of(0)}",
268-
Eq(AstType(ast_internal::MessageType(
268+
Eq(TypeSpec(ast_internal::MessageType(
269269
"cel.expr.conformance.proto3.TestAllTypes")))},
270270
TestCase{"cel.expr.conformance.proto3.TestAllTypes{?null_value: null}",
271-
Eq(AstType(ast_internal::MessageType(
271+
Eq(TypeSpec(ast_internal::MessageType(
272272
"cel.expr.conformance.proto3.TestAllTypes")))},
273273
TestCase{"cel.expr.conformance.proto3.TestAllTypes{?null_value: "
274274
"optional.of(null)}",
275-
Eq(AstType(ast_internal::MessageType(
275+
Eq(TypeSpec(ast_internal::MessageType(
276276
"cel.expr.conformance.proto3.TestAllTypes")))},
277277
TestCase{"cel.expr.conformance.proto3.TestAllTypes{}.?single_int64 "
278278
"== null",
279-
Eq(AstType(ast_internal::PrimitiveType::kBool))}));
279+
Eq(TypeSpec(ast_internal::PrimitiveType::kBool))}));
280280

281281
class OptionalStrictNullAssignmentTest
282282
: public testing::TestWithParam<TestCase> {};
@@ -315,7 +315,7 @@ TEST_P(OptionalStrictNullAssignmentTest, Runner) {
315315

316316
int64_t root_id = ast_impl.root_expr().id();
317317

318-
EXPECT_THAT(ast_impl.GetType(root_id), test_case.result_type_matcher)
318+
EXPECT_THAT(ast_impl.GetTypeOrDyn(root_id), test_case.result_type_matcher)
319319
<< "for expression: " << test_case.expr;
320320
}
321321

checker/standard_library_test.cc

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ TEST(StandardLibraryTest, ComprehensionResultTypeIsSubstituted) {
135135
const ast_internal::AstImpl& checked_impl =
136136
ast_internal::AstImpl::CastFromPublicAst(*checked_ast);
137137

138-
ast_internal::Type type = checked_impl.GetType(checked_impl.root_expr().id());
138+
ast_internal::Type type =
139+
checked_impl.GetTypeOrDyn(checked_impl.root_expr().id());
139140
EXPECT_TRUE(type.has_primitive() &&
140141
type.primitive() == ast_internal::PrimitiveType::kInt64);
141142
}
@@ -160,8 +161,8 @@ class StdlibTypeVarDefinitionTest
160161

161162
TEST_P(StdlibTypeVarDefinitionTest, DefinesTypeConstants) {
162163
auto ast = std::make_unique<AstImpl>();
163-
ast->root_expr().mutable_ident_expr().set_name(GetParam());
164-
ast->root_expr().set_id(1);
164+
ast->mutable_root_expr().mutable_ident_expr().set_name(GetParam());
165+
ast->mutable_root_expr().set_id(1);
165166

166167
ASSERT_OK_AND_ASSIGN(ValidationResult result,
167168
stdlib_type_checker_->Check(std::move(ast)));
@@ -171,7 +172,7 @@ TEST_P(StdlibTypeVarDefinitionTest, DefinesTypeConstants) {
171172
const auto& checked_impl = AstImpl::CastFromPublicAst(*checked_ast);
172173
EXPECT_THAT(checked_impl.GetReference(1),
173174
Pointee(Property(&Reference::name, GetParam())));
174-
EXPECT_THAT(checked_impl.GetType(1), Property(&AstType::has_type, true));
175+
EXPECT_THAT(checked_impl.GetTypeOrDyn(1), Property(&AstType::has_type, true));
175176
}
176177

177178
INSTANTIATE_TEST_SUITE_P(StdlibTypeVarDefinitions, StdlibTypeVarDefinitionTest,
@@ -185,7 +186,7 @@ INSTANTIATE_TEST_SUITE_P(StdlibTypeVarDefinitions, StdlibTypeVarDefinitionTest,
185186
TEST_F(StandardLibraryDefinitionsTest, DefinesProtoStructNull) {
186187
auto ast = std::make_unique<AstImpl>();
187188

188-
auto& enumerator = ast->root_expr();
189+
auto& enumerator = ast->mutable_root_expr();
189190
enumerator.set_id(4);
190191
enumerator.mutable_select_expr().set_field("NULL_VALUE");
191192
auto& enumeration = enumerator.mutable_select_expr().mutable_operand();
@@ -212,7 +213,7 @@ TEST_F(StandardLibraryDefinitionsTest, DefinesProtoStructNull) {
212213
TEST_F(StandardLibraryDefinitionsTest, DefinesTypeType) {
213214
auto ast = std::make_unique<AstImpl>();
214215

215-
auto& ident = ast->root_expr();
216+
auto& ident = ast->mutable_root_expr();
216217
ident.set_id(1);
217218
ident.mutable_ident_expr().set_name("type");
218219

@@ -224,7 +225,7 @@ TEST_F(StandardLibraryDefinitionsTest, DefinesTypeType) {
224225
const auto& checked_impl = AstImpl::CastFromPublicAst(*checked_ast);
225226
EXPECT_THAT(checked_impl.GetReference(1),
226227
Pointee(Property(&Reference::name, "type")));
227-
EXPECT_THAT(checked_impl.GetType(1), Property(&AstType::has_type, true));
228+
EXPECT_THAT(checked_impl.GetTypeOrDyn(1), Property(&AstType::has_type, true));
228229
}
229230

230231
struct DefinitionsTestCase {

0 commit comments

Comments
 (0)