Skip to content

Commit 982b47d

Browse files
committed
Add Builtin.hopToActor to the feature list.
This builtin never occurs in @inlinable code. But apparently we still need to add a language feature for every builtin. This must allow older compilers to reparse the library source (though I don't know why that would ever happen!) Fixes rdar://80525569 error: module 'Builtin' has no member named 'hopToActor')
1 parent a34d757 commit 982b47d

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

include/swift/Basic/Features.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ LANGUAGE_FEATURE(BuiltinJob, 0, "Builtin.Job type", true)
4747
LANGUAGE_FEATURE(Sendable, 0, "Sendable and @Sendable", true)
4848
LANGUAGE_FEATURE(BuiltinExecutor, 0, "Builtin.Executor type", true)
4949
LANGUAGE_FEATURE(BuiltinContinuation, 0, "Continuation builtins", true)
50+
LANGUAGE_FEATURE(BuiltinHopToActor, 0, "Builtin.HopToActor", true)
5051
LANGUAGE_FEATURE(BuiltinTaskGroupWithArgument, 0, "TaskGroup builtins", true)
5152
LANGUAGE_FEATURE(InheritActorContext, 0, "@_inheritActorContext attribute", true)
5253
LANGUAGE_FEATURE(ImplicitSelfCapture, 0, "@_implicitSelfCapture attribute", true)

lib/AST/ASTPrinter.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2713,6 +2713,10 @@ static bool usesFeatureBuiltinContinuation(Decl *decl) {
27132713
return false;
27142714
}
27152715

2716+
static bool usesFeatureBuiltinHopToActor(Decl *decl) {
2717+
return false;
2718+
}
2719+
27162720
static bool usesFeatureBuiltinTaskGroupWithArgument(Decl *decl) {
27172721
return false;
27182722
}

stdlib/public/Concurrency/Task.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,11 @@ public func _runAsyncMain(_ asyncFun: @escaping () async throws -> ()) {
762762
Task.detached {
763763
do {
764764
#if !os(Windows)
765+
#if compiler(>=5.5) && $BuiltinHopToActor
765766
Builtin.hopToActor(MainActor.shared)
767+
#else
768+
fatalError("Swift compiler is incompatible with this SDK version")
769+
#endif
766770
#endif
767771
try await asyncFun()
768772
exit(0)

0 commit comments

Comments
 (0)