Files
swift-mirror/test/Constraints/rdar35142121.swift
Joe Groff 69e4b95fb8 SIL: Model noescape partial_applys with ownership in OSSA.
Although nonescaping closures are representationally trivial pointers to their
on-stack context, it is useful to model them as borrowing their captures, which
allows for checking correct use of move-only values across the closure, and
lets us model the lifetime dependence between a closure and its captures without
an ad-hoc web of `mark_dependence` instructions.

During ownership elimination, We eliminate copy/destroy_value instructions and
end the partial_apply's lifetime with an explicit dealloc_stack as before,
for compatibility with existing IRGen and non-OSSA aware passes.
2023-02-16 21:43:53 -08:00

13 lines
262 B
Swift

// RUN: %target-swift-frontend -emit-sil -verify %s | %FileCheck %s
func foo<T>(_ a: T) -> Int {
return 0
}
func foo(_ a: (Int) -> (Int)) -> Int {
return 42
}
// CHECK: function_ref @$s12rdar351421213fooyS3iXEF :
let _ = foo({ (a: Int) -> Int in a + 1 })