mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This is the same restriction as with @frozen structs. Even though classes are lowered as a single reference and clients don't usually manipulate their stored property layout directly, @frozen classes can have @inlinable designated initializers.
19 lines
969 B
Swift
19 lines
969 B
Swift
// RUN: %target-typecheck-verify-swift -swift-version 5
|
|
|
|
private struct PrivateType {}
|
|
// expected-note@-1 {{struct 'PrivateType' is not '@usableFromInline' or public}}
|
|
// expected-note@-2 {{initializer 'init()' is not '@usableFromInline' or public}}
|
|
// expected-note@-3 {{type declared here}}
|
|
|
|
@_fixed_layout public class UsesPrivateType {
|
|
private var y1: PrivateType
|
|
// expected-error@-1 {{type referenced from a stored property in a '@frozen' struct must be '@usableFromInline' or public}}
|
|
|
|
private var y2 = PrivateType()
|
|
// expected-error@-1 {{struct 'PrivateType' is private and cannot be referenced from a property initializer in a '@frozen' type}}
|
|
// expected-error@-2 {{initializer 'init()' is private and cannot be referenced from a property initializer in a '@frozen' type}}
|
|
// expected-error@-3 {{type referenced from a stored property with inferred type 'PrivateType' in a '@frozen' struct must be '@usableFromInline' or public}}
|
|
|
|
init() {}
|
|
}
|