diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b133245d837..5be13ecfdca 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -129,6 +129,7 @@ module ts { var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var typeArgumentInferenceFailureType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var anySignature = createSignature(undefined, undefined, emptyArray, anyType, 0, false, false); var unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, 0, false, false); @@ -3993,23 +3994,26 @@ module ts { } function getInferredType(context: InferenceContext, index: number): Type { - var result = context.inferredTypes[index]; - if (!result) { + var inferredType = context.inferredTypes[index]; + if (!inferredType) { var inferences = context.inferences[index]; if (inferences.length) { // Infer widened union or supertype, or the undefined type for no common supertype var unionOrSuperType = context.inferUnionTypes ? getUnionType(inferences) : getCommonSupertype(inferences); - var inferredType = unionOrSuperType ? getWidenedType(unionOrSuperType) : undefinedType; + inferredType = unionOrSuperType ? getWidenedType(unionOrSuperType) : typeArgumentInferenceFailureType; } else { // Infer the empty object type when no inferences were made inferredType = emptyObjectType; } - var constraint = getConstraintOfTypeParameter(context.typeParameters[index]); - var result = constraint && !isTypeAssignableTo(inferredType, constraint) ? constraint : inferredType; - context.inferredTypes[index] = result; + + if (inferredType !== typeArgumentInferenceFailureType) { + var constraint = getConstraintOfTypeParameter(context.typeParameters[index]); + inferredType = constraint && !isTypeAssignableTo(inferredType, constraint) ? constraint : inferredType; + } + context.inferredTypes[index] = inferredType; } - return result; + return inferredType; } function getInferredTypes(context: InferenceContext): Type[] { @@ -5094,7 +5098,7 @@ module ts { } var inferredTypes = getInferredTypes(context); // Inference has failed if the undefined type is in list of inferences - return !contains(inferredTypes, undefinedType); + return !contains(inferredTypes, typeArgumentInferenceFailureType); } function checkTypeArguments(signature: Signature, typeArguments: TypeNode[], typeArgumentResultTypes: Type[], reportErrors: boolean): boolean { @@ -5161,6 +5165,7 @@ module ts { var candidateForArgumentError: Signature; var candidateForTypeArgumentError: Signature; + var indexOfUninferredTypeParameter: number; var result: Signature; if (candidates.length > 1) { result = chooseOverload(candidates, subtypeRelation, excludeArgument); @@ -5169,6 +5174,7 @@ module ts { // Reinitialize these pointers for round two candidateForArgumentError = undefined; candidateForTypeArgumentError = undefined; + indexOfUninferredTypeParameter = undefined; result = chooseOverload(candidates, assignableRelation, excludeArgument); } if (result) { @@ -5187,7 +5193,8 @@ module ts { checkTypeArguments(candidateForTypeArgumentError, node.typeArguments, [], /*reportErrors*/ true) } else { - error(node.func, Diagnostics.The_type_arguments_cannot_be_inferred_from_the_usage_Try_specifying_the_type_arguments_explicitly); + error(node.func, Diagnostics.The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Try_specifying_the_type_arguments_explicitly, + typeToString(candidateForTypeArgumentError.typeParameters[indexOfUninferredTypeParameter])); } } else { @@ -5251,6 +5258,9 @@ module ts { } else { candidateForTypeArgumentError = originalCandidate; + if (!node.typeArguments) { + indexOfUninferredTypeParameter = typeArgumentTypes.indexOf(typeArgumentInferenceFailureType); + } } } else { diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index f0620c210e8..f3043c9cc0d 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -261,7 +261,7 @@ module ts { Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: DiagnosticCategory.Error, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." }, Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: DiagnosticCategory.Error, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: DiagnosticCategory.Error, key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, - The_type_arguments_cannot_be_inferred_from_the_usage_Try_specifying_the_type_arguments_explicitly: { code: 2448, category: DiagnosticCategory.Error, key: "The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly." }, + The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Try_specifying_the_type_arguments_explicitly: { code: 2448, category: DiagnosticCategory.Error, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Try specifying the type arguments explicitly." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4001, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 4ef5d67b453..fd65342681a 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1036,7 +1036,7 @@ "category": "Error", "code": 2447 }, - "The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly.": { + "The type argument for type parameter '{0}' cannot be inferred from the usage. Try specifying the type arguments explicitly.": { "category": "Error", "code": 2448 }, diff --git a/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.errors.txt b/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.errors.txt index 932e78369a9..887d36f4524 100644 --- a/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.errors.txt +++ b/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/contextualTypingWithFixedTypeParameters1.ts(2,22): error TS2339: Property 'foo' does not exist on type 'string'. -tests/cases/compiler/contextualTypingWithFixedTypeParameters1.ts(3,10): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/compiler/contextualTypingWithFixedTypeParameters1.ts(3,10): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. ==== tests/cases/compiler/contextualTypingWithFixedTypeParameters1.ts (2 errors) ==== @@ -9,4 +9,4 @@ tests/cases/compiler/contextualTypingWithFixedTypeParameters1.ts(3,10): error TS !!! error TS2339: Property 'foo' does not exist on type 'string'. var r9 = f10('', () => (a => a.foo), 1); // error ~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. \ No newline at end of file +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. \ No newline at end of file diff --git a/tests/baselines/reference/defaultBestCommonTypesHaveDecls.errors.txt b/tests/baselines/reference/defaultBestCommonTypesHaveDecls.errors.txt index f8f79f3cb65..c049929b7bf 100644 --- a/tests/baselines/reference/defaultBestCommonTypesHaveDecls.errors.txt +++ b/tests/baselines/reference/defaultBestCommonTypesHaveDecls.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts(2,6): error TS2339: Property 'length' does not exist on type '{}'. tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts(5,6): error TS2339: Property 'length' does not exist on type 'Object'. -tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts(8,14): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts(8,14): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. ==== tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts (3 errors) ==== @@ -17,7 +17,7 @@ tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts(8,14): error TS2448: The function concat(x: T, y: T): T { return null; } var result = concat(1, ""); // error ~~~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. var elementCount = result.length; function concat2(x: T, y: U) { return null; } diff --git a/tests/baselines/reference/fixTypeParameterInSignatureWithRestParameters.errors.txt b/tests/baselines/reference/fixTypeParameterInSignatureWithRestParameters.errors.txt index 8c206ca1051..24395528484 100644 --- a/tests/baselines/reference/fixTypeParameterInSignatureWithRestParameters.errors.txt +++ b/tests/baselines/reference/fixTypeParameterInSignatureWithRestParameters.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/fixTypeParameterInSignatureWithRestParameters.ts(2,1): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/compiler/fixTypeParameterInSignatureWithRestParameters.ts(2,1): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. ==== tests/cases/compiler/fixTypeParameterInSignatureWithRestParameters.ts (1 errors) ==== function bar(item1: T, item2: T) { } bar(1, ""); // Should be ok ~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. \ No newline at end of file +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt b/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt index c747a83fde3..3728b5e153b 100644 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(26,10): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(30,15): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(33,15): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(34,16): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(35,15): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(26,10): error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(30,15): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(33,15): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(34,16): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(35,15): error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts (5 errors) ==== @@ -33,22 +33,22 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun var r8 = foo3(1, function (a) { return '' }, 1); // error ~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. var r9 = foo3(1, (a) => '', ''); // string function other(t: T, u: U) { var r10 = foo2(1, (x: T) => ''); // error ~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. var r10 = foo2(1, (x) => ''); // string var r11 = foo3(1, (x: T) => '', ''); // error ~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. var r11b = foo3(1, (x: T) => '', 1); // error ~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. var r12 = foo3(1, function (a) { return '' }, 1); // error ~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. } \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments2.errors.txt b/tests/baselines/reference/genericCallWithFunctionTypedArguments2.errors.txt index 21a69b75ecf..378234af8e3 100644 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments2.errors.txt +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments2.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments2.ts(29,10): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments2.ts(40,10): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments2.ts(29,10): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments2.ts(40,10): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments2.ts (2 errors) ==== @@ -33,7 +33,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun var r4 = foo2(1, i2); // error ~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. var r4b = foo2(1, a); // any var r5 = foo2(1, i); // any var r6 = foo2('', i2); // string @@ -46,5 +46,5 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun var r7b = foo3(null, a, ''); // any var r8 = foo3(1, i2, 1); // error ~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. var r9 = foo3('', i2, ''); // string \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithGenericSignatureArguments.errors.txt b/tests/baselines/reference/genericCallWithGenericSignatureArguments.errors.txt index 43bad8f6a1d..3220126e594 100644 --- a/tests/baselines/reference/genericCallWithGenericSignatureArguments.errors.txt +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments.ts(18,10): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments.ts(19,10): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments.ts(18,10): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments.ts(19,10): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments.ts (2 errors) ==== @@ -21,11 +21,11 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen var b: { x: number; z?: number; }; var r4 = foo((x: typeof a) => a, (x: typeof b) => b); // typeof a => typeof a - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~ +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. var r5 = foo((x: typeof b) => b, (x: typeof a) => a); // typeof b => typeof b - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~ +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. function other(x: T) { var r6 = foo((a: T) => a, (b: T) => b); // T => T diff --git a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt index 8bfbc1d08c4..a0bcb3baf6c 100644 --- a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(10,29): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(10,29): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(15,21): error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(16,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(25,23): error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. @@ -22,7 +22,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen var r1: (x: {}) => {} = foo((x: number) => 1, (x: string) => ''); ~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. function other2(x: T) { var r7 = foo((a: T) => a, (b: T) => b); // T => T diff --git a/tests/baselines/reference/genericCallWithGenericSignatureArguments3.errors.txt b/tests/baselines/reference/genericCallWithGenericSignatureArguments3.errors.txt index 6a7ee5ab616..292a2dd372a 100644 --- a/tests/baselines/reference/genericCallWithGenericSignatureArguments3.errors.txt +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments3.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3.ts(32,11): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3.ts(33,11): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3.ts(32,11): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3.ts(33,11): error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3.ts (2 errors) ==== @@ -36,7 +36,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen var x: (a: string) => boolean; var r11 = foo2(x, (a1: (y: string) => string) => (n: Object) => 1, (a2: (z: string) => string) => 2); // error ~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. var r12 = foo2(x, (a1: (y: string) => boolean) => (n: Object) => 1, (a2: (z: string) => boolean) => 2); // error ~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. \ No newline at end of file +!!! error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithNonSymmetricSubtypes.errors.txt b/tests/baselines/reference/genericCallWithNonSymmetricSubtypes.errors.txt index c14db877073..fbac0909634 100644 --- a/tests/baselines/reference/genericCallWithNonSymmetricSubtypes.errors.txt +++ b/tests/baselines/reference/genericCallWithNonSymmetricSubtypes.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithNonSymmetricSubtypes.ts(12,9): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithNonSymmetricSubtypes.ts(13,10): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithNonSymmetricSubtypes.ts(12,9): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithNonSymmetricSubtypes.ts(13,10): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithNonSymmetricSubtypes.ts (2 errors) ==== @@ -15,11 +15,11 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithNon var b: { x: number; z?: number; }; var r = foo(a, b); // { x: number; y?: number; }; - ~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~ +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. var r2 = foo(b, a); // { x: number; z?: number; }; - ~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~ +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. var x: { x: number; }; var y: { x?: number; }; diff --git a/tests/baselines/reference/genericCallWithObjectLiteralArgs.errors.txt b/tests/baselines/reference/genericCallWithObjectLiteralArgs.errors.txt index 0ce87808d51..265c7f29f82 100644 --- a/tests/baselines/reference/genericCallWithObjectLiteralArgs.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectLiteralArgs.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectLiteralArgs.ts(5,9): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectLiteralArgs.ts(5,9): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectLiteralArgs.ts (1 errors) ==== @@ -8,7 +8,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObj var r = foo({ bar: 1, baz: '' }); // error ~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. var r2 = foo({ bar: 1, baz: 1 }); // T = number var r3 = foo({ bar: foo, baz: foo }); // T = typeof foo var r4 = foo({ bar: 1, baz: '' }); // T = Object \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithObjectLiteralArguments1.errors.txt b/tests/baselines/reference/genericCallWithObjectLiteralArguments1.errors.txt index 666cb36dda9..4158ffc049f 100644 --- a/tests/baselines/reference/genericCallWithObjectLiteralArguments1.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectLiteralArguments1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts(3,9): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts(3,9): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts(4,22): error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type '{ x: number; y: number; }'. Types of property 'y' are incompatible: Type 'string' is not assignable to type 'number'. @@ -18,7 +18,7 @@ tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts(7,22): error TS23 // these are all errors var x = foo({ x: 3, y: "" }, 4); ~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. var x2 = foo({ x: 3, y: "" }, 4); ~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type '{ x: number; y: number; }'. diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgs.errors.txt b/tests/baselines/reference/genericCallWithObjectTypeArgs.errors.txt index cf6a731bff6..78b50c114cb 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgs.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectTypeArgs.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgs.ts(20,9): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgs.ts(20,9): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgs.ts (1 errors) ==== @@ -23,5 +23,5 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObj var d1 = new X(); var r = foo(c1, d1); // error ~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. var r2 = foo(c1, c1); // ok \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.errors.txt b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.errors.txt index 9fa2245d9e6..e06a351a2c5 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints3.ts(18,10): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints3.ts(18,10): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints3.ts(20,29): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. @@ -20,9 +20,9 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObj return r; } - var r1 = f({ x: new Derived(), y: new Derived2() }); // ok, both extend Base + var r1 = f({ x: new Derived(), y: new Derived2() }); // error because neither is supertype of the other ~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. function f2(a: U) { ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -39,7 +39,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObj return y(null); } - // all ok - T gets fixed too early, but then defaults to Base and everything works out + // all ok - second argument is processed before x is fixed var r4 = f3(x => x, new Base()); var r5 = f3(x => x, new Derived()); var r6 = f3(x => x, null); diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js index 3d37dace7ae..b9c722f80be 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js @@ -16,7 +16,7 @@ function f(a: { x: T; y: T }) { return r; } -var r1 = f({ x: new Derived(), y: new Derived2() }); // ok, both extend Base +var r1 = f({ x: new Derived(), y: new Derived2() }); // error because neither is supertype of the other function f2(a: U) { var r: T; @@ -31,7 +31,7 @@ function f3(y: (a: T) => T, x: T) { return y(null); } -// all ok - T gets fixed too early, but then defaults to Base and everything works out +// all ok - second argument is processed before x is fixed var r4 = f3(x => x, new Base()); var r5 = f3(x => x, new Derived()); var r6 = f3(x => x, null); @@ -68,7 +68,7 @@ function f(a) { var r; return r; } -var r1 = f({ x: new Derived(), y: new Derived2() }); // ok, both extend Base +var r1 = f({ x: new Derived(), y: new Derived2() }); // error because neither is supertype of the other function f2(a) { var r; return r; @@ -78,7 +78,7 @@ var r3 = f2({ x: new Derived(), y: new Derived2() }); // ok function f3(y, x) { return y(null); } -// all ok - T gets fixed too early, but then defaults to Base and everything works out +// all ok - second argument is processed before x is fixed var r4 = f3(function (x) { return x; }, new Base()); var r5 = f3(function (x) { return x; }, new Derived()); var r6 = f3(function (x) { return x; }, null); diff --git a/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.errors.txt b/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.errors.txt index 657371faefb..b96fda8b327 100644 --- a/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.errors.txt +++ b/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOverloadedConstructorTypedArguments.ts(36,14): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOverloadedConstructorTypedArguments.ts(36,14): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOverloadedConstructorTypedArguments.ts (1 errors) ==== @@ -39,7 +39,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOve var r8 = foo6(a); // error ~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. var r9 = foo6(b); // new any => string; new(x:any, y?:any) => string function foo7(x:T, cb: { new(x: T): string; new(x: T, y?: T): string }) { diff --git a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt index 2f56a3c8585..c2a8b303d8e 100644 --- a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt +++ b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(57,19): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. -tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(60,19): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. -tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(61,20): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. -tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(62,19): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(57,19): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(60,19): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(61,20): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(62,19): error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts (4 errors) ==== @@ -63,17 +63,17 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFu function other(t: T, u: U) { var r10 = c.foo2(1, (x: T) => ''); // error ~~~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. var r10 = c.foo2(1, (x) => ''); // string var r11 = c3.foo3(1, (x: T) => '', ''); // error ~~~~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. var r11b = c3.foo3(1, (x: T) => '', 1); // error ~~~~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. var r12 = c3.foo3(1, function (a) { return '' }, 1); // error ~~~~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. } } \ No newline at end of file diff --git a/tests/baselines/reference/genericRestArgs.errors.txt b/tests/baselines/reference/genericRestArgs.errors.txt index a286e154923..9c4b89639d8 100644 --- a/tests/baselines/reference/genericRestArgs.errors.txt +++ b/tests/baselines/reference/genericRestArgs.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/genericRestArgs.ts(2,12): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/compiler/genericRestArgs.ts(2,12): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. tests/cases/compiler/genericRestArgs.ts(5,34): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -tests/cases/compiler/genericRestArgs.ts(10,12): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/compiler/genericRestArgs.ts(10,12): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. tests/cases/compiler/genericRestArgs.ts(12,30): error TS2345: Argument of type 'number' is not assignable to parameter of type 'any[]'. @@ -8,7 +8,7 @@ tests/cases/compiler/genericRestArgs.ts(12,30): error TS2345: Argument of type ' function makeArrayG(...items: T[]): T[] { return items; } var a1Ga = makeArrayG(1, ""); // no error ~~~~~~~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. var a1Gb = makeArrayG(1, ""); var a1Gc = makeArrayG(1, ""); var a1Gd = makeArrayG(1, ""); // error @@ -20,7 +20,7 @@ tests/cases/compiler/genericRestArgs.ts(12,30): error TS2345: Argument of type ' } var a2Ga = makeArrayGOpt(1, ""); ~~~~~~~~~~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. var a2Gb = makeArrayG(1, ""); var a2Gc = makeArrayG(1, ""); // error ~ diff --git a/tests/baselines/reference/parser15.4.4.14-9-2.errors.txt b/tests/baselines/reference/parser15.4.4.14-9-2.errors.txt index a55c1820e66..363094b8b08 100644 --- a/tests/baselines/reference/parser15.4.4.14-9-2.errors.txt +++ b/tests/baselines/reference/parser15.4.4.14-9-2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/parser15.4.4.14-9-2.ts(16,15): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/conformance/parser/ecmascript5/parser15.4.4.14-9-2.ts(16,15): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. tests/cases/conformance/parser/ecmascript5/parser15.4.4.14-9-2.ts(25,1): error TS2304: Cannot find name 'runTestCase'. @@ -20,7 +20,7 @@ tests/cases/conformance/parser/ecmascript5/parser15.4.4.14-9-2.ts(25,1): error T var _float = -(4/3); var a = new Array(false,undefined,null,"0",obj,-1.3333333333333, "str",-0,true,+0, one, 1,0, false, _float, -(4/3)); ~~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. if (a.indexOf(-(4/3)) === 14 && // a[14]=_float===-(4/3) a.indexOf(0) === 7 && // a[7] = +0, 0===+0 a.indexOf(-0) === 7 && // a[7] = +0, -0===+0 diff --git a/tests/baselines/reference/promisePermutations.errors.txt b/tests/baselines/reference/promisePermutations.errors.txt index 87946dee3d1..845db19c2f9 100644 --- a/tests/baselines/reference/promisePermutations.errors.txt +++ b/tests/baselines/reference/promisePermutations.errors.txt @@ -20,13 +20,13 @@ tests/cases/compiler/promisePermutations.ts(120,19): error TS2345: Argument of t tests/cases/compiler/promisePermutations.ts(121,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/promisePermutations.ts(122,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/promisePermutations.ts(126,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/promisePermutations.ts(129,11): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/compiler/promisePermutations.ts(129,11): error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. tests/cases/compiler/promisePermutations.ts(132,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/promisePermutations.ts(133,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/promisePermutations.ts(134,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/promisePermutations.ts(137,11): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. -tests/cases/compiler/promisePermutations.ts(144,12): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. -tests/cases/compiler/promisePermutations.ts(152,12): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/compiler/promisePermutations.ts(137,11): error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/compiler/promisePermutations.ts(144,12): error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/compiler/promisePermutations.ts(152,12): error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. 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'. tests/cases/compiler/promisePermutations.ts(158,21): error TS2345: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. tests/cases/compiler/promisePermutations.ts(159,21): error TS2345: Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => Promise'. @@ -208,7 +208,7 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t var r9c = r9.then(nIPromise, nIPromise, nIPromise); // ok var r9d = r9.then(testFunction, sIPromise, nIPromise); // ok ~~~~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. var r9e = r9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s9: Promise; var s9a = s9.then(testFunction9, testFunction9, testFunction9); // error @@ -224,7 +224,7 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t var s9e = s9.then(nPromise, nPromise, nPromise); // ok var s9f = s9.then(testFunction, sIPromise, nIPromise); // error ~~~~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. var s9g = s9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var r10 = testFunction10(x => x); @@ -233,7 +233,7 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t var r10c = r10.then(nIPromise, nIPromise, nIPromise); // ok var r10d = r10.then(testFunction, sIPromise, nIPromise); // ok ~~~~~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. var r10e = r10.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s10 = testFunction10P(x => x); var s10a = s10.then(testFunction10, testFunction10, testFunction10); // ok @@ -243,7 +243,7 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t var s10e = s10.then(nIPromise, nPromise, nIPromise); // ok var s10f = s10.then(testFunctionP, sIPromise, nIPromise); // error ~~~~~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok var r11: IPromise; diff --git a/tests/baselines/reference/promisePermutations2.errors.txt b/tests/baselines/reference/promisePermutations2.errors.txt index dbfa743f684..31cb1e2203b 100644 --- a/tests/baselines/reference/promisePermutations2.errors.txt +++ b/tests/baselines/reference/promisePermutations2.errors.txt @@ -20,13 +20,13 @@ tests/cases/compiler/promisePermutations2.ts(119,19): error TS2345: Argument of 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,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 TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/compiler/promisePermutations2.ts(128,11): error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. 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,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 TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. -tests/cases/compiler/promisePermutations2.ts(143,12): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. -tests/cases/compiler/promisePermutations2.ts(151,12): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/compiler/promisePermutations2.ts(136,11): error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/compiler/promisePermutations2.ts(143,12): error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/compiler/promisePermutations2.ts(151,12): error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. 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'. tests/cases/compiler/promisePermutations2.ts(157,21): error TS2345: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. 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'. @@ -207,7 +207,7 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of var r9c = r9.then(nIPromise, nIPromise, nIPromise); // ok var r9d = r9.then(testFunction, sIPromise, nIPromise); // error ~~~~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. var r9e = r9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s9: Promise; var s9a = s9.then(testFunction9, testFunction9, testFunction9); // error @@ -223,7 +223,7 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of var s9e = s9.then(nPromise, nPromise, nPromise); // ok var s9f = s9.then(testFunction, sIPromise, nIPromise); // error ~~~~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. var s9g = s9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var r10 = testFunction10(x => x); @@ -232,7 +232,7 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of var r10c = r10.then(nIPromise, nIPromise, nIPromise); // ok var r10d = r10.then(testFunction, sIPromise, nIPromise); // error ~~~~~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. var r10e = r10.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s10 = testFunction10P(x => x); var s10a = s10.then(testFunction10, testFunction10, testFunction10); // ok @@ -242,7 +242,7 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of var s10e = s10.then(nIPromise, nPromise, nIPromise); // ok var s10f = s10.then(testFunctionP, sIPromise, nIPromise); // error ~~~~~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok var r11: IPromise; diff --git a/tests/baselines/reference/promisePermutations3.errors.txt b/tests/baselines/reference/promisePermutations3.errors.txt index 62e5d87b66f..c2e200f9111 100644 --- a/tests/baselines/reference/promisePermutations3.errors.txt +++ b/tests/baselines/reference/promisePermutations3.errors.txt @@ -21,13 +21,13 @@ tests/cases/compiler/promisePermutations3.ts(119,19): error TS2345: Argument of tests/cases/compiler/promisePermutations3.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/promisePermutations3.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/promisePermutations3.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/promisePermutations3.ts(128,11): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/compiler/promisePermutations3.ts(128,11): error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. tests/cases/compiler/promisePermutations3.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/promisePermutations3.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/promisePermutations3.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/promisePermutations3.ts(136,11): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. -tests/cases/compiler/promisePermutations3.ts(143,12): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. -tests/cases/compiler/promisePermutations3.ts(151,12): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/compiler/promisePermutations3.ts(136,11): error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/compiler/promisePermutations3.ts(143,12): error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/compiler/promisePermutations3.ts(151,12): error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. tests/cases/compiler/promisePermutations3.ts(155,21): error TS2345: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. tests/cases/compiler/promisePermutations3.ts(157,21): error TS2345: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. tests/cases/compiler/promisePermutations3.ts(158,21): error TS2345: Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => Promise'. @@ -211,7 +211,7 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of var r9c = r9.then(nIPromise, nIPromise, nIPromise); // ok var r9d = r9.then(testFunction, sIPromise, nIPromise); // error ~~~~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. var r9e = r9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s9: Promise; var s9a = s9.then(testFunction9, testFunction9, testFunction9); // error @@ -227,7 +227,7 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of var s9e = s9.then(nPromise, nPromise, nPromise); // ok var s9f = s9.then(testFunction, sIPromise, nIPromise); // error ~~~~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. var s9g = s9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var r10 = testFunction10(x => x); @@ -236,7 +236,7 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of var r10c = r10.then(nIPromise, nIPromise, nIPromise); // ok var r10d = r10.then(testFunction, sIPromise, nIPromise); // error ~~~~~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. var r10e = r10.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s10 = testFunction10P(x => x); var s10a = s10.then(testFunction10, testFunction10, testFunction10); // ok @@ -246,7 +246,7 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of var s10e = s10.then(nIPromise, nPromise, nIPromise); // ok var s10f = s10.then(testFunctionP, sIPromise, nIPromise); // error ~~~~~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Try specifying the type arguments explicitly. var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok var r11: IPromise; diff --git a/tests/baselines/reference/typeArgInference2.errors.txt b/tests/baselines/reference/typeArgInference2.errors.txt index 50fe513a95d..5c100a2f104 100644 --- a/tests/baselines/reference/typeArgInference2.errors.txt +++ b/tests/baselines/reference/typeArgInference2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/typeArgInference2.ts(12,10): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/compiler/typeArgInference2.ts(12,10): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. ==== tests/cases/compiler/typeArgInference2.ts (1 errors) ==== @@ -15,4 +15,4 @@ tests/cases/compiler/typeArgInference2.ts(12,10): error TS2448: The type argumen var z5 = foo({ name: "abc", a: 5 }); // { name: string; a: number } var z6 = foo({ name: "abc", a: 5 }, { name: "def", b: 5 }); // error ~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. \ No newline at end of file +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. \ No newline at end of file diff --git a/tests/baselines/reference/typeArgInference2WithError.errors.txt b/tests/baselines/reference/typeArgInference2WithError.errors.txt index e6d2aee567d..2ab40a670bd 100644 --- a/tests/baselines/reference/typeArgInference2WithError.errors.txt +++ b/tests/baselines/reference/typeArgInference2WithError.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/typeArgInference2WithError.ts(7,10): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/compiler/typeArgInference2WithError.ts(7,10): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. ==== tests/cases/compiler/typeArgInference2WithError.ts (1 errors) ==== @@ -10,4 +10,4 @@ tests/cases/compiler/typeArgInference2WithError.ts(7,10): error TS2448: The type var z7 = foo("abc", 5); // Error ~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. \ No newline at end of file +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. \ No newline at end of file diff --git a/tests/baselines/reference/typeArgumentInference.errors.txt b/tests/baselines/reference/typeArgumentInference.errors.txt index 980f6d6d65d..5f0f24a2614 100644 --- a/tests/baselines/reference/typeArgumentInference.errors.txt +++ b/tests/baselines/reference/typeArgumentInference.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(68,11): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. -tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(82,11): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(68,11): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(82,11): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. ==== tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts (2 errors) ==== @@ -72,7 +72,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(82,11 } var a9a = someGenerics9('', 0, []); ~~~~~~~~~~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. var a9a: {}; var a9b = someGenerics9<{ a?: number; b?: string; }>({ a: 0 }, { b: '' }, null); var a9b: { a?: number; b?: string; }; @@ -88,7 +88,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(82,11 } var a9e = someGenerics9(undefined, { x: 6, z: new Date() }, { x: 6, y: '' }); ~~~~~~~~~~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. var a9e: {}; var a9f = someGenerics9(undefined, { x: 6, z: new Date() }, { x: 6, y: '' }); var a9f: A92; diff --git a/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt b/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt index 01c355fa688..09734d0194c 100644 --- a/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt +++ b/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt @@ -3,9 +3,9 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(61,39): error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(71,39): error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(81,45): error TS2345: Argument of type '(n: string) => string' is not assignable to parameter of type '(b: number) => number'. -tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(106,15): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(106,15): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(118,9): error TS2304: Cannot find name 'Window'. -tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(120,15): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(120,15): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(120,51): error TS2304: Cannot find name 'window'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(122,56): error TS2304: Cannot find name 'window'. @@ -128,7 +128,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct var someGenerics9: someGenerics9; var a9a = new someGenerics9('', 0, []); ~~~~~~~~~~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. var a9a: {}; var a9b = new someGenerics9<{ a?: number; b?: string; }>({ a: 0 }, { b: '' }, null); var a9b: { a?: number; b?: string; }; @@ -146,7 +146,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct } var a9e = new someGenerics9(undefined, { x: 6, z: window }, { x: 6, y: '' }); ~~~~~~~~~~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. ~~~~~~ !!! error TS2304: Cannot find name 'window'. var a9e: {}; diff --git a/tests/baselines/reference/typeArgumentInferenceWithConstraintAsCommonRoot.errors.txt b/tests/baselines/reference/typeArgumentInferenceWithConstraintAsCommonRoot.errors.txt index 112e44046d8..ee3c71cd801 100644 --- a/tests/baselines/reference/typeArgumentInferenceWithConstraintAsCommonRoot.errors.txt +++ b/tests/baselines/reference/typeArgumentInferenceWithConstraintAsCommonRoot.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/typeArgumentInferenceWithConstraintAsCommonRoot.ts(7,1): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/compiler/typeArgumentInferenceWithConstraintAsCommonRoot.ts(7,1): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. ==== tests/cases/compiler/typeArgumentInferenceWithConstraintAsCommonRoot.ts (1 errors) ==== @@ -10,4 +10,4 @@ tests/cases/compiler/typeArgumentInferenceWithConstraintAsCommonRoot.ts(7,1): er var e: Elephant; f(g, e); // valid because both Giraffe and Elephant satisfy the constraint. T is Animal ~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. \ No newline at end of file +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. \ No newline at end of file diff --git a/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt b/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt index 44d51f0a428..b3a1d65b3db 100644 --- a/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt +++ b/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt @@ -8,9 +8,9 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(49,15): error TS2344: Type 'string' does not satisfy the constraint 'number'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(55,41): error TS2345: Argument of type '(n: string) => string' is not assignable to parameter of type '(b: number) => number'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(66,31): error TS2345: Argument of type '(a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) => void' is not assignable to parameter of type 'string'. -tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(73,11): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(73,11): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(85,9): error TS2304: Cannot find name 'Window'. -tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(87,11): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(87,11): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(87,47): error TS2304: Cannot find name 'window'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(89,52): error TS2304: Cannot find name 'window'. @@ -110,7 +110,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst } var a9a = someGenerics9('', 0, []); ~~~~~~~~~~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. var a9a: {}; var a9b = someGenerics9<{ a?: number; b?: string; }>({ a: 0 }, { b: '' }, null); var a9b: { a?: number; b?: string; }; @@ -128,7 +128,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst } var a9e = someGenerics9(undefined, { x: 6, z: window }, { x: 6, y: '' }); ~~~~~~~~~~~~~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. ~~~~~~ !!! error TS2304: Cannot find name 'window'. var a9e: {}; diff --git a/tests/baselines/reference/typeInferenceConflictingCandidates.errors.txt b/tests/baselines/reference/typeInferenceConflictingCandidates.errors.txt index daf08be37db..f577f55c70d 100644 --- a/tests/baselines/reference/typeInferenceConflictingCandidates.errors.txt +++ b/tests/baselines/reference/typeInferenceConflictingCandidates.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/typeInferenceConflictingCandidates.ts(3,1): error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. +tests/cases/compiler/typeInferenceConflictingCandidates.ts(3,1): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. ==== tests/cases/compiler/typeInferenceConflictingCandidates.ts (1 errors) ==== @@ -6,4 +6,4 @@ tests/cases/compiler/typeInferenceConflictingCandidates.ts(3,1): error TS2448: T g("", 3, a => a); ~ -!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. \ No newline at end of file +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Try specifying the type arguments explicitly. \ No newline at end of file diff --git a/tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints3.ts b/tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints3.ts index 2fffc6cba44..a7e7e337ead 100644 --- a/tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints3.ts +++ b/tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints3.ts @@ -15,7 +15,7 @@ function f(a: { x: T; y: T }) { return r; } -var r1 = f({ x: new Derived(), y: new Derived2() }); // ok, both extend Base +var r1 = f({ x: new Derived(), y: new Derived2() }); // error because neither is supertype of the other function f2(a: U) { var r: T; @@ -30,7 +30,7 @@ function f3(y: (a: T) => T, x: T) { return y(null); } -// all ok - T gets fixed too early, but then defaults to Base and everything works out +// all ok - second argument is processed before x is fixed var r4 = f3(x => x, new Base()); var r5 = f3(x => x, new Derived()); var r6 = f3(x => x, null);