Tbkka radar59302422 swift 5.2 #29883
Merged
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.
An earlier fix for certain protocol casts inadvertently disabled
the check for a protocol being cast to its own metatype.
This rearranges the code so that identical types always succeed.
It also updates swift_dynamicCastMetatypeUnconditional to
include recent changes to swift_dynamicCastMetatype.
Note: These fixes only apply to debug/non-optimized builds.
Cast optimizations still break a lot of these cases.
Scope: This restores the ability to cast type identifiers (e.g.
T.self
andP.self
) to their direct type (T.Type
andP.Protocol
, respectively). It also ensures thatas!
supports the same behaviors for protocol existentials asas?
does.Resolves SR-12161
Resolves rdar://59302422
Risk: Minor. This comprises two code changes: The first migrates a block of code so that the check for exact type equality always occurs first. The second duplicates a block of code added to
as?
processing back in October 2019 to also be used inas!
handling.Testing: The unit tests have been expanded to provide good coverage of these cases.