Repository navigation
[Test][Relax] Make the purity assertion in test_call_packed able to fail - #21063
Open
VenishPaneliya wants to merge 1 commit into
Open
VenishPaneliya wants to merge 1 commit into
VenishPaneliya wants to merge 1 commit into
Conversation
`assert "is_pure=False"` tests a non-empty string literal, so it always passes and the check its comment describes never runs: the dump could stop emitting the purity attribute, or emit `is_pure=True`, and the test would stay green. The line above it is `assert "ret_ty=AnyType()" in f_str`, so the `in f_str` was dropped.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In
test_call_packed:The second assertion tests a non-empty string literal, so it always passes and the check its comment describes never runs. The dump could stop emitting the purity attribute, or emit
is_pure=True, and the test would stay green. Thein f_strwas dropped; the line directly above shows the intended form.The expected text is right: the function under test is declared
@R.function(pure=False),ast_printer.pyemitsis_purethroughbuild_ast_nodeasf"{field}={value}",relax.Functiondeclaresis_pure: bool, and two assertions in this same file already depend on that rendering — line 223 (assert "is_pure=" in func_str) and line 348 (== "FuncType(params=[],ret=AnyType(),purity=True)").This is the only
PLW0129("asserting on a non-empty string literal will always pass") in the repository.I could not run the test here — it needs a built TVM — so please take the expected-string part on the evidence above rather than on my word; if the dump renders the value differently the assertion will say so immediately in CI. What I did verify is the defect itself: a static check that no assertion in
test_call_packedis a bare string literal and that the purity assertion now tests membership (2 failures before this change, 0 after), plus a reduced copy showing that the current form passes even when the dump saysis_pure=Truewhile the fixed form fails.