From aa4ea10bc5b8fa36bd22a24c86a23e299b0e7853 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 26 Feb 2016 11:05:12 -0800 Subject: [PATCH 1/5] Add checking for 'void' in '||', '&&', and branching statements. --- src/compiler/checker.ts | 43 ++++++++++++++++++++++++---- src/compiler/diagnosticMessages.json | 8 ++++++ 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index ebc8d16e6e268..a8c33b7583a7b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -11295,7 +11295,7 @@ namespace ts { if ((leftType.flags & TypeFlags.Boolean) && (rightType.flags & TypeFlags.Boolean) && (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== undefined) { - error(errorNode || operatorToken, Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, tokenToString(operatorToken.kind), tokenToString(suggestedOperator)); + error(errorNode || operatorToken, Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, tokenToString(operator), tokenToString(suggestedOperator)); } else { // otherwise just check each operand separately and report errors as normal @@ -11374,8 +11374,15 @@ namespace ts { case SyntaxKind.InKeyword: return checkInExpression(left, right, leftType, rightType); case SyntaxKind.AmpersandAmpersandToken: + if (leftType.flags & TypeFlags.Void) { + error(errorNode || operatorToken, Diagnostics.The_left_hand_side_of_a_0_expression_cannot_have_type_1, tokenToString(operator), typeToString(leftType)); + } return rightType; case SyntaxKind.BarBarToken: + if (leftType.flags & TypeFlags.Void) { + error(errorNode || operatorToken, Diagnostics.The_left_hand_side_of_a_0_expression_cannot_have_type_1, tokenToString(operator), typeToString(leftType)); + return rightType; + } return getUnionType([leftType, rightType]); case SyntaxKind.EqualsToken: checkAssignmentOperator(rightType); @@ -12973,7 +12980,9 @@ namespace ts { function checkFunctionDeclaration(node: FunctionDeclaration): void { if (produceDiagnostics) { - checkFunctionOrMethodDeclaration(node) || checkGrammarForGenerator(node); + checkGrammarForGenerator(node); + + checkFunctionOrMethodDeclaration(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); @@ -13406,7 +13415,9 @@ namespace ts { // Grammar checking checkGrammarStatementInAmbientContext(node); - checkExpression(node.expression); + const conditionType = checkExpression(node.expression); + checkConditionOfBranchingStatement(node, node.expression, conditionType); + checkSourceElement(node.thenStatement); if (node.thenStatement.kind === SyntaxKind.EmptyStatement) { @@ -13421,14 +13432,16 @@ namespace ts { checkGrammarStatementInAmbientContext(node); checkSourceElement(node.statement); - checkExpression(node.expression); + const conditionType = checkExpression(node.expression); + checkConditionOfBranchingStatement(node, node.expression, conditionType); } function checkWhileStatement(node: WhileStatement) { // Grammar checking checkGrammarStatementInAmbientContext(node); - checkExpression(node.expression); + const conditionType = checkExpression(node.expression); + checkConditionOfBranchingStatement(node, node.expression, conditionType); checkSourceElement(node.statement); } @@ -13449,11 +13462,29 @@ namespace ts { } } - if (node.condition) checkExpression(node.condition); + if (node.condition) { + const conditionType = checkExpression(node.condition); + checkConditionOfBranchingStatement(node, node.condition, conditionType); + } if (node.incrementor) checkExpression(node.incrementor); checkSourceElement(node.statement); } + function checkConditionOfBranchingStatement(statement: IfStatement | ForStatement | DoStatement, condition: Expression, conditionType: Type): void { + // Any type apart from 'void' is okay. + if (conditionType !== voidType) { + return; + } + + // Don't report an error for '||'. + // We'll have reported errors elsewhere. + if (condition.kind === SyntaxKind.BinaryExpression && (condition as BinaryExpression).operatorToken.kind === SyntaxKind.BarBarToken) { + return; + } + + error(statement, Diagnostics.The_condition_of_a_0_statement_cannot_have_type_1, tokenToString(statement.kind), voidType); + } + function checkForOfStatement(node: ForOfStatement): void { checkGrammarForInOrForOfStatement(node); diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index f2da96b133bb7..85c46820d2614 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2215,6 +2215,14 @@ "category": "Error", "code": 5062 }, + "The left-hand side of a '{0}' expression cannot have type '{1}'.": { + "category": "Error", + "code": 5063 + }, + "The condition of a '{0}' statement cannot have type '{1}'.": { + "category": "Error", + "code": 5064 + }, "Concatenate and emit output to single file.": { "category": "Message", From cf3182d4801bf45dc59100ecca5bec69e9970f0a Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 26 Feb 2016 11:11:36 -0800 Subject: [PATCH 2/5] Accepted baselines. --- ...logicalAndOperatorWithEveryType.errors.txt | 156 +++++ .../logicalAndOperatorWithEveryType.symbols | 515 -------------- .../logicalAndOperatorWithEveryType.types | 635 ----------------- .../logicalOrOperatorWithEveryType.errors.txt | 158 +++++ .../logicalOrOperatorWithEveryType.symbols | 518 -------------- .../logicalOrOperatorWithEveryType.types | 638 ------------------ 6 files changed, 314 insertions(+), 2306 deletions(-) create mode 100644 tests/baselines/reference/logicalAndOperatorWithEveryType.errors.txt delete mode 100644 tests/baselines/reference/logicalAndOperatorWithEveryType.symbols delete mode 100644 tests/baselines/reference/logicalAndOperatorWithEveryType.types create mode 100644 tests/baselines/reference/logicalOrOperatorWithEveryType.errors.txt delete mode 100644 tests/baselines/reference/logicalOrOperatorWithEveryType.symbols delete mode 100644 tests/baselines/reference/logicalOrOperatorWithEveryType.types diff --git a/tests/baselines/reference/logicalAndOperatorWithEveryType.errors.txt b/tests/baselines/reference/logicalAndOperatorWithEveryType.errors.txt new file mode 100644 index 0000000000000..1e67fa1ed69e7 --- /dev/null +++ b/tests/baselines/reference/logicalAndOperatorWithEveryType.errors.txt @@ -0,0 +1,156 @@ +tests/cases/conformance/expressions/binaryOperators/logicalAndOperator/logicalAndOperatorWithEveryType.ts(19,11): error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. +tests/cases/conformance/expressions/binaryOperators/logicalAndOperator/logicalAndOperatorWithEveryType.ts(30,11): error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. +tests/cases/conformance/expressions/binaryOperators/logicalAndOperator/logicalAndOperatorWithEveryType.ts(41,11): error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. +tests/cases/conformance/expressions/binaryOperators/logicalAndOperator/logicalAndOperatorWithEveryType.ts(52,11): error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. +tests/cases/conformance/expressions/binaryOperators/logicalAndOperator/logicalAndOperatorWithEveryType.ts(63,11): error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. +tests/cases/conformance/expressions/binaryOperators/logicalAndOperator/logicalAndOperatorWithEveryType.ts(74,11): error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. +tests/cases/conformance/expressions/binaryOperators/logicalAndOperator/logicalAndOperatorWithEveryType.ts(85,11): error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. +tests/cases/conformance/expressions/binaryOperators/logicalAndOperator/logicalAndOperatorWithEveryType.ts(96,11): error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. +tests/cases/conformance/expressions/binaryOperators/logicalAndOperator/logicalAndOperatorWithEveryType.ts(107,11): error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. +tests/cases/conformance/expressions/binaryOperators/logicalAndOperator/logicalAndOperatorWithEveryType.ts(118,11): error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. + + +==== tests/cases/conformance/expressions/binaryOperators/logicalAndOperator/logicalAndOperatorWithEveryType.ts (10 errors) ==== + // The && operator permits the operands to be of any type and produces a result of the same + // type as the second operand. + + enum E { a, b, c } + + var a1: any; + var a2: boolean; + var a3: number + var a4: string; + var a5: void; + var a6: E; + var a7: {}; + var a8: string[]; + + var ra1 = a1 && a1; + var ra2 = a2 && a1; + var ra3 = a3 && a1; + var ra4 = a4 && a1; + var ra5 = a5 && a1; + ~~~~~~~~ +!!! error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. + var ra6 = a6 && a1; + var ra7 = a7 && a1; + var ra8 = a8 && a1; + var ra9 = null && a1; + var ra10 = undefined && a1; + + var rb1 = a1 && a2; + var rb2 = a2 && a2; + var rb3 = a3 && a2; + var rb4 = a4 && a2; + var rb5 = a5 && a2; + ~~~~~~~~ +!!! error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. + var rb6 = a6 && a2; + var rb7 = a7 && a2; + var rb8 = a8 && a2; + var rb9 = null && a2; + var rb10 = undefined && a2; + + var rc1 = a1 && a3; + var rc2 = a2 && a3; + var rc3 = a3 && a3; + var rc4 = a4 && a3; + var rc5 = a5 && a3; + ~~~~~~~~ +!!! error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. + var rc6 = a6 && a3; + var rc7 = a7 && a3; + var rc8 = a8 && a3; + var rc9 = null && a3; + var rc10 = undefined && a3; + + var rd1 = a1 && a4; + var rd2 = a2 && a4; + var rd3 = a3 && a4; + var rd4 = a4 && a4; + var rd5 = a5 && a4; + ~~~~~~~~ +!!! error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. + var rd6 = a6 && a4; + var rd7 = a7 && a4; + var rd8 = a8 && a4; + var rd9 = null && a4; + var rd10 = undefined && a4; + + var re1 = a1 && a5; + var re2 = a2 && a5; + var re3 = a3 && a5; + var re4 = a4 && a5; + var re5 = a5 && a5; + ~~~~~~~~ +!!! error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. + var re6 = a6 && a5; + var re7 = a7 && a5; + var re8 = a8 && a5; + var re9 = null && a5; + var re10 = undefined && a5; + + var rf1 = a1 && a6; + var rf2 = a2 && a6; + var rf3 = a3 && a6; + var rf4 = a4 && a6; + var rf5 = a5 && a6; + ~~~~~~~~ +!!! error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. + var rf6 = a6 && a6; + var rf7 = a7 && a6; + var rf8 = a8 && a6; + var rf9 = null && a6; + var rf10 = undefined && a6; + + var rg1 = a1 && a7; + var rg2 = a2 && a7; + var rg3 = a3 && a7; + var rg4 = a4 && a7; + var rg5 = a5 && a7; + ~~~~~~~~ +!!! error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. + var rg6 = a6 && a7; + var rg7 = a7 && a7; + var rg8 = a8 && a7; + var rg9 = null && a7; + var rg10 = undefined && a7; + + var rh1 = a1 && a8; + var rh2 = a2 && a8; + var rh3 = a3 && a8; + var rh4 = a4 && a8; + var rh5 = a5 && a8; + ~~~~~~~~ +!!! error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. + var rh6 = a6 && a8; + var rh7 = a7 && a8; + var rh8 = a8 && a8; + var rh9 = null && a8; + var rh10 = undefined && a8; + + var ri1 = a1 && null; + var ri2 = a2 && null; + var ri3 = a3 && null; + var ri4 = a4 && null; + var ri5 = a5 && null; + ~~~~~~~~~~ +!!! error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. + var ri6 = a6 && null; + var ri7 = a7 && null; + var ri8 = a8 && null; + var ri9 = null && null; + var ri10 = undefined && null; + + var rj1 = a1 && undefined; + var rj2 = a2 && undefined; + var rj3 = a3 && undefined; + var rj4 = a4 && undefined; + var rj5 = a5 && undefined; + ~~~~~~~~~~~~~~~ +!!! error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. + var rj6 = a6 && undefined; + var rj7 = a7 && undefined; + var rj8 = a8 && undefined; + var rj9 = null && undefined; + var rj10 = undefined && undefined; \ No newline at end of file diff --git a/tests/baselines/reference/logicalAndOperatorWithEveryType.symbols b/tests/baselines/reference/logicalAndOperatorWithEveryType.symbols deleted file mode 100644 index 440bfbf56517d..0000000000000 --- a/tests/baselines/reference/logicalAndOperatorWithEveryType.symbols +++ /dev/null @@ -1,515 +0,0 @@ -=== tests/cases/conformance/expressions/binaryOperators/logicalAndOperator/logicalAndOperatorWithEveryType.ts === -// The && operator permits the operands to be of any type and produces a result of the same -// type as the second operand. - -enum E { a, b, c } ->E : Symbol(E, Decl(logicalAndOperatorWithEveryType.ts, 0, 0)) ->a : Symbol(E.a, Decl(logicalAndOperatorWithEveryType.ts, 3, 8)) ->b : Symbol(E.b, Decl(logicalAndOperatorWithEveryType.ts, 3, 11)) ->c : Symbol(E.c, Decl(logicalAndOperatorWithEveryType.ts, 3, 14)) - -var a1: any; ->a1 : Symbol(a1, Decl(logicalAndOperatorWithEveryType.ts, 5, 3)) - -var a2: boolean; ->a2 : Symbol(a2, Decl(logicalAndOperatorWithEveryType.ts, 6, 3)) - -var a3: number ->a3 : Symbol(a3, Decl(logicalAndOperatorWithEveryType.ts, 7, 3)) - -var a4: string; ->a4 : Symbol(a4, Decl(logicalAndOperatorWithEveryType.ts, 8, 3)) - -var a5: void; ->a5 : Symbol(a5, Decl(logicalAndOperatorWithEveryType.ts, 9, 3)) - -var a6: E; ->a6 : Symbol(a6, Decl(logicalAndOperatorWithEveryType.ts, 10, 3)) ->E : Symbol(E, Decl(logicalAndOperatorWithEveryType.ts, 0, 0)) - -var a7: {}; ->a7 : Symbol(a7, Decl(logicalAndOperatorWithEveryType.ts, 11, 3)) - -var a8: string[]; ->a8 : Symbol(a8, Decl(logicalAndOperatorWithEveryType.ts, 12, 3)) - -var ra1 = a1 && a1; ->ra1 : Symbol(ra1, Decl(logicalAndOperatorWithEveryType.ts, 14, 3)) ->a1 : Symbol(a1, Decl(logicalAndOperatorWithEveryType.ts, 5, 3)) ->a1 : Symbol(a1, Decl(logicalAndOperatorWithEveryType.ts, 5, 3)) - -var ra2 = a2 && a1; ->ra2 : Symbol(ra2, Decl(logicalAndOperatorWithEveryType.ts, 15, 3)) ->a2 : Symbol(a2, Decl(logicalAndOperatorWithEveryType.ts, 6, 3)) ->a1 : Symbol(a1, Decl(logicalAndOperatorWithEveryType.ts, 5, 3)) - -var ra3 = a3 && a1; ->ra3 : Symbol(ra3, Decl(logicalAndOperatorWithEveryType.ts, 16, 3)) ->a3 : Symbol(a3, Decl(logicalAndOperatorWithEveryType.ts, 7, 3)) ->a1 : Symbol(a1, Decl(logicalAndOperatorWithEveryType.ts, 5, 3)) - -var ra4 = a4 && a1; ->ra4 : Symbol(ra4, Decl(logicalAndOperatorWithEveryType.ts, 17, 3)) ->a4 : Symbol(a4, Decl(logicalAndOperatorWithEveryType.ts, 8, 3)) ->a1 : Symbol(a1, Decl(logicalAndOperatorWithEveryType.ts, 5, 3)) - -var ra5 = a5 && a1; ->ra5 : Symbol(ra5, Decl(logicalAndOperatorWithEveryType.ts, 18, 3)) ->a5 : Symbol(a5, Decl(logicalAndOperatorWithEveryType.ts, 9, 3)) ->a1 : Symbol(a1, Decl(logicalAndOperatorWithEveryType.ts, 5, 3)) - -var ra6 = a6 && a1; ->ra6 : Symbol(ra6, Decl(logicalAndOperatorWithEveryType.ts, 19, 3)) ->a6 : Symbol(a6, Decl(logicalAndOperatorWithEveryType.ts, 10, 3)) ->a1 : Symbol(a1, Decl(logicalAndOperatorWithEveryType.ts, 5, 3)) - -var ra7 = a7 && a1; ->ra7 : Symbol(ra7, Decl(logicalAndOperatorWithEveryType.ts, 20, 3)) ->a7 : Symbol(a7, Decl(logicalAndOperatorWithEveryType.ts, 11, 3)) ->a1 : Symbol(a1, Decl(logicalAndOperatorWithEveryType.ts, 5, 3)) - -var ra8 = a8 && a1; ->ra8 : Symbol(ra8, Decl(logicalAndOperatorWithEveryType.ts, 21, 3)) ->a8 : Symbol(a8, Decl(logicalAndOperatorWithEveryType.ts, 12, 3)) ->a1 : Symbol(a1, Decl(logicalAndOperatorWithEveryType.ts, 5, 3)) - -var ra9 = null && a1; ->ra9 : Symbol(ra9, Decl(logicalAndOperatorWithEveryType.ts, 22, 3)) ->a1 : Symbol(a1, Decl(logicalAndOperatorWithEveryType.ts, 5, 3)) - -var ra10 = undefined && a1; ->ra10 : Symbol(ra10, Decl(logicalAndOperatorWithEveryType.ts, 23, 3)) ->undefined : Symbol(undefined) ->a1 : Symbol(a1, Decl(logicalAndOperatorWithEveryType.ts, 5, 3)) - -var rb1 = a1 && a2; ->rb1 : Symbol(rb1, Decl(logicalAndOperatorWithEveryType.ts, 25, 3)) ->a1 : Symbol(a1, Decl(logicalAndOperatorWithEveryType.ts, 5, 3)) ->a2 : Symbol(a2, Decl(logicalAndOperatorWithEveryType.ts, 6, 3)) - -var rb2 = a2 && a2; ->rb2 : Symbol(rb2, Decl(logicalAndOperatorWithEveryType.ts, 26, 3)) ->a2 : Symbol(a2, Decl(logicalAndOperatorWithEveryType.ts, 6, 3)) ->a2 : Symbol(a2, Decl(logicalAndOperatorWithEveryType.ts, 6, 3)) - -var rb3 = a3 && a2; ->rb3 : Symbol(rb3, Decl(logicalAndOperatorWithEveryType.ts, 27, 3)) ->a3 : Symbol(a3, Decl(logicalAndOperatorWithEveryType.ts, 7, 3)) ->a2 : Symbol(a2, Decl(logicalAndOperatorWithEveryType.ts, 6, 3)) - -var rb4 = a4 && a2; ->rb4 : Symbol(rb4, Decl(logicalAndOperatorWithEveryType.ts, 28, 3)) ->a4 : Symbol(a4, Decl(logicalAndOperatorWithEveryType.ts, 8, 3)) ->a2 : Symbol(a2, Decl(logicalAndOperatorWithEveryType.ts, 6, 3)) - -var rb5 = a5 && a2; ->rb5 : Symbol(rb5, Decl(logicalAndOperatorWithEveryType.ts, 29, 3)) ->a5 : Symbol(a5, Decl(logicalAndOperatorWithEveryType.ts, 9, 3)) ->a2 : Symbol(a2, Decl(logicalAndOperatorWithEveryType.ts, 6, 3)) - -var rb6 = a6 && a2; ->rb6 : Symbol(rb6, Decl(logicalAndOperatorWithEveryType.ts, 30, 3)) ->a6 : Symbol(a6, Decl(logicalAndOperatorWithEveryType.ts, 10, 3)) ->a2 : Symbol(a2, Decl(logicalAndOperatorWithEveryType.ts, 6, 3)) - -var rb7 = a7 && a2; ->rb7 : Symbol(rb7, Decl(logicalAndOperatorWithEveryType.ts, 31, 3)) ->a7 : Symbol(a7, Decl(logicalAndOperatorWithEveryType.ts, 11, 3)) ->a2 : Symbol(a2, Decl(logicalAndOperatorWithEveryType.ts, 6, 3)) - -var rb8 = a8 && a2; ->rb8 : Symbol(rb8, Decl(logicalAndOperatorWithEveryType.ts, 32, 3)) ->a8 : Symbol(a8, Decl(logicalAndOperatorWithEveryType.ts, 12, 3)) ->a2 : Symbol(a2, Decl(logicalAndOperatorWithEveryType.ts, 6, 3)) - -var rb9 = null && a2; ->rb9 : Symbol(rb9, Decl(logicalAndOperatorWithEveryType.ts, 33, 3)) ->a2 : Symbol(a2, Decl(logicalAndOperatorWithEveryType.ts, 6, 3)) - -var rb10 = undefined && a2; ->rb10 : Symbol(rb10, Decl(logicalAndOperatorWithEveryType.ts, 34, 3)) ->undefined : Symbol(undefined) ->a2 : Symbol(a2, Decl(logicalAndOperatorWithEveryType.ts, 6, 3)) - -var rc1 = a1 && a3; ->rc1 : Symbol(rc1, Decl(logicalAndOperatorWithEveryType.ts, 36, 3)) ->a1 : Symbol(a1, Decl(logicalAndOperatorWithEveryType.ts, 5, 3)) ->a3 : Symbol(a3, Decl(logicalAndOperatorWithEveryType.ts, 7, 3)) - -var rc2 = a2 && a3; ->rc2 : Symbol(rc2, Decl(logicalAndOperatorWithEveryType.ts, 37, 3)) ->a2 : Symbol(a2, Decl(logicalAndOperatorWithEveryType.ts, 6, 3)) ->a3 : Symbol(a3, Decl(logicalAndOperatorWithEveryType.ts, 7, 3)) - -var rc3 = a3 && a3; ->rc3 : Symbol(rc3, Decl(logicalAndOperatorWithEveryType.ts, 38, 3)) ->a3 : Symbol(a3, Decl(logicalAndOperatorWithEveryType.ts, 7, 3)) ->a3 : Symbol(a3, Decl(logicalAndOperatorWithEveryType.ts, 7, 3)) - -var rc4 = a4 && a3; ->rc4 : Symbol(rc4, Decl(logicalAndOperatorWithEveryType.ts, 39, 3)) ->a4 : Symbol(a4, Decl(logicalAndOperatorWithEveryType.ts, 8, 3)) ->a3 : Symbol(a3, Decl(logicalAndOperatorWithEveryType.ts, 7, 3)) - -var rc5 = a5 && a3; ->rc5 : Symbol(rc5, Decl(logicalAndOperatorWithEveryType.ts, 40, 3)) ->a5 : Symbol(a5, Decl(logicalAndOperatorWithEveryType.ts, 9, 3)) ->a3 : Symbol(a3, Decl(logicalAndOperatorWithEveryType.ts, 7, 3)) - -var rc6 = a6 && a3; ->rc6 : Symbol(rc6, Decl(logicalAndOperatorWithEveryType.ts, 41, 3)) ->a6 : Symbol(a6, Decl(logicalAndOperatorWithEveryType.ts, 10, 3)) ->a3 : Symbol(a3, Decl(logicalAndOperatorWithEveryType.ts, 7, 3)) - -var rc7 = a7 && a3; ->rc7 : Symbol(rc7, Decl(logicalAndOperatorWithEveryType.ts, 42, 3)) ->a7 : Symbol(a7, Decl(logicalAndOperatorWithEveryType.ts, 11, 3)) ->a3 : Symbol(a3, Decl(logicalAndOperatorWithEveryType.ts, 7, 3)) - -var rc8 = a8 && a3; ->rc8 : Symbol(rc8, Decl(logicalAndOperatorWithEveryType.ts, 43, 3)) ->a8 : Symbol(a8, Decl(logicalAndOperatorWithEveryType.ts, 12, 3)) ->a3 : Symbol(a3, Decl(logicalAndOperatorWithEveryType.ts, 7, 3)) - -var rc9 = null && a3; ->rc9 : Symbol(rc9, Decl(logicalAndOperatorWithEveryType.ts, 44, 3)) ->a3 : Symbol(a3, Decl(logicalAndOperatorWithEveryType.ts, 7, 3)) - -var rc10 = undefined && a3; ->rc10 : Symbol(rc10, Decl(logicalAndOperatorWithEveryType.ts, 45, 3)) ->undefined : Symbol(undefined) ->a3 : Symbol(a3, Decl(logicalAndOperatorWithEveryType.ts, 7, 3)) - -var rd1 = a1 && a4; ->rd1 : Symbol(rd1, Decl(logicalAndOperatorWithEveryType.ts, 47, 3)) ->a1 : Symbol(a1, Decl(logicalAndOperatorWithEveryType.ts, 5, 3)) ->a4 : Symbol(a4, Decl(logicalAndOperatorWithEveryType.ts, 8, 3)) - -var rd2 = a2 && a4; ->rd2 : Symbol(rd2, Decl(logicalAndOperatorWithEveryType.ts, 48, 3)) ->a2 : Symbol(a2, Decl(logicalAndOperatorWithEveryType.ts, 6, 3)) ->a4 : Symbol(a4, Decl(logicalAndOperatorWithEveryType.ts, 8, 3)) - -var rd3 = a3 && a4; ->rd3 : Symbol(rd3, Decl(logicalAndOperatorWithEveryType.ts, 49, 3)) ->a3 : Symbol(a3, Decl(logicalAndOperatorWithEveryType.ts, 7, 3)) ->a4 : Symbol(a4, Decl(logicalAndOperatorWithEveryType.ts, 8, 3)) - -var rd4 = a4 && a4; ->rd4 : Symbol(rd4, Decl(logicalAndOperatorWithEveryType.ts, 50, 3)) ->a4 : Symbol(a4, Decl(logicalAndOperatorWithEveryType.ts, 8, 3)) ->a4 : Symbol(a4, Decl(logicalAndOperatorWithEveryType.ts, 8, 3)) - -var rd5 = a5 && a4; ->rd5 : Symbol(rd5, Decl(logicalAndOperatorWithEveryType.ts, 51, 3)) ->a5 : Symbol(a5, Decl(logicalAndOperatorWithEveryType.ts, 9, 3)) ->a4 : Symbol(a4, Decl(logicalAndOperatorWithEveryType.ts, 8, 3)) - -var rd6 = a6 && a4; ->rd6 : Symbol(rd6, Decl(logicalAndOperatorWithEveryType.ts, 52, 3)) ->a6 : Symbol(a6, Decl(logicalAndOperatorWithEveryType.ts, 10, 3)) ->a4 : Symbol(a4, Decl(logicalAndOperatorWithEveryType.ts, 8, 3)) - -var rd7 = a7 && a4; ->rd7 : Symbol(rd7, Decl(logicalAndOperatorWithEveryType.ts, 53, 3)) ->a7 : Symbol(a7, Decl(logicalAndOperatorWithEveryType.ts, 11, 3)) ->a4 : Symbol(a4, Decl(logicalAndOperatorWithEveryType.ts, 8, 3)) - -var rd8 = a8 && a4; ->rd8 : Symbol(rd8, Decl(logicalAndOperatorWithEveryType.ts, 54, 3)) ->a8 : Symbol(a8, Decl(logicalAndOperatorWithEveryType.ts, 12, 3)) ->a4 : Symbol(a4, Decl(logicalAndOperatorWithEveryType.ts, 8, 3)) - -var rd9 = null && a4; ->rd9 : Symbol(rd9, Decl(logicalAndOperatorWithEveryType.ts, 55, 3)) ->a4 : Symbol(a4, Decl(logicalAndOperatorWithEveryType.ts, 8, 3)) - -var rd10 = undefined && a4; ->rd10 : Symbol(rd10, Decl(logicalAndOperatorWithEveryType.ts, 56, 3)) ->undefined : Symbol(undefined) ->a4 : Symbol(a4, Decl(logicalAndOperatorWithEveryType.ts, 8, 3)) - -var re1 = a1 && a5; ->re1 : Symbol(re1, Decl(logicalAndOperatorWithEveryType.ts, 58, 3)) ->a1 : Symbol(a1, Decl(logicalAndOperatorWithEveryType.ts, 5, 3)) ->a5 : Symbol(a5, Decl(logicalAndOperatorWithEveryType.ts, 9, 3)) - -var re2 = a2 && a5; ->re2 : Symbol(re2, Decl(logicalAndOperatorWithEveryType.ts, 59, 3)) ->a2 : Symbol(a2, Decl(logicalAndOperatorWithEveryType.ts, 6, 3)) ->a5 : Symbol(a5, Decl(logicalAndOperatorWithEveryType.ts, 9, 3)) - -var re3 = a3 && a5; ->re3 : Symbol(re3, Decl(logicalAndOperatorWithEveryType.ts, 60, 3)) ->a3 : Symbol(a3, Decl(logicalAndOperatorWithEveryType.ts, 7, 3)) ->a5 : Symbol(a5, Decl(logicalAndOperatorWithEveryType.ts, 9, 3)) - -var re4 = a4 && a5; ->re4 : Symbol(re4, Decl(logicalAndOperatorWithEveryType.ts, 61, 3)) ->a4 : Symbol(a4, Decl(logicalAndOperatorWithEveryType.ts, 8, 3)) ->a5 : Symbol(a5, Decl(logicalAndOperatorWithEveryType.ts, 9, 3)) - -var re5 = a5 && a5; ->re5 : Symbol(re5, Decl(logicalAndOperatorWithEveryType.ts, 62, 3)) ->a5 : Symbol(a5, Decl(logicalAndOperatorWithEveryType.ts, 9, 3)) ->a5 : Symbol(a5, Decl(logicalAndOperatorWithEveryType.ts, 9, 3)) - -var re6 = a6 && a5; ->re6 : Symbol(re6, Decl(logicalAndOperatorWithEveryType.ts, 63, 3)) ->a6 : Symbol(a6, Decl(logicalAndOperatorWithEveryType.ts, 10, 3)) ->a5 : Symbol(a5, Decl(logicalAndOperatorWithEveryType.ts, 9, 3)) - -var re7 = a7 && a5; ->re7 : Symbol(re7, Decl(logicalAndOperatorWithEveryType.ts, 64, 3)) ->a7 : Symbol(a7, Decl(logicalAndOperatorWithEveryType.ts, 11, 3)) ->a5 : Symbol(a5, Decl(logicalAndOperatorWithEveryType.ts, 9, 3)) - -var re8 = a8 && a5; ->re8 : Symbol(re8, Decl(logicalAndOperatorWithEveryType.ts, 65, 3)) ->a8 : Symbol(a8, Decl(logicalAndOperatorWithEveryType.ts, 12, 3)) ->a5 : Symbol(a5, Decl(logicalAndOperatorWithEveryType.ts, 9, 3)) - -var re9 = null && a5; ->re9 : Symbol(re9, Decl(logicalAndOperatorWithEveryType.ts, 66, 3)) ->a5 : Symbol(a5, Decl(logicalAndOperatorWithEveryType.ts, 9, 3)) - -var re10 = undefined && a5; ->re10 : Symbol(re10, Decl(logicalAndOperatorWithEveryType.ts, 67, 3)) ->undefined : Symbol(undefined) ->a5 : Symbol(a5, Decl(logicalAndOperatorWithEveryType.ts, 9, 3)) - -var rf1 = a1 && a6; ->rf1 : Symbol(rf1, Decl(logicalAndOperatorWithEveryType.ts, 69, 3)) ->a1 : Symbol(a1, Decl(logicalAndOperatorWithEveryType.ts, 5, 3)) ->a6 : Symbol(a6, Decl(logicalAndOperatorWithEveryType.ts, 10, 3)) - -var rf2 = a2 && a6; ->rf2 : Symbol(rf2, Decl(logicalAndOperatorWithEveryType.ts, 70, 3)) ->a2 : Symbol(a2, Decl(logicalAndOperatorWithEveryType.ts, 6, 3)) ->a6 : Symbol(a6, Decl(logicalAndOperatorWithEveryType.ts, 10, 3)) - -var rf3 = a3 && a6; ->rf3 : Symbol(rf3, Decl(logicalAndOperatorWithEveryType.ts, 71, 3)) ->a3 : Symbol(a3, Decl(logicalAndOperatorWithEveryType.ts, 7, 3)) ->a6 : Symbol(a6, Decl(logicalAndOperatorWithEveryType.ts, 10, 3)) - -var rf4 = a4 && a6; ->rf4 : Symbol(rf4, Decl(logicalAndOperatorWithEveryType.ts, 72, 3)) ->a4 : Symbol(a4, Decl(logicalAndOperatorWithEveryType.ts, 8, 3)) ->a6 : Symbol(a6, Decl(logicalAndOperatorWithEveryType.ts, 10, 3)) - -var rf5 = a5 && a6; ->rf5 : Symbol(rf5, Decl(logicalAndOperatorWithEveryType.ts, 73, 3)) ->a5 : Symbol(a5, Decl(logicalAndOperatorWithEveryType.ts, 9, 3)) ->a6 : Symbol(a6, Decl(logicalAndOperatorWithEveryType.ts, 10, 3)) - -var rf6 = a6 && a6; ->rf6 : Symbol(rf6, Decl(logicalAndOperatorWithEveryType.ts, 74, 3)) ->a6 : Symbol(a6, Decl(logicalAndOperatorWithEveryType.ts, 10, 3)) ->a6 : Symbol(a6, Decl(logicalAndOperatorWithEveryType.ts, 10, 3)) - -var rf7 = a7 && a6; ->rf7 : Symbol(rf7, Decl(logicalAndOperatorWithEveryType.ts, 75, 3)) ->a7 : Symbol(a7, Decl(logicalAndOperatorWithEveryType.ts, 11, 3)) ->a6 : Symbol(a6, Decl(logicalAndOperatorWithEveryType.ts, 10, 3)) - -var rf8 = a8 && a6; ->rf8 : Symbol(rf8, Decl(logicalAndOperatorWithEveryType.ts, 76, 3)) ->a8 : Symbol(a8, Decl(logicalAndOperatorWithEveryType.ts, 12, 3)) ->a6 : Symbol(a6, Decl(logicalAndOperatorWithEveryType.ts, 10, 3)) - -var rf9 = null && a6; ->rf9 : Symbol(rf9, Decl(logicalAndOperatorWithEveryType.ts, 77, 3)) ->a6 : Symbol(a6, Decl(logicalAndOperatorWithEveryType.ts, 10, 3)) - -var rf10 = undefined && a6; ->rf10 : Symbol(rf10, Decl(logicalAndOperatorWithEveryType.ts, 78, 3)) ->undefined : Symbol(undefined) ->a6 : Symbol(a6, Decl(logicalAndOperatorWithEveryType.ts, 10, 3)) - -var rg1 = a1 && a7; ->rg1 : Symbol(rg1, Decl(logicalAndOperatorWithEveryType.ts, 80, 3)) ->a1 : Symbol(a1, Decl(logicalAndOperatorWithEveryType.ts, 5, 3)) ->a7 : Symbol(a7, Decl(logicalAndOperatorWithEveryType.ts, 11, 3)) - -var rg2 = a2 && a7; ->rg2 : Symbol(rg2, Decl(logicalAndOperatorWithEveryType.ts, 81, 3)) ->a2 : Symbol(a2, Decl(logicalAndOperatorWithEveryType.ts, 6, 3)) ->a7 : Symbol(a7, Decl(logicalAndOperatorWithEveryType.ts, 11, 3)) - -var rg3 = a3 && a7; ->rg3 : Symbol(rg3, Decl(logicalAndOperatorWithEveryType.ts, 82, 3)) ->a3 : Symbol(a3, Decl(logicalAndOperatorWithEveryType.ts, 7, 3)) ->a7 : Symbol(a7, Decl(logicalAndOperatorWithEveryType.ts, 11, 3)) - -var rg4 = a4 && a7; ->rg4 : Symbol(rg4, Decl(logicalAndOperatorWithEveryType.ts, 83, 3)) ->a4 : Symbol(a4, Decl(logicalAndOperatorWithEveryType.ts, 8, 3)) ->a7 : Symbol(a7, Decl(logicalAndOperatorWithEveryType.ts, 11, 3)) - -var rg5 = a5 && a7; ->rg5 : Symbol(rg5, Decl(logicalAndOperatorWithEveryType.ts, 84, 3)) ->a5 : Symbol(a5, Decl(logicalAndOperatorWithEveryType.ts, 9, 3)) ->a7 : Symbol(a7, Decl(logicalAndOperatorWithEveryType.ts, 11, 3)) - -var rg6 = a6 && a7; ->rg6 : Symbol(rg6, Decl(logicalAndOperatorWithEveryType.ts, 85, 3)) ->a6 : Symbol(a6, Decl(logicalAndOperatorWithEveryType.ts, 10, 3)) ->a7 : Symbol(a7, Decl(logicalAndOperatorWithEveryType.ts, 11, 3)) - -var rg7 = a7 && a7; ->rg7 : Symbol(rg7, Decl(logicalAndOperatorWithEveryType.ts, 86, 3)) ->a7 : Symbol(a7, Decl(logicalAndOperatorWithEveryType.ts, 11, 3)) ->a7 : Symbol(a7, Decl(logicalAndOperatorWithEveryType.ts, 11, 3)) - -var rg8 = a8 && a7; ->rg8 : Symbol(rg8, Decl(logicalAndOperatorWithEveryType.ts, 87, 3)) ->a8 : Symbol(a8, Decl(logicalAndOperatorWithEveryType.ts, 12, 3)) ->a7 : Symbol(a7, Decl(logicalAndOperatorWithEveryType.ts, 11, 3)) - -var rg9 = null && a7; ->rg9 : Symbol(rg9, Decl(logicalAndOperatorWithEveryType.ts, 88, 3)) ->a7 : Symbol(a7, Decl(logicalAndOperatorWithEveryType.ts, 11, 3)) - -var rg10 = undefined && a7; ->rg10 : Symbol(rg10, Decl(logicalAndOperatorWithEveryType.ts, 89, 3)) ->undefined : Symbol(undefined) ->a7 : Symbol(a7, Decl(logicalAndOperatorWithEveryType.ts, 11, 3)) - -var rh1 = a1 && a8; ->rh1 : Symbol(rh1, Decl(logicalAndOperatorWithEveryType.ts, 91, 3)) ->a1 : Symbol(a1, Decl(logicalAndOperatorWithEveryType.ts, 5, 3)) ->a8 : Symbol(a8, Decl(logicalAndOperatorWithEveryType.ts, 12, 3)) - -var rh2 = a2 && a8; ->rh2 : Symbol(rh2, Decl(logicalAndOperatorWithEveryType.ts, 92, 3)) ->a2 : Symbol(a2, Decl(logicalAndOperatorWithEveryType.ts, 6, 3)) ->a8 : Symbol(a8, Decl(logicalAndOperatorWithEveryType.ts, 12, 3)) - -var rh3 = a3 && a8; ->rh3 : Symbol(rh3, Decl(logicalAndOperatorWithEveryType.ts, 93, 3)) ->a3 : Symbol(a3, Decl(logicalAndOperatorWithEveryType.ts, 7, 3)) ->a8 : Symbol(a8, Decl(logicalAndOperatorWithEveryType.ts, 12, 3)) - -var rh4 = a4 && a8; ->rh4 : Symbol(rh4, Decl(logicalAndOperatorWithEveryType.ts, 94, 3)) ->a4 : Symbol(a4, Decl(logicalAndOperatorWithEveryType.ts, 8, 3)) ->a8 : Symbol(a8, Decl(logicalAndOperatorWithEveryType.ts, 12, 3)) - -var rh5 = a5 && a8; ->rh5 : Symbol(rh5, Decl(logicalAndOperatorWithEveryType.ts, 95, 3)) ->a5 : Symbol(a5, Decl(logicalAndOperatorWithEveryType.ts, 9, 3)) ->a8 : Symbol(a8, Decl(logicalAndOperatorWithEveryType.ts, 12, 3)) - -var rh6 = a6 && a8; ->rh6 : Symbol(rh6, Decl(logicalAndOperatorWithEveryType.ts, 96, 3)) ->a6 : Symbol(a6, Decl(logicalAndOperatorWithEveryType.ts, 10, 3)) ->a8 : Symbol(a8, Decl(logicalAndOperatorWithEveryType.ts, 12, 3)) - -var rh7 = a7 && a8; ->rh7 : Symbol(rh7, Decl(logicalAndOperatorWithEveryType.ts, 97, 3)) ->a7 : Symbol(a7, Decl(logicalAndOperatorWithEveryType.ts, 11, 3)) ->a8 : Symbol(a8, Decl(logicalAndOperatorWithEveryType.ts, 12, 3)) - -var rh8 = a8 && a8; ->rh8 : Symbol(rh8, Decl(logicalAndOperatorWithEveryType.ts, 98, 3)) ->a8 : Symbol(a8, Decl(logicalAndOperatorWithEveryType.ts, 12, 3)) ->a8 : Symbol(a8, Decl(logicalAndOperatorWithEveryType.ts, 12, 3)) - -var rh9 = null && a8; ->rh9 : Symbol(rh9, Decl(logicalAndOperatorWithEveryType.ts, 99, 3)) ->a8 : Symbol(a8, Decl(logicalAndOperatorWithEveryType.ts, 12, 3)) - -var rh10 = undefined && a8; ->rh10 : Symbol(rh10, Decl(logicalAndOperatorWithEveryType.ts, 100, 3)) ->undefined : Symbol(undefined) ->a8 : Symbol(a8, Decl(logicalAndOperatorWithEveryType.ts, 12, 3)) - -var ri1 = a1 && null; ->ri1 : Symbol(ri1, Decl(logicalAndOperatorWithEveryType.ts, 102, 3)) ->a1 : Symbol(a1, Decl(logicalAndOperatorWithEveryType.ts, 5, 3)) - -var ri2 = a2 && null; ->ri2 : Symbol(ri2, Decl(logicalAndOperatorWithEveryType.ts, 103, 3)) ->a2 : Symbol(a2, Decl(logicalAndOperatorWithEveryType.ts, 6, 3)) - -var ri3 = a3 && null; ->ri3 : Symbol(ri3, Decl(logicalAndOperatorWithEveryType.ts, 104, 3)) ->a3 : Symbol(a3, Decl(logicalAndOperatorWithEveryType.ts, 7, 3)) - -var ri4 = a4 && null; ->ri4 : Symbol(ri4, Decl(logicalAndOperatorWithEveryType.ts, 105, 3)) ->a4 : Symbol(a4, Decl(logicalAndOperatorWithEveryType.ts, 8, 3)) - -var ri5 = a5 && null; ->ri5 : Symbol(ri5, Decl(logicalAndOperatorWithEveryType.ts, 106, 3)) ->a5 : Symbol(a5, Decl(logicalAndOperatorWithEveryType.ts, 9, 3)) - -var ri6 = a6 && null; ->ri6 : Symbol(ri6, Decl(logicalAndOperatorWithEveryType.ts, 107, 3)) ->a6 : Symbol(a6, Decl(logicalAndOperatorWithEveryType.ts, 10, 3)) - -var ri7 = a7 && null; ->ri7 : Symbol(ri7, Decl(logicalAndOperatorWithEveryType.ts, 108, 3)) ->a7 : Symbol(a7, Decl(logicalAndOperatorWithEveryType.ts, 11, 3)) - -var ri8 = a8 && null; ->ri8 : Symbol(ri8, Decl(logicalAndOperatorWithEveryType.ts, 109, 3)) ->a8 : Symbol(a8, Decl(logicalAndOperatorWithEveryType.ts, 12, 3)) - -var ri9 = null && null; ->ri9 : Symbol(ri9, Decl(logicalAndOperatorWithEveryType.ts, 110, 3)) - -var ri10 = undefined && null; ->ri10 : Symbol(ri10, Decl(logicalAndOperatorWithEveryType.ts, 111, 3)) ->undefined : Symbol(undefined) - -var rj1 = a1 && undefined; ->rj1 : Symbol(rj1, Decl(logicalAndOperatorWithEveryType.ts, 113, 3)) ->a1 : Symbol(a1, Decl(logicalAndOperatorWithEveryType.ts, 5, 3)) ->undefined : Symbol(undefined) - -var rj2 = a2 && undefined; ->rj2 : Symbol(rj2, Decl(logicalAndOperatorWithEveryType.ts, 114, 3)) ->a2 : Symbol(a2, Decl(logicalAndOperatorWithEveryType.ts, 6, 3)) ->undefined : Symbol(undefined) - -var rj3 = a3 && undefined; ->rj3 : Symbol(rj3, Decl(logicalAndOperatorWithEveryType.ts, 115, 3)) ->a3 : Symbol(a3, Decl(logicalAndOperatorWithEveryType.ts, 7, 3)) ->undefined : Symbol(undefined) - -var rj4 = a4 && undefined; ->rj4 : Symbol(rj4, Decl(logicalAndOperatorWithEveryType.ts, 116, 3)) ->a4 : Symbol(a4, Decl(logicalAndOperatorWithEveryType.ts, 8, 3)) ->undefined : Symbol(undefined) - -var rj5 = a5 && undefined; ->rj5 : Symbol(rj5, Decl(logicalAndOperatorWithEveryType.ts, 117, 3)) ->a5 : Symbol(a5, Decl(logicalAndOperatorWithEveryType.ts, 9, 3)) ->undefined : Symbol(undefined) - -var rj6 = a6 && undefined; ->rj6 : Symbol(rj6, Decl(logicalAndOperatorWithEveryType.ts, 118, 3)) ->a6 : Symbol(a6, Decl(logicalAndOperatorWithEveryType.ts, 10, 3)) ->undefined : Symbol(undefined) - -var rj7 = a7 && undefined; ->rj7 : Symbol(rj7, Decl(logicalAndOperatorWithEveryType.ts, 119, 3)) ->a7 : Symbol(a7, Decl(logicalAndOperatorWithEveryType.ts, 11, 3)) ->undefined : Symbol(undefined) - -var rj8 = a8 && undefined; ->rj8 : Symbol(rj8, Decl(logicalAndOperatorWithEveryType.ts, 120, 3)) ->a8 : Symbol(a8, Decl(logicalAndOperatorWithEveryType.ts, 12, 3)) ->undefined : Symbol(undefined) - -var rj9 = null && undefined; ->rj9 : Symbol(rj9, Decl(logicalAndOperatorWithEveryType.ts, 121, 3)) ->undefined : Symbol(undefined) - -var rj10 = undefined && undefined; ->rj10 : Symbol(rj10, Decl(logicalAndOperatorWithEveryType.ts, 122, 3)) ->undefined : Symbol(undefined) ->undefined : Symbol(undefined) - diff --git a/tests/baselines/reference/logicalAndOperatorWithEveryType.types b/tests/baselines/reference/logicalAndOperatorWithEveryType.types deleted file mode 100644 index bd913e94da58c..0000000000000 --- a/tests/baselines/reference/logicalAndOperatorWithEveryType.types +++ /dev/null @@ -1,635 +0,0 @@ -=== tests/cases/conformance/expressions/binaryOperators/logicalAndOperator/logicalAndOperatorWithEveryType.ts === -// The && operator permits the operands to be of any type and produces a result of the same -// type as the second operand. - -enum E { a, b, c } ->E : E ->a : E ->b : E ->c : E - -var a1: any; ->a1 : any - -var a2: boolean; ->a2 : boolean - -var a3: number ->a3 : number - -var a4: string; ->a4 : string - -var a5: void; ->a5 : void - -var a6: E; ->a6 : E ->E : E - -var a7: {}; ->a7 : {} - -var a8: string[]; ->a8 : string[] - -var ra1 = a1 && a1; ->ra1 : any ->a1 && a1 : any ->a1 : any ->a1 : any - -var ra2 = a2 && a1; ->ra2 : any ->a2 && a1 : any ->a2 : boolean ->a1 : any - -var ra3 = a3 && a1; ->ra3 : any ->a3 && a1 : any ->a3 : number ->a1 : any - -var ra4 = a4 && a1; ->ra4 : any ->a4 && a1 : any ->a4 : string ->a1 : any - -var ra5 = a5 && a1; ->ra5 : any ->a5 && a1 : any ->a5 : void ->a1 : any - -var ra6 = a6 && a1; ->ra6 : any ->a6 && a1 : any ->a6 : E ->a1 : any - -var ra7 = a7 && a1; ->ra7 : any ->a7 && a1 : any ->a7 : {} ->a1 : any - -var ra8 = a8 && a1; ->ra8 : any ->a8 && a1 : any ->a8 : string[] ->a1 : any - -var ra9 = null && a1; ->ra9 : any ->null && a1 : any ->null : null ->a1 : any - -var ra10 = undefined && a1; ->ra10 : any ->undefined && a1 : any ->undefined : undefined ->a1 : any - -var rb1 = a1 && a2; ->rb1 : boolean ->a1 && a2 : boolean ->a1 : any ->a2 : boolean - -var rb2 = a2 && a2; ->rb2 : boolean ->a2 && a2 : boolean ->a2 : boolean ->a2 : boolean - -var rb3 = a3 && a2; ->rb3 : boolean ->a3 && a2 : boolean ->a3 : number ->a2 : boolean - -var rb4 = a4 && a2; ->rb4 : boolean ->a4 && a2 : boolean ->a4 : string ->a2 : boolean - -var rb5 = a5 && a2; ->rb5 : boolean ->a5 && a2 : boolean ->a5 : void ->a2 : boolean - -var rb6 = a6 && a2; ->rb6 : boolean ->a6 && a2 : boolean ->a6 : E ->a2 : boolean - -var rb7 = a7 && a2; ->rb7 : boolean ->a7 && a2 : boolean ->a7 : {} ->a2 : boolean - -var rb8 = a8 && a2; ->rb8 : boolean ->a8 && a2 : boolean ->a8 : string[] ->a2 : boolean - -var rb9 = null && a2; ->rb9 : boolean ->null && a2 : boolean ->null : null ->a2 : boolean - -var rb10 = undefined && a2; ->rb10 : boolean ->undefined && a2 : boolean ->undefined : undefined ->a2 : boolean - -var rc1 = a1 && a3; ->rc1 : number ->a1 && a3 : number ->a1 : any ->a3 : number - -var rc2 = a2 && a3; ->rc2 : number ->a2 && a3 : number ->a2 : boolean ->a3 : number - -var rc3 = a3 && a3; ->rc3 : number ->a3 && a3 : number ->a3 : number ->a3 : number - -var rc4 = a4 && a3; ->rc4 : number ->a4 && a3 : number ->a4 : string ->a3 : number - -var rc5 = a5 && a3; ->rc5 : number ->a5 && a3 : number ->a5 : void ->a3 : number - -var rc6 = a6 && a3; ->rc6 : number ->a6 && a3 : number ->a6 : E ->a3 : number - -var rc7 = a7 && a3; ->rc7 : number ->a7 && a3 : number ->a7 : {} ->a3 : number - -var rc8 = a8 && a3; ->rc8 : number ->a8 && a3 : number ->a8 : string[] ->a3 : number - -var rc9 = null && a3; ->rc9 : number ->null && a3 : number ->null : null ->a3 : number - -var rc10 = undefined && a3; ->rc10 : number ->undefined && a3 : number ->undefined : undefined ->a3 : number - -var rd1 = a1 && a4; ->rd1 : string ->a1 && a4 : string ->a1 : any ->a4 : string - -var rd2 = a2 && a4; ->rd2 : string ->a2 && a4 : string ->a2 : boolean ->a4 : string - -var rd3 = a3 && a4; ->rd3 : string ->a3 && a4 : string ->a3 : number ->a4 : string - -var rd4 = a4 && a4; ->rd4 : string ->a4 && a4 : string ->a4 : string ->a4 : string - -var rd5 = a5 && a4; ->rd5 : string ->a5 && a4 : string ->a5 : void ->a4 : string - -var rd6 = a6 && a4; ->rd6 : string ->a6 && a4 : string ->a6 : E ->a4 : string - -var rd7 = a7 && a4; ->rd7 : string ->a7 && a4 : string ->a7 : {} ->a4 : string - -var rd8 = a8 && a4; ->rd8 : string ->a8 && a4 : string ->a8 : string[] ->a4 : string - -var rd9 = null && a4; ->rd9 : string ->null && a4 : string ->null : null ->a4 : string - -var rd10 = undefined && a4; ->rd10 : string ->undefined && a4 : string ->undefined : undefined ->a4 : string - -var re1 = a1 && a5; ->re1 : void ->a1 && a5 : void ->a1 : any ->a5 : void - -var re2 = a2 && a5; ->re2 : void ->a2 && a5 : void ->a2 : boolean ->a5 : void - -var re3 = a3 && a5; ->re3 : void ->a3 && a5 : void ->a3 : number ->a5 : void - -var re4 = a4 && a5; ->re4 : void ->a4 && a5 : void ->a4 : string ->a5 : void - -var re5 = a5 && a5; ->re5 : void ->a5 && a5 : void ->a5 : void ->a5 : void - -var re6 = a6 && a5; ->re6 : void ->a6 && a5 : void ->a6 : E ->a5 : void - -var re7 = a7 && a5; ->re7 : void ->a7 && a5 : void ->a7 : {} ->a5 : void - -var re8 = a8 && a5; ->re8 : void ->a8 && a5 : void ->a8 : string[] ->a5 : void - -var re9 = null && a5; ->re9 : void ->null && a5 : void ->null : null ->a5 : void - -var re10 = undefined && a5; ->re10 : void ->undefined && a5 : void ->undefined : undefined ->a5 : void - -var rf1 = a1 && a6; ->rf1 : E ->a1 && a6 : E ->a1 : any ->a6 : E - -var rf2 = a2 && a6; ->rf2 : E ->a2 && a6 : E ->a2 : boolean ->a6 : E - -var rf3 = a3 && a6; ->rf3 : E ->a3 && a6 : E ->a3 : number ->a6 : E - -var rf4 = a4 && a6; ->rf4 : E ->a4 && a6 : E ->a4 : string ->a6 : E - -var rf5 = a5 && a6; ->rf5 : E ->a5 && a6 : E ->a5 : void ->a6 : E - -var rf6 = a6 && a6; ->rf6 : E ->a6 && a6 : E ->a6 : E ->a6 : E - -var rf7 = a7 && a6; ->rf7 : E ->a7 && a6 : E ->a7 : {} ->a6 : E - -var rf8 = a8 && a6; ->rf8 : E ->a8 && a6 : E ->a8 : string[] ->a6 : E - -var rf9 = null && a6; ->rf9 : E ->null && a6 : E ->null : null ->a6 : E - -var rf10 = undefined && a6; ->rf10 : E ->undefined && a6 : E ->undefined : undefined ->a6 : E - -var rg1 = a1 && a7; ->rg1 : {} ->a1 && a7 : {} ->a1 : any ->a7 : {} - -var rg2 = a2 && a7; ->rg2 : {} ->a2 && a7 : {} ->a2 : boolean ->a7 : {} - -var rg3 = a3 && a7; ->rg3 : {} ->a3 && a7 : {} ->a3 : number ->a7 : {} - -var rg4 = a4 && a7; ->rg4 : {} ->a4 && a7 : {} ->a4 : string ->a7 : {} - -var rg5 = a5 && a7; ->rg5 : {} ->a5 && a7 : {} ->a5 : void ->a7 : {} - -var rg6 = a6 && a7; ->rg6 : {} ->a6 && a7 : {} ->a6 : E ->a7 : {} - -var rg7 = a7 && a7; ->rg7 : {} ->a7 && a7 : {} ->a7 : {} ->a7 : {} - -var rg8 = a8 && a7; ->rg8 : {} ->a8 && a7 : {} ->a8 : string[] ->a7 : {} - -var rg9 = null && a7; ->rg9 : {} ->null && a7 : {} ->null : null ->a7 : {} - -var rg10 = undefined && a7; ->rg10 : {} ->undefined && a7 : {} ->undefined : undefined ->a7 : {} - -var rh1 = a1 && a8; ->rh1 : string[] ->a1 && a8 : string[] ->a1 : any ->a8 : string[] - -var rh2 = a2 && a8; ->rh2 : string[] ->a2 && a8 : string[] ->a2 : boolean ->a8 : string[] - -var rh3 = a3 && a8; ->rh3 : string[] ->a3 && a8 : string[] ->a3 : number ->a8 : string[] - -var rh4 = a4 && a8; ->rh4 : string[] ->a4 && a8 : string[] ->a4 : string ->a8 : string[] - -var rh5 = a5 && a8; ->rh5 : string[] ->a5 && a8 : string[] ->a5 : void ->a8 : string[] - -var rh6 = a6 && a8; ->rh6 : string[] ->a6 && a8 : string[] ->a6 : E ->a8 : string[] - -var rh7 = a7 && a8; ->rh7 : string[] ->a7 && a8 : string[] ->a7 : {} ->a8 : string[] - -var rh8 = a8 && a8; ->rh8 : string[] ->a8 && a8 : string[] ->a8 : string[] ->a8 : string[] - -var rh9 = null && a8; ->rh9 : string[] ->null && a8 : string[] ->null : null ->a8 : string[] - -var rh10 = undefined && a8; ->rh10 : string[] ->undefined && a8 : string[] ->undefined : undefined ->a8 : string[] - -var ri1 = a1 && null; ->ri1 : any ->a1 && null : null ->a1 : any ->null : null - -var ri2 = a2 && null; ->ri2 : any ->a2 && null : null ->a2 : boolean ->null : null - -var ri3 = a3 && null; ->ri3 : any ->a3 && null : null ->a3 : number ->null : null - -var ri4 = a4 && null; ->ri4 : any ->a4 && null : null ->a4 : string ->null : null - -var ri5 = a5 && null; ->ri5 : any ->a5 && null : null ->a5 : void ->null : null - -var ri6 = a6 && null; ->ri6 : any ->a6 && null : null ->a6 : E ->null : null - -var ri7 = a7 && null; ->ri7 : any ->a7 && null : null ->a7 : {} ->null : null - -var ri8 = a8 && null; ->ri8 : any ->a8 && null : null ->a8 : string[] ->null : null - -var ri9 = null && null; ->ri9 : any ->null && null : null ->null : null ->null : null - -var ri10 = undefined && null; ->ri10 : any ->undefined && null : null ->undefined : undefined ->null : null - -var rj1 = a1 && undefined; ->rj1 : any ->a1 && undefined : undefined ->a1 : any ->undefined : undefined - -var rj2 = a2 && undefined; ->rj2 : any ->a2 && undefined : undefined ->a2 : boolean ->undefined : undefined - -var rj3 = a3 && undefined; ->rj3 : any ->a3 && undefined : undefined ->a3 : number ->undefined : undefined - -var rj4 = a4 && undefined; ->rj4 : any ->a4 && undefined : undefined ->a4 : string ->undefined : undefined - -var rj5 = a5 && undefined; ->rj5 : any ->a5 && undefined : undefined ->a5 : void ->undefined : undefined - -var rj6 = a6 && undefined; ->rj6 : any ->a6 && undefined : undefined ->a6 : E ->undefined : undefined - -var rj7 = a7 && undefined; ->rj7 : any ->a7 && undefined : undefined ->a7 : {} ->undefined : undefined - -var rj8 = a8 && undefined; ->rj8 : any ->a8 && undefined : undefined ->a8 : string[] ->undefined : undefined - -var rj9 = null && undefined; ->rj9 : any ->null && undefined : undefined ->null : null ->undefined : undefined - -var rj10 = undefined && undefined; ->rj10 : any ->undefined && undefined : undefined ->undefined : undefined ->undefined : undefined - diff --git a/tests/baselines/reference/logicalOrOperatorWithEveryType.errors.txt b/tests/baselines/reference/logicalOrOperatorWithEveryType.errors.txt new file mode 100644 index 0000000000000..da4f922785fa9 --- /dev/null +++ b/tests/baselines/reference/logicalOrOperatorWithEveryType.errors.txt @@ -0,0 +1,158 @@ +tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrOperatorWithEveryType.ts(21,11): error TS5063: The left-hand side of a '||' expression cannot have type 'void'. +tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrOperatorWithEveryType.ts(32,11): error TS5063: The left-hand side of a '||' expression cannot have type 'void'. +tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrOperatorWithEveryType.ts(43,11): error TS5063: The left-hand side of a '||' expression cannot have type 'void'. +tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrOperatorWithEveryType.ts(54,11): error TS5063: The left-hand side of a '||' expression cannot have type 'void'. +tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrOperatorWithEveryType.ts(65,11): error TS5063: The left-hand side of a '||' expression cannot have type 'void'. +tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrOperatorWithEveryType.ts(76,11): error TS5063: The left-hand side of a '||' expression cannot have type 'void'. +tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrOperatorWithEveryType.ts(87,11): error TS5063: The left-hand side of a '||' expression cannot have type 'void'. +tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrOperatorWithEveryType.ts(98,11): error TS5063: The left-hand side of a '||' expression cannot have type 'void'. +tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrOperatorWithEveryType.ts(109,11): error TS5063: The left-hand side of a '||' expression cannot have type 'void'. +tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrOperatorWithEveryType.ts(120,11): error TS5063: The left-hand side of a '||' expression cannot have type 'void'. + + +==== tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrOperatorWithEveryType.ts (10 errors) ==== + // The || operator permits the operands to be of any type. + // If the || expression is not contextually typed, the right operand is contextually typed + // by the type of the left operand and the result is of the best common type of the two + // operand types. + + enum E { a, b, c } + + var a1: any; + var a2: boolean; + var a3: number + var a4: string; + var a5: void; + var a6: E; + var a7: {a: string}; + var a8: string[]; + + var ra1 = a1 || a1; // any || any is any + var ra2 = a2 || a1; // boolean || any is any + var ra3 = a3 || a1; // number || any is any + var ra4 = a4 || a1; // string || any is any + var ra5 = a5 || a1; // void || any is any + ~~~~~~~~ +!!! error TS5063: The left-hand side of a '||' expression cannot have type 'void'. + var ra6 = a6 || a1; // enum || any is any + var ra7 = a7 || a1; // object || any is any + var ra8 = a8 || a1; // array || any is any + var ra9 = null || a1; // null || any is any + var ra10 = undefined || a1; // undefined || any is any + + var rb1 = a1 || a2; // any || boolean is any + var rb2 = a2 || a2; // boolean || boolean is boolean + var rb3 = a3 || a2; // number || boolean is number | boolean + var rb4 = a4 || a2; // string || boolean is string | boolean + var rb5 = a5 || a2; // void || boolean is void | boolean + ~~~~~~~~ +!!! error TS5063: The left-hand side of a '||' expression cannot have type 'void'. + var rb6 = a6 || a2; // enum || boolean is E | boolean + var rb7 = a7 || a2; // object || boolean is object | boolean + var rb8 = a8 || a2; // array || boolean is array | boolean + var rb9 = null || a2; // null || boolean is boolean + var rb10= undefined || a2; // undefined || boolean is boolean + + var rc1 = a1 || a3; // any || number is any + var rc2 = a2 || a3; // boolean || number is boolean | number + var rc3 = a3 || a3; // number || number is number + var rc4 = a4 || a3; // string || number is string | number + var rc5 = a5 || a3; // void || number is void | number + ~~~~~~~~ +!!! error TS5063: The left-hand side of a '||' expression cannot have type 'void'. + var rc6 = a6 || a3; // enum || number is number + var rc7 = a7 || a3; // object || number is object | number + var rc8 = a8 || a3; // array || number is array | number + var rc9 = null || a3; // null || number is number + var rc10 = undefined || a3; // undefined || number is number + + var rd1 = a1 || a4; // any || string is any + var rd2 = a2 || a4; // boolean || string is boolean | string + var rd3 = a3 || a4; // number || string is number | string + var rd4 = a4 || a4; // string || string is string + var rd5 = a5 || a4; // void || string is void | string + ~~~~~~~~ +!!! error TS5063: The left-hand side of a '||' expression cannot have type 'void'. + var rd6 = a6 || a4; // enum || string is enum | string + var rd7 = a7 || a4; // object || string is object | string + var rd8 = a8 || a4; // array || string is array | string + var rd9 = null || a4; // null || string is string + var rd10 = undefined || a4; // undefined || string is string + + var re1 = a1 || a5; // any || void is any + var re2 = a2 || a5; // boolean || void is boolean | void + var re3 = a3 || a5; // number || void is number | void + var re4 = a4 || a5; // string || void is string | void + var re5 = a5 || a5; // void || void is void + ~~~~~~~~ +!!! error TS5063: The left-hand side of a '||' expression cannot have type 'void'. + var re6 = a6 || a5; // enum || void is enum | void + var re7 = a7 || a5; // object || void is object | void + var re8 = a8 || a5; // array || void is array | void + var re9 = null || a5; // null || void is void + var re10 = undefined || a5; // undefined || void is void + + var rg1 = a1 || a6; // any || enum is any + var rg2 = a2 || a6; // boolean || enum is boolean | enum + var rg3 = a3 || a6; // number || enum is number + var rg4 = a4 || a6; // string || enum is string | enum + var rg5 = a5 || a6; // void || enum is void | enum + ~~~~~~~~ +!!! error TS5063: The left-hand side of a '||' expression cannot have type 'void'. + var rg6 = a6 || a6; // enum || enum is E + var rg7 = a7 || a6; // object || enum is object | enum + var rg8 = a8 || a6; // array || enum is array | enum + var rg9 = null || a6; // null || enum is E + var rg10 = undefined || a6; // undefined || enum is E + + var rh1 = a1 || a7; // any || object is any + var rh2 = a2 || a7; // boolean || object is boolean | object + var rh3 = a3 || a7; // number || object is number | object + var rh4 = a4 || a7; // string || object is string | object + var rh5 = a5 || a7; // void || object is void | object + ~~~~~~~~ +!!! error TS5063: The left-hand side of a '||' expression cannot have type 'void'. + var rh6 = a6 || a7; // enum || object is enum | object + var rh7 = a7 || a7; // object || object is object + var rh8 = a8 || a7; // array || object is array | object + var rh9 = null || a7; // null || object is object + var rh10 = undefined || a7; // undefined || object is object + + var ri1 = a1 || a8; // any || array is any + var ri2 = a2 || a8; // boolean || array is boolean | array + var ri3 = a3 || a8; // number || array is number | array + var ri4 = a4 || a8; // string || array is string | array + var ri5 = a5 || a8; // void || array is void | array + ~~~~~~~~ +!!! error TS5063: The left-hand side of a '||' expression cannot have type 'void'. + var ri6 = a6 || a8; // enum || array is enum | array + var ri7 = a7 || a8; // object || array is object | array + var ri8 = a8 || a8; // array || array is array + var ri9 = null || a8; // null || array is array + var ri10 = undefined || a8; // undefined || array is array + + var rj1 = a1 || null; // any || null is any + var rj2 = a2 || null; // boolean || null is boolean + var rj3 = a3 || null; // number || null is number + var rj4 = a4 || null; // string || null is string + var rj5 = a5 || null; // void || null is void + ~~~~~~~~~~ +!!! error TS5063: The left-hand side of a '||' expression cannot have type 'void'. + var rj6 = a6 || null; // enum || null is E + var rj7 = a7 || null; // object || null is object + var rj8 = a8 || null; // array || null is array + var rj9 = null || null; // null || null is any + var rj10 = undefined || null; // undefined || null is any + + var rf1 = a1 || undefined; // any || undefined is any + var rf2 = a2 || undefined; // boolean || undefined is boolean + var rf3 = a3 || undefined; // number || undefined is number + var rf4 = a4 || undefined; // string || undefined is string + var rf5 = a5 || undefined; // void || undefined is void + ~~~~~~~~~~~~~~~ +!!! error TS5063: The left-hand side of a '||' expression cannot have type 'void'. + var rf6 = a6 || undefined; // enum || undefined is E + var rf7 = a7 || undefined; // object || undefined is object + var rf8 = a8 || undefined; // array || undefined is array + var rf9 = null || undefined; // null || undefined is any + var rf10 = undefined || undefined; // undefined || undefined is any \ No newline at end of file diff --git a/tests/baselines/reference/logicalOrOperatorWithEveryType.symbols b/tests/baselines/reference/logicalOrOperatorWithEveryType.symbols deleted file mode 100644 index df2084351df8e..0000000000000 --- a/tests/baselines/reference/logicalOrOperatorWithEveryType.symbols +++ /dev/null @@ -1,518 +0,0 @@ -=== tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrOperatorWithEveryType.ts === -// The || operator permits the operands to be of any type. -// If the || expression is not contextually typed, the right operand is contextually typed -// by the type of the left operand and the result is of the best common type of the two -// operand types. - -enum E { a, b, c } ->E : Symbol(E, Decl(logicalOrOperatorWithEveryType.ts, 0, 0)) ->a : Symbol(E.a, Decl(logicalOrOperatorWithEveryType.ts, 5, 8)) ->b : Symbol(E.b, Decl(logicalOrOperatorWithEveryType.ts, 5, 11)) ->c : Symbol(E.c, Decl(logicalOrOperatorWithEveryType.ts, 5, 14)) - -var a1: any; ->a1 : Symbol(a1, Decl(logicalOrOperatorWithEveryType.ts, 7, 3)) - -var a2: boolean; ->a2 : Symbol(a2, Decl(logicalOrOperatorWithEveryType.ts, 8, 3)) - -var a3: number ->a3 : Symbol(a3, Decl(logicalOrOperatorWithEveryType.ts, 9, 3)) - -var a4: string; ->a4 : Symbol(a4, Decl(logicalOrOperatorWithEveryType.ts, 10, 3)) - -var a5: void; ->a5 : Symbol(a5, Decl(logicalOrOperatorWithEveryType.ts, 11, 3)) - -var a6: E; ->a6 : Symbol(a6, Decl(logicalOrOperatorWithEveryType.ts, 12, 3)) ->E : Symbol(E, Decl(logicalOrOperatorWithEveryType.ts, 0, 0)) - -var a7: {a: string}; ->a7 : Symbol(a7, Decl(logicalOrOperatorWithEveryType.ts, 13, 3)) ->a : Symbol(a, Decl(logicalOrOperatorWithEveryType.ts, 13, 9)) - -var a8: string[]; ->a8 : Symbol(a8, Decl(logicalOrOperatorWithEveryType.ts, 14, 3)) - -var ra1 = a1 || a1; // any || any is any ->ra1 : Symbol(ra1, Decl(logicalOrOperatorWithEveryType.ts, 16, 3)) ->a1 : Symbol(a1, Decl(logicalOrOperatorWithEveryType.ts, 7, 3)) ->a1 : Symbol(a1, Decl(logicalOrOperatorWithEveryType.ts, 7, 3)) - -var ra2 = a2 || a1; // boolean || any is any ->ra2 : Symbol(ra2, Decl(logicalOrOperatorWithEveryType.ts, 17, 3)) ->a2 : Symbol(a2, Decl(logicalOrOperatorWithEveryType.ts, 8, 3)) ->a1 : Symbol(a1, Decl(logicalOrOperatorWithEveryType.ts, 7, 3)) - -var ra3 = a3 || a1; // number || any is any ->ra3 : Symbol(ra3, Decl(logicalOrOperatorWithEveryType.ts, 18, 3)) ->a3 : Symbol(a3, Decl(logicalOrOperatorWithEveryType.ts, 9, 3)) ->a1 : Symbol(a1, Decl(logicalOrOperatorWithEveryType.ts, 7, 3)) - -var ra4 = a4 || a1; // string || any is any ->ra4 : Symbol(ra4, Decl(logicalOrOperatorWithEveryType.ts, 19, 3)) ->a4 : Symbol(a4, Decl(logicalOrOperatorWithEveryType.ts, 10, 3)) ->a1 : Symbol(a1, Decl(logicalOrOperatorWithEveryType.ts, 7, 3)) - -var ra5 = a5 || a1; // void || any is any ->ra5 : Symbol(ra5, Decl(logicalOrOperatorWithEveryType.ts, 20, 3)) ->a5 : Symbol(a5, Decl(logicalOrOperatorWithEveryType.ts, 11, 3)) ->a1 : Symbol(a1, Decl(logicalOrOperatorWithEveryType.ts, 7, 3)) - -var ra6 = a6 || a1; // enum || any is any ->ra6 : Symbol(ra6, Decl(logicalOrOperatorWithEveryType.ts, 21, 3)) ->a6 : Symbol(a6, Decl(logicalOrOperatorWithEveryType.ts, 12, 3)) ->a1 : Symbol(a1, Decl(logicalOrOperatorWithEveryType.ts, 7, 3)) - -var ra7 = a7 || a1; // object || any is any ->ra7 : Symbol(ra7, Decl(logicalOrOperatorWithEveryType.ts, 22, 3)) ->a7 : Symbol(a7, Decl(logicalOrOperatorWithEveryType.ts, 13, 3)) ->a1 : Symbol(a1, Decl(logicalOrOperatorWithEveryType.ts, 7, 3)) - -var ra8 = a8 || a1; // array || any is any ->ra8 : Symbol(ra8, Decl(logicalOrOperatorWithEveryType.ts, 23, 3)) ->a8 : Symbol(a8, Decl(logicalOrOperatorWithEveryType.ts, 14, 3)) ->a1 : Symbol(a1, Decl(logicalOrOperatorWithEveryType.ts, 7, 3)) - -var ra9 = null || a1; // null || any is any ->ra9 : Symbol(ra9, Decl(logicalOrOperatorWithEveryType.ts, 24, 3)) ->a1 : Symbol(a1, Decl(logicalOrOperatorWithEveryType.ts, 7, 3)) - -var ra10 = undefined || a1; // undefined || any is any ->ra10 : Symbol(ra10, Decl(logicalOrOperatorWithEveryType.ts, 25, 3)) ->undefined : Symbol(undefined) ->a1 : Symbol(a1, Decl(logicalOrOperatorWithEveryType.ts, 7, 3)) - -var rb1 = a1 || a2; // any || boolean is any ->rb1 : Symbol(rb1, Decl(logicalOrOperatorWithEveryType.ts, 27, 3)) ->a1 : Symbol(a1, Decl(logicalOrOperatorWithEveryType.ts, 7, 3)) ->a2 : Symbol(a2, Decl(logicalOrOperatorWithEveryType.ts, 8, 3)) - -var rb2 = a2 || a2; // boolean || boolean is boolean ->rb2 : Symbol(rb2, Decl(logicalOrOperatorWithEveryType.ts, 28, 3)) ->a2 : Symbol(a2, Decl(logicalOrOperatorWithEveryType.ts, 8, 3)) ->a2 : Symbol(a2, Decl(logicalOrOperatorWithEveryType.ts, 8, 3)) - -var rb3 = a3 || a2; // number || boolean is number | boolean ->rb3 : Symbol(rb3, Decl(logicalOrOperatorWithEveryType.ts, 29, 3)) ->a3 : Symbol(a3, Decl(logicalOrOperatorWithEveryType.ts, 9, 3)) ->a2 : Symbol(a2, Decl(logicalOrOperatorWithEveryType.ts, 8, 3)) - -var rb4 = a4 || a2; // string || boolean is string | boolean ->rb4 : Symbol(rb4, Decl(logicalOrOperatorWithEveryType.ts, 30, 3)) ->a4 : Symbol(a4, Decl(logicalOrOperatorWithEveryType.ts, 10, 3)) ->a2 : Symbol(a2, Decl(logicalOrOperatorWithEveryType.ts, 8, 3)) - -var rb5 = a5 || a2; // void || boolean is void | boolean ->rb5 : Symbol(rb5, Decl(logicalOrOperatorWithEveryType.ts, 31, 3)) ->a5 : Symbol(a5, Decl(logicalOrOperatorWithEveryType.ts, 11, 3)) ->a2 : Symbol(a2, Decl(logicalOrOperatorWithEveryType.ts, 8, 3)) - -var rb6 = a6 || a2; // enum || boolean is E | boolean ->rb6 : Symbol(rb6, Decl(logicalOrOperatorWithEveryType.ts, 32, 3)) ->a6 : Symbol(a6, Decl(logicalOrOperatorWithEveryType.ts, 12, 3)) ->a2 : Symbol(a2, Decl(logicalOrOperatorWithEveryType.ts, 8, 3)) - -var rb7 = a7 || a2; // object || boolean is object | boolean ->rb7 : Symbol(rb7, Decl(logicalOrOperatorWithEveryType.ts, 33, 3)) ->a7 : Symbol(a7, Decl(logicalOrOperatorWithEveryType.ts, 13, 3)) ->a2 : Symbol(a2, Decl(logicalOrOperatorWithEveryType.ts, 8, 3)) - -var rb8 = a8 || a2; // array || boolean is array | boolean ->rb8 : Symbol(rb8, Decl(logicalOrOperatorWithEveryType.ts, 34, 3)) ->a8 : Symbol(a8, Decl(logicalOrOperatorWithEveryType.ts, 14, 3)) ->a2 : Symbol(a2, Decl(logicalOrOperatorWithEveryType.ts, 8, 3)) - -var rb9 = null || a2; // null || boolean is boolean ->rb9 : Symbol(rb9, Decl(logicalOrOperatorWithEveryType.ts, 35, 3)) ->a2 : Symbol(a2, Decl(logicalOrOperatorWithEveryType.ts, 8, 3)) - -var rb10= undefined || a2; // undefined || boolean is boolean ->rb10 : Symbol(rb10, Decl(logicalOrOperatorWithEveryType.ts, 36, 3)) ->undefined : Symbol(undefined) ->a2 : Symbol(a2, Decl(logicalOrOperatorWithEveryType.ts, 8, 3)) - -var rc1 = a1 || a3; // any || number is any ->rc1 : Symbol(rc1, Decl(logicalOrOperatorWithEveryType.ts, 38, 3)) ->a1 : Symbol(a1, Decl(logicalOrOperatorWithEveryType.ts, 7, 3)) ->a3 : Symbol(a3, Decl(logicalOrOperatorWithEveryType.ts, 9, 3)) - -var rc2 = a2 || a3; // boolean || number is boolean | number ->rc2 : Symbol(rc2, Decl(logicalOrOperatorWithEveryType.ts, 39, 3)) ->a2 : Symbol(a2, Decl(logicalOrOperatorWithEveryType.ts, 8, 3)) ->a3 : Symbol(a3, Decl(logicalOrOperatorWithEveryType.ts, 9, 3)) - -var rc3 = a3 || a3; // number || number is number ->rc3 : Symbol(rc3, Decl(logicalOrOperatorWithEveryType.ts, 40, 3)) ->a3 : Symbol(a3, Decl(logicalOrOperatorWithEveryType.ts, 9, 3)) ->a3 : Symbol(a3, Decl(logicalOrOperatorWithEveryType.ts, 9, 3)) - -var rc4 = a4 || a3; // string || number is string | number ->rc4 : Symbol(rc4, Decl(logicalOrOperatorWithEveryType.ts, 41, 3)) ->a4 : Symbol(a4, Decl(logicalOrOperatorWithEveryType.ts, 10, 3)) ->a3 : Symbol(a3, Decl(logicalOrOperatorWithEveryType.ts, 9, 3)) - -var rc5 = a5 || a3; // void || number is void | number ->rc5 : Symbol(rc5, Decl(logicalOrOperatorWithEveryType.ts, 42, 3)) ->a5 : Symbol(a5, Decl(logicalOrOperatorWithEveryType.ts, 11, 3)) ->a3 : Symbol(a3, Decl(logicalOrOperatorWithEveryType.ts, 9, 3)) - -var rc6 = a6 || a3; // enum || number is number ->rc6 : Symbol(rc6, Decl(logicalOrOperatorWithEveryType.ts, 43, 3)) ->a6 : Symbol(a6, Decl(logicalOrOperatorWithEveryType.ts, 12, 3)) ->a3 : Symbol(a3, Decl(logicalOrOperatorWithEveryType.ts, 9, 3)) - -var rc7 = a7 || a3; // object || number is object | number ->rc7 : Symbol(rc7, Decl(logicalOrOperatorWithEveryType.ts, 44, 3)) ->a7 : Symbol(a7, Decl(logicalOrOperatorWithEveryType.ts, 13, 3)) ->a3 : Symbol(a3, Decl(logicalOrOperatorWithEveryType.ts, 9, 3)) - -var rc8 = a8 || a3; // array || number is array | number ->rc8 : Symbol(rc8, Decl(logicalOrOperatorWithEveryType.ts, 45, 3)) ->a8 : Symbol(a8, Decl(logicalOrOperatorWithEveryType.ts, 14, 3)) ->a3 : Symbol(a3, Decl(logicalOrOperatorWithEveryType.ts, 9, 3)) - -var rc9 = null || a3; // null || number is number ->rc9 : Symbol(rc9, Decl(logicalOrOperatorWithEveryType.ts, 46, 3)) ->a3 : Symbol(a3, Decl(logicalOrOperatorWithEveryType.ts, 9, 3)) - -var rc10 = undefined || a3; // undefined || number is number ->rc10 : Symbol(rc10, Decl(logicalOrOperatorWithEveryType.ts, 47, 3)) ->undefined : Symbol(undefined) ->a3 : Symbol(a3, Decl(logicalOrOperatorWithEveryType.ts, 9, 3)) - -var rd1 = a1 || a4; // any || string is any ->rd1 : Symbol(rd1, Decl(logicalOrOperatorWithEveryType.ts, 49, 3)) ->a1 : Symbol(a1, Decl(logicalOrOperatorWithEveryType.ts, 7, 3)) ->a4 : Symbol(a4, Decl(logicalOrOperatorWithEveryType.ts, 10, 3)) - -var rd2 = a2 || a4; // boolean || string is boolean | string ->rd2 : Symbol(rd2, Decl(logicalOrOperatorWithEveryType.ts, 50, 3)) ->a2 : Symbol(a2, Decl(logicalOrOperatorWithEveryType.ts, 8, 3)) ->a4 : Symbol(a4, Decl(logicalOrOperatorWithEveryType.ts, 10, 3)) - -var rd3 = a3 || a4; // number || string is number | string ->rd3 : Symbol(rd3, Decl(logicalOrOperatorWithEveryType.ts, 51, 3)) ->a3 : Symbol(a3, Decl(logicalOrOperatorWithEveryType.ts, 9, 3)) ->a4 : Symbol(a4, Decl(logicalOrOperatorWithEveryType.ts, 10, 3)) - -var rd4 = a4 || a4; // string || string is string ->rd4 : Symbol(rd4, Decl(logicalOrOperatorWithEveryType.ts, 52, 3)) ->a4 : Symbol(a4, Decl(logicalOrOperatorWithEveryType.ts, 10, 3)) ->a4 : Symbol(a4, Decl(logicalOrOperatorWithEveryType.ts, 10, 3)) - -var rd5 = a5 || a4; // void || string is void | string ->rd5 : Symbol(rd5, Decl(logicalOrOperatorWithEveryType.ts, 53, 3)) ->a5 : Symbol(a5, Decl(logicalOrOperatorWithEveryType.ts, 11, 3)) ->a4 : Symbol(a4, Decl(logicalOrOperatorWithEveryType.ts, 10, 3)) - -var rd6 = a6 || a4; // enum || string is enum | string ->rd6 : Symbol(rd6, Decl(logicalOrOperatorWithEveryType.ts, 54, 3)) ->a6 : Symbol(a6, Decl(logicalOrOperatorWithEveryType.ts, 12, 3)) ->a4 : Symbol(a4, Decl(logicalOrOperatorWithEveryType.ts, 10, 3)) - -var rd7 = a7 || a4; // object || string is object | string ->rd7 : Symbol(rd7, Decl(logicalOrOperatorWithEveryType.ts, 55, 3)) ->a7 : Symbol(a7, Decl(logicalOrOperatorWithEveryType.ts, 13, 3)) ->a4 : Symbol(a4, Decl(logicalOrOperatorWithEveryType.ts, 10, 3)) - -var rd8 = a8 || a4; // array || string is array | string ->rd8 : Symbol(rd8, Decl(logicalOrOperatorWithEveryType.ts, 56, 3)) ->a8 : Symbol(a8, Decl(logicalOrOperatorWithEveryType.ts, 14, 3)) ->a4 : Symbol(a4, Decl(logicalOrOperatorWithEveryType.ts, 10, 3)) - -var rd9 = null || a4; // null || string is string ->rd9 : Symbol(rd9, Decl(logicalOrOperatorWithEveryType.ts, 57, 3)) ->a4 : Symbol(a4, Decl(logicalOrOperatorWithEveryType.ts, 10, 3)) - -var rd10 = undefined || a4; // undefined || string is string ->rd10 : Symbol(rd10, Decl(logicalOrOperatorWithEveryType.ts, 58, 3)) ->undefined : Symbol(undefined) ->a4 : Symbol(a4, Decl(logicalOrOperatorWithEveryType.ts, 10, 3)) - -var re1 = a1 || a5; // any || void is any ->re1 : Symbol(re1, Decl(logicalOrOperatorWithEveryType.ts, 60, 3)) ->a1 : Symbol(a1, Decl(logicalOrOperatorWithEveryType.ts, 7, 3)) ->a5 : Symbol(a5, Decl(logicalOrOperatorWithEveryType.ts, 11, 3)) - -var re2 = a2 || a5; // boolean || void is boolean | void ->re2 : Symbol(re2, Decl(logicalOrOperatorWithEveryType.ts, 61, 3)) ->a2 : Symbol(a2, Decl(logicalOrOperatorWithEveryType.ts, 8, 3)) ->a5 : Symbol(a5, Decl(logicalOrOperatorWithEveryType.ts, 11, 3)) - -var re3 = a3 || a5; // number || void is number | void ->re3 : Symbol(re3, Decl(logicalOrOperatorWithEveryType.ts, 62, 3)) ->a3 : Symbol(a3, Decl(logicalOrOperatorWithEveryType.ts, 9, 3)) ->a5 : Symbol(a5, Decl(logicalOrOperatorWithEveryType.ts, 11, 3)) - -var re4 = a4 || a5; // string || void is string | void ->re4 : Symbol(re4, Decl(logicalOrOperatorWithEveryType.ts, 63, 3)) ->a4 : Symbol(a4, Decl(logicalOrOperatorWithEveryType.ts, 10, 3)) ->a5 : Symbol(a5, Decl(logicalOrOperatorWithEveryType.ts, 11, 3)) - -var re5 = a5 || a5; // void || void is void ->re5 : Symbol(re5, Decl(logicalOrOperatorWithEveryType.ts, 64, 3)) ->a5 : Symbol(a5, Decl(logicalOrOperatorWithEveryType.ts, 11, 3)) ->a5 : Symbol(a5, Decl(logicalOrOperatorWithEveryType.ts, 11, 3)) - -var re6 = a6 || a5; // enum || void is enum | void ->re6 : Symbol(re6, Decl(logicalOrOperatorWithEveryType.ts, 65, 3)) ->a6 : Symbol(a6, Decl(logicalOrOperatorWithEveryType.ts, 12, 3)) ->a5 : Symbol(a5, Decl(logicalOrOperatorWithEveryType.ts, 11, 3)) - -var re7 = a7 || a5; // object || void is object | void ->re7 : Symbol(re7, Decl(logicalOrOperatorWithEveryType.ts, 66, 3)) ->a7 : Symbol(a7, Decl(logicalOrOperatorWithEveryType.ts, 13, 3)) ->a5 : Symbol(a5, Decl(logicalOrOperatorWithEveryType.ts, 11, 3)) - -var re8 = a8 || a5; // array || void is array | void ->re8 : Symbol(re8, Decl(logicalOrOperatorWithEveryType.ts, 67, 3)) ->a8 : Symbol(a8, Decl(logicalOrOperatorWithEveryType.ts, 14, 3)) ->a5 : Symbol(a5, Decl(logicalOrOperatorWithEveryType.ts, 11, 3)) - -var re9 = null || a5; // null || void is void ->re9 : Symbol(re9, Decl(logicalOrOperatorWithEveryType.ts, 68, 3)) ->a5 : Symbol(a5, Decl(logicalOrOperatorWithEveryType.ts, 11, 3)) - -var re10 = undefined || a5; // undefined || void is void ->re10 : Symbol(re10, Decl(logicalOrOperatorWithEveryType.ts, 69, 3)) ->undefined : Symbol(undefined) ->a5 : Symbol(a5, Decl(logicalOrOperatorWithEveryType.ts, 11, 3)) - -var rg1 = a1 || a6; // any || enum is any ->rg1 : Symbol(rg1, Decl(logicalOrOperatorWithEveryType.ts, 71, 3)) ->a1 : Symbol(a1, Decl(logicalOrOperatorWithEveryType.ts, 7, 3)) ->a6 : Symbol(a6, Decl(logicalOrOperatorWithEveryType.ts, 12, 3)) - -var rg2 = a2 || a6; // boolean || enum is boolean | enum ->rg2 : Symbol(rg2, Decl(logicalOrOperatorWithEveryType.ts, 72, 3)) ->a2 : Symbol(a2, Decl(logicalOrOperatorWithEveryType.ts, 8, 3)) ->a6 : Symbol(a6, Decl(logicalOrOperatorWithEveryType.ts, 12, 3)) - -var rg3 = a3 || a6; // number || enum is number ->rg3 : Symbol(rg3, Decl(logicalOrOperatorWithEveryType.ts, 73, 3)) ->a3 : Symbol(a3, Decl(logicalOrOperatorWithEveryType.ts, 9, 3)) ->a6 : Symbol(a6, Decl(logicalOrOperatorWithEveryType.ts, 12, 3)) - -var rg4 = a4 || a6; // string || enum is string | enum ->rg4 : Symbol(rg4, Decl(logicalOrOperatorWithEveryType.ts, 74, 3)) ->a4 : Symbol(a4, Decl(logicalOrOperatorWithEveryType.ts, 10, 3)) ->a6 : Symbol(a6, Decl(logicalOrOperatorWithEveryType.ts, 12, 3)) - -var rg5 = a5 || a6; // void || enum is void | enum ->rg5 : Symbol(rg5, Decl(logicalOrOperatorWithEveryType.ts, 75, 3)) ->a5 : Symbol(a5, Decl(logicalOrOperatorWithEveryType.ts, 11, 3)) ->a6 : Symbol(a6, Decl(logicalOrOperatorWithEveryType.ts, 12, 3)) - -var rg6 = a6 || a6; // enum || enum is E ->rg6 : Symbol(rg6, Decl(logicalOrOperatorWithEveryType.ts, 76, 3)) ->a6 : Symbol(a6, Decl(logicalOrOperatorWithEveryType.ts, 12, 3)) ->a6 : Symbol(a6, Decl(logicalOrOperatorWithEveryType.ts, 12, 3)) - -var rg7 = a7 || a6; // object || enum is object | enum ->rg7 : Symbol(rg7, Decl(logicalOrOperatorWithEveryType.ts, 77, 3)) ->a7 : Symbol(a7, Decl(logicalOrOperatorWithEveryType.ts, 13, 3)) ->a6 : Symbol(a6, Decl(logicalOrOperatorWithEveryType.ts, 12, 3)) - -var rg8 = a8 || a6; // array || enum is array | enum ->rg8 : Symbol(rg8, Decl(logicalOrOperatorWithEveryType.ts, 78, 3)) ->a8 : Symbol(a8, Decl(logicalOrOperatorWithEveryType.ts, 14, 3)) ->a6 : Symbol(a6, Decl(logicalOrOperatorWithEveryType.ts, 12, 3)) - -var rg9 = null || a6; // null || enum is E ->rg9 : Symbol(rg9, Decl(logicalOrOperatorWithEveryType.ts, 79, 3)) ->a6 : Symbol(a6, Decl(logicalOrOperatorWithEveryType.ts, 12, 3)) - -var rg10 = undefined || a6; // undefined || enum is E ->rg10 : Symbol(rg10, Decl(logicalOrOperatorWithEveryType.ts, 80, 3)) ->undefined : Symbol(undefined) ->a6 : Symbol(a6, Decl(logicalOrOperatorWithEveryType.ts, 12, 3)) - -var rh1 = a1 || a7; // any || object is any ->rh1 : Symbol(rh1, Decl(logicalOrOperatorWithEveryType.ts, 82, 3)) ->a1 : Symbol(a1, Decl(logicalOrOperatorWithEveryType.ts, 7, 3)) ->a7 : Symbol(a7, Decl(logicalOrOperatorWithEveryType.ts, 13, 3)) - -var rh2 = a2 || a7; // boolean || object is boolean | object ->rh2 : Symbol(rh2, Decl(logicalOrOperatorWithEveryType.ts, 83, 3)) ->a2 : Symbol(a2, Decl(logicalOrOperatorWithEveryType.ts, 8, 3)) ->a7 : Symbol(a7, Decl(logicalOrOperatorWithEveryType.ts, 13, 3)) - -var rh3 = a3 || a7; // number || object is number | object ->rh3 : Symbol(rh3, Decl(logicalOrOperatorWithEveryType.ts, 84, 3)) ->a3 : Symbol(a3, Decl(logicalOrOperatorWithEveryType.ts, 9, 3)) ->a7 : Symbol(a7, Decl(logicalOrOperatorWithEveryType.ts, 13, 3)) - -var rh4 = a4 || a7; // string || object is string | object ->rh4 : Symbol(rh4, Decl(logicalOrOperatorWithEveryType.ts, 85, 3)) ->a4 : Symbol(a4, Decl(logicalOrOperatorWithEveryType.ts, 10, 3)) ->a7 : Symbol(a7, Decl(logicalOrOperatorWithEveryType.ts, 13, 3)) - -var rh5 = a5 || a7; // void || object is void | object ->rh5 : Symbol(rh5, Decl(logicalOrOperatorWithEveryType.ts, 86, 3)) ->a5 : Symbol(a5, Decl(logicalOrOperatorWithEveryType.ts, 11, 3)) ->a7 : Symbol(a7, Decl(logicalOrOperatorWithEveryType.ts, 13, 3)) - -var rh6 = a6 || a7; // enum || object is enum | object ->rh6 : Symbol(rh6, Decl(logicalOrOperatorWithEveryType.ts, 87, 3)) ->a6 : Symbol(a6, Decl(logicalOrOperatorWithEveryType.ts, 12, 3)) ->a7 : Symbol(a7, Decl(logicalOrOperatorWithEveryType.ts, 13, 3)) - -var rh7 = a7 || a7; // object || object is object ->rh7 : Symbol(rh7, Decl(logicalOrOperatorWithEveryType.ts, 88, 3)) ->a7 : Symbol(a7, Decl(logicalOrOperatorWithEveryType.ts, 13, 3)) ->a7 : Symbol(a7, Decl(logicalOrOperatorWithEveryType.ts, 13, 3)) - -var rh8 = a8 || a7; // array || object is array | object ->rh8 : Symbol(rh8, Decl(logicalOrOperatorWithEveryType.ts, 89, 3)) ->a8 : Symbol(a8, Decl(logicalOrOperatorWithEveryType.ts, 14, 3)) ->a7 : Symbol(a7, Decl(logicalOrOperatorWithEveryType.ts, 13, 3)) - -var rh9 = null || a7; // null || object is object ->rh9 : Symbol(rh9, Decl(logicalOrOperatorWithEveryType.ts, 90, 3)) ->a7 : Symbol(a7, Decl(logicalOrOperatorWithEveryType.ts, 13, 3)) - -var rh10 = undefined || a7; // undefined || object is object ->rh10 : Symbol(rh10, Decl(logicalOrOperatorWithEveryType.ts, 91, 3)) ->undefined : Symbol(undefined) ->a7 : Symbol(a7, Decl(logicalOrOperatorWithEveryType.ts, 13, 3)) - -var ri1 = a1 || a8; // any || array is any ->ri1 : Symbol(ri1, Decl(logicalOrOperatorWithEveryType.ts, 93, 3)) ->a1 : Symbol(a1, Decl(logicalOrOperatorWithEveryType.ts, 7, 3)) ->a8 : Symbol(a8, Decl(logicalOrOperatorWithEveryType.ts, 14, 3)) - -var ri2 = a2 || a8; // boolean || array is boolean | array ->ri2 : Symbol(ri2, Decl(logicalOrOperatorWithEveryType.ts, 94, 3)) ->a2 : Symbol(a2, Decl(logicalOrOperatorWithEveryType.ts, 8, 3)) ->a8 : Symbol(a8, Decl(logicalOrOperatorWithEveryType.ts, 14, 3)) - -var ri3 = a3 || a8; // number || array is number | array ->ri3 : Symbol(ri3, Decl(logicalOrOperatorWithEveryType.ts, 95, 3)) ->a3 : Symbol(a3, Decl(logicalOrOperatorWithEveryType.ts, 9, 3)) ->a8 : Symbol(a8, Decl(logicalOrOperatorWithEveryType.ts, 14, 3)) - -var ri4 = a4 || a8; // string || array is string | array ->ri4 : Symbol(ri4, Decl(logicalOrOperatorWithEveryType.ts, 96, 3)) ->a4 : Symbol(a4, Decl(logicalOrOperatorWithEveryType.ts, 10, 3)) ->a8 : Symbol(a8, Decl(logicalOrOperatorWithEveryType.ts, 14, 3)) - -var ri5 = a5 || a8; // void || array is void | array ->ri5 : Symbol(ri5, Decl(logicalOrOperatorWithEveryType.ts, 97, 3)) ->a5 : Symbol(a5, Decl(logicalOrOperatorWithEveryType.ts, 11, 3)) ->a8 : Symbol(a8, Decl(logicalOrOperatorWithEveryType.ts, 14, 3)) - -var ri6 = a6 || a8; // enum || array is enum | array ->ri6 : Symbol(ri6, Decl(logicalOrOperatorWithEveryType.ts, 98, 3)) ->a6 : Symbol(a6, Decl(logicalOrOperatorWithEveryType.ts, 12, 3)) ->a8 : Symbol(a8, Decl(logicalOrOperatorWithEveryType.ts, 14, 3)) - -var ri7 = a7 || a8; // object || array is object | array ->ri7 : Symbol(ri7, Decl(logicalOrOperatorWithEveryType.ts, 99, 3)) ->a7 : Symbol(a7, Decl(logicalOrOperatorWithEveryType.ts, 13, 3)) ->a8 : Symbol(a8, Decl(logicalOrOperatorWithEveryType.ts, 14, 3)) - -var ri8 = a8 || a8; // array || array is array ->ri8 : Symbol(ri8, Decl(logicalOrOperatorWithEveryType.ts, 100, 3)) ->a8 : Symbol(a8, Decl(logicalOrOperatorWithEveryType.ts, 14, 3)) ->a8 : Symbol(a8, Decl(logicalOrOperatorWithEveryType.ts, 14, 3)) - -var ri9 = null || a8; // null || array is array ->ri9 : Symbol(ri9, Decl(logicalOrOperatorWithEveryType.ts, 101, 3)) ->a8 : Symbol(a8, Decl(logicalOrOperatorWithEveryType.ts, 14, 3)) - -var ri10 = undefined || a8; // undefined || array is array ->ri10 : Symbol(ri10, Decl(logicalOrOperatorWithEveryType.ts, 102, 3)) ->undefined : Symbol(undefined) ->a8 : Symbol(a8, Decl(logicalOrOperatorWithEveryType.ts, 14, 3)) - -var rj1 = a1 || null; // any || null is any ->rj1 : Symbol(rj1, Decl(logicalOrOperatorWithEveryType.ts, 104, 3)) ->a1 : Symbol(a1, Decl(logicalOrOperatorWithEveryType.ts, 7, 3)) - -var rj2 = a2 || null; // boolean || null is boolean ->rj2 : Symbol(rj2, Decl(logicalOrOperatorWithEveryType.ts, 105, 3)) ->a2 : Symbol(a2, Decl(logicalOrOperatorWithEveryType.ts, 8, 3)) - -var rj3 = a3 || null; // number || null is number ->rj3 : Symbol(rj3, Decl(logicalOrOperatorWithEveryType.ts, 106, 3)) ->a3 : Symbol(a3, Decl(logicalOrOperatorWithEveryType.ts, 9, 3)) - -var rj4 = a4 || null; // string || null is string ->rj4 : Symbol(rj4, Decl(logicalOrOperatorWithEveryType.ts, 107, 3)) ->a4 : Symbol(a4, Decl(logicalOrOperatorWithEveryType.ts, 10, 3)) - -var rj5 = a5 || null; // void || null is void ->rj5 : Symbol(rj5, Decl(logicalOrOperatorWithEveryType.ts, 108, 3)) ->a5 : Symbol(a5, Decl(logicalOrOperatorWithEveryType.ts, 11, 3)) - -var rj6 = a6 || null; // enum || null is E ->rj6 : Symbol(rj6, Decl(logicalOrOperatorWithEveryType.ts, 109, 3)) ->a6 : Symbol(a6, Decl(logicalOrOperatorWithEveryType.ts, 12, 3)) - -var rj7 = a7 || null; // object || null is object ->rj7 : Symbol(rj7, Decl(logicalOrOperatorWithEveryType.ts, 110, 3)) ->a7 : Symbol(a7, Decl(logicalOrOperatorWithEveryType.ts, 13, 3)) - -var rj8 = a8 || null; // array || null is array ->rj8 : Symbol(rj8, Decl(logicalOrOperatorWithEveryType.ts, 111, 3)) ->a8 : Symbol(a8, Decl(logicalOrOperatorWithEveryType.ts, 14, 3)) - -var rj9 = null || null; // null || null is any ->rj9 : Symbol(rj9, Decl(logicalOrOperatorWithEveryType.ts, 112, 3)) - -var rj10 = undefined || null; // undefined || null is any ->rj10 : Symbol(rj10, Decl(logicalOrOperatorWithEveryType.ts, 113, 3)) ->undefined : Symbol(undefined) - -var rf1 = a1 || undefined; // any || undefined is any ->rf1 : Symbol(rf1, Decl(logicalOrOperatorWithEveryType.ts, 115, 3)) ->a1 : Symbol(a1, Decl(logicalOrOperatorWithEveryType.ts, 7, 3)) ->undefined : Symbol(undefined) - -var rf2 = a2 || undefined; // boolean || undefined is boolean ->rf2 : Symbol(rf2, Decl(logicalOrOperatorWithEveryType.ts, 116, 3)) ->a2 : Symbol(a2, Decl(logicalOrOperatorWithEveryType.ts, 8, 3)) ->undefined : Symbol(undefined) - -var rf3 = a3 || undefined; // number || undefined is number ->rf3 : Symbol(rf3, Decl(logicalOrOperatorWithEveryType.ts, 117, 3)) ->a3 : Symbol(a3, Decl(logicalOrOperatorWithEveryType.ts, 9, 3)) ->undefined : Symbol(undefined) - -var rf4 = a4 || undefined; // string || undefined is string ->rf4 : Symbol(rf4, Decl(logicalOrOperatorWithEveryType.ts, 118, 3)) ->a4 : Symbol(a4, Decl(logicalOrOperatorWithEveryType.ts, 10, 3)) ->undefined : Symbol(undefined) - -var rf5 = a5 || undefined; // void || undefined is void ->rf5 : Symbol(rf5, Decl(logicalOrOperatorWithEveryType.ts, 119, 3)) ->a5 : Symbol(a5, Decl(logicalOrOperatorWithEveryType.ts, 11, 3)) ->undefined : Symbol(undefined) - -var rf6 = a6 || undefined; // enum || undefined is E ->rf6 : Symbol(rf6, Decl(logicalOrOperatorWithEveryType.ts, 120, 3)) ->a6 : Symbol(a6, Decl(logicalOrOperatorWithEveryType.ts, 12, 3)) ->undefined : Symbol(undefined) - -var rf7 = a7 || undefined; // object || undefined is object ->rf7 : Symbol(rf7, Decl(logicalOrOperatorWithEveryType.ts, 121, 3)) ->a7 : Symbol(a7, Decl(logicalOrOperatorWithEveryType.ts, 13, 3)) ->undefined : Symbol(undefined) - -var rf8 = a8 || undefined; // array || undefined is array ->rf8 : Symbol(rf8, Decl(logicalOrOperatorWithEveryType.ts, 122, 3)) ->a8 : Symbol(a8, Decl(logicalOrOperatorWithEveryType.ts, 14, 3)) ->undefined : Symbol(undefined) - -var rf9 = null || undefined; // null || undefined is any ->rf9 : Symbol(rf9, Decl(logicalOrOperatorWithEveryType.ts, 123, 3)) ->undefined : Symbol(undefined) - -var rf10 = undefined || undefined; // undefined || undefined is any ->rf10 : Symbol(rf10, Decl(logicalOrOperatorWithEveryType.ts, 124, 3)) ->undefined : Symbol(undefined) ->undefined : Symbol(undefined) - diff --git a/tests/baselines/reference/logicalOrOperatorWithEveryType.types b/tests/baselines/reference/logicalOrOperatorWithEveryType.types deleted file mode 100644 index 4540e35aaf459..0000000000000 --- a/tests/baselines/reference/logicalOrOperatorWithEveryType.types +++ /dev/null @@ -1,638 +0,0 @@ -=== tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrOperatorWithEveryType.ts === -// The || operator permits the operands to be of any type. -// If the || expression is not contextually typed, the right operand is contextually typed -// by the type of the left operand and the result is of the best common type of the two -// operand types. - -enum E { a, b, c } ->E : E ->a : E ->b : E ->c : E - -var a1: any; ->a1 : any - -var a2: boolean; ->a2 : boolean - -var a3: number ->a3 : number - -var a4: string; ->a4 : string - -var a5: void; ->a5 : void - -var a6: E; ->a6 : E ->E : E - -var a7: {a: string}; ->a7 : { a: string; } ->a : string - -var a8: string[]; ->a8 : string[] - -var ra1 = a1 || a1; // any || any is any ->ra1 : any ->a1 || a1 : any ->a1 : any ->a1 : any - -var ra2 = a2 || a1; // boolean || any is any ->ra2 : any ->a2 || a1 : any ->a2 : boolean ->a1 : any - -var ra3 = a3 || a1; // number || any is any ->ra3 : any ->a3 || a1 : any ->a3 : number ->a1 : any - -var ra4 = a4 || a1; // string || any is any ->ra4 : any ->a4 || a1 : any ->a4 : string ->a1 : any - -var ra5 = a5 || a1; // void || any is any ->ra5 : any ->a5 || a1 : any ->a5 : void ->a1 : any - -var ra6 = a6 || a1; // enum || any is any ->ra6 : any ->a6 || a1 : any ->a6 : E ->a1 : any - -var ra7 = a7 || a1; // object || any is any ->ra7 : any ->a7 || a1 : any ->a7 : { a: string; } ->a1 : any - -var ra8 = a8 || a1; // array || any is any ->ra8 : any ->a8 || a1 : any ->a8 : string[] ->a1 : any - -var ra9 = null || a1; // null || any is any ->ra9 : any ->null || a1 : any ->null : null ->a1 : any - -var ra10 = undefined || a1; // undefined || any is any ->ra10 : any ->undefined || a1 : any ->undefined : undefined ->a1 : any - -var rb1 = a1 || a2; // any || boolean is any ->rb1 : any ->a1 || a2 : any ->a1 : any ->a2 : boolean - -var rb2 = a2 || a2; // boolean || boolean is boolean ->rb2 : boolean ->a2 || a2 : boolean ->a2 : boolean ->a2 : boolean - -var rb3 = a3 || a2; // number || boolean is number | boolean ->rb3 : number | boolean ->a3 || a2 : number | boolean ->a3 : number ->a2 : boolean - -var rb4 = a4 || a2; // string || boolean is string | boolean ->rb4 : string | boolean ->a4 || a2 : string | boolean ->a4 : string ->a2 : boolean - -var rb5 = a5 || a2; // void || boolean is void | boolean ->rb5 : void | boolean ->a5 || a2 : void | boolean ->a5 : void ->a2 : boolean - -var rb6 = a6 || a2; // enum || boolean is E | boolean ->rb6 : E | boolean ->a6 || a2 : E | boolean ->a6 : E ->a2 : boolean - -var rb7 = a7 || a2; // object || boolean is object | boolean ->rb7 : { a: string; } | boolean ->a7 || a2 : { a: string; } | boolean ->a7 : { a: string; } ->a2 : boolean - -var rb8 = a8 || a2; // array || boolean is array | boolean ->rb8 : string[] | boolean ->a8 || a2 : string[] | boolean ->a8 : string[] ->a2 : boolean - -var rb9 = null || a2; // null || boolean is boolean ->rb9 : boolean ->null || a2 : boolean ->null : null ->a2 : boolean - -var rb10= undefined || a2; // undefined || boolean is boolean ->rb10 : boolean ->undefined || a2 : boolean ->undefined : undefined ->a2 : boolean - -var rc1 = a1 || a3; // any || number is any ->rc1 : any ->a1 || a3 : any ->a1 : any ->a3 : number - -var rc2 = a2 || a3; // boolean || number is boolean | number ->rc2 : boolean | number ->a2 || a3 : boolean | number ->a2 : boolean ->a3 : number - -var rc3 = a3 || a3; // number || number is number ->rc3 : number ->a3 || a3 : number ->a3 : number ->a3 : number - -var rc4 = a4 || a3; // string || number is string | number ->rc4 : string | number ->a4 || a3 : string | number ->a4 : string ->a3 : number - -var rc5 = a5 || a3; // void || number is void | number ->rc5 : void | number ->a5 || a3 : void | number ->a5 : void ->a3 : number - -var rc6 = a6 || a3; // enum || number is number ->rc6 : number ->a6 || a3 : number ->a6 : E ->a3 : number - -var rc7 = a7 || a3; // object || number is object | number ->rc7 : { a: string; } | number ->a7 || a3 : { a: string; } | number ->a7 : { a: string; } ->a3 : number - -var rc8 = a8 || a3; // array || number is array | number ->rc8 : string[] | number ->a8 || a3 : string[] | number ->a8 : string[] ->a3 : number - -var rc9 = null || a3; // null || number is number ->rc9 : number ->null || a3 : number ->null : null ->a3 : number - -var rc10 = undefined || a3; // undefined || number is number ->rc10 : number ->undefined || a3 : number ->undefined : undefined ->a3 : number - -var rd1 = a1 || a4; // any || string is any ->rd1 : any ->a1 || a4 : any ->a1 : any ->a4 : string - -var rd2 = a2 || a4; // boolean || string is boolean | string ->rd2 : boolean | string ->a2 || a4 : boolean | string ->a2 : boolean ->a4 : string - -var rd3 = a3 || a4; // number || string is number | string ->rd3 : number | string ->a3 || a4 : number | string ->a3 : number ->a4 : string - -var rd4 = a4 || a4; // string || string is string ->rd4 : string ->a4 || a4 : string ->a4 : string ->a4 : string - -var rd5 = a5 || a4; // void || string is void | string ->rd5 : void | string ->a5 || a4 : void | string ->a5 : void ->a4 : string - -var rd6 = a6 || a4; // enum || string is enum | string ->rd6 : E | string ->a6 || a4 : E | string ->a6 : E ->a4 : string - -var rd7 = a7 || a4; // object || string is object | string ->rd7 : { a: string; } | string ->a7 || a4 : { a: string; } | string ->a7 : { a: string; } ->a4 : string - -var rd8 = a8 || a4; // array || string is array | string ->rd8 : string[] | string ->a8 || a4 : string[] | string ->a8 : string[] ->a4 : string - -var rd9 = null || a4; // null || string is string ->rd9 : string ->null || a4 : string ->null : null ->a4 : string - -var rd10 = undefined || a4; // undefined || string is string ->rd10 : string ->undefined || a4 : string ->undefined : undefined ->a4 : string - -var re1 = a1 || a5; // any || void is any ->re1 : any ->a1 || a5 : any ->a1 : any ->a5 : void - -var re2 = a2 || a5; // boolean || void is boolean | void ->re2 : boolean | void ->a2 || a5 : boolean | void ->a2 : boolean ->a5 : void - -var re3 = a3 || a5; // number || void is number | void ->re3 : number | void ->a3 || a5 : number | void ->a3 : number ->a5 : void - -var re4 = a4 || a5; // string || void is string | void ->re4 : string | void ->a4 || a5 : string | void ->a4 : string ->a5 : void - -var re5 = a5 || a5; // void || void is void ->re5 : void ->a5 || a5 : void ->a5 : void ->a5 : void - -var re6 = a6 || a5; // enum || void is enum | void ->re6 : E | void ->a6 || a5 : E | void ->a6 : E ->a5 : void - -var re7 = a7 || a5; // object || void is object | void ->re7 : { a: string; } | void ->a7 || a5 : { a: string; } | void ->a7 : { a: string; } ->a5 : void - -var re8 = a8 || a5; // array || void is array | void ->re8 : string[] | void ->a8 || a5 : string[] | void ->a8 : string[] ->a5 : void - -var re9 = null || a5; // null || void is void ->re9 : void ->null || a5 : void ->null : null ->a5 : void - -var re10 = undefined || a5; // undefined || void is void ->re10 : void ->undefined || a5 : void ->undefined : undefined ->a5 : void - -var rg1 = a1 || a6; // any || enum is any ->rg1 : any ->a1 || a6 : any ->a1 : any ->a6 : E - -var rg2 = a2 || a6; // boolean || enum is boolean | enum ->rg2 : boolean | E ->a2 || a6 : boolean | E ->a2 : boolean ->a6 : E - -var rg3 = a3 || a6; // number || enum is number ->rg3 : number ->a3 || a6 : number ->a3 : number ->a6 : E - -var rg4 = a4 || a6; // string || enum is string | enum ->rg4 : string | E ->a4 || a6 : string | E ->a4 : string ->a6 : E - -var rg5 = a5 || a6; // void || enum is void | enum ->rg5 : void | E ->a5 || a6 : void | E ->a5 : void ->a6 : E - -var rg6 = a6 || a6; // enum || enum is E ->rg6 : E ->a6 || a6 : E ->a6 : E ->a6 : E - -var rg7 = a7 || a6; // object || enum is object | enum ->rg7 : { a: string; } | E ->a7 || a6 : { a: string; } | E ->a7 : { a: string; } ->a6 : E - -var rg8 = a8 || a6; // array || enum is array | enum ->rg8 : string[] | E ->a8 || a6 : string[] | E ->a8 : string[] ->a6 : E - -var rg9 = null || a6; // null || enum is E ->rg9 : E ->null || a6 : E ->null : null ->a6 : E - -var rg10 = undefined || a6; // undefined || enum is E ->rg10 : E ->undefined || a6 : E ->undefined : undefined ->a6 : E - -var rh1 = a1 || a7; // any || object is any ->rh1 : any ->a1 || a7 : any ->a1 : any ->a7 : { a: string; } - -var rh2 = a2 || a7; // boolean || object is boolean | object ->rh2 : boolean | { a: string; } ->a2 || a7 : boolean | { a: string; } ->a2 : boolean ->a7 : { a: string; } - -var rh3 = a3 || a7; // number || object is number | object ->rh3 : number | { a: string; } ->a3 || a7 : number | { a: string; } ->a3 : number ->a7 : { a: string; } - -var rh4 = a4 || a7; // string || object is string | object ->rh4 : string | { a: string; } ->a4 || a7 : string | { a: string; } ->a4 : string ->a7 : { a: string; } - -var rh5 = a5 || a7; // void || object is void | object ->rh5 : void | { a: string; } ->a5 || a7 : void | { a: string; } ->a5 : void ->a7 : { a: string; } - -var rh6 = a6 || a7; // enum || object is enum | object ->rh6 : E | { a: string; } ->a6 || a7 : E | { a: string; } ->a6 : E ->a7 : { a: string; } - -var rh7 = a7 || a7; // object || object is object ->rh7 : { a: string; } ->a7 || a7 : { a: string; } ->a7 : { a: string; } ->a7 : { a: string; } - -var rh8 = a8 || a7; // array || object is array | object ->rh8 : string[] | { a: string; } ->a8 || a7 : string[] | { a: string; } ->a8 : string[] ->a7 : { a: string; } - -var rh9 = null || a7; // null || object is object ->rh9 : { a: string; } ->null || a7 : { a: string; } ->null : null ->a7 : { a: string; } - -var rh10 = undefined || a7; // undefined || object is object ->rh10 : { a: string; } ->undefined || a7 : { a: string; } ->undefined : undefined ->a7 : { a: string; } - -var ri1 = a1 || a8; // any || array is any ->ri1 : any ->a1 || a8 : any ->a1 : any ->a8 : string[] - -var ri2 = a2 || a8; // boolean || array is boolean | array ->ri2 : boolean | string[] ->a2 || a8 : boolean | string[] ->a2 : boolean ->a8 : string[] - -var ri3 = a3 || a8; // number || array is number | array ->ri3 : number | string[] ->a3 || a8 : number | string[] ->a3 : number ->a8 : string[] - -var ri4 = a4 || a8; // string || array is string | array ->ri4 : string | string[] ->a4 || a8 : string | string[] ->a4 : string ->a8 : string[] - -var ri5 = a5 || a8; // void || array is void | array ->ri5 : void | string[] ->a5 || a8 : void | string[] ->a5 : void ->a8 : string[] - -var ri6 = a6 || a8; // enum || array is enum | array ->ri6 : E | string[] ->a6 || a8 : E | string[] ->a6 : E ->a8 : string[] - -var ri7 = a7 || a8; // object || array is object | array ->ri7 : { a: string; } | string[] ->a7 || a8 : { a: string; } | string[] ->a7 : { a: string; } ->a8 : string[] - -var ri8 = a8 || a8; // array || array is array ->ri8 : string[] ->a8 || a8 : string[] ->a8 : string[] ->a8 : string[] - -var ri9 = null || a8; // null || array is array ->ri9 : string[] ->null || a8 : string[] ->null : null ->a8 : string[] - -var ri10 = undefined || a8; // undefined || array is array ->ri10 : string[] ->undefined || a8 : string[] ->undefined : undefined ->a8 : string[] - -var rj1 = a1 || null; // any || null is any ->rj1 : any ->a1 || null : any ->a1 : any ->null : null - -var rj2 = a2 || null; // boolean || null is boolean ->rj2 : boolean ->a2 || null : boolean ->a2 : boolean ->null : null - -var rj3 = a3 || null; // number || null is number ->rj3 : number ->a3 || null : number ->a3 : number ->null : null - -var rj4 = a4 || null; // string || null is string ->rj4 : string ->a4 || null : string ->a4 : string ->null : null - -var rj5 = a5 || null; // void || null is void ->rj5 : void ->a5 || null : void ->a5 : void ->null : null - -var rj6 = a6 || null; // enum || null is E ->rj6 : E ->a6 || null : E ->a6 : E ->null : null - -var rj7 = a7 || null; // object || null is object ->rj7 : { a: string; } ->a7 || null : { a: string; } ->a7 : { a: string; } ->null : null - -var rj8 = a8 || null; // array || null is array ->rj8 : string[] ->a8 || null : string[] ->a8 : string[] ->null : null - -var rj9 = null || null; // null || null is any ->rj9 : any ->null || null : null ->null : null ->null : null - -var rj10 = undefined || null; // undefined || null is any ->rj10 : any ->undefined || null : null ->undefined : undefined ->null : null - -var rf1 = a1 || undefined; // any || undefined is any ->rf1 : any ->a1 || undefined : any ->a1 : any ->undefined : undefined - -var rf2 = a2 || undefined; // boolean || undefined is boolean ->rf2 : boolean ->a2 || undefined : boolean ->a2 : boolean ->undefined : undefined - -var rf3 = a3 || undefined; // number || undefined is number ->rf3 : number ->a3 || undefined : number ->a3 : number ->undefined : undefined - -var rf4 = a4 || undefined; // string || undefined is string ->rf4 : string ->a4 || undefined : string ->a4 : string ->undefined : undefined - -var rf5 = a5 || undefined; // void || undefined is void ->rf5 : void ->a5 || undefined : void ->a5 : void ->undefined : undefined - -var rf6 = a6 || undefined; // enum || undefined is E ->rf6 : E ->a6 || undefined : E ->a6 : E ->undefined : undefined - -var rf7 = a7 || undefined; // object || undefined is object ->rf7 : { a: string; } ->a7 || undefined : { a: string; } ->a7 : { a: string; } ->undefined : undefined - -var rf8 = a8 || undefined; // array || undefined is array ->rf8 : string[] ->a8 || undefined : string[] ->a8 : string[] ->undefined : undefined - -var rf9 = null || undefined; // null || undefined is any ->rf9 : any ->null || undefined : null ->null : null ->undefined : undefined - -var rf10 = undefined || undefined; // undefined || undefined is any ->rf10 : any ->undefined || undefined : undefined ->undefined : undefined ->undefined : undefined - From 72fe3361f2b475e227e787011eb83e399055ed73 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 26 Feb 2016 22:49:32 -0800 Subject: [PATCH 3/5] Error on void tested expressions for logical not and conditional expressions. --- src/compiler/checker.ts | 62 ++++++++++++++++++++-------- src/compiler/diagnosticMessages.json | 6 ++- 2 files changed, 50 insertions(+), 18 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a8c33b7583a7b..93e8afa51b9e7 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -11014,10 +11014,13 @@ namespace ts { case SyntaxKind.MinusToken: case SyntaxKind.TildeToken: if (maybeTypeOfKind(operandType, TypeFlags.ESSymbol)) { - error(node.operand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(node.operator)); + error(node.operand, Diagnostics.The_0_operator_cannot_be_applied_to_type_1, tokenToString(node.operator), typeToString(esSymbolType)); } return numberType; case SyntaxKind.ExclamationToken: + if (operandType === voidType) { + error(node.operand, Diagnostics.The_0_operator_cannot_be_applied_to_type_1, tokenToString(node.operator), typeToString(operandType)); + } return booleanType; case SyntaxKind.PlusPlusToken: case SyntaxKind.MinusMinusToken: @@ -11335,7 +11338,7 @@ namespace ts { } // Symbols are not allowed at all in arithmetic expressions - if (resultType && !checkForDisallowedESSymbolOperand(operator)) { + if (resultType && checkForDisallowedESSymbolOperand(operator)) { return resultType; } } @@ -11353,7 +11356,7 @@ namespace ts { case SyntaxKind.GreaterThanToken: case SyntaxKind.LessThanEqualsToken: case SyntaxKind.GreaterThanEqualsToken: - if (!checkForDisallowedESSymbolOperand(operator)) { + if (checkForDisallowedESSymbolOperand(operator)) { return booleanType; } // Fall through @@ -11374,13 +11377,12 @@ namespace ts { case SyntaxKind.InKeyword: return checkInExpression(left, right, leftType, rightType); case SyntaxKind.AmpersandAmpersandToken: - if (leftType.flags & TypeFlags.Void) { - error(errorNode || operatorToken, Diagnostics.The_left_hand_side_of_a_0_expression_cannot_have_type_1, tokenToString(operator), typeToString(leftType)); + if (checkForDisallowedVoidLeftOperand(operator, left, leftType)) { + return leftType; } return rightType; case SyntaxKind.BarBarToken: - if (leftType.flags & TypeFlags.Void) { - error(errorNode || operatorToken, Diagnostics.The_left_hand_side_of_a_0_expression_cannot_have_type_1, tokenToString(operator), typeToString(leftType)); + if (checkForDisallowedVoidLeftOperand(operator, left, leftType)) { return rightType; } return getUnionType([leftType, rightType]); @@ -11391,17 +11393,34 @@ namespace ts { return rightType; } - // Return true if there was no error, false if there was an error. + /** @returns true if there was an error, false otherwise. */ function checkForDisallowedESSymbolOperand(operator: SyntaxKind): boolean { const offendingSymbolOperand = maybeTypeOfKind(leftType, TypeFlags.ESSymbol) ? left : maybeTypeOfKind(rightType, TypeFlags.ESSymbol) ? right : undefined; if (offendingSymbolOperand) { - error(offendingSymbolOperand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(operator)); - return false; + error(offendingSymbolOperand, Diagnostics.The_0_operator_cannot_be_applied_to_type_1, tokenToString(operator), typeToString(esSymbolType)); + return true; } + return false; + } + + /** @returns true if there was an error, false otherwise. */ + function checkForDisallowedVoidLeftOperand(operatorKind: SyntaxKind, leftOperand: Expression, operandType: Type): boolean { + if (operandType !== voidType) { + return false; + } + switch (operatorKind) { + case SyntaxKind.AmpersandAmpersandToken: + case SyntaxKind.BarBarToken: + Debug.assert(leftOperand === (leftOperand.parent as BinaryExpression).left, "Operand should be left side."); + error(leftOperand, Diagnostics.The_left_hand_side_of_a_0_expression_cannot_have_type_1, tokenToString(operatorKind), typeToString(operandType)); + break; + default: + Debug.fail("Not '&&' or '||'"); + } return true; } @@ -11506,7 +11525,12 @@ namespace ts { } function checkConditionalExpression(node: ConditionalExpression, contextualMapper?: TypeMapper): Type { - checkExpression(node.condition); + const conditionType = checkExpression(node.condition); + + if (conditionType === voidType) { + error(node.condition, Diagnostics.The_tested_expression_of_a_conditional_expression_cannot_have_type_0, typeToString(conditionType)); + } + const type1 = checkExpression(node.whenTrue, contextualMapper); const type2 = checkExpression(node.whenFalse, contextualMapper); return getUnionType([type1, type2]); @@ -13416,7 +13440,7 @@ namespace ts { checkGrammarStatementInAmbientContext(node); const conditionType = checkExpression(node.expression); - checkConditionOfBranchingStatement(node, node.expression, conditionType); + checkConditionOfBranchingStatementOrConditionalExpression(node, node.expression, conditionType); checkSourceElement(node.thenStatement); @@ -13433,7 +13457,7 @@ namespace ts { checkSourceElement(node.statement); const conditionType = checkExpression(node.expression); - checkConditionOfBranchingStatement(node, node.expression, conditionType); + checkConditionOfBranchingStatementOrConditionalExpression(node, node.expression, conditionType); } function checkWhileStatement(node: WhileStatement) { @@ -13441,7 +13465,7 @@ namespace ts { checkGrammarStatementInAmbientContext(node); const conditionType = checkExpression(node.expression); - checkConditionOfBranchingStatement(node, node.expression, conditionType); + checkConditionOfBranchingStatementOrConditionalExpression(node, node.expression, conditionType); checkSourceElement(node.statement); } @@ -13464,13 +13488,17 @@ namespace ts { if (node.condition) { const conditionType = checkExpression(node.condition); - checkConditionOfBranchingStatement(node, node.condition, conditionType); + checkConditionOfBranchingStatementOrConditionalExpression(node, node.condition, conditionType); } if (node.incrementor) checkExpression(node.incrementor); checkSourceElement(node.statement); } - function checkConditionOfBranchingStatement(statement: IfStatement | ForStatement | DoStatement, condition: Expression, conditionType: Type): void { + function checkConditionOfBranchingStatementOrConditionalExpression( + statementOrConditional: IfStatement | ForStatement | DoStatement, + condition: Expression, + conditionType: Type): void { + // Any type apart from 'void' is okay. if (conditionType !== voidType) { return; @@ -13482,7 +13510,7 @@ namespace ts { return; } - error(statement, Diagnostics.The_condition_of_a_0_statement_cannot_have_type_1, tokenToString(statement.kind), voidType); + error(statementOrConditional, Diagnostics.The_condition_of_a_0_statement_cannot_have_type_1, tokenToString(statementOrConditional.kind), voidType); } function checkForOfStatement(node: ForOfStatement): void { diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 85c46820d2614..586275ce682a9 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1467,7 +1467,7 @@ "category": "Error", "code": 2468 }, - "The '{0}' operator cannot be applied to type 'symbol'.": { + "The '{0}' operator cannot be applied to type '{1}'.": { "category": "Error", "code": 2469 }, @@ -2223,6 +2223,10 @@ "category": "Error", "code": 5064 }, + "The tested expression of a conditional expression cannot have type '{0}'.": { + "category": "Error", + "code": 5065 + }, "Concatenate and emit output to single file.": { "category": "Message", From 0c79f9726e67fd683d4feeca7e25d3e1978a32ae Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 26 Feb 2016 22:50:38 -0800 Subject: [PATCH 4/5] Accepted baselines. --- ...alOperatorConditionIsObjectType.errors.txt | 82 ++++ ...ionalOperatorConditionIsObjectType.symbols | 273 -------------- ...itionalOperatorConditionIsObjectType.types | 357 ------------------ ...logicalAndOperatorWithEveryType.errors.txt | 20 +- .../logicalOrOperatorWithEveryType.errors.txt | 20 +- 5 files changed, 102 insertions(+), 650 deletions(-) create mode 100644 tests/baselines/reference/conditionalOperatorConditionIsObjectType.errors.txt delete mode 100644 tests/baselines/reference/conditionalOperatorConditionIsObjectType.symbols delete mode 100644 tests/baselines/reference/conditionalOperatorConditionIsObjectType.types diff --git a/tests/baselines/reference/conditionalOperatorConditionIsObjectType.errors.txt b/tests/baselines/reference/conditionalOperatorConditionIsObjectType.errors.txt new file mode 100644 index 0000000000000..6dd41d014d3b6 --- /dev/null +++ b/tests/baselines/reference/conditionalOperatorConditionIsObjectType.errors.txt @@ -0,0 +1,82 @@ +tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorConditionIsObjectType.ts(36,1): error TS5065: The tested expression of a conditional expression cannot have type 'void'. +tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorConditionIsObjectType.ts(39,1): error TS5065: The tested expression of a conditional expression cannot have type 'void'. +tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorConditionIsObjectType.ts(58,20): error TS5065: The tested expression of a conditional expression cannot have type 'void'. +tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorConditionIsObjectType.ts(61,23): error TS5065: The tested expression of a conditional expression cannot have type 'void'. +tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorConditionIsObjectType.ts(63,32): error TS5065: The tested expression of a conditional expression cannot have type 'void'. + + +==== tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorConditionIsObjectType.ts (5 errors) ==== + //Cond ? Expr1 : Expr2, Cond is of object type, Expr1 and Expr2 have the same type + var condObject: Object; + + var exprAny1: any; + var exprBoolean1: boolean; + var exprNumber1: number; + var exprString1: string; + var exprIsObject1: Object; + + var exprAny2: any; + var exprBoolean2: boolean; + var exprNumber2: number; + var exprString2: string; + var exprIsObject2: Object; + + function foo() { }; + class C { static doIt: () => void }; + + //Cond is an object type variable + condObject ? exprAny1 : exprAny2; + condObject ? exprBoolean1 : exprBoolean2; + condObject ? exprNumber1 : exprNumber2; + condObject ? exprString1 : exprString2; + condObject ? exprIsObject1 : exprIsObject2; + condObject ? exprString1 : exprBoolean1; // union + + //Cond is an object type literal + ((a: string) => a.length) ? exprAny1 : exprAny2; + ((a: string) => a.length) ? exprBoolean1 : exprBoolean2; + ({}) ? exprNumber1 : exprNumber2; + ({ a: 1, b: "s" }) ? exprString1 : exprString2; + ({ a: 1, b: "s" }) ? exprIsObject1 : exprIsObject2; + ({ a: 1, b: "s" }) ? exprString1: exprBoolean1; // union + + //Cond is an object type expression + foo() ? exprAny1 : exprAny2; + ~~~~~ +!!! error TS5065: The tested expression of a conditional expression cannot have type 'void'. + new Date() ? exprBoolean1 : exprBoolean2; + new C() ? exprNumber1 : exprNumber2; + C.doIt() ? exprString1 : exprString2; + ~~~~~~~~ +!!! error TS5065: The tested expression of a conditional expression cannot have type 'void'. + condObject.valueOf() ? exprIsObject1 : exprIsObject2; + new Date() ? exprString1 : exprBoolean1; // union + + //Results shoud be same as Expr1 and Expr2 + var resultIsAny1 = condObject ? exprAny1 : exprAny2; + var resultIsBoolean1 = condObject ? exprBoolean1 : exprBoolean2; + var resultIsNumber1 = condObject ? exprNumber1 : exprNumber2; + var resultIsString1 = condObject ? exprString1 : exprString2; + var resultIsObject1 = condObject ? exprIsObject1 : exprIsObject2; + var resultIsStringOrBoolean1 = condObject ? exprString1 : exprBoolean1; // union + + var resultIsAny2 = ((a: string) => a.length) ? exprAny1 : exprAny2; + var resultIsBoolean2 = ((a: string) => a.length) ? exprBoolean1 : exprBoolean2; + var resultIsNumber2 = ({}) ? exprNumber1 : exprNumber2; + var resultIsString2 = ({ a: 1, b: "s" }) ? exprString1 : exprString2; + var resultIsObject2 = ({ a: 1, b: "s" }) ? exprIsObject1 : exprIsObject2; + var resultIsStringOrBoolean2 = ({ a: 1, b: "s" }) ? exprString1 : exprBoolean1; // union + + var resultIsAny3 = foo() ? exprAny1 : exprAny2; + ~~~~~ +!!! error TS5065: The tested expression of a conditional expression cannot have type 'void'. + var resultIsBoolean3 = new Date() ? exprBoolean1 : exprBoolean2; + var resultIsNumber3 = new C() ? exprNumber1 : exprNumber2; + var resultIsString3 = C.doIt() ? exprString1 : exprString2; + ~~~~~~~~ +!!! error TS5065: The tested expression of a conditional expression cannot have type 'void'. + var resultIsObject3 = condObject.valueOf() ? exprIsObject1 : exprIsObject2; + var resultIsStringOrBoolean3 = C.doIt() ? exprString1 : exprBoolean1; // union + ~~~~~~~~ +!!! error TS5065: The tested expression of a conditional expression cannot have type 'void'. + \ No newline at end of file diff --git a/tests/baselines/reference/conditionalOperatorConditionIsObjectType.symbols b/tests/baselines/reference/conditionalOperatorConditionIsObjectType.symbols deleted file mode 100644 index 0867a7087706e..0000000000000 --- a/tests/baselines/reference/conditionalOperatorConditionIsObjectType.symbols +++ /dev/null @@ -1,273 +0,0 @@ -=== tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorConditionIsObjectType.ts === -//Cond ? Expr1 : Expr2, Cond is of object type, Expr1 and Expr2 have the same type -var condObject: Object; ->condObject : Symbol(condObject, Decl(conditionalOperatorConditionIsObjectType.ts, 1, 3)) ->Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) - -var exprAny1: any; ->exprAny1 : Symbol(exprAny1, Decl(conditionalOperatorConditionIsObjectType.ts, 3, 3)) - -var exprBoolean1: boolean; ->exprBoolean1 : Symbol(exprBoolean1, Decl(conditionalOperatorConditionIsObjectType.ts, 4, 3)) - -var exprNumber1: number; ->exprNumber1 : Symbol(exprNumber1, Decl(conditionalOperatorConditionIsObjectType.ts, 5, 3)) - -var exprString1: string; ->exprString1 : Symbol(exprString1, Decl(conditionalOperatorConditionIsObjectType.ts, 6, 3)) - -var exprIsObject1: Object; ->exprIsObject1 : Symbol(exprIsObject1, Decl(conditionalOperatorConditionIsObjectType.ts, 7, 3)) ->Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) - -var exprAny2: any; ->exprAny2 : Symbol(exprAny2, Decl(conditionalOperatorConditionIsObjectType.ts, 9, 3)) - -var exprBoolean2: boolean; ->exprBoolean2 : Symbol(exprBoolean2, Decl(conditionalOperatorConditionIsObjectType.ts, 10, 3)) - -var exprNumber2: number; ->exprNumber2 : Symbol(exprNumber2, Decl(conditionalOperatorConditionIsObjectType.ts, 11, 3)) - -var exprString2: string; ->exprString2 : Symbol(exprString2, Decl(conditionalOperatorConditionIsObjectType.ts, 12, 3)) - -var exprIsObject2: Object; ->exprIsObject2 : Symbol(exprIsObject2, Decl(conditionalOperatorConditionIsObjectType.ts, 13, 3)) ->Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) - -function foo() { }; ->foo : Symbol(foo, Decl(conditionalOperatorConditionIsObjectType.ts, 13, 26)) - -class C { static doIt: () => void }; ->C : Symbol(C, Decl(conditionalOperatorConditionIsObjectType.ts, 15, 19)) ->doIt : Symbol(C.doIt, Decl(conditionalOperatorConditionIsObjectType.ts, 16, 9)) - -//Cond is an object type variable -condObject ? exprAny1 : exprAny2; ->condObject : Symbol(condObject, Decl(conditionalOperatorConditionIsObjectType.ts, 1, 3)) ->exprAny1 : Symbol(exprAny1, Decl(conditionalOperatorConditionIsObjectType.ts, 3, 3)) ->exprAny2 : Symbol(exprAny2, Decl(conditionalOperatorConditionIsObjectType.ts, 9, 3)) - -condObject ? exprBoolean1 : exprBoolean2; ->condObject : Symbol(condObject, Decl(conditionalOperatorConditionIsObjectType.ts, 1, 3)) ->exprBoolean1 : Symbol(exprBoolean1, Decl(conditionalOperatorConditionIsObjectType.ts, 4, 3)) ->exprBoolean2 : Symbol(exprBoolean2, Decl(conditionalOperatorConditionIsObjectType.ts, 10, 3)) - -condObject ? exprNumber1 : exprNumber2; ->condObject : Symbol(condObject, Decl(conditionalOperatorConditionIsObjectType.ts, 1, 3)) ->exprNumber1 : Symbol(exprNumber1, Decl(conditionalOperatorConditionIsObjectType.ts, 5, 3)) ->exprNumber2 : Symbol(exprNumber2, Decl(conditionalOperatorConditionIsObjectType.ts, 11, 3)) - -condObject ? exprString1 : exprString2; ->condObject : Symbol(condObject, Decl(conditionalOperatorConditionIsObjectType.ts, 1, 3)) ->exprString1 : Symbol(exprString1, Decl(conditionalOperatorConditionIsObjectType.ts, 6, 3)) ->exprString2 : Symbol(exprString2, Decl(conditionalOperatorConditionIsObjectType.ts, 12, 3)) - -condObject ? exprIsObject1 : exprIsObject2; ->condObject : Symbol(condObject, Decl(conditionalOperatorConditionIsObjectType.ts, 1, 3)) ->exprIsObject1 : Symbol(exprIsObject1, Decl(conditionalOperatorConditionIsObjectType.ts, 7, 3)) ->exprIsObject2 : Symbol(exprIsObject2, Decl(conditionalOperatorConditionIsObjectType.ts, 13, 3)) - -condObject ? exprString1 : exprBoolean1; // union ->condObject : Symbol(condObject, Decl(conditionalOperatorConditionIsObjectType.ts, 1, 3)) ->exprString1 : Symbol(exprString1, Decl(conditionalOperatorConditionIsObjectType.ts, 6, 3)) ->exprBoolean1 : Symbol(exprBoolean1, Decl(conditionalOperatorConditionIsObjectType.ts, 4, 3)) - -//Cond is an object type literal -((a: string) => a.length) ? exprAny1 : exprAny2; ->a : Symbol(a, Decl(conditionalOperatorConditionIsObjectType.ts, 27, 2)) ->a.length : Symbol(String.length, Decl(lib.d.ts, --, --)) ->a : Symbol(a, Decl(conditionalOperatorConditionIsObjectType.ts, 27, 2)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) ->exprAny1 : Symbol(exprAny1, Decl(conditionalOperatorConditionIsObjectType.ts, 3, 3)) ->exprAny2 : Symbol(exprAny2, Decl(conditionalOperatorConditionIsObjectType.ts, 9, 3)) - -((a: string) => a.length) ? exprBoolean1 : exprBoolean2; ->a : Symbol(a, Decl(conditionalOperatorConditionIsObjectType.ts, 28, 2)) ->a.length : Symbol(String.length, Decl(lib.d.ts, --, --)) ->a : Symbol(a, Decl(conditionalOperatorConditionIsObjectType.ts, 28, 2)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) ->exprBoolean1 : Symbol(exprBoolean1, Decl(conditionalOperatorConditionIsObjectType.ts, 4, 3)) ->exprBoolean2 : Symbol(exprBoolean2, Decl(conditionalOperatorConditionIsObjectType.ts, 10, 3)) - -({}) ? exprNumber1 : exprNumber2; ->exprNumber1 : Symbol(exprNumber1, Decl(conditionalOperatorConditionIsObjectType.ts, 5, 3)) ->exprNumber2 : Symbol(exprNumber2, Decl(conditionalOperatorConditionIsObjectType.ts, 11, 3)) - -({ a: 1, b: "s" }) ? exprString1 : exprString2; ->a : Symbol(a, Decl(conditionalOperatorConditionIsObjectType.ts, 30, 2)) ->b : Symbol(b, Decl(conditionalOperatorConditionIsObjectType.ts, 30, 8)) ->exprString1 : Symbol(exprString1, Decl(conditionalOperatorConditionIsObjectType.ts, 6, 3)) ->exprString2 : Symbol(exprString2, Decl(conditionalOperatorConditionIsObjectType.ts, 12, 3)) - -({ a: 1, b: "s" }) ? exprIsObject1 : exprIsObject2; ->a : Symbol(a, Decl(conditionalOperatorConditionIsObjectType.ts, 31, 2)) ->b : Symbol(b, Decl(conditionalOperatorConditionIsObjectType.ts, 31, 8)) ->exprIsObject1 : Symbol(exprIsObject1, Decl(conditionalOperatorConditionIsObjectType.ts, 7, 3)) ->exprIsObject2 : Symbol(exprIsObject2, Decl(conditionalOperatorConditionIsObjectType.ts, 13, 3)) - -({ a: 1, b: "s" }) ? exprString1: exprBoolean1; // union ->a : Symbol(a, Decl(conditionalOperatorConditionIsObjectType.ts, 32, 2)) ->b : Symbol(b, Decl(conditionalOperatorConditionIsObjectType.ts, 32, 8)) ->exprString1 : Symbol(exprString1, Decl(conditionalOperatorConditionIsObjectType.ts, 6, 3)) ->exprBoolean1 : Symbol(exprBoolean1, Decl(conditionalOperatorConditionIsObjectType.ts, 4, 3)) - -//Cond is an object type expression -foo() ? exprAny1 : exprAny2; ->foo : Symbol(foo, Decl(conditionalOperatorConditionIsObjectType.ts, 13, 26)) ->exprAny1 : Symbol(exprAny1, Decl(conditionalOperatorConditionIsObjectType.ts, 3, 3)) ->exprAny2 : Symbol(exprAny2, Decl(conditionalOperatorConditionIsObjectType.ts, 9, 3)) - -new Date() ? exprBoolean1 : exprBoolean2; ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->exprBoolean1 : Symbol(exprBoolean1, Decl(conditionalOperatorConditionIsObjectType.ts, 4, 3)) ->exprBoolean2 : Symbol(exprBoolean2, Decl(conditionalOperatorConditionIsObjectType.ts, 10, 3)) - -new C() ? exprNumber1 : exprNumber2; ->C : Symbol(C, Decl(conditionalOperatorConditionIsObjectType.ts, 15, 19)) ->exprNumber1 : Symbol(exprNumber1, Decl(conditionalOperatorConditionIsObjectType.ts, 5, 3)) ->exprNumber2 : Symbol(exprNumber2, Decl(conditionalOperatorConditionIsObjectType.ts, 11, 3)) - -C.doIt() ? exprString1 : exprString2; ->C.doIt : Symbol(C.doIt, Decl(conditionalOperatorConditionIsObjectType.ts, 16, 9)) ->C : Symbol(C, Decl(conditionalOperatorConditionIsObjectType.ts, 15, 19)) ->doIt : Symbol(C.doIt, Decl(conditionalOperatorConditionIsObjectType.ts, 16, 9)) ->exprString1 : Symbol(exprString1, Decl(conditionalOperatorConditionIsObjectType.ts, 6, 3)) ->exprString2 : Symbol(exprString2, Decl(conditionalOperatorConditionIsObjectType.ts, 12, 3)) - -condObject.valueOf() ? exprIsObject1 : exprIsObject2; ->condObject.valueOf : Symbol(Object.valueOf, Decl(lib.d.ts, --, --)) ->condObject : Symbol(condObject, Decl(conditionalOperatorConditionIsObjectType.ts, 1, 3)) ->valueOf : Symbol(Object.valueOf, Decl(lib.d.ts, --, --)) ->exprIsObject1 : Symbol(exprIsObject1, Decl(conditionalOperatorConditionIsObjectType.ts, 7, 3)) ->exprIsObject2 : Symbol(exprIsObject2, Decl(conditionalOperatorConditionIsObjectType.ts, 13, 3)) - -new Date() ? exprString1 : exprBoolean1; // union ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->exprString1 : Symbol(exprString1, Decl(conditionalOperatorConditionIsObjectType.ts, 6, 3)) ->exprBoolean1 : Symbol(exprBoolean1, Decl(conditionalOperatorConditionIsObjectType.ts, 4, 3)) - -//Results shoud be same as Expr1 and Expr2 -var resultIsAny1 = condObject ? exprAny1 : exprAny2; ->resultIsAny1 : Symbol(resultIsAny1, Decl(conditionalOperatorConditionIsObjectType.ts, 43, 3)) ->condObject : Symbol(condObject, Decl(conditionalOperatorConditionIsObjectType.ts, 1, 3)) ->exprAny1 : Symbol(exprAny1, Decl(conditionalOperatorConditionIsObjectType.ts, 3, 3)) ->exprAny2 : Symbol(exprAny2, Decl(conditionalOperatorConditionIsObjectType.ts, 9, 3)) - -var resultIsBoolean1 = condObject ? exprBoolean1 : exprBoolean2; ->resultIsBoolean1 : Symbol(resultIsBoolean1, Decl(conditionalOperatorConditionIsObjectType.ts, 44, 3)) ->condObject : Symbol(condObject, Decl(conditionalOperatorConditionIsObjectType.ts, 1, 3)) ->exprBoolean1 : Symbol(exprBoolean1, Decl(conditionalOperatorConditionIsObjectType.ts, 4, 3)) ->exprBoolean2 : Symbol(exprBoolean2, Decl(conditionalOperatorConditionIsObjectType.ts, 10, 3)) - -var resultIsNumber1 = condObject ? exprNumber1 : exprNumber2; ->resultIsNumber1 : Symbol(resultIsNumber1, Decl(conditionalOperatorConditionIsObjectType.ts, 45, 3)) ->condObject : Symbol(condObject, Decl(conditionalOperatorConditionIsObjectType.ts, 1, 3)) ->exprNumber1 : Symbol(exprNumber1, Decl(conditionalOperatorConditionIsObjectType.ts, 5, 3)) ->exprNumber2 : Symbol(exprNumber2, Decl(conditionalOperatorConditionIsObjectType.ts, 11, 3)) - -var resultIsString1 = condObject ? exprString1 : exprString2; ->resultIsString1 : Symbol(resultIsString1, Decl(conditionalOperatorConditionIsObjectType.ts, 46, 3)) ->condObject : Symbol(condObject, Decl(conditionalOperatorConditionIsObjectType.ts, 1, 3)) ->exprString1 : Symbol(exprString1, Decl(conditionalOperatorConditionIsObjectType.ts, 6, 3)) ->exprString2 : Symbol(exprString2, Decl(conditionalOperatorConditionIsObjectType.ts, 12, 3)) - -var resultIsObject1 = condObject ? exprIsObject1 : exprIsObject2; ->resultIsObject1 : Symbol(resultIsObject1, Decl(conditionalOperatorConditionIsObjectType.ts, 47, 3)) ->condObject : Symbol(condObject, Decl(conditionalOperatorConditionIsObjectType.ts, 1, 3)) ->exprIsObject1 : Symbol(exprIsObject1, Decl(conditionalOperatorConditionIsObjectType.ts, 7, 3)) ->exprIsObject2 : Symbol(exprIsObject2, Decl(conditionalOperatorConditionIsObjectType.ts, 13, 3)) - -var resultIsStringOrBoolean1 = condObject ? exprString1 : exprBoolean1; // union ->resultIsStringOrBoolean1 : Symbol(resultIsStringOrBoolean1, Decl(conditionalOperatorConditionIsObjectType.ts, 48, 3)) ->condObject : Symbol(condObject, Decl(conditionalOperatorConditionIsObjectType.ts, 1, 3)) ->exprString1 : Symbol(exprString1, Decl(conditionalOperatorConditionIsObjectType.ts, 6, 3)) ->exprBoolean1 : Symbol(exprBoolean1, Decl(conditionalOperatorConditionIsObjectType.ts, 4, 3)) - -var resultIsAny2 = ((a: string) => a.length) ? exprAny1 : exprAny2; ->resultIsAny2 : Symbol(resultIsAny2, Decl(conditionalOperatorConditionIsObjectType.ts, 50, 3)) ->a : Symbol(a, Decl(conditionalOperatorConditionIsObjectType.ts, 50, 21)) ->a.length : Symbol(String.length, Decl(lib.d.ts, --, --)) ->a : Symbol(a, Decl(conditionalOperatorConditionIsObjectType.ts, 50, 21)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) ->exprAny1 : Symbol(exprAny1, Decl(conditionalOperatorConditionIsObjectType.ts, 3, 3)) ->exprAny2 : Symbol(exprAny2, Decl(conditionalOperatorConditionIsObjectType.ts, 9, 3)) - -var resultIsBoolean2 = ((a: string) => a.length) ? exprBoolean1 : exprBoolean2; ->resultIsBoolean2 : Symbol(resultIsBoolean2, Decl(conditionalOperatorConditionIsObjectType.ts, 51, 3)) ->a : Symbol(a, Decl(conditionalOperatorConditionIsObjectType.ts, 51, 25)) ->a.length : Symbol(String.length, Decl(lib.d.ts, --, --)) ->a : Symbol(a, Decl(conditionalOperatorConditionIsObjectType.ts, 51, 25)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) ->exprBoolean1 : Symbol(exprBoolean1, Decl(conditionalOperatorConditionIsObjectType.ts, 4, 3)) ->exprBoolean2 : Symbol(exprBoolean2, Decl(conditionalOperatorConditionIsObjectType.ts, 10, 3)) - -var resultIsNumber2 = ({}) ? exprNumber1 : exprNumber2; ->resultIsNumber2 : Symbol(resultIsNumber2, Decl(conditionalOperatorConditionIsObjectType.ts, 52, 3)) ->exprNumber1 : Symbol(exprNumber1, Decl(conditionalOperatorConditionIsObjectType.ts, 5, 3)) ->exprNumber2 : Symbol(exprNumber2, Decl(conditionalOperatorConditionIsObjectType.ts, 11, 3)) - -var resultIsString2 = ({ a: 1, b: "s" }) ? exprString1 : exprString2; ->resultIsString2 : Symbol(resultIsString2, Decl(conditionalOperatorConditionIsObjectType.ts, 53, 3)) ->a : Symbol(a, Decl(conditionalOperatorConditionIsObjectType.ts, 53, 24)) ->b : Symbol(b, Decl(conditionalOperatorConditionIsObjectType.ts, 53, 30)) ->exprString1 : Symbol(exprString1, Decl(conditionalOperatorConditionIsObjectType.ts, 6, 3)) ->exprString2 : Symbol(exprString2, Decl(conditionalOperatorConditionIsObjectType.ts, 12, 3)) - -var resultIsObject2 = ({ a: 1, b: "s" }) ? exprIsObject1 : exprIsObject2; ->resultIsObject2 : Symbol(resultIsObject2, Decl(conditionalOperatorConditionIsObjectType.ts, 54, 3)) ->a : Symbol(a, Decl(conditionalOperatorConditionIsObjectType.ts, 54, 24)) ->b : Symbol(b, Decl(conditionalOperatorConditionIsObjectType.ts, 54, 30)) ->exprIsObject1 : Symbol(exprIsObject1, Decl(conditionalOperatorConditionIsObjectType.ts, 7, 3)) ->exprIsObject2 : Symbol(exprIsObject2, Decl(conditionalOperatorConditionIsObjectType.ts, 13, 3)) - -var resultIsStringOrBoolean2 = ({ a: 1, b: "s" }) ? exprString1 : exprBoolean1; // union ->resultIsStringOrBoolean2 : Symbol(resultIsStringOrBoolean2, Decl(conditionalOperatorConditionIsObjectType.ts, 55, 3)) ->a : Symbol(a, Decl(conditionalOperatorConditionIsObjectType.ts, 55, 33)) ->b : Symbol(b, Decl(conditionalOperatorConditionIsObjectType.ts, 55, 39)) ->exprString1 : Symbol(exprString1, Decl(conditionalOperatorConditionIsObjectType.ts, 6, 3)) ->exprBoolean1 : Symbol(exprBoolean1, Decl(conditionalOperatorConditionIsObjectType.ts, 4, 3)) - -var resultIsAny3 = foo() ? exprAny1 : exprAny2; ->resultIsAny3 : Symbol(resultIsAny3, Decl(conditionalOperatorConditionIsObjectType.ts, 57, 3)) ->foo : Symbol(foo, Decl(conditionalOperatorConditionIsObjectType.ts, 13, 26)) ->exprAny1 : Symbol(exprAny1, Decl(conditionalOperatorConditionIsObjectType.ts, 3, 3)) ->exprAny2 : Symbol(exprAny2, Decl(conditionalOperatorConditionIsObjectType.ts, 9, 3)) - -var resultIsBoolean3 = new Date() ? exprBoolean1 : exprBoolean2; ->resultIsBoolean3 : Symbol(resultIsBoolean3, Decl(conditionalOperatorConditionIsObjectType.ts, 58, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->exprBoolean1 : Symbol(exprBoolean1, Decl(conditionalOperatorConditionIsObjectType.ts, 4, 3)) ->exprBoolean2 : Symbol(exprBoolean2, Decl(conditionalOperatorConditionIsObjectType.ts, 10, 3)) - -var resultIsNumber3 = new C() ? exprNumber1 : exprNumber2; ->resultIsNumber3 : Symbol(resultIsNumber3, Decl(conditionalOperatorConditionIsObjectType.ts, 59, 3)) ->C : Symbol(C, Decl(conditionalOperatorConditionIsObjectType.ts, 15, 19)) ->exprNumber1 : Symbol(exprNumber1, Decl(conditionalOperatorConditionIsObjectType.ts, 5, 3)) ->exprNumber2 : Symbol(exprNumber2, Decl(conditionalOperatorConditionIsObjectType.ts, 11, 3)) - -var resultIsString3 = C.doIt() ? exprString1 : exprString2; ->resultIsString3 : Symbol(resultIsString3, Decl(conditionalOperatorConditionIsObjectType.ts, 60, 3)) ->C.doIt : Symbol(C.doIt, Decl(conditionalOperatorConditionIsObjectType.ts, 16, 9)) ->C : Symbol(C, Decl(conditionalOperatorConditionIsObjectType.ts, 15, 19)) ->doIt : Symbol(C.doIt, Decl(conditionalOperatorConditionIsObjectType.ts, 16, 9)) ->exprString1 : Symbol(exprString1, Decl(conditionalOperatorConditionIsObjectType.ts, 6, 3)) ->exprString2 : Symbol(exprString2, Decl(conditionalOperatorConditionIsObjectType.ts, 12, 3)) - -var resultIsObject3 = condObject.valueOf() ? exprIsObject1 : exprIsObject2; ->resultIsObject3 : Symbol(resultIsObject3, Decl(conditionalOperatorConditionIsObjectType.ts, 61, 3)) ->condObject.valueOf : Symbol(Object.valueOf, Decl(lib.d.ts, --, --)) ->condObject : Symbol(condObject, Decl(conditionalOperatorConditionIsObjectType.ts, 1, 3)) ->valueOf : Symbol(Object.valueOf, Decl(lib.d.ts, --, --)) ->exprIsObject1 : Symbol(exprIsObject1, Decl(conditionalOperatorConditionIsObjectType.ts, 7, 3)) ->exprIsObject2 : Symbol(exprIsObject2, Decl(conditionalOperatorConditionIsObjectType.ts, 13, 3)) - -var resultIsStringOrBoolean3 = C.doIt() ? exprString1 : exprBoolean1; // union ->resultIsStringOrBoolean3 : Symbol(resultIsStringOrBoolean3, Decl(conditionalOperatorConditionIsObjectType.ts, 62, 3)) ->C.doIt : Symbol(C.doIt, Decl(conditionalOperatorConditionIsObjectType.ts, 16, 9)) ->C : Symbol(C, Decl(conditionalOperatorConditionIsObjectType.ts, 15, 19)) ->doIt : Symbol(C.doIt, Decl(conditionalOperatorConditionIsObjectType.ts, 16, 9)) ->exprString1 : Symbol(exprString1, Decl(conditionalOperatorConditionIsObjectType.ts, 6, 3)) ->exprBoolean1 : Symbol(exprBoolean1, Decl(conditionalOperatorConditionIsObjectType.ts, 4, 3)) - diff --git a/tests/baselines/reference/conditionalOperatorConditionIsObjectType.types b/tests/baselines/reference/conditionalOperatorConditionIsObjectType.types deleted file mode 100644 index 14a0f375ead04..0000000000000 --- a/tests/baselines/reference/conditionalOperatorConditionIsObjectType.types +++ /dev/null @@ -1,357 +0,0 @@ -=== tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorConditionIsObjectType.ts === -//Cond ? Expr1 : Expr2, Cond is of object type, Expr1 and Expr2 have the same type -var condObject: Object; ->condObject : Object ->Object : Object - -var exprAny1: any; ->exprAny1 : any - -var exprBoolean1: boolean; ->exprBoolean1 : boolean - -var exprNumber1: number; ->exprNumber1 : number - -var exprString1: string; ->exprString1 : string - -var exprIsObject1: Object; ->exprIsObject1 : Object ->Object : Object - -var exprAny2: any; ->exprAny2 : any - -var exprBoolean2: boolean; ->exprBoolean2 : boolean - -var exprNumber2: number; ->exprNumber2 : number - -var exprString2: string; ->exprString2 : string - -var exprIsObject2: Object; ->exprIsObject2 : Object ->Object : Object - -function foo() { }; ->foo : () => void - -class C { static doIt: () => void }; ->C : C ->doIt : () => void - -//Cond is an object type variable -condObject ? exprAny1 : exprAny2; ->condObject ? exprAny1 : exprAny2 : any ->condObject : Object ->exprAny1 : any ->exprAny2 : any - -condObject ? exprBoolean1 : exprBoolean2; ->condObject ? exprBoolean1 : exprBoolean2 : boolean ->condObject : Object ->exprBoolean1 : boolean ->exprBoolean2 : boolean - -condObject ? exprNumber1 : exprNumber2; ->condObject ? exprNumber1 : exprNumber2 : number ->condObject : Object ->exprNumber1 : number ->exprNumber2 : number - -condObject ? exprString1 : exprString2; ->condObject ? exprString1 : exprString2 : string ->condObject : Object ->exprString1 : string ->exprString2 : string - -condObject ? exprIsObject1 : exprIsObject2; ->condObject ? exprIsObject1 : exprIsObject2 : Object ->condObject : Object ->exprIsObject1 : Object ->exprIsObject2 : Object - -condObject ? exprString1 : exprBoolean1; // union ->condObject ? exprString1 : exprBoolean1 : string | boolean ->condObject : Object ->exprString1 : string ->exprBoolean1 : boolean - -//Cond is an object type literal -((a: string) => a.length) ? exprAny1 : exprAny2; ->((a: string) => a.length) ? exprAny1 : exprAny2 : any ->((a: string) => a.length) : (a: string) => number ->(a: string) => a.length : (a: string) => number ->a : string ->a.length : number ->a : string ->length : number ->exprAny1 : any ->exprAny2 : any - -((a: string) => a.length) ? exprBoolean1 : exprBoolean2; ->((a: string) => a.length) ? exprBoolean1 : exprBoolean2 : boolean ->((a: string) => a.length) : (a: string) => number ->(a: string) => a.length : (a: string) => number ->a : string ->a.length : number ->a : string ->length : number ->exprBoolean1 : boolean ->exprBoolean2 : boolean - -({}) ? exprNumber1 : exprNumber2; ->({}) ? exprNumber1 : exprNumber2 : number ->({}) : {} ->{} : {} ->exprNumber1 : number ->exprNumber2 : number - -({ a: 1, b: "s" }) ? exprString1 : exprString2; ->({ a: 1, b: "s" }) ? exprString1 : exprString2 : string ->({ a: 1, b: "s" }) : { a: number; b: string; } ->{ a: 1, b: "s" } : { a: number; b: string; } ->a : number ->1 : number ->b : string ->"s" : string ->exprString1 : string ->exprString2 : string - -({ a: 1, b: "s" }) ? exprIsObject1 : exprIsObject2; ->({ a: 1, b: "s" }) ? exprIsObject1 : exprIsObject2 : Object ->({ a: 1, b: "s" }) : { a: number; b: string; } ->{ a: 1, b: "s" } : { a: number; b: string; } ->a : number ->1 : number ->b : string ->"s" : string ->exprIsObject1 : Object ->exprIsObject2 : Object - -({ a: 1, b: "s" }) ? exprString1: exprBoolean1; // union ->({ a: 1, b: "s" }) ? exprString1: exprBoolean1 : string | boolean ->({ a: 1, b: "s" }) : { a: number; b: string; } ->{ a: 1, b: "s" } : { a: number; b: string; } ->a : number ->1 : number ->b : string ->"s" : string ->exprString1 : string ->exprBoolean1 : boolean - -//Cond is an object type expression -foo() ? exprAny1 : exprAny2; ->foo() ? exprAny1 : exprAny2 : any ->foo() : void ->foo : () => void ->exprAny1 : any ->exprAny2 : any - -new Date() ? exprBoolean1 : exprBoolean2; ->new Date() ? exprBoolean1 : exprBoolean2 : boolean ->new Date() : Date ->Date : DateConstructor ->exprBoolean1 : boolean ->exprBoolean2 : boolean - -new C() ? exprNumber1 : exprNumber2; ->new C() ? exprNumber1 : exprNumber2 : number ->new C() : C ->C : typeof C ->exprNumber1 : number ->exprNumber2 : number - -C.doIt() ? exprString1 : exprString2; ->C.doIt() ? exprString1 : exprString2 : string ->C.doIt() : void ->C.doIt : () => void ->C : typeof C ->doIt : () => void ->exprString1 : string ->exprString2 : string - -condObject.valueOf() ? exprIsObject1 : exprIsObject2; ->condObject.valueOf() ? exprIsObject1 : exprIsObject2 : Object ->condObject.valueOf() : Object ->condObject.valueOf : () => Object ->condObject : Object ->valueOf : () => Object ->exprIsObject1 : Object ->exprIsObject2 : Object - -new Date() ? exprString1 : exprBoolean1; // union ->new Date() ? exprString1 : exprBoolean1 : string | boolean ->new Date() : Date ->Date : DateConstructor ->exprString1 : string ->exprBoolean1 : boolean - -//Results shoud be same as Expr1 and Expr2 -var resultIsAny1 = condObject ? exprAny1 : exprAny2; ->resultIsAny1 : any ->condObject ? exprAny1 : exprAny2 : any ->condObject : Object ->exprAny1 : any ->exprAny2 : any - -var resultIsBoolean1 = condObject ? exprBoolean1 : exprBoolean2; ->resultIsBoolean1 : boolean ->condObject ? exprBoolean1 : exprBoolean2 : boolean ->condObject : Object ->exprBoolean1 : boolean ->exprBoolean2 : boolean - -var resultIsNumber1 = condObject ? exprNumber1 : exprNumber2; ->resultIsNumber1 : number ->condObject ? exprNumber1 : exprNumber2 : number ->condObject : Object ->exprNumber1 : number ->exprNumber2 : number - -var resultIsString1 = condObject ? exprString1 : exprString2; ->resultIsString1 : string ->condObject ? exprString1 : exprString2 : string ->condObject : Object ->exprString1 : string ->exprString2 : string - -var resultIsObject1 = condObject ? exprIsObject1 : exprIsObject2; ->resultIsObject1 : Object ->condObject ? exprIsObject1 : exprIsObject2 : Object ->condObject : Object ->exprIsObject1 : Object ->exprIsObject2 : Object - -var resultIsStringOrBoolean1 = condObject ? exprString1 : exprBoolean1; // union ->resultIsStringOrBoolean1 : string | boolean ->condObject ? exprString1 : exprBoolean1 : string | boolean ->condObject : Object ->exprString1 : string ->exprBoolean1 : boolean - -var resultIsAny2 = ((a: string) => a.length) ? exprAny1 : exprAny2; ->resultIsAny2 : any ->((a: string) => a.length) ? exprAny1 : exprAny2 : any ->((a: string) => a.length) : (a: string) => number ->(a: string) => a.length : (a: string) => number ->a : string ->a.length : number ->a : string ->length : number ->exprAny1 : any ->exprAny2 : any - -var resultIsBoolean2 = ((a: string) => a.length) ? exprBoolean1 : exprBoolean2; ->resultIsBoolean2 : boolean ->((a: string) => a.length) ? exprBoolean1 : exprBoolean2 : boolean ->((a: string) => a.length) : (a: string) => number ->(a: string) => a.length : (a: string) => number ->a : string ->a.length : number ->a : string ->length : number ->exprBoolean1 : boolean ->exprBoolean2 : boolean - -var resultIsNumber2 = ({}) ? exprNumber1 : exprNumber2; ->resultIsNumber2 : number ->({}) ? exprNumber1 : exprNumber2 : number ->({}) : {} ->{} : {} ->exprNumber1 : number ->exprNumber2 : number - -var resultIsString2 = ({ a: 1, b: "s" }) ? exprString1 : exprString2; ->resultIsString2 : string ->({ a: 1, b: "s" }) ? exprString1 : exprString2 : string ->({ a: 1, b: "s" }) : { a: number; b: string; } ->{ a: 1, b: "s" } : { a: number; b: string; } ->a : number ->1 : number ->b : string ->"s" : string ->exprString1 : string ->exprString2 : string - -var resultIsObject2 = ({ a: 1, b: "s" }) ? exprIsObject1 : exprIsObject2; ->resultIsObject2 : Object ->({ a: 1, b: "s" }) ? exprIsObject1 : exprIsObject2 : Object ->({ a: 1, b: "s" }) : { a: number; b: string; } ->{ a: 1, b: "s" } : { a: number; b: string; } ->a : number ->1 : number ->b : string ->"s" : string ->exprIsObject1 : Object ->exprIsObject2 : Object - -var resultIsStringOrBoolean2 = ({ a: 1, b: "s" }) ? exprString1 : exprBoolean1; // union ->resultIsStringOrBoolean2 : string | boolean ->({ a: 1, b: "s" }) ? exprString1 : exprBoolean1 : string | boolean ->({ a: 1, b: "s" }) : { a: number; b: string; } ->{ a: 1, b: "s" } : { a: number; b: string; } ->a : number ->1 : number ->b : string ->"s" : string ->exprString1 : string ->exprBoolean1 : boolean - -var resultIsAny3 = foo() ? exprAny1 : exprAny2; ->resultIsAny3 : any ->foo() ? exprAny1 : exprAny2 : any ->foo() : void ->foo : () => void ->exprAny1 : any ->exprAny2 : any - -var resultIsBoolean3 = new Date() ? exprBoolean1 : exprBoolean2; ->resultIsBoolean3 : boolean ->new Date() ? exprBoolean1 : exprBoolean2 : boolean ->new Date() : Date ->Date : DateConstructor ->exprBoolean1 : boolean ->exprBoolean2 : boolean - -var resultIsNumber3 = new C() ? exprNumber1 : exprNumber2; ->resultIsNumber3 : number ->new C() ? exprNumber1 : exprNumber2 : number ->new C() : C ->C : typeof C ->exprNumber1 : number ->exprNumber2 : number - -var resultIsString3 = C.doIt() ? exprString1 : exprString2; ->resultIsString3 : string ->C.doIt() ? exprString1 : exprString2 : string ->C.doIt() : void ->C.doIt : () => void ->C : typeof C ->doIt : () => void ->exprString1 : string ->exprString2 : string - -var resultIsObject3 = condObject.valueOf() ? exprIsObject1 : exprIsObject2; ->resultIsObject3 : Object ->condObject.valueOf() ? exprIsObject1 : exprIsObject2 : Object ->condObject.valueOf() : Object ->condObject.valueOf : () => Object ->condObject : Object ->valueOf : () => Object ->exprIsObject1 : Object ->exprIsObject2 : Object - -var resultIsStringOrBoolean3 = C.doIt() ? exprString1 : exprBoolean1; // union ->resultIsStringOrBoolean3 : string | boolean ->C.doIt() ? exprString1 : exprBoolean1 : string | boolean ->C.doIt() : void ->C.doIt : () => void ->C : typeof C ->doIt : () => void ->exprString1 : string ->exprBoolean1 : boolean - diff --git a/tests/baselines/reference/logicalAndOperatorWithEveryType.errors.txt b/tests/baselines/reference/logicalAndOperatorWithEveryType.errors.txt index 1e67fa1ed69e7..fbe71861361eb 100644 --- a/tests/baselines/reference/logicalAndOperatorWithEveryType.errors.txt +++ b/tests/baselines/reference/logicalAndOperatorWithEveryType.errors.txt @@ -30,7 +30,7 @@ tests/cases/conformance/expressions/binaryOperators/logicalAndOperator/logicalAn var ra3 = a3 && a1; var ra4 = a4 && a1; var ra5 = a5 && a1; - ~~~~~~~~ + ~~ !!! error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. var ra6 = a6 && a1; var ra7 = a7 && a1; @@ -43,7 +43,7 @@ tests/cases/conformance/expressions/binaryOperators/logicalAndOperator/logicalAn var rb3 = a3 && a2; var rb4 = a4 && a2; var rb5 = a5 && a2; - ~~~~~~~~ + ~~ !!! error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. var rb6 = a6 && a2; var rb7 = a7 && a2; @@ -56,7 +56,7 @@ tests/cases/conformance/expressions/binaryOperators/logicalAndOperator/logicalAn var rc3 = a3 && a3; var rc4 = a4 && a3; var rc5 = a5 && a3; - ~~~~~~~~ + ~~ !!! error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. var rc6 = a6 && a3; var rc7 = a7 && a3; @@ -69,7 +69,7 @@ tests/cases/conformance/expressions/binaryOperators/logicalAndOperator/logicalAn var rd3 = a3 && a4; var rd4 = a4 && a4; var rd5 = a5 && a4; - ~~~~~~~~ + ~~ !!! error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. var rd6 = a6 && a4; var rd7 = a7 && a4; @@ -82,7 +82,7 @@ tests/cases/conformance/expressions/binaryOperators/logicalAndOperator/logicalAn var re3 = a3 && a5; var re4 = a4 && a5; var re5 = a5 && a5; - ~~~~~~~~ + ~~ !!! error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. var re6 = a6 && a5; var re7 = a7 && a5; @@ -95,7 +95,7 @@ tests/cases/conformance/expressions/binaryOperators/logicalAndOperator/logicalAn var rf3 = a3 && a6; var rf4 = a4 && a6; var rf5 = a5 && a6; - ~~~~~~~~ + ~~ !!! error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. var rf6 = a6 && a6; var rf7 = a7 && a6; @@ -108,7 +108,7 @@ tests/cases/conformance/expressions/binaryOperators/logicalAndOperator/logicalAn var rg3 = a3 && a7; var rg4 = a4 && a7; var rg5 = a5 && a7; - ~~~~~~~~ + ~~ !!! error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. var rg6 = a6 && a7; var rg7 = a7 && a7; @@ -121,7 +121,7 @@ tests/cases/conformance/expressions/binaryOperators/logicalAndOperator/logicalAn var rh3 = a3 && a8; var rh4 = a4 && a8; var rh5 = a5 && a8; - ~~~~~~~~ + ~~ !!! error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. var rh6 = a6 && a8; var rh7 = a7 && a8; @@ -134,7 +134,7 @@ tests/cases/conformance/expressions/binaryOperators/logicalAndOperator/logicalAn var ri3 = a3 && null; var ri4 = a4 && null; var ri5 = a5 && null; - ~~~~~~~~~~ + ~~ !!! error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. var ri6 = a6 && null; var ri7 = a7 && null; @@ -147,7 +147,7 @@ tests/cases/conformance/expressions/binaryOperators/logicalAndOperator/logicalAn var rj3 = a3 && undefined; var rj4 = a4 && undefined; var rj5 = a5 && undefined; - ~~~~~~~~~~~~~~~ + ~~ !!! error TS5063: The left-hand side of a '&&' expression cannot have type 'void'. var rj6 = a6 && undefined; var rj7 = a7 && undefined; diff --git a/tests/baselines/reference/logicalOrOperatorWithEveryType.errors.txt b/tests/baselines/reference/logicalOrOperatorWithEveryType.errors.txt index da4f922785fa9..0ae4a1b4bedd2 100644 --- a/tests/baselines/reference/logicalOrOperatorWithEveryType.errors.txt +++ b/tests/baselines/reference/logicalOrOperatorWithEveryType.errors.txt @@ -32,7 +32,7 @@ tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrO var ra3 = a3 || a1; // number || any is any var ra4 = a4 || a1; // string || any is any var ra5 = a5 || a1; // void || any is any - ~~~~~~~~ + ~~ !!! error TS5063: The left-hand side of a '||' expression cannot have type 'void'. var ra6 = a6 || a1; // enum || any is any var ra7 = a7 || a1; // object || any is any @@ -45,7 +45,7 @@ tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrO var rb3 = a3 || a2; // number || boolean is number | boolean var rb4 = a4 || a2; // string || boolean is string | boolean var rb5 = a5 || a2; // void || boolean is void | boolean - ~~~~~~~~ + ~~ !!! error TS5063: The left-hand side of a '||' expression cannot have type 'void'. var rb6 = a6 || a2; // enum || boolean is E | boolean var rb7 = a7 || a2; // object || boolean is object | boolean @@ -58,7 +58,7 @@ tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrO var rc3 = a3 || a3; // number || number is number var rc4 = a4 || a3; // string || number is string | number var rc5 = a5 || a3; // void || number is void | number - ~~~~~~~~ + ~~ !!! error TS5063: The left-hand side of a '||' expression cannot have type 'void'. var rc6 = a6 || a3; // enum || number is number var rc7 = a7 || a3; // object || number is object | number @@ -71,7 +71,7 @@ tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrO var rd3 = a3 || a4; // number || string is number | string var rd4 = a4 || a4; // string || string is string var rd5 = a5 || a4; // void || string is void | string - ~~~~~~~~ + ~~ !!! error TS5063: The left-hand side of a '||' expression cannot have type 'void'. var rd6 = a6 || a4; // enum || string is enum | string var rd7 = a7 || a4; // object || string is object | string @@ -84,7 +84,7 @@ tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrO var re3 = a3 || a5; // number || void is number | void var re4 = a4 || a5; // string || void is string | void var re5 = a5 || a5; // void || void is void - ~~~~~~~~ + ~~ !!! error TS5063: The left-hand side of a '||' expression cannot have type 'void'. var re6 = a6 || a5; // enum || void is enum | void var re7 = a7 || a5; // object || void is object | void @@ -97,7 +97,7 @@ tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrO var rg3 = a3 || a6; // number || enum is number var rg4 = a4 || a6; // string || enum is string | enum var rg5 = a5 || a6; // void || enum is void | enum - ~~~~~~~~ + ~~ !!! error TS5063: The left-hand side of a '||' expression cannot have type 'void'. var rg6 = a6 || a6; // enum || enum is E var rg7 = a7 || a6; // object || enum is object | enum @@ -110,7 +110,7 @@ tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrO var rh3 = a3 || a7; // number || object is number | object var rh4 = a4 || a7; // string || object is string | object var rh5 = a5 || a7; // void || object is void | object - ~~~~~~~~ + ~~ !!! error TS5063: The left-hand side of a '||' expression cannot have type 'void'. var rh6 = a6 || a7; // enum || object is enum | object var rh7 = a7 || a7; // object || object is object @@ -123,7 +123,7 @@ tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrO var ri3 = a3 || a8; // number || array is number | array var ri4 = a4 || a8; // string || array is string | array var ri5 = a5 || a8; // void || array is void | array - ~~~~~~~~ + ~~ !!! error TS5063: The left-hand side of a '||' expression cannot have type 'void'. var ri6 = a6 || a8; // enum || array is enum | array var ri7 = a7 || a8; // object || array is object | array @@ -136,7 +136,7 @@ tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrO var rj3 = a3 || null; // number || null is number var rj4 = a4 || null; // string || null is string var rj5 = a5 || null; // void || null is void - ~~~~~~~~~~ + ~~ !!! error TS5063: The left-hand side of a '||' expression cannot have type 'void'. var rj6 = a6 || null; // enum || null is E var rj7 = a7 || null; // object || null is object @@ -149,7 +149,7 @@ tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrO var rf3 = a3 || undefined; // number || undefined is number var rf4 = a4 || undefined; // string || undefined is string var rf5 = a5 || undefined; // void || undefined is void - ~~~~~~~~~~~~~~~ + ~~ !!! error TS5063: The left-hand side of a '||' expression cannot have type 'void'. var rf6 = a6 || undefined; // enum || undefined is E var rf7 = a7 || undefined; // object || undefined is object From 6cd31f7096ce8dda15338104622ff1b3ad35fb64 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 9 Mar 2016 11:22:05 -0800 Subject: [PATCH 5/5] Minor function rename. --- src/compiler/checker.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 93e8afa51b9e7..9c705b7a3bcc2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -13440,7 +13440,7 @@ namespace ts { checkGrammarStatementInAmbientContext(node); const conditionType = checkExpression(node.expression); - checkConditionOfBranchingStatementOrConditionalExpression(node, node.expression, conditionType); + checkConditionOfBranchingStatement(node, node.expression, conditionType); checkSourceElement(node.thenStatement); @@ -13457,7 +13457,7 @@ namespace ts { checkSourceElement(node.statement); const conditionType = checkExpression(node.expression); - checkConditionOfBranchingStatementOrConditionalExpression(node, node.expression, conditionType); + checkConditionOfBranchingStatement(node, node.expression, conditionType); } function checkWhileStatement(node: WhileStatement) { @@ -13465,7 +13465,7 @@ namespace ts { checkGrammarStatementInAmbientContext(node); const conditionType = checkExpression(node.expression); - checkConditionOfBranchingStatementOrConditionalExpression(node, node.expression, conditionType); + checkConditionOfBranchingStatement(node, node.expression, conditionType); checkSourceElement(node.statement); } @@ -13488,14 +13488,14 @@ namespace ts { if (node.condition) { const conditionType = checkExpression(node.condition); - checkConditionOfBranchingStatementOrConditionalExpression(node, node.condition, conditionType); + checkConditionOfBranchingStatement(node, node.condition, conditionType); } if (node.incrementor) checkExpression(node.incrementor); checkSourceElement(node.statement); } - function checkConditionOfBranchingStatementOrConditionalExpression( - statementOrConditional: IfStatement | ForStatement | DoStatement, + function checkConditionOfBranchingStatement( + statementOrConditional: IfStatement | IterationStatement, condition: Expression, conditionType: Type): void {