File tree Expand file tree Collapse file tree 4 files changed +29
-9
lines changed Expand file tree Collapse file tree 4 files changed +29
-9
lines changed Original file line number Diff line number Diff line change @@ -259,7 +259,7 @@ AvailabilityContext ASTContext::getSwift50Availability() {
259
259
return AvailabilityContext (
260
260
VersionRange::allGTE (llvm::VersionTuple (12 ,2 )));
261
261
} else if (target.isWatchOS ()) {
262
- if (target.getArch () == llvm::Triple::ArchType::x86_64 )
262
+ if (target.isArch64Bit () )
263
263
return AvailabilityContext::alwaysAvailable ();
264
264
265
265
return AvailabilityContext (
@@ -297,6 +297,9 @@ AvailabilityContext ASTContext::getSwift51Availability() {
297
297
return AvailabilityContext (
298
298
VersionRange::allGTE (llvm::VersionTuple (13 ,0 ,0 )));
299
299
} else if (target.isWatchOS ()) {
300
+ if (target.isArch64Bit ())
301
+ return AvailabilityContext::alwaysAvailable ();
302
+
300
303
return AvailabilityContext (
301
304
VersionRange::allGTE (llvm::VersionTuple (6 ,0 ,0 )));
302
305
} else {
Original file line number Diff line number Diff line change @@ -417,14 +417,20 @@ swift::getSwiftRuntimeCompatibilityVersionForTarget(
417
417
}
418
418
}
419
419
} else if (Triple.isWatchOS ()) {
420
+ auto floorFor64bits = [&Triple](llvm::VersionTuple v) {
421
+ if (!Triple.isArch64Bit ()) return v;
422
+ // 64-bit watchOS was introduced with Swift 5.3
423
+ return MAX (v, llvm::VersionTuple (5 , 3 ));
424
+ };
425
+
420
426
Triple.getWatchOSVersion (Major, Minor, Micro);
421
427
if (Major <= 5 ) {
422
- return llvm::VersionTuple (5 , 0 );
428
+ return floorFor64bits ( llvm::VersionTuple (5 , 0 ) );
423
429
} else if (Major <= 6 ) {
424
430
if (Minor <= 1 ) {
425
- return llvm::VersionTuple (5 , 1 );
431
+ return floorFor64bits ( llvm::VersionTuple (5 , 1 ) );
426
432
} else {
427
- return llvm::VersionTuple (5 , 2 );
433
+ return floorFor64bits ( llvm::VersionTuple (5 , 2 ) );
428
434
}
429
435
}
430
436
}
Original file line number Diff line number Diff line change @@ -153,11 +153,14 @@ static ValueDecl *deriveActor_unownedExecutor(DerivedConformance &derived) {
153
153
if (property->getFormalAccess () == AccessLevel::Open)
154
154
property->overwriteAccess (AccessLevel::Public);
155
155
156
- // Clone any @available attributes from UnownedSerialExecutor.
157
- // Really, though, the whole actor probably needs to be marked as
158
- // unavailable.
159
- for (auto attr: executorDecl->getAttrs ().getAttributes <AvailableAttr>())
160
- property->getAttrs ().add (attr->clone (ctx, /* implicit*/ true ));
156
+ // Infer availability.
157
+ SmallVector<const Decl *, 2 > asAvailableAs;
158
+ asAvailableAs.push_back (executorDecl);
159
+ if (auto enclosingDecl = property->getInnermostDeclWithAvailability ())
160
+ asAvailableAs.push_back (enclosingDecl);
161
+
162
+ AvailabilityInference::applyInferredAvailableAttrs (
163
+ property, asAvailableAs, ctx);
161
164
162
165
auto getter =
163
166
derived.addGetterToReadOnlyDerivedProperty (property, executorType);
Original file line number Diff line number Diff line change @@ -11,3 +11,11 @@ actor A { } // expected-error{{concurrency is only available in}}
11
11
// Allow this without any availability for Historical Reasons.
12
12
public func swift_deletedAsyncMethodError( ) async {
13
13
}
14
+
15
+ // Ensure that our synthesis of the actor's unownedExecutor does not cause
16
+ // availability errors.
17
+ @available ( macOS 12 . 0 , * )
18
+ struct S {
19
+ actor A {
20
+ }
21
+ }
You can’t perform that action at this time.
0 commit comments