mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #61321 from DougGregor/open-existential-for-optional-param
This commit is contained in:
@@ -1620,8 +1620,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.
|
||||
@@ -1630,8 +1632,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