diff --git a/source/ast/expressions/MiscExpressions.cpp b/source/ast/expressions/MiscExpressions.cpp index 1f6a25a54..a9fcba7b5 100644 --- a/source/ast/expressions/MiscExpressions.cpp +++ b/source/ast/expressions/MiscExpressions.cpp @@ -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) diff --git a/tests/unittests/ast/AssertionTests.cpp b/tests/unittests/ast/AssertionTests.cpp index 320575323..b8577ebd3 100644 --- a/tests/unittests/ast/AssertionTests.cpp +++ b/tests/unittests/ast/AssertionTests.cpp @@ -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") {