@@ -33,29 +33,29 @@ TEST(IdsTest, LocIdValues) {
3333 Eq (-(1 << 30 ) + 1 ));
3434}
3535
36- // A standard parameterized test for (implicit , index).
36+ // A standard parameterized test for (is_desugared , index).
3737class IdsTestWithParam
3838 : public testing::TestWithParam<std::tuple<bool , int32_t >> {
3939 public:
4040 explicit IdsTestWithParam () {
41- llvm::errs () << " implicit =" << is_implicit ()
42- << " , index= " << std::get< 1 >( GetParam ()) << " \n " ;
41+ llvm::errs () << " is_desugared =" << is_desugared () << " , index= " << index ()
42+ << " \n " ;
4343 }
4444
4545 // Returns IdT with its matching LocId form. Sets flags based on test
4646 // parameters.
4747 template <typename IdT>
4848 auto BuildIdAndLocId () -> std::pair<IdT, LocId> {
49- auto [implicit, index] = GetParam ( );
50- IdT id (index);
51- LocId loc_id (id);
52- if (implicit) {
53- loc_id = loc_id. ToImplicit () ;
49+ IdT id ( index () );
50+ if ( is_desugared ()) {
51+ return {id, LocId (id). AsDesugared ()} ;
52+ } else {
53+ return {id, LocId (id)} ;
5454 }
55- return {id, loc_id};
5655 }
5756
58- auto is_implicit () -> bool { return std::get<0 >(GetParam ()); }
57+ auto is_desugared () -> bool { return std::get<0 >(GetParam ()); }
58+ auto index () -> int32_t { return std::get<1 >(GetParam ()); }
5959};
6060
6161// Returns a test case generator for edge-case values.
@@ -78,7 +78,7 @@ TEST_P(LocIdAsNoneTestWithParam, Test) {
7878 auto [_, loc_id] = BuildIdAndLocId<Parse::NodeId>();
7979 EXPECT_FALSE (loc_id.has_value ());
8080 EXPECT_THAT (loc_id.kind (), Eq (LocId::Kind::None));
81- EXPECT_FALSE (loc_id.is_implicit ());
81+ EXPECT_FALSE (loc_id.is_desugared ());
8282 EXPECT_THAT (loc_id.import_ir_inst_id (), Eq (ImportIRInstId::None));
8383 EXPECT_THAT (loc_id.inst_id (), Eq (InstId::None));
8484 EXPECT_THAT (loc_id.node_id (),
@@ -96,7 +96,7 @@ TEST_P(LocIdAsImportIRInstIdTest, Test) {
9696 EXPECT_TRUE (loc_id.has_value ());
9797 ASSERT_THAT (loc_id.kind (), Eq (LocId::Kind::ImportIRInstId));
9898 EXPECT_THAT (loc_id.import_ir_inst_id (), import_ir_inst_id);
99- EXPECT_FALSE (loc_id.is_implicit ());
99+ EXPECT_FALSE (loc_id.is_desugared ());
100100}
101101
102102class LocIdAsInstIdTest : public IdsTestWithParam {};
@@ -111,7 +111,7 @@ TEST_P(LocIdAsInstIdTest, Test) {
111111 EXPECT_TRUE (loc_id.has_value ());
112112 ASSERT_THAT (loc_id.kind (), Eq (LocId::Kind::InstId));
113113 EXPECT_THAT (loc_id.inst_id (), inst_id);
114- // Note that `is_implicit ` is invalid to use with `InstId`.
114+ // Note that `is_desugared ` is invalid to use with `InstId`.
115115}
116116
117117class LocIdAsNodeIdTest : public IdsTestWithParam {};
@@ -124,7 +124,7 @@ TEST_P(LocIdAsNodeIdTest, Test) {
124124 EXPECT_TRUE (loc_id.has_value ());
125125 ASSERT_THAT (loc_id.kind (), Eq (LocId::Kind::NodeId));
126126 EXPECT_THAT (loc_id.node_id (), node_id);
127- EXPECT_THAT (loc_id.is_implicit (), Eq (is_implicit ()));
127+ EXPECT_THAT (loc_id.is_desugared (), Eq (is_desugared ()));
128128}
129129
130130} // namespace
0 commit comments