@@ -4389,52 +4389,7 @@ bool FailureDiagnosis::visitAssignExpr(AssignExpr *assignExpr) {
4389
4389
return false ;
4390
4390
}
4391
4391
4392
-
4393
- // / Return true if this type is known to be an ArrayType.
4394
- static bool isKnownToBeArrayType (Type ty) {
4395
- if (!ty) return false ;
4396
-
4397
- auto bgt = ty->getAs <BoundGenericType>();
4398
- if (!bgt) return false ;
4399
-
4400
- auto &ctx = bgt->getASTContext ();
4401
- return bgt->getDecl () == ctx.getArrayDecl ();
4402
- }
4403
-
4404
4392
bool FailureDiagnosis::visitInOutExpr (InOutExpr *IOE) {
4405
- // If we have a contextual type, it must be an inout type.
4406
- auto contextualType = CS.getContextualType ();
4407
- if (contextualType) {
4408
- // If the contextual type is one of the UnsafePointer<T> types, then the
4409
- // contextual type of the subexpression must be T.
4410
- Type unwrappedType = contextualType;
4411
- if (auto unwrapped = contextualType->getOptionalObjectType ())
4412
- unwrappedType = unwrapped;
4413
-
4414
- if (auto pointerEltType = unwrappedType->getAnyPointerElementType ()) {
4415
-
4416
- // If the element type is Void, then we allow any input type, since
4417
- // everything is convertible to UnsafeRawPointer
4418
- if (pointerEltType->isVoid ())
4419
- contextualType = Type ();
4420
- else
4421
- contextualType = pointerEltType;
4422
-
4423
- // Furthermore, if the subexpr type is already known to be an array type,
4424
- // then we must have an attempt at an array to pointer conversion.
4425
- if (isKnownToBeArrayType (CS.getType (IOE->getSubExpr ()))) {
4426
- contextualType = ArraySliceType::get (contextualType);
4427
- }
4428
- } else if (contextualType->is <InOutType>()) {
4429
- contextualType = contextualType->getInOutObjectType ();
4430
- }
4431
- }
4432
-
4433
- if (!typeCheckChildIndependently (IOE->getSubExpr (), contextualType,
4434
- CS.getContextualTypePurpose (),
4435
- TCC_AllowLValue)) {
4436
- return true ;
4437
- }
4438
4393
return false ;
4439
4394
}
4440
4395
0 commit comments