@@ -72,6 +72,8 @@ public static IEnumerable<object[]> GetTypesWithNonNullablePropertyGetter()
7272 yield return Wrap ( typeof ( NotNullableSpecialTypePropertiesClass ) , nameof ( NotNullableSpecialTypePropertiesClass . JsonDocument ) ) ;
7373 yield return Wrap ( typeof ( NullableObliviousConstructorParameter ) , nameof ( NullableObliviousConstructorParameter . Property ) ) ;
7474 yield return Wrap ( typeof ( NotNullGenericPropertyClass < string > ) , nameof ( NotNullGenericPropertyClass < string > . Property ) ) ;
75+ yield return Wrap ( typeof ( ClassWithNonNullableInitProperty ) , nameof ( ClassWithNonNullableInitProperty . Property ) ) ;
76+ yield return Wrap ( typeof ( ClassWithNonNullableInitProperty ) , nameof ( ClassWithNonNullableRequiredProperty . Property ) ) ;
7577
7678 static object [ ] Wrap ( Type type , string propertyName ) => [ type, propertyName ] ;
7779 }
@@ -125,6 +127,8 @@ public static IEnumerable<object[]> GetTypesWithNullablePropertyGetter()
125127 yield return Wrap ( typeof ( NullableObliviousPropertyClass ) , nameof ( NullableObliviousPropertyClass . Property ) ) ;
126128 yield return Wrap ( typeof ( GenericPropertyClass < string > ) , nameof ( GenericPropertyClass < string > . Property ) ) ;
127129 yield return Wrap ( typeof ( NullableGenericPropertyClass < string > ) , nameof ( NullableGenericPropertyClass < string > . Property ) ) ;
130+ yield return Wrap ( typeof ( ClassWithNullableInitProperty ) , nameof ( ClassWithNullableInitProperty . Property ) ) ;
131+ yield return Wrap ( typeof ( ClassWithNullableInitProperty ) , nameof ( ClassWithNullableRequiredProperty . Property ) ) ;
128132
129133 static object [ ] Wrap ( Type type , string propertyName ) => [ type, propertyName ] ;
130134 }
@@ -191,6 +195,8 @@ public static IEnumerable<object[]> GetTypesWithNonNullablePropertySetter()
191195 yield return Wrap ( typeof ( DisallowNullConstructorParameter ) , nameof ( DisallowNullConstructorParameter . Property ) ) ;
192196 yield return Wrap ( typeof ( DisallowNullConstructorParameter < string > ) , nameof ( DisallowNullConstructorParameter < string > . Property ) ) ;
193197 yield return Wrap ( typeof ( NotNullGenericConstructorParameter < string > ) , nameof ( NotNullGenericConstructorParameter < string > . Property ) ) ;
198+ yield return Wrap ( typeof ( ClassWithNonNullableInitProperty ) , nameof ( ClassWithNonNullableInitProperty . Property ) ) ;
199+ yield return Wrap ( typeof ( ClassWithNonNullableInitProperty ) , nameof ( ClassWithNonNullableRequiredProperty . Property ) ) ;
194200
195201 static object [ ] Wrap ( Type type , string propertyName ) => [ type, propertyName ] ;
196202 }
@@ -249,6 +255,8 @@ public static IEnumerable<object[]> GetTypesWithNullablePropertySetter()
249255 yield return Wrap ( typeof ( AllowNullConstructorParameter < string > ) , nameof ( AllowNullConstructorParameter < string > . Property ) ) ;
250256 yield return Wrap ( typeof ( GenericConstructorParameter < string > ) , nameof ( GenericConstructorParameter < string > . Property ) ) ;
251257 yield return Wrap ( typeof ( NullableGenericConstructorParameter < string > ) , nameof ( NullableGenericConstructorParameter < string > . Property ) ) ;
258+ yield return Wrap ( typeof ( ClassWithNullableInitProperty ) , nameof ( ClassWithNullableInitProperty . Property ) ) ;
259+ yield return Wrap ( typeof ( ClassWithNullableInitProperty ) , nameof ( ClassWithNullableRequiredProperty . Property ) ) ;
252260
253261 static object [ ] Wrap ( Type type , string propertyName ) => [ type, propertyName ] ;
254262 }
@@ -765,5 +773,25 @@ public class NullableFieldClass
765773 [ JsonInclude ]
766774 public string ? Field ;
767775 }
776+
777+ public class ClassWithNullableInitProperty
778+ {
779+ public string ? Property { get ; init ; }
780+ }
781+
782+ public class ClassWithNonNullableInitProperty
783+ {
784+ public string Property { get ; init ; }
785+ }
786+
787+ public class ClassWithNullableRequiredProperty
788+ {
789+ public required string ? Property { get ; set ; }
790+ }
791+
792+ public class ClassWithNonNullableRequiredProperty
793+ {
794+ public required string Property { get ; set ; }
795+ }
768796 }
769797}
0 commit comments