Repository navigation
Forward pointer-union wraps of call arguments to the callee's parameter proof - #2048
Merged
Merged
Conversation
…er proof A call argument that wraps a binding into a nullable-pointer union passes the binding's pointer itself. The call-lifetimes analysis now treats it like the bare binding, so a record or instance passed to a `T | undefined` parameter that is only projected keeps its frame storage and result slot.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
… narrowed payload A union parameter's proof covered the union, not its payload: narrowing it and storing, returning or pushing the result, a narrowed nullish read, and a store into a nullable-pointer field all counted as projections. That holds for a boxed union, whose payload is a separate object. A record passed through a nullable-pointer union is that payload, so forwarding it to such a callee let a record in its caller's frame escape the frame. A pointer-wrapped argument now needs a second fact from the callee's union parameter: its payload stays in place too. The payload is in place when it is only tested, narrowed for a field read (directly or through the checked narrowing a field read of a `T | undefined` parameter compiles to), or passed on to a parameter that is proved in turn. The facts that other arguments use are unchanged. Corpus 7663 has callees that push (directly and through a non-null assertion), default, store in a global record field or a class field, or pass on the narrowed record, and one that only reads it.
This branch was successfully 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.
T | undefined,T | null) passes its pointer unchanged, so the call-lifetimes analysis now forwards it to the callee's parameter proof like the bare binding; callees that only read the argument let it keep its frame storage and result slot.