-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SILGen] Don't crash when calling a generic init with default args. #7169
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
Conversation
In cases where a default value is used for a parameter with generic type, the argument list might be empty. In that case, we don't need to emit any arguments!
@swift-ci Please test |
Why is this specific to generic arguments? |
Why didn't this happen when calling things other than initializers? I think this warrants further investigation. |
That's fair, but I'm not qualified to do it. Want a Radar? |
What was the actual crash you saw? |
|
Really I'm just trying to get #7156 in, because this isn't a regression. :-/ |
That looks like something is not lining up. We should not be claiming a parameter if we don't need to. Go ahead and file a JIRA and assign it to me, I need to rework that code some time soon for generic subscripts anyway. |
Mmk. What do you want me to do for now? Land this because it fixes a crash? Or take the problematic test case out of #7156 for now? |
Filed SR-3808. |
I think landing this for now is OK |
All right. Thanks for the review, and the push to file the follow-up bug! |
I agree, FWIW, this looks like a reasonable spot fix for 3.1. |
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.
LGTM
…wiftlang#7169) In cases where a default value is used for a parameter with generic type, the argument list might be empty. In that case, we don't need to emit any arguments!
…ed initializer (#7171) * [SILGen] Don't crash when calling a generic init with default args. (#7169) In cases where a default value is used for a parameter with generic type, the argument list might be empty. In that case, we don't need to emit any arguments! * Fix ParameterList::clone to handle deserialized defaults arguments. (#7156) It was checking the wrong predicate, and therefore failing to mark inherited default arguments as actually being inherited. While here, explicitly clear out default arguments from non-inherited cloned parameter lists. I don't think this case can come up today, but it's better to be correct when we do hit it. rdar://problem/30167924
In cases where a default value is used for a parameter with generic type, the argument list might be empty. In that case, we don't need to emit any arguments!
Fixes a crash that came up when writing test cases for #7156.