Uploaded image for project: 'HPCC'
  1. HPCC
  2. HPCC-18128

Unable to create default value for DICTIONARY function argument

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 6.4.0
    • Fix Version/s: 7.0.0
    • Component/s: Code Generator
    • Labels:
      None

      Description

      DictionaryRec := RECORD
          STRING key => STRING value;
      END;
      
      /*
      MyFunc(STRING k, DICTIONARY(DictionaryRec) dict) := FUNCTION
          RETURN dict[k].value;
      END;
      */
      
      MyFunc(STRING k, DICTIONARY(DictionaryRec) dict = DICTIONARY([], DictionaryRec)) := FUNCTION
          RETURN dict[k].value;
      END;
      
      d := DICTIONARY([{'foo' => 'bar'}], DictionaryRec);
      
      MyFunc('foo', d);
      
      

       

      The enclosed code demonstrates an attempt at making a DICTIONARY function argument optional, with an empty dictionary.  It fails on syntax-check with the following error:

       

      'Error' message: '3002: syntax error near "}" : expected <' at: '11,65' source: ''

      The commented-out function, without a default argument, works well.

        Attachments

          Activity

            People

            • Assignee:
              ghalliday Gavin Halliday
              Reporter:
              dcamper Dan S. Camper
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: