Skip to content

Commit

Permalink
libnixf/Sema: fix builtin asserts (#398)
Browse files Browse the repository at this point in the history
  • Loading branch information
inclyc authored Apr 9, 2024
1 parent bd52a54 commit 0c2cba7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion libnixf/include/nixf/Sema/VariableLookup.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Definition {

void usedBy(const ExprVar &User) { Uses.emplace_back(&User); }

[[nodiscard]] bool isBuiltin() const { return Syntax; }
[[nodiscard]] bool isBuiltin() const { return !Syntax; }
};

/// \brief A set of variable definitions, which may inherit parent environment.
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 @@ -46,6 +46,7 @@ TEST_F(VLATest, DefinedBuiltin) {
VLAResult Result = VLA.query(Var);

ASSERT_EQ(Result.Kind, VLAResultKind::Defined);
ASSERT_TRUE(Result.Def->isBuiltin());
}

TEST_F(VLATest, LookupLambda) {
Expand All @@ -61,6 +62,7 @@ TEST_F(VLATest, LookupLambda) {
VLAResult Result = VLA.query(Var);

ASSERT_EQ(Result.Kind, VLAResultKind::Defined);
ASSERT_FALSE(Result.Def->isBuiltin());
}

TEST_F(VLATest, LookupAttrs) {
Expand Down

0 comments on commit 0c2cba7

Please sign in to comment.