mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Exclude properties with initial values from the memberwise initializer if they are less accessible than the most accessible property, up to `internal`. Introduce a compatibility overload that continues to include the same properties as before until the next language mode. This is gated behind the `ExcludePrivateFromMemberwiseInit` feature. rdar://122416579
14 lines
343 B
Swift
14 lines
343 B
Swift
// RUN: %target-typecheck-verify-swift -swift-version 7 -enable-experimental-feature ExcludePrivateFromMemberwiseInit %s
|
|
|
|
// REQUIRES: swift_feature_ExcludePrivateFromMemberwiseInit
|
|
// REQUIRES: swift7
|
|
|
|
struct A {
|
|
var a: Int
|
|
private var b = 0
|
|
|
|
func foo() {
|
|
_ = Self(a: 0, b: 0) // expected-error {{extra argument 'b' in call}}
|
|
}
|
|
}
|