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
AST: Get SPI status of PatternBindingDecl from anchoring VarDecl.
For property declarations, the `@_spi` attribute is attached to the VarDecl AST
node, rather than the PatternBindingDecl AST node, so the `isSPI()` query
should take this into account. Failing to do so caused the availability checker
to erroneously require that `@_spi` properties of types in `-library-level api`
libraries have availability annotations.
Resolves rdar://113587321.
ePublicAvailBetween:AtDeploymentTarget, // expected-error {{'AtDeploymentTarget' is only available in macOS 10.15 or newer; clients of 'Test' may have a lower deployment target}}
761
761
fPublicAvailBetween:AfterDeploymentTarget // expected-error {{'AfterDeploymentTarget' is only available in macOS 11 or newer}}
762
762
763
+
@_spi(Private)
764
+
publicvaraSPI:NoAvailable,
765
+
bSPI:BeforeInliningTarget,
766
+
cSPI:AtInliningTarget,
767
+
dSPI:BetweenTargets,
768
+
eSPI:AtDeploymentTarget,
769
+
fSPI:AfterDeploymentTarget // expected-error {{'AfterDeploymentTarget' is only available in macOS 11 or newer}}
770
+
771
+
@available(macOS, unavailable)
772
+
publicvaraUnavailable:NoAvailable{
773
+
NoAvailable()
774
+
}
775
+
776
+
@available(macOS, unavailable)
777
+
publicvarbUnavailable:BeforeInliningTarget{
778
+
BeforeInliningTarget()
779
+
}
780
+
781
+
@available(macOS, unavailable)
782
+
publicvarcUnavailable:AtInliningTarget{
783
+
AtInliningTarget()
784
+
}
785
+
786
+
@available(macOS, unavailable)
787
+
publicvardUnavailable:BetweenTargets{
788
+
BetweenTargets()
789
+
}
790
+
791
+
@available(macOS, unavailable)
792
+
publicvareUnavailable:AtDeploymentTarget{
793
+
AtDeploymentTarget()
794
+
}
795
+
796
+
@available(macOS, unavailable)
797
+
publicvarfUnavailable:AfterDeploymentTarget{
798
+
AfterDeploymentTarget() // expected-error {{'AfterDeploymentTarget' is only available in macOS 11 or newer}} expected-note {{add 'if #available' version check}}
799
+
}
800
+
763
801
// The inferred types of public properties are exposed.
publictypealiasF=AfterDeploymentTarget // expected-error {{'AfterDeploymentTarget' is only available in macOS 11 or newer}} expected-note {{add @available attribute to enclosing type alias}}
1358
1396
}
1359
1397
1398
+
// MARK: - Enums with payloads
1399
+
1400
+
publicenumPublicNoAvailableEnumWithPayloads{ // expected-note 5 {{add @available attribute to enclosing enum}}
1401
+
case aNoAvailable(NoAvailable),
1402
+
bNoAvailable(BeforeInliningTarget),
1403
+
cNoAvailable(AtInliningTarget),
1404
+
dNoAvailable(BetweenTargets), // expected-error {{'BetweenTargets' is only available in macOS 10.14.5 or newer; clients of 'Test' may have a lower deployment target}}
1405
+
eNoAvailable(AtDeploymentTarget), // expected-error {{'AtDeploymentTarget' is only available in macOS 10.15 or newer; clients of 'Test' may have a lower deployment target}}
1406
+
fNoAvailable(AfterDeploymentTarget) // expected-error {{'AfterDeploymentTarget' is only available in macOS 11 or newer}}
1407
+
1408
+
@available(macOS, introduced:10.15)
1409
+
case aAtDeploymentTarget(NoAvailable),
1410
+
bAtDeploymentTarget(BeforeInliningTarget),
1411
+
cAtDeploymentTarget(AtInliningTarget),
1412
+
dAtDeploymentTarget(BetweenTargets),
1413
+
eAtDeploymentTarget(AtDeploymentTarget),
1414
+
fAtDeploymentTarget(AfterDeploymentTarget) // expected-error {{'AfterDeploymentTarget' is only available in macOS 11 or newer}}
1415
+
1416
+
@_spi(Private)
1417
+
case aSPI(NoAvailable),
1418
+
bSPI(BeforeInliningTarget),
1419
+
cSPI(AtInliningTarget),
1420
+
dSPI(BetweenTargets),
1421
+
eSPI(AtDeploymentTarget),
1422
+
fSPI(AfterDeploymentTarget) // expected-error {{'AfterDeploymentTarget' is only available in macOS 11 or newer}}
1423
+
1424
+
@available(macOS, unavailable)
1425
+
case aUnavailable(NoAvailable),
1426
+
bUnavailable(BeforeInliningTarget),
1427
+
cUnavailable(AtInliningTarget),
1428
+
dUnavailable(BetweenTargets),
1429
+
eUnavailable(AtDeploymentTarget),
1430
+
fUnavailable(AfterDeploymentTarget)
1431
+
}
1432
+
1360
1433
// MARK: - Class inheritance
1361
1434
1362
1435
// FIXME: Duplicate 'add @available' emitted when classes are nested in a decl
0 commit comments