mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Sema: Better fix for banning the '() -> T' => '() -> ()?' implicit conversion
Previously we would check TMF_UnwrappingOptional flag, which does not stick with the constraint, so it would not always persist. Now, add a new OptionalPayload locator element, which is more correct. Fixes <rdar://problem/30429709>.
This commit is contained in:
@@ -3874,7 +3874,8 @@ ConstraintSystem::simplifyRestrictedConstraintImpl(
|
||||
if (generic2->getDecl()->classifyAsOptionalType()) {
|
||||
return matchTypes(type1, generic2->getGenericArgs()[0],
|
||||
matchKind, (subflags | TMF_UnwrappingOptional),
|
||||
locator);
|
||||
locator.withPathElement(
|
||||
ConstraintLocator::OptionalPayload));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user