From 3fe75914ae07e313d370735f8ad7e32e730b007a Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 10 Jul 2015 19:18:17 -0700 Subject: [PATCH] Accepting new baselines --- .../baselines/reference/arrayCast.errors.txt | 4 +- .../arrayLiteralTypeInference.errors.txt | 72 +++++++ .../arrayLiteralTypeInference.symbols | 113 ----------- .../reference/arrayLiteralTypeInference.types | 144 -------------- .../reference/arrayLiterals.errors.txt | 50 +++++ .../baselines/reference/arrayLiterals.symbols | 94 --------- tests/baselines/reference/arrayLiterals.types | 153 --------------- .../reference/assignmentCompatBug2.errors.txt | 15 +- .../reference/assignmentCompatBug5.errors.txt | 4 +- .../reference/contextualTyping17.errors.txt | 9 + .../reference/contextualTyping17.symbols | 9 - .../reference/contextualTyping17.types | 15 -- .../reference/contextualTyping2.errors.txt | 9 + .../reference/contextualTyping2.symbols | 7 - .../reference/contextualTyping2.types | 10 - .../reference/contextualTyping4.errors.txt | 9 + .../reference/contextualTyping4.symbols | 8 - .../reference/contextualTyping4.types | 11 -- ...nBaseCallViaSuperPropertyAccess.errors.txt | 25 +++ ...ddenBaseCallViaSuperPropertyAccess.symbols | 56 ------ ...HiddenBaseCallViaSuperPropertyAccess.types | 69 ------- ...structuringParameterProperties5.errors.txt | 4 +- .../reference/incompatibleTypes.errors.txt | 8 +- ...OrExpressionIsContextuallyTyped.errors.txt | 16 ++ ...calOrExpressionIsContextuallyTyped.symbols | 14 -- ...gicalOrExpressionIsContextuallyTyped.types | 21 -- ...objectLitStructuralTypeMismatch.errors.txt | 4 +- ...eralFunctionArgContextualTyping.errors.txt | 11 +- ...ralFunctionArgContextualTyping2.errors.txt | 8 +- ...rthandPropertiesAssignmentError.errors.txt | 4 +- ...nmentErrorFromMissingIdentifier.errors.txt | 4 +- .../reference/switchStatements.errors.txt | 63 ++++++ .../reference/switchStatements.symbols | 115 ----------- .../reference/switchStatements.types | 184 ------------------ .../reference/symbolProperty21.errors.txt | 24 +++ .../reference/symbolProperty21.symbols | 51 ----- .../reference/symbolProperty21.types | 56 ------ .../reference/tsxAttributeResolution9.symbols | 47 ----- .../reference/tsxAttributeResolution9.types | 49 ----- .../typeArgumentInference.errors.txt | 7 +- ...entInferenceConstructSignatures.errors.txt | 7 +- ...rgumentInferenceWithConstraints.errors.txt | 7 +- .../baselines/reference/typeInfer1.errors.txt | 4 +- .../baselines/reference/typeMatch2.errors.txt | 16 +- 44 files changed, 348 insertions(+), 1262 deletions(-) create mode 100644 tests/baselines/reference/arrayLiteralTypeInference.errors.txt delete mode 100644 tests/baselines/reference/arrayLiteralTypeInference.symbols delete mode 100644 tests/baselines/reference/arrayLiteralTypeInference.types create mode 100644 tests/baselines/reference/arrayLiterals.errors.txt delete mode 100644 tests/baselines/reference/arrayLiterals.symbols delete mode 100644 tests/baselines/reference/arrayLiterals.types create mode 100644 tests/baselines/reference/contextualTyping17.errors.txt delete mode 100644 tests/baselines/reference/contextualTyping17.symbols delete mode 100644 tests/baselines/reference/contextualTyping17.types create mode 100644 tests/baselines/reference/contextualTyping2.errors.txt delete mode 100644 tests/baselines/reference/contextualTyping2.symbols delete mode 100644 tests/baselines/reference/contextualTyping2.types create mode 100644 tests/baselines/reference/contextualTyping4.errors.txt delete mode 100644 tests/baselines/reference/contextualTyping4.symbols delete mode 100644 tests/baselines/reference/contextualTyping4.types create mode 100644 tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.errors.txt delete mode 100644 tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.symbols delete mode 100644 tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.types create mode 100644 tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.errors.txt delete mode 100644 tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.symbols delete mode 100644 tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.types create mode 100644 tests/baselines/reference/switchStatements.errors.txt delete mode 100644 tests/baselines/reference/switchStatements.symbols delete mode 100644 tests/baselines/reference/switchStatements.types create mode 100644 tests/baselines/reference/symbolProperty21.errors.txt delete mode 100644 tests/baselines/reference/symbolProperty21.symbols delete mode 100644 tests/baselines/reference/symbolProperty21.types delete mode 100644 tests/baselines/reference/tsxAttributeResolution9.symbols delete mode 100644 tests/baselines/reference/tsxAttributeResolution9.types diff --git a/tests/baselines/reference/arrayCast.errors.txt b/tests/baselines/reference/arrayCast.errors.txt index 10562cc57e4..3aebf139825 100644 --- a/tests/baselines/reference/arrayCast.errors.txt +++ b/tests/baselines/reference/arrayCast.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/arrayCast.ts(3,1): error TS2352: Neither type '{ foo: string; }[]' nor type '{ id: number; }[]' is assignable to the other. Type '{ foo: string; }' is not assignable to type '{ id: number; }'. - Property 'id' is missing in type '{ foo: string; }'. + Property 'foo' does not exist on type '{ id: number; }'. ==== tests/cases/compiler/arrayCast.ts (1 errors) ==== @@ -10,7 +10,7 @@ tests/cases/compiler/arrayCast.ts(3,1): error TS2352: Neither type '{ foo: strin ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2352: Neither type '{ foo: string; }[]' nor type '{ id: number; }[]' is assignable to the other. !!! error TS2352: Type '{ foo: string; }' is not assignable to type '{ id: number; }'. -!!! error TS2352: Property 'id' is missing in type '{ foo: string; }'. +!!! error TS2352: Property 'foo' does not exist on type '{ id: number; }'. // Should succeed, as the {} element causes the type of the array to be {}[] <{ id: number; }[]>[{ foo: "s" }, {}]; \ No newline at end of file diff --git a/tests/baselines/reference/arrayLiteralTypeInference.errors.txt b/tests/baselines/reference/arrayLiteralTypeInference.errors.txt new file mode 100644 index 00000000000..4d381b77af9 --- /dev/null +++ b/tests/baselines/reference/arrayLiteralTypeInference.errors.txt @@ -0,0 +1,72 @@ +tests/cases/compiler/arrayLiteralTypeInference.ts(13,5): error TS2322: Type '({ id: number; trueness: boolean; } | { id: number; name: string; })[]' is not assignable to type 'Action[]'. + Type '{ id: number; trueness: boolean; } | { id: number; name: string; }' is not assignable to type 'Action'. + Type '{ id: number; trueness: boolean; }' is not assignable to type 'Action'. + Property 'trueness' does not exist on type 'Action'. +tests/cases/compiler/arrayLiteralTypeInference.ts(29,5): error TS2322: Type '({ id: number; trueness: boolean; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'. + Type '{ id: number; trueness: boolean; } | { id: number; name: string; }' is not assignable to type '{ id: number; }'. + Type '{ id: number; trueness: boolean; }' is not assignable to type '{ id: number; }'. + Property 'trueness' does not exist on type '{ id: number; }'. + + +==== tests/cases/compiler/arrayLiteralTypeInference.ts (2 errors) ==== + class Action { + id: number; + } + + class ActionA extends Action { + value: string; + } + + class ActionB extends Action { + trueNess: boolean; + } + + var x1: Action[] = [ + ~~ +!!! error TS2322: Type '({ id: number; trueness: boolean; } | { id: number; name: string; })[]' is not assignable to type 'Action[]'. +!!! error TS2322: Type '{ id: number; trueness: boolean; } | { id: number; name: string; }' is not assignable to type 'Action'. +!!! error TS2322: Type '{ id: number; trueness: boolean; }' is not assignable to type 'Action'. +!!! error TS2322: Property 'trueness' does not exist on type 'Action'. + { id: 2, trueness: false }, + { id: 3, name: "three" } + ] + + var x2: Action[] = [ + new ActionA(), + new ActionB() + ] + + var x3: Action[] = [ + new Action(), + new ActionA(), + new ActionB() + ] + + var z1: { id: number }[] = + ~~ +!!! error TS2322: Type '({ id: number; trueness: boolean; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'. +!!! error TS2322: Type '{ id: number; trueness: boolean; } | { id: number; name: string; }' is not assignable to type '{ id: number; }'. +!!! error TS2322: Type '{ id: number; trueness: boolean; }' is not assignable to type '{ id: number; }'. +!!! error TS2322: Property 'trueness' does not exist on type '{ id: number; }'. + [ + { id: 2, trueness: false }, + { id: 3, name: "three" } + ] + + var z2: { id: number }[] = + [ + new ActionA(), + new ActionB() + ] + + var z3: { id: number }[] = + [ + new Action(), + new ActionA(), + new ActionB() + ] + + + + + \ No newline at end of file diff --git a/tests/baselines/reference/arrayLiteralTypeInference.symbols b/tests/baselines/reference/arrayLiteralTypeInference.symbols deleted file mode 100644 index 005cb57f6c4..00000000000 --- a/tests/baselines/reference/arrayLiteralTypeInference.symbols +++ /dev/null @@ -1,113 +0,0 @@ -=== tests/cases/compiler/arrayLiteralTypeInference.ts === -class Action { ->Action : Symbol(Action, Decl(arrayLiteralTypeInference.ts, 0, 0)) - - id: number; ->id : Symbol(id, Decl(arrayLiteralTypeInference.ts, 0, 14)) -} - -class ActionA extends Action { ->ActionA : Symbol(ActionA, Decl(arrayLiteralTypeInference.ts, 2, 1)) ->Action : Symbol(Action, Decl(arrayLiteralTypeInference.ts, 0, 0)) - - value: string; ->value : Symbol(value, Decl(arrayLiteralTypeInference.ts, 4, 30)) -} - -class ActionB extends Action { ->ActionB : Symbol(ActionB, Decl(arrayLiteralTypeInference.ts, 6, 1)) ->Action : Symbol(Action, Decl(arrayLiteralTypeInference.ts, 0, 0)) - - trueNess: boolean; ->trueNess : Symbol(trueNess, Decl(arrayLiteralTypeInference.ts, 8, 30)) -} - -var x1: Action[] = [ ->x1 : Symbol(x1, Decl(arrayLiteralTypeInference.ts, 12, 3)) ->Action : Symbol(Action, Decl(arrayLiteralTypeInference.ts, 0, 0)) - - { id: 2, trueness: false }, ->id : Symbol(id, Decl(arrayLiteralTypeInference.ts, 13, 5)) ->trueness : Symbol(trueness, Decl(arrayLiteralTypeInference.ts, 13, 12)) - - { id: 3, name: "three" } ->id : Symbol(id, Decl(arrayLiteralTypeInference.ts, 14, 5)) ->name : Symbol(name, Decl(arrayLiteralTypeInference.ts, 14, 12)) - -] - -var x2: Action[] = [ ->x2 : Symbol(x2, Decl(arrayLiteralTypeInference.ts, 17, 3)) ->Action : Symbol(Action, Decl(arrayLiteralTypeInference.ts, 0, 0)) - - new ActionA(), ->ActionA : Symbol(ActionA, Decl(arrayLiteralTypeInference.ts, 2, 1)) - - new ActionB() ->ActionB : Symbol(ActionB, Decl(arrayLiteralTypeInference.ts, 6, 1)) - -] - -var x3: Action[] = [ ->x3 : Symbol(x3, Decl(arrayLiteralTypeInference.ts, 22, 3)) ->Action : Symbol(Action, Decl(arrayLiteralTypeInference.ts, 0, 0)) - - new Action(), ->Action : Symbol(Action, Decl(arrayLiteralTypeInference.ts, 0, 0)) - - new ActionA(), ->ActionA : Symbol(ActionA, Decl(arrayLiteralTypeInference.ts, 2, 1)) - - new ActionB() ->ActionB : Symbol(ActionB, Decl(arrayLiteralTypeInference.ts, 6, 1)) - -] - -var z1: { id: number }[] = ->z1 : Symbol(z1, Decl(arrayLiteralTypeInference.ts, 28, 3)) ->id : Symbol(id, Decl(arrayLiteralTypeInference.ts, 28, 9)) - - [ - { id: 2, trueness: false }, ->id : Symbol(id, Decl(arrayLiteralTypeInference.ts, 30, 9)) ->trueness : Symbol(trueness, Decl(arrayLiteralTypeInference.ts, 30, 16)) - - { id: 3, name: "three" } ->id : Symbol(id, Decl(arrayLiteralTypeInference.ts, 31, 9)) ->name : Symbol(name, Decl(arrayLiteralTypeInference.ts, 31, 16)) - - ] - -var z2: { id: number }[] = ->z2 : Symbol(z2, Decl(arrayLiteralTypeInference.ts, 34, 3)) ->id : Symbol(id, Decl(arrayLiteralTypeInference.ts, 34, 9)) - - [ - new ActionA(), ->ActionA : Symbol(ActionA, Decl(arrayLiteralTypeInference.ts, 2, 1)) - - new ActionB() ->ActionB : Symbol(ActionB, Decl(arrayLiteralTypeInference.ts, 6, 1)) - - ] - -var z3: { id: number }[] = ->z3 : Symbol(z3, Decl(arrayLiteralTypeInference.ts, 40, 3)) ->id : Symbol(id, Decl(arrayLiteralTypeInference.ts, 40, 9)) - - [ - new Action(), ->Action : Symbol(Action, Decl(arrayLiteralTypeInference.ts, 0, 0)) - - new ActionA(), ->ActionA : Symbol(ActionA, Decl(arrayLiteralTypeInference.ts, 2, 1)) - - new ActionB() ->ActionB : Symbol(ActionB, Decl(arrayLiteralTypeInference.ts, 6, 1)) - - ] - - - - - diff --git a/tests/baselines/reference/arrayLiteralTypeInference.types b/tests/baselines/reference/arrayLiteralTypeInference.types deleted file mode 100644 index 660592fceb8..00000000000 --- a/tests/baselines/reference/arrayLiteralTypeInference.types +++ /dev/null @@ -1,144 +0,0 @@ -=== tests/cases/compiler/arrayLiteralTypeInference.ts === -class Action { ->Action : Action - - id: number; ->id : number -} - -class ActionA extends Action { ->ActionA : ActionA ->Action : Action - - value: string; ->value : string -} - -class ActionB extends Action { ->ActionB : ActionB ->Action : Action - - trueNess: boolean; ->trueNess : boolean -} - -var x1: Action[] = [ ->x1 : Action[] ->Action : Action ->[ { id: 2, trueness: false }, { id: 3, name: "three" }] : ({ id: number; trueness: boolean; } | { id: number; name: string; })[] - - { id: 2, trueness: false }, ->{ id: 2, trueness: false } : { id: number; trueness: boolean; } ->id : number ->2 : number ->trueness : boolean ->false : boolean - - { id: 3, name: "three" } ->{ id: 3, name: "three" } : { id: number; name: string; } ->id : number ->3 : number ->name : string ->"three" : string - -] - -var x2: Action[] = [ ->x2 : Action[] ->Action : Action ->[ new ActionA(), new ActionB()] : (ActionA | ActionB)[] - - new ActionA(), ->new ActionA() : ActionA ->ActionA : typeof ActionA - - new ActionB() ->new ActionB() : ActionB ->ActionB : typeof ActionB - -] - -var x3: Action[] = [ ->x3 : Action[] ->Action : Action ->[ new Action(), new ActionA(), new ActionB()] : Action[] - - new Action(), ->new Action() : Action ->Action : typeof Action - - new ActionA(), ->new ActionA() : ActionA ->ActionA : typeof ActionA - - new ActionB() ->new ActionB() : ActionB ->ActionB : typeof ActionB - -] - -var z1: { id: number }[] = ->z1 : { id: number; }[] ->id : number - - [ ->[ { id: 2, trueness: false }, { id: 3, name: "three" } ] : ({ id: number; trueness: boolean; } | { id: number; name: string; })[] - - { id: 2, trueness: false }, ->{ id: 2, trueness: false } : { id: number; trueness: boolean; } ->id : number ->2 : number ->trueness : boolean ->false : boolean - - { id: 3, name: "three" } ->{ id: 3, name: "three" } : { id: number; name: string; } ->id : number ->3 : number ->name : string ->"three" : string - - ] - -var z2: { id: number }[] = ->z2 : { id: number; }[] ->id : number - - [ ->[ new ActionA(), new ActionB() ] : (ActionA | ActionB)[] - - new ActionA(), ->new ActionA() : ActionA ->ActionA : typeof ActionA - - new ActionB() ->new ActionB() : ActionB ->ActionB : typeof ActionB - - ] - -var z3: { id: number }[] = ->z3 : { id: number; }[] ->id : number - - [ ->[ new Action(), new ActionA(), new ActionB() ] : Action[] - - new Action(), ->new Action() : Action ->Action : typeof Action - - new ActionA(), ->new ActionA() : ActionA ->ActionA : typeof ActionA - - new ActionB() ->new ActionB() : ActionB ->ActionB : typeof ActionB - - ] - - - - - diff --git a/tests/baselines/reference/arrayLiterals.errors.txt b/tests/baselines/reference/arrayLiterals.errors.txt new file mode 100644 index 00000000000..9bae14e36b3 --- /dev/null +++ b/tests/baselines/reference/arrayLiterals.errors.txt @@ -0,0 +1,50 @@ +tests/cases/conformance/expressions/arrayLiterals/arrayLiterals.ts(24,5): error TS2322: Type '({ a: string; b: number; c: string; } | { a: string; b: number; c: number; })[]' is not assignable to type '{ [n: number]: { a: string; b: number; }; }'. + Index signatures are incompatible. + Type '{ a: string; b: number; c: string; } | { a: string; b: number; c: number; }' is not assignable to type '{ a: string; b: number; }'. + Type '{ a: string; b: number; c: string; }' is not assignable to type '{ a: string; b: number; }'. + Property 'c' does not exist on type '{ a: string; b: number; }'. + + +==== tests/cases/conformance/expressions/arrayLiterals/arrayLiterals.ts (1 errors) ==== + // Empty array literal with no contextual type has type Undefined[] + + var arr1= [[], [1], ['']]; + + var arr2 = [[null], [1], ['']]; + + + // Array literal with elements of only EveryType E has type E[] + var stringArrArr = [[''], [""]]; + + var stringArr = ['', ""]; + + var numberArr = [0, 0.0, 0x00, 1e1]; + + var boolArr = [false, true, false, true]; + + class C { private p; } + var classArr = [new C(), new C()]; + + var classTypeArray = [C, C, C]; + var classTypeArray: Array; // Should OK, not be a parse error + + // Contextual type C with numeric index signature makes array literal of EveryType E of type BCT(E,C)[] + var context1: { [n: number]: { a: string; b: number; }; } = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }]; + ~~~~~~~~ +!!! error TS2322: Type '({ a: string; b: number; c: string; } | { a: string; b: number; c: number; })[]' is not assignable to type '{ [n: number]: { a: string; b: number; }; }'. +!!! error TS2322: Index signatures are incompatible. +!!! error TS2322: Type '{ a: string; b: number; c: string; } | { a: string; b: number; c: number; }' is not assignable to type '{ a: string; b: number; }'. +!!! error TS2322: Type '{ a: string; b: number; c: string; }' is not assignable to type '{ a: string; b: number; }'. +!!! error TS2322: Property 'c' does not exist on type '{ a: string; b: number; }'. + var context2 = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }]; + + // Contextual type C with numeric index signature of type Base makes array literal of Derived have type Base[] + class Base { private p; } + class Derived1 extends Base { private m }; + class Derived2 extends Base { private n }; + var context3: Base[] = [new Derived1(), new Derived2()]; + + // Contextual type C with numeric index signature of type Base makes array literal of Derived1 and Derived2 have type Base[] + var context4: Base[] = [new Derived1(), new Derived1()]; + + \ No newline at end of file diff --git a/tests/baselines/reference/arrayLiterals.symbols b/tests/baselines/reference/arrayLiterals.symbols deleted file mode 100644 index b338e7ff6e6..00000000000 --- a/tests/baselines/reference/arrayLiterals.symbols +++ /dev/null @@ -1,94 +0,0 @@ -=== tests/cases/conformance/expressions/arrayLiterals/arrayLiterals.ts === -// Empty array literal with no contextual type has type Undefined[] - -var arr1= [[], [1], ['']]; ->arr1 : Symbol(arr1, Decl(arrayLiterals.ts, 2, 3)) - -var arr2 = [[null], [1], ['']]; ->arr2 : Symbol(arr2, Decl(arrayLiterals.ts, 4, 3)) - - -// Array literal with elements of only EveryType E has type E[] -var stringArrArr = [[''], [""]]; ->stringArrArr : Symbol(stringArrArr, Decl(arrayLiterals.ts, 8, 3)) - -var stringArr = ['', ""]; ->stringArr : Symbol(stringArr, Decl(arrayLiterals.ts, 10, 3)) - -var numberArr = [0, 0.0, 0x00, 1e1]; ->numberArr : Symbol(numberArr, Decl(arrayLiterals.ts, 12, 3)) - -var boolArr = [false, true, false, true]; ->boolArr : Symbol(boolArr, Decl(arrayLiterals.ts, 14, 3)) - -class C { private p; } ->C : Symbol(C, Decl(arrayLiterals.ts, 14, 41)) ->p : Symbol(p, Decl(arrayLiterals.ts, 16, 9)) - -var classArr = [new C(), new C()]; ->classArr : Symbol(classArr, Decl(arrayLiterals.ts, 17, 3)) ->C : Symbol(C, Decl(arrayLiterals.ts, 14, 41)) ->C : Symbol(C, Decl(arrayLiterals.ts, 14, 41)) - -var classTypeArray = [C, C, C]; ->classTypeArray : Symbol(classTypeArray, Decl(arrayLiterals.ts, 19, 3), Decl(arrayLiterals.ts, 20, 3)) ->C : Symbol(C, Decl(arrayLiterals.ts, 14, 41)) ->C : Symbol(C, Decl(arrayLiterals.ts, 14, 41)) ->C : Symbol(C, Decl(arrayLiterals.ts, 14, 41)) - -var classTypeArray: Array; // Should OK, not be a parse error ->classTypeArray : Symbol(classTypeArray, Decl(arrayLiterals.ts, 19, 3), Decl(arrayLiterals.ts, 20, 3)) ->Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11)) ->C : Symbol(C, Decl(arrayLiterals.ts, 14, 41)) - -// Contextual type C with numeric index signature makes array literal of EveryType E of type BCT(E,C)[] -var context1: { [n: number]: { a: string; b: number; }; } = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }]; ->context1 : Symbol(context1, Decl(arrayLiterals.ts, 23, 3)) ->n : Symbol(n, Decl(arrayLiterals.ts, 23, 17)) ->a : Symbol(a, Decl(arrayLiterals.ts, 23, 30)) ->b : Symbol(b, Decl(arrayLiterals.ts, 23, 41)) ->a : Symbol(a, Decl(arrayLiterals.ts, 23, 62)) ->b : Symbol(b, Decl(arrayLiterals.ts, 23, 69)) ->c : Symbol(c, Decl(arrayLiterals.ts, 23, 75)) ->a : Symbol(a, Decl(arrayLiterals.ts, 23, 86)) ->b : Symbol(b, Decl(arrayLiterals.ts, 23, 93)) ->c : Symbol(c, Decl(arrayLiterals.ts, 23, 99)) - -var context2 = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }]; ->context2 : Symbol(context2, Decl(arrayLiterals.ts, 24, 3)) ->a : Symbol(a, Decl(arrayLiterals.ts, 24, 17)) ->b : Symbol(b, Decl(arrayLiterals.ts, 24, 24)) ->c : Symbol(c, Decl(arrayLiterals.ts, 24, 30)) ->a : Symbol(a, Decl(arrayLiterals.ts, 24, 41)) ->b : Symbol(b, Decl(arrayLiterals.ts, 24, 48)) ->c : Symbol(c, Decl(arrayLiterals.ts, 24, 54)) - -// Contextual type C with numeric index signature of type Base makes array literal of Derived have type Base[] -class Base { private p; } ->Base : Symbol(Base, Decl(arrayLiterals.ts, 24, 63)) ->p : Symbol(p, Decl(arrayLiterals.ts, 27, 12)) - -class Derived1 extends Base { private m }; ->Derived1 : Symbol(Derived1, Decl(arrayLiterals.ts, 27, 25)) ->Base : Symbol(Base, Decl(arrayLiterals.ts, 24, 63)) ->m : Symbol(m, Decl(arrayLiterals.ts, 28, 29)) - -class Derived2 extends Base { private n }; ->Derived2 : Symbol(Derived2, Decl(arrayLiterals.ts, 28, 42)) ->Base : Symbol(Base, Decl(arrayLiterals.ts, 24, 63)) ->n : Symbol(n, Decl(arrayLiterals.ts, 29, 29)) - -var context3: Base[] = [new Derived1(), new Derived2()]; ->context3 : Symbol(context3, Decl(arrayLiterals.ts, 30, 3)) ->Base : Symbol(Base, Decl(arrayLiterals.ts, 24, 63)) ->Derived1 : Symbol(Derived1, Decl(arrayLiterals.ts, 27, 25)) ->Derived2 : Symbol(Derived2, Decl(arrayLiterals.ts, 28, 42)) - -// Contextual type C with numeric index signature of type Base makes array literal of Derived1 and Derived2 have type Base[] -var context4: Base[] = [new Derived1(), new Derived1()]; ->context4 : Symbol(context4, Decl(arrayLiterals.ts, 33, 3)) ->Base : Symbol(Base, Decl(arrayLiterals.ts, 24, 63)) ->Derived1 : Symbol(Derived1, Decl(arrayLiterals.ts, 27, 25)) ->Derived1 : Symbol(Derived1, Decl(arrayLiterals.ts, 27, 25)) - - diff --git a/tests/baselines/reference/arrayLiterals.types b/tests/baselines/reference/arrayLiterals.types deleted file mode 100644 index e103241dd0b..00000000000 --- a/tests/baselines/reference/arrayLiterals.types +++ /dev/null @@ -1,153 +0,0 @@ -=== tests/cases/conformance/expressions/arrayLiterals/arrayLiterals.ts === -// Empty array literal with no contextual type has type Undefined[] - -var arr1= [[], [1], ['']]; ->arr1 : (number[] | string[])[] ->[[], [1], ['']] : (number[] | string[])[] ->[] : undefined[] ->[1] : number[] ->1 : number ->[''] : string[] ->'' : string - -var arr2 = [[null], [1], ['']]; ->arr2 : (number[] | string[])[] ->[[null], [1], ['']] : (number[] | string[])[] ->[null] : null[] ->null : null ->[1] : number[] ->1 : number ->[''] : string[] ->'' : string - - -// Array literal with elements of only EveryType E has type E[] -var stringArrArr = [[''], [""]]; ->stringArrArr : string[][] ->[[''], [""]] : string[][] ->[''] : string[] ->'' : string ->[""] : string[] ->"" : string - -var stringArr = ['', ""]; ->stringArr : string[] ->['', ""] : string[] ->'' : string ->"" : string - -var numberArr = [0, 0.0, 0x00, 1e1]; ->numberArr : number[] ->[0, 0.0, 0x00, 1e1] : number[] ->0 : number ->0.0 : number ->0x00 : number ->1e1 : number - -var boolArr = [false, true, false, true]; ->boolArr : boolean[] ->[false, true, false, true] : boolean[] ->false : boolean ->true : boolean ->false : boolean ->true : boolean - -class C { private p; } ->C : C ->p : any - -var classArr = [new C(), new C()]; ->classArr : C[] ->[new C(), new C()] : C[] ->new C() : C ->C : typeof C ->new C() : C ->C : typeof C - -var classTypeArray = [C, C, C]; ->classTypeArray : typeof C[] ->[C, C, C] : typeof C[] ->C : typeof C ->C : typeof C ->C : typeof C - -var classTypeArray: Array; // Should OK, not be a parse error ->classTypeArray : typeof C[] ->Array : T[] ->C : typeof C - -// Contextual type C with numeric index signature makes array literal of EveryType E of type BCT(E,C)[] -var context1: { [n: number]: { a: string; b: number; }; } = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }]; ->context1 : { [n: number]: { a: string; b: number; }; } ->n : number ->a : string ->b : number ->[{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }] : ({ a: string; b: number; c: string; } | { a: string; b: number; c: number; })[] ->{ a: '', b: 0, c: '' } : { a: string; b: number; c: string; } ->a : string ->'' : string ->b : number ->0 : number ->c : string ->'' : string ->{ a: "", b: 3, c: 0 } : { a: string; b: number; c: number; } ->a : string ->"" : string ->b : number ->3 : number ->c : number ->0 : number - -var context2 = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }]; ->context2 : ({ a: string; b: number; c: string; } | { a: string; b: number; c: number; })[] ->[{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }] : ({ a: string; b: number; c: string; } | { a: string; b: number; c: number; })[] ->{ a: '', b: 0, c: '' } : { a: string; b: number; c: string; } ->a : string ->'' : string ->b : number ->0 : number ->c : string ->'' : string ->{ a: "", b: 3, c: 0 } : { a: string; b: number; c: number; } ->a : string ->"" : string ->b : number ->3 : number ->c : number ->0 : number - -// Contextual type C with numeric index signature of type Base makes array literal of Derived have type Base[] -class Base { private p; } ->Base : Base ->p : any - -class Derived1 extends Base { private m }; ->Derived1 : Derived1 ->Base : Base ->m : any - -class Derived2 extends Base { private n }; ->Derived2 : Derived2 ->Base : Base ->n : any - -var context3: Base[] = [new Derived1(), new Derived2()]; ->context3 : Base[] ->Base : Base ->[new Derived1(), new Derived2()] : (Derived1 | Derived2)[] ->new Derived1() : Derived1 ->Derived1 : typeof Derived1 ->new Derived2() : Derived2 ->Derived2 : typeof Derived2 - -// Contextual type C with numeric index signature of type Base makes array literal of Derived1 and Derived2 have type Base[] -var context4: Base[] = [new Derived1(), new Derived1()]; ->context4 : Base[] ->Base : Base ->[new Derived1(), new Derived1()] : Derived1[] ->new Derived1() : Derived1 ->Derived1 : typeof Derived1 ->new Derived1() : Derived1 ->Derived1 : typeof Derived1 - - diff --git a/tests/baselines/reference/assignmentCompatBug2.errors.txt b/tests/baselines/reference/assignmentCompatBug2.errors.txt index 15bf1111391..dcccaabca18 100644 --- a/tests/baselines/reference/assignmentCompatBug2.errors.txt +++ b/tests/baselines/reference/assignmentCompatBug2.errors.txt @@ -1,7 +1,9 @@ tests/cases/compiler/assignmentCompatBug2.ts(1,5): error TS2322: Type '{ a: number; }' is not assignable to type '{ b: number; }'. - Property 'b' is missing in type '{ a: number; }'. + Property 'a' does not exist on type '{ b: number; }'. tests/cases/compiler/assignmentCompatBug2.ts(3,1): error TS2322: Type '{ a: number; }' is not assignable to type '{ b: number; }'. - Property 'b' is missing in type '{ a: number; }'. + Property 'a' does not exist on type '{ b: number; }'. +tests/cases/compiler/assignmentCompatBug2.ts(5,1): error TS2322: Type '{ b: number; a: number; }' is not assignable to type '{ b: number; }'. + Property 'a' does not exist on type '{ b: number; }'. tests/cases/compiler/assignmentCompatBug2.ts(15,1): error TS2322: Type '{ f: (n: number) => number; g: (s: string) => number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'. Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; }'. tests/cases/compiler/assignmentCompatBug2.ts(20,1): error TS2322: Type '{ f: (n: number) => number; m: number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'. @@ -10,18 +12,21 @@ tests/cases/compiler/assignmentCompatBug2.ts(33,1): error TS2322: Type '{ f: (n: Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; n: number; k: (a: any) => any; }'. -==== tests/cases/compiler/assignmentCompatBug2.ts (5 errors) ==== +==== tests/cases/compiler/assignmentCompatBug2.ts (6 errors) ==== var b2: { b: number;} = { a: 0 }; // error ~~ !!! error TS2322: Type '{ a: number; }' is not assignable to type '{ b: number; }'. -!!! error TS2322: Property 'b' is missing in type '{ a: number; }'. +!!! error TS2322: Property 'a' does not exist on type '{ b: number; }'. b2 = { a: 0 }; // error ~~ !!! error TS2322: Type '{ a: number; }' is not assignable to type '{ b: number; }'. -!!! error TS2322: Property 'b' is missing in type '{ a: number; }'. +!!! error TS2322: Property 'a' does not exist on type '{ b: number; }'. b2 = {b: 0, a: 0 }; + ~~ +!!! error TS2322: Type '{ b: number; a: number; }' is not assignable to type '{ b: number; }'. +!!! error TS2322: Property 'a' does not exist on type '{ b: number; }'. var b3: { f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }; diff --git a/tests/baselines/reference/assignmentCompatBug5.errors.txt b/tests/baselines/reference/assignmentCompatBug5.errors.txt index fd13a07a948..200829a8693 100644 --- a/tests/baselines/reference/assignmentCompatBug5.errors.txt +++ b/tests/baselines/reference/assignmentCompatBug5.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/assignmentCompatBug5.ts(2,6): error TS2345: Argument of type '{ b: number; }' is not assignable to parameter of type '{ a: number; }'. - Property 'a' is missing in type '{ b: number; }'. + Property 'b' does not exist on type '{ a: number; }'. tests/cases/compiler/assignmentCompatBug5.ts(5,6): error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'number[]'. Type 'string' is not assignable to type 'number'. tests/cases/compiler/assignmentCompatBug5.ts(8,6): error TS2345: Argument of type '(s: string) => void' is not assignable to parameter of type '(n: number) => number'. @@ -14,7 +14,7 @@ tests/cases/compiler/assignmentCompatBug5.ts(9,6): error TS2345: Argument of typ foo1({ b: 5 }); ~~~~~~~~ !!! error TS2345: Argument of type '{ b: number; }' is not assignable to parameter of type '{ a: number; }'. -!!! error TS2345: Property 'a' is missing in type '{ b: number; }'. +!!! error TS2345: Property 'b' does not exist on type '{ a: number; }'. function foo2(x: number[]) { } foo2(["s", "t"]); diff --git a/tests/baselines/reference/contextualTyping17.errors.txt b/tests/baselines/reference/contextualTyping17.errors.txt new file mode 100644 index 00000000000..e67d5958092 --- /dev/null +++ b/tests/baselines/reference/contextualTyping17.errors.txt @@ -0,0 +1,9 @@ +tests/cases/compiler/contextualTyping17.ts(1,33): error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'. + Property 'name' does not exist on type '{ id: number; }'. + + +==== tests/cases/compiler/contextualTyping17.ts (1 errors) ==== + var foo: {id:number;} = {id:4}; foo = {id: 5, name:"foo"}; + ~~~ +!!! error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'. +!!! error TS2322: Property 'name' does not exist on type '{ id: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping17.symbols b/tests/baselines/reference/contextualTyping17.symbols deleted file mode 100644 index 55631494105..00000000000 --- a/tests/baselines/reference/contextualTyping17.symbols +++ /dev/null @@ -1,9 +0,0 @@ -=== tests/cases/compiler/contextualTyping17.ts === -var foo: {id:number;} = {id:4}; foo = {id: 5, name:"foo"}; ->foo : Symbol(foo, Decl(contextualTyping17.ts, 0, 3)) ->id : Symbol(id, Decl(contextualTyping17.ts, 0, 10)) ->id : Symbol(id, Decl(contextualTyping17.ts, 0, 25)) ->foo : Symbol(foo, Decl(contextualTyping17.ts, 0, 3)) ->id : Symbol(id, Decl(contextualTyping17.ts, 0, 39)) ->name : Symbol(name, Decl(contextualTyping17.ts, 0, 45)) - diff --git a/tests/baselines/reference/contextualTyping17.types b/tests/baselines/reference/contextualTyping17.types deleted file mode 100644 index 649bc339ba1..00000000000 --- a/tests/baselines/reference/contextualTyping17.types +++ /dev/null @@ -1,15 +0,0 @@ -=== tests/cases/compiler/contextualTyping17.ts === -var foo: {id:number;} = {id:4}; foo = {id: 5, name:"foo"}; ->foo : { id: number; } ->id : number ->{id:4} : { id: number; } ->id : number ->4 : number ->foo = {id: 5, name:"foo"} : { id: number; name: string; } ->foo : { id: number; } ->{id: 5, name:"foo"} : { id: number; name: string; } ->id : number ->5 : number ->name : string ->"foo" : string - diff --git a/tests/baselines/reference/contextualTyping2.errors.txt b/tests/baselines/reference/contextualTyping2.errors.txt new file mode 100644 index 00000000000..cc15a8bbbb1 --- /dev/null +++ b/tests/baselines/reference/contextualTyping2.errors.txt @@ -0,0 +1,9 @@ +tests/cases/compiler/contextualTyping2.ts(1,5): error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'. + Property 'name' does not exist on type '{ id: number; }'. + + +==== tests/cases/compiler/contextualTyping2.ts (1 errors) ==== + var foo: {id:number;} = {id:4, name:"foo"}; + ~~~ +!!! error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'. +!!! error TS2322: Property 'name' does not exist on type '{ id: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping2.symbols b/tests/baselines/reference/contextualTyping2.symbols deleted file mode 100644 index 9c102092979..00000000000 --- a/tests/baselines/reference/contextualTyping2.symbols +++ /dev/null @@ -1,7 +0,0 @@ -=== tests/cases/compiler/contextualTyping2.ts === -var foo: {id:number;} = {id:4, name:"foo"}; ->foo : Symbol(foo, Decl(contextualTyping2.ts, 0, 3)) ->id : Symbol(id, Decl(contextualTyping2.ts, 0, 10)) ->id : Symbol(id, Decl(contextualTyping2.ts, 0, 25)) ->name : Symbol(name, Decl(contextualTyping2.ts, 0, 30)) - diff --git a/tests/baselines/reference/contextualTyping2.types b/tests/baselines/reference/contextualTyping2.types deleted file mode 100644 index 0658247c089..00000000000 --- a/tests/baselines/reference/contextualTyping2.types +++ /dev/null @@ -1,10 +0,0 @@ -=== tests/cases/compiler/contextualTyping2.ts === -var foo: {id:number;} = {id:4, name:"foo"}; ->foo : { id: number; } ->id : number ->{id:4, name:"foo"} : { id: number; name: string; } ->id : number ->4 : number ->name : string ->"foo" : string - diff --git a/tests/baselines/reference/contextualTyping4.errors.txt b/tests/baselines/reference/contextualTyping4.errors.txt new file mode 100644 index 00000000000..c2079cdf004 --- /dev/null +++ b/tests/baselines/reference/contextualTyping4.errors.txt @@ -0,0 +1,9 @@ +tests/cases/compiler/contextualTyping4.ts(1,13): error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'. + Property 'name' does not exist on type '{ id: number; }'. + + +==== tests/cases/compiler/contextualTyping4.ts (1 errors) ==== + class foo { public bar:{id:number;} = {id:5, name:"foo"}; } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'. +!!! error TS2322: Property 'name' does not exist on type '{ id: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping4.symbols b/tests/baselines/reference/contextualTyping4.symbols deleted file mode 100644 index c5dcd4f1577..00000000000 --- a/tests/baselines/reference/contextualTyping4.symbols +++ /dev/null @@ -1,8 +0,0 @@ -=== tests/cases/compiler/contextualTyping4.ts === -class foo { public bar:{id:number;} = {id:5, name:"foo"}; } ->foo : Symbol(foo, Decl(contextualTyping4.ts, 0, 0)) ->bar : Symbol(bar, Decl(contextualTyping4.ts, 0, 11)) ->id : Symbol(id, Decl(contextualTyping4.ts, 0, 24)) ->id : Symbol(id, Decl(contextualTyping4.ts, 0, 39)) ->name : Symbol(name, Decl(contextualTyping4.ts, 0, 44)) - diff --git a/tests/baselines/reference/contextualTyping4.types b/tests/baselines/reference/contextualTyping4.types deleted file mode 100644 index 757c67745f1..00000000000 --- a/tests/baselines/reference/contextualTyping4.types +++ /dev/null @@ -1,11 +0,0 @@ -=== tests/cases/compiler/contextualTyping4.ts === -class foo { public bar:{id:number;} = {id:5, name:"foo"}; } ->foo : foo ->bar : { id: number; } ->id : number ->{id:5, name:"foo"} : { id: number; name: string; } ->id : number ->5 : number ->name : string ->"foo" : string - diff --git a/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.errors.txt b/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.errors.txt new file mode 100644 index 00000000000..4a43ec56ead --- /dev/null +++ b/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.errors.txt @@ -0,0 +1,25 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts(14,28): error TS2345: Argument of type '{ a: number; b: number; }' is not assignable to parameter of type '{ a: number; }'. + Property 'b' does not exist on type '{ a: number; }'. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts (1 errors) ==== + class Base { + foo(x: { a: number }): { a: number } { + return null; + } + } + + class Derived extends Base { + foo(x: { a: number; b: number }): { a: number; b: number } { + return null; + } + + bar() { + var r = super.foo({ a: 1 }); // { a: number } + var r2 = super.foo({ a: 1, b: 2 }); // { a: number } + ~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '{ a: number; b: number; }' is not assignable to parameter of type '{ a: number; }'. +!!! error TS2345: Property 'b' does not exist on type '{ a: number; }'. + var r3 = this.foo({ a: 1, b: 2 }); // { a: number; b: number; } + } + } \ No newline at end of file diff --git a/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.symbols b/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.symbols deleted file mode 100644 index e935d7bf66a..00000000000 --- a/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.symbols +++ /dev/null @@ -1,56 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts === -class Base { ->Base : Symbol(Base, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 0, 0)) - - foo(x: { a: number }): { a: number } { ->foo : Symbol(foo, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 0, 12)) ->x : Symbol(x, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 1, 8)) ->a : Symbol(a, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 1, 12)) ->a : Symbol(a, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 1, 28)) - - return null; - } -} - -class Derived extends Base { ->Derived : Symbol(Derived, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 4, 1)) ->Base : Symbol(Base, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 0, 0)) - - foo(x: { a: number; b: number }): { a: number; b: number } { ->foo : Symbol(foo, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 6, 28)) ->x : Symbol(x, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 7, 8)) ->a : Symbol(a, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 7, 12)) ->b : Symbol(b, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 7, 23)) ->a : Symbol(a, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 7, 39)) ->b : Symbol(b, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 7, 50)) - - return null; - } - - bar() { ->bar : Symbol(bar, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 9, 5)) - - var r = super.foo({ a: 1 }); // { a: number } ->r : Symbol(r, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 12, 11)) ->super.foo : Symbol(Base.foo, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 0, 12)) ->super : Symbol(Base, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 0, 0)) ->foo : Symbol(Base.foo, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 0, 12)) ->a : Symbol(a, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 12, 27)) - - var r2 = super.foo({ a: 1, b: 2 }); // { a: number } ->r2 : Symbol(r2, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 13, 11)) ->super.foo : Symbol(Base.foo, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 0, 12)) ->super : Symbol(Base, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 0, 0)) ->foo : Symbol(Base.foo, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 0, 12)) ->a : Symbol(a, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 13, 28)) ->b : Symbol(b, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 13, 34)) - - var r3 = this.foo({ a: 1, b: 2 }); // { a: number; b: number; } ->r3 : Symbol(r3, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 14, 11)) ->this.foo : Symbol(foo, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 6, 28)) ->this : Symbol(Derived, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 4, 1)) ->foo : Symbol(foo, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 6, 28)) ->a : Symbol(a, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 14, 27)) ->b : Symbol(b, Decl(derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts, 14, 33)) - } -} diff --git a/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.types b/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.types deleted file mode 100644 index d8d9f657255..00000000000 --- a/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.types +++ /dev/null @@ -1,69 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts === -class Base { ->Base : Base - - foo(x: { a: number }): { a: number } { ->foo : (x: { a: number; }) => { a: number; } ->x : { a: number; } ->a : number ->a : number - - return null; ->null : null - } -} - -class Derived extends Base { ->Derived : Derived ->Base : Base - - foo(x: { a: number; b: number }): { a: number; b: number } { ->foo : (x: { a: number; b: number; }) => { a: number; b: number; } ->x : { a: number; b: number; } ->a : number ->b : number ->a : number ->b : number - - return null; ->null : null - } - - bar() { ->bar : () => void - - var r = super.foo({ a: 1 }); // { a: number } ->r : { a: number; } ->super.foo({ a: 1 }) : { a: number; } ->super.foo : (x: { a: number; }) => { a: number; } ->super : Base ->foo : (x: { a: number; }) => { a: number; } ->{ a: 1 } : { a: number; } ->a : number ->1 : number - - var r2 = super.foo({ a: 1, b: 2 }); // { a: number } ->r2 : { a: number; } ->super.foo({ a: 1, b: 2 }) : { a: number; } ->super.foo : (x: { a: number; }) => { a: number; } ->super : Base ->foo : (x: { a: number; }) => { a: number; } ->{ a: 1, b: 2 } : { a: number; b: number; } ->a : number ->1 : number ->b : number ->2 : number - - var r3 = this.foo({ a: 1, b: 2 }); // { a: number; b: number; } ->r3 : { a: number; b: number; } ->this.foo({ a: 1, b: 2 }) : { a: number; b: number; } ->this.foo : (x: { a: number; b: number; }) => { a: number; b: number; } ->this : Derived ->foo : (x: { a: number; b: number; }) => { a: number; b: number; } ->{ a: 1, b: 2 } : { a: number; b: number; } ->a : number ->1 : number ->b : number ->2 : number - } -} diff --git a/tests/baselines/reference/destructuringParameterProperties5.errors.txt b/tests/baselines/reference/destructuringParameterProperties5.errors.txt index dca02a9a84e..0f83063c936 100644 --- a/tests/baselines/reference/destructuringParameterProperties5.errors.txt +++ b/tests/baselines/reference/destructuringParameterProperties5.errors.txt @@ -10,7 +10,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(7 tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(11,16): error TS2345: Argument of type '[{ x1: number; x2: string; x3: boolean; }, string, boolean]' is not assignable to parameter of type '[{ x: number; y: string; z: boolean; }, number, string]'. Types of property '0' are incompatible. Type '{ x1: number; x2: string; x3: boolean; }' is not assignable to type '{ x: number; y: string; z: boolean; }'. - Property 'x' is missing in type '{ x1: number; x2: string; x3: boolean; }'. + Property 'x1' does not exist on type '{ x: number; y: string; z: boolean; }'. ==== tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts (10 errors) ==== @@ -47,5 +47,5 @@ tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(1 !!! error TS2345: Argument of type '[{ x1: number; x2: string; x3: boolean; }, string, boolean]' is not assignable to parameter of type '[{ x: number; y: string; z: boolean; }, number, string]'. !!! error TS2345: Types of property '0' are incompatible. !!! error TS2345: Type '{ x1: number; x2: string; x3: boolean; }' is not assignable to type '{ x: number; y: string; z: boolean; }'. -!!! error TS2345: Property 'x' is missing in type '{ x1: number; x2: string; x3: boolean; }'. +!!! error TS2345: Property 'x1' does not exist on type '{ x: number; y: string; z: boolean; }'. var [a_x1, a_x2, a_x3, a_y, a_z] = [a.x1, a.x2, a.x3, a.y, a.z]; \ No newline at end of file diff --git a/tests/baselines/reference/incompatibleTypes.errors.txt b/tests/baselines/reference/incompatibleTypes.errors.txt index 504ff0088fa..9da3b9a8c89 100644 --- a/tests/baselines/reference/incompatibleTypes.errors.txt +++ b/tests/baselines/reference/incompatibleTypes.errors.txt @@ -19,9 +19,9 @@ tests/cases/compiler/incompatibleTypes.ts(42,5): error TS2345: Argument of type Type '() => string' is not assignable to type '(s: string) => number'. Type 'string' is not assignable to type 'number'. tests/cases/compiler/incompatibleTypes.ts(49,5): error TS2345: Argument of type '{ e: number; f: number; }' is not assignable to parameter of type '{ c: { b: string; }; d: string; }'. - Property 'c' is missing in type '{ e: number; f: number; }'. + Property 'e' does not exist on type '{ c: { b: string; }; d: string; }'. tests/cases/compiler/incompatibleTypes.ts(66,5): error TS2322: Type '{ e: number; f: number; }' is not assignable to type '{ a: { a: string; }; b: string; }'. - Property 'a' is missing in type '{ e: number; f: number; }'. + Property 'e' does not exist on type '{ a: { a: string; }; b: string; }'. tests/cases/compiler/incompatibleTypes.ts(72,5): error TS2322: Type 'number' is not assignable to type '() => string'. tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) => number' is not assignable to type '() => any'. @@ -103,7 +103,7 @@ tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) => of1({ e: 0, f: 0 }); ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '{ e: number; f: number; }' is not assignable to parameter of type '{ c: { b: string; }; d: string; }'. -!!! error TS2345: Property 'c' is missing in type '{ e: number; f: number; }'. +!!! error TS2345: Property 'e' does not exist on type '{ c: { b: string; }; d: string; }'. interface IMap { [key:string]:string; @@ -123,7 +123,7 @@ tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) => var o1: { a: { a: string; }; b: string; } = { e: 0, f: 0 }; ~~ !!! error TS2322: Type '{ e: number; f: number; }' is not assignable to type '{ a: { a: string; }; b: string; }'. -!!! error TS2322: Property 'a' is missing in type '{ e: number; f: number; }'. +!!! error TS2322: Property 'e' does not exist on type '{ a: { a: string; }; b: string; }'. var a1 = [{ e: 0, f: 0 }, { e: 0, f: 0 }, { e: 0, g: 0 }]; diff --git a/tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.errors.txt b/tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.errors.txt new file mode 100644 index 00000000000..cd0497b3bff --- /dev/null +++ b/tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrExpressionIsContextuallyTyped.ts(6,5): error TS2322: Type '{ a: string; b: number; } | { a: string; b: boolean; }' is not assignable to type '{ a: string; }'. + Type '{ a: string; b: number; }' is not assignable to type '{ a: string; }'. + Property 'b' does not exist on type '{ a: string; }'. + + +==== tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrExpressionIsContextuallyTyped.ts (1 errors) ==== + // The || operator permits the operands to be of any type. + // If the || expression is contextually typed, the operands are contextually typed by the + // same type and the result is of the best common type of the contextual type and the two + // operand types. + + var r: { a: string } = { a: '', b: 123 } || { a: '', b: true }; + ~ +!!! error TS2322: Type '{ a: string; b: number; } | { a: string; b: boolean; }' is not assignable to type '{ a: string; }'. +!!! error TS2322: Type '{ a: string; b: number; }' is not assignable to type '{ a: string; }'. +!!! error TS2322: Property 'b' does not exist on type '{ a: string; }'. \ No newline at end of file diff --git a/tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.symbols b/tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.symbols deleted file mode 100644 index 90fc4ac163c..00000000000 --- a/tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.symbols +++ /dev/null @@ -1,14 +0,0 @@ -=== tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrExpressionIsContextuallyTyped.ts === -// The || operator permits the operands to be of any type. -// If the || expression is contextually typed, the operands are contextually typed by the -// same type and the result is of the best common type of the contextual type and the two -// operand types. - -var r: { a: string } = { a: '', b: 123 } || { a: '', b: true }; ->r : Symbol(r, Decl(logicalOrExpressionIsContextuallyTyped.ts, 5, 3)) ->a : Symbol(a, Decl(logicalOrExpressionIsContextuallyTyped.ts, 5, 8)) ->a : Symbol(a, Decl(logicalOrExpressionIsContextuallyTyped.ts, 5, 24)) ->b : Symbol(b, Decl(logicalOrExpressionIsContextuallyTyped.ts, 5, 31)) ->a : Symbol(a, Decl(logicalOrExpressionIsContextuallyTyped.ts, 5, 45)) ->b : Symbol(b, Decl(logicalOrExpressionIsContextuallyTyped.ts, 5, 52)) - diff --git a/tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.types b/tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.types deleted file mode 100644 index 52315226bb6..00000000000 --- a/tests/baselines/reference/logicalOrExpressionIsContextuallyTyped.types +++ /dev/null @@ -1,21 +0,0 @@ -=== tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrExpressionIsContextuallyTyped.ts === -// The || operator permits the operands to be of any type. -// If the || expression is contextually typed, the operands are contextually typed by the -// same type and the result is of the best common type of the contextual type and the two -// operand types. - -var r: { a: string } = { a: '', b: 123 } || { a: '', b: true }; ->r : { a: string; } ->a : string ->{ a: '', b: 123 } || { a: '', b: true } : { a: string; b: number; } | { a: string; b: boolean; } ->{ a: '', b: 123 } : { a: string; b: number; } ->a : string ->'' : string ->b : number ->123 : number ->{ a: '', b: true } : { a: string; b: boolean; } ->a : string ->'' : string ->b : boolean ->true : boolean - diff --git a/tests/baselines/reference/objectLitStructuralTypeMismatch.errors.txt b/tests/baselines/reference/objectLitStructuralTypeMismatch.errors.txt index 0b218d3227b..e263b971561 100644 --- a/tests/baselines/reference/objectLitStructuralTypeMismatch.errors.txt +++ b/tests/baselines/reference/objectLitStructuralTypeMismatch.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/objectLitStructuralTypeMismatch.ts(2,5): error TS2322: Type '{ b: number; }' is not assignable to type '{ a: number; }'. - Property 'a' is missing in type '{ b: number; }'. + Property 'b' does not exist on type '{ a: number; }'. ==== tests/cases/compiler/objectLitStructuralTypeMismatch.ts (1 errors) ==== @@ -7,4 +7,4 @@ tests/cases/compiler/objectLitStructuralTypeMismatch.ts(2,5): error TS2322: Type var x: { a: number; } = { b: 5 }; ~ !!! error TS2322: Type '{ b: number; }' is not assignable to type '{ a: number; }'. -!!! error TS2322: Property 'a' is missing in type '{ b: number; }'. \ No newline at end of file +!!! error TS2322: Property 'b' does not exist on type '{ a: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralFunctionArgContextualTyping.errors.txt b/tests/baselines/reference/objectLiteralFunctionArgContextualTyping.errors.txt index f031031b0a8..c4b05fe9c49 100644 --- a/tests/baselines/reference/objectLiteralFunctionArgContextualTyping.errors.txt +++ b/tests/baselines/reference/objectLiteralFunctionArgContextualTyping.errors.txt @@ -1,5 +1,7 @@ tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts(8,4): error TS2345: Argument of type '{ hello: number; }' is not assignable to parameter of type 'I'. - Property 'value' is missing in type '{ hello: number; }'. + Property 'hello' does not exist on type 'I'. +tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts(10,4): error TS2345: Argument of type '{ value: string; what: number; }' is not assignable to parameter of type 'I'. + Property 'what' does not exist on type 'I'. tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts(11,4): error TS2345: Argument of type '{ toString: (s: string) => string; }' is not assignable to parameter of type 'I'. Property 'value' is missing in type '{ toString: (s: string) => string; }'. tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts(12,4): error TS2345: Argument of type '{ toString: (s: string) => string; }' is not assignable to parameter of type 'I'. @@ -7,7 +9,7 @@ tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts(12,4): error TS tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts(13,36): error TS2339: Property 'uhhh' does not exist on type 'string'. -==== tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts (4 errors) ==== +==== tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts (5 errors) ==== interface I { value: string; toString: (t: string) => string; @@ -18,9 +20,12 @@ tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts(13,36): error T f2({ hello: 1 }) // error ~~~~~~~~~~~~ !!! error TS2345: Argument of type '{ hello: number; }' is not assignable to parameter of type 'I'. -!!! error TS2345: Property 'value' is missing in type '{ hello: number; }'. +!!! error TS2345: Property 'hello' does not exist on type 'I'. f2({ value: '' }) // missing toString satisfied by Object's member f2({ value: '', what: 1 }) // missing toString satisfied by Object's member + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '{ value: string; what: number; }' is not assignable to parameter of type 'I'. +!!! error TS2345: Property 'what' does not exist on type 'I'. f2({ toString: (s) => s }) // error, missing property value from ArgsString ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '{ toString: (s: string) => string; }' is not assignable to parameter of type 'I'. diff --git a/tests/baselines/reference/objectLiteralFunctionArgContextualTyping2.errors.txt b/tests/baselines/reference/objectLiteralFunctionArgContextualTyping2.errors.txt index 7cb3304aa2f..6fdf156cadc 100644 --- a/tests/baselines/reference/objectLiteralFunctionArgContextualTyping2.errors.txt +++ b/tests/baselines/reference/objectLiteralFunctionArgContextualTyping2.errors.txt @@ -1,9 +1,9 @@ tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(8,4): error TS2345: Argument of type '{ hello: number; }' is not assignable to parameter of type 'I2'. - Property 'value' is missing in type '{ hello: number; }'. + Property 'hello' does not exist on type 'I2'. tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(9,4): error TS2345: Argument of type '{ value: string; }' is not assignable to parameter of type 'I2'. Property 'doStuff' is missing in type '{ value: string; }'. tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(10,4): error TS2345: Argument of type '{ value: string; what: number; }' is not assignable to parameter of type 'I2'. - Property 'doStuff' is missing in type '{ value: string; what: number; }'. + Property 'what' does not exist on type 'I2'. tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(11,4): error TS2345: Argument of type '{ toString: (s: any) => any; }' is not assignable to parameter of type 'I2'. Property 'value' is missing in type '{ toString: (s: any) => any; }'. tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(12,4): error TS2345: Argument of type '{ toString: (s: string) => string; }' is not assignable to parameter of type 'I2'. @@ -23,7 +23,7 @@ tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(13,4): error T f2({ hello: 1 }) ~~~~~~~~~~~~ !!! error TS2345: Argument of type '{ hello: number; }' is not assignable to parameter of type 'I2'. -!!! error TS2345: Property 'value' is missing in type '{ hello: number; }'. +!!! error TS2345: Property 'hello' does not exist on type 'I2'. f2({ value: '' }) ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '{ value: string; }' is not assignable to parameter of type 'I2'. @@ -31,7 +31,7 @@ tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(13,4): error T f2({ value: '', what: 1 }) ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '{ value: string; what: number; }' is not assignable to parameter of type 'I2'. -!!! error TS2345: Property 'doStuff' is missing in type '{ value: string; what: number; }'. +!!! error TS2345: Property 'what' does not exist on type 'I2'. f2({ toString: (s) => s }) ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '{ toString: (s: any) => any; }' is not assignable to parameter of type 'I2'. diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.errors.txt b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.errors.txt index f12e29f5117..36379f6e058 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.errors.txt +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(4,5): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'. - Property 'b' is missing in type '{ name: string; id: number; }'. + Property 'name' does not exist on type '{ b: string; id: number; }'. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(5,16): error TS1131: Property or signature expected. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(5,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'id' must be of type 'number', but here has type 'any'. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(5,25): error TS1128: Declaration or statement expected. @@ -18,7 +18,7 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr var person: { b: string; id: number } = { name, id }; // error ~~~~~~ !!! error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'. -!!! error TS2322: Property 'b' is missing in type '{ name: string; id: number; }'. +!!! error TS2322: Property 'name' does not exist on type '{ b: string; id: number; }'. var person1: { name, id }; // error: can't use short-hand property assignment in type position ~~~~ !!! error TS1131: Property or signature expected. diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.errors.txt b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.errors.txt index 26b0224f2b0..32f7733a22d 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.errors.txt +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(4,5): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'. - Property 'b' is missing in type '{ name: string; id: number; }'. + Property 'name' does not exist on type '{ b: string; id: number; }'. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(5,79): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ name: number; id: string; }'. Types of property 'name' are incompatible. Type 'string' is not assignable to type 'number'. @@ -18,7 +18,7 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr var person: { b: string; id: number } = { name, id }; // error ~~~~~~ !!! error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'. -!!! error TS2322: Property 'b' is missing in type '{ name: string; id: number; }'. +!!! error TS2322: Property 'name' does not exist on type '{ b: string; id: number; }'. function bar(name: string, id: number): { name: number, id: string } { return { name, id }; } // error ~~~~~~~~~~~~ !!! error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ name: number; id: string; }'. diff --git a/tests/baselines/reference/switchStatements.errors.txt b/tests/baselines/reference/switchStatements.errors.txt new file mode 100644 index 00000000000..09a799cc5cb --- /dev/null +++ b/tests/baselines/reference/switchStatements.errors.txt @@ -0,0 +1,63 @@ +tests/cases/conformance/statements/switchStatements/switchStatements.ts(35,10): error TS2322: Type '{ id: number; name: string; }' is not assignable to type 'C'. + Property 'name' does not exist on type 'C'. + + +==== tests/cases/conformance/statements/switchStatements/switchStatements.ts (1 errors) ==== + module M { + export function fn(x: number) { + return ''; + } + } + + var x: any; + switch (x) { + case '': + case 12: + case true: + case null: + case undefined: + case new Date(12): + case new Object(): + case /[a-z]/: + case[]: + case {}: + case { id: 12 }: + case['a']: + case typeof x: + case typeof M: + case M.fn(1): + case (x: number) => '': + case ((x: number) => '')(2): + default: + } + + // basic assignable check, rest covered in tests for 'assignement compatibility' + class C { id: number; } + class D extends C { name: string } + + switch (new C()) { + case new D(): + case { id: 12, name: '' }: + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '{ id: number; name: string; }' is not assignable to type 'C'. +!!! error TS2322: Property 'name' does not exist on type 'C'. + case new C(): + } + + switch ('') { } + switch (12) { } + switch (true) { } + switch (null) { } + switch (undefined) { } + switch (new Date(12)) { } + switch (new Object()) { } + switch (/[a-z]/) { } + switch ([]) { } + switch ({}) { } + switch ({ id: 12 }) { } + switch (['a']) { } + switch ((x: number) => '') { } + switch (((x: T) => '')(1)) { } + + + \ No newline at end of file diff --git a/tests/baselines/reference/switchStatements.symbols b/tests/baselines/reference/switchStatements.symbols deleted file mode 100644 index fc8f076a12c..00000000000 --- a/tests/baselines/reference/switchStatements.symbols +++ /dev/null @@ -1,115 +0,0 @@ -=== tests/cases/conformance/statements/switchStatements/switchStatements.ts === -module M { ->M : Symbol(M, Decl(switchStatements.ts, 0, 0)) - - export function fn(x: number) { ->fn : Symbol(fn, Decl(switchStatements.ts, 0, 10)) ->x : Symbol(x, Decl(switchStatements.ts, 1, 23)) - - return ''; - } -} - -var x: any; ->x : Symbol(x, Decl(switchStatements.ts, 6, 3)) - -switch (x) { ->x : Symbol(x, Decl(switchStatements.ts, 6, 3)) - - case '': - case 12: - case true: - case null: - case undefined: ->undefined : Symbol(undefined) - - case new Date(12): ->Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11)) - - case new Object(): ->Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11)) - - case /[a-z]/: - case[]: - case {}: - case { id: 12 }: ->id : Symbol(id, Decl(switchStatements.ts, 18, 10)) - - case['a']: - case typeof x: ->x : Symbol(x, Decl(switchStatements.ts, 6, 3)) - - case typeof M: ->M : Symbol(M, Decl(switchStatements.ts, 0, 0)) - - case M.fn(1): ->M.fn : Symbol(M.fn, Decl(switchStatements.ts, 0, 10)) ->M : Symbol(M, Decl(switchStatements.ts, 0, 0)) ->fn : Symbol(M.fn, Decl(switchStatements.ts, 0, 10)) - - case (x: number) => '': ->T : Symbol(T, Decl(switchStatements.ts, 23, 10)) ->x : Symbol(x, Decl(switchStatements.ts, 23, 13)) - - case ((x: number) => '')(2): ->T : Symbol(T, Decl(switchStatements.ts, 24, 11)) ->x : Symbol(x, Decl(switchStatements.ts, 24, 14)) - - default: -} - -// basic assignable check, rest covered in tests for 'assignement compatibility' -class C { id: number; } ->C : Symbol(C, Decl(switchStatements.ts, 26, 1)) ->id : Symbol(id, Decl(switchStatements.ts, 29, 9)) - -class D extends C { name: string } ->D : Symbol(D, Decl(switchStatements.ts, 29, 23)) ->C : Symbol(C, Decl(switchStatements.ts, 26, 1)) ->name : Symbol(name, Decl(switchStatements.ts, 30, 19)) - -switch (new C()) { ->C : Symbol(C, Decl(switchStatements.ts, 26, 1)) - - case new D(): ->D : Symbol(D, Decl(switchStatements.ts, 29, 23)) - - case { id: 12, name: '' }: ->id : Symbol(id, Decl(switchStatements.ts, 34, 10)) ->name : Symbol(name, Decl(switchStatements.ts, 34, 18)) - - case new C(): ->C : Symbol(C, Decl(switchStatements.ts, 26, 1)) -} - -switch ('') { } -switch (12) { } -switch (true) { } -switch (null) { } -switch (undefined) { } ->undefined : Symbol(undefined) - -switch (new Date(12)) { } ->Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11)) - -switch (new Object()) { } ->Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11)) - -switch (/[a-z]/) { } -switch ([]) { } -switch ({}) { } -switch ({ id: 12 }) { } ->id : Symbol(id, Decl(switchStatements.ts, 48, 9)) - -switch (['a']) { } -switch ((x: number) => '') { } ->T : Symbol(T, Decl(switchStatements.ts, 50, 9)) ->x : Symbol(x, Decl(switchStatements.ts, 50, 12)) - -switch (((x: T) => '')(1)) { } ->T : Symbol(T, Decl(switchStatements.ts, 51, 10)) ->x : Symbol(x, Decl(switchStatements.ts, 51, 13)) ->T : Symbol(T, Decl(switchStatements.ts, 51, 10)) - - - diff --git a/tests/baselines/reference/switchStatements.types b/tests/baselines/reference/switchStatements.types deleted file mode 100644 index a5679547c12..00000000000 --- a/tests/baselines/reference/switchStatements.types +++ /dev/null @@ -1,184 +0,0 @@ -=== tests/cases/conformance/statements/switchStatements/switchStatements.ts === -module M { ->M : typeof M - - export function fn(x: number) { ->fn : (x: number) => string ->x : number - - return ''; ->'' : string - } -} - -var x: any; ->x : any - -switch (x) { ->x : any - - case '': ->'' : string - - case 12: ->12 : number - - case true: ->true : boolean - - case null: ->null : null - - case undefined: ->undefined : undefined - - case new Date(12): ->new Date(12) : Date ->Date : DateConstructor ->12 : number - - case new Object(): ->new Object() : Object ->Object : ObjectConstructor - - case /[a-z]/: ->/[a-z]/ : RegExp - - case[]: ->[] : undefined[] - - case {}: ->{} : {} - - case { id: 12 }: ->{ id: 12 } : { id: number; } ->id : number ->12 : number - - case['a']: ->['a'] : string[] ->'a' : string - - case typeof x: ->typeof x : string ->x : any - - case typeof M: ->typeof M : string ->M : typeof M - - case M.fn(1): ->M.fn(1) : string ->M.fn : (x: number) => string ->M : typeof M ->fn : (x: number) => string ->1 : number - - case (x: number) => '': ->(x: number) => '' : (x: number) => string ->T : T ->x : number ->'' : string - - case ((x: number) => '')(2): ->((x: number) => '')(2) : string ->((x: number) => '') : (x: number) => string ->(x: number) => '' : (x: number) => string ->T : T ->x : number ->'' : string ->2 : number - - default: -} - -// basic assignable check, rest covered in tests for 'assignement compatibility' -class C { id: number; } ->C : C ->id : number - -class D extends C { name: string } ->D : D ->C : C ->name : string - -switch (new C()) { ->new C() : C ->C : typeof C - - case new D(): ->new D() : D ->D : typeof D - - case { id: 12, name: '' }: ->{ id: 12, name: '' } : { id: number; name: string; } ->id : number ->12 : number ->name : string ->'' : string - - case new C(): ->new C() : C ->C : typeof C -} - -switch ('') { } ->'' : string - -switch (12) { } ->12 : number - -switch (true) { } ->true : boolean - -switch (null) { } ->null : null - -switch (undefined) { } ->undefined : undefined - -switch (new Date(12)) { } ->new Date(12) : Date ->Date : DateConstructor ->12 : number - -switch (new Object()) { } ->new Object() : Object ->Object : ObjectConstructor - -switch (/[a-z]/) { } ->/[a-z]/ : RegExp - -switch ([]) { } ->[] : undefined[] - -switch ({}) { } ->{} : {} - -switch ({ id: 12 }) { } ->{ id: 12 } : { id: number; } ->id : number ->12 : number - -switch (['a']) { } ->['a'] : string[] ->'a' : string - -switch ((x: number) => '') { } ->(x: number) => '' : (x: number) => string ->T : T ->x : number ->'' : string - -switch (((x: T) => '')(1)) { } ->((x: T) => '')(1) : string ->((x: T) => '') : (x: T) => string ->(x: T) => '' : (x: T) => string ->T : T ->x : T ->T : T ->'' : string ->1 : number - - - diff --git a/tests/baselines/reference/symbolProperty21.errors.txt b/tests/baselines/reference/symbolProperty21.errors.txt new file mode 100644 index 00000000000..5bc0e20f75f --- /dev/null +++ b/tests/baselines/reference/symbolProperty21.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/es6/Symbols/symbolProperty21.ts(8,5): error TS2345: Argument of type '{ [Symbol.isConcatSpreadable]: string; [Symbol.toPrimitive]: number; [Symbol.unscopables]: boolean; }' is not assignable to parameter of type 'I'. + Property '[Symbol.toPrimitive]' does not exist on type 'I'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty21.ts (1 errors) ==== + interface I { + [Symbol.unscopables]: T; + [Symbol.isConcatSpreadable]: U; + } + + declare function foo(p: I): { t: T; u: U }; + + foo({ + ~ + [Symbol.isConcatSpreadable]: "", + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + [Symbol.toPrimitive]: 0, + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + [Symbol.unscopables]: true + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + }); + ~ +!!! error TS2345: Argument of type '{ [Symbol.isConcatSpreadable]: string; [Symbol.toPrimitive]: number; [Symbol.unscopables]: boolean; }' is not assignable to parameter of type 'I'. +!!! error TS2345: Property '[Symbol.toPrimitive]' does not exist on type 'I'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty21.symbols b/tests/baselines/reference/symbolProperty21.symbols deleted file mode 100644 index 09997f687d5..00000000000 --- a/tests/baselines/reference/symbolProperty21.symbols +++ /dev/null @@ -1,51 +0,0 @@ -=== tests/cases/conformance/es6/Symbols/symbolProperty21.ts === -interface I { ->I : Symbol(I, Decl(symbolProperty21.ts, 0, 0)) ->T : Symbol(T, Decl(symbolProperty21.ts, 0, 12)) ->U : Symbol(U, Decl(symbolProperty21.ts, 0, 14)) - - [Symbol.unscopables]: T; ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1297, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1297, 24)) ->T : Symbol(T, Decl(symbolProperty21.ts, 0, 12)) - - [Symbol.isConcatSpreadable]: U; ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) ->U : Symbol(U, Decl(symbolProperty21.ts, 0, 14)) -} - -declare function foo(p: I): { t: T; u: U }; ->foo : Symbol(foo, Decl(symbolProperty21.ts, 3, 1)) ->T : Symbol(T, Decl(symbolProperty21.ts, 5, 21)) ->U : Symbol(U, Decl(symbolProperty21.ts, 5, 23)) ->p : Symbol(p, Decl(symbolProperty21.ts, 5, 27)) ->I : Symbol(I, Decl(symbolProperty21.ts, 0, 0)) ->T : Symbol(T, Decl(symbolProperty21.ts, 5, 21)) ->U : Symbol(U, Decl(symbolProperty21.ts, 5, 23)) ->t : Symbol(t, Decl(symbolProperty21.ts, 5, 41)) ->T : Symbol(T, Decl(symbolProperty21.ts, 5, 21)) ->u : Symbol(u, Decl(symbolProperty21.ts, 5, 47)) ->U : Symbol(U, Decl(symbolProperty21.ts, 5, 23)) - -foo({ ->foo : Symbol(foo, Decl(symbolProperty21.ts, 3, 1)) - - [Symbol.isConcatSpreadable]: "", ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) - - [Symbol.toPrimitive]: 0, ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) - - [Symbol.unscopables]: true ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1297, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1297, 24)) - -}); diff --git a/tests/baselines/reference/symbolProperty21.types b/tests/baselines/reference/symbolProperty21.types deleted file mode 100644 index e2cda0a896f..00000000000 --- a/tests/baselines/reference/symbolProperty21.types +++ /dev/null @@ -1,56 +0,0 @@ -=== tests/cases/conformance/es6/Symbols/symbolProperty21.ts === -interface I { ->I : I ->T : T ->U : U - - [Symbol.unscopables]: T; ->Symbol.unscopables : symbol ->Symbol : SymbolConstructor ->unscopables : symbol ->T : T - - [Symbol.isConcatSpreadable]: U; ->Symbol.isConcatSpreadable : symbol ->Symbol : SymbolConstructor ->isConcatSpreadable : symbol ->U : U -} - -declare function foo(p: I): { t: T; u: U }; ->foo : (p: I) => { t: T; u: U; } ->T : T ->U : U ->p : I ->I : I ->T : T ->U : U ->t : T ->T : T ->u : U ->U : U - -foo({ ->foo({ [Symbol.isConcatSpreadable]: "", [Symbol.toPrimitive]: 0, [Symbol.unscopables]: true}) : { t: boolean; u: string; } ->foo : (p: I) => { t: T; u: U; } ->{ [Symbol.isConcatSpreadable]: "", [Symbol.toPrimitive]: 0, [Symbol.unscopables]: true} : { [Symbol.isConcatSpreadable]: string; [Symbol.toPrimitive]: number; [Symbol.unscopables]: boolean; } - - [Symbol.isConcatSpreadable]: "", ->Symbol.isConcatSpreadable : symbol ->Symbol : SymbolConstructor ->isConcatSpreadable : symbol ->"" : string - - [Symbol.toPrimitive]: 0, ->Symbol.toPrimitive : symbol ->Symbol : SymbolConstructor ->toPrimitive : symbol ->0 : number - - [Symbol.unscopables]: true ->Symbol.unscopables : symbol ->Symbol : SymbolConstructor ->unscopables : symbol ->true : boolean - -}); diff --git a/tests/baselines/reference/tsxAttributeResolution9.symbols b/tests/baselines/reference/tsxAttributeResolution9.symbols deleted file mode 100644 index 081482d5d47..00000000000 --- a/tests/baselines/reference/tsxAttributeResolution9.symbols +++ /dev/null @@ -1,47 +0,0 @@ -=== tests/cases/conformance/jsx/react.d.ts === - -declare module JSX { ->JSX : Symbol(JSX, Decl(react.d.ts, 0, 0)) - - interface Element { } ->Element : Symbol(Element, Decl(react.d.ts, 1, 20)) - - interface IntrinsicElements { ->IntrinsicElements : Symbol(IntrinsicElements, Decl(react.d.ts, 2, 22)) - } - interface ElementAttributesProperty { ->ElementAttributesProperty : Symbol(ElementAttributesProperty, Decl(react.d.ts, 4, 2)) - - props; ->props : Symbol(props, Decl(react.d.ts, 5, 38)) - } -} - -interface Props { ->Props : Symbol(Props, Decl(react.d.ts, 8, 1)) - - foo: string; ->foo : Symbol(foo, Decl(react.d.ts, 10, 17)) -} - -=== tests/cases/conformance/jsx/file.tsx === -export class MyComponent { ->MyComponent : Symbol(MyComponent, Decl(file.tsx, 0, 0)) - - render() { ->render : Symbol(render, Decl(file.tsx, 0, 26)) - } - - props: { foo: string; } ->props : Symbol(props, Decl(file.tsx, 2, 3)) ->foo : Symbol(foo, Decl(file.tsx, 4, 10)) -} - -; // ok ->MyComponent : Symbol(MyComponent, Decl(file.tsx, 0, 0)) ->foo : Symbol(unknown) - -; // should be an error ->MyComponent : Symbol(MyComponent, Decl(file.tsx, 0, 0)) ->foo : Symbol(unknown) - diff --git a/tests/baselines/reference/tsxAttributeResolution9.types b/tests/baselines/reference/tsxAttributeResolution9.types deleted file mode 100644 index 1b2c6d42389..00000000000 --- a/tests/baselines/reference/tsxAttributeResolution9.types +++ /dev/null @@ -1,49 +0,0 @@ -=== tests/cases/conformance/jsx/react.d.ts === - -declare module JSX { ->JSX : any - - interface Element { } ->Element : Element - - interface IntrinsicElements { ->IntrinsicElements : IntrinsicElements - } - interface ElementAttributesProperty { ->ElementAttributesProperty : ElementAttributesProperty - - props; ->props : any - } -} - -interface Props { ->Props : Props - - foo: string; ->foo : string -} - -=== tests/cases/conformance/jsx/file.tsx === -export class MyComponent { ->MyComponent : MyComponent - - render() { ->render : () => void - } - - props: { foo: string; } ->props : { foo: string; } ->foo : string -} - -; // ok -> : JSX.Element ->MyComponent : typeof MyComponent ->foo : any - -; // should be an error -> : JSX.Element ->MyComponent : typeof MyComponent ->foo : any - diff --git a/tests/baselines/reference/typeArgumentInference.errors.txt b/tests/baselines/reference/typeArgumentInference.errors.txt index 126fe3d772f..42b4593b7e1 100644 --- a/tests/baselines/reference/typeArgumentInference.errors.txt +++ b/tests/baselines/reference/typeArgumentInference.errors.txt @@ -3,9 +3,11 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(68,11 tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(82,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. Property 'z' is missing in type '{ x: number; y: string; }'. +tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(84,66): error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type 'A92'. + Property 'y' does not exist on type 'A92'. -==== tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts (2 errors) ==== +==== tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts (3 errors) ==== // Generic call with no parameters function noParams() { } noParams(); @@ -97,6 +99,9 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(82,11 !!! error TS2453: Property 'z' is missing in type '{ x: number; y: string; }'. var a9e: {}; var a9f = someGenerics9(undefined, { x: 6, z: new Date() }, { x: 6, y: '' }); + ~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type 'A92'. +!!! error TS2345: Property 'y' does not exist on type 'A92'. var a9f: A92; // Generic call with multiple parameters of generic type passed arguments with a single best common type diff --git a/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt b/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt index c82dab89e94..6443b55d94b 100644 --- a/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt +++ b/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt @@ -17,9 +17,11 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct Property 'z' is missing in type '{ x: number; y: string; }'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(120,51): error TS2304: Cannot find name 'window'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(122,56): error TS2304: Cannot find name 'window'. +tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(122,66): error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type 'A92'. + Property 'y' does not exist on type 'A92'. -==== tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts (10 errors) ==== +==== tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts (11 errors) ==== // Generic call with no parameters interface NoParams { new (); @@ -171,6 +173,9 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct var a9f = new someGenerics9(undefined, { x: 6, z: window }, { x: 6, y: '' }); ~~~~~~ !!! error TS2304: Cannot find name 'window'. + ~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type 'A92'. +!!! error TS2345: Property 'y' does not exist on type 'A92'. var a9f: A92; // Generic call with multiple parameters of generic type passed arguments with a single best common type diff --git a/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt b/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt index 56370ac03d5..3a6ae294ea3 100644 --- a/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt +++ b/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt @@ -22,9 +22,11 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst Property 'z' is missing in type '{ x: number; y: string; }'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(87,47): error TS2304: Cannot find name 'window'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(89,52): error TS2304: Cannot find name 'window'. +tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(89,62): error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type 'A92'. + Property 'y' does not exist on type 'A92'. -==== tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts (15 errors) ==== +==== tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts (16 errors) ==== // Generic call with no parameters function noParams() { } noParams(); @@ -153,6 +155,9 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst var a9f = someGenerics9(undefined, { x: 6, z: window }, { x: 6, y: '' }); ~~~~~~ !!! error TS2304: Cannot find name 'window'. + ~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type 'A92'. +!!! error TS2345: Property 'y' does not exist on type 'A92'. var a9f: A92; // Generic call with multiple parameters of generic type passed arguments with a single best common type diff --git a/tests/baselines/reference/typeInfer1.errors.txt b/tests/baselines/reference/typeInfer1.errors.txt index cce736e2531..e7653ecd3a5 100644 --- a/tests/baselines/reference/typeInfer1.errors.txt +++ b/tests/baselines/reference/typeInfer1.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/typeInfer1.ts(11,5): error TS2322: Type '{ Moo: () => string; }' is not assignable to type 'ITextWriter2'. - Property 'Write' is missing in type '{ Moo: () => string; }'. + Property 'Moo' does not exist on type 'ITextWriter2'. ==== tests/cases/compiler/typeInfer1.ts (1 errors) ==== @@ -16,6 +16,6 @@ tests/cases/compiler/typeInfer1.ts(11,5): error TS2322: Type '{ Moo: () => strin var yyyyyyyy: ITextWriter2 = { ~~~~~~~~ !!! error TS2322: Type '{ Moo: () => string; }' is not assignable to type 'ITextWriter2'. -!!! error TS2322: Property 'Write' is missing in type '{ Moo: () => string; }'. +!!! error TS2322: Property 'Moo' does not exist on type 'ITextWriter2'. Moo: function() { return "cow"; } } \ No newline at end of file diff --git a/tests/baselines/reference/typeMatch2.errors.txt b/tests/baselines/reference/typeMatch2.errors.txt index 4db4828064e..847cfbaf407 100644 --- a/tests/baselines/reference/typeMatch2.errors.txt +++ b/tests/baselines/reference/typeMatch2.errors.txt @@ -2,8 +2,10 @@ tests/cases/compiler/typeMatch2.ts(3,2): error TS2322: Type '{}' is not assignab Property 'x' is missing in type '{}'. tests/cases/compiler/typeMatch2.ts(4,5): error TS2322: Type '{ x: number; }' is not assignable to type '{ x: number; y: number; }'. Property 'y' is missing in type '{ x: number; }'. +tests/cases/compiler/typeMatch2.ts(5,2): error TS2322: Type '{ x: number; y: number; z: number; }' is not assignable to type '{ x: number; y: number; }'. + Property 'z' does not exist on type '{ x: number; y: number; }'. tests/cases/compiler/typeMatch2.ts(6,5): error TS2322: Type '{ x: number; z: number; }' is not assignable to type '{ x: number; y: number; }'. - Property 'y' is missing in type '{ x: number; z: number; }'. + Property 'z' does not exist on type '{ x: number; y: number; }'. tests/cases/compiler/typeMatch2.ts(18,5): error TS2322: Type 'Animal[]' is not assignable to type 'Giraffe[]'. Type 'Animal' is not assignable to type 'Giraffe'. Property 'g' is missing in type 'Animal'. @@ -11,11 +13,13 @@ tests/cases/compiler/typeMatch2.ts(22,5): error TS2322: Type '{ f1: number; f2: Types of property 'f2' are incompatible. Type 'Animal[]' is not assignable to type 'Giraffe[]'. Type 'Animal' is not assignable to type 'Giraffe'. +tests/cases/compiler/typeMatch2.ts(34,5): error TS2322: Type '{ x: number; y: any; z: number; }' is not assignable to type '{ x: number; y: number; }'. + Property 'z' does not exist on type '{ x: number; y: number; }'. tests/cases/compiler/typeMatch2.ts(35,5): error TS2322: Type '{ x: number; }' is not assignable to type '{ x: number; y: number; }'. Property 'y' is missing in type '{ x: number; }'. -==== tests/cases/compiler/typeMatch2.ts (6 errors) ==== +==== tests/cases/compiler/typeMatch2.ts (8 errors) ==== function f1() { var a = { x: 1, y: 2 }; a = {}; // error @@ -27,10 +31,13 @@ tests/cases/compiler/typeMatch2.ts(35,5): error TS2322: Type '{ x: number; }' is !!! error TS2322: Type '{ x: number; }' is not assignable to type '{ x: number; y: number; }'. !!! error TS2322: Property 'y' is missing in type '{ x: number; }'. a = { x: 1, y: 2, z: 3 }; + ~ +!!! error TS2322: Type '{ x: number; y: number; z: number; }' is not assignable to type '{ x: number; y: number; }'. +!!! error TS2322: Property 'z' does not exist on type '{ x: number; y: number; }'. a = { x: 1, z: 3 }; // error ~ !!! error TS2322: Type '{ x: number; z: number; }' is not assignable to type '{ x: number; y: number; }'. -!!! error TS2322: Property 'y' is missing in type '{ x: number; z: number; }'. +!!! error TS2322: Property 'z' does not exist on type '{ x: number; y: number; }'. } class Animal { private a; } @@ -68,6 +75,9 @@ tests/cases/compiler/typeMatch2.ts(35,5): error TS2322: Type '{ x: number; }' is a = { x: 1, y: undefined }; a = { x: 1, y: _any }; a = { x: 1, y: _any, z:1 }; + ~ +!!! error TS2322: Type '{ x: number; y: any; z: number; }' is not assignable to type '{ x: number; y: number; }'. +!!! error TS2322: Property 'z' does not exist on type '{ x: number; y: number; }'. a = { x: 1 }; // error ~ !!! error TS2322: Type '{ x: number; }' is not assignable to type '{ x: number; y: number; }'.