From 32f4cbb58a85a73058c84a41eed65bedf646a56a Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 18 Jul 2016 13:16:45 -0700 Subject: [PATCH] Accept new baselines --- .../assignmentNonObjectTypeConstraints.types | 4 +- .../reference/booleanLiteralTypes1.types | 92 +++++++++---------- .../reference/booleanLiteralTypes2.types | 86 ++++++++--------- ...torWithIncompleteTypeAnnotation.errors.txt | 19 +++- .../contextualTypeWithTuple.errors.txt | 4 +- .../controlFlowBinaryOrExpression.types | 2 +- .../reference/controlFlowIfStatement.types | 2 +- .../controlFlowIterationErrors.errors.txt | 8 +- .../reference/controlFlowWhileStatement.types | 4 +- .../genericCallWithTupleType.errors.txt | 4 +- tests/baselines/reference/literalTypes1.types | 4 +- .../logicalAndOperatorStrictMode.types | 2 +- .../logicalAndOperatorWithEveryType.types | 2 +- .../logicalOrOperatorWithEveryType.types | 32 +++---- .../reference/strictNullLogicalAndOr.types | 2 +- ...ngLiteralTypesWithVariousOperators01.types | 4 +- ...itchCaseWithIntersectionTypes01.errors.txt | 2 - .../reference/typeGuardFunction.types | 2 +- .../reference/typeGuardNesting.types | 4 +- ...peGuardsInRightOperandOfOrOrOperator.types | 16 ++-- 20 files changed, 151 insertions(+), 144 deletions(-) diff --git a/tests/baselines/reference/assignmentNonObjectTypeConstraints.types b/tests/baselines/reference/assignmentNonObjectTypeConstraints.types index e2c3176940d..26c0b172443 100644 --- a/tests/baselines/reference/assignmentNonObjectTypeConstraints.types +++ b/tests/baselines/reference/assignmentNonObjectTypeConstraints.types @@ -24,9 +24,9 @@ foo(5); foo(E.A); >foo(E.A) : void >foo : (x: T) => void ->E.A : E.A +>E.A : E >E : typeof E ->A : E.A +>A : E class A { a } >A : A diff --git a/tests/baselines/reference/booleanLiteralTypes1.types b/tests/baselines/reference/booleanLiteralTypes1.types index 5e987b105b5..3ea81df09c3 100644 --- a/tests/baselines/reference/booleanLiteralTypes1.types +++ b/tests/baselines/reference/booleanLiteralTypes1.types @@ -1,11 +1,11 @@ === tests/cases/conformance/types/literal/booleanLiteralTypes1.ts === type A1 = true | false; ->A1 : true | false +>A1 : boolean >true : true >false : false type A2 = false | true; ->A2 : false | true +>A2 : boolean >false : false >true : true @@ -13,67 +13,67 @@ function f1() { >f1 : () => void var a: A1; ->a : true | false ->A1 : true | false +>a : boolean +>A1 : boolean var a: A2; ->a : true | false ->A2 : false | true +>a : boolean +>A2 : boolean var a: true | false; ->a : true | false +>a : boolean >true : true >false : false var a: false | true; ->a : true | false +>a : boolean >false : false >true : true } function f2(a: true | false, b: boolean) { ->f2 : (a: true | false, b: boolean) => void ->a : true | false +>f2 : (a: boolean, b: boolean) => void +>a : boolean >true : true >false : false >b : boolean a = b; >a = b : boolean ->a : true | false +>a : boolean >b : boolean b = a; ->b = a : true | false +>b = a : boolean >b : boolean ->a : true | false +>a : boolean } function f3(a: true | false, b: true | false) { ->f3 : (a: true | false, b: true | false) => void ->a : true | false +>f3 : (a: boolean, b: boolean) => void +>a : boolean >true : true >false : false ->b : true | false +>b : boolean >true : true >false : false var x = a || b; ->x : true | false ->a || b : true | false ->a : true | false ->b : true | false +>x : boolean +>a || b : boolean +>a : boolean +>b : boolean var x = a && b; ->x : true | false ->a && b : true | false ->a : true | false ->b : true | false +>x : boolean +>a && b : boolean +>a : boolean +>b : boolean var x = !a; ->x : true | false ->!a : true | false ->a : true | false +>x : boolean +>!a : boolean +>a : boolean } function f4(t: true, f: false) { @@ -96,8 +96,8 @@ function f4(t: true, f: false) { >t : true var x3 = t || f; ->x3 : true | false ->t || f : true | false +>x3 : boolean +>t || f : boolean >t : true >f : false @@ -166,13 +166,13 @@ function assertNever(x: never): never { } function f10(x: true | false) { ->f10 : (x: true | false) => string ->x : true | false +>f10 : (x: boolean) => string +>x : boolean >true : true >false : false switch (x) { ->x : true | false +>x : boolean case true: return "true"; >true : true @@ -185,13 +185,13 @@ function f10(x: true | false) { } function f11(x: true | false) { ->f11 : (x: true | false) => string ->x : true | false +>f11 : (x: boolean) => string +>x : boolean >true : true >false : false switch (x) { ->x : true | false +>x : boolean case true: return "true"; >true : true @@ -208,32 +208,32 @@ function f11(x: true | false) { } function f12(x: true | false) { ->f12 : (x: true | false) => void ->x : true | false +>f12 : (x: boolean) => void +>x : boolean >true : true >false : false if (x) { ->x : true | false +>x : boolean x; >x : true } else { x; ->x : true | false +>x : boolean } } function f13(x: true | false) { ->f13 : (x: true | false) => void ->x : true | false +>f13 : (x: boolean) => void +>x : boolean >true : true >false : false if (x === true) { >x === true : boolean ->x : true | false +>x : boolean >true : true x; @@ -264,9 +264,9 @@ function f20(x: Item) { >Item : { kind: true; a: string; } | { kind: false; b: string; } switch (x.kind) { ->x.kind : true | false +>x.kind : boolean >x : { kind: true; a: string; } | { kind: false; b: string; } ->kind : true | false +>kind : boolean case true: return x.a; >true : true @@ -288,9 +288,9 @@ function f21(x: Item) { >Item : { kind: true; a: string; } | { kind: false; b: string; } switch (x.kind) { ->x.kind : true | false +>x.kind : boolean >x : { kind: true; a: string; } | { kind: false; b: string; } ->kind : true | false +>kind : boolean case true: return x.a; >true : true diff --git a/tests/baselines/reference/booleanLiteralTypes2.types b/tests/baselines/reference/booleanLiteralTypes2.types index a1d7ee2d36f..7b6d16c35d2 100644 --- a/tests/baselines/reference/booleanLiteralTypes2.types +++ b/tests/baselines/reference/booleanLiteralTypes2.types @@ -1,12 +1,12 @@ === tests/cases/conformance/types/literal/booleanLiteralTypes2.ts === type A1 = true | false; ->A1 : true | false +>A1 : boolean >true : true >false : false type A2 = false | true; ->A2 : false | true +>A2 : boolean >false : false >true : true @@ -14,67 +14,67 @@ function f1() { >f1 : () => void var a: A1; ->a : true | false ->A1 : true | false +>a : boolean +>A1 : boolean var a: A2; ->a : true | false ->A2 : false | true +>a : boolean +>A2 : boolean var a: true | false; ->a : true | false +>a : boolean >true : true >false : false var a: false | true; ->a : true | false +>a : boolean >false : false >true : true } function f2(a: true | false, b: boolean) { ->f2 : (a: true | false, b: boolean) => void ->a : true | false +>f2 : (a: boolean, b: boolean) => void +>a : boolean >true : true >false : false >b : boolean a = b; >a = b : boolean ->a : true | false +>a : boolean >b : boolean b = a; ->b = a : true | false +>b = a : boolean >b : boolean ->a : true | false +>a : boolean } function f3(a: true | false, b: true | false) { ->f3 : (a: true | false, b: true | false) => void ->a : true | false +>f3 : (a: boolean, b: boolean) => void +>a : boolean >true : true >false : false ->b : true | false +>b : boolean >true : true >false : false var x = a || b; ->x : true | false ->a || b : true | false ->a : true | false ->b : true | false +>x : boolean +>a || b : boolean +>a : boolean +>b : boolean var x = a && b; ->x : true | false ->a && b : true | false ->a : true | false ->b : true | false +>x : boolean +>a && b : boolean +>a : boolean +>b : boolean var x = !a; ->x : true | false ->!a : true | false ->a : false | true +>x : boolean +>!a : boolean +>a : boolean } function f4(t: true, f: false) { @@ -167,13 +167,13 @@ function assertNever(x: never): never { } function f10(x: true | false) { ->f10 : (x: true | false) => string ->x : true | false +>f10 : (x: boolean) => string +>x : boolean >true : true >false : false switch (x) { ->x : true | false +>x : boolean case true: return "true"; >true : true @@ -186,13 +186,13 @@ function f10(x: true | false) { } function f11(x: true | false) { ->f11 : (x: true | false) => string ->x : true | false +>f11 : (x: boolean) => string +>x : boolean >true : true >false : false switch (x) { ->x : true | false +>x : boolean case true: return "true"; >true : true @@ -209,13 +209,13 @@ function f11(x: true | false) { } function f12(x: true | false) { ->f12 : (x: true | false) => void ->x : true | false +>f12 : (x: boolean) => void +>x : boolean >true : true >false : false if (x) { ->x : true | false +>x : boolean x; >x : true @@ -227,14 +227,14 @@ function f12(x: true | false) { } function f13(x: true | false) { ->f13 : (x: true | false) => void ->x : true | false +>f13 : (x: boolean) => void +>x : boolean >true : true >false : false if (x === true) { >x === true : boolean ->x : true | false +>x : boolean >true : true x; @@ -265,9 +265,9 @@ function f20(x: Item) { >Item : { kind: true; a: string; } | { kind: false; b: string; } switch (x.kind) { ->x.kind : true | false +>x.kind : boolean >x : { kind: true; a: string; } | { kind: false; b: string; } ->kind : true | false +>kind : boolean case true: return x.a; >true : true @@ -289,9 +289,9 @@ function f21(x: Item) { >Item : { kind: true; a: string; } | { kind: false; b: string; } switch (x.kind) { ->x.kind : true | false +>x.kind : boolean >x : { kind: true; a: string; } | { kind: false; b: string; } ->kind : true | false +>kind : boolean case true: return x.a; >true : true diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt index b9804b1b6db..20f4ac1a335 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt @@ -12,12 +12,12 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(32,18): error TS tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(35,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(35,26): error TS1005: ';' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(35,28): error TS2304: Cannot find name 'bfs'. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(36,21): error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'number'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(36,21): error TS2365: Operator '!=' cannot be applied to types 'boolean' and '0'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(39,17): error TS1109: Expression expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(41,28): error TS2304: Cannot find name 'bfs'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(41,41): error TS1005: ';' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(41,45): error TS1002: Unterminated string literal. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(42,21): error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'number'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(42,21): error TS2365: Operator '!=' cannot be applied to types 'boolean' and '0'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(48,17): error TS2304: Cannot find name 'console'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(50,13): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(54,13): error TS2304: Cannot find name 'console'. @@ -38,6 +38,9 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(160,30): error T tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(160,31): error TS2304: Cannot find name 'Property'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(167,13): error TS2365: Operator '+=' cannot be applied to types 'number' and 'void'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(181,40): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(182,13): error TS2322: Type 'boolean' is not assignable to type 'true | number'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(184,13): error TS2322: Type 'boolean' is not assignable to type 'true | number'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(192,13): error TS2322: Type 'boolean' is not assignable to type 'true | number'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(206,28): error TS1109: Expression expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(214,16): error TS2304: Cannot find name 'bool'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(219,10): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. @@ -83,7 +86,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(260,55): error T tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(262,1): error TS1128: Declaration or statement expected. -==== tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts (83 errors) ==== +==== tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts (86 errors) ==== declare module "fs" { export class File { @@ -152,7 +155,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(262,1): error TS !!! error TS2304: Cannot find name 'bfs'. if (retValue != 0) { ~~~~~~~~~~~~~ -!!! error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'number'. +!!! error TS2365: Operator '!=' cannot be applied to types 'boolean' and '0'. return 1 && } @@ -168,7 +171,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(262,1): error TS !!! error TS1002: Unterminated string literal. if (retValue != 0) { ~~~~~~~~~~~~~ -!!! error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'number'. +!!! error TS2365: Operator '!=' cannot be applied to types 'boolean' and '0'. return 1; } @@ -349,8 +352,12 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(262,1): error TS ~~~~~~~~~~~~ !!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. b = !b;/*!*/ + ~ +!!! error TS2322: Type 'boolean' is not assignable to type 'true | number'. i = ~i;/*~i*/ b = i < (i - 1) && (i + 1) > i;/*< && >*/ + ~ +!!! error TS2322: Type 'boolean' is not assignable to type 'true | number'. var f = true ? 1 : 0;/*? :*/ // YES : i++;/*++*/ i--;/*--*/ @@ -359,6 +366,8 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(262,1): error TS i = i >> 5;/*>>*/ var j = i; b = i == j && i != j && i <= j && i >= j;/*= == && != <= >=*/ + ~ +!!! error TS2322: Type 'boolean' is not assignable to type 'true | number'. i += 5.0;/*+=*/ i -= i;/*-=*/ i *= i;/**=*/ diff --git a/tests/baselines/reference/contextualTypeWithTuple.errors.txt b/tests/baselines/reference/contextualTypeWithTuple.errors.txt index a2d3b224ddc..d0091aa1e22 100644 --- a/tests/baselines/reference/contextualTypeWithTuple.errors.txt +++ b/tests/baselines/reference/contextualTypeWithTuple.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(3,5): error TS232 Types of property 'pop' are incompatible. Type '() => number | string | boolean' is not assignable to type '() => number | string'. Type 'number | string | boolean' is not assignable to type 'number | string'. - Type 'boolean' is not assignable to type 'number | string'. + Type 'true' is not assignable to type 'number | string'. tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(15,1): error TS2322: Type '[number, string, boolean]' is not assignable to type '[number, string]'. tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(18,1): error TS2322: Type '[{}, number]' is not assignable to type '[{ a: string; }, number]'. Types of property '0' are incompatible. @@ -32,7 +32,7 @@ tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(25,1): error TS23 !!! error TS2322: Types of property 'pop' are incompatible. !!! error TS2322: Type '() => number | string | boolean' is not assignable to type '() => number | string'. !!! error TS2322: Type 'number | string | boolean' is not assignable to type 'number | string'. -!!! error TS2322: Type 'boolean' is not assignable to type 'number | string'. +!!! error TS2322: Type 'true' is not assignable to type 'number | string'. var numStrBoolTuple: [number, string, boolean] = [5, "foo", true]; var objNumTuple: [{ a: string }, number] = [{ a: "world" }, 5]; var strTupleTuple: [string, [number, {}]] = ["bar", [5, { x: 1, y: 1 }]]; diff --git a/tests/baselines/reference/controlFlowBinaryOrExpression.types b/tests/baselines/reference/controlFlowBinaryOrExpression.types index 5f9d02b4443..bf2a55e24e7 100644 --- a/tests/baselines/reference/controlFlowBinaryOrExpression.types +++ b/tests/baselines/reference/controlFlowBinaryOrExpression.types @@ -25,7 +25,7 @@ x = ""; >"" : string cond || (x = 0); ->cond || (x = 0) : boolean | number +>cond || (x = 0) : true | number >cond : boolean >(x = 0) : number >x = 0 : number diff --git a/tests/baselines/reference/controlFlowIfStatement.types b/tests/baselines/reference/controlFlowIfStatement.types index dc07e23275f..716491ea58b 100644 --- a/tests/baselines/reference/controlFlowIfStatement.types +++ b/tests/baselines/reference/controlFlowIfStatement.types @@ -20,7 +20,7 @@ if (x /* RegExp */, (x = true)) { >true : boolean x; // boolean ->x : boolean +>x : true x = ""; >x = "" : string diff --git a/tests/baselines/reference/controlFlowIterationErrors.errors.txt b/tests/baselines/reference/controlFlowIterationErrors.errors.txt index 737a9e9557b..1f090ccd35f 100644 --- a/tests/baselines/reference/controlFlowIterationErrors.errors.txt +++ b/tests/baselines/reference/controlFlowIterationErrors.errors.txt @@ -8,10 +8,10 @@ tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(46,17): error Type 'string' is not assignable to type 'number'. tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(77,13): error TS7022: 'y' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(77,26): error TS2345: Argument of type 'string | number | boolean' is not assignable to parameter of type 'string | number'. - Type 'boolean' is not assignable to type 'string | number'. + Type 'true' is not assignable to type 'string | number'. tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(88,13): error TS7022: 'y' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(88,26): error TS2345: Argument of type 'string | number | boolean' is not assignable to parameter of type 'string | number'. - Type 'boolean' is not assignable to type 'string | number'. + Type 'true' is not assignable to type 'string | number'. ==== tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts (8 errors) ==== @@ -108,7 +108,7 @@ tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(88,26): error !!! error TS7022: 'y' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. ~ !!! error TS2345: Argument of type 'string | number | boolean' is not assignable to parameter of type 'string | number'. -!!! error TS2345: Type 'boolean' is not assignable to type 'string | number'. +!!! error TS2345: Type 'true' is not assignable to type 'string | number'. x = y + 1; x; } @@ -124,7 +124,7 @@ tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(88,26): error !!! error TS7022: 'y' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. ~ !!! error TS2345: Argument of type 'string | number | boolean' is not assignable to parameter of type 'string | number'. -!!! error TS2345: Type 'boolean' is not assignable to type 'string | number'. +!!! error TS2345: Type 'true' is not assignable to type 'string | number'. x = y + 1; x; } diff --git a/tests/baselines/reference/controlFlowWhileStatement.types b/tests/baselines/reference/controlFlowWhileStatement.types index 33f5d455f9b..5ab48e02e2b 100644 --- a/tests/baselines/reference/controlFlowWhileStatement.types +++ b/tests/baselines/reference/controlFlowWhileStatement.types @@ -148,7 +148,7 @@ function f() { >cond : boolean if (cond) { ->cond : boolean +>cond : true x = 42; >x = 42 : number @@ -158,7 +158,7 @@ function f() { break; } if (cond) { ->cond : boolean +>cond : true x = true; >x = true : boolean diff --git a/tests/baselines/reference/genericCallWithTupleType.errors.txt b/tests/baselines/reference/genericCallWithTupleType.errors.txt index 24e0505d009..0194dc61311 100644 --- a/tests/baselines/reference/genericCallWithTupleType.errors.txt +++ b/tests/baselines/reference/genericCallWithTupleType.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTup Types of property 'pop' are incompatible. Type '() => string | number | boolean' is not assignable to type '() => string | number'. Type 'string | number | boolean' is not assignable to type 'string | number'. - Type 'boolean' is not assignable to type 'string | number'. + Type 'true' is not assignable to type 'string | number'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(14,1): error TS2322: Type '{ a: string; }' is not assignable to type 'string | number'. Type '{ a: string; }' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(22,1): error TS2322: Type '[number, string]' is not assignable to type '[string, number]'. @@ -33,7 +33,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTup !!! error TS2322: Types of property 'pop' are incompatible. !!! error TS2322: Type '() => string | number | boolean' is not assignable to type '() => string | number'. !!! error TS2322: Type 'string | number | boolean' is not assignable to type 'string | number'. -!!! error TS2322: Type 'boolean' is not assignable to type 'string | number'. +!!! error TS2322: Type 'true' is not assignable to type 'string | number'. var e3 = i1.tuple1[2]; // {} i1.tuple1[3] = { a: "string" }; ~~~~~~~~~~~~ diff --git a/tests/baselines/reference/literalTypes1.types b/tests/baselines/reference/literalTypes1.types index 1428ce601a0..e7a44f8d753 100644 --- a/tests/baselines/reference/literalTypes1.types +++ b/tests/baselines/reference/literalTypes1.types @@ -180,7 +180,7 @@ function f5(x: string | number | boolean) { >true : true x; ->x : boolean +>x : true break; case "hello": @@ -195,6 +195,6 @@ function f5(x: string | number | boolean) { break; default: x; ->x : string | number | boolean +>x : string | number | false } } diff --git a/tests/baselines/reference/logicalAndOperatorStrictMode.types b/tests/baselines/reference/logicalAndOperatorStrictMode.types index 61e3c4c6301..c47c54ad1b7 100644 --- a/tests/baselines/reference/logicalAndOperatorStrictMode.types +++ b/tests/baselines/reference/logicalAndOperatorStrictMode.types @@ -203,7 +203,7 @@ const b4 = b && b; >b4 : boolean >b && b : boolean >b : boolean ->b : boolean +>b : true const b5 = b && v; >b5 : void | false diff --git a/tests/baselines/reference/logicalAndOperatorWithEveryType.types b/tests/baselines/reference/logicalAndOperatorWithEveryType.types index 99675f42f63..25771ede186 100644 --- a/tests/baselines/reference/logicalAndOperatorWithEveryType.types +++ b/tests/baselines/reference/logicalAndOperatorWithEveryType.types @@ -103,7 +103,7 @@ var rb2 = a2 && a2; >rb2 : boolean >a2 && a2 : boolean >a2 : boolean ->a2 : boolean +>a2 : true var rb3 = a3 && a2; >rb3 : boolean diff --git a/tests/baselines/reference/logicalOrOperatorWithEveryType.types b/tests/baselines/reference/logicalOrOperatorWithEveryType.types index 88f24d02dae..4a8f5e6a3e1 100644 --- a/tests/baselines/reference/logicalOrOperatorWithEveryType.types +++ b/tests/baselines/reference/logicalOrOperatorWithEveryType.types @@ -163,8 +163,8 @@ var rc1 = a1 || a3; // any || number is any >a3 : number var rc2 = a2 || a3; // boolean || number is boolean | number ->rc2 : boolean | number ->a2 || a3 : boolean | number +>rc2 : true | number +>a2 || a3 : true | number >a2 : boolean >a3 : number @@ -223,8 +223,8 @@ var rd1 = a1 || a4; // any || string is any >a4 : string var rd2 = a2 || a4; // boolean || string is boolean | string ->rd2 : boolean | string ->a2 || a4 : boolean | string +>rd2 : true | string +>a2 || a4 : true | string >a2 : boolean >a4 : string @@ -283,8 +283,8 @@ var re1 = a1 || a5; // any || void is any >a5 : void var re2 = a2 || a5; // boolean || void is boolean | void ->re2 : boolean | void ->a2 || a5 : boolean | void +>re2 : true | void +>a2 || a5 : true | void >a2 : boolean >a5 : void @@ -343,8 +343,8 @@ var rg1 = a1 || a6; // any || enum is any >a6 : E var rg2 = a2 || a6; // boolean || enum is boolean | enum ->rg2 : boolean | E ->a2 || a6 : boolean | E +>rg2 : true | E +>a2 || a6 : true | E >a2 : boolean >a6 : E @@ -403,8 +403,8 @@ var rh1 = a1 || a7; // any || object is any >a7 : { a: string; } var rh2 = a2 || a7; // boolean || object is boolean | object ->rh2 : boolean | { a: string; } ->a2 || a7 : boolean | { a: string; } +>rh2 : true | { a: string; } +>a2 || a7 : true | { a: string; } >a2 : boolean >a7 : { a: string; } @@ -463,8 +463,8 @@ var ri1 = a1 || a8; // any || array is any >a8 : string[] var ri2 = a2 || a8; // boolean || array is boolean | array ->ri2 : boolean | string[] ->a2 || a8 : boolean | string[] +>ri2 : true | string[] +>a2 || a8 : true | string[] >a2 : boolean >a8 : string[] @@ -523,8 +523,8 @@ var rj1 = a1 || null; // any || null is any >null : null var rj2 = a2 || null; // boolean || null is boolean ->rj2 : boolean ->a2 || null : boolean +>rj2 : true +>a2 || null : true >a2 : boolean >null : null @@ -583,8 +583,8 @@ var rf1 = a1 || undefined; // any || undefined is any >undefined : undefined var rf2 = a2 || undefined; // boolean || undefined is boolean ->rf2 : boolean ->a2 || undefined : boolean +>rf2 : true +>a2 || undefined : true >a2 : boolean >undefined : undefined diff --git a/tests/baselines/reference/strictNullLogicalAndOr.types b/tests/baselines/reference/strictNullLogicalAndOr.types index b82496845b7..ac02ec1378b 100644 --- a/tests/baselines/reference/strictNullLogicalAndOr.types +++ b/tests/baselines/reference/strictNullLogicalAndOr.types @@ -44,7 +44,7 @@ function sq(n?: number): number { >n*n : number >n : number >n : number ->0 : 0 +>0 : number return r; >r : number diff --git a/tests/baselines/reference/stringLiteralTypesWithVariousOperators01.types b/tests/baselines/reference/stringLiteralTypesWithVariousOperators01.types index 46442d75ad4..90cb538b800 100644 --- a/tests/baselines/reference/stringLiteralTypesWithVariousOperators01.types +++ b/tests/baselines/reference/stringLiteralTypesWithVariousOperators01.types @@ -16,9 +16,9 @@ let abcOrXyz: "ABC" | "XYZ" = abc || xyz; let abcOrXyzOrNumber: "ABC" | "XYZ" | number = abcOrXyz || 100; >abcOrXyzOrNumber : "ABC" | "XYZ" | number ->abcOrXyz || 100 : "ABC" | "XYZ" | 100 +>abcOrXyz || 100 : "ABC" | "XYZ" | number >abcOrXyz : "ABC" | "XYZ" ->100 : 100 +>100 : number let a = "" + abc; >a : string diff --git a/tests/baselines/reference/switchCaseWithIntersectionTypes01.errors.txt b/tests/baselines/reference/switchCaseWithIntersectionTypes01.errors.txt index d42f407a784..ad2ca8bc123 100644 --- a/tests/baselines/reference/switchCaseWithIntersectionTypes01.errors.txt +++ b/tests/baselines/reference/switchCaseWithIntersectionTypes01.errors.txt @@ -1,7 +1,6 @@ tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithIntersectionTypes01.ts(19,10): error TS2678: Type 'number & boolean' is not comparable to type 'string & number'. Type 'number & boolean' is not comparable to type 'string'. tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithIntersectionTypes01.ts(23,10): error TS2678: Type 'boolean' is not comparable to type 'string & number'. - Type 'boolean' is not comparable to type 'string'. ==== tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithIntersectionTypes01.ts (2 errors) ==== @@ -33,6 +32,5 @@ tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithInterse case bool: ~~~~ !!! error TS2678: Type 'boolean' is not comparable to type 'string & number'. -!!! error TS2678: Type 'boolean' is not comparable to type 'string'. break; } \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardFunction.types b/tests/baselines/reference/typeGuardFunction.types index 50a5fcaf324..7f60bbc0a3b 100644 --- a/tests/baselines/reference/typeGuardFunction.types +++ b/tests/baselines/reference/typeGuardFunction.types @@ -223,7 +223,7 @@ let union2: C | B; let union3: boolean | B = isA(union2) || union2; >union3 : boolean | B >B : B ->isA(union2) || union2 : boolean | B +>isA(union2) || union2 : true | B >isA(union2) : boolean >isA : (p1: any) => p1 is A >union2 : C | B diff --git a/tests/baselines/reference/typeGuardNesting.types b/tests/baselines/reference/typeGuardNesting.types index cb06d457a30..0532e4d2536 100644 --- a/tests/baselines/reference/typeGuardNesting.types +++ b/tests/baselines/reference/typeGuardNesting.types @@ -14,7 +14,7 @@ if ((typeof strOrBool === 'boolean' && !strOrBool) || typeof strOrBool === 'stri >strOrBool : boolean >typeof strOrBool === 'string' : boolean >typeof strOrBool : string ->strOrBool : string | boolean +>strOrBool : string | true >'string' : "string" let label: string = (typeof strOrBool === 'string') ? strOrBool : "string"; @@ -74,7 +74,7 @@ if ((typeof strOrBool !== 'string' && !strOrBool) || typeof strOrBool !== 'boole >strOrBool : boolean >typeof strOrBool !== 'boolean' : boolean >typeof strOrBool : string ->strOrBool : string | boolean +>strOrBool : string | true >'boolean' : "boolean" let label: string = (typeof strOrBool === 'string') ? strOrBool : "string"; diff --git a/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types b/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types index b251664e9ee..141fab13b3d 100644 --- a/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types +++ b/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types @@ -19,12 +19,12 @@ function foo(x: number | string) { >10 : 10 } function foo2(x: number | string) { ->foo2 : (x: number | string) => boolean | number +>foo2 : (x: number | string) => true | number >x : number | string // modify x in right hand operand return typeof x !== "string" || ((x = 10) || x); // string | number ->typeof x !== "string" || ((x = 10) || x) : boolean | number +>typeof x !== "string" || ((x = 10) || x) : true | number >typeof x !== "string" : boolean >typeof x : string >x : number | string @@ -38,12 +38,12 @@ function foo2(x: number | string) { >x : number } function foo3(x: number | string) { ->foo3 : (x: number | string) => boolean | string +>foo3 : (x: number | string) => true | string >x : number | string // modify x in right hand operand with string type itself return typeof x !== "string" || ((x = "hello") || x); // string | number ->typeof x !== "string" || ((x = "hello") || x) : boolean | string +>typeof x !== "string" || ((x = "hello") || x) : true | string >typeof x !== "string" : boolean >typeof x : string >x : number | string @@ -138,7 +138,7 @@ function foo6(x: number | string | boolean) { >10 : 10 } function foo7(x: number | string | boolean) { ->foo7 : (x: number | string | boolean) => boolean | number | string +>foo7 : (x: number | string | boolean) => true | number | string >x : number | string | boolean var y: number| boolean | string; @@ -149,15 +149,15 @@ function foo7(x: number | string | boolean) { // Mixing typeguard narrowing return typeof x === "string" ->typeof x === "string" || ((z = x) // number | boolean || (typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // number | boolean | string // do not change value : ((y = x) && x.toString()))) : boolean | number | string +>typeof x === "string" || ((z = x) // number | boolean || (typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // number | boolean | string // do not change value : ((y = x) && x.toString()))) : true | number | string >typeof x === "string" : boolean >typeof x : string >x : number | string | boolean >"string" : "string" || ((z = x) // number | boolean ->((z = x) // number | boolean || (typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // number | boolean | string // do not change value : ((y = x) && x.toString()))) : number | boolean | string ->(z = x) // number | boolean || (typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // number | boolean | string // do not change value : ((y = x) && x.toString())) : number | boolean | string +>((z = x) // number | boolean || (typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // number | boolean | string // do not change value : ((y = x) && x.toString()))) : number | true | string +>(z = x) // number | boolean || (typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // number | boolean | string // do not change value : ((y = x) && x.toString())) : number | true | string >(z = x) : number | boolean >z = x : number | boolean >z : number | boolean | string