Accept new baselines

This commit is contained in:
Anders Hejlsberg
2018-10-29 16:07:42 -07:00
parent 7a47248f30
commit 00c30156c6
8 changed files with 36 additions and 81 deletions

View File

@@ -5,11 +5,10 @@ tests/cases/conformance/types/rest/objectRestNegative.ts(6,10): error TS2322: Ty
tests/cases/conformance/types/rest/objectRestNegative.ts(9,31): error TS2462: A rest element must be last in a destructuring pattern.
tests/cases/conformance/types/rest/objectRestNegative.ts(11,30): error TS7008: Member 'x' implicitly has an 'any' type.
tests/cases/conformance/types/rest/objectRestNegative.ts(11,33): error TS7008: Member 'y' implicitly has an 'any' type.
tests/cases/conformance/types/rest/objectRestNegative.ts(12,17): error TS2700: Rest types may only be created from object types.
tests/cases/conformance/types/rest/objectRestNegative.ts(17,9): error TS2701: The target of an object rest assignment must be a variable or a property access.
==== tests/cases/conformance/types/rest/objectRestNegative.ts (7 errors) ====
==== tests/cases/conformance/types/rest/objectRestNegative.ts (6 errors) ====
let o = { a: 1, b: 'no' };
var { ...mustBeLast, a } = o;
~~~~~~~~~~
@@ -34,8 +33,6 @@ tests/cases/conformance/types/rest/objectRestNegative.ts(17,9): error TS2701: Th
~
!!! error TS7008: Member 'y' implicitly has an 'any' type.
let { x, ...rest } = t;
~~~~
!!! error TS2700: Rest types may only be created from object types.
return rest;
}

View File

@@ -36,18 +36,18 @@ function stillMustBeLast({ ...mustBeLast, a }: { a: number, b: string }): void {
>b : string
}
function generic<T extends { x, y }>(t: T) {
>generic : <T extends { x: any; y: any; }>(t: T) => any
>generic : <T extends { x: any; y: any; }>(t: T) => { y: any; }
>x : any
>y : any
>t : T
let { x, ...rest } = t;
>x : any
>rest : any
>rest : { y: any; }
>t : T
return rest;
>rest : any
>rest : { y: any; }
}
let rest: { b: string }

View File

@@ -16,11 +16,9 @@ tests/cases/conformance/types/spread/objectSpreadNegative.ts(43,1): error TS2349
tests/cases/conformance/types/spread/objectSpreadNegative.ts(47,12): error TS2339: Property 'b' does not exist on type '{}'.
tests/cases/conformance/types/spread/objectSpreadNegative.ts(53,9): error TS2339: Property 'm' does not exist on type '{ p: number; }'.
tests/cases/conformance/types/spread/objectSpreadNegative.ts(58,11): error TS2339: Property 'a' does not exist on type '{}'.
tests/cases/conformance/types/spread/objectSpreadNegative.ts(62,14): error TS2698: Spread types may only be created from object types.
tests/cases/conformance/types/spread/objectSpreadNegative.ts(65,14): error TS2698: Spread types may only be created from object types.
==== tests/cases/conformance/types/spread/objectSpreadNegative.ts (17 errors) ====
==== tests/cases/conformance/types/spread/objectSpreadNegative.ts (15 errors) ====
let o = { a: 1, b: 'no' }
/// private propagates
@@ -116,13 +114,9 @@ tests/cases/conformance/types/spread/objectSpreadNegative.ts(65,14): error TS269
// generics
function f<T, U>(t: T, u: U) {
return { ...t, ...u, id: 'id' };
~~~~
!!! error TS2698: Spread types may only be created from object types.
}
function override<U>(initial: U, override: U): U {
return { ...initial, ...override };
~~~~~~~~~~
!!! error TS2698: Spread types may only be created from object types.
}
let exclusive: { id: string, a: number, b: string, c: string, d: boolean } =
f({ a: 1, b: 'yes' }, { c: 'no', d: false })

View File

@@ -228,12 +228,12 @@ spreadObj.a; // error 'a' is not in {}
// generics
function f<T, U>(t: T, u: U) {
>f : <T, U>(t: T, u: U) => any
>f : <T, U>(t: T, u: U) => T & U & { id: string; }
>t : T
>u : U
return { ...t, ...u, id: 'id' };
>{ ...t, ...u, id: 'id' } : any
>{ ...t, ...u, id: 'id' } : T & U & { id: string; }
>t : T
>u : U
>id : string
@@ -245,7 +245,7 @@ function override<U>(initial: U, override: U): U {
>override : U
return { ...initial, ...override };
>{ ...initial, ...override } : any
>{ ...initial, ...override } : U
>initial : U
>override : U
}
@@ -258,8 +258,8 @@ let exclusive: { id: string, a: number, b: string, c: string, d: boolean } =
>d : boolean
f({ a: 1, b: 'yes' }, { c: 'no', d: false })
>f({ a: 1, b: 'yes' }, { c: 'no', d: false }) : any
>f : <T, U>(t: T, u: U) => any
>f({ a: 1, b: 'yes' }, { c: 'no', d: false }) : { a: number; b: string; } & { c: string; d: boolean; } & { id: string; }
>f : <T, U>(t: T, u: U) => T & U & { id: string; }
>{ a: 1, b: 'yes' } : { a: number; b: string; }
>a : number
>1 : 1
@@ -278,8 +278,8 @@ let overlap: { id: string, a: number, b: string } =
>b : string
f({ a: 1 }, { a: 2, b: 'extra' })
>f({ a: 1 }, { a: 2, b: 'extra' }) : any
>f : <T, U>(t: T, u: U) => any
>f({ a: 1 }, { a: 2, b: 'extra' }) : { a: number; } & { a: number; b: string; } & { id: string; }
>f : <T, U>(t: T, u: U) => T & U & { id: string; }
>{ a: 1 } : { a: number; }
>a : number
>1 : 1
@@ -295,8 +295,8 @@ let overlapConflict: { id:string, a: string } =
>a : string
f({ a: 1 }, { a: 'mismatch' })
>f({ a: 1 }, { a: 'mismatch' }) : any
>f : <T, U>(t: T, u: U) => any
>f({ a: 1 }, { a: 'mismatch' }) : { a: number; } & { a: string; } & { id: string; }
>f : <T, U>(t: T, u: U) => T & U & { id: string; }
>{ a: 1 } : { a: number; }
>a : number
>1 : 1
@@ -312,8 +312,8 @@ let overwriteId: { id: string, a: number, c: number, d: string } =
>d : string
f({ a: 1, id: true }, { c: 1, d: 'no' })
>f({ a: 1, id: true }, { c: 1, d: 'no' }) : any
>f : <T, U>(t: T, u: U) => any
>f({ a: 1, id: true }, { c: 1, d: 'no' }) : { a: number; id: boolean; } & { c: number; d: string; } & { id: string; }
>f : <T, U>(t: T, u: U) => T & U & { id: string; }
>{ a: 1, id: true } : { a: number; id: true; }
>a : number
>1 : 1

View File

@@ -1,11 +1,5 @@
tests/cases/compiler/restInvalidArgumentType.ts(27,13): error TS2700: Rest types may only be created from object types.
tests/cases/compiler/restInvalidArgumentType.ts(29,13): error TS2700: Rest types may only be created from object types.
tests/cases/compiler/restInvalidArgumentType.ts(30,13): error TS2700: Rest types may only be created from object types.
tests/cases/compiler/restInvalidArgumentType.ts(31,13): error TS2700: Rest types may only be created from object types.
tests/cases/compiler/restInvalidArgumentType.ts(33,13): error TS2700: Rest types may only be created from object types.
tests/cases/compiler/restInvalidArgumentType.ts(36,13): error TS2700: Rest types may only be created from object types.
tests/cases/compiler/restInvalidArgumentType.ts(37,13): error TS2700: Rest types may only be created from object types.
tests/cases/compiler/restInvalidArgumentType.ts(39,13): error TS2700: Rest types may only be created from object types.
tests/cases/compiler/restInvalidArgumentType.ts(40,13): error TS2700: Rest types may only be created from object types.
tests/cases/compiler/restInvalidArgumentType.ts(42,13): error TS2700: Rest types may only be created from object types.
tests/cases/compiler/restInvalidArgumentType.ts(43,13): error TS2700: Rest types may only be created from object types.
@@ -16,7 +10,7 @@ tests/cases/compiler/restInvalidArgumentType.ts(51,13): error TS2700: Rest types
tests/cases/compiler/restInvalidArgumentType.ts(53,13): error TS2700: Rest types may only be created from object types.
==== tests/cases/compiler/restInvalidArgumentType.ts (16 errors) ====
==== tests/cases/compiler/restInvalidArgumentType.ts (10 errors) ====
enum E { v1, v2 };
function f<T extends { b: string }>(p1: T, p2: T[]) {
@@ -44,34 +38,22 @@ tests/cases/compiler/restInvalidArgumentType.ts(53,13): error TS2700: Rest types
var a: any;
var {...r1} = p1; // Error, generic type paramterre
~~
!!! error TS2700: Rest types may only be created from object types.
var {...r2} = p2; // OK
var {...r3} = t; // Error, generic type paramter
~~
!!! error TS2700: Rest types may only be created from object types.
var {...r4} = i; // Error, index access
~~
!!! error TS2700: Rest types may only be created from object types.
var {...r5} = k; // Error, index
~~
!!! error TS2700: Rest types may only be created from object types.
var {...r6} = mapped_generic; // Error, generic mapped object type
~~
!!! error TS2700: Rest types may only be created from object types.
var {...r7} = mapped; // OK, non-generic mapped type
var {...r8} = union_generic; // Error, union with generic type parameter
~~
!!! error TS2700: Rest types may only be created from object types.
var {...r9} = union_primitive; // Error, union with generic type parameter
~~
!!! error TS2700: Rest types may only be created from object types.
var {...r10} = intersection_generic; // Error, intersection with generic type parameter
~~~
!!! error TS2700: Rest types may only be created from object types.
var {...r11} = intersection_primitive; // Error, intersection with generic type parameter
~~~
!!! error TS2700: Rest types may only be created from object types.

View File

@@ -67,7 +67,7 @@ function f<T extends { b: string }>(p1: T, p2: T[]) {
>a : any
var {...r1} = p1; // Error, generic type paramterre
>r1 : any
>r1 : { b: string; }
>p1 : T
var {...r2} = p2; // OK
@@ -75,11 +75,11 @@ function f<T extends { b: string }>(p1: T, p2: T[]) {
>p2 : T[]
var {...r3} = t; // Error, generic type paramter
>r3 : any
>r3 : { b: string; }
>t : T
var {...r4} = i; // Error, index access
>r4 : any
>r4 : { readonly [index: number]: string; toString(): string; charAt(pos: number): string; charCodeAt(index: number): number; concat(...strings: string[]): string; indexOf(searchString: string, position?: number): number; lastIndexOf(searchString: string, position?: number): number; localeCompare(that: string): number; localeCompare(that: string, locales?: string | string[], options?: Intl.CollatorOptions): number; match(regexp: string | RegExp): RegExpMatchArray; replace(searchValue: string | RegExp, replaceValue: string): string; replace(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; search(regexp: string | RegExp): number; slice(start?: number, end?: number): string; split(separator: string | RegExp, limit?: number): string[]; substring(start: number, end?: number): string; toLowerCase(): string; toLocaleLowerCase(): string; toUpperCase(): string; toLocaleUpperCase(): string; trim(): string; length: number; substr(from: number, length?: number): string; valueOf(): string; }
>i : T["b"]
var {...r5} = k; // Error, index
@@ -87,7 +87,7 @@ function f<T extends { b: string }>(p1: T, p2: T[]) {
>k : keyof T
var {...r6} = mapped_generic; // Error, generic mapped object type
>r6 : any
>r6 : { b: T["b"]; }
>mapped_generic : { [P in keyof T]: T[P]; }
var {...r7} = mapped; // OK, non-generic mapped type
@@ -95,7 +95,7 @@ function f<T extends { b: string }>(p1: T, p2: T[]) {
>mapped : { b: T["b"]; }
var {...r8} = union_generic; // Error, union with generic type parameter
>r8 : any
>r8 : { b: string; } | { a: number; }
>union_generic : T | { a: number; }
var {...r9} = union_primitive; // Error, union with generic type parameter
@@ -103,7 +103,7 @@ function f<T extends { b: string }>(p1: T, p2: T[]) {
>union_primitive : number | { a: number; }
var {...r10} = intersection_generic; // Error, intersection with generic type parameter
>r10 : any
>r10 : { b: string; a: number; }
>intersection_generic : T & { a: number; }
var {...r11} = intersection_primitive; // Error, intersection with generic type parameter

View File

@@ -1,11 +1,5 @@
tests/cases/compiler/spreadInvalidArgumentType.ts(30,16): error TS2698: Spread types may only be created from object types.
tests/cases/compiler/spreadInvalidArgumentType.ts(32,16): error TS2698: Spread types may only be created from object types.
tests/cases/compiler/spreadInvalidArgumentType.ts(33,16): error TS2698: Spread types may only be created from object types.
tests/cases/compiler/spreadInvalidArgumentType.ts(34,16): error TS2698: Spread types may only be created from object types.
tests/cases/compiler/spreadInvalidArgumentType.ts(35,16): error TS2698: Spread types may only be created from object types.
tests/cases/compiler/spreadInvalidArgumentType.ts(38,16): error TS2698: Spread types may only be created from object types.
tests/cases/compiler/spreadInvalidArgumentType.ts(39,16): error TS2698: Spread types may only be created from object types.
tests/cases/compiler/spreadInvalidArgumentType.ts(41,17): error TS2698: Spread types may only be created from object types.
tests/cases/compiler/spreadInvalidArgumentType.ts(42,17): error TS2698: Spread types may only be created from object types.
tests/cases/compiler/spreadInvalidArgumentType.ts(44,17): error TS2698: Spread types may only be created from object types.
tests/cases/compiler/spreadInvalidArgumentType.ts(45,17): error TS2698: Spread types may only be created from object types.
@@ -16,7 +10,7 @@ tests/cases/compiler/spreadInvalidArgumentType.ts(53,17): error TS2698: Spread t
tests/cases/compiler/spreadInvalidArgumentType.ts(55,17): error TS2698: Spread types may only be created from object types.
==== tests/cases/compiler/spreadInvalidArgumentType.ts (16 errors) ====
==== tests/cases/compiler/spreadInvalidArgumentType.ts (10 errors) ====
enum E { v1, v2 };
function f<T extends { b: string }>(p1: T, p2: T[]) {
@@ -47,33 +41,21 @@ tests/cases/compiler/spreadInvalidArgumentType.ts(55,17): error TS2698: Spread t
var e: E;
var o1 = { ...p1 }; // Error, generic type paramterre
~~~~~
!!! error TS2698: Spread types may only be created from object types.
var o2 = { ...p2 }; // OK
var o3 = { ...t }; // Error, generic type paramter
~~~~
!!! error TS2698: Spread types may only be created from object types.
var o4 = { ...i }; // Error, index access
~~~~
!!! error TS2698: Spread types may only be created from object types.
var o5 = { ...k }; // Error, index
~~~~
!!! error TS2698: Spread types may only be created from object types.
var o6 = { ...mapped_generic }; // Error, generic mapped object type
~~~~~~~~~~~~~~~~~
!!! error TS2698: Spread types may only be created from object types.
var o7 = { ...mapped }; // OK, non-generic mapped type
var o8 = { ...union_generic }; // Error, union with generic type parameter
~~~~~~~~~~~~~~~~
!!! error TS2698: Spread types may only be created from object types.
var o9 = { ...union_primitive }; // Error, union with generic type parameter
~~~~~~~~~~~~~~~~~~
!!! error TS2698: Spread types may only be created from object types.
var o10 = { ...intersection_generic }; // Error, intersection with generic type parameter
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2698: Spread types may only be created from object types.
var o11 = { ...intersection_primitive }; // Error, intersection with generic type parameter
~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2698: Spread types may only be created from object types.

View File

@@ -68,8 +68,8 @@ function f<T extends { b: string }>(p1: T, p2: T[]) {
>e : E
var o1 = { ...p1 }; // Error, generic type paramterre
>o1 : any
>{ ...p1 } : any
>o1 : T
>{ ...p1 } : T
>p1 : T
var o2 = { ...p2 }; // OK
@@ -78,13 +78,13 @@ function f<T extends { b: string }>(p1: T, p2: T[]) {
>p2 : T[]
var o3 = { ...t }; // Error, generic type paramter
>o3 : any
>{ ...t } : any
>o3 : T
>{ ...t } : T
>t : T
var o4 = { ...i }; // Error, index access
>o4 : any
>{ ...i } : any
>o4 : T["b"]
>{ ...i } : T["b"]
>i : T["b"]
var o5 = { ...k }; // Error, index
@@ -93,8 +93,8 @@ function f<T extends { b: string }>(p1: T, p2: T[]) {
>k : keyof T
var o6 = { ...mapped_generic }; // Error, generic mapped object type
>o6 : any
>{ ...mapped_generic } : any
>o6 : { [P in keyof T]: T[P]; }
>{ ...mapped_generic } : { [P in keyof T]: T[P]; }
>mapped_generic : { [P in keyof T]: T[P]; }
var o7 = { ...mapped }; // OK, non-generic mapped type
@@ -103,8 +103,8 @@ function f<T extends { b: string }>(p1: T, p2: T[]) {
>mapped : { b: T["b"]; }
var o8 = { ...union_generic }; // Error, union with generic type parameter
>o8 : any
>{ ...union_generic } : any
>o8 : T | { a: number; }
>{ ...union_generic } : T | { a: number; }
>union_generic : T | { a: number; }
var o9 = { ...union_primitive }; // Error, union with generic type parameter
@@ -113,8 +113,8 @@ function f<T extends { b: string }>(p1: T, p2: T[]) {
>union_primitive : number | { a: number; }
var o10 = { ...intersection_generic }; // Error, intersection with generic type parameter
>o10 : any
>{ ...intersection_generic } : any
>o10 : T & { a: number; }
>{ ...intersection_generic } : T & { a: number; }
>intersection_generic : T & { a: number; }
var o11 = { ...intersection_primitive }; // Error, intersection with generic type parameter