theos/logos

Nullability specifiers not supported in %property

Opened this issue · 3 comments

What are the steps to reproduce this issue?

%property (nonatomic, retain) UITextField * _Nonnull textField;

What happens?

iDUTagCreationAlertCollectionViewController.x:19:1: error: expected identifier or '('
%property (nonatomic, retain) UITextField * _Nonnull textField;
^

What were you expecting to happen?

Successful compilation.

Any logs, error output, etc?

iDUTagCreationAlertCollectionViewController.x:19:1: error: expected identifier or '('
%property (nonatomic, retain) UITextField * _Nonnull textField;
^

Any other comments?

Nope.

What versions of software are you using?

Operating System: macOS 10.15.4

Toolchain Version:

SDK Version: 13.4

It would be nice to also have:

%property (nonatomic, retain, nonnull) UITextField *textField;

%property is not the place to put nullability specifies, imo. That code is only used to generate other code; it's not the interface you use to access the resulting property itself. And since nullability is purely a compile-time feature, it wouldn't change anything even if you could put it there.

You should be putting nullability specifiers in the @interface for whatever class this is.

%property is not the place to put nullability specifies, imo. That code is only used to generate other code; it's not the interface you use to access the resulting property itself. And since nullability is purely a compile-time feature, it wouldn't change anything even if you could put it there.

You should be putting nullability specifiers in the @interface for whatever class this is.

While I agree, I think that it wouldn't hurt to support the nullability specifiers. For the %property syntax to be intuitive, it should follow the syntax of @property, including support for nullability specifiers — it would just mean one less place where Logos can break.