[4.2-04-30-2018] [SILGen] Ensure type params in witness method conformances match the witness method signatures. #16518
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.
Explanation: A class conditionally conforming to a protocol and using a default method for one of the requirements, would result in an incorrect signature (at the LLVM/asm level) for the thunk for the witness for that requirement. These are called dynamically, and so would result in crashes/undefined behaviour at runtime if things from the conditional requirements were used (e.g. calling a method on a
T
inextension Class: P where T: Q
).Scope: Any class conforming to a protocol as above is at high risk of this.
Radar: rdar://problem/40078863.
Risk: Low: this is, essentially, just changing a type parameter from the incorrect default to the correct one, without modifying anything around it.
Testing: Test suite plus source compatibility suite
Reviewer: @DougGregor
#16493 #16514