mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Allow existential opening for parameters of optional type.
This commit is contained in:
@@ -1584,8 +1584,10 @@ shouldOpenExistentialCallArgument(
|
||||
if (param->isVariadic())
|
||||
return None;
|
||||
|
||||
// Look through an inout type on the formal type of the parameter.
|
||||
auto formalParamTy = param->getInterfaceType()->getInOutObjectType();
|
||||
// Look through an inout and optional types on the formal type of the
|
||||
// parameter.
|
||||
auto formalParamTy = param->getInterfaceType()->getInOutObjectType()
|
||||
->lookThroughSingleOptionalType();
|
||||
|
||||
// If the argument is of an existential metatype, look through the
|
||||
// metatype on the parameter.
|
||||
@@ -1594,8 +1596,8 @@ shouldOpenExistentialCallArgument(
|
||||
paramTy = paramTy->getMetatypeInstanceType();
|
||||
}
|
||||
|
||||
// Look through an inout type on the parameter.
|
||||
paramTy = paramTy->getInOutObjectType();
|
||||
// Look through an inout and optional types on the parameter.
|
||||
paramTy = paramTy->getInOutObjectType()->lookThroughSingleOptionalType();
|
||||
|
||||
// The parameter type must be a type variable.
|
||||
auto paramTypeVar = paramTy->getAs<TypeVariableType>();
|
||||
|
||||
Reference in New Issue
Block a user