mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Constraint solver] Declarations with IUOs don’t have effective overload types
A declaration with an implicitly-unwrapped optional essentially has two effective overload types, because the result might be optional or it might have been forced. Disable computation of the effective overload type in this case.
This commit is contained in:
@@ -1488,6 +1488,11 @@ Type ConstraintSystem::getEffectiveOverloadType(const OverloadChoice &overload,
|
||||
if (isa<TypeDecl>(decl))
|
||||
return Type();
|
||||
|
||||
// Declarations returning unwrapped optionals don't have a single effective
|
||||
// type.
|
||||
if (decl->getAttrs().hasAttribute<ImplicitlyUnwrappedOptionalAttr>())
|
||||
return Type();
|
||||
|
||||
// Retrieve the interface type.
|
||||
auto type = decl->getInterfaceType();
|
||||
if (!type) {
|
||||
|
||||
Reference in New Issue
Block a user