You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check consistency of isolation of conformances within other conformances
When a protocol conformance somehow depends on an isolated conformance, it
must itself be isolated to the same global actor as the conformance on
which it depends.
Copy file name to clipboardExpand all lines: test/Concurrency/isolated_conformance.swift
+38Lines changed: 38 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -40,3 +40,41 @@ class CMismatchedIsolation: isolated P {
40
40
classC:isolated P {
41
41
func f(){} // okay
42
42
}
43
+
44
+
// Associated conformances with isolation
45
+
46
+
protocolQ{
47
+
associatedtypeA:P
48
+
}
49
+
50
+
// expected-error@+2{{conformance of 'SMissingIsolation' to 'Q' depends on main actor-isolated conformance of 'C' to 'P'; mark it as 'isolated'}}{{27-27=isolated }}
51
+
@MainActor
52
+
structSMissingIsolation:Q{
53
+
typealiasA=C
54
+
}
55
+
56
+
structPWrapper<T:P>:P{
57
+
func f(){}
58
+
}
59
+
60
+
// expected-error@+2{{conformance of 'SMissingIsolationViaWrapper' to 'Q' depends on main actor-isolated conformance of 'C' to 'P'; mark it as 'isolated'}}
61
+
@MainActor
62
+
structSMissingIsolationViaWrapper:Q{
63
+
typealiasA=PWrapper<C>
64
+
}
65
+
66
+
@SomeGlobalActor
67
+
classC2:isolated P {
68
+
func f(){}
69
+
}
70
+
71
+
@MainActor
72
+
structS:isolated Q {
73
+
typealiasA=C
74
+
}
75
+
76
+
// expected-error@+2{{main actor-isolated conformance of 'SMismatchedActors' to 'Q' cannot depend on global actor 'SomeGlobalActor'-isolated conformance of 'C2' to 'P'}}
0 commit comments