Accept new baselines
This commit is contained in:
parent
c58157573e
commit
42be36d182
4 changed files with 152 additions and 1 deletions
|
@ -1,7 +1,13 @@
|
|||
tests/cases/compiler/inferFromGenericFunctionReturnTypes3.ts(28,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"bar"'.
|
||||
tests/cases/compiler/inferFromGenericFunctionReturnTypes3.ts(175,47): error TS2322: Type 'boolean' is not assignable to type 'true'.
|
||||
tests/cases/compiler/inferFromGenericFunctionReturnTypes3.ts(180,26): error TS2322: Type '{ state: State.A; }[] | { state: State.B; }[]' is not assignable to type '{ state: State.A; }[]'.
|
||||
Type '{ state: State.B; }[]' is not assignable to type '{ state: State.A; }[]'.
|
||||
Type '{ state: State.B; }' is not assignable to type '{ state: State.A; }'.
|
||||
Types of property 'state' are incompatible.
|
||||
Type 'State.B' is not assignable to type 'State.A'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/inferFromGenericFunctionReturnTypes3.ts (1 errors) ====
|
||||
==== tests/cases/compiler/inferFromGenericFunctionReturnTypes3.ts (3 errors) ====
|
||||
// Repros from #5487
|
||||
|
||||
function truePromise(): Promise<true> {
|
||||
|
@ -174,4 +180,24 @@ tests/cases/compiler/inferFromGenericFunctionReturnTypes3.ts(28,30): error TS234
|
|||
}
|
||||
]);
|
||||
};
|
||||
|
||||
// Breaking change repros from #29478
|
||||
|
||||
declare function foldLeft<U>(z: U, f: (acc: U, t: boolean) => U): U;
|
||||
let res: boolean = foldLeft(true, (acc, t) => acc && t); // Error
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'true'.
|
||||
!!! related TS6502 tests/cases/compiler/inferFromGenericFunctionReturnTypes3.ts:174:39: The expected type comes from the return type of this signature.
|
||||
|
||||
enum State { A, B }
|
||||
type Foo = { state: State }
|
||||
declare function bar<T>(f: () => T[]): T[];
|
||||
let x: Foo[] = bar(() => !!true ? [{ state: State.A }] : [{ state: State.B }]); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ state: State.A; }[] | { state: State.B; }[]' is not assignable to type '{ state: State.A; }[]'.
|
||||
!!! error TS2322: Type '{ state: State.B; }[]' is not assignable to type '{ state: State.A; }[]'.
|
||||
!!! error TS2322: Type '{ state: State.B; }' is not assignable to type '{ state: State.A; }'.
|
||||
!!! error TS2322: Types of property 'state' are incompatible.
|
||||
!!! error TS2322: Type 'State.B' is not assignable to type 'State.A'.
|
||||
!!! related TS6502 tests/cases/compiler/inferFromGenericFunctionReturnTypes3.ts:179:28: The expected type comes from the return type of this signature.
|
||||
|
|
@ -169,6 +169,16 @@ const f1: F = () => {
|
|||
}
|
||||
]);
|
||||
};
|
||||
|
||||
// Breaking change repros from #29478
|
||||
|
||||
declare function foldLeft<U>(z: U, f: (acc: U, t: boolean) => U): U;
|
||||
let res: boolean = foldLeft(true, (acc, t) => acc && t); // Error
|
||||
|
||||
enum State { A, B }
|
||||
type Foo = { state: State }
|
||||
declare function bar<T>(f: () => T[]): T[];
|
||||
let x: Foo[] = bar(() => !!true ? [{ state: State.A }] : [{ state: State.B }]); // Error
|
||||
|
||||
|
||||
//// [inferFromGenericFunctionReturnTypes3.js]
|
||||
|
@ -261,6 +271,13 @@ const f1 = () => {
|
|||
}
|
||||
]);
|
||||
};
|
||||
let res = foldLeft(true, (acc, t) => acc && t); // Error
|
||||
var State;
|
||||
(function (State) {
|
||||
State[State["A"] = 0] = "A";
|
||||
State[State["B"] = 1] = "B";
|
||||
})(State || (State = {}));
|
||||
let x = bar(() => !!true ? [{ state: State.A }] : [{ state: State.B }]); // Error
|
||||
|
||||
|
||||
//// [inferFromGenericFunctionReturnTypes3.d.ts]
|
||||
|
|
|
@ -407,3 +407,55 @@ const f1: F = () => {
|
|||
]);
|
||||
};
|
||||
|
||||
// Breaking change repros from #29478
|
||||
|
||||
declare function foldLeft<U>(z: U, f: (acc: U, t: boolean) => U): U;
|
||||
>foldLeft : Symbol(foldLeft, Decl(inferFromGenericFunctionReturnTypes3.ts, 169, 2))
|
||||
>U : Symbol(U, Decl(inferFromGenericFunctionReturnTypes3.ts, 173, 26))
|
||||
>z : Symbol(z, Decl(inferFromGenericFunctionReturnTypes3.ts, 173, 29))
|
||||
>U : Symbol(U, Decl(inferFromGenericFunctionReturnTypes3.ts, 173, 26))
|
||||
>f : Symbol(f, Decl(inferFromGenericFunctionReturnTypes3.ts, 173, 34))
|
||||
>acc : Symbol(acc, Decl(inferFromGenericFunctionReturnTypes3.ts, 173, 39))
|
||||
>U : Symbol(U, Decl(inferFromGenericFunctionReturnTypes3.ts, 173, 26))
|
||||
>t : Symbol(t, Decl(inferFromGenericFunctionReturnTypes3.ts, 173, 46))
|
||||
>U : Symbol(U, Decl(inferFromGenericFunctionReturnTypes3.ts, 173, 26))
|
||||
>U : Symbol(U, Decl(inferFromGenericFunctionReturnTypes3.ts, 173, 26))
|
||||
|
||||
let res: boolean = foldLeft(true, (acc, t) => acc && t); // Error
|
||||
>res : Symbol(res, Decl(inferFromGenericFunctionReturnTypes3.ts, 174, 3))
|
||||
>foldLeft : Symbol(foldLeft, Decl(inferFromGenericFunctionReturnTypes3.ts, 169, 2))
|
||||
>acc : Symbol(acc, Decl(inferFromGenericFunctionReturnTypes3.ts, 174, 35))
|
||||
>t : Symbol(t, Decl(inferFromGenericFunctionReturnTypes3.ts, 174, 39))
|
||||
>acc : Symbol(acc, Decl(inferFromGenericFunctionReturnTypes3.ts, 174, 35))
|
||||
>t : Symbol(t, Decl(inferFromGenericFunctionReturnTypes3.ts, 174, 39))
|
||||
|
||||
enum State { A, B }
|
||||
>State : Symbol(State, Decl(inferFromGenericFunctionReturnTypes3.ts, 174, 56))
|
||||
>A : Symbol(State.A, Decl(inferFromGenericFunctionReturnTypes3.ts, 176, 12))
|
||||
>B : Symbol(State.B, Decl(inferFromGenericFunctionReturnTypes3.ts, 176, 15))
|
||||
|
||||
type Foo = { state: State }
|
||||
>Foo : Symbol(Foo, Decl(inferFromGenericFunctionReturnTypes3.ts, 176, 19))
|
||||
>state : Symbol(state, Decl(inferFromGenericFunctionReturnTypes3.ts, 177, 12))
|
||||
>State : Symbol(State, Decl(inferFromGenericFunctionReturnTypes3.ts, 174, 56))
|
||||
|
||||
declare function bar<T>(f: () => T[]): T[];
|
||||
>bar : Symbol(bar, Decl(inferFromGenericFunctionReturnTypes3.ts, 177, 27))
|
||||
>T : Symbol(T, Decl(inferFromGenericFunctionReturnTypes3.ts, 178, 21))
|
||||
>f : Symbol(f, Decl(inferFromGenericFunctionReturnTypes3.ts, 178, 24))
|
||||
>T : Symbol(T, Decl(inferFromGenericFunctionReturnTypes3.ts, 178, 21))
|
||||
>T : Symbol(T, Decl(inferFromGenericFunctionReturnTypes3.ts, 178, 21))
|
||||
|
||||
let x: Foo[] = bar(() => !!true ? [{ state: State.A }] : [{ state: State.B }]); // Error
|
||||
>x : Symbol(x, Decl(inferFromGenericFunctionReturnTypes3.ts, 179, 3))
|
||||
>Foo : Symbol(Foo, Decl(inferFromGenericFunctionReturnTypes3.ts, 176, 19))
|
||||
>bar : Symbol(bar, Decl(inferFromGenericFunctionReturnTypes3.ts, 177, 27))
|
||||
>state : Symbol(state, Decl(inferFromGenericFunctionReturnTypes3.ts, 179, 36))
|
||||
>State.A : Symbol(State.A, Decl(inferFromGenericFunctionReturnTypes3.ts, 176, 12))
|
||||
>State : Symbol(State, Decl(inferFromGenericFunctionReturnTypes3.ts, 174, 56))
|
||||
>A : Symbol(State.A, Decl(inferFromGenericFunctionReturnTypes3.ts, 176, 12))
|
||||
>state : Symbol(state, Decl(inferFromGenericFunctionReturnTypes3.ts, 179, 59))
|
||||
>State.B : Symbol(State.B, Decl(inferFromGenericFunctionReturnTypes3.ts, 176, 15))
|
||||
>State : Symbol(State, Decl(inferFromGenericFunctionReturnTypes3.ts, 174, 56))
|
||||
>B : Symbol(State.B, Decl(inferFromGenericFunctionReturnTypes3.ts, 176, 15))
|
||||
|
||||
|
|
|
@ -450,3 +450,59 @@ const f1: F = () => {
|
|||
]);
|
||||
};
|
||||
|
||||
// Breaking change repros from #29478
|
||||
|
||||
declare function foldLeft<U>(z: U, f: (acc: U, t: boolean) => U): U;
|
||||
>foldLeft : <U>(z: U, f: (acc: U, t: boolean) => U) => U
|
||||
>z : U
|
||||
>f : (acc: U, t: boolean) => U
|
||||
>acc : U
|
||||
>t : boolean
|
||||
|
||||
let res: boolean = foldLeft(true, (acc, t) => acc && t); // Error
|
||||
>res : boolean
|
||||
>foldLeft(true, (acc, t) => acc && t) : any
|
||||
>foldLeft : <U>(z: U, f: (acc: U, t: boolean) => U) => U
|
||||
>true : true
|
||||
>(acc, t) => acc && t : (acc: true, t: boolean) => boolean
|
||||
>acc : true
|
||||
>t : boolean
|
||||
>acc && t : boolean
|
||||
>acc : true
|
||||
>t : boolean
|
||||
|
||||
enum State { A, B }
|
||||
>State : State
|
||||
>A : State.A
|
||||
>B : State.B
|
||||
|
||||
type Foo = { state: State }
|
||||
>Foo : Foo
|
||||
>state : State
|
||||
|
||||
declare function bar<T>(f: () => T[]): T[];
|
||||
>bar : <T>(f: () => T[]) => T[]
|
||||
>f : () => T[]
|
||||
|
||||
let x: Foo[] = bar(() => !!true ? [{ state: State.A }] : [{ state: State.B }]); // Error
|
||||
>x : Foo[]
|
||||
>bar(() => !!true ? [{ state: State.A }] : [{ state: State.B }]) : any
|
||||
>bar : <T>(f: () => T[]) => T[]
|
||||
>() => !!true ? [{ state: State.A }] : [{ state: State.B }] : () => { state: State.A; }[] | { state: State.B; }[]
|
||||
>!!true ? [{ state: State.A }] : [{ state: State.B }] : { state: State; }[]
|
||||
>!!true : true
|
||||
>!true : false
|
||||
>true : true
|
||||
>[{ state: State.A }] : { state: State; }[]
|
||||
>{ state: State.A } : { state: State; }
|
||||
>state : State
|
||||
>State.A : State.A
|
||||
>State : typeof State
|
||||
>A : State.A
|
||||
>[{ state: State.B }] : { state: State; }[]
|
||||
>{ state: State.B } : { state: State; }
|
||||
>state : State
|
||||
>State.B : State.B
|
||||
>State : typeof State
|
||||
>B : State.B
|
||||
|
||||
|
|
Loading…
Reference in a new issue