swiftlang/swift

[SR-9789] Use "pretty" nullability in generated ObjC headers

Open

#52,214 创建于 2019年1月29日

在 GitHub 查看
 (5 评论) (0 反应) (1 负责人)Swift (10,719 fork)batch import
PrintAsClangcompilergood first issueimprovement

仓库指标

Star
 (69,989 star)
PR 合并指标
 (平均合并 8天 17小时) (30 天内合并 510 个 PR)

描述

Previous ID SR-9789
Radar None
Original Reporter @belkadan
Type Improvement
Votes 0
Component/s Compiler
Labels Improvement, PrintAsObjC, StarterBug
Assignee @adellibovi
Priority Medium

md5: 0bc925759fd7590c0a91c67c7a5de68f

Issue Description:

Objective-C supports two "pretty" forms for nullability qualifiers: within the parentheses of a method's parameters or return type:

- (id _Nullable)computate:(int * _Nonnull)values;

- (nullable id)computate:(nonnull int *)values;

And in the property attributes list for a property:

@property id _Nullable owner;

@property (nullable) id owner;

PrintAsObjC should adopt these where valid; right now it only uses them in hardcoded cases for instancetype.

贡献者指南