You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sema: Make suppression of availability checking for types more consistent.
Availability checking for types was only suppressed when the immediate context
for the use of the type was explicitly marked unavailable. Availability is
lexical so the checking should be suppressed in the entire scope instead.
let _ :ClassAvailableOn51=methodWithPotentiallyUnavailableReturnType() // expected-error {{'ClassAvailableOn51' is only available in macOS 51 or newer}}
812
-
// expected-note@-1 {{add 'if #available' version check}}
811
+
let _ :ClassAvailableOn51=methodWithPotentiallyUnavailableReturnType()
structNeverAvailableContainer{ // expected-note {{'NeverAvailableContainer' has been explicitly marked unavailable here}}
136
136
letnever_var:NeverAvailable=never() // expected-error {{'never()' is unavailable}}
137
137
letosx_var:OSXUnavailable=osx() // expected-error {{'osx()' is unavailable}}
138
-
// expected-error@-1 {{'OSXUnavailable' is unavailable in macOS}}
139
138
letosx_extension_var:OSXAppExtensionsUnavailable=osx_extension() // expected-error {{'osx_extension()' is unavailable in application extensions for macOS}}
140
-
// expected-error@-1 {{'OSXAppExtensionsUnavailable' is unavailable in application extensions for macOS}}
141
139
}
142
140
143
141
@available(OSX, unavailable)
144
142
structOSXUnavailableContainer{ // expected-note {{'OSXUnavailableContainer' has been explicitly marked unavailable here}}
145
143
letnever_var:NeverAvailable=never() // expected-error {{'never()' is unavailable}}
146
-
// expected-error@-1 {{'NeverAvailable' is unavailable}}
Copy file name to clipboardexpand all lines: test/attr/attr_inlinable_available.swift
+5-6
Original file line number
Diff line number
Diff line change
@@ -1159,7 +1159,7 @@ public struct UnavailablePublicStruct {
1159
1159
cPublic:AtInliningTarget,
1160
1160
dPublic:BetweenTargets,
1161
1161
ePublic:AtDeploymentTarget,
1162
-
fPublic:AfterDeploymentTarget, // expected-error {{'AfterDeploymentTarget' is only available in macOS 11 or newer}}
1162
+
fPublic:AfterDeploymentTarget,
1163
1163
gPublic:Unavailable
1164
1164
1165
1165
publicvaraPublicInit:Any=NoAvailable(),
@@ -1175,7 +1175,7 @@ public struct UnavailablePublicStruct {
1175
1175
cInternal:AtInliningTarget=.init(),
1176
1176
dInternal:BetweenTargets=.init(),
1177
1177
eInternal:AtDeploymentTarget=.init(),
1178
-
fInternal:AfterDeploymentTarget=.init(), // expected-error {{'AfterDeploymentTarget' is only available in macOS 11 or newer}}
1178
+
fInternal:AfterDeploymentTarget=.init(),
1179
1179
gInternal:Unavailable=.init()
1180
1180
}
1181
1181
@@ -1562,8 +1562,7 @@ public protocol UnavailableProtoWithAssoc {
1562
1562
associatedtypeC:AtInliningTargetProto
1563
1563
associatedtypeD:BetweenTargetsProto
1564
1564
associatedtypeE:AtDeploymentTargetProto
1565
-
associatedtypeF:AfterDeploymentTargetProto // expected-error {{'AfterDeploymentTargetProto' is only available in}}
1566
-
// expected-note@-1{{add @available attribute to enclosing associated type}}
1565
+
associatedtypeF:AfterDeploymentTargetProto
1567
1566
associatedtypeG:UnavailableProto
1568
1567
}
1569
1568
@@ -1596,7 +1595,7 @@ public enum UnavailableEnumWithTypeAliases {
1596
1595
publictypealiasC=AtInliningTarget
1597
1596
publictypealiasD=BetweenTargets
1598
1597
publictypealiasE=AtDeploymentTarget
1599
-
publictypealiasF=AfterDeploymentTarget // expected-error {{'AfterDeploymentTarget' is only available in macOS 11 or newer}} expected-note {{add @available attribute to enclosing type alias}}
1598
+
publictypealiasF=AfterDeploymentTarget
1600
1599
publictypealiasG=Unavailable
1601
1600
}
1602
1601
@@ -1688,6 +1687,6 @@ public enum UnavailableEnumWithClasses {
publicclassInheritsAfterDeploymentTarget:AfterDeploymentTargetClass{} // expected-error {{'AfterDeploymentTargetClass' is only available in}} expected-note 2 {{add @available attribute to enclosing class}}
0 commit comments