mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Computes the side effects for a function, which consists of argument- and global effects. This is similar to the ComputeEscapeEffects pass, just for side-effects.
38 lines
823 B
Swift
38 lines
823 B
Swift
// RUN: %target-swift-frontend -module-name main -O -emit-sil -primary-file %s | %FileCheck %s
|
|
|
|
protocol P {
|
|
func foo()
|
|
}
|
|
|
|
public struct Inner {
|
|
var x: Int
|
|
var y: Int
|
|
}
|
|
|
|
public struct S : P {
|
|
var i: Inner
|
|
|
|
func foo() {
|
|
print(i.x)
|
|
}
|
|
}
|
|
|
|
// Check that FSO does not crash due to a missing decl on the function argument.
|
|
|
|
// Following specializations should be done:
|
|
// * FSO: existential to protocol constrained generic
|
|
// * generic specialization <S>
|
|
// * FSO: argument explosion
|
|
|
|
// CHECK-LABEL: sil shared [noinline] @$s4main6testityyAA1P_pFTf4e_nAA1SV_Tg5Tf4x_n : $@convention(thin) (Int) -> () {
|
|
// CHECK: // %0 "p"
|
|
// CHECK: } // end sil function '$s4main6testityyAA1P_pFTf4e_nAA1SV_Tg5Tf4x_n'
|
|
@inline(never)
|
|
func testit(_ p: P) {
|
|
p.foo()
|
|
}
|
|
|
|
public func callit(s: S) {
|
|
testit(s)
|
|
}
|