File tree Expand file tree Collapse file tree 2 files changed +4
-16
lines changed Expand file tree Collapse file tree 2 files changed +4
-16
lines changed Original file line number Diff line number Diff line change @@ -1402,10 +1402,8 @@ shouldOpenExistentialCallArgument(
1402
1402
if (param->isVariadic() && !param->getVarargBaseTy()->hasTypeSequence())
1403
1403
return None;
1404
1404
1405
- // Look through an inout and optional types on the formal type of the
1406
- // parameter.
1407
- auto formalParamTy = param->getInterfaceType()->getInOutObjectType()
1408
- ->lookThroughSingleOptionalType();
1405
+ // Look through an inout type on the formal type of the parameter.
1406
+ auto formalParamTy = param->getInterfaceType()->getInOutObjectType();
1409
1407
1410
1408
// If the argument is of an existential metatype, look through the
1411
1409
// metatype on the parameter.
@@ -1414,8 +1412,8 @@ shouldOpenExistentialCallArgument(
1414
1412
paramTy = paramTy->getMetatypeInstanceType();
1415
1413
}
1416
1414
1417
- // Look through an inout and optional types on the parameter.
1418
- paramTy = paramTy->getInOutObjectType()->lookThroughSingleOptionalType() ;
1415
+ // Look through an inout type on the parameter.
1416
+ paramTy = paramTy->getInOutObjectType();
1419
1417
1420
1418
// The parameter type must be a type variable.
1421
1419
auto paramTypeVar = paramTy->getAs<TypeVariableType>();
Original file line number Diff line number Diff line change @@ -159,16 +159,6 @@ func passesInOut(i: Int) {
159
159
takesInOut ( & p)
160
160
}
161
161
162
- func takesOptional< T: P > ( _ value: T ? ) { }
163
- // expected-note@-1{{required by global function 'takesOptional' where 'T' = 'P'}}
164
-
165
- func passesToOptional( p: any P , pOpt: ( any P ) ? ) {
166
- takesOptional ( p) // okay
167
- takesOptional ( pOpt) // expected-error{{protocol 'P' as a type cannot conform to the protocol itself}}
168
- // expected-note@-1{{only concrete types such as structs, enums and classes can conform to protocols}}
169
- }
170
-
171
-
172
162
@available ( SwiftStdlib 5 . 1 , * )
173
163
func testReturningOpaqueTypes( p: any P ) {
174
164
let q = p. getQ ( )
You can’t perform that action at this time.
0 commit comments