Commits

Slava Pestov committed 1368db7872f
IRGen: Fix layout of concrete subclasses of generic subclasses of imported Objective-C classes class B<T> : NSFoo {} class A : B<Int> {} IRGen computes the ivar layout starting from offset zero, since the size of the 'NSFoo' is unknown and we rely on the Objective-C runtime to slide the ivar offsets. The instantiated metadata for B<Int> would contain a field offset vector with the correct offsets, because of how swift_initClassMetadata_UniversalStrategy() works. However, A's metadata is emitted statically, and this includes a copy of the field offset vector from the superclass. A's metadata was initialized by swift_initializeSuperclass(), which did not copy the field offset vector over from A<Int>. And since the Objective-C runtime only slides the immediate ivars of a class, the field offsets corresponding to A<Int>'s fields in B's type metadata were never slid, resulting in problems when an instance of B was passed to a function operating on an A<T> generically. Fixes <rdar://problem/23200051>.