everywhere: Allow descructuring assignments#1620
Merged
Merged
Conversation
Member
|
Hello! One or more of the commit messages in this PR do not match the Jakt code submission policy, please check the |
Member
|
Very nice, I'll take a more comprehensive look in a bit but generally looks good. |
alimpfard
reviewed
Oct 6, 2025
Comment on lines
+6736
to
+6743
| match expr { | ||
| BinaryOp(lhs, op, rhs) => { | ||
| if op is Assign and lhs is JaktTuple(values) { | ||
| return .typecheck_tuple_assignment(lhs_values: values, rhs, scope_id, safety_mode, span) | ||
| } | ||
| } | ||
| else => {} | ||
| } |
Member
There was a problem hiding this comment.
maybe better as an if?
Suggested change
| match expr { | |
| BinaryOp(lhs, op, rhs) => { | |
| if op is Assign and lhs is JaktTuple(values) { | |
| return .typecheck_tuple_assignment(lhs_values: values, rhs, scope_id, safety_mode, span) | |
| } | |
| } | |
| else => {} | |
| } | |
| if expr is BinaryOp(lhs, op, rhs) and op is Assign and lhs is JaktTuple(values) { | |
| return .typecheck_tuple_assignment(lhs_values: values, rhs, scope_id, safety_mode, span) | |
| } |
robryanx
force-pushed
the
tuple_new
branch
2 times, most recently
from
October 7, 2025 10:05
a5301b9 to
4ec8fb9
Compare
Member
|
Thanks! |
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.
Currently we allow descructuring declarations for example:
This extends so that we can do destrucuting assignments for example:
Additionally we can do nested destructuring for example:
Will add this for declaration destructuring as part of a separate PR.
Note: This is similar to an older PR: #1161
The main difference being that it specifically only allows
VarorJaktTuplefor nesting on the LHS. Also the earlier PR had fairly significant parser changes but this version handles it within the typechecker without introducing parsing changes.