Skip to content

[SR-9816] Odd interface decl for 'public private(set)' properties (Swift 5) #52234

@johnfairh

Description

@johnfairh
Previous ID SR-9816
Radar None
Original Reporter @johnfairh
Type Bug
Status Closed
Resolution Done
Environment

Swift master / swift-5-branch ; xcode10.2 beta 1.

Additional Detail from JIRA
Votes 0
Component/s Source Tooling
Labels Bug
Assignee @harlanhaskins
Priority Medium

md5: 78fe6f8ba1981811c5d409d50a6c8eb6

Issue Description:

In Swift 5, stored properties declared (eg) `public private(set)` print with extra newlines in the interface AST-print format. This is the main one used by SourceKit so affects quick help etc.

For example given:

public class F {
    public private(set) var p1 = 0
    public private(set) var p2: Int {
        get { return 0 }
        set {}
    }
}

...the 'interface'-style declarations printed by the compiler (again eg. see quick help) are:

public private(set) var p1: Int {
  get
  }

// and compare the equiv. computed:
public private(set) var p2: Int { get set }

I see that PR 2250 decided that this type of stored property needs { get } — fine. I think the newlines aren't necessary though: no other declaration prints on multiple lines in this print style.

@harlanhaskins what do you think?

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions