Skip to content
Snippets Groups Projects
  • Douglas Gregor's avatar
    a34fa683
    Implement variance for Objective-C type parameters. · a34fa683
    Douglas Gregor authored
    Introduce co- and contra-variance for Objective-C type parameters,
    which allows us to express that (for example) an NSArray is covariant
    in its type parameter. This means that NSArray<NSMutableString *> * is
    a subtype of NSArray<NSString *> *, which is expected of the immutable
    Foundation collections.
    
    Type parameters can be annotated with __covariant or __contravariant
    to make them co- or contra-variant, respectively. This feature can be
    detected by __has_feature(objc_generics_variance). Implements
    rdar://problem/20217490.
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241549 91177308-0d34-0410-b5e6-96231b3b80d8
    a34fa683
    History
    Implement variance for Objective-C type parameters.
    Douglas Gregor authored
    Introduce co- and contra-variance for Objective-C type parameters,
    which allows us to express that (for example) an NSArray is covariant
    in its type parameter. This means that NSArray<NSMutableString *> * is
    a subtype of NSArray<NSString *> *, which is expected of the immutable
    Foundation collections.
    
    Type parameters can be annotated with __covariant or __contravariant
    to make them co- or contra-variant, respectively. This feature can be
    detected by __has_feature(objc_generics_variance). Implements
    rdar://problem/20217490.
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241549 91177308-0d34-0410-b5e6-96231b3b80d8
Code owners
Assign users and groups as approvers for specific file changes. Learn more.