TypeScript/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt
Daniel Rosenwasser 6e77e2e810 Removed colons from diagnostic messages.
Also got rid of the 'terminalMessages' concept.
2014-10-28 00:48:58 -07:00

64 lines
4.7 KiB
Plaintext

tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(26,10): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(30,15): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'T'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(33,15): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'T'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(34,16): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'T'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(35,15): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'.
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts (5 errors) ====
// Generic functions used as arguments for function typed parameters are not used to make inferences from
// Using function arguments, no errors expected
function foo<T>(x: (a: T) => T) {
return x(null);
}
var r = foo(<U>(x: U) => ''); // {}
var r2 = foo<string>(<U>(x: U) => ''); // string
var r3 = foo(x => ''); // {}
function foo2<T, U>(x: T, cb: (a: T) => U) {
return cb(x);
}
var r4 = foo2(1, function <Z>(a: Z) { return '' }); // string, contextual signature instantiation is applied to generic functions
var r5 = foo2(1, (a) => ''); // string
var r6 = foo2<string, number>('', <Z>(a: Z) => 1);
function foo3<T, U>(x: T, cb: (a: T) => U, y: U) {
return cb(x);
}
var r7 = foo3(1, <Z>(a: Z) => '', ''); // string
var r8 = foo3(1, function (a) { return '' }, 1); // 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 'number' is not a valid type argument because it is not a supertype of candidate 'string'.
var r9 = foo3<number, string>(1, (a) => '', ''); // string
function other<T, U>(t: T, u: U) {
var r10 = foo2(1, (x: T) => ''); // error
~~~~
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
!!! error TS2453: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'T'.
var r10 = foo2(1, (x) => ''); // string
var r11 = foo3(1, (x: T) => '', ''); // error
~~~~
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
!!! error TS2453: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'T'.
var r11b = foo3(1, (x: T) => '', 1); // error
~~~~
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
!!! error TS2453: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'T'.
var r12 = foo3(1, function (a) { return '' }, 1); // 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 'number' is not a valid type argument because it is not a supertype of candidate 'string'.
}