mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
The rule changes are as follows: * All functions (introduced with the 'func' keyword) have argument labels for arguments beyond the first, by default. Methods are no longer special in this regard. * The presence of a default argument no longer implies an argument label. The actual changes to the parser and printer are fairly simple; the rest of the noise is updating the standard library, overlays, tests, etc. With the standard library, this change is intended to be API neutral: I've added/removed #'s and _'s as appropriate to keep the user interface the same. If we want to separately consider using argument labels for more free functions now that the defaults in the language have shifted, we can tackle that separately. Fixes rdar://problem/17218256. Swift SVN r27704
274 lines
14 KiB
Plaintext
274 lines
14 KiB
Plaintext
<decl:Import>@exported import <ref:module>Foo</ref>.<ref:module>FooSub</ref></decl>
|
|
<decl:Import>@exported import <ref:module>FooHelper</ref></decl>
|
|
|
|
|
|
<decl:Struct>/// Aaa. FooEnum1. Bbb.
|
|
struct <loc>FooEnum1</loc> : <ref:Protocol>RawRepresentable</ref> {
|
|
<decl:Constructor><loc>init(_ rawValue: <ref:Struct>UInt32</ref>)</loc></decl>
|
|
<decl:Constructor><loc>init(rawValue: <ref:Struct>UInt32</ref>)</loc></decl>
|
|
<decl:Var>var <loc>rawValue</loc>: <ref:Struct>UInt32</ref></decl>
|
|
}</decl>
|
|
|
|
<decl:Var>/// Aaa. FooEnum1X. Bbb.
|
|
var <loc>FooEnum1X</loc>: <ref:Struct>FooEnum1</ref> { get }</decl>
|
|
<decl:Struct>struct <loc>FooEnum2</loc> : <ref:Protocol>RawRepresentable</ref> {
|
|
<decl:Constructor><loc>init(_ rawValue: <ref:Struct>UInt32</ref>)</loc></decl>
|
|
<decl:Constructor><loc>init(rawValue: <ref:Struct>UInt32</ref>)</loc></decl>
|
|
<decl:Var>var <loc>rawValue</loc>: <ref:Struct>UInt32</ref></decl>
|
|
}</decl>
|
|
<decl:Var>var <loc>FooEnum2X</loc>: <ref:Struct>FooEnum2</ref> { get }</decl>
|
|
<decl:Var>var <loc>FooEnum2Y</loc>: <ref:Struct>FooEnum2</ref> { get }</decl>
|
|
<decl:Struct>struct <loc>FooEnum3</loc> : <ref:Protocol>RawRepresentable</ref> {
|
|
<decl:Constructor><loc>init(_ rawValue: <ref:Struct>UInt32</ref>)</loc></decl>
|
|
<decl:Constructor><loc>init(rawValue: <ref:Struct>UInt32</ref>)</loc></decl>
|
|
<decl:Var>var <loc>rawValue</loc>: <ref:Struct>UInt32</ref></decl>
|
|
}</decl>
|
|
<decl:Var>var <loc>FooEnum3X</loc>: <ref:Struct>FooEnum3</ref> { get }</decl>
|
|
<decl:Var>var <loc>FooEnum3Y</loc>: <ref:Struct>FooEnum3</ref> { get }</decl>
|
|
|
|
<decl:Enum>/// Aaa. FooComparisonResult. Bbb.
|
|
enum <loc>FooComparisonResult</loc> : <ref:Struct>Int</ref> {
|
|
<decl:Constructor><loc>init?(rawValue: <ref:Struct>Int</ref>)</loc></decl>
|
|
<decl:Var>var <loc>rawValue</loc>: <ref:Struct>Int</ref> { get }</decl>
|
|
<decl:EnumElement>case <loc>OrderedAscending</loc></decl>
|
|
<decl:EnumElement>case <loc>OrderedSame</loc></decl>
|
|
<decl:EnumElement>case <loc>OrderedDescending</loc></decl>
|
|
}</decl>
|
|
|
|
<decl:Struct>/// Aaa. FooRuncingOptions. Bbb.
|
|
struct <loc>FooRuncingOptions</loc> : <ref:Protocol>RawOptionSetType</ref> {
|
|
<decl:Constructor><loc>init()</loc></decl>
|
|
<decl:Constructor><loc>init(_ rawValue: <ref:Struct>Int</ref>)</loc></decl>
|
|
<decl:Constructor><loc>init(rawValue: <ref:Struct>Int</ref>)</loc></decl>
|
|
<decl:Var>let <loc>rawValue</loc>: <ref:Struct>Int</ref></decl>
|
|
<decl:Var>static var <loc>EnableMince</loc>: <ref:Struct>FooRuncingOptions</ref> { get }</decl>
|
|
<decl:Var>static var <loc>EnableQuince</loc>: <ref:Struct>FooRuncingOptions</ref> { get }</decl>
|
|
<decl:Var>static var <loc>allZeros</loc>: <ref:Struct>FooRuncingOptions</ref> { get }</decl>
|
|
<decl:Constructor><loc>init(nilLiteral _: ())</loc></decl>
|
|
}</decl>
|
|
<decl:Struct>struct <loc>FooStruct1</loc> {
|
|
<decl:Var>var <loc>x</loc>: <ref:Struct>Int32</ref></decl>
|
|
<decl:Var>var <loc>y</loc>: <ref:Struct>Double</ref></decl>
|
|
<decl:Constructor><loc>init()</loc></decl>
|
|
<decl:Constructor><loc>init(x: <ref:Struct>Int32</ref>, y: <ref:Struct>Double</ref>)</loc></decl>
|
|
}</decl>
|
|
<decl:Struct>struct <loc>FooStruct2</loc> {
|
|
<decl:Var>var <loc>x</loc>: <ref:Struct>Int32</ref></decl>
|
|
<decl:Var>var <loc>y</loc>: <ref:Struct>Double</ref></decl>
|
|
<decl:Constructor><loc>init()</loc></decl>
|
|
<decl:Constructor><loc>init(x: <ref:Struct>Int32</ref>, y: <ref:Struct>Double</ref>)</loc></decl>
|
|
}</decl>
|
|
<decl:TypeAlias>typealias <loc>FooStructTypedef1</loc> = <ref:Struct>FooStruct2</ref></decl>
|
|
<decl:Struct>struct <loc>FooStructTypedef2</loc> {
|
|
<decl:Var>var <loc>x</loc>: <ref:Struct>Int32</ref></decl>
|
|
<decl:Var>var <loc>y</loc>: <ref:Struct>Double</ref></decl>
|
|
<decl:Constructor><loc>init()</loc></decl>
|
|
<decl:Constructor><loc>init(x: <ref:Struct>Int32</ref>, y: <ref:Struct>Double</ref>)</loc></decl>
|
|
}</decl>
|
|
|
|
<decl:TypeAlias>/// Aaa. FooTypedef1. Bbb.
|
|
typealias <loc>FooTypedef1</loc> = <ref:Struct>Int32</ref></decl>
|
|
|
|
<decl:Var>/// Aaa. fooIntVar. Bbb.
|
|
var <loc>fooIntVar</loc>: <ref:Struct>Int32</ref></decl>
|
|
|
|
<decl:Func>/// Aaa. fooFunc1. Bbb.
|
|
func <loc>fooFunc1(a: <ref:Struct>Int32</ref>)</loc> -> <ref:Struct>Int32</ref></decl>
|
|
<decl:Func>func <loc>fooFunc1AnonymousParam(_: <ref:Struct>Int32</ref>)</loc> -> <ref:Struct>Int32</ref></decl>
|
|
<decl:Func>func <loc>fooFunc3(a: <ref:Struct>Int32</ref>, _ b: <ref:Struct>Float</ref>, _ c: <ref:Struct>Double</ref>, _ d: <ref:Struct>UnsafeMutablePointer</ref><<ref:Struct>Int32</ref>>)</loc> -> <ref:Struct>Int32</ref></decl>
|
|
<decl:Func>func <loc>fooFuncWithBlock(blk: ((<ref:Struct>Float</ref>) -> <ref:Struct>Int32</ref>)!)</loc></decl>
|
|
<decl:Func>func <loc>fooFuncWithFunctionPointer(fptr: (@convention(c) (<ref:Struct>Float</ref>) -> <ref:Struct>Int32</ref>)!)</loc></decl>
|
|
<decl:Func>@noreturn func <loc>fooFuncNoreturn1()</loc></decl>
|
|
<decl:Func>@noreturn func <loc>fooFuncNoreturn2()</loc></decl>
|
|
|
|
<decl:Func>/**
|
|
* Aaa. fooFuncWithComment1. Bbb.
|
|
* Ccc.
|
|
*
|
|
* Ddd.
|
|
*/
|
|
func <loc>fooFuncWithComment1()</loc></decl>
|
|
|
|
<decl:Func>/*!
|
|
Aaa. fooFuncWithComment2. Bbb.
|
|
*/
|
|
func <loc>fooFuncWithComment2()</loc></decl>
|
|
|
|
<decl:Func>/**
|
|
* Aaa. fooFuncWithComment3. Bbb.
|
|
*/
|
|
/**
|
|
* Ccc.
|
|
*/
|
|
func <loc>fooFuncWithComment3()</loc></decl>
|
|
|
|
<decl:Func>/**
|
|
* Aaa. fooFuncWithComment4. Bbb.
|
|
*/
|
|
/// Ddd.
|
|
func <loc>fooFuncWithComment4()</loc></decl>
|
|
|
|
<decl:Func>/// Aaa. fooFuncWithComment5. Bbb.
|
|
/// Ccc.
|
|
///
|
|
/// Ddd.
|
|
func <loc>fooFuncWithComment5()</loc></decl>
|
|
|
|
<decl:Func>/// Aaa. redeclaredInMultipleModulesFunc1. Bbb.
|
|
func <loc>redeclaredInMultipleModulesFunc1(a: <ref:Struct>Int32</ref>)</loc> -> <ref:Struct>Int32</ref></decl>
|
|
|
|
<decl:Protocol>/// Aaa. FooProtocolBase. Bbb.
|
|
protocol <loc>FooProtocolBase</loc> {
|
|
|
|
<decl:Func>/// Aaa. fooProtoFunc. Bbb.
|
|
/// Ccc.
|
|
func <loc>fooProtoFunc()</loc></decl>
|
|
|
|
<decl:Func>/// Aaa. fooProtoFuncWithExtraIndentation1. Bbb.
|
|
/// Ccc.
|
|
func <loc>fooProtoFuncWithExtraIndentation1()</loc></decl>
|
|
|
|
<decl:Func>/**
|
|
* Aaa. fooProtoFuncWithExtraIndentation2. Bbb.
|
|
* Ccc.
|
|
*/
|
|
func <loc>fooProtoFuncWithExtraIndentation2()</loc></decl>
|
|
<decl:Func>static func <loc>fooProtoClassFunc()</loc></decl>
|
|
<decl:Var>var <loc>fooProperty1</loc>: <ref:Struct>Int32</ref> { get set }</decl>
|
|
<decl:Var>var <loc>fooProperty2</loc>: <ref:Struct>Int32</ref> { get set }</decl>
|
|
<decl:Var>var <loc>fooProperty3</loc>: <ref:Struct>Int32</ref> { get }</decl>
|
|
}</decl>
|
|
<decl:Protocol>protocol <loc>FooProtocolDerived</loc> : <ref:Protocol>FooProtocolBase</ref> {
|
|
}</decl>
|
|
<decl:Class>class <loc>FooClassBase</loc> {
|
|
<decl:Func>class func <loc>fooBaseInstanceFunc0()</loc></decl>
|
|
<decl:Func>func <loc>fooBaseInstanceFunc0()</loc></decl>
|
|
<decl:Func>class func <loc>fooBaseInstanceFunc1(anObject: <ref:Protocol>AnyObject</ref>!)</loc> -> <ref:Class>FooClassBase</ref>!</decl>
|
|
<decl:Func>func <loc>fooBaseInstanceFunc1(anObject: <ref:Protocol>AnyObject</ref>!)</loc> -> <ref:Class>FooClassBase</ref>!</decl>
|
|
<decl:Constructor><loc>init!()</loc></decl>
|
|
<decl:Constructor>convenience <loc>init!(float f: <ref:Struct>Float</ref>)</loc></decl>
|
|
<decl:Func>class func <loc>fooBaseInstanceFuncOverridden()</loc></decl>
|
|
<decl:Func>func <loc>fooBaseInstanceFuncOverridden()</loc></decl>
|
|
<decl:Func>class func <loc>fooBaseClassFunc0()</loc></decl>
|
|
}</decl>
|
|
|
|
<decl:Class>/// Aaa. FooClassDerived. Bbb.
|
|
class <loc>FooClassDerived</loc> : <ref:Class>FooClassBase</ref>, <ref:Protocol>FooProtocolDerived</ref>, <ref:Protocol>FooProtocolBase</ref> {
|
|
<decl:Var>var <loc>fooProperty1</loc>: <ref:Struct>Int32</ref></decl>
|
|
<decl:Var>var <loc>fooProperty2</loc>: <ref:Struct>Int32</ref></decl>
|
|
<decl:Var>var <loc>fooProperty3</loc>: <ref:Struct>Int32</ref> { get }</decl>
|
|
<decl:Func>func <loc>fooInstanceFunc0()</loc></decl>
|
|
<decl:Func>func <loc>fooInstanceFunc1(a: <ref:Struct>Int32</ref>)</loc></decl>
|
|
<decl:Func>func <loc>fooInstanceFunc2(a: <ref:Struct>Int32</ref>, withB b: <ref:Struct>Int32</ref>)</loc></decl>
|
|
<decl:Func>func <loc>fooBaseInstanceFuncOverridden()</loc></decl>
|
|
<decl:Func>class func <loc>fooClassFunc0()</loc></decl>
|
|
<decl:Constructor><loc>init!()</loc></decl>
|
|
<decl:Constructor>convenience <loc>init!(float f: <ref:Struct>Float</ref>)</loc></decl>
|
|
|
|
<decl:Func>/// Aaa. fooProtoFunc. Bbb.
|
|
/// Ccc.
|
|
func <loc>fooProtoFunc()</loc></decl>
|
|
|
|
<decl:Func>/// Aaa. fooProtoFuncWithExtraIndentation1. Bbb.
|
|
/// Ccc.
|
|
func <loc>fooProtoFuncWithExtraIndentation1()</loc></decl>
|
|
|
|
<decl:Func>/**
|
|
* Aaa. fooProtoFuncWithExtraIndentation2. Bbb.
|
|
* Ccc.
|
|
*/
|
|
func <loc>fooProtoFuncWithExtraIndentation2()</loc></decl>
|
|
<decl:Func>class func <loc>fooProtoClassFunc()</loc></decl>
|
|
}</decl>
|
|
<decl:Var>var <loc>FOO_MACRO_1</loc>: <ref:Struct>Int32</ref> { get }</decl>
|
|
<decl:Var>var <loc>FOO_MACRO_2</loc>: <ref:Struct>Int32</ref> { get }</decl>
|
|
<decl:Var>var <loc>FOO_MACRO_3</loc>: <ref:Struct>Int32</ref> { get }</decl>
|
|
<decl:Var>var <loc>FOO_MACRO_4</loc>: <ref:Struct>UInt32</ref> { get }</decl>
|
|
<decl:Var>var <loc>FOO_MACRO_5</loc>: <ref:Struct>UInt64</ref> { get }</decl>
|
|
<decl:Var>var <loc>FOO_MACRO_REDEF_1</loc>: <ref:Struct>Int32</ref> { get }</decl>
|
|
<decl:Var>var <loc>FOO_MACRO_REDEF_2</loc>: <ref:Struct>Int32</ref> { get }</decl>
|
|
<decl:Func>func <loc>theLastDeclInFoo()</loc></decl>
|
|
<decl:Func>func <loc>_internalTopLevelFunc()</loc></decl>
|
|
<decl:Struct>struct <loc>_InternalStruct</loc> {
|
|
<decl:Var>var <loc>x</loc>: <ref:Struct>Int32</ref></decl>
|
|
<decl:Constructor><loc>init()</loc></decl>
|
|
<decl:Constructor><loc>init(x: <ref:Struct>Int32</ref>)</loc></decl>
|
|
}</decl>
|
|
<decl:Extension>extension <ref:Class><loc>FooClassBase</ref></loc> {
|
|
<decl:Func>class func <loc>_internalMeth1()</loc> -> <ref:Protocol>AnyObject</ref>!</decl>
|
|
<decl:Func>func <loc>_internalMeth1()</loc> -> <ref:Protocol>AnyObject</ref>!</decl>
|
|
}</decl>
|
|
<decl:Extension>extension <ref:Class><loc>FooClassBase</ref></loc> {
|
|
<decl:Func>class func <loc>_internalMeth2()</loc> -> <ref:Protocol>AnyObject</ref>!</decl>
|
|
<decl:Func>func <loc>_internalMeth2()</loc> -> <ref:Protocol>AnyObject</ref>!</decl>
|
|
<decl:Func>class func <loc>nonInternalMeth()</loc> -> <ref:Protocol>AnyObject</ref>!</decl>
|
|
<decl:Func>func <loc>nonInternalMeth()</loc> -> <ref:Protocol>AnyObject</ref>!</decl>
|
|
}</decl>
|
|
<decl:Extension>extension <ref:Class><loc>FooClassBase</ref></loc> {
|
|
<decl:Func>class func <loc>_internalMeth3()</loc> -> <ref:Protocol>AnyObject</ref>!</decl>
|
|
<decl:Func>func <loc>_internalMeth3()</loc> -> <ref:Protocol>AnyObject</ref>!</decl>
|
|
}</decl>
|
|
<decl:Protocol>protocol <loc>_InternalProt</loc> {
|
|
}</decl>
|
|
<decl:Class>class <loc>ClassWithInternalProt</loc> : <ref:Protocol>_InternalProt</ref> {
|
|
}</decl>
|
|
<decl:Class>class <loc>FooClassPropertyOwnership</loc> : <ref:Class>FooClassBase</ref> {
|
|
<decl:Var>unowned(unsafe) var <loc>assignable</loc>: @sil_unmanaged <ref:Protocol>AnyObject</ref>!</decl>
|
|
<decl:Var>unowned(unsafe) var <loc>unsafeAssignable</loc>: @sil_unmanaged <ref:Protocol>AnyObject</ref>!</decl>
|
|
<decl:Var>var <loc>retainable</loc>: <ref:Protocol>AnyObject</ref>!</decl>
|
|
<decl:Var>var <loc>strongRef</loc>: <ref:Protocol>AnyObject</ref>!</decl>
|
|
<decl:Var>@NSCopying var <loc>copyable</loc>: <ref:Protocol>AnyObject</ref>!</decl>
|
|
<decl:Var>weak var <loc>weakRef</loc>: @sil_weak <ref:Protocol>AnyObject</ref>?</decl>
|
|
<decl:Var>var <loc>scalar</loc>: <ref:Struct>Int32</ref></decl>
|
|
<decl:Constructor><loc>init!()</loc></decl>
|
|
<decl:Constructor>convenience <loc>init!(float f: <ref:Struct>Float</ref>)</loc></decl>
|
|
}</decl>
|
|
<decl:Class>class <loc>FooUnavailableMembers</loc> : <ref:Class>FooClassBase</ref> {
|
|
<decl:Constructor>convenience <loc>init!(int i: <ref:Struct>Int32</ref>)</loc></decl>
|
|
<decl:Func>@availability(*, unavailable, message="use object construction 'FooUnavailableMembers(int:)'")
|
|
class func <loc>unavailableMembersWithInt(i: <ref:Struct>Int32</ref>)</loc> -> Self!</decl>
|
|
<decl:Func>@availability(*, unavailable, message="x")
|
|
func <loc>unavailable()</loc></decl>
|
|
<decl:Func>@availability(*, unavailable, message="Not available in Swift")
|
|
func <loc>swiftUnavailable()</loc></decl>
|
|
<decl:Func>@availability(*, deprecated, message="x")
|
|
func <loc>deprecated()</loc></decl>
|
|
<decl:Func>@availability(OSX, introduced=10.1)
|
|
func <loc>availabilityIntroduced()</loc></decl>
|
|
<decl:Func>@availability(OSX, unavailable, deprecated=10.1, message="APIs deprecated as of OS X 10.9 and earlier are unavailable in Swift")
|
|
func <loc>availabilityDeprecated()</loc></decl>
|
|
<decl:Func>@availability(OSX, obsoleted=10.1)
|
|
func <loc>availabilityObsoleted()</loc></decl>
|
|
<decl:Func>@availability(OSX, unavailable)
|
|
func <loc>availabilityUnavailable()</loc></decl>
|
|
<decl:Func>@availability(OSX, introduced=10.1, message="x")
|
|
func <loc>availabilityIntroducedMsg()</loc></decl>
|
|
<decl:Func>@availability(OSX, unavailable, deprecated=10.1, message="x")
|
|
func <loc>availabilityDeprecatedMsg()</loc></decl>
|
|
<decl:Func>@availability(OSX, obsoleted=10.1, message="x")
|
|
func <loc>availabilityObsoletedMsg()</loc></decl>
|
|
<decl:Func>@availability(OSX, unavailable, message="x")
|
|
func <loc>availabilityUnavailableMsg()</loc></decl>
|
|
<decl:Func>@availability(*, unavailable, message="'performSelector' methods are unavailable")
|
|
func <loc>performSelectorWithMagic(cmd: <ref:Struct>COpaquePointer</ref>)</loc></decl>
|
|
<decl:Constructor><loc>init!()</loc></decl>
|
|
<decl:Constructor>convenience <loc>init!(float f: <ref:Struct>Float</ref>)</loc></decl>
|
|
}</decl>
|
|
<decl:TypeAlias>typealias <loc>FooCFTypeRef</loc> = <ref:Class>FooCFType</ref></decl>
|
|
<decl:Func>@availability(*, unavailable, message="Core Foundation objects are automatically memory managed")
|
|
func <loc>FooCFTypeRelease(_: <ref:Class>FooCFType</ref>!)</loc></decl>
|
|
<decl:Class>class <loc>FooRepeatedMembers</loc> : <ref:Class>FooClassBase</ref> {
|
|
<decl:Func>func <loc>repeatedMethod()</loc></decl>
|
|
<decl:Func>func <loc>anotherMethod()</loc></decl>
|
|
<decl:Constructor><loc>init!()</loc></decl>
|
|
<decl:Constructor>convenience <loc>init!(float f: <ref:Struct>Float</ref>)</loc></decl>
|
|
}</decl>
|
|
<decl:Extension>extension <ref:Class><loc>FooRepeatedMembers</ref></loc> {
|
|
<decl:Var>var <loc>repeatedPropertyInCategory</loc>: <ref:Struct>Int32</ref></decl>
|
|
<decl:Func>func <loc>repeatedMethodInCategory()</loc></decl>
|
|
<decl:Var>var <loc>repeatedPropertyFromCategory</loc>: <ref:Struct>Int32</ref></decl>
|
|
<decl:Func>func <loc>repeatedMethodFromCategory()</loc></decl>
|
|
}</decl>
|
|
<decl:Extension>extension <ref:Class><loc>FooRepeatedMembers</ref></loc> {
|
|
}</decl>
|