Files
swift-mirror/test/SILGen/local_captures.swift
Arnold Schwaighofer 0971d82f70 SILGen: Remaining fixes for @callee_guaranteed closures and enable it
- Fix block to func reabstraction thunks block argument handling
- Forward cast ownership
- Fix applyPartiallyAppliedSuperMethod ownership for @callee_guaranteed closures
- Avoid a copy in buildBlockToFuncThunkBody
- Update tests for callee_guaranteed closures

SR-5441
rdar://33255593
2017-11-15 19:46:08 -08:00

26 lines
868 B
Swift

// RUN: %target-swift-frontend -parse-as-library -emit-silgen -enable-sil-ownership %s | %FileCheck %s
// Check that we don't crash if a local function references another local
// function without captures.
// CHECK-LABEL: sil hidden @_T014local_captures10globalfuncyycyF : $@convention(thin) () -> @owned @callee_guaranteed () -> ()
func globalfunc() -> () -> () {
// CHECK-LABEL: sil private @_T014local_captures10globalfuncyycyF0A4FuncL_yyF : $@convention(thin) () -> ()
func localFunc() {
}
// CHECK-LABEL: sil private @_T014local_captures10globalfuncyycyF6callitL_yyF : $@convention(thin) () -> ()
func callit() {
localFunc()
}
// CHECK-LABEL: sil private @_T014local_captures10globalfuncyycyF5getitL_yycyF : $@convention(thin) () -> @owned @callee_guaranteed () -> ()
func getit() -> () -> () {
return localFunc
}
callit()
return getit()
}