3
3
// Code should type check with a new enough deployment target:
4
4
// RUN: %target-swift-frontend -typecheck %s -target %target-cpu-apple-macos50
5
5
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
+
6
10
// REQUIRES: OS=macosx
7
11
8
12
@available ( macOS 50 , * )
9
- struct NewStruct { }
13
+ public struct NewStruct { }
10
14
11
15
@available ( macOS 50 , * )
12
16
@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
+ }
15
23
}
16
24
17
25
@available ( macOS 50 , * )
@@ -59,6 +67,21 @@ struct BadReferenceStruct2 {
59
67
lazy var z : Int = 42
60
68
}
61
69
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
+
62
85
// The same behavior should hold for enum elements with payloads.
63
86
@available ( macOS 50 , * )
64
87
enum GoodReferenceEnum {
@@ -84,3 +107,10 @@ enum BadReferenceEnum2 {
84
107
@available ( macOS 50 , * )
85
108
case x( NewStruct )
86
109
}
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