Skip to content

Commit

Permalink
libnixf/Sema: reduce range of with def (#397)
Browse files Browse the repository at this point in the history
  • Loading branch information
inclyc authored Apr 9, 2024
1 parent 0c2cba7 commit 9de8eba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion libnixf/src/Sema/VariableLookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void VariableLookupAnalysis::dfs(const ExprWith &With,
const std::shared_ptr<EnvNode> &Env) {
auto NewEnv = std::make_shared<EnvNode>(Env, EnvNode::DefMap{}, &With);
if (!WithDefs.contains(&With))
WithDefs.insert({&With, std::make_shared<Definition>(&With)});
WithDefs.insert({&With, std::make_shared<Definition>(&With.kwWith())});

if (With.with())
dfs(*With.with(), Env);
Expand Down
2 changes: 2 additions & 0 deletions libnixf/test/Sema/VariableLookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ TEST_F(VLATest, LookupWith) {
VLAResult Result = VLA.query(Var);

ASSERT_EQ(Result.Kind, VLAResultKind::FromWith);
ASSERT_EQ(Result.Def->syntax()->range().lCur().column(), 0);
ASSERT_EQ(Result.Def->syntax()->range().rCur().column(), 4);
}

TEST_F(VLATest, LivenessRec) {
Expand Down

0 comments on commit 9de8eba

Please sign in to comment.