Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protocol Foo {
- associatedtype F
- }
- class FooClass : Foo {
- typealias F = String
- }
- class Bar<F:Foo> {
- let foo: F
- init(){
- // Error, cannot assign value of type 'FooClass' to type 'F'
- foo = FooClass()
- }
- }
- func weird<F:Foo>(_ f: F){ }
- func test(){
- weird(FooClass()) // this works
- }
- class Bar<F:Foo> {
- let foo: FooClass.F
- init(){
- foo = FooClass.F()
- }
- }
- class Bar<F:Foo> {
- let foo: FooClass
- init(){
- foo = FooClass()
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement