-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CS2] Destructuring #4478
[CS2] Destructuring #4478
Changes from 1 commit
59959a6
b9f8f5d
066071f
2e0dab3
a196614
b11ba7f
c5f7279
93c8f8e
8840aa9
7786899
1e6d910
6c814a0
5fc4e19
770ddcd
d110b9a
678e931
60f046e
05c1f46
923b931
bd8cf29
7e81fa0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,13 +150,13 @@ test "@-parameters and splats with constructors", -> | |
eq b, obj.last | ||
|
||
test "destructuring in function definition", -> | ||
(([{a: [b], c}]...) -> | ||
(({a: [b], c}) -> | ||
eq 1, b | ||
eq 2, c | ||
) {a: [1], c: 2} | ||
|
||
context = {} | ||
(([{a: [b, c = 2], @d, e = 4}]...) -> | ||
(({a: [b, c = 2], @d, e = 4}) -> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These tests pass with or without this change. I just thought the revised version was a more realistic test. We could test both versions if you want, but the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So @lydell, do you want me to revert these tests? They pass either way. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They've been like this since 2010. Let's keep them that way. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay. |
||
eq 1, b | ||
eq 2, c | ||
eq @d, 3 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did we need to remove these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So there was a period when I was struggling to get splatted arrays to work as function parameters, and so I modified these tests. Later on I added an exception for this case that just dumped such cases back into the legacy compilation, so now we could revert these test changes. But I think we shouldn’t, because the splat-array wrapper feels like a workaround. The version without the wrapper looks to me much more like something someone would intentionally write.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is acceptable. There are lots of things in programming languages that people never write, but still need to be supported for consistency.