mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-18 07:29:16 -05:00
Accept new baselines
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
tests/cases/compiler/genericSignatureIdentity.ts(10,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '<T extends Date>(x: T) => T', but here has type '<T extends number>(x: T) => T'.
|
||||
tests/cases/compiler/genericSignatureIdentity.ts(14,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '<T extends Date>(x: T) => T', but here has type '<T>(x: T) => T'.
|
||||
tests/cases/compiler/genericSignatureIdentity.ts(18,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '<T extends Date>(x: T) => T', but here has type '<T>(x: any) => any'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/genericSignatureIdentity.ts (3 errors) ====
|
||||
// This test is here to remind us of our current limits of type identity checking.
|
||||
// Ideally all of the below declarations would be considered different (and thus errors)
|
||||
// but they aren't because we erase type parameters to type any and don't check that
|
||||
// constraints are identical.
|
||||
|
||||
var x: {
|
||||
<T extends Date>(x: T): T;
|
||||
};
|
||||
|
||||
var x: {
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '<T extends Date>(x: T) => T', but here has type '<T extends number>(x: T) => T'.
|
||||
!!! related TS6203 tests/cases/compiler/genericSignatureIdentity.ts:6:5: 'x' was also declared here.
|
||||
<T extends number>(x: T): T;
|
||||
};
|
||||
|
||||
var x: {
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '<T extends Date>(x: T) => T', but here has type '<T>(x: T) => T'.
|
||||
!!! related TS6203 tests/cases/compiler/genericSignatureIdentity.ts:6:5: 'x' was also declared here.
|
||||
<T>(x: T): T;
|
||||
};
|
||||
|
||||
var x: {
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '<T extends Date>(x: T) => T', but here has type '<T>(x: any) => any'.
|
||||
!!! related TS6203 tests/cases/compiler/genericSignatureIdentity.ts:6:5: 'x' was also declared here.
|
||||
<T>(x: any): any;
|
||||
};
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(2,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type '<T, U>(x: T, y: U) => T', but here has type '<T, U>(x: any, y: any) => any'.
|
||||
tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'g' must be of type '<T, U>(x: T, y: U) => T', but here has type '<T>(x: any, y: any) => any'.
|
||||
tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(8,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'h' must be of type '<T, U>(x: T, y: U) => T', but here has type '(x: any, y: any) => any'.
|
||||
tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(11,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type '<T, U>(x: T, y: U) => T', but here has type '<T, U>(x: any, y: string) => any'.
|
||||
tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(14,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'j' must be of type '<T, U>(x: T, y: U) => T', but here has type '<T, U>(x: any, y: any) => string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts (4 errors) ====
|
||||
==== tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts (5 errors) ====
|
||||
var f: <T, U>(x: T, y: U) => T;
|
||||
var f: <T, U>(x: any, y: any) => any;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type '<T, U>(x: T, y: U) => T', but here has type '<T, U>(x: any, y: any) => any'.
|
||||
!!! related TS6203 tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts:1:5: 'f' was also declared here.
|
||||
|
||||
var g: <T, U>(x: T, y: U) => T;
|
||||
var g: <T>(x: any, y: any) => any;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
tests/cases/compiler/identityForSignaturesWithTypeParametersSwitched.ts(2,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type '<T, U>(x: T, y: U) => T', but here has type '<T, U>(x: U, y: T) => U'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/identityForSignaturesWithTypeParametersSwitched.ts (1 errors) ====
|
||||
var f: <T, U>(x: T, y: U) => T;
|
||||
var f: <T, U>(x: U, y: T) => U;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type '<T, U>(x: T, y: U) => T', but here has type '<T, U>(x: U, y: T) => U'.
|
||||
!!! related TS6203 tests/cases/compiler/identityForSignaturesWithTypeParametersSwitched.ts:1:5: 'f' was also declared here.
|
||||
28
tests/baselines/reference/promiseIdentity.errors.txt
Normal file
28
tests/baselines/reference/promiseIdentity.errors.txt
Normal file
@@ -0,0 +1,28 @@
|
||||
tests/cases/compiler/promiseIdentity.ts(21,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'IPromise2<string, number>', but here has type 'Promise2<any, string>'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/promiseIdentity.ts (1 errors) ====
|
||||
export interface IPromise<T> {
|
||||
then<U>(callback: (x: T) => IPromise<U>): IPromise<U>;
|
||||
}
|
||||
interface Promise<T> {
|
||||
then<U>(callback: (x: T) => Promise<U>): Promise<U>;
|
||||
}
|
||||
var x: IPromise<string>;
|
||||
var x: Promise<string>;
|
||||
|
||||
|
||||
interface IPromise2<T, V> {
|
||||
then<U, W>(callback: (x: T) => IPromise2<U, W>): IPromise2<W, U>;
|
||||
}
|
||||
interface Promise2<T, V> {
|
||||
then<U, W>(callback: (x: V) => Promise2<U, T>): Promise2<T, W>; // Uses V instead of T in callback's parameter
|
||||
}
|
||||
|
||||
// Ok because T in this particular Promise2 is any, as are all the U and W references.
|
||||
// Also, the V of Promise2 happens to coincide with the T of IPromise2 (they are both string).
|
||||
var y: IPromise2<string, number>;
|
||||
var y: Promise2<any, string>;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'IPromise2<string, number>', but here has type 'Promise2<any, string>'.
|
||||
!!! related TS6203 tests/cases/compiler/promiseIdentity.ts:20:5: 'y' was also declared here.
|
||||
17
tests/baselines/reference/promiseIdentityWithAny.errors.txt
Normal file
17
tests/baselines/reference/promiseIdentityWithAny.errors.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
tests/cases/compiler/promiseIdentityWithAny.ts(10,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'IPromise<string, number>', but here has type 'Promise<string, boolean>'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/promiseIdentityWithAny.ts (1 errors) ====
|
||||
export interface IPromise<T, V> {
|
||||
then<U, W>(callback: (x: T) => IPromise<U, W>): IPromise<U, W>;
|
||||
}
|
||||
export interface Promise<T, V> {
|
||||
then<U, W>(callback: (x: T) => Promise<any, any>): Promise<any, any>;
|
||||
}
|
||||
|
||||
// Should be ok because signature type parameters get erased to any
|
||||
var x: IPromise<string, number>;
|
||||
var x: Promise<string, boolean>;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'IPromise<string, number>', but here has type 'Promise<string, boolean>'.
|
||||
!!! related TS6203 tests/cases/compiler/promiseIdentityWithAny.ts:9:5: 'x' was also declared here.
|
||||
@@ -0,0 +1,17 @@
|
||||
tests/cases/compiler/promiseIdentityWithConstraints.ts(10,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'IPromise<string, number>', but here has type 'Promise<string, boolean>'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/promiseIdentityWithConstraints.ts (1 errors) ====
|
||||
export interface IPromise<T, V> {
|
||||
then<U extends T, W extends V>(callback: (x: T) => IPromise<U, W>): IPromise<U, W>;
|
||||
}
|
||||
export interface Promise<T, V> {
|
||||
then<U extends T, W extends V>(callback: (x: T) => Promise<U, W>): Promise<U, W>;
|
||||
}
|
||||
|
||||
// Error because constraint V doesn't match
|
||||
var x: IPromise<string, number>;
|
||||
var x: Promise<string, boolean>;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'IPromise<string, number>', but here has type 'Promise<string, boolean>'.
|
||||
!!! related TS6203 tests/cases/compiler/promiseIdentityWithConstraints.ts:9:5: 'x' was also declared here.
|
||||
Reference in New Issue
Block a user