Add resolution diagnostic for multi-output procedure in expression position#1116
Merged
Conversation
…sition When a StaticCall to a multi-output procedure appears in expression position (not as the RHS of an Assign), emit an error diagnostic: the extra outputs would be silently discarded, which is a semantic bug (e.g., error channels lost). The diagnostic is suppressed when the call is the direct RHS of an assignment (where the target count check already validates arity). Includes a test in ResolutionKindTests demonstrating the diagnostic. Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Address review feedback: - Replace coarse inAssignRhs flag with inValueContext that is set when recursing into arguments of StaticCall/PrimitiveOp. This correctly diagnoses nested multi-output calls (e.g., f(multi(1))) while not firing for statement-position calls or direct assignment RHS. - Factor out duplicate staticProcedure/instanceProcedure branches into a single outputCount lookup. Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
These are all value contexts where a multi-output procedure call would silently discard outputs. Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
Contributor
|
How about instead of this PR we look at merging #1121 ? I know this PR is a strict improvement, but I think it might be confusing to temporarily have this code. We'll have to make sure to remove it later as well. Since it's so easy to add a more long term solution, shouldn't we do that? |
keyboardDrummer
approved these changes
May 5, 2026
Contributor
keyboardDrummer
left a comment
There was a problem hiding this comment.
Prefer to wait for #1121, but approving in case you prefer not to wait
ssomayyajula
approved these changes
May 18, 2026
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.
When a StaticCall to a multi-output procedure appears in expression position (not as the RHS of an Assign), emit an error diagnostic: the extra outputs would be silently discarded, which is a semantic bug (e.g., error channels lost).
The diagnostic is suppressed when the call is the direct RHS of an assignment (where the target count check already validates arity).
Includes a test in ResolutionKindTests demonstrating the diagnostic.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.