33// Code should type check with a new enough deployment target:
44// RUN: %target-swift-frontend -typecheck %s -target %target-cpu-apple-macos50
55
6+ // Code should also type check when the library client deployment target is
7+ // lowered via -target-min-inlining-version.
8+ // RUN: %target-swift-frontend -typecheck %s -target %target-cpu-apple-macos50 -enable-library-evolution -target-min-inlining-version min
9+
610// REQUIRES: OS=macosx
711
812@available ( macOS 50 , * )
9- struct NewStruct { }
13+ public struct NewStruct { }
1014
1115@available ( macOS 50 , * )
1216@propertyWrapper
13- struct NewPropertyWrapper < Value> {
14- var wrappedValue : Value
17+ public struct NewPropertyWrapper < Value> {
18+ public var wrappedValue : Value
19+
20+ public init ( wrappedValue: Value ) {
21+ self . wrappedValue = wrappedValue
22+ }
1523}
1624
1725@available ( macOS 50 , * )
@@ -59,6 +67,21 @@ struct BadReferenceStruct2 {
5967 lazy var z : Int = 42
6068}
6169
70+ @available ( macOS 40 , * )
71+ public struct PublicStruct {
72+ // expected-error@+1 {{stored properties cannot be marked potentially unavailable with '@available'}}
73+ @available ( macOS 50 , * )
74+ public var x : NewStruct
75+
76+ // expected-error@+1 {{stored properties cannot be marked potentially unavailable with '@available'}}
77+ @available ( macOS 50 , * )
78+ @NewPropertyWrapper public var y : Int
79+
80+ // expected-error@+1 {{stored properties cannot be marked potentially unavailable with '@available'}}
81+ @available ( macOS 50 , * )
82+ public lazy var z : Int = 42
83+ }
84+
6285// The same behavior should hold for enum elements with payloads.
6386@available ( macOS 50 , * )
6487enum GoodReferenceEnum {
@@ -84,3 +107,10 @@ enum BadReferenceEnum2 {
84107 @available ( macOS 50 , * )
85108 case x( NewStruct )
86109}
110+
111+ @available ( macOS 40 , * )
112+ public enum PublicReferenceEnum {
113+ // expected-error@+1 {{enum cases with associated values cannot be marked potentially unavailable with '@available'}}
114+ @available ( macOS 50 , * )
115+ case x( NewStruct )
116+ }
0 commit comments