[swift-users] Still can't derive from a generic class

Jon Shier jon at jonshier.com
Tue Aug 29 12:28:51 CDT 2017


Ah, I see. Making a subclass that inherits from a superclass generic to the subclass doesn’t seem like it should be a thing, but I’m not a type theorist. In any case, this is a bug (unexpected runtime crash and all) and you should file it. 



Jon

> On Aug 29, 2017, at 1:25 PM, Joanna Carter <joanna at carterconsulting.org.uk> wrote:
> 
> Hi Jon
> 
>> Le 29 août 2017 à 19:20, Jon Shier <jon at jonshier.com> a écrit :
>> 
>> This works fine for me in a playground in the latest Xcode 9 beta:
>> 
>> class Test { }
>> 
>> class Base<T: AnyObject> { }
>> 
>> class Sub: Base<Test> { }
>> 
>> let sub = Sub()
> 
> That may well work but what I want is to be able to do is simpler than that :
> 
> class Base<T : AnyObject> { }
> 
> class Test : Base<Test> { }
> 
> let test = Test()
> 
> 
> Joanna
> 
> --
> Joanna Carter
> Carter Consulting
> 



More information about the swift-users mailing list