Details
-
Bug
-
Resolution: Fixed
-
Blocker
-
5.5.6, 6.0.4, 6.6.0, 6.5.0
-
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 |
126312,3 | MB-38843: Assign precedence to exponentiation operator | unstable | eventing | Status: ABANDONED | 0 | 0 |
126400,5 | MB-38843: Add ability to detect globals and timers | unstable | eventing | Status: MERGED | +2 | +1 |
126675,4 | MB-38843: Use whitespace preserving transpiler for N1QL | mad-hatter | eventing | Status: MERGED | +2 | +1 |
126689,3 | MB-38843: Handle unclosed multichar escape | mad-hatter | eventing | Status: MERGED | +2 | +1 |
126913,3 | MB-38843: Check N1QL grammer and alert if changes as parser needs to keep in sync with it | unstable | eventing | Status: MERGED | +2 | +1 |
126916,4 | MB-38843: Remove esprima/escodegen entirely | unstable | eventing | Status: MERGED | +2 | +1 |
126950,7 | MB-38843: Add ability to detect globals and timers | mad-hatter | eventing | Status: MERGED | +2 | +1 |
127008,5 | MB-38843: Use v8 compiler to compile handler code | mad-hatter | eventing | Status: MERGED | +2 | +1 |
127292,3 | MB-38843: Make CI capable of compiling cgo | mad-hatter | eventing | Status: MERGED | +2 | +1 |