diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 760547d8fac..c2e79bdafe7 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3471,7 +3471,7 @@ module ts { // where errors were being reported. if (errorInfo.next === undefined) { errorInfo = undefined; - isRelatedTo(source, target, errorNode !== undefined, headMessage, true); + isRelatedTo(source, target, errorNode !== undefined, headMessage, /* mustRecompute */ true); } if (containingMessageChain) { errorInfo = concatenateDiagnosticMessageChains(containingMessageChain, errorInfo); @@ -3652,8 +3652,11 @@ module ts { } var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; var related = relation[id]; + //var related: RelationComparisonResult = undefined; // relation[id]; if (related !== undefined) { - if (!elaborateErrors || related === RelationComparisonResult.FailedAndReported) { + // If we computed this relation already and it was failed and reported, or if we're not being asked to elaborate + // errors, we can use the cached value. Otherwise, recompute the relation + if (!elaborateErrors || (related === RelationComparisonResult.FailedAndReported)) { return related === RelationComparisonResult.Succeeded ? Ternary.True : Ternary.False; } } @@ -3706,9 +3709,14 @@ module ts { if (result) { var maybeCache = maybeStack[depth]; // If result is definitely true, copy assumptions to global cache, else copy to next level up - var destinationCache = result === Ternary.True || depth === 0 ? relation : maybeStack[depth - 1]; - for (var key in maybeCache) { - destinationCache[key] = maybeCache[key] ? RelationComparisonResult.Succeeded : RelationComparisonResult.Failed; + if (result === Ternary.True || depth === 0) { + var key: string; + for (key in maybeCache) { + relation[key] = maybeCache[key] ? RelationComparisonResult.Succeeded : (reportErrors ? RelationComparisonResult.FailedAndReported : RelationComparisonResult.Failed); + } + } + else { + copyMap(maybeCache, maybeStack[depth - 1]); } } else { diff --git a/tests/baselines/reference/promisePermutations.errors.txt b/tests/baselines/reference/promisePermutations.errors.txt index d4082015054..744fd5da90e 100644 --- a/tests/baselines/reference/promisePermutations.errors.txt +++ b/tests/baselines/reference/promisePermutations.errors.txt @@ -1,11 +1,6 @@ -tests/cases/compiler/promisePermutations.ts(55,34): error TS2345: Argument of type '() => IPromise' is not assignable to parameter of type '(error: any) => Promise'. - Type 'IPromise' is not assignable to type 'Promise'. -tests/cases/compiler/promisePermutations.ts(56,34): error TS2345: Argument of type '() => IPromise' is not assignable to parameter of type '(error: any) => Promise'. - Type 'IPromise' is not assignable to type 'Promise'. -tests/cases/compiler/promisePermutations.ts(73,35): error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. - Type 'IPromise' is not assignable to type 'Promise'. -tests/cases/compiler/promisePermutations.ts(74,35): error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. - Type 'IPromise' is not assignable to type 'Promise'. +tests/cases/compiler/promisePermutations.ts(74,70): error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. + Types of parameters 'x' and 'value' are incompatible. + Type 'number' is not assignable to type 'IPromise'. tests/cases/compiler/promisePermutations.ts(79,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'x' and 'value' are incompatible. Type 'number' is not assignable to type 'string'. @@ -55,14 +50,10 @@ tests/cases/compiler/promisePermutations.ts(137,11): error TS2453: The type argu tests/cases/compiler/promisePermutations.ts(144,12): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'IPromise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. Type 'string' is not assignable to type 'number'. -tests/cases/compiler/promisePermutations.ts(151,21): error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(value: {}) => Promise'. - Type 'IPromise' is not assignable to type 'Promise'. tests/cases/compiler/promisePermutations.ts(152,12): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. Types of property 'then' are incompatible. Type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }' is not assignable to type '{ (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }'. -tests/cases/compiler/promisePermutations.ts(153,36): error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. - Type 'IPromise' is not assignable to type 'Promise'. tests/cases/compiler/promisePermutations.ts(156,21): error TS2345: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. Type 'IPromise' is not assignable to type 'IPromise'. Type 'number' is not assignable to type 'string'. @@ -76,7 +67,7 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t Type 'Promise' is not assignable to type 'IPromise'. -==== tests/cases/compiler/promisePermutations.ts (38 errors) ==== +==== tests/cases/compiler/promisePermutations.ts (33 errors) ==== interface Promise { then(success?: (value: T) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; then(success?: (value: T) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; @@ -132,13 +123,7 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t var s1a = s1.then(testFunction, testFunction, testFunction); var s1b = s1.then(testFunctionP, testFunctionP, testFunctionP); var s1c = s1.then(testFunctionP, testFunction, testFunction); - ~~~~~~~~~~~~ -!!! error TS2345: Argument of type '() => IPromise' is not assignable to parameter of type '(error: any) => Promise'. -!!! error TS2345: Type 'IPromise' is not assignable to type 'Promise'. var s1d = s1.then(testFunctionP, testFunction, testFunction).then(testFunction, testFunction, testFunction); - ~~~~~~~~~~~~ -!!! error TS2345: Argument of type '() => IPromise' is not assignable to parameter of type '(error: any) => Promise'. -!!! error TS2345: Type 'IPromise' is not assignable to type 'Promise'. var r2: IPromise<{ x: number; }>; var r2a = r2.then(testFunction2, testFunction2, testFunction2); @@ -156,13 +141,11 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t var s3a = s3.then(testFunction3, testFunction3, testFunction3); var s3b = s3.then(testFunction3P, testFunction3P, testFunction3P); var s3c = s3.then(testFunction3P, testFunction3, testFunction3); - ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. -!!! error TS2345: Type 'IPromise' is not assignable to type 'Promise'. var s3d = s3.then(testFunction3P, testFunction3, testFunction3).then(testFunction3, testFunction3, testFunction3); // error - ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. -!!! error TS2345: Type 'IPromise' is not assignable to type 'Promise'. + ~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. +!!! error TS2345: Types of parameters 'x' and 'value' are incompatible. +!!! error TS2345: Type 'number' is not assignable to type 'IPromise'. var r4: IPromise; var sIPromise: (x: any) => IPromise; @@ -316,9 +299,6 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t var s10c = s10.then(testFunction10P, testFunction10, testFunction10); // ok var s10d = s10.then(sPromise, sPromise, sPromise); // ok var s10e = s10.then(nIPromise, nPromise, nIPromise); // ok - ~~~~~~~~~ -!!! error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(value: {}) => Promise'. -!!! error TS2345: Type 'IPromise' is not assignable to type 'Promise'. var s10f = s10.then(testFunctionP, sIPromise, nIPromise); // error ~~~~~~~~ !!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. @@ -326,9 +306,6 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t !!! error TS2453: Types of property 'then' are incompatible. !!! error TS2453: Type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }' is not assignable to type '{ (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }'. var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok - ~~~~~~~~~ -!!! error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. -!!! error TS2345: Type 'IPromise' is not assignable to type 'Promise'. var r11: IPromise; var r11a = r11.then(testFunction11, testFunction11, testFunction11); // error diff --git a/tests/baselines/reference/promisePermutations2.errors.txt b/tests/baselines/reference/promisePermutations2.errors.txt index 1e2c13edd15..5a50b9391ba 100644 --- a/tests/baselines/reference/promisePermutations2.errors.txt +++ b/tests/baselines/reference/promisePermutations2.errors.txt @@ -1,19 +1,6 @@ -tests/cases/compiler/promisePermutations2.ts(54,11): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. - Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. - Types of property 'then' are incompatible. - Type '{ (success?: (value: number) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: number) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: number) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }' is not assignable to type '(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void) => Promise'. -tests/cases/compiler/promisePermutations2.ts(55,11): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. - Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. -tests/cases/compiler/promisePermutations2.ts(63,11): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. - Type argument candidate 'Promise<{ x: number; }>' is not a valid type argument because it is not a supertype of candidate 'IPromise<{ x: number; }>'. - Types of property 'then' are incompatible. - Type '{ (success?: (value: { x: number; }) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: { x: number; }) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: { x: number; }) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: { x: number; }) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }' is not assignable to type '(success?: (value: { x: number; }) => U, error?: (error: any) => U, progress?: (progress: any) => void) => Promise'. -tests/cases/compiler/promisePermutations2.ts(64,11): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. - Type argument candidate 'Promise<{ x: number; }>' is not a valid type argument because it is not a supertype of candidate 'IPromise<{ x: number; }>'. -tests/cases/compiler/promisePermutations2.ts(72,11): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. - Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. -tests/cases/compiler/promisePermutations2.ts(73,11): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. - Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. +tests/cases/compiler/promisePermutations2.ts(73,70): error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. + Types of parameters 'x' and 'value' are incompatible. + Type 'number' is not assignable to type 'IPromise'. tests/cases/compiler/promisePermutations2.ts(78,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'x' and 'value' are incompatible. Type 'number' is not assignable to type 'string'. @@ -23,24 +10,17 @@ tests/cases/compiler/promisePermutations2.ts(81,19): error TS2345: Argument of t tests/cases/compiler/promisePermutations2.ts(82,19): error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. Types of parameters 'x' and 'value' are incompatible. Type 'number' is not assignable to type 'string'. -tests/cases/compiler/promisePermutations2.ts(83,11): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. - Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. - Types of property 'then' are incompatible. - Type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }' is not assignable to type '(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void) => Promise'. -tests/cases/compiler/promisePermutations2.ts(84,11): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. - Type argument candidate 'IPromise' is not a valid type argument because it is not a supertype of candidate 'Promise'. - Types of property 'then' are incompatible. - Type '(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void) => Promise' is not assignable to type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }'. +tests/cases/compiler/promisePermutations2.ts(83,19): error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. + Types of parameters 'x' and 'value' are incompatible. + Type 'number' is not assignable to type 'string'. tests/cases/compiler/promisePermutations2.ts(87,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations2.ts(90,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations2.ts(91,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. -tests/cases/compiler/promisePermutations2.ts(92,11): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. - Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. +tests/cases/compiler/promisePermutations2.ts(92,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations2.ts(96,19): error TS2345: Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations2.ts(99,19): error TS2345: Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations2.ts(100,19): error TS2345: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. -tests/cases/compiler/promisePermutations2.ts(101,11): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. - Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. +tests/cases/compiler/promisePermutations2.ts(101,19): error TS2345: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations2.ts(105,19): error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'cb' and 'value' are incompatible. Type '(a: T) => T' is not assignable to type 'string'. @@ -56,35 +36,24 @@ tests/cases/compiler/promisePermutations2.ts(110,19): error TS2345: Argument of tests/cases/compiler/promisePermutations2.ts(116,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. tests/cases/compiler/promisePermutations2.ts(119,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. tests/cases/compiler/promisePermutations2.ts(120,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => Promise'. -tests/cases/compiler/promisePermutations2.ts(121,11): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. - Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. - Types of property 'then' are incompatible. - Type '{ (success?: (value: any) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: any) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: any) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: any) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }' is not assignable to type '(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void) => Promise'. +tests/cases/compiler/promisePermutations2.ts(121,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. tests/cases/compiler/promisePermutations2.ts(125,19): error TS2345: Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. tests/cases/compiler/promisePermutations2.ts(128,11): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'IPromise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations2.ts(131,19): error TS2345: Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. tests/cases/compiler/promisePermutations2.ts(132,19): error TS2345: Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => Promise'. -tests/cases/compiler/promisePermutations2.ts(133,11): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. - Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. +tests/cases/compiler/promisePermutations2.ts(133,19): error TS2345: Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. tests/cases/compiler/promisePermutations2.ts(136,11): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'IPromise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations2.ts(143,12): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'IPromise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. Type 'string' is not assignable to type 'number'. -tests/cases/compiler/promisePermutations2.ts(148,12): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. - Type argument candidate 'Promise<{}>' is not a valid type argument because it is not a supertype of candidate 'IPromise<{}>'. - Types of property 'then' are incompatible. - Type '{ (success?: (value: {}) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }' is not assignable to type '(success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void) => Promise'. -tests/cases/compiler/promisePermutations2.ts(150,12): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. tests/cases/compiler/promisePermutations2.ts(151,12): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. Types of property 'then' are incompatible. Type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }' is not assignable to type '(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void) => Promise'. -tests/cases/compiler/promisePermutations2.ts(152,12): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. - Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. tests/cases/compiler/promisePermutations2.ts(155,21): error TS2345: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. Type 'IPromise' is not assignable to type 'IPromise'. Type 'number' is not assignable to type 'string'. @@ -94,11 +63,11 @@ tests/cases/compiler/promisePermutations2.ts(157,21): error TS2345: Argument of tests/cases/compiler/promisePermutations2.ts(158,21): error TS2345: Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => Promise'. Type 'Promise' is not assignable to type 'Promise'. Type 'number' is not assignable to type 'string'. -tests/cases/compiler/promisePermutations2.ts(159,12): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. - Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. +tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => IPromise'. + Type 'Promise' is not assignable to type 'IPromise'. -==== tests/cases/compiler/promisePermutations2.ts (42 errors) ==== +==== tests/cases/compiler/promisePermutations2.ts (33 errors) ==== // same as promisePermutations but without the same overloads in Promise interface Promise { @@ -153,15 +122,7 @@ tests/cases/compiler/promisePermutations2.ts(159,12): error TS2453: The type arg var s1a = s1.then(testFunction, testFunction, testFunction); var s1b = s1.then(testFunctionP, testFunctionP, testFunctionP); var s1c = s1.then(testFunctionP, testFunction, testFunction); - ~~~~~~~ -!!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. -!!! error TS2453: Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. -!!! error TS2453: Types of property 'then' are incompatible. -!!! error TS2453: Type '{ (success?: (value: number) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: number) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: number) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }' is not assignable to type '(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void) => Promise'. var s1d = s1.then(testFunctionP, testFunction, testFunction).then(testFunction, testFunction, testFunction); - ~~~~~~~ -!!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. -!!! error TS2453: Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. var r2: IPromise<{ x: number; }>; var r2a = r2.then(testFunction2, testFunction2, testFunction2); @@ -170,15 +131,7 @@ tests/cases/compiler/promisePermutations2.ts(159,12): error TS2453: The type arg var s2a = s2.then(testFunction2, testFunction2, testFunction2); var s2b = s2.then(testFunction2P, testFunction2P, testFunction2P); var s2c = s2.then(testFunction2P, testFunction2, testFunction2); - ~~~~~~~ -!!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. -!!! error TS2453: Type argument candidate 'Promise<{ x: number; }>' is not a valid type argument because it is not a supertype of candidate 'IPromise<{ x: number; }>'. -!!! error TS2453: Types of property 'then' are incompatible. -!!! error TS2453: Type '{ (success?: (value: { x: number; }) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: { x: number; }) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: { x: number; }) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: { x: number; }) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }' is not assignable to type '(success?: (value: { x: number; }) => U, error?: (error: any) => U, progress?: (progress: any) => void) => Promise'. var s2d = s2.then(testFunction2P, testFunction2, testFunction2).then(testFunction2, testFunction2, testFunction2); - ~~~~~~~ -!!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. -!!! error TS2453: Type argument candidate 'Promise<{ x: number; }>' is not a valid type argument because it is not a supertype of candidate 'IPromise<{ x: number; }>'. var r3: IPromise; var r3a = r3.then(testFunction3, testFunction3, testFunction3); @@ -187,13 +140,11 @@ tests/cases/compiler/promisePermutations2.ts(159,12): error TS2453: The type arg var s3a = s3.then(testFunction3, testFunction3, testFunction3); var s3b = s3.then(testFunction3P, testFunction3P, testFunction3P); var s3c = s3.then(testFunction3P, testFunction3, testFunction3); - ~~~~~~~ -!!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. -!!! error TS2453: Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. var s3d = s3.then(testFunction3P, testFunction3, testFunction3).then(testFunction3, testFunction3, testFunction3); // Should error - ~~~~~~~ -!!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. -!!! error TS2453: Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. + ~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. +!!! error TS2345: Types of parameters 'x' and 'value' are incompatible. +!!! error TS2345: Type 'number' is not assignable to type 'IPromise'. var r4: IPromise; var sIPromise: (x: any) => IPromise; @@ -216,17 +167,11 @@ tests/cases/compiler/promisePermutations2.ts(159,12): error TS2453: The type arg !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. !!! error TS2345: Type 'number' is not assignable to type 'string'. var s4c = s4.then(testFunction4P, testFunction4, testFunction4); // error - ~~~~~~~ -!!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. -!!! error TS2453: Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. -!!! error TS2453: Types of property 'then' are incompatible. -!!! error TS2453: Type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }' is not assignable to type '(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void) => Promise'. + ~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2345: Types of parameters 'x' and 'value' are incompatible. +!!! error TS2345: Type 'number' is not assignable to type 'string'. var s4d = s4.then(sIPromise, testFunction4P, testFunction4).then(sIPromise, testFunction4P, testFunction4); - ~~~~~~~ -!!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. -!!! error TS2453: Type argument candidate 'IPromise' is not a valid type argument because it is not a supertype of candidate 'Promise'. -!!! error TS2453: Types of property 'then' are incompatible. -!!! error TS2453: Type '(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void) => Promise' is not assignable to type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }'. var r5: IPromise; var r5a = r5.then(testFunction5, testFunction5, testFunction5); // error @@ -241,9 +186,8 @@ tests/cases/compiler/promisePermutations2.ts(159,12): error TS2453: The type arg ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. var s5c = s5.then(testFunction5P, testFunction5, testFunction5); // error - ~~~~~~~ -!!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. -!!! error TS2453: Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. + ~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. var s5d = s5.then(sPromise, sPromise, sPromise).then(sIPromise, sIPromise, sIPromise); // ok var r6: IPromise; @@ -259,9 +203,8 @@ tests/cases/compiler/promisePermutations2.ts(159,12): error TS2453: The type arg ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. var s6c = s6.then(testFunction6P, testFunction6, testFunction6); // error - ~~~~~~~ -!!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. -!!! error TS2453: Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. + ~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. var s6d = s6.then(sPromise, sPromise, sPromise).then(sIPromise, sIPromise, sIPromise); // ok var r7: IPromise; @@ -304,11 +247,8 @@ tests/cases/compiler/promisePermutations2.ts(159,12): error TS2453: The type arg ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => Promise'. var s8c = s8.then(testFunction8P, testFunction8, testFunction8); // error - ~~~~~~~ -!!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. -!!! error TS2453: Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. -!!! error TS2453: Types of property 'then' are incompatible. -!!! error TS2453: Type '{ (success?: (value: any) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: any) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: any) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: any) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }' is not assignable to type '(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void) => Promise'. + ~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. var s8d = s8.then(nIPromise, nIPromise, nIPromise).then(nIPromise, nIPromise, nIPromise); // ok var r9: IPromise; @@ -331,9 +271,8 @@ tests/cases/compiler/promisePermutations2.ts(159,12): error TS2453: The type arg ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => Promise'. var s9c = s9.then(testFunction9P, testFunction9, testFunction9); // error - ~~~~~~~ -!!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. -!!! error TS2453: Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. + ~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. var s9d = s9.then(sPromise, sPromise, sPromise); // ok var s9e = s9.then(nPromise, nPromise, nPromise); // ok var s9f = s9.then(testFunction, sIPromise, nIPromise); // error @@ -357,15 +296,8 @@ tests/cases/compiler/promisePermutations2.ts(159,12): error TS2453: The type arg var s10a = s10.then(testFunction10, testFunction10, testFunction10); // ok var s10b = s10.then(testFunction10P, testFunction10P, testFunction10P); // ok var s10c = s10.then(testFunction10P, testFunction10, testFunction10); // ok - ~~~~~~~~ -!!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. -!!! error TS2453: Type argument candidate 'Promise<{}>' is not a valid type argument because it is not a supertype of candidate 'IPromise<{}>'. -!!! error TS2453: Types of property 'then' are incompatible. -!!! error TS2453: Type '{ (success?: (value: {}) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }' is not assignable to type '(success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void) => Promise'. var s10d = s10.then(sPromise, sPromise, sPromise); // ok var s10e = s10.then(nIPromise, nPromise, nIPromise); // ok - ~~~~~~~~ -!!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. var s10f = s10.then(testFunctionP, sIPromise, nIPromise); // error ~~~~~~~~ !!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. @@ -373,9 +305,6 @@ tests/cases/compiler/promisePermutations2.ts(159,12): error TS2453: The type arg !!! error TS2453: Types of property 'then' are incompatible. !!! error TS2453: Type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }' is not assignable to type '(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void) => Promise'. var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. -!!! error TS2453: Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. var r11: IPromise; var r11a = r11.then(testFunction11, testFunction11, testFunction11); // error @@ -395,9 +324,9 @@ tests/cases/compiler/promisePermutations2.ts(159,12): error TS2453: The type arg !!! error TS2345: Type 'Promise' is not assignable to type 'Promise'. !!! error TS2345: Type 'number' is not assignable to type 'string'. var s11c = s11.then(testFunction11P, testFunction11, testFunction11); // ok - ~~~~~~~~ -!!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. -!!! error TS2453: Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. + ~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2345: Type 'Promise' is not assignable to type 'IPromise'. var r12 = testFunction12(x => x); var r12a = r12.then(testFunction12, testFunction12, testFunction12); // ok