Skip to content

assert!() not working in Procs #1410

Closed
Closed
@lpawelcz

Description

@lpawelcz

Describe the bug
It looks like assert!() builtin is not working when it is used in Procs.

Recently, the constructs similar to:

if (false_predicate) {
    fail!();
} else {
}

became discouraged in favor of assert!(). The toolchain generates a warning when such construct is detected and advises to switch to assert!().
During the work on #1315, after we converted some of the fail!() to assert!() we noticed that those are no longer triggered in our DSLX tests.

We see that assert!() is tested thoroughly in the context of DSLX functions, but there is no test in the context of a Proc.
I've put up a negative test case that reproduces our problem. It consists of a simple passthrough proc and a test proc. In the body of next() there's an assert!() with a false predicate that should always trigger an Interpreter failure just as it is done when we switch the assert to fail!().

To Reproduce
Steps to reproduce the behavior:

  1. Apply the following patch:
    assert_in_proc_diff.txt
  2. run
bazel test //xls/dslx/tests/errors:error_modules_test
  1. Observe failing negative test case due to assert_with_false_predicate_proc.x test proc finishing successfully without triggering the assert!()

Expected behavior
DSLX Interpreter should report failure when encountering assert!() with false predicate in all occurrences.

Additional context
Test case for reproducing the issue is available on branch: antmicro/assert-in-proc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions