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

Dart generates incorrect code for a const struct

VotersStop watchingWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

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

      Description

      This snippet:

      struct Operator {
          1:string displayName
          2:string fieldSuffix
      }
      const Operator equalTo = {'displayName': '=', 'fieldSuffix': 'eq'}
      const Operator notEqualTo = {'displayName': '!=', 'fieldSuffix': 'ne'}
      

      Produces this Dart code:

      ...
      static final Operator equalTo = new Operator();
      equalTo.displayName = '=';
      equalTo.fieldSuffix = 'eq';
      ...
      

      But it should produce this Dart code:

      static final Operator equalTo = new Operator()
        ..displayName = '='
        ..fieldSuffix = 'eq';
      

        Attachments

          Activity

            People

            • Assignee:
              markerickson-wk Mark Erickson
              Reporter:
              markerickson-wk Mark Erickson

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment