File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ // This test case used to crash when tsan ran before co-routine lowering.
2+ // RUN: %target-swift-frontend -emit-ir -sanitize=thread %s | %FileCheck %s
3+
4+ // TSan is currently only supported on 64 bit mac and simulators.
5+ // (We do not test the simulators here.)
6+ // REQUIRES: CPU=x86_64, OS=macosx
7+
8+ public class C { }
9+
10+ public struct Foobar {
11+ var things : [ String : C ] = [ : ]
12+ }
13+
14+ extension Foobar {
15+ public struct Index {
16+ fileprivate typealias MyIndex = Dictionary < String , C > . Values . Index
17+
18+ fileprivate let myIndex : MyIndex
19+
20+ fileprivate init ( _ index: MyIndex ) {
21+ self . myIndex = index
22+ }
23+ }
24+
25+ // We used to crash emitting the subscript function.
26+ // CHECK: define swiftcc { i8*, %T15tsan_coroutines1CC* } @"$s15tsan_coroutines6FoobarVyAA1CCAC5IndexVcir"
27+ @_borrowed
28+ public subscript( position: Index ) -> C {
29+ return things. values [ position. myIndex]
30+ }
31+ }
You can’t perform that action at this time.
0 commit comments