[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:
Doug Gregor
2019-03-01 09:45:24 -08:00
parent 1b2b6f92e8
commit 4097428df9
2 changed files with 19 additions and 3 deletions

View File

@@ -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) {