While working on SWC-843, I've made an attempt to have ConversionOptions.AssumeNonNullPointers (and NS_ASSUME_NONNULL_BEGIN, NS_ASSUME_NONNULL_END macros)
affect properties, similarly to methods.
Since Objective-C properties require default initializers in Swift, the suggested approach was as follows:
1. Non-calculated properties:
Ignore `AssumeNonNullPointers` (declare as optional).
2. Calculated properties:
Declare the property as non-optional.
Unwrap an optional backing field if needed.
After trying to implement this, the output of "SkipAccessorMethodDefinition" method was as follows:
Issues with the implementation:
1) The backing field (`_preferencesWindowController`) needs to be forcefully unwrapped in the `return` statement.
2) This leads to inconsistencies with the handling of properties with or without accessors.
For example, we need to treat the property type as non-optional (only if it has accessors), but the type of generated backing field as optional.
Same time, most of the properties do not have accessors, and they are not affected by this change at all.
3) A few issues related to optionals were left unresolved after these changes (copied from SWC-843):
+ SkipAccessorMethodDefinition*: `preferencesWindowController` property should be declared as non-optional
+ SkipAccessorMethodDefinition*: _preferencesWindowController should be unwrapped with `!`
ShouldLookupPropertyAccessorsInAllImplementationSections: should not infer NSNumber type name
+ ShouldGenerateBackingFieldForPropertyDeclarationWithGetter: `return _managedObjectModel` should be unwrapped with `!`
+ ShouldDetectDeclaredPropertyOptionality: `dataSource` should be unwrapped
ShouldUnwrapOptionalPropertyInOptionalSetterChain: `brain` should be unwrapped
ShouldNotKeepSelForPropertiesOutsideOfBlock: `networkQueue` should be unwrapped
IBActionTest: `delegate` should be unwrapped
DefaultSample2: `self.label` should be unwrapped
Reverting these changes for now. OptionalUtility.cs:
Other related changes that were not included:
P.S. the support for properties was removed in commit ID: 1f3331f5d6d7876268d64d0db739e10aa864cfc7