File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-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+ public class C { }
5+
6+ public struct Foobar {
7+ var things : [ String : C ] = [ : ]
8+ }
9+
10+ extension Foobar {
11+ public struct Index {
12+ fileprivate typealias MyIndex = Dictionary < String , C > . Values . Index
13+
14+ fileprivate let myIndex : MyIndex
15+
16+ fileprivate init ( _ index: MyIndex ) {
17+ self . myIndex = index
18+ }
19+ }
20+
21+ // We used to crash emitting the subscript function.
22+ // CHECK: define swiftcc { i8*, %T15tsan_coroutines1CC* } @"$s15tsan_coroutines6FoobarVyAA1CCAC5IndexVcir"
23+ @_borrowed
24+ public subscript( position: Index ) -> C {
25+ return things. values [ position. myIndex]
26+ }
27+ }
You can’t perform that action at this time.
0 commit comments