File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 1515#include " RValue.h"
1616#include " Scope.h"
1717#include " swift/AST/ASTContext.h"
18+ #include " swift/AST/Availability.h"
1819#include " swift/AST/ProtocolConformance.h"
1920#include " swift/Basic/Range.h"
2021
@@ -595,6 +596,17 @@ void SILGenFunction::emitPreconditionCheckExpectedExecutor(
595596 if (!checkExecutor)
596597 return ;
597598
599+ // Forego a check if instrinsic is unavailable, this could happen
600+ // in main-actor context.
601+ auto &C = checkExecutor->getASTContext ();
602+ if (!C.LangOpts .DisableAvailabilityChecking ) {
603+ auto deploymentAvailability = AvailabilityContext::forDeploymentTarget (C);
604+ auto declAvailability =
605+ AvailabilityInference::availableRange (checkExecutor, C);
606+ if (!deploymentAvailability.isContainedIn (declAvailability))
607+ return ;
608+ }
609+
598610 // We don't want the debugger to step into these.
599611 loc.markAutoGenerated ();
600612
Original file line number Diff line number Diff line change 1+ // RUN: %target-swift-frontend -primary-file %s -target %target-cpu-apple-macosx10.14 -enable-experimental-feature DynamicActorIsolation -emit-silgen -o - | %FileCheck %s
2+
3+ // REQUIRES: asserts
4+ // REQUIRES: concurrency
5+ // REQUIRES: OS=macosx
6+
7+ protocol P {
8+ associatedtype T
9+
10+ func fn( ) -> T ?
11+ }
12+
13+ @MainActor
14+ struct IsolatedType < T> : @preconcurrency P {
15+ func fn( ) -> T ? { nil }
16+ }
17+
18+ // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s38preconcurrency_conformances_backdeploy12IsolatedTypeVyxGAA1PA2aEP2fn1TQzSgyFTW
19+ // CHECK-NOT: function_ref @$ss22_checkExpectedExecutor14_filenameStart01_D6Length01_D7IsASCII5_line9_executoryBp_BwBi1_BwBetF
You can’t perform that action at this time.
0 commit comments