mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Currently, closure specialization inserts arguments after the 'self' parameter, which breaks dynamic Self. Fixes <rdar://problem/31725007>.
24 lines
418 B
Swift
24 lines
418 B
Swift
// RUN: %target-swift-frontend -emit-sil -O -primary-file %s
|
|
|
|
// Just make sure we skip the optimization and not crash here.
|
|
//
|
|
// Eventually, we can make this work.
|
|
//
|
|
// <rdar://problem/31725007>
|
|
|
|
class Foo {
|
|
required init() {}
|
|
|
|
static func foo(_ f: () -> ()) -> Self {
|
|
f()
|
|
return self.init()
|
|
}
|
|
}
|
|
|
|
class Bar: Foo {}
|
|
|
|
func closures(_ x: String) {
|
|
print(Foo.foo { _ = x })
|
|
print(Bar.foo { _ = x })
|
|
}
|