[swift-users] typealias for Generic in Generic

Седых Александр se-a at mail.ru
Tue Apr 4 12:25:37 CDT 2017


Hello.
I stumbled on ambiguous behaviour of compiler. Is not allowed explicitly indicate type in Generic typealias.

struct Сarriage<T> {
     let g = [ T ]()
}
 
struct Coma<T> {
     typealias R =  Сarriage < T >
     let m =  R ()
     let d =  R < String >() \\  error: cannot specialize non-generic type 'Сarriage<T>'
     var b =  Сarriage < String >()
     mutating func work() {
         m .g.append(<#T##newElement: T##T#>) \\ what I can write here?
         b . g . append ( "Z" )
    }
}

-- 
Седых Александр
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170404/cdad65a1/attachment.html>


More information about the swift-users mailing list