@@ -3849,7 +3849,13 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
3849
3849
case KeyPathPatternComponent::Kind::SettableProperty: {
3850
3850
bool hasIndices = !component.getSubscriptIndices ().empty ();
3851
3851
3852
- // Getter should be <Sig...> @convention(thin) (@in Base) -> @out Result
3852
+ ParameterConvention normalArgConvention;
3853
+ if (F.getModule ().getOptions ().EnableGuaranteedNormalArguments )
3854
+ normalArgConvention = ParameterConvention::Indirect_In_Guaranteed;
3855
+ else
3856
+ normalArgConvention = ParameterConvention::Indirect_In;
3857
+
3858
+ // Getter should be <Sig...> @convention(thin) (@in_guaranteed Base) -> @out Result
3853
3859
{
3854
3860
auto getter = component.getComputedPropertyGetter ();
3855
3861
auto substGetterType = getter->getLoweredFunctionType ()
@@ -3861,9 +3867,8 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
3861
3867
require (substGetterType->getNumParameters () == 1 + hasIndices,
3862
3868
" getter should have one parameter" );
3863
3869
auto baseParam = substGetterType->getParameters ()[0 ];
3864
- require (baseParam.getConvention () ==
3865
- ParameterConvention::Indirect_In,
3866
- " getter base parameter should be @in" );
3870
+ require (baseParam.getConvention () == normalArgConvention,
3871
+ " getter base parameter should have normal arg convention" );
3867
3872
require (baseParam.getType () == loweredBaseTy.getSwiftRValueType (),
3868
3873
" getter base parameter should match base of component" );
3869
3874
@@ -3889,7 +3894,7 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
3889
3894
3890
3895
if (kind == KeyPathPatternComponent::Kind::SettableProperty) {
3891
3896
// Setter should be
3892
- // <Sig...> @convention(thin) (@in Result, @in Base) -> ()
3897
+ // <Sig...> @convention(thin) (@in_guaranteed Result, @in Base) -> ()
3893
3898
3894
3899
auto setter = component.getComputedPropertySetter ();
3895
3900
auto substSetterType = setter->getLoweredFunctionType ()
@@ -3903,16 +3908,17 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
3903
3908
" setter should have two parameters" );
3904
3909
3905
3910
auto newValueParam = substSetterType->getParameters ()[0 ];
3906
- require (newValueParam.getConvention () ==
3907
- ParameterConvention::Indirect_In,
3908
- " setter value parameter should be @in" );
3911
+ // TODO: This should probably be unconditionally +1 when we
3912
+ // can represent that.
3913
+ require (newValueParam.getConvention () == normalArgConvention,
3914
+ " setter value parameter should havee normal arg convention" );
3909
3915
3910
3916
auto baseParam = substSetterType->getParameters ()[1 ];
3911
- require (baseParam.getConvention () ==
3912
- ParameterConvention::Indirect_In
3917
+ require (baseParam.getConvention () == normalArgConvention
3913
3918
|| baseParam.getConvention () ==
3914
3919
ParameterConvention::Indirect_Inout,
3915
- " setter base parameter should be @in or @inout" );
3920
+ " setter base parameter should be normal arg convention "
3921
+ " or @inout" );
3916
3922
3917
3923
if (hasIndices) {
3918
3924
auto indicesParam = substSetterType->getParameters ()[2 ];
0 commit comments