-
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-12486] Value.self is Any.Protocol
broke in 5.1, got bad warning in 5.2
#54927
Comments
Bizarrely, in my source project where I ran into this, my tests all pass with Swift 5.1.5 and as best as I can tell, it's because the |
Oh dear. Behavior changes under optimization with both Swift 5.1.5 and Swift 5.2. When I turn on |
Swift 5.1.5 also changes behavior based on deployment target. With Swift 5.1.5, |
There are two bugs here. The false positive warning is actually a different code path than the runtime cast implementation... |
@swift-ci create |
Lily, Thanks for the report. I'm trying to dig through and figure out what changed and why. As a workaround can you change the original code to `return Value.self == Any.self`? If that works for you, it should actually be a lot faster. |
I believe this is fixed by #31662 |
Nominated for inclusion in Swift 5.3: #32725 |
I believe this is fixed in Swift 5.3. Please let me know if you see any further problems in this area. |
Environment
Swift 5.1.5, Swift 5.2
Additional Detail from JIRA
md5: 868c763c40543f8ea25aec14dbda84d3
Issue Description:
I have some generic code that, in an attempt to check if the generic type is literally
Any
, evaluatesValue.self is Any.Protocol
. This used to work correctly up through Swift 5.0.3. Testing in Swift 5.1.5, this code now always evaluates totrue
, which is a surprise. Testing in Swift 5.2, this code not only evaluates totrue
, but triggers a compiler warning that erroneously claims it will always evaluate tofalse
.The text was updated successfully, but these errors were encountered: