-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[SR-2603] Crash with default function parameter body #45208
Comments
Reduced:
|
@slavapestov, you've been working with generics a lot lately. Any ideas? |
Comment by Myke Olson (JIRA) @swift-ci create |
This is weird, why do we have AnyHashable showing up here?
|
If I change 'T : Hashable' to 'T : Equatable', there's no problem, so there's some kind of 'erase type variable to AnyHashable' thing that's kicking in erroneously. |
Here's the culprit in CSSimplify.cpp:
|
For some reason, we pick the AnyHashable:== overload, instead of Equatable:==, even though the former requires a conversion. We don't even consider Equatable:== at all. |
@DougGregor or @rudkx any ideas? |
This has nothing to do with default arguments either:
|
This works, but if I omit the type annotations on x and y, it fails:
So when we're inferring argument types for the closure, we prefer non-generic ones for some reason? |
So I realized there really is a bug here, SILGen needs to be able to emit a archetype to AnyHashable erasure, because you can request one with a function cast. However, the other issue in overload resolution is still worth investigating. |
Attachment: Download
Additional Detail from JIRA
md5: 920e64667a2bdec078d83b2a065cd016
Issue Description:
I get the following crash in the Xcode 8 GM (which did not occur in prior Xcode betas):
The text was updated successfully, but these errors were encountered: