diff --git a/src/compiler/factory/parenthesizerRules.ts b/src/compiler/factory/parenthesizerRules.ts index 3a67604847438..58284decd437a 100644 --- a/src/compiler/factory/parenthesizerRules.ts +++ b/src/compiler/factory/parenthesizerRules.ts @@ -112,6 +112,16 @@ export function createParenthesizerRules(factory: NodeFactory): ParenthesizerRul return parenthesizerRule; } + function mixingBinaryOperatorsRequiresParentheses(a: SyntaxKind, b: SyntaxKind) { + if (a === SyntaxKind.QuestionQuestionToken) { + return b === SyntaxKind.AmpersandAmpersandToken || b === SyntaxKind.BarBarToken; + } + if (b === SyntaxKind.QuestionQuestionToken) { + return a === SyntaxKind.AmpersandAmpersandToken || a === SyntaxKind.BarBarToken; + } + return false; + } + /** * Determines whether the operand to a BinaryExpression needs to be parenthesized. * @@ -121,6 +131,10 @@ export function createParenthesizerRules(factory: NodeFactory): ParenthesizerRul * BinaryExpression. */ function binaryOperandNeedsParentheses(binaryOperator: SyntaxKind, operand: Expression, isLeftSideOfBinary: boolean, leftOperand: Expression | undefined) { + const emittedOperand = skipPartiallyEmittedExpressions(operand); + if (isBinaryExpression(emittedOperand) && mixingBinaryOperatorsRequiresParentheses(binaryOperator, emittedOperand.operatorToken.kind)) { + return true; + } // If the operand has lower precedence, then it needs to be parenthesized to preserve the // intent of the expression. For example, if the operand is `a + b` and the operator is // `*`, then we need to parenthesize the operand to preserve the intended order of @@ -140,7 +154,6 @@ export function createParenthesizerRules(factory: NodeFactory): ParenthesizerRul // the intended order of operations: `(a ** b) ** c` const binaryOperatorPrecedence = getOperatorPrecedence(SyntaxKind.BinaryExpression, binaryOperator); const binaryOperatorAssociativity = getOperatorAssociativity(SyntaxKind.BinaryExpression, binaryOperator); - const emittedOperand = skipPartiallyEmittedExpressions(operand); if (!isLeftSideOfBinary && operand.kind === SyntaxKind.ArrowFunction && binaryOperatorPrecedence > OperatorPrecedence.Assignment) { // We need to parenthesize arrow functions on the right side to avoid it being // parsed as parenthesized expression: `a && (() => {})` diff --git a/src/testRunner/unittests/printer.ts b/src/testRunner/unittests/printer.ts index ab6dd5a718415..eac7ed1cdac4f 100644 --- a/src/testRunner/unittests/printer.ts +++ b/src/testRunner/unittests/printer.ts @@ -423,5 +423,311 @@ describe("unittests:: PrinterAPI", () => { ), ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext), )); + + printsCorrectly("binaryBarBarExpressionWithLeftBinaryQuestionQuestionExpression", {}, printer => + printer.printNode( + ts.EmitHint.Unspecified, + ts.factory.createExpressionStatement( + ts.factory.createBinaryExpression( + ts.factory.createBinaryExpression( + ts.factory.createIdentifier("a"), + ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken), + ts.factory.createIdentifier("b"), + ), + ts.factory.createToken(ts.SyntaxKind.BarBarToken), + ts.factory.createIdentifier("c"), + ), + ), + ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext), + )); + + printsCorrectly("binaryAmpersandAmpersandExpressionWithLeftBinaryQuestionQuestionExpression", {}, printer => + printer.printNode( + ts.EmitHint.Unspecified, + ts.factory.createExpressionStatement( + ts.factory.createBinaryExpression( + ts.factory.createBinaryExpression( + ts.factory.createIdentifier("a"), + ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken), + ts.factory.createIdentifier("b"), + ), + ts.factory.createToken(ts.SyntaxKind.AmpersandAmpersandToken), + ts.factory.createIdentifier("c"), + ), + ), + ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext), + )); + + printsCorrectly("binaryBarBarExpressionWithRightBinaryQuestionQuestionExpression", {}, printer => + printer.printNode( + ts.EmitHint.Unspecified, + ts.factory.createExpressionStatement( + ts.factory.createBinaryExpression( + ts.factory.createIdentifier("a"), + ts.factory.createToken(ts.SyntaxKind.BarBarToken), + ts.factory.createBinaryExpression( + ts.factory.createIdentifier("b"), + ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken), + ts.factory.createIdentifier("c"), + ), + ), + ), + ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext), + )); + + printsCorrectly("binaryAmpersandAmpersandExpressionWithRightBinaryQuestionQuestionExpression", {}, printer => + printer.printNode( + ts.EmitHint.Unspecified, + ts.factory.createExpressionStatement( + ts.factory.createBinaryExpression( + ts.factory.createIdentifier("a"), + ts.factory.createToken(ts.SyntaxKind.AmpersandAmpersandToken), + ts.factory.createBinaryExpression( + ts.factory.createIdentifier("b"), + ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken), + ts.factory.createIdentifier("c"), + ), + ), + ), + ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext), + )); + + printsCorrectly("binaryQuestionQuestionExpressionWithLeftBinaryBarBarExpression", {}, printer => + printer.printNode( + ts.EmitHint.Unspecified, + ts.factory.createExpressionStatement( + ts.factory.createBinaryExpression( + ts.factory.createBinaryExpression( + ts.factory.createIdentifier("a"), + ts.factory.createToken(ts.SyntaxKind.BarBarToken), + ts.factory.createIdentifier("b"), + ), + ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken), + ts.factory.createIdentifier("c"), + ), + ), + ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext), + )); + + printsCorrectly("binaryQuestionQuestionExpressionWithLeftBinaryAmpersandAmpersandExpression", {}, printer => + printer.printNode( + ts.EmitHint.Unspecified, + ts.factory.createExpressionStatement( + ts.factory.createBinaryExpression( + ts.factory.createBinaryExpression( + ts.factory.createIdentifier("a"), + ts.factory.createToken(ts.SyntaxKind.AmpersandAmpersandToken), + ts.factory.createIdentifier("b"), + ), + ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken), + ts.factory.createIdentifier("c"), + ), + ), + ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext), + )); + + printsCorrectly("binaryQuestionQuestionExpressionWithRightBinaryBarBarExpression", {}, printer => + printer.printNode( + ts.EmitHint.Unspecified, + ts.factory.createExpressionStatement( + ts.factory.createBinaryExpression( + ts.factory.createIdentifier("a"), + ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken), + ts.factory.createBinaryExpression( + ts.factory.createIdentifier("b"), + ts.factory.createToken(ts.SyntaxKind.BarBarToken), + ts.factory.createIdentifier("c"), + ), + ), + ), + ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext), + )); + + printsCorrectly("binaryQuestionQuestionExpressionWithRightBinaryAmpersandAmpersandExpression", {}, printer => + printer.printNode( + ts.EmitHint.Unspecified, + ts.factory.createExpressionStatement( + ts.factory.createBinaryExpression( + ts.factory.createIdentifier("a"), + ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken), + ts.factory.createBinaryExpression( + ts.factory.createIdentifier("b"), + ts.factory.createToken(ts.SyntaxKind.AmpersandAmpersandToken), + ts.factory.createIdentifier("c"), + ), + ), + ), + ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext), + )); + + printsCorrectly("binaryQuestionQuestionExpressionWithLeftBinaryQuestionQuestionExpression", {}, printer => + printer.printNode( + ts.EmitHint.Unspecified, + ts.factory.createExpressionStatement( + ts.factory.createBinaryExpression( + ts.factory.createBinaryExpression( + ts.factory.createIdentifier("a"), + ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken), + ts.factory.createIdentifier("b"), + ), + ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken), + ts.factory.createIdentifier("c"), + ), + ), + ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext), + )); + + printsCorrectly("binaryQuestionQuestionExpressionWithRightBinaryQuestionQuestionExpression", {}, printer => + printer.printNode( + ts.EmitHint.Unspecified, + ts.factory.createExpressionStatement( + ts.factory.createBinaryExpression( + ts.factory.createIdentifier("a"), + ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken), + ts.factory.createBinaryExpression( + ts.factory.createIdentifier("b"), + ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken), + ts.factory.createIdentifier("c"), + ), + ), + ), + ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext), + )); + + printsCorrectly("binaryCommaExpressionWithLeftBinaryQuestionQuestionExpression", {}, printer => + printer.printNode( + ts.EmitHint.Unspecified, + ts.factory.createExpressionStatement( + ts.factory.createBinaryExpression( + ts.factory.createBinaryExpression( + ts.factory.createIdentifier("a"), + ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken), + ts.factory.createIdentifier("b"), + ), + ts.factory.createToken(ts.SyntaxKind.CommaToken), + ts.factory.createIdentifier("c"), + ), + ), + ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext), + )); + + printsCorrectly("binaryCommaExpressionWithRightBinaryQuestionQuestionExpression", {}, printer => + printer.printNode( + ts.EmitHint.Unspecified, + ts.factory.createExpressionStatement( + ts.factory.createBinaryExpression( + ts.factory.createIdentifier("a"), + ts.factory.createToken(ts.SyntaxKind.CommaToken), + ts.factory.createBinaryExpression( + ts.factory.createIdentifier("b"), + ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken), + ts.factory.createIdentifier("c"), + ), + ), + ), + ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext), + )); + + printsCorrectly("binaryEqualsEqualsExpressionWithLeftBinaryQuestionQuestionExpression", {}, printer => + printer.printNode( + ts.EmitHint.Unspecified, + ts.factory.createExpressionStatement( + ts.factory.createBinaryExpression( + ts.factory.createBinaryExpression( + ts.factory.createIdentifier("a"), + ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken), + ts.factory.createIdentifier("b"), + ), + ts.factory.createToken(ts.SyntaxKind.EqualsEqualsToken), + ts.factory.createIdentifier("c"), + ), + ), + ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext), + )); + + printsCorrectly("binaryEqualsEqualsExpressionWithRightBinaryQuestionQuestionExpression", {}, printer => + printer.printNode( + ts.EmitHint.Unspecified, + ts.factory.createExpressionStatement( + ts.factory.createBinaryExpression( + ts.factory.createIdentifier("a"), + ts.factory.createToken(ts.SyntaxKind.EqualsEqualsToken), + ts.factory.createBinaryExpression( + ts.factory.createIdentifier("b"), + ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken), + ts.factory.createIdentifier("c"), + ), + ), + ), + ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext), + )); + + printsCorrectly("binaryQuestionQuestionExpressionWithLeftBinaryCommaExpression", {}, printer => + printer.printNode( + ts.EmitHint.Unspecified, + ts.factory.createExpressionStatement( + ts.factory.createBinaryExpression( + ts.factory.createBinaryExpression( + ts.factory.createIdentifier("a"), + ts.factory.createToken(ts.SyntaxKind.CommaToken), + ts.factory.createIdentifier("b"), + ), + ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken), + ts.factory.createIdentifier("c"), + ), + ), + ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext), + )); + + printsCorrectly("binaryQuestionQuestionExpressionWithRightBinaryCommaExpression", {}, printer => + printer.printNode( + ts.EmitHint.Unspecified, + ts.factory.createExpressionStatement( + ts.factory.createBinaryExpression( + ts.factory.createIdentifier("a"), + ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken), + ts.factory.createBinaryExpression( + ts.factory.createIdentifier("b"), + ts.factory.createToken(ts.SyntaxKind.CommaToken), + ts.factory.createIdentifier("c"), + ), + ), + ), + ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext), + )); + + printsCorrectly("binaryQuestionQuestionExpressionWithLeftBinaryEqualsEqualsExpression", {}, printer => + printer.printNode( + ts.EmitHint.Unspecified, + ts.factory.createExpressionStatement( + ts.factory.createBinaryExpression( + ts.factory.createBinaryExpression( + ts.factory.createIdentifier("a"), + ts.factory.createToken(ts.SyntaxKind.EqualsEqualsToken), + ts.factory.createIdentifier("b"), + ), + ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken), + ts.factory.createIdentifier("c"), + ), + ), + ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext), + )); + + printsCorrectly("binaryQuestionQuestionExpressionWithRightBinaryEqualsEqualsExpression", {}, printer => + printer.printNode( + ts.EmitHint.Unspecified, + ts.factory.createExpressionStatement( + ts.factory.createBinaryExpression( + ts.factory.createIdentifier("a"), + ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken), + ts.factory.createBinaryExpression( + ts.factory.createIdentifier("b"), + ts.factory.createToken(ts.SyntaxKind.EqualsEqualsToken), + ts.factory.createIdentifier("c"), + ), + ), + ), + ts.createSourceFile("source.ts", "", ts.ScriptTarget.ESNext), + )); }); }); diff --git a/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryAmpersandAmpersandExpressionWithLeftBinaryQuestionQuestionExpression.js b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryAmpersandAmpersandExpressionWithLeftBinaryQuestionQuestionExpression.js new file mode 100644 index 0000000000000..c4a864cada86e --- /dev/null +++ b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryAmpersandAmpersandExpressionWithLeftBinaryQuestionQuestionExpression.js @@ -0,0 +1 @@ +(a ?? b) && c; \ No newline at end of file diff --git a/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryAmpersandAmpersandExpressionWithRightBinaryQuestionQuestionExpression.js b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryAmpersandAmpersandExpressionWithRightBinaryQuestionQuestionExpression.js new file mode 100644 index 0000000000000..631477f80824e --- /dev/null +++ b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryAmpersandAmpersandExpressionWithRightBinaryQuestionQuestionExpression.js @@ -0,0 +1 @@ +a && (b ?? c); \ No newline at end of file diff --git a/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryBarBarExpressionWithLeftBinaryQuestionQuestionExpression.js b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryBarBarExpressionWithLeftBinaryQuestionQuestionExpression.js new file mode 100644 index 0000000000000..affbdb4c02740 --- /dev/null +++ b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryBarBarExpressionWithLeftBinaryQuestionQuestionExpression.js @@ -0,0 +1 @@ +(a ?? b) || c; \ No newline at end of file diff --git a/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryBarBarExpressionWithRightBinaryQuestionQuestionExpression.js b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryBarBarExpressionWithRightBinaryQuestionQuestionExpression.js new file mode 100644 index 0000000000000..b3a9c2774d7c2 --- /dev/null +++ b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryBarBarExpressionWithRightBinaryQuestionQuestionExpression.js @@ -0,0 +1 @@ +a || (b ?? c); \ No newline at end of file diff --git a/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryCommaExpressionWithLeftBinaryQuestionQuestionExpression.js b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryCommaExpressionWithLeftBinaryQuestionQuestionExpression.js new file mode 100644 index 0000000000000..89168051f6b45 --- /dev/null +++ b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryCommaExpressionWithLeftBinaryQuestionQuestionExpression.js @@ -0,0 +1 @@ +a ?? b, c; \ No newline at end of file diff --git a/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryCommaExpressionWithRightBinaryQuestionQuestionExpression.js b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryCommaExpressionWithRightBinaryQuestionQuestionExpression.js new file mode 100644 index 0000000000000..71d5273feedcb --- /dev/null +++ b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryCommaExpressionWithRightBinaryQuestionQuestionExpression.js @@ -0,0 +1 @@ +a, b ?? c; \ No newline at end of file diff --git a/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryEqualsEqualsExpressionWithLeftBinaryQuestionQuestionExpression.js b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryEqualsEqualsExpressionWithLeftBinaryQuestionQuestionExpression.js new file mode 100644 index 0000000000000..76b39c1d7695e --- /dev/null +++ b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryEqualsEqualsExpressionWithLeftBinaryQuestionQuestionExpression.js @@ -0,0 +1 @@ +(a ?? b) == c; \ No newline at end of file diff --git a/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryEqualsEqualsExpressionWithRightBinaryQuestionQuestionExpression.js b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryEqualsEqualsExpressionWithRightBinaryQuestionQuestionExpression.js new file mode 100644 index 0000000000000..6f583e8aa54e1 --- /dev/null +++ b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryEqualsEqualsExpressionWithRightBinaryQuestionQuestionExpression.js @@ -0,0 +1 @@ +a == (b ?? c); \ No newline at end of file diff --git a/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithLeftBinaryAmpersandAmpersandExpression.js b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithLeftBinaryAmpersandAmpersandExpression.js new file mode 100644 index 0000000000000..12debb34d1514 --- /dev/null +++ b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithLeftBinaryAmpersandAmpersandExpression.js @@ -0,0 +1 @@ +(a && b) ?? c; \ No newline at end of file diff --git a/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithLeftBinaryBarBarExpression.js b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithLeftBinaryBarBarExpression.js new file mode 100644 index 0000000000000..de158d5222234 --- /dev/null +++ b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithLeftBinaryBarBarExpression.js @@ -0,0 +1 @@ +(a || b) ?? c; \ No newline at end of file diff --git a/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithLeftBinaryCommaExpression.js b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithLeftBinaryCommaExpression.js new file mode 100644 index 0000000000000..a8723f46e8f27 --- /dev/null +++ b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithLeftBinaryCommaExpression.js @@ -0,0 +1 @@ +(a, b) ?? c; \ No newline at end of file diff --git a/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithLeftBinaryEqualsEqualsExpression.js b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithLeftBinaryEqualsEqualsExpression.js new file mode 100644 index 0000000000000..334c6bc06248e --- /dev/null +++ b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithLeftBinaryEqualsEqualsExpression.js @@ -0,0 +1 @@ +a == b ?? c; \ No newline at end of file diff --git a/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithLeftBinaryQuestionQuestionExpression.js b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithLeftBinaryQuestionQuestionExpression.js new file mode 100644 index 0000000000000..b9b28fee1f731 --- /dev/null +++ b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithLeftBinaryQuestionQuestionExpression.js @@ -0,0 +1 @@ +a ?? b ?? c; \ No newline at end of file diff --git a/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithRightBinaryAmpersandAmpersandExpression.js b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithRightBinaryAmpersandAmpersandExpression.js new file mode 100644 index 0000000000000..5bcfab5819a7c --- /dev/null +++ b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithRightBinaryAmpersandAmpersandExpression.js @@ -0,0 +1 @@ +a ?? (b && c); \ No newline at end of file diff --git a/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithRightBinaryBarBarExpression.js b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithRightBinaryBarBarExpression.js new file mode 100644 index 0000000000000..23e450ccd66e0 --- /dev/null +++ b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithRightBinaryBarBarExpression.js @@ -0,0 +1 @@ +a ?? (b || c); \ No newline at end of file diff --git a/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithRightBinaryCommaExpression.js b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithRightBinaryCommaExpression.js new file mode 100644 index 0000000000000..ab0bf02288177 --- /dev/null +++ b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithRightBinaryCommaExpression.js @@ -0,0 +1 @@ +a ?? (b, c); \ No newline at end of file diff --git a/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithRightBinaryEqualsEqualsExpression.js b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithRightBinaryEqualsEqualsExpression.js new file mode 100644 index 0000000000000..7cb8388a2a87b --- /dev/null +++ b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithRightBinaryEqualsEqualsExpression.js @@ -0,0 +1 @@ +a ?? b == c; \ No newline at end of file diff --git a/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithRightBinaryQuestionQuestionExpression.js b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithRightBinaryQuestionQuestionExpression.js new file mode 100644 index 0000000000000..226fddaf8033d --- /dev/null +++ b/tests/baselines/reference/printerApi/printsNodeCorrectly.binaryQuestionQuestionExpressionWithRightBinaryQuestionQuestionExpression.js @@ -0,0 +1 @@ +a ?? (b ?? c); \ No newline at end of file