File tree Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change 1
- // RUN: %target-run-simple-swift(-Xfrontend -sil-verify-all)
2
- // RUN: %target-run-simple-swift(-O -Xfrontend -sil-verify-all)
1
+ // RUN: %target-run-simple-swift(-Xfrontend -sil-verify-all) | %FileCheck %s
2
+ // RUN: %target-run-simple-swift(-O -Xfrontend -sil-verify-all) | %FileCheck %s
3
3
4
4
// REQUIRES: executable_test
5
5
6
6
import StdlibUnittest
7
+ import Foundation
7
8
8
9
defer { runAllTests ( ) }
9
10
@@ -155,3 +156,25 @@ Tests.test("global borrowing access") {
155
156
expectEqual ( HasStatic . b. y. data, 121 )
156
157
}
157
158
159
+ // coverage for rdar://132915515
160
+ // CHECK-LABEL: borrowing get on copyable type
161
+ Tests . test ( " borrowing get on copyable type " ) {
162
+ struct Loaner {
163
+ let value : UUID
164
+ var property : UUID { borrowing get { value } }
165
+ borrowing func method( ) -> UUID { value }
166
+ }
167
+
168
+ func printLoanedValue( _ loaner: borrowing Loaner ) {
169
+ // CHECK: UUID = [[UUID_VAL:.*]]
170
+ print ( " UUID = \( loaner. property) " )
171
+
172
+ // CHECK: UUID = [[UUID_VAL]]
173
+ print ( " UUID = \( loaner. method ( ) ) " )
174
+ }
175
+
176
+ do {
177
+ let l = Loaner ( value: UUID ( ) )
178
+ printLoanedValue ( l)
179
+ }
180
+ }
You can’t perform that action at this time.
0 commit comments