Files
swift-mirror/test/SILOptimizer/closure_specialize_dynamic_self.swift
Slava Pestov c14a4be04b SILOptimizer: Don't attempt closure specialization if the callee uses dynamic Self
Currently, closure specialization inserts arguments after the 'self'
parameter, which breaks dynamic Self.

Fixes <rdar://problem/31725007>.
2017-04-23 01:49:00 -07:00

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 })
}