summaryrefslogtreecommitdiff
path: root/test/language/expressions/coalesce/cannot-chain-tail-with-logical-and.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/language/expressions/coalesce/cannot-chain-tail-with-logical-and.js')
-rw-r--r--test/language/expressions/coalesce/cannot-chain-tail-with-logical-and.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/language/expressions/coalesce/cannot-chain-tail-with-logical-and.js b/test/language/expressions/coalesce/cannot-chain-tail-with-logical-and.js
new file mode 100644
index 000000000..a279608cc
--- /dev/null
+++ b/test/language/expressions/coalesce/cannot-chain-tail-with-logical-and.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ If the CoalesceExpressionHead is undefined or null, follow return the right-side value.
+ Otherwise, return the left-side value.
+esid: sec-conditional-operator
+info: |
+ ConditionalExpression :
+ ShortCircuitExpression
+ ShortCircuitExpression ? AssignmentExpression : AssignmentExpression
+
+ ShortCircuitExpression :
+ LogicalORExpression
+ CoalesceExpression
+
+ CoalesceExpression :
+ CoalesceExpressionHead ?? BitwiseORExpression
+
+ CoalesceExpressionHead :
+ CoalesceExpression
+ BitwiseORExpression
+features: [coalesce-expression]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+0 ?? 0 && true;