File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
SwiftCompilerSources/Sources/Optimizer/InstructionSimplification Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,9 @@ private extension UnconditionalCheckedCastInst {
81
81
return
82
82
}
83
83
let conformance = sourceFormalType. instanceTypeOfMetatype. checkConformance ( to: proto)
84
- guard conformance. isValid else {
84
+ guard conformance. isValid,
85
+ conformance. matchesActorIsolation ( in: parentFunction)
86
+ else {
85
87
return
86
88
}
87
89
Original file line number Diff line number Diff line change 1
- // RUN: %target-sil-opt -enable-sil-verify-all %s -simplification -simplify-instruction=unconditional_checked_cast | %FileCheck %s
1
+ // RUN: %target-sil-opt -enable-sil-verify-all %s -simplification -simplify-instruction=unconditional_checked_cast -enable-experimental-feature IsolatedConformances | %FileCheck %s
2
+
3
+ // REQUIRES: swift_feature_IsolatedConformances
4
+ // REQUIRES: concurrency
2
5
3
6
import Swift
4
7
import Builtin
8
+ import _Concurrency
5
9
6
10
protocol P {}
7
11
protocol PC: AnyObject {}
@@ -12,6 +16,8 @@ struct T {}
12
16
13
17
class C {}
14
18
19
+ struct X : @MainActor P {}
20
+
15
21
// CHECK-LABEL: sil [ossa] @test_conforming_struct :
16
22
// CHECK: %1 = init_existential_metatype %0, $@thick any P.Type
17
23
// CHECK-NEXT: return %1
@@ -52,3 +58,14 @@ bb0(%0 : $@thick S.Type):
52
58
%1 = unconditional_checked_cast %0 to Int.Type
53
59
return %1
54
60
}
61
+
62
+ // CHECK-LABEL: sil [ossa] @test_isolated_conformance :
63
+ // CHECK: %1 = unconditional_checked_cast %0
64
+ // CHECK-NEXT: return %1
65
+ // CHECK: } // end sil function 'test_isolated_conformance'
66
+ sil [ossa] @test_isolated_conformance : $@convention(thin) (@thick X.Type) -> @thick any P.Type {
67
+ bb0(%0 : $@thick X.Type):
68
+ %1 = unconditional_checked_cast %0 to any P.Type
69
+ return %1
70
+ }
71
+
You can’t perform that action at this time.
0 commit comments