Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-2608] Enhance default arguments printing in module interface #45213

Closed
rintaro mannequin opened this issue Sep 10, 2016 · 3 comments
Closed

[SR-2608] Enhance default arguments printing in module interface #45213

rintaro mannequin opened this issue Sep 10, 2016 · 3 comments
Assignees
Labels
compiler The Swift compiler in itself improvement

Comments

@rintaro
Copy link
Mannequin

rintaro mannequin commented Sep 10, 2016

Previous ID SR-2608
Radar rdar://problem/18675831
Original Reporter @rintaro
Type Improvement
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler, Source Tooling
Labels Improvement
Assignee @belkadan
Priority Medium

md5: 66d899d56bcca613cc9bf6ca9ead7b52

relates to:

  • SR-8501 Properly syntax-color default argument expressions in generated interfaces

Issue Description:

It would be great if we can see the value of any default arguments in module interface printing.
(as long as it doesn't include non-public elements)

Currently, only very limited special literals are printed:
#file, #line, #column, #function, and #dsohandle

e.g.

public func fatalError(_ message: @autoclosure () -> String = default, file: StaticString = #file, line: UInt = #line) -> Never

public func print(_ items: Any..., separator: String = default, terminator: String = default)

should be:

public func fatalError(_ message: @autoclosure () -> String = String(), file: StaticString = #file, line: UInt = #line) -> Never

public func print(_ items: Any..., separator: String = " ", terminator: String = "\n")
@belkadan
Copy link
Contributor

This has some complexity if we want to do it right, in that you can reference things in default arguments that aren't part of the public interface of the module. But I'm fine with us doing this wrong for now.

We don't serialize expressions in modules, but we can certainly store a stringified version of the expression.

@belkadan
Copy link
Contributor

If anyone wants to pick this up I'd be happy to answer questions about our current module format and how this might fit in.

@belkadan
Copy link
Contributor

belkadan commented Aug 9, 2018

#18579

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler in itself improvement
Projects
None yet
Development

No branches or pull requests

1 participant