File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ // RUN: %target-swift-frontend %s -emit-sil \
2+ // RUN: -disable-experimental-parser-round-trip \
3+ // RUN: -enable-experimental-feature NonescapableTypes \
4+ // RUN: -enable-experimental-feature NoncopyableGenerics \
5+ // RUN: -enable-experimental-lifetime-dependence-inference | %FileCheck %s
6+ // REQUIRES: noncopyable_generics
7+
8+ protocol P {
9+ associatedtype E : ~ Escapable
10+ borrowing func getE( ) -> _borrow( self ) E
11+ }
12+
13+ extension P {
14+ borrowing func getDefault( ) -> _borrow( self ) E {
15+ return getE ( )
16+ }
17+ }
18+
19+ public struct View : ~ Escapable {
20+ @_unsafeNonescapableResult
21+ init ( ) { }
22+ }
23+
24+ public struct PView : P {
25+ borrowing func getE( ) -> _borrow( self ) View { return View ( ) }
26+ }
27+
28+ public func test( pview: consuming PView ) -> _consume( pview ) View {
29+ return pview. getDefault ( )
30+ }
31+
32+ // CHECK: sil hidden @$s28lifetime_dependence_generics1PPAAE10getDefault1EQzyF : $@convention(method) <Self where Self : P> (@in_guaranteed Self) -> _borrow(0) @out Self.E {
33+
34+ // CHECK: sil hidden @$s28lifetime_dependence_generics5PViewV4getEAA4ViewVyF : $@convention(method) (PView) -> _borrow(0) @owned View {
35+
36+ // CHECK: sil private [transparent] [thunk] @$s28lifetime_dependence_generics5PViewVAA1PA2aDP4getE1EQzyFTW : $@convention(witness_method: P) (@in_guaranteed PView) -> _borrow(0) @out View {
37+
38+ // CHECK: sil @$s28lifetime_dependence_generics4test5pviewAA4ViewVAA5PViewVn_tF : $@convention(thin) (PView) -> _inherit(1) @owned View {
You can’t perform that action at this time.
0 commit comments