@@ -2447,37 +2447,20 @@ static CanAnyFunctionType getStoredPropertyInitializerInterfaceType(
2447
2447
// / (property-type) -> backing-type.
2448
2448
static CanAnyFunctionType getPropertyWrapperBackingInitializerInterfaceType (
2449
2449
TypeConverter &TC,
2450
- VarDecl *VD) {
2450
+ VarDecl *VD,
2451
+ bool fromWrappedValue) {
2451
2452
CanType resultType =
2452
2453
VD->getPropertyWrapperBackingPropertyType ()->getCanonicalType ();
2453
2454
2454
2455
auto *DC = VD->getInnermostDeclContext ();
2455
- CanType inputType =
2456
- VD->getPropertyWrapperInitValueInterfaceType ()->getCanonicalType ();
2457
-
2458
- auto sig = DC->getGenericSignatureOfContext ();
2459
-
2460
- AnyFunctionType::Param param (
2461
- inputType, Identifier (),
2462
- ParameterTypeFlags ().withValueOwnership (ValueOwnership::Owned));
2463
- // FIXME: Verify ExtInfo state is correct, not working by accident.
2464
- CanAnyFunctionType::ExtInfo info;
2465
- return CanAnyFunctionType::get (getCanonicalSignatureOrNull (sig), {param},
2466
- resultType, info);
2467
- }
2468
-
2469
- static CanAnyFunctionType getPropertyWrapperInitFromProjectedValueInterfaceType (TypeConverter &TC,
2470
- VarDecl *VD) {
2471
- CanType resultType =
2472
- VD->getPropertyWrapperBackingPropertyType ()->getCanonicalType ();
2473
-
2474
- Type interfaceType = VD->getPropertyWrapperProjectionVar ()->getInterfaceType ();
2475
- if (interfaceType->hasArchetype ())
2476
- interfaceType = interfaceType->mapTypeOutOfContext ();
2477
-
2478
- CanType inputType = interfaceType->getCanonicalType ();
2456
+ CanType inputType;
2457
+ if (fromWrappedValue) {
2458
+ inputType = VD->getPropertyWrapperInitValueInterfaceType ()->getCanonicalType ();
2459
+ } else {
2460
+ Type interfaceType = VD->getPropertyWrapperProjectionVar ()->getInterfaceType ();
2461
+ inputType = interfaceType->getCanonicalType ();
2462
+ }
2479
2463
2480
- auto *DC = VD->getInnermostDeclContext ();
2481
2464
auto sig = DC->getGenericSignatureOfContext ();
2482
2465
2483
2466
AnyFunctionType::Param param (
@@ -2682,11 +2665,9 @@ CanAnyFunctionType TypeConverter::makeConstantInterfaceType(SILDeclRef c) {
2682
2665
case SILDeclRef::Kind::StoredPropertyInitializer:
2683
2666
return getStoredPropertyInitializerInterfaceType (cast<VarDecl>(vd));
2684
2667
case SILDeclRef::Kind::PropertyWrapperBackingInitializer:
2685
- return getPropertyWrapperBackingInitializerInterfaceType (*this ,
2686
- cast<VarDecl>(vd));
2687
2668
case SILDeclRef::Kind::PropertyWrapperInitFromProjectedValue:
2688
- return getPropertyWrapperInitFromProjectedValueInterfaceType (* this ,
2689
- cast<VarDecl>(vd));
2669
+ return getPropertyWrapperBackingInitializerInterfaceType (
2670
+ * this , cast<VarDecl>(vd), c. kind == SILDeclRef::Kind::PropertyWrapperBackingInitializer );
2690
2671
case SILDeclRef::Kind::IVarInitializer:
2691
2672
return getIVarInitDestroyerInterfaceType (cast<ClassDecl>(vd),
2692
2673
c.isForeign , false );
0 commit comments