IDE: Remove bogus use of getCanonicalTypeInContext() #38359
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.
The GenericSig might come from a protocol extension.
The original types in the Requirement come from this generic signature.
However, the Requirement can then be substituted with the base type's
concrete substitutions, and if the base type is a conforming nominal
type, we now have a Requirement whose types are written in terms of
the conforming nominal type's generic signature.
Therefore, the call to getCanonicalTypeInContext() might not produce
correct results, since there's no guarantee the protocol extension's
GenericSignature has the same requirements as the conforming type's.
This used to just silently produce incorrect results, but now asserts
when the RequirementMachine is enabled.
To fix this I replaced these calls with plain old getCanonicalType()
that does not take a GenericSignature.
If we find a case that is now broken as a result of this change, we'll
need to re-introduce some bookkeeping here to keep track of which
GenericSignature generates the types in the substituted Requirement.