Skip to content

Commit

Permalink
[bug][slang] Fix recursive property negation check bug (#1143)
Browse files Browse the repository at this point in the history
  • Loading branch information
likeamahoney authored Oct 5, 2024
1 parent 85f61c6 commit e85f944
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
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

0 comments on commit e85f944

Please sign in to comment.