mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #58531 from xedin/rdar-92327807
[CSSimplify] Don't attempt to synthesize ~= for optional base types
This commit is contained in:
@@ -9216,17 +9216,21 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyMemberConstraint(
|
||||
dyn_cast<EnumElementPattern>(patternLoc->getPattern())) {
|
||||
auto enumType = baseObjTy->getMetatypeInstanceType();
|
||||
|
||||
// If the synthesis of ~= resulted in errors (i.e. broken stdlib)
|
||||
// that would be diagnosed inline, so let's just fall through and
|
||||
// let this situation be diagnosed as a missing member.
|
||||
auto hadErrors = inferEnumMemberThroughTildeEqualsOperator(
|
||||
// Optional base type does not trigger `~=` synthesis, but it tries
|
||||
// to find member on both `Optional` and its wrapped type.
|
||||
if (!enumType->getOptionalObjectType()) {
|
||||
// If the synthesis of ~= resulted in errors (i.e. broken stdlib)
|
||||
// that would be diagnosed inline, so let's just fall through and
|
||||
// let this situation be diagnosed as a missing member.
|
||||
auto hadErrors = inferEnumMemberThroughTildeEqualsOperator(
|
||||
*this, enumElement, enumType, memberTy, locator);
|
||||
|
||||
// Let's consider current member constraint solved because it's
|
||||
// replaced by a new set of constraints that would resolve member
|
||||
// type.
|
||||
if (!hadErrors)
|
||||
return SolutionKind::Solved;
|
||||
// Let's consider current member constraint solved because it's
|
||||
// replaced by a new set of constraints that would resolve member
|
||||
// type.
|
||||
if (!hadErrors)
|
||||
return SolutionKind::Solved;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user