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+ // RUN: %target-swift-frontend -O -emit-sil %s -disable-availability-checking | %FileCheck %s --check-prefix=CHECK-SIL
2+
3+ public protocol P {
4+ mutating func mutate( _ other: Self )
5+ }
6+
7+ // CHECK-SIL-LABEL: sil @$s38mutable_span_stdlib_bounds_check_tests0a1_B7_doubleyys11MutableSpanVyxGzAA1PRzlF :
8+ // CHECK-SIL: bb3({{.*}}):
9+ // CHECK-SIL-NOT: end_cow_mutation
10+ // CHECK-SIL-NOT: cond_fail "index out of bounds"
11+ // CHECK-SIL-LABEL: } // end sil function '$s38mutable_span_stdlib_bounds_check_tests0a1_B7_doubleyys11MutableSpanVyxGzAA1PRzlF'
12+ public func mutable_span_double< T: P > ( _ ms: inout MutableSpan < T > ) {
13+ for i in ms. indices {
14+ ms [ i] . mutate ( ms [ i] )
15+ }
16+ }
17+
18+ extension Int : P {
19+ public mutating func mutate( _ other: Int ) {
20+ self += other
21+ }
22+ }
23+
24+ // CHECK-SIL-LABEL: sil @$s38mutable_span_stdlib_bounds_check_tests17specializedCalleryySaySiGzF : $@convention(thin) (@inout Array<Int>) -> () {
25+ // CHECK-SIL-NOT: cond_fail "index out of bounds"
26+ // CHECK-SIL-LABEL: } // end sil function '$s38mutable_span_stdlib_bounds_check_tests17specializedCalleryySaySiGzF'
27+ public func specializedCaller( _ array: inout Array < Int > ) {
28+ var mut = array. mutableSpan
29+ mutable_span_double ( & mut)
30+ }
31+
You can’t perform that action at this time.
0 commit comments