Skip to content

Commit

Permalink
libnixf/Sema: precommit tests for misplaced nested liveness diagnostic
Browse files Browse the repository at this point in the history
  • Loading branch information
inclyc committed Apr 8, 2024
1 parent 05819cd commit e1fb0b8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions libnixf/test/Sema/VariableLookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,18 @@ TEST_F(VLATest, LivenessArg) {
ASSERT_EQ(Diags[0].tags()[0], DiagnosticTag::Faded);
}

TEST_F(VLATest, LivenessNested) {
std::shared_ptr<Node> AST = parse("let y = 1; in x: y: x + y", Diags);
VariableLookupAnalysis VLA(Diags);
VLA.runOnAST(*AST);

ASSERT_EQ(Diags.size(), 1);

ASSERT_EQ(Diags[0].kind(), Diagnostic::DK_DefinitionNotUsed);
// FIXME: this should be place at 'let y = 1;'
ASSERT_EQ(Diags[0].range().lCur().column(), 17);
ASSERT_EQ(Diags[0].tags().size(), 1);
ASSERT_EQ(Diags[0].tags()[0], DiagnosticTag::Faded);
}

} // namespace

0 comments on commit e1fb0b8

Please sign in to comment.