@@ -1258,8 +1258,8 @@ ManagedValue Conversion::emit(SILGenFunction &SGF, SILLocation loc,
12581258 case AnyErasure:
12591259 case BridgingSubtype:
12601260 case Subtype:
1261- return SGF.emitTransformedValue (loc, value, getBridgingSourceType (),
1262- getBridgingResultType (), C);
1261+ return SGF.emitTransformedValue (loc, value, getSourceType (),
1262+ getResultType (), C);
12631263
12641264 case ForceOptional: {
12651265 auto &optTL = SGF.getTypeLowering (value.getType ());
@@ -1270,32 +1270,30 @@ ManagedValue Conversion::emit(SILGenFunction &SGF, SILLocation loc,
12701270
12711271 case BridgeToObjC:
12721272 return SGF.emitNativeToBridgedValue (loc, value,
1273- getBridgingSourceType (),
1274- getBridgingResultType (),
1275- getBridgingLoweredResultType (), C);
1273+ getSourceType (),
1274+ getResultType (),
1275+ getLoweredResultType (), C);
12761276
12771277 case ForceAndBridgeToObjC: {
12781278 auto &tl = SGF.getTypeLowering (value.getType ());
1279- auto sourceValueType = getBridgingSourceType ().getOptionalObjectType ();
1279+ auto sourceValueType = getSourceType ().getOptionalObjectType ();
12801280 value = SGF.emitCheckedGetOptionalValueFrom (loc, value,
12811281 /* isImplicitUnwrap*/ true ,
12821282 tl, SGFContext ());
12831283 return SGF.emitNativeToBridgedValue (loc, value, sourceValueType,
1284- getBridgingResultType (),
1285- getBridgingLoweredResultType (), C);
1284+ getResultType (),
1285+ getLoweredResultType (), C);
12861286 }
12871287
12881288 case BridgeFromObjC:
12891289 return SGF.emitBridgedToNativeValue (loc, value,
1290- getBridgingSourceType (),
1291- getBridgingResultType (),
1292- getBridgingLoweredResultType (), C);
1290+ getSourceType (), getResultType (),
1291+ getLoweredResultType (), C);
12931292
12941293 case BridgeResultFromObjC:
12951294 return SGF.emitBridgedToNativeValue (loc, value,
1296- getBridgingSourceType (),
1297- getBridgingResultType (),
1298- getBridgingLoweredResultType (), C,
1295+ getSourceType (), getResultType (),
1296+ getLoweredResultType (), C,
12991297 /* isResult*/ true );
13001298
13011299 case Reabstract:
@@ -1328,9 +1326,9 @@ Conversion::adjustForInitialOptionalInjection() const {
13281326 case Subtype:
13291327 return OptionalInjectionConversion::forValue (
13301328 getSubtype (
1331- getBridgingSourceType ().getOptionalObjectType (),
1332- getBridgingResultType ().getOptionalObjectType (),
1333- getBridgingLoweredResultType ().getOptionalObjectType ())
1329+ getSourceType ().getOptionalObjectType (),
1330+ getResultType ().getOptionalObjectType (),
1331+ getLoweredResultType ().getOptionalObjectType ())
13341332 );
13351333
13361334 // TODO: can these actually happen?
@@ -1344,9 +1342,8 @@ Conversion::adjustForInitialOptionalInjection() const {
13441342 case BridgeFromObjC:
13451343 case BridgeResultFromObjC:
13461344 return OptionalInjectionConversion::forInjection (
1347- getBridging (getKind (), getBridgingSourceType ().getOptionalObjectType (),
1348- getBridgingResultType (),
1349- getBridgingLoweredResultType (),
1345+ getBridging (getKind (), getSourceType ().getOptionalObjectType (),
1346+ getResultType (), getLoweredResultType (),
13501347 isBridgingExplicit ())
13511348 );
13521349 }
@@ -1371,8 +1368,7 @@ Conversion::adjustForInitialOptionalConversions(CanType newSourceType) const {
13711368 case BridgeFromObjC:
13721369 case BridgeResultFromObjC:
13731370 return Conversion::getBridging (getKind (), newSourceType,
1374- getBridgingResultType (),
1375- getBridgingLoweredResultType (),
1371+ getResultType (), getLoweredResultType (),
13761372 isBridgingExplicit ());
13771373 }
13781374 llvm_unreachable (" bad kind" );
@@ -1391,12 +1387,10 @@ std::optional<Conversion> Conversion::adjustForInitialForceValue() const {
13911387 return std::nullopt ;
13921388
13931389 case BridgeToObjC: {
1394- auto sourceOptType =
1395- OptionalType::get (getBridgingSourceType ())->getCanonicalType ();
1390+ auto sourceOptType = getSourceType ().wrapInOptionalType ();
13961391 return Conversion::getBridging (ForceAndBridgeToObjC,
1397- sourceOptType,
1398- getBridgingResultType (),
1399- getBridgingLoweredResultType (),
1392+ sourceOptType, getResultType (),
1393+ getLoweredResultType (),
14001394 isBridgingExplicit ());
14011395 }
14021396 }
@@ -1428,9 +1422,9 @@ static void printReabstraction(const Conversion &conversion,
14281422static void printBridging (const Conversion &conversion, llvm::raw_ostream &out,
14291423 StringRef name) {
14301424 out << name << " (from: " ;
1431- conversion.getBridgingSourceType ().print (out);
1425+ conversion.getSourceType ().print (out);
14321426 out << " , to: " ;
1433- conversion.getBridgingResultType ().print (out);
1427+ conversion.getResultType ().print (out);
14341428 out << " , explicit: " << conversion.isBridgingExplicit () << ' )' ;
14351429}
14361430
@@ -1784,7 +1778,7 @@ combineSubtypeIntoReabstract(SILGenFunction &SGF,
17841778 if (!isCombinableConversion (inner, outer))
17851779 return salvageUncombinableConversion (SGF, inner, outer);
17861780
1787- auto inputSubstType = inner.getBridgingSourceType ();
1781+ auto inputSubstType = inner.getSourceType ();
17881782 auto inputOrigType = AbstractionPattern (inputSubstType);
17891783 auto inputLoweredTy = SGF.getLoweredType (inputOrigType, inputSubstType);
17901784
@@ -1804,9 +1798,8 @@ combineSubtype(SILGenFunction &SGF,
18041798 return salvageUncombinableConversion (SGF, inner, outer);
18051799
18061800 return CombinedConversions (
1807- Conversion::getSubtype (inner.getBridgingSourceType (),
1808- outer.getBridgingResultType (),
1809- outer.getBridgingLoweredResultType ())
1801+ Conversion::getSubtype (inner.getSourceType (), outer.getResultType (),
1802+ outer.getLoweredResultType ())
18101803 );
18111804}
18121805
@@ -1824,9 +1817,9 @@ combineBridging(SILGenFunction &SGF,
18241817 // Otherwise, we can peephole if we understand the resulting conversion
18251818 // and applying the peephole doesn't change semantics.
18261819
1827- CanType sourceType = inner.getBridgingSourceType ();
1828- CanType intermediateType = inner.getBridgingResultType ();
1829- assert (intermediateType == outer.getBridgingSourceType ());
1820+ CanType sourceType = inner.getSourceType ();
1821+ CanType intermediateType = inner.getResultType ();
1822+ assert (intermediateType == outer.getSourceType ());
18301823
18311824 // If we're doing a peephole involving a force, we want to propagate
18321825 // the force to the source value. If it's not in fact optional, that
@@ -1841,9 +1834,9 @@ combineBridging(SILGenFunction &SGF,
18411834 assert (intermediateType);
18421835 }
18431836
1844- CanType resultType = outer.getBridgingResultType ();
1837+ CanType resultType = outer.getResultType ();
18451838 SILType loweredSourceTy = SGF.getLoweredType (sourceType);
1846- SILType loweredResultTy = outer.getBridgingLoweredResultType ();
1839+ SILType loweredResultTy = outer.getLoweredResultType ();
18471840
18481841 auto applyPeephole = [&](const std::optional<Conversion> &conversion) {
18491842 if (!forced) {
@@ -1854,7 +1847,7 @@ combineBridging(SILGenFunction &SGF,
18541847
18551848 auto forceConversion =
18561849 Conversion::getBridging (Conversion::ForceOptional,
1857- inner.getBridgingSourceType (), sourceType,
1850+ inner.getSourceType (), sourceType,
18581851 loweredSourceTy);
18591852 if (conversion)
18601853 return CombinedConversions (forceConversion, *conversion);
0 commit comments