Skip to content

Commit 339ab82

Browse files
committed
AST: Fix iOS -> visionOS version remap for @backDeployed attrs.
The version remapping for `@backDeployed` regressed due to a bug introduced by #81922. Also, fix some visionOS tests that have gotten out of date because we don't seem to be running them in CI. Resolves rdar://152542983.
1 parent 121aa40 commit 339ab82

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

lib/AST/Availability.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,8 @@ bool AvailabilityInference::updateBeforeAvailabilityDomainForFallback(
365365
const BackDeployedAttr *attr, const ASTContext &ctx,
366366
AvailabilityDomain &domain, llvm::VersionTuple &platformVer) {
367367
bool hasRemap = false;
368-
auto remappedDomain = domain.getRemappedDomain(ctx, hasRemap);
368+
auto remappedDomain = AvailabilityDomain::forPlatform(attr->Platform)
369+
.getRemappedDomain(ctx, hasRemap);
369370
if (!hasRemap)
370371
return false;
371372

test/attr/back_deployed_attr_func_visionos.swift renamed to test/SILGen/back_deployed_attr_func_visionos.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %target-swift-emit-sil -parse-as-library -module-name back_deploy %s -target %target-cpu-apple-xros1.0 -verify
2-
// RUN: %target-swift-emit-silgen -parse-as-library -module-name back_deploy %s -target %target-cpu-apple-xros1.0 | %FileCheck %s
2+
// RUN: %target-swift-emit-silgen -Xllvm -sil-print-types -parse-as-library -module-name back_deploy %s -target %target-cpu-apple-xros1.0 | %FileCheck %s
33

44
// REQUIRES: OS=xros
55

@@ -10,7 +10,7 @@
1010
// CHECK: return [[RESULT]] : $()
1111

1212
// -- Back deployment thunk for trivialFunc()
13-
// CHECK-LABEL: sil non_abi [serialized] [thunk] [ossa] @$s11back_deploy11trivialFuncyyFTwb : $@convention(thin) () -> ()
13+
// CHECK-LABEL: sil non_abi [serialized] [back_deployed_thunk] [ossa] @$s11back_deploy11trivialFuncyyFTwb : $@convention(thin) () -> ()
1414
// CHECK: bb0:
1515
// CHECK: [[MAJOR:%.*]] = integer_literal $Builtin.Word, 2
1616
// CHECK: [[MINOR:%.*]] = integer_literal $Builtin.Word, 0
@@ -45,7 +45,7 @@ public func trivialFunc() {}
4545
// CHECK: return [[RESULT]] : $()
4646

4747
// -- Back deployment thunk for trivialFunc_iOS()
48-
// CHECK-LABEL: sil non_abi [serialized] [thunk] [ossa] @$s11back_deploy15trivialFunc_iOSyyFTwb : $@convention(thin) () -> ()
48+
// CHECK-LABEL: sil non_abi [serialized] [back_deployed_thunk] [ossa] @$s11back_deploy15trivialFunc_iOSyyFTwb : $@convention(thin) () -> ()
4949
// CHECK: bb0:
5050
// CHECK: [[MAJOR:%.*]] = integer_literal $Builtin.Word, 1
5151
// CHECK: [[MINOR:%.*]] = integer_literal $Builtin.Word, 1

test/attr/attr_backDeployed_availability_visionos.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// RUN: %target-typecheck-verify-swift -parse-as-library
2-
3-
// REQUIRES: OS=xros
1+
// RUN: %empty-directory(%t/mock-sdk)
2+
// RUN: cp %S/../Inputs/MockPlatformRemapSDKConfig/SDKSettings.json %t/mock-sdk/SDKSettings.json
3+
// RUN: %swift -typecheck -verify -parse-stdlib -target arm64-apple-xros1.0 %s -sdk %t/mock-sdk
44

55
@backDeployed(before: visionOS 2) // Ok, introduced availability is inferred to be visionOS epoch
66
public func topLevelFunc() {}
@@ -51,7 +51,7 @@ public func availableSameVersionAsBackDeploymentAndAlsoAvailableEarlierOniOS() {
5151
@backDeployed(before: visionOS 2) // expected-error {{'@backDeployed' has no effect because 'availableAfterBackDeployment()' is not available before visionOS 2}}
5252
public func availableAfterBackDeployment() {}
5353

54-
@available(iOS 99, *) // expected-note {{'availableOniOSAfterBackDeploymentOniOS()' was introduced in visionOS 99}}
54+
@available(iOS 99, *) // expected-note {{'availableOniOSAfterBackDeploymentOniOS()' was introduced in iOS 99}}
5555
@backDeployed(before: iOS 17.4) // expected-error {{'@backDeployed' has no effect because 'availableOniOSAfterBackDeploymentOniOS()' is not available before visionOS 1.1}}
5656
public func availableOniOSAfterBackDeploymentOniOS() {}
5757

0 commit comments

Comments
 (0)