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

assert!() not working in Procs #1410

Closed
lpawelcz opened this issue May 16, 2024 · 0 comments
Closed

assert!() not working in Procs #1410

lpawelcz opened this issue May 16, 2024 · 0 comments

Comments

@lpawelcz
Copy link
Contributor

lpawelcz commented May 16, 2024

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

copybara-service bot pushed a commit that referenced this issue May 24, 2024
This PR adds a simple proc that forwards the received information from an input channel to an output channel. We found this particular proc surprisingly useful when testing various tools within the toolchain or when reporting bugs.

We used it in:
* #1415
* #1410
* #1392
* #1057

COPYBARA_INTEGRATE_REVIEW=#1416 from antmicro:passthrough 907a62b
PiperOrigin-RevId: 636954688
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant