Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-3401

Nested collections emit Objective-C code that cannot compile

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.10.0
    • Component/s: Cocoa - Compiler
    • Labels:
      None
    • Environment:

      OS X 10.9 and 10.10

      Description

      Nested Thrift collections produce nested generics in Objective-C. Unfortunately, Objective-C generics do not appear to support type nesting.

      For instance,

      1: list<list<string>> foo

      generates an Objective-C declaration like this

      @property (strong, nonatomic) NSMutableArray<NSArray<NSString *>> * foo;

      which results in an XCode compile error: Type argument 'NSArray<NSString *>' is neither an Objective-C object nor a block type

      The only workaround is to edit the generated code to remove the nested type specifiers.

      Until Objective-C supports nesting generic types, the Thrift cocoa compiler should limit the type nesting to at most one level – NSMutableArray<NSArray> is legal, for instance. Alternately, an easier solution might be to add a flag that disables the generation of generic types for cocoa.

        Attachments

          Activity

            People

            • Assignee:
              kdubb Kevin Wooten
              Reporter:
              steve.yegge Steve Yegge
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 72h
                72h
                Remaining:
                Remaining Estimate - 72h
                72h
                Logged:
                Time Spent - Not Specified
                Not Specified