- Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathdynamic_self_swift4.swift
24 lines (19 loc) · 729 Bytes
/
dynamic_self_swift4.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// RUN: %target-typecheck-verify-swift -swift-version 4
// ----------------------------------------------------------------------------
// Semi-bogus factory init pattern -- Swift 4 permitted this for non-final
// classes, which is unsound, but swift-corelibs-foundation made use of
// this, so possibly there are other usages in the wild.
//
// See test/decl/func/dynamic_self.swift for the Swift 5 test case.
protocolFactoryPattern{
init(factory:@autoclosure()->Self)
}
extensionFactoryPattern{
init(factory:@autoclosure()->Self){self=factory()}
}
classFactory:FactoryPattern{
init(_string:String){}
convenienceinit(string:String){
self.init(factory:Factory(_string: string))
}
}