mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #30251 from hborla/invalid-optional-chaining
[ConstraintSystem] Don't assume the lhs type is for a generic parameter in simplifyConformsToConstraint.
This commit is contained in:
@@ -5175,11 +5175,12 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyConformsToConstraint(
|
||||
// collection type couldn't be determined without unification to
|
||||
// `Any` and `+` failing for all numeric overloads is just a consequence.
|
||||
if (typeVar && type->isAny()) {
|
||||
auto *GP = typeVar->getImpl().getGenericParameter();
|
||||
if (auto *GPD = GP->getDecl()) {
|
||||
auto *DC = GPD->getDeclContext();
|
||||
if (DC->isTypeContext() && DC->getSelfInterfaceType()->isEqual(GP))
|
||||
return SolutionKind::Error;
|
||||
if (auto *GP = typeVar->getImpl().getGenericParameter()) {
|
||||
if (auto *GPD = GP->getDecl()) {
|
||||
auto *DC = GPD->getDeclContext();
|
||||
if (DC->isTypeContext() && DC->getSelfInterfaceType()->isEqual(GP))
|
||||
return SolutionKind::Error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user