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
48 lines
1.8 KiB
Swift
48 lines
1.8 KiB
Swift
// RUN: %target-swift-frontend -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen | FileCheck %s
|
|
|
|
// REQUIRES: objc_interop
|
|
|
|
import gizmo
|
|
|
|
|
|
// CHECK-DAG: sil shared @_TFOSC16NSRuncingOptionsCfMS_FT8rawValueSi_GSqS__
|
|
// CHECK-DAG: sil shared @_TFOSC16NSRuncingOptionsg8rawValueSi
|
|
// CHECK-DAG: sil shared @_TFOSC16NSRuncingOptionsg9hashValueSi
|
|
|
|
// CHECK-DAG: sil shared @_TZF5gizmooi2eeFTOSC16NSRuncingOptionsS0__Sb
|
|
|
|
// CHECK-DAG: sil shared [transparent] @_TFOSC16NSRuncingOptions5MinceFMS_S_
|
|
// CHECK-DAG: sil shared [transparent] @_TFOSC16NSRuncingOptions12QuinceSlicedFMS_S_
|
|
// CHECK-DAG: sil shared [transparent] @_TFOSC16NSRuncingOptions15QuinceJuliennedFMS_S_
|
|
// CHECK-DAG: sil shared [transparent] @_TFOSC16NSRuncingOptions11QuinceDicedFMS_S_
|
|
|
|
var runcing: NSRuncingOptions = .Mince
|
|
|
|
var raw = runcing.rawValue
|
|
var eq = runcing == .QuinceSliced
|
|
var hash = runcing.hashValue
|
|
|
|
func testEm<E: Equatable>(x: E, _ y: E) {}
|
|
func hashEm<H: Hashable>(x: H) {}
|
|
func rawEm<R: RawRepresentable>(x: R) {}
|
|
|
|
testEm(NSRuncingOptions.Mince, .QuinceSliced)
|
|
hashEm(NSRuncingOptions.Mince)
|
|
rawEm(NSRuncingOptions.Mince)
|
|
rawEm(NSFungingMask.Asset)
|
|
|
|
protocol Bub {}
|
|
|
|
extension NSRuncingOptions: Bub {}
|
|
|
|
// CHECK-DAG: sil_witness_table shared NSRuncingOptions: RawRepresentable module gizmo
|
|
// CHECK-DAG: sil_witness_table shared NSRuncingOptions: Equatable module gizmo
|
|
// CHECK-DAG: sil_witness_table shared NSRuncingOptions: Hashable module gizmo
|
|
// CHECK-DAG: sil_witness_table shared NSFungingMask: RawRepresentable module gizmo
|
|
|
|
// CHECK-DAG: sil shared [transparent] [thunk] @_TTWOSC16NSRuncingOptionsSs16RawRepresentable5gizmoFS0_CUS0__U__fMQPS0_FT8rawValueQS2_8RawValue_GSqS2__
|
|
|
|
// Extension conformances get linkage occording to the protocol's accessibility, as normal.
|
|
// CHECK-DAG: sil_witness_table hidden NSRuncingOptions: Bub module objc_enum
|
|
|