Describe the bug
The optional chaining operator is allowed to occur, and is then ignored, in many (but not all) cases between two terms that are being implicitly multiplied.
To Reproduce
In current develop, execute either math.evaluate('(3 + 4)?.(2)') or math.evaluate('add(3,4)?.(2)'). Either returns 14, but they both should issue a TypeError complaining that 7 is not a function. On the other hand, math.evaluate('7?.(2)') throws a syntax error. So this latter case correctly fails, but the behavior is possibly still problematic, in that JavaScript on the same expression 7?.(2) issues a TypeError complaining that 7 is not a function, suggesting that it is not a syntax error, but that the problem is rather that the number 7 cannot be called as a function.
Problems of this sort seem only to occur when the expression to the right is parenthesized. For example, math.evaluate('a = 7; a 2')) returns (a ResultSet of) 14 via implicit multiplication, but math.evaluate('a =7; a ?. 2') produces a SyntaxError that the ?. token is unexpected.
Describe the bug
The optional chaining operator is allowed to occur, and is then ignored, in many (but not all) cases between two terms that are being implicitly multiplied.
To Reproduce
In current develop, execute either
math.evaluate('(3 + 4)?.(2)')ormath.evaluate('add(3,4)?.(2)'). Either returns 14, but they both should issue a TypeError complaining that 7 is not a function. On the other hand,math.evaluate('7?.(2)')throws a syntax error. So this latter case correctly fails, but the behavior is possibly still problematic, in that JavaScript on the same expression7?.(2)issues a TypeError complaining that 7 is not a function, suggesting that it is not a syntax error, but that the problem is rather that the number 7 cannot be called as a function.Problems of this sort seem only to occur when the expression to the right is parenthesized. For example,
math.evaluate('a = 7; a 2'))returns (a ResultSet of) 14 via implicit multiplication, butmath.evaluate('a =7; a ?. 2')produces a SyntaxError that the ?. token is unexpected.