Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug][slang] Fix recursive property negation check bug #1143

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion source/ast/expressions/MiscExpressions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1005,9 +1005,11 @@ Expression& AssertionInstanceExpression::fromLookup(const Symbol& symbol,

ASTContext bodyContext(*symbolScope, LookupLocation::max);
bodyContext.assertionInstance = &instance;
// Propagate previously founded time advance specs
// Propagate previously founded time advance specs and negation operators
if (context.flags.has(ASTFlags::PropertyTimeAdvance))
bodyContext.flags |= ASTFlags::PropertyTimeAdvance;
if (context.flags.has(ASTFlags::PropertyNegation))
bodyContext.flags |= ASTFlags::PropertyNegation;

// Let declarations expand directly to an expression.
if (symbol.kind == SymbolKind::LetDecl)
Expand Down
9 changes: 5 additions & 4 deletions tests/unittests/ast/AssertionTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1119,13 +1119,14 @@ endmodule
compilation.addSyntaxTree(tree);

auto& diags = compilation.getAllDiagnostics();
REQUIRE(diags.size() == 6);
REQUIRE(diags.size() == 7);
CHECK(diags[0].code == diag::RecursivePropNegation);
CHECK(diags[1].code == diag::RecursivePropDisableIff);
CHECK(diags[2].code == diag::RecursivePropTimeAdvance);
CHECK(diags[3].code == diag::RecursivePropArgExpr);
CHECK(diags[1].code == diag::RecursivePropNegation);
CHECK(diags[2].code == diag::RecursivePropDisableIff);
CHECK(diags[3].code == diag::RecursivePropTimeAdvance);
CHECK(diags[4].code == diag::RecursivePropArgExpr);
CHECK(diags[5].code == diag::RecursivePropArgExpr);
CHECK(diags[6].code == diag::RecursivePropArgExpr);
}

TEST_CASE("Illegal concurrent assertions in action blocks") {
Expand Down