Repository navigation
test(ts): replace through a pointer with the old value unread - #380
Merged
Merged
Conversation
The quest's TS6133 doesn't reproduce: an unread result of ptr::replace lowers to a bare statement naming the old value, which tsc counts as a read, as it did when the quest was filed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 42 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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.
Problem
Quest
m3/ts-ptr-replace-unreadsaidptr::replacewith an unread result, such aslet _ = p.replace(1), leavesconst oldunread andtscrefuses it (TS6133). That doesn't reproduce. No PR fixed it: the output was the same at #339, the PR that filed the quest. The mapping ints/src/lower/pointer.rshasn't changed since then.An unread call result is lowered to a bare statement naming the old value (
old;).tsccounts that as a read, even under the fixture'snoUnusedLocals. Thetscgate from #376 also leaves unused names out, so it could not have caught this either way. I tried a named unused binding,let _, a bare statement, and a call in a branch, through pointers to a number, au8, and an object. All type-check, both atmainand at #339's merge.Approach
Delete the quest and add the missing coverage:
pointers::placesnow replaces through a pointer to a number, to a struct, and to a[u8; 2]with the result unread. Those are the three pointee kinds (Place,Object,Bytes). The lang fixture type-checks them withnoUnusedLocalsand runs them differentially against native wasm32. No existing case discarded aptr::replaceresult.Impact
Alternatives
mem::replaceandOption::takedo. The bareold;statement is dead code, but it's valid and has the correct semantics. Dropping it would be an output-size tweak with no current consumer, so I left it out.ptr::replaceresult goes unread.Follow-ups
None.
Review
quest reviewround 1.🤖 Generated with Claude Code