Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-38843

Eventing operator precedence for group has issues

    XMLWordPrintable

Details

    • Untriaged
    • 1
    • Unknown

    Description

      Run a simple Eventing function as follows:

      function OnUpdate(doc, meta) {
       var pow;
       
       pow = 2 ** 4;
       log('A yes 16 from: pow = 2 ** 4', pow);
       
       pow = 2 ** (3 + 1);
       log('B not 16 from: pow = 2 ** (3 + 1)', pow); 
      }

      Deploy from now and Kick off a single mutation The results are incorrect

       

      2020-04-18T08:17:40.839-07:00 [INFO] "A yes 16 from: pow = 2 ** 4" 16 
      2020-04-18T08:17:40.839-07:00 [INFO] "B not 16 from: pow = 2 ** (3 + 1)" 9
      

      Both pow functions should have given 16, I believe this is a transpiler issue where the grouping syntax is ignored (at least in the case of the '**' operator).

      Of course Node.js works as expected e.g.

       

      # cat pow.js
          const log = console.log
       
          var pow;
          
          pow = 2 ** 4;
          log('A yes 16 from: pow = 2 ** 4', pow);
          
          pow = 2 ** (3 + 1);
          log('B not 16 from: pow = 2 ** (3 + 1)', pow); 
       
      # node pow.js
      A yes 16 from: pow = 2 ** 4 16
      B not 16 from: pow = 2 ** (3 + 1) 16

      Important Fix Note:
      The bugfix for this issue is intertwined with MB-38844 fix. These two bugs must be handled together as a single unit

       

       

      Attachments

        Issue Links

          For Gerrit Dashboard: MB-38843
          # Subject Branch Project Status CR V

          Activity

            People

              ankit.prabhu Ankit Prabhu
              jon.strabala Jon Strabala
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                PagerDuty