Files
swift-mirror/test/SILGen/array_literal_abstraction.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

25 lines
919 B
Swift

// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
// Verify that reabstraction happens when forming container literals.
// <rdar://problem/16039286>
// CHECK-LABEL: sil hidden @_T025array_literal_abstraction0A9_of_funcsSayyycGyF
// CHECK: pointer_to_address {{.*}} $*@callee_guaranteed (@in ()) -> @out ()
func array_of_funcs() -> [(() -> ())] {
return [{}, {}]
}
// CHECK-LABEL: sil hidden @_T025array_literal_abstraction13dict_of_funcss10DictionaryVySiyycGyF
// CHECK: pointer_to_address {{.*}} $*(Int, @callee_guaranteed (@in ()) -> @out ())
func dict_of_funcs() -> Dictionary<Int, () -> ()> {
return [0: {}, 1: {}]
}
func vararg_funcs(_ fs: (() -> ())...) {}
// CHECK-LABEL: sil hidden @_T025array_literal_abstraction17call_vararg_funcsyyF
// CHECK: pointer_to_address {{.*}} $*@callee_guaranteed (@in ()) -> @out ()
func call_vararg_funcs() {
vararg_funcs({}, {})
}