-
Notifications
You must be signed in to change notification settings - Fork 488
Documentation for Switch, Return, Throw and Type syntax nodes #3231
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
base: main
Are you sure you want to change the base?
Changes from 4 commits
8efdec6
90ac202
cd55ee0
c3017a8
20957ea
b9e50c2
048f3e5
b3ac04d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2171,6 +2171,24 @@ public let DECL_NODES: [Node] = [ | |
| kind: .returnClause, | ||
| base: .syntax, | ||
| nameForDiagnostics: nil, | ||
| documentation: """ | ||
| A clause that specifies the return type of a function or closure. | ||
|
|
||
| Written as: | ||
| ```swift | ||
| -> <type> | ||
| ``` | ||
|
||
|
|
||
| ### Examples | ||
|
||
|
|
||
| ```swift | ||
| func f() -> Int { } | ||
| ``` | ||
|
|
||
| ```swift | ||
| let g: () -> String = { "hello" } | ||
| ``` | ||
| """, | ||
| children: [ | ||
| Child( | ||
| name: "arrow", | ||
|
|
@@ -2437,6 +2455,20 @@ public let DECL_NODES: [Node] = [ | |
| kind: .typeInitializerClause, | ||
| base: .syntax, | ||
| nameForDiagnostics: nil, | ||
| documentation: """ | ||
| A clause that specifies the underlying type of `typealias` or `associatedtype` declaration. | ||
|
|
||
| Written as: | ||
| ```swift | ||
| = <type> | ||
| ``` | ||
|
|
||
| ### Examples | ||
|
|
||
| ```swift | ||
| typealias MyInt = Int | ||
| ``` | ||
| """, | ||
| children: [ | ||
| Child( | ||
| name: "equal", | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually function, subscript, type, or closure.
But I'm not sure we should list everything here. This information is automatically rendered as "Contained in" section.
So maybe
A clause that specifies the return typeis enough.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My proposal would be
A clause that specifies the return type, typically of a function or subscript. That leaves room for the slightly more edge cases in theContained Insection, while still giving you an idea of what this is about.