From d3af1e3c4abf72d45d57da142b11ae670d896079 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Fri, 17 Oct 2014 18:05:54 -0700 Subject: [PATCH 01/13] Move overload resolution logic into chooseOverload function --- src/compiler/checker.ts | 72 +++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 229fcf51f17..38f13c6524a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5153,13 +5153,51 @@ module ts { excludeArgument[i] = true; } } - var relation = candidates.length === 1 ? assignableRelation : subtypeRelation; + var lastCandidate: Signature; - while (true) { + var result: Signature; + if (candidates.length > 1) { + result = chooseOverload(candidates, subtypeRelation, excludeArgument); + } + if (!result) { + result = chooseOverload(candidates, assignableRelation, excludeArgument); + } + if (result) { + return result; + } + + // No signatures were applicable. Now report errors based on the last applicable signature with + // no arguments excluded from assignability checks. + // If candidate is undefined, it means that no candidates had a suitable arity. In that case, + // skip the checkApplicableSignature check. + if (lastCandidate) { + checkApplicableSignature(node, lastCandidate, assignableRelation, /*excludeArgument*/ undefined, /*reportErrors*/ true); + } + else { + error(node, Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); + } + + // No signature was applicable. We have already reported the errors for the invalid signature. + // If this is a type resolution session, e.g. Language Service, try to get better information that anySignature. + // Pick the first candidate that matches the arity. This way we can get a contextual type for cases like: + // declare function f(a: { xa: number; xb: number; }); + // f({ | + if (!fullTypeCheck) { + for (var i = 0, n = candidates.length; i < n; i++) { + if (signatureHasCorrectArity(node, candidates[i])) { + return candidates[i]; + } + } + } + + return resolveErrorCall(node); + + function chooseOverload(candidates: Signature[], relation: Map, excludeArgument: boolean[]) { for (var i = 0; i < candidates.length; i++) { if (!signatureHasCorrectArity(node, candidates[i])) { continue; } + while (true) { var candidate = candidates[i]; if (candidate.typeParameters) { @@ -5182,37 +5220,9 @@ module ts { excludeArgument[index] = false; } } - if (relation === assignableRelation) { - break; - } - relation = assignableRelation; - } - // No signatures were applicable. Now report errors based on the last applicable signature with - // no arguments excluded from assignability checks. - // If candidate is undefined, it means that no candidates had a suitable arity. In that case, - // skip the checkApplicableSignature check. - if (lastCandidate) { - checkApplicableSignature(node, lastCandidate, relation, /*excludeArgument*/ undefined, /*reportErrors*/ true); + return undefined; } - else { - error(node, Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); - } - - // No signature was applicable. We have already reported the errors for the invalid signature. - // If this is a type resolution session, e.g. Language Service, try to get better information that anySignature. - // Pick the first candidate that matches the arity. This way we can get a contextual type for cases like: - // declare function f(a: { xa: number; xb: number; }); - // f({ | - if (!fullTypeCheck) { - for (var i = 0, n = candidates.length; i < n; i++) { - if (signatureHasCorrectArity(node, candidates[i])) { - return candidates[i]; - } - } - } - - return resolveErrorCall(node); // The candidate list orders groups in reverse, but within a group signatures are kept in declaration order // A nit here is that we reorder only signatures that belong to the same symbol, From f6b7bfa948a33419116250a04e7e69e44c4ae6f6 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 21 Oct 2014 11:21:06 -0700 Subject: [PATCH 02/13] Begin refactoring overload resolution to collect more info --- src/compiler/checker.ts | 69 ++++++++++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 25 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 38f13c6524a..7250133236f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3844,8 +3844,8 @@ module ts { callback(s, t); } } - - function createInferenceContext(typeParameters: TypeParameter[], inferUnionTypes: boolean): InferenceContext { + + function createInferenceContext(typeParameters: TypeParameter[], inferUnionTypes: boolean, typeArgumentResultTypes?: Type[]): InferenceContext { var inferences: Type[][] = []; for (var i = 0; i < typeParameters.length; i++) inferences.push([]); return { @@ -3853,7 +3853,7 @@ module ts { inferUnionTypes: inferUnionTypes, inferenceCount: 0, inferences: inferences, - inferredTypes: new Array(typeParameters.length), + inferredTypes: typeArgumentResultTypes || new Array(typeParameters.length), }; } @@ -5066,9 +5066,9 @@ module ts { return getSignatureInstantiation(signature, getInferredTypes(context)); } - function inferTypeArguments(signature: Signature, args: Expression[], excludeArgument?: boolean[]): Type[] { - var typeParameters = signature.typeParameters; - var context = createInferenceContext(typeParameters, /*inferUnionTypes*/ false); + function inferTypeArguments(signature: Signature, args: Expression[], typeArgumentResultTypes: Type[], excludeArgument?: boolean[]): boolean { + var typeParameters = signature.typeParameters; + var context = createInferenceContext(typeParameters, /*inferUnionTypes*/ false, typeArgumentResultTypes); var mapper = createInferenceMapper(context); // First infer from arguments that are not context sensitive for (var i = 0; i < args.length; i++) { @@ -5094,22 +5094,27 @@ module ts { } var inferredTypes = getInferredTypes(context); // Inference has failed if the undefined type is in list of inferences - return contains(inferredTypes, undefinedType) ? undefined : inferredTypes; + return !contains(inferredTypes, undefinedType); } - function checkTypeArguments(signature: Signature, typeArguments: TypeNode[]): Type[] { + function checkTypeArguments(signature: Signature, typeArguments: TypeNode[], typeArgumentResultTypes: Type[], reportErrors: boolean): boolean { var typeParameters = signature.typeParameters; - var result: Type[] = []; + var typeArgumentsAreAssignable = true; for (var i = 0; i < typeParameters.length; i++) { var typeArgNode = typeArguments[i]; var typeArgument = getTypeFromTypeNode(typeArgNode); - var constraint = getConstraintOfTypeParameter(typeParameters[i]); - if (constraint && fullTypeCheck) { - checkTypeAssignableTo(typeArgument, constraint, typeArgNode, Diagnostics.Type_0_does_not_satisfy_the_constraint_1_Colon, Diagnostics.Type_0_does_not_satisfy_the_constraint_1); + // Do not push on this array! It has a preallocated length + typeArgumentResultTypes[i] = typeArgument; + if (typeArgumentsAreAssignable /* so far */) { + var constraint = getConstraintOfTypeParameter(typeParameters[i]); + if (constraint) { + typeArgumentsAreAssignable = typeArgumentsAreAssignable && + checkTypeAssignableTo(typeArgument, constraint, reportErrors ? typeArgNode : undefined, + Diagnostics.Type_0_does_not_satisfy_the_constraint_1_Colon, Diagnostics.Type_0_does_not_satisfy_the_constraint_1); + } } - result.push(typeArgument); } - return result; + return typeArgumentsAreAssignable; } function checkApplicableSignature(node: CallExpression, signature: Signature, relation: Map, excludeArgument: boolean[], reportErrors: boolean) { @@ -5154,12 +5159,16 @@ module ts { } } - var lastCandidate: Signature; + var lastCandidateWithCorrectArity: Signature; + var lastCandidateWithValidTypeArguments: Signature; var result: Signature; if (candidates.length > 1) { result = chooseOverload(candidates, subtypeRelation, excludeArgument); } if (!result) { + // Reinitialize these pointers for round two + lastCandidateWithCorrectArity = undefined; + lastCandidateWithValidTypeArguments = undefined; result = chooseOverload(candidates, assignableRelation, excludeArgument); } if (result) { @@ -5170,8 +5179,8 @@ module ts { // no arguments excluded from assignability checks. // If candidate is undefined, it means that no candidates had a suitable arity. In that case, // skip the checkApplicableSignature check. - if (lastCandidate) { - checkApplicableSignature(node, lastCandidate, assignableRelation, /*excludeArgument*/ undefined, /*reportErrors*/ true); + if (lastCandidateWithValidTypeArguments || lastCandidateWithCorrectArity) { + checkApplicableSignature(node, lastCandidateWithValidTypeArguments || lastCandidateWithCorrectArity, assignableRelation, /*excludeArgument*/ undefined, /*reportErrors*/ true); } else { error(node, Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); @@ -5197,28 +5206,38 @@ module ts { if (!signatureHasCorrectArity(node, candidates[i])) { continue; } + lastCandidateWithCorrectArity = candidates[i]; while (true) { - var candidate = candidates[i]; + var candidate = lastCandidateWithCorrectArity; if (candidate.typeParameters) { - var typeArguments = node.typeArguments ? - checkTypeArguments(candidate, node.typeArguments) : - inferTypeArguments(candidate, args, excludeArgument); - if (!typeArguments) { + var typeArgumentTypes = new Array(candidate.typeParameters.length); + var typeArgumentsAreValid = node.typeArguments ? + checkTypeArguments(candidate, node.typeArguments, typeArgumentTypes, /*reportErrors*/ false) : + inferTypeArguments(candidate, args, typeArgumentTypes, excludeArgument); + if (!typeArgumentsAreValid) { break; } - candidate = getSignatureInstantiation(candidate, typeArguments); + candidate = getSignatureInstantiation(candidate, typeArgumentTypes); } - lastCandidate = candidate; if (!checkApplicableSignature(node, candidate, relation, excludeArgument, /*reportErrors*/ false)) { break; } var index = excludeArgument ? indexOf(excludeArgument, true) : -1; if (index < 0) { - return candidate; + return candidates[i] = candidate; } excludeArgument[index] = false; } + + // This candidate was not applicable, but it may have had valid type arguments. + // If it did, update the signature to point to the instantiated signature. + if (lastCandidateWithCorrectArity.typeParameters) { + candidates[i] = candidate; // Replace with instantiated + if (typeArgumentsAreValid) { + lastCandidateWithValidTypeArguments = candidate; + } + } } return undefined; From 44f1ab07bf89a5123f226443cc557d1d6116230e Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 21 Oct 2014 15:32:45 -0700 Subject: [PATCH 03/13] Give different errors for different overload resolution issues --- src/compiler/checker.ts | 45 +++++++++++++------ .../diagnosticInformationMap.generated.ts | 1 + src/compiler/diagnosticMessages.json | 4 ++ ...lTypingWithFixedTypeParameters1.errors.txt | 6 +-- ...defaultBestCommonTypesHaveDecls.errors.txt | 6 +-- ...erInSignatureWithRestParameters.errors.txt | 6 +-- ...cCallWithFunctionTypedArguments.errors.txt | 34 +++++++------- ...CallWithFunctionTypedArguments2.errors.txt | 12 ++--- ...lWithGenericSignatureArguments2.errors.txt | 6 +-- ...lWithGenericSignatureArguments3.errors.txt | 12 ++--- ...enericCallWithObjectLiteralArgs.errors.txt | 6 +-- ...CallWithObjectLiteralArguments1.errors.txt | 8 ++-- .../genericCallWithObjectLiteralArguments1.js | 4 +- .../genericCallWithObjectTypeArgs.errors.txt | 6 +-- ...thObjectTypeArgsAndConstraints3.errors.txt | 6 +-- ...loadedConstructorTypedArguments.errors.txt | 6 +-- ...ithFunctionTypedMemberArguments.errors.txt | 26 +++++------ .../reference/genericConstraint2.errors.txt | 6 +-- .../reference/genericRestArgs.errors.txt | 12 ++--- .../reference/overloadResolution.errors.txt | 27 ++--------- ...loadResolutionClassConstructors.errors.txt | 14 +----- .../overloadResolutionConstructors.errors.txt | 33 +++----------- .../reference/parser15.4.4.14-9-2.errors.txt | 6 +-- .../reference/promisePermutations.errors.txt | 24 +++++----- .../reference/promisePermutations2.errors.txt | 24 +++++----- .../reference/promisePermutations3.errors.txt | 24 +++++----- .../reference/typeArgInference2.errors.txt | 6 +-- .../typeArgInference2WithError.errors.txt | 6 +-- ...peArgumentConstraintResolution1.errors.txt | 6 +-- .../typeArgumentInference.errors.txt | 12 ++--- ...entInferenceConstructSignatures.errors.txt | 12 ++--- ...renceWithConstraintAsCommonRoot.errors.txt | 6 +-- ...rgumentInferenceWithConstraints.errors.txt | 12 ++--- ...eInferenceConflictingCandidates.errors.txt | 6 +-- .../genericCallWithObjectLiteralArguments1.ts | 2 +- 35 files changed, 196 insertions(+), 236 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7250133236f..0d393f9783c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5159,16 +5159,16 @@ module ts { } } - var lastCandidateWithCorrectArity: Signature; - var lastCandidateWithValidTypeArguments: Signature; + var candidateForArgumentError: Signature; + var candidateForTypeArgumentError: Signature; var result: Signature; if (candidates.length > 1) { result = chooseOverload(candidates, subtypeRelation, excludeArgument); } if (!result) { // Reinitialize these pointers for round two - lastCandidateWithCorrectArity = undefined; - lastCandidateWithValidTypeArguments = undefined; + candidateForArgumentError = undefined; + candidateForTypeArgumentError = undefined; result = chooseOverload(candidates, assignableRelation, excludeArgument); } if (result) { @@ -5179,8 +5179,16 @@ module ts { // no arguments excluded from assignability checks. // If candidate is undefined, it means that no candidates had a suitable arity. In that case, // skip the checkApplicableSignature check. - if (lastCandidateWithValidTypeArguments || lastCandidateWithCorrectArity) { - checkApplicableSignature(node, lastCandidateWithValidTypeArguments || lastCandidateWithCorrectArity, assignableRelation, /*excludeArgument*/ undefined, /*reportErrors*/ true); + if (candidateForArgumentError) { + checkApplicableSignature(node, candidateForArgumentError, assignableRelation, /*excludeArgument*/ undefined, /*reportErrors*/ true); + } + else if (candidateForTypeArgumentError) { + if (node.typeArguments) { + 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); + } } else { error(node, Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); @@ -5206,10 +5214,11 @@ module ts { if (!signatureHasCorrectArity(node, candidates[i])) { continue; } - lastCandidateWithCorrectArity = candidates[i]; + + var originalCandidate = candidates[i]; while (true) { - var candidate = lastCandidateWithCorrectArity; + var candidate = originalCandidate; if (candidate.typeParameters) { var typeArgumentTypes = new Array(candidate.typeParameters.length); var typeArgumentsAreValid = node.typeArguments ? @@ -5230,13 +5239,23 @@ module ts { excludeArgument[index] = false; } - // This candidate was not applicable, but it may have had valid type arguments. - // If it did, update the signature to point to the instantiated signature. - if (lastCandidateWithCorrectArity.typeParameters) { - candidates[i] = candidate; // Replace with instantiated + // A post-mortem of this iteration of the loop. The signature was not applicable, + // so we want to track it as a candidate for reporting an error. If the candidate + // had no type parameters, or had no issues related to type arguments, we can + // report an error based on the arguments. If there was an issue with type + // arguments, then we can only report an error based on the type arguments. + if (originalCandidate.typeParameters) { + var instantiatedCandidate = candidate; + candidates[i] = instantiatedCandidate; if (typeArgumentsAreValid) { - lastCandidateWithValidTypeArguments = candidate; + candidateForArgumentError = instantiatedCandidate; } + else { + candidateForTypeArgumentError = originalCandidate; + } + } + else { + candidateForArgumentError = originalCandidate; // Could be candidate too } } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index ac2a79c603d..f0620c210e8 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -261,6 +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." }, 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 d8895d15144..4ef5d67b453 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1036,6 +1036,10 @@ "category": "Error", "code": 2447 }, + "The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly.": { + "category": "Error", + "code": 2448 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", diff --git a/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.errors.txt b/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.errors.txt index a524fd3be31..932e78369a9 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 TS2346: Supplied parameters do not match any signature of call target. +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 (2 errors) ==== @@ -8,5 +8,5 @@ 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 TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file + ~~~ +!!! error TS2448: The type arguments 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 21296783f28..f8f79f3cb65 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 TS2346: Supplied parameters do not match any signature of call target. +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 (3 errors) ==== @@ -16,8 +16,8 @@ tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts(8,14): error TS2346: Sup function concat(x: T, y: T): T { return null; } var result = concat(1, ""); // error - ~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~~~~ +!!! error TS2448: The type arguments 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 d9416eb4c25..8c206ca1051 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 TS2346: Supplied parameters do not match any signature of call target. +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 (1 errors) ==== function bar(item1: T, item2: T) { } bar(1, ""); // Should be ok - ~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file + ~~~ +!!! error TS2448: The type arguments 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 36a22868333..c747a83fde3 100644 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt @@ -1,10 +1,8 @@ -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(26,18): error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => number'. - Type 'string' is not assignable to type 'number'. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(30,15): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(33,15): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(34,16): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(35,23): error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => number'. - Type 'string' is not assignable to type 'number'. +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 (5 errors) ==== @@ -34,25 +32,23 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun var r7 = foo3(1, (a: Z) => '', ''); // string var r8 = foo3(1, function (a) { return '' }, 1); // error - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => number'. -!!! error TS2345: Type 'string' is not assignable to type 'number'. + ~~~~ +!!! error TS2448: The type arguments 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 TS2346: Supplied parameters do not match any signature of call target. + ~~~~ +!!! error TS2448: The type arguments 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 TS2346: Supplied parameters do not match any signature of call target. + ~~~~ +!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. var r11b = foo3(1, (x: T) => '', 1); // error - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~~ +!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. var r12 = foo3(1, function (a) { return '' }, 1); // error - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => number'. -!!! error TS2345: Type 'string' is not assignable to type 'number'. + ~~~~ +!!! error TS2448: The type arguments 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 083d197bbb4..21a69b75ecf 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 TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments2.ts(40,10): error TS2346: Supplied parameters do not match any signature of call target. +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 (2 errors) ==== @@ -32,8 +32,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun } var r4 = foo2(1, i2); // error - ~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~~ +!!! error TS2448: The type arguments 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 @@ -45,6 +45,6 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun var r7 = foo3(null, i, ''); // any var r7b = foo3(null, a, ''); // any var r8 = foo3(1, i2, 1); // error - ~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~~ +!!! error TS2448: The type arguments 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/genericCallWithGenericSignatureArguments2.errors.txt b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt index 55318f268bd..8bfbc1d08c4 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 TS2346: Supplied parameters do not match any signature of call target. +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(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'. @@ -21,8 +21,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen } var r1: (x: {}) => {} = foo((x: number) => 1, (x: string) => ''); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~ +!!! error TS2448: The type arguments 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 0a42d940625..6a7ee5ab616 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 TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3.ts(33,11): error TS2346: Supplied parameters do not match any signature of call target. +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 (2 errors) ==== @@ -35,8 +35,8 @@ 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 TS2346: Supplied parameters do not match any signature of call target. + ~~~~ +!!! error TS2448: The type arguments 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 TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file + ~~~~ +!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithObjectLiteralArgs.errors.txt b/tests/baselines/reference/genericCallWithObjectLiteralArgs.errors.txt index 856f35a57f6..0ce87808d51 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 TS2346: Supplied parameters do not match any signature of call target. +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 (1 errors) ==== @@ -7,8 +7,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObj } var r = foo({ bar: 1, baz: '' }); // error - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~ +!!! error TS2448: The type arguments 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 4ac64500bd1..666cb36dda9 100644 --- a/tests/baselines/reference/genericCallWithObjectLiteralArguments1.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectLiteralArguments1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts(2,9): error TS2346: Supplied parameters do not match any signature of call target. +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(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'. @@ -15,10 +15,10 @@ tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts(7,22): error TS23 ==== tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts (5 errors) ==== function foo(n: { x: T; y: T }, m: T) { return m; } - var x = foo({ x: 3, y: "" }, 4); // no error, x is Object, the best common type - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. // 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. 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/genericCallWithObjectLiteralArguments1.js b/tests/baselines/reference/genericCallWithObjectLiteralArguments1.js index 293a54e425f..c289ce3de14 100644 --- a/tests/baselines/reference/genericCallWithObjectLiteralArguments1.js +++ b/tests/baselines/reference/genericCallWithObjectLiteralArguments1.js @@ -1,7 +1,7 @@ //// [genericCallWithObjectLiteralArguments1.ts] function foo(n: { x: T; y: T }, m: T) { return m; } -var x = foo({ x: 3, y: "" }, 4); // no error, x is Object, the best common type // these are all errors +var x = foo({ x: 3, y: "" }, 4); var x2 = foo({ x: 3, y: "" }, 4); var x3 = foo({ x: 3, y: "" }, 4); var x4 = foo({ x: "", y: 4 }, ""); @@ -11,8 +11,8 @@ var x5 = foo({ x: "", y: 4 }, ""); function foo(n, m) { return m; } -var x = foo({ x: 3, y: "" }, 4); // no error, x is Object, the best common type // these are all errors +var x = foo({ x: 3, y: "" }, 4); var x2 = foo({ x: 3, y: "" }, 4); var x3 = foo({ x: 3, y: "" }, 4); var x4 = foo({ x: "", y: 4 }, ""); diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgs.errors.txt b/tests/baselines/reference/genericCallWithObjectTypeArgs.errors.txt index dce9562a8f5..cf6a731bff6 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 TS2346: Supplied parameters do not match any signature of call target. +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 (1 errors) ==== @@ -22,6 +22,6 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObj var c1 = new X(); var d1 = new X(); var r = foo(c1, d1); // error - ~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~ +!!! error TS2448: The type arguments 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 9cb190ddecd..9fa2245d9e6 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 TS2346: Supplied parameters do not match any signature of call target. +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(20,29): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. @@ -21,8 +21,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObj } var r1 = f({ x: new Derived(), y: new Derived2() }); // ok, both extend Base - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~ +!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. function f2(a: U) { ~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.errors.txt b/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.errors.txt index 3ddb094970a..657371faefb 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 TS2346: Supplied parameters do not match any signature of call target. +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 (1 errors) ==== @@ -38,8 +38,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOve } var r8 = foo6(a); // error - ~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~~ +!!! error TS2448: The type arguments 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 30ed4bc431f..2f56a3c8585 100644 --- a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt +++ b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt @@ -1,8 +1,7 @@ -tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(57,19): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(60,19): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(61,20): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(62,30): error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => number'. - Type 'string' is not assignable to type 'number'. +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 (4 errors) ==== @@ -63,19 +62,18 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFu function other(t: T, u: U) { var r10 = c.foo2(1, (x: T) => ''); // error - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~~~~ +!!! error TS2448: The type arguments 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 TS2346: Supplied parameters do not match any signature of call target. + ~~~~~~~ +!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. var r11b = c3.foo3(1, (x: T) => '', 1); // error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~~~~~ +!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. var r12 = c3.foo3(1, function (a) { return '' }, 1); // error - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => number'. -!!! error TS2345: Type 'string' is not assignable to type 'number'. + ~~~~~~~ +!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. } } \ No newline at end of file diff --git a/tests/baselines/reference/genericConstraint2.errors.txt b/tests/baselines/reference/genericConstraint2.errors.txt index e8635f24cee..482173ff075 100644 --- a/tests/baselines/reference/genericConstraint2.errors.txt +++ b/tests/baselines/reference/genericConstraint2.errors.txt @@ -1,8 +1,7 @@ tests/cases/compiler/genericConstraint2.ts(5,18): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. tests/cases/compiler/genericConstraint2.ts(11,7): error TS2421: Class 'ComparableString' incorrectly implements interface 'Comparable': Property 'comparer' is missing in type 'ComparableString'. -tests/cases/compiler/genericConstraint2.ts(21,17): error TS2343: Type 'ComparableString' does not satisfy the constraint 'Comparable': - Property 'comparer' is missing in type 'ComparableString'. +tests/cases/compiler/genericConstraint2.ts(21,17): error TS2344: Type 'ComparableString' does not satisfy the constraint 'Comparable'. ==== tests/cases/compiler/genericConstraint2.ts (3 errors) ==== @@ -33,5 +32,4 @@ tests/cases/compiler/genericConstraint2.ts(21,17): error TS2343: Type 'Comparabl var b = new ComparableString("b"); var c = compare(a, b); ~~~~~~~~~~~~~~~~ -!!! error TS2343: Type 'ComparableString' does not satisfy the constraint 'Comparable': -!!! error TS2343: Property 'comparer' is missing in type 'ComparableString'. \ No newline at end of file +!!! error TS2344: Type 'ComparableString' does not satisfy the constraint 'Comparable'. \ No newline at end of file diff --git a/tests/baselines/reference/genericRestArgs.errors.txt b/tests/baselines/reference/genericRestArgs.errors.txt index 49f61de325f..a286e154923 100644 --- a/tests/baselines/reference/genericRestArgs.errors.txt +++ b/tests/baselines/reference/genericRestArgs.errors.txt @@ -1,14 +1,14 @@ -tests/cases/compiler/genericRestArgs.ts(2,12): error TS2346: Supplied parameters do not match any signature of call target. +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(5,34): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -tests/cases/compiler/genericRestArgs.ts(10,12): error TS2346: Supplied parameters do not match any signature of call target. +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(12,30): error TS2345: Argument of type 'number' is not assignable to parameter of type 'any[]'. ==== tests/cases/compiler/genericRestArgs.ts (4 errors) ==== function makeArrayG(...items: T[]): T[] { return items; } var a1Ga = makeArrayG(1, ""); // no error - ~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~~~~~~~~ +!!! error TS2448: The type arguments 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 @@ -19,8 +19,8 @@ tests/cases/compiler/genericRestArgs.ts(12,30): error TS2345: Argument of type ' return [item1, item2, item3]; } var a2Ga = makeArrayGOpt(1, ""); - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~~~~~~~~~~~ +!!! error TS2448: The type arguments 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/overloadResolution.errors.txt b/tests/baselines/reference/overloadResolution.errors.txt index 729b52d6045..1d9f6cb6296 100644 --- a/tests/baselines/reference/overloadResolution.errors.txt +++ b/tests/baselines/reference/overloadResolution.errors.txt @@ -2,22 +2,15 @@ tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(27,5): e tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(41,11): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(63,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(70,5): error TS2344: Type 'string' does not satisfy the constraint 'number'. -tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(70,13): error TS2344: Type 'number' does not satisfy the constraint 'string'. -tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(70,21): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(71,5): error TS2344: Type 'number' does not satisfy the constraint 'string'. -tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(71,13): error TS2344: Type 'string' does not satisfy the constraint 'number'. -tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(71,21): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(72,5): error TS2344: Type 'number' does not satisfy the constraint 'string'. -tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(72,13): error TS2344: Type 'string' does not satisfy the constraint 'number'. -tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(81,5): error TS2344: Type 'boolean' does not satisfy the constraint 'string'. -tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(81,14): error TS2344: Type 'Date' does not satisfy the constraint 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(81,5): error TS2344: Type 'boolean' does not satisfy the constraint 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(84,5): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(85,11): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(91,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'n' must be of type 'number', but here has type 'string'. tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(91,22): error TS2339: Property 'toFixed' does not exist on type 'string'. -==== tests/cases/conformance/expressions/functionCalls/overloadResolution.ts (17 errors) ==== +==== tests/cases/conformance/expressions/functionCalls/overloadResolution.ts (10 errors) ==== class SomeBase { private n; @@ -96,22 +89,10 @@ tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(91,22): fn4(3, ''); // Error ~~~~~~ !!! error TS2344: Type 'string' does not satisfy the constraint 'number'. - ~~~~~~ -!!! error TS2344: Type 'number' does not satisfy the constraint 'string'. - ~ -!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. fn4('', 3); // Error ~~~~~~ !!! error TS2344: Type 'number' does not satisfy the constraint 'string'. - ~~~~~~ -!!! error TS2344: Type 'string' does not satisfy the constraint 'number'. - ~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. fn4(3, ''); - ~~~~~~ -!!! error TS2344: Type 'number' does not satisfy the constraint 'string'. - ~~~~~~ -!!! error TS2344: Type 'string' does not satisfy the constraint 'number'. // Generic overloads with constraints called without type arguments but with types that satisfy the constraints fn4('', 3); @@ -122,9 +103,7 @@ tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(91,22): // Generic overloads with constraints called with type arguments that do not satisfy the constraints fn4(null, null); // Error ~~~~~~~ -!!! error TS2344: Type 'boolean' does not satisfy the constraint 'string'. - ~~~~ -!!! error TS2344: Type 'Date' does not satisfy the constraint 'number'. +!!! error TS2344: Type 'boolean' does not satisfy the constraint 'number'. // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints fn4(true, null); // Error diff --git a/tests/baselines/reference/overloadResolutionClassConstructors.errors.txt b/tests/baselines/reference/overloadResolutionClassConstructors.errors.txt index 676d5ea12d0..c6737c3d792 100644 --- a/tests/baselines/reference/overloadResolutionClassConstructors.errors.txt +++ b/tests/baselines/reference/overloadResolutionClassConstructors.errors.txt @@ -4,21 +4,17 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstru tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(65,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(73,25): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(74,9): error TS2344: Type 'number' does not satisfy the constraint 'string'. -tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(74,17): error TS2344: Type 'string' does not satisfy the constraint 'number'. -tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(74,25): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(75,9): error TS2344: Type 'number' does not satisfy the constraint 'string'. -tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(75,17): error TS2344: Type 'string' does not satisfy the constraint 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(79,9): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(80,9): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(84,9): error TS2344: Type 'boolean' does not satisfy the constraint 'string'. -tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(84,18): error TS2344: Type 'Date' does not satisfy the constraint 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(87,9): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(88,15): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(96,18): error TS2339: Property 'toFixed' does not exist on type 'string'. tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(98,18): error TS2339: Property 'blah' does not exist on type 'string'. -==== tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts (18 errors) ==== +==== tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts (14 errors) ==== class SomeBase { private n; @@ -105,15 +101,9 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstru new fn4('', 3); // Error ~~~~~~ !!! error TS2344: Type 'number' does not satisfy the constraint 'string'. - ~~~~~~ -!!! error TS2344: Type 'string' does not satisfy the constraint 'number'. - ~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. new fn4(3, ''); // Error ~~~~~~ !!! error TS2344: Type 'number' does not satisfy the constraint 'string'. - ~~~~~~ -!!! error TS2344: Type 'string' does not satisfy the constraint 'number'. // Generic overloads with constraints called without type arguments but with types that satisfy the constraints new fn4('', 3); @@ -129,8 +119,6 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstru new fn4(null, null); // Error ~~~~~~~ !!! error TS2344: Type 'boolean' does not satisfy the constraint 'string'. - ~~~~ -!!! error TS2344: Type 'Date' does not satisfy the constraint 'number'. // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints new fn4(true, null); // Error diff --git a/tests/baselines/reference/overloadResolutionConstructors.errors.txt b/tests/baselines/reference/overloadResolutionConstructors.errors.txt index 0cbaec65c13..19052cc3f50 100644 --- a/tests/baselines/reference/overloadResolutionConstructors.errors.txt +++ b/tests/baselines/reference/overloadResolutionConstructors.errors.txt @@ -1,23 +1,16 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(27,9): error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. -tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(43,15): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(43,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(67,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(77,9): error TS2344: Type 'string' does not satisfy the constraint 'number'. -tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(77,17): error TS2344: Type 'number' does not satisfy the constraint 'string'. -tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(77,25): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(78,9): error TS2344: Type 'number' does not satisfy the constraint 'string'. -tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(78,17): error TS2344: Type 'string' does not satisfy the constraint 'number'. -tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(78,25): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(79,9): error TS2344: Type 'number' does not satisfy the constraint 'string'. -tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(79,17): error TS2344: Type 'string' does not satisfy the constraint 'number'. -tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(88,9): error TS2344: Type 'boolean' does not satisfy the constraint 'string'. -tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(88,18): error TS2344: Type 'Date' does not satisfy the constraint 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(88,9): error TS2344: Type 'boolean' does not satisfy the constraint 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(91,9): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(92,15): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(100,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'n' must be of type 'number', but here has type 'string'. tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(100,26): error TS2339: Property 'toFixed' does not exist on type 'string'. -==== tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts (17 errors) ==== +==== tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts (10 errors) ==== class SomeBase { private n; @@ -63,8 +56,8 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors // Generic and non - generic overload where non - generic overload is the only candidate when called with type arguments new fn2('', 0); // Error - ~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. // Generic and non - generic overload where non - generic overload is the only candidate when called without type arguments new fn2('', 0); // OK @@ -103,22 +96,10 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors new fn4(3, ''); // Error ~~~~~~ !!! error TS2344: Type 'string' does not satisfy the constraint 'number'. - ~~~~~~ -!!! error TS2344: Type 'number' does not satisfy the constraint 'string'. - ~ -!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. new fn4('', 3); // Error ~~~~~~ !!! error TS2344: Type 'number' does not satisfy the constraint 'string'. - ~~~~~~ -!!! error TS2344: Type 'string' does not satisfy the constraint 'number'. - ~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. new fn4(3, ''); - ~~~~~~ -!!! error TS2344: Type 'number' does not satisfy the constraint 'string'. - ~~~~~~ -!!! error TS2344: Type 'string' does not satisfy the constraint 'number'. // Generic overloads with constraints called without type arguments but with types that satisfy the constraints new fn4('', 3); @@ -129,9 +110,7 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors // Generic overloads with constraints called with type arguments that do not satisfy the constraints new fn4(null, null); // Error ~~~~~~~ -!!! error TS2344: Type 'boolean' does not satisfy the constraint 'string'. - ~~~~ -!!! error TS2344: Type 'Date' does not satisfy the constraint 'number'. +!!! error TS2344: Type 'boolean' does not satisfy the constraint 'number'. // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints new fn4(true, null); // 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 237541b40f7..a55c1820e66 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,11): error TS2346: Supplied parameters do not match any signature of call target. +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(25,1): error TS2304: Cannot find name 'runTestCase'. @@ -19,8 +19,8 @@ tests/cases/conformance/parser/ecmascript5/parser15.4.4.14-9-2.ts(25,1): error T var one = 1; 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 TS2346: Supplied parameters do not match any signature of call target. + ~~~~~ +!!! error TS2448: The type arguments 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 0b2aa01bb5c..87946dee3d1 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 TS2346: Supplied parameters do not match any signature of call target. +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(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 TS2346: Supplied parameters do not match any signature of call target. -tests/cases/compiler/promisePermutations.ts(144,12): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/compiler/promisePermutations.ts(152,12): error TS2346: Supplied parameters do not match any signature of call target. +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(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'. @@ -207,8 +207,8 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t var r9b = r9.then(sIPromise, sIPromise, sIPromise); // ok var r9c = r9.then(nIPromise, nIPromise, nIPromise); // ok var r9d = r9.then(testFunction, sIPromise, nIPromise); // ok - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~~~~~ +!!! error TS2448: The type arguments 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,8 +223,8 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t var s9d = s9.then(sPromise, sPromise, sPromise); // ok var s9e = s9.then(nPromise, nPromise, nPromise); // ok var s9f = s9.then(testFunction, sIPromise, nIPromise); // error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~~~~~ +!!! error TS2448: The type arguments 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,8 +232,8 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t var r10b = r10.then(sIPromise, sIPromise, sIPromise); // ok var r10c = r10.then(nIPromise, nIPromise, nIPromise); // ok var r10d = r10.then(testFunction, sIPromise, nIPromise); // ok - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~~~~~~ +!!! error TS2448: The type arguments 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,8 +242,8 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t var s10d = s10.then(sPromise, sPromise, sPromise); // ok var s10e = s10.then(nIPromise, nPromise, nIPromise); // ok var s10f = s10.then(testFunctionP, sIPromise, nIPromise); // error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~~~~~~ +!!! error TS2448: The type arguments 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 e512ca73277..dbfa743f684 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 TS2346: Supplied parameters do not match any signature of call target. +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(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 TS2346: Supplied parameters do not match any signature of call target. -tests/cases/compiler/promisePermutations2.ts(143,12): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/compiler/promisePermutations2.ts(151,12): error TS2346: Supplied parameters do not match any signature of call target. +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(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'. @@ -206,8 +206,8 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of var r9b = r9.then(sIPromise, sIPromise, sIPromise); // ok var r9c = r9.then(nIPromise, nIPromise, nIPromise); // ok var r9d = r9.then(testFunction, sIPromise, nIPromise); // error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~~~~~ +!!! error TS2448: The type arguments 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 @@ -222,8 +222,8 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of var s9d = s9.then(sPromise, sPromise, sPromise); // ok var s9e = s9.then(nPromise, nPromise, nPromise); // ok var s9f = s9.then(testFunction, sIPromise, nIPromise); // error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~~~~~ +!!! error TS2448: The type arguments 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); @@ -231,8 +231,8 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of var r10b = r10.then(sIPromise, sIPromise, sIPromise); // ok var r10c = r10.then(nIPromise, nIPromise, nIPromise); // ok var r10d = r10.then(testFunction, sIPromise, nIPromise); // error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~~~~~~ +!!! error TS2448: The type arguments 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 @@ -241,8 +241,8 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of var s10d = s10.then(sPromise, sPromise, sPromise); // ok var s10e = s10.then(nIPromise, nPromise, nIPromise); // ok var s10f = s10.then(testFunctionP, sIPromise, nIPromise); // error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~~~~~~ +!!! error TS2448: The type arguments 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 97d47cc7f7f..62e5d87b66f 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 TS2346: Supplied parameters do not match any signature of call target. +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(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 TS2346: Supplied parameters do not match any signature of call target. -tests/cases/compiler/promisePermutations3.ts(143,12): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/compiler/promisePermutations3.ts(151,12): error TS2346: Supplied parameters do not match any signature of call target. +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(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'. @@ -210,8 +210,8 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of var r9b = r9.then(sIPromise, sIPromise, sIPromise); // ok var r9c = r9.then(nIPromise, nIPromise, nIPromise); // ok var r9d = r9.then(testFunction, sIPromise, nIPromise); // error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~~~~~ +!!! error TS2448: The type arguments 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 @@ -226,8 +226,8 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of var s9d = s9.then(sPromise, sPromise, sPromise); // ok var s9e = s9.then(nPromise, nPromise, nPromise); // ok var s9f = s9.then(testFunction, sIPromise, nIPromise); // error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~~~~~ +!!! error TS2448: The type arguments 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); @@ -235,8 +235,8 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of var r10b = r10.then(sIPromise, sIPromise, sIPromise); // ok var r10c = r10.then(nIPromise, nIPromise, nIPromise); // ok var r10d = r10.then(testFunction, sIPromise, nIPromise); // error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~~~~~~ +!!! error TS2448: The type arguments 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 @@ -245,8 +245,8 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of var s10d = s10.then(sPromise, sPromise, sPromise); // ok var s10e = s10.then(nIPromise, nPromise, nIPromise); // ok var s10f = s10.then(testFunctionP, sIPromise, nIPromise); // error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~~~~~~ +!!! error TS2448: The type arguments 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 cf188972b7d..50fe513a95d 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 TS2346: Supplied parameters do not match any signature of call target. +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 (1 errors) ==== @@ -14,5 +14,5 @@ tests/cases/compiler/typeArgInference2.ts(12,10): error TS2346: Supplied paramet var z4 = foo({ name: "abc" }); // { name: string } var z5 = foo({ name: "abc", a: 5 }); // { name: string; a: number } var z6 = foo({ name: "abc", a: 5 }, { name: "def", b: 5 }); // error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file + ~~~ +!!! error TS2448: The type arguments 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 83fa81b5524..e6d2aee567d 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 TS2346: Supplied parameters do not match any signature of call target. +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 (1 errors) ==== @@ -9,5 +9,5 @@ tests/cases/compiler/typeArgInference2WithError.ts(7,10): error TS2346: Supplied declare function foo(x?: T, y?: T): T; var z7 = foo("abc", 5); // Error - ~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file + ~~~ +!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. \ No newline at end of file diff --git a/tests/baselines/reference/typeArgumentConstraintResolution1.errors.txt b/tests/baselines/reference/typeArgumentConstraintResolution1.errors.txt index 27064866755..b650b09c143 100644 --- a/tests/baselines/reference/typeArgumentConstraintResolution1.errors.txt +++ b/tests/baselines/reference/typeArgumentConstraintResolution1.errors.txt @@ -1,5 +1,4 @@ -tests/cases/compiler/typeArgumentConstraintResolution1.ts(4,6): error TS2343: Type 'Date' does not satisfy the constraint 'Number': - Property 'toFixed' is missing in type 'Date'. +tests/cases/compiler/typeArgumentConstraintResolution1.ts(4,6): error TS2344: Type 'Date' does not satisfy the constraint 'Number'. tests/cases/compiler/typeArgumentConstraintResolution1.ts(11,6): error TS2344: Type 'Date' does not satisfy the constraint 'Number'. @@ -9,8 +8,7 @@ tests/cases/compiler/typeArgumentConstraintResolution1.ts(11,6): error TS2344: T function foo1(test: any) { } foo1(""); // should error ~~~~ -!!! error TS2343: Type 'Date' does not satisfy the constraint 'Number': -!!! error TS2343: Property 'toFixed' is missing in type 'Date'. +!!! error TS2344: Type 'Date' does not satisfy the constraint 'Number'. diff --git a/tests/baselines/reference/typeArgumentInference.errors.txt b/tests/baselines/reference/typeArgumentInference.errors.txt index dbff8b83854..980f6d6d65d 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 TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(82,11): error TS2346: Supplied parameters do not match any signature of call target. +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 (2 errors) ==== @@ -71,8 +71,8 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(82,11 return null; } var a9a = someGenerics9('', 0, []); - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~~~~~~~~~~~ +!!! error TS2448: The type arguments 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; }; @@ -87,8 +87,8 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(82,11 z?: Date; } var a9e = someGenerics9(undefined, { x: 6, z: new Date() }, { x: 6, y: '' }); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~~~~~~~~~~~ +!!! error TS2448: The type arguments 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 4f11cb6135e..01c355fa688 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,11): error TS2346: Supplied parameters do not match any signature of call target. +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(118,9): error TS2304: Cannot find name 'Window'. -tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(120,11): error TS2346: Supplied parameters do not match any signature of call target. +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,51): error TS2304: Cannot find name 'window'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(122,56): error TS2304: Cannot find name 'window'. @@ -127,8 +127,8 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct } var someGenerics9: someGenerics9; var a9a = new someGenerics9('', 0, []); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~~~~~~~~~~~ +!!! error TS2448: The type arguments 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; }; @@ -145,8 +145,8 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct !!! error TS2304: Cannot find name 'Window'. } var a9e = new someGenerics9(undefined, { x: 6, z: window }, { x: 6, y: '' }); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~~~~~~~~~~~ +!!! error TS2448: The type arguments 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 c0ee4329c8d..112e44046d8 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 TS2346: Supplied parameters do not match any signature of call target. +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 (1 errors) ==== @@ -9,5 +9,5 @@ tests/cases/compiler/typeArgumentInferenceWithConstraintAsCommonRoot.ts(7,1): er var g: Giraffe; var e: Elephant; f(g, e); // valid because both Giraffe and Elephant satisfy the constraint. T is Animal - ~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file + ~ +!!! error TS2448: The type arguments 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 c0dbf74f66e..44d51f0a428 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 TS2346: Supplied parameters do not match any signature of call target. +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(85,9): error TS2304: Cannot find name 'Window'. -tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(87,11): error TS2346: Supplied parameters do not match any signature of call target. +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,47): error TS2304: Cannot find name 'window'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(89,52): error TS2304: Cannot find name 'window'. @@ -109,8 +109,8 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst return null; } var a9a = someGenerics9('', 0, []); - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~~~~~~~~~~~ +!!! error TS2448: The type arguments 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; }; @@ -127,8 +127,8 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst !!! error TS2304: Cannot find name 'Window'. } var a9e = someGenerics9(undefined, { x: 6, z: window }, { x: 6, y: '' }); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~~~~~~~~~~~ +!!! error TS2448: The type arguments 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 5f9f980e735..daf08be37db 100644 --- a/tests/baselines/reference/typeInferenceConflictingCandidates.errors.txt +++ b/tests/baselines/reference/typeInferenceConflictingCandidates.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/typeInferenceConflictingCandidates.ts(3,1): error TS2346: Supplied parameters do not match any signature of call target. +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 (1 errors) ==== declare function g(a: T, b: T, c: (t: T) => T): T; g("", 3, a => a); - ~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file + ~ +!!! error TS2448: The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly. \ No newline at end of file diff --git a/tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts b/tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts index 5dd6383dcfc..6ff5a088df0 100644 --- a/tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts +++ b/tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts @@ -1,6 +1,6 @@ function foo(n: { x: T; y: T }, m: T) { return m; } -var x = foo({ x: 3, y: "" }, 4); // no error, x is Object, the best common type // these are all errors +var x = foo({ x: 3, y: "" }, 4); var x2 = foo({ x: 3, y: "" }, 4); var x3 = foo({ x: 3, y: "" }, 4); var x4 = foo({ x: "", y: 4 }, ""); From e8d5fdc286de4fe672973de744edbc85833124a2 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 21 Oct 2014 16:17:37 -0700 Subject: [PATCH 04/13] Revert the stuffing of instantiated signatures back into the candidates array --- src/compiler/checker.ts | 3 +-- .../reference/overloadResolution.errors.txt | 12 ++++++------ .../overloadResolutionConstructors.errors.txt | 18 +++++++++--------- ...onWithConstraintCheckingDeferred.errors.txt | 18 +++++++++--------- ...resolutionWithConstraintCheckingDeferred.js | 14 +++++++------- ...ypeArgumentConstraintResolution1.errors.txt | 12 ++++++------ ...resolutionWithConstraintCheckingDeferred.ts | 8 ++++---- 7 files changed, 42 insertions(+), 43 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 0d393f9783c..b133245d837 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5234,7 +5234,7 @@ module ts { } var index = excludeArgument ? indexOf(excludeArgument, true) : -1; if (index < 0) { - return candidates[i] = candidate; + return candidate; } excludeArgument[index] = false; } @@ -5246,7 +5246,6 @@ module ts { // arguments, then we can only report an error based on the type arguments. if (originalCandidate.typeParameters) { var instantiatedCandidate = candidate; - candidates[i] = instantiatedCandidate; if (typeArgumentsAreValid) { candidateForArgumentError = instantiatedCandidate; } diff --git a/tests/baselines/reference/overloadResolution.errors.txt b/tests/baselines/reference/overloadResolution.errors.txt index 1d9f6cb6296..e0a65f7475e 100644 --- a/tests/baselines/reference/overloadResolution.errors.txt +++ b/tests/baselines/reference/overloadResolution.errors.txt @@ -1,8 +1,8 @@ tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(27,5): error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(41,11): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(63,1): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(70,5): error TS2344: Type 'string' does not satisfy the constraint 'number'. -tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(71,5): error TS2344: Type 'number' does not satisfy the constraint 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(70,21): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(71,21): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(81,5): error TS2344: Type 'boolean' does not satisfy the constraint 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(84,5): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(85,11): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. @@ -87,11 +87,11 @@ tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(91,22): function fn4() { } fn4('', 3); fn4(3, ''); // Error - ~~~~~~ -!!! error TS2344: Type 'string' does not satisfy the constraint 'number'. + ~ +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. fn4('', 3); // Error - ~~~~~~ -!!! error TS2344: Type 'number' does not satisfy the constraint 'string'. + ~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. fn4(3, ''); // Generic overloads with constraints called without type arguments but with types that satisfy the constraints diff --git a/tests/baselines/reference/overloadResolutionConstructors.errors.txt b/tests/baselines/reference/overloadResolutionConstructors.errors.txt index 19052cc3f50..540e12774c7 100644 --- a/tests/baselines/reference/overloadResolutionConstructors.errors.txt +++ b/tests/baselines/reference/overloadResolutionConstructors.errors.txt @@ -1,8 +1,8 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(27,9): error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. -tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(43,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(43,15): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(67,1): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(77,9): error TS2344: Type 'string' does not satisfy the constraint 'number'. -tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(78,9): error TS2344: Type 'number' does not satisfy the constraint 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(77,25): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(78,25): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(88,9): error TS2344: Type 'boolean' does not satisfy the constraint 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(91,9): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(92,15): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. @@ -56,8 +56,8 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors // Generic and non - generic overload where non - generic overload is the only candidate when called with type arguments new fn2('', 0); // Error - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. // Generic and non - generic overload where non - generic overload is the only candidate when called without type arguments new fn2('', 0); // OK @@ -94,11 +94,11 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors new fn4('', 3); new fn4(3, ''); // Error - ~~~~~~ -!!! error TS2344: Type 'string' does not satisfy the constraint 'number'. + ~ +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. new fn4('', 3); // Error - ~~~~~~ -!!! error TS2344: Type 'number' does not satisfy the constraint 'string'. + ~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. new fn4(3, ''); // Generic overloads with constraints called without type arguments but with types that satisfy the constraints diff --git a/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt b/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt index e41557a2903..80472228380 100644 --- a/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt +++ b/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(14,5): error TS2323: Type 'string' is not assignable to type 'number'. tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(14,37): error TS2345: Argument of type 'D' is not assignable to parameter of type 'A'. -tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(16,27): error TS2345: Argument of type '(x: D) => G' is not assignable to parameter of type '(x: B) => any'. +tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(16,5): error TS2323: Type 'string' is not assignable to type 'number'. tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(16,38): error TS2344: Type 'D' does not satisfy the constraint 'A'. tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(18,27): error TS2345: Argument of type '(x: D) => G' is not assignable to parameter of type '(x: B) => any'. tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(19,12): error TS2344: Type 'D' does not satisfy the constraint 'A'. @@ -20,22 +20,22 @@ tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(19,12): declare function foo(arg: (x: C) => any): string; declare function foo(arg: (x: B) => any): number; - var result: number = foo(x => new G(x)); // No error, returns number + var result: number = foo(x => new G(x)); // x has type D, new G(x) fails, so first overload is picked. ~~~~~~ !!! error TS2323: Type 'string' is not assignable to type 'number'. ~ !!! error TS2345: Argument of type 'D' is not assignable to parameter of type 'A'. - var result2: number = foo(x => new G(x)); // No error, returns number - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: D) => G' is not assignable to parameter of type '(x: B) => any'. + var result2: number = foo(x => new G(x)); // x has type D, new G(x) fails, so first overload is picked. + ~~~~~~~ +!!! error TS2323: Type 'string' is not assignable to type 'number'. ~~~~~~~~ !!! error TS2344: Type 'D' does not satisfy the constraint 'A'. - var result3: string = foo(x => { // returns string because the C overload is picked - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - var y: G; // error that C does not satisfy constraint - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + var result3: string = foo(x => { // x has type D + ~~~~~~~~~~~~~~~~~~~~~~ + var y: G; // error that D does not satisfy constraint, y is of type G, entire call to foo is an error + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~ !!! error TS2344: Type 'D' does not satisfy the constraint 'A'. return y; diff --git a/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.js b/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.js index 0e5f84c8d69..63b4a2b1e93 100644 --- a/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.js +++ b/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.js @@ -12,12 +12,12 @@ declare function foo(arg: (x: D) => number): string; declare function foo(arg: (x: C) => any): string; declare function foo(arg: (x: B) => any): number; -var result: number = foo(x => new G(x)); // No error, returns number +var result: number = foo(x => new G(x)); // x has type D, new G(x) fails, so first overload is picked. -var result2: number = foo(x => new G(x)); // No error, returns number +var result2: number = foo(x => new G(x)); // x has type D, new G(x) fails, so first overload is picked. -var result3: string = foo(x => { // returns string because the C overload is picked - var y: G; // error that C does not satisfy constraint +var result3: string = foo(x => { // x has type D + var y: G; // error that D does not satisfy constraint, y is of type G, entire call to foo is an error return y; }); @@ -28,9 +28,9 @@ var G = (function () { } return G; })(); -var result = foo(function (x) { return new G(x); }); // No error, returns number -var result2 = foo(function (x) { return new G(x); }); // No error, returns number +var result = foo(function (x) { return new G(x); }); // x has type D, new G(x) fails, so first overload is picked. +var result2 = foo(function (x) { return new G(x); }); // x has type D, new G(x) fails, so first overload is picked. var result3 = foo(function (x) { - var y; // error that C does not satisfy constraint + var y; // error that D does not satisfy constraint, y is of type G, entire call to foo is an error return y; }); diff --git a/tests/baselines/reference/typeArgumentConstraintResolution1.errors.txt b/tests/baselines/reference/typeArgumentConstraintResolution1.errors.txt index b650b09c143..1131b6e1a68 100644 --- a/tests/baselines/reference/typeArgumentConstraintResolution1.errors.txt +++ b/tests/baselines/reference/typeArgumentConstraintResolution1.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/typeArgumentConstraintResolution1.ts(4,6): error TS2344: Type 'Date' does not satisfy the constraint 'Number'. -tests/cases/compiler/typeArgumentConstraintResolution1.ts(11,6): error TS2344: Type 'Date' does not satisfy the constraint 'Number'. +tests/cases/compiler/typeArgumentConstraintResolution1.ts(4,12): error TS2345: Argument of type 'string' is not assignable to parameter of type 'Date'. +tests/cases/compiler/typeArgumentConstraintResolution1.ts(11,12): error TS2345: Argument of type 'string' is not assignable to parameter of type 'Date'. ==== tests/cases/compiler/typeArgumentConstraintResolution1.ts (2 errors) ==== @@ -7,8 +7,8 @@ tests/cases/compiler/typeArgumentConstraintResolution1.ts(11,6): error TS2344: T function foo1(test: string); function foo1(test: any) { } foo1(""); // should error - ~~~~ -!!! error TS2344: Type 'Date' does not satisfy the constraint 'Number'. + ~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'Date'. @@ -16,6 +16,6 @@ tests/cases/compiler/typeArgumentConstraintResolution1.ts(11,6): error TS2344: T function foo2(test: string): T; function foo2(test: any): any { return null; } foo2(""); // Type Date does not satisfy the constraint 'Number' for type parameter 'T extends Number' - ~~~~ -!!! error TS2344: Type 'Date' does not satisfy the constraint 'Number'. + ~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'Date'. \ No newline at end of file diff --git a/tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts b/tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts index bf6007560e8..a139eb85572 100644 --- a/tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts +++ b/tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts @@ -11,11 +11,11 @@ declare function foo(arg: (x: D) => number): string; declare function foo(arg: (x: C) => any): string; declare function foo(arg: (x: B) => any): number; -var result: number = foo(x => new G(x)); // No error, returns number +var result: number = foo(x => new G(x)); // x has type D, new G(x) fails, so first overload is picked. -var result2: number = foo(x => new G(x)); // No error, returns number +var result2: number = foo(x => new G(x)); // x has type D, new G(x) fails, so first overload is picked. -var result3: string = foo(x => { // returns string because the C overload is picked - var y: G; // error that C does not satisfy constraint +var result3: string = foo(x => { // x has type D + var y: G; // error that D does not satisfy constraint, y is of type G, entire call to foo is an error return y; }); From 47bded060e97a21934fddd730dabf472e2999286 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 22 Oct 2014 14:49:23 -0700 Subject: [PATCH 05/13] Specify error message for type argument inference failing --- src/compiler/checker.ts | 28 +++++++++++++------ .../diagnosticInformationMap.generated.ts | 2 +- src/compiler/diagnosticMessages.json | 2 +- ...lTypingWithFixedTypeParameters1.errors.txt | 4 +-- ...defaultBestCommonTypesHaveDecls.errors.txt | 4 +-- ...erInSignatureWithRestParameters.errors.txt | 4 +-- ...cCallWithFunctionTypedArguments.errors.txt | 20 ++++++------- ...CallWithFunctionTypedArguments2.errors.txt | 8 +++--- ...llWithGenericSignatureArguments.errors.txt | 12 ++++---- ...lWithGenericSignatureArguments2.errors.txt | 4 +-- ...lWithGenericSignatureArguments3.errors.txt | 8 +++--- ...ricCallWithNonSymmetricSubtypes.errors.txt | 12 ++++---- ...enericCallWithObjectLiteralArgs.errors.txt | 4 +-- ...CallWithObjectLiteralArguments1.errors.txt | 4 +-- .../genericCallWithObjectTypeArgs.errors.txt | 4 +-- ...thObjectTypeArgsAndConstraints3.errors.txt | 8 +++--- ...icCallWithObjectTypeArgsAndConstraints3.js | 8 +++--- ...loadedConstructorTypedArguments.errors.txt | 4 +-- ...ithFunctionTypedMemberArguments.errors.txt | 16 +++++------ .../reference/genericRestArgs.errors.txt | 8 +++--- .../reference/parser15.4.4.14-9-2.errors.txt | 4 +-- .../reference/promisePermutations.errors.txt | 16 +++++------ .../reference/promisePermutations2.errors.txt | 16 +++++------ .../reference/promisePermutations3.errors.txt | 16 +++++------ .../reference/typeArgInference2.errors.txt | 4 +-- .../typeArgInference2WithError.errors.txt | 4 +-- .../typeArgumentInference.errors.txt | 8 +++--- ...entInferenceConstructSignatures.errors.txt | 8 +++--- ...renceWithConstraintAsCommonRoot.errors.txt | 4 +-- ...rgumentInferenceWithConstraints.errors.txt | 8 +++--- ...eInferenceConflictingCandidates.errors.txt | 4 +-- ...icCallWithObjectTypeArgsAndConstraints3.ts | 4 +-- 32 files changed, 135 insertions(+), 125 deletions(-) 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); From 25171857c598ad036696831894b4d5ddadeb5e21 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Thu, 23 Oct 2014 12:27:34 -0700 Subject: [PATCH 06/13] Add test for bug #807 --- .../reference/overloadsWithConstraints.js | 8 +++++++ .../reference/overloadsWithConstraints.types | 22 +++++++++++++++++++ .../compiler/overloadsWithConstraints.ts | 4 ++++ 3 files changed, 34 insertions(+) create mode 100644 tests/baselines/reference/overloadsWithConstraints.js create mode 100644 tests/baselines/reference/overloadsWithConstraints.types create mode 100644 tests/cases/compiler/overloadsWithConstraints.ts diff --git a/tests/baselines/reference/overloadsWithConstraints.js b/tests/baselines/reference/overloadsWithConstraints.js new file mode 100644 index 00000000000..f9cc87b2260 --- /dev/null +++ b/tests/baselines/reference/overloadsWithConstraints.js @@ -0,0 +1,8 @@ +//// [overloadsWithConstraints.ts] +declare function f(x: T): T; +declare function f(x: T): T + +var v = f(""); + +//// [overloadsWithConstraints.js] +var v = f(""); diff --git a/tests/baselines/reference/overloadsWithConstraints.types b/tests/baselines/reference/overloadsWithConstraints.types new file mode 100644 index 00000000000..1493a0e1a2a --- /dev/null +++ b/tests/baselines/reference/overloadsWithConstraints.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/overloadsWithConstraints.ts === +declare function f(x: T): T; +>f : { (x: T): T; (x: T): T; } +>T : T +>Number : Number +>x : T +>T : T +>T : T + +declare function f(x: T): T +>f : { (x: T): T; (x: T): T; } +>T : T +>String : String +>x : T +>T : T +>T : T + +var v = f(""); +>v : string +>f("") : string +>f : { (x: T): T; (x: T): T; } + diff --git a/tests/cases/compiler/overloadsWithConstraints.ts b/tests/cases/compiler/overloadsWithConstraints.ts new file mode 100644 index 00000000000..7cf5b2b70a3 --- /dev/null +++ b/tests/cases/compiler/overloadsWithConstraints.ts @@ -0,0 +1,4 @@ +declare function f(x: T): T; +declare function f(x: T): T + +var v = f(""); \ No newline at end of file From 05300a7efe607b7ec74816f8a7eb1a3b451a4bea Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Thu, 23 Oct 2014 15:44:26 -0700 Subject: [PATCH 07/13] Have inferArgumentTypes return the InferenceContext --- src/compiler/checker.ts | 36 ++++++++++++++++++++++++++---------- src/compiler/types.ts | 2 ++ 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5be13ecfdca..96c4764e01a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5070,7 +5070,7 @@ module ts { return getSignatureInstantiation(signature, getInferredTypes(context)); } - function inferTypeArguments(signature: Signature, args: Expression[], typeArgumentResultTypes: Type[], excludeArgument?: boolean[]): boolean { + function inferTypeArguments(signature: Signature, args: Expression[], typeArgumentResultTypes: Type[], excludeArgument?: boolean[]): InferenceContext { var typeParameters = signature.typeParameters; var context = createInferenceContext(typeParameters, /*inferUnionTypes*/ false, typeArgumentResultTypes); var mapper = createInferenceMapper(context); @@ -5097,8 +5097,17 @@ module ts { } } var inferredTypes = getInferredTypes(context); - // Inference has failed if the undefined type is in list of inferences - return !contains(inferredTypes, typeArgumentInferenceFailureType); + // Inference has failed if the typeArgumentInferenceFailureType type is in list of inferences + context.failureIndex = indexOf(inferredTypes, typeArgumentInferenceFailureType); + + // Wipe out the typeArgumentInferenceFailureType from the array so that error recovery can work properly + for (var i = 0; i < inferredTypes.length; i++) { + if (inferredTypes[i] === typeArgumentInferenceFailureType) { + inferredTypes[i] = unknownType; + } + } + + return context; } function checkTypeArguments(signature: Signature, typeArguments: TypeNode[], typeArgumentResultTypes: Type[], reportErrors: boolean): boolean { @@ -5165,7 +5174,7 @@ module ts { var candidateForArgumentError: Signature; var candidateForTypeArgumentError: Signature; - var indexOfUninferredTypeParameter: number; + var resultOfFailedInference: InferenceContext; var result: Signature; if (candidates.length > 1) { result = chooseOverload(candidates, subtypeRelation, excludeArgument); @@ -5174,7 +5183,7 @@ module ts { // Reinitialize these pointers for round two candidateForArgumentError = undefined; candidateForTypeArgumentError = undefined; - indexOfUninferredTypeParameter = undefined; + resultOfFailedInference = undefined; result = chooseOverload(candidates, assignableRelation, excludeArgument); } if (result) { @@ -5193,8 +5202,9 @@ module ts { checkTypeArguments(candidateForTypeArgumentError, node.typeArguments, [], /*reportErrors*/ true) } else { + Debug.assert(resultOfFailedInference.failureIndex >= 0); 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])); + typeToString(candidateForTypeArgumentError.typeParameters[resultOfFailedInference.failureIndex])); } } else { @@ -5223,14 +5233,20 @@ module ts { } var originalCandidate = candidates[i]; + var inferenceResult: InferenceContext; while (true) { var candidate = originalCandidate; if (candidate.typeParameters) { var typeArgumentTypes = new Array(candidate.typeParameters.length); - var typeArgumentsAreValid = node.typeArguments ? - checkTypeArguments(candidate, node.typeArguments, typeArgumentTypes, /*reportErrors*/ false) : - inferTypeArguments(candidate, args, typeArgumentTypes, excludeArgument); + var typeArgumentsAreValid: boolean; + if (node.typeArguments) { + typeArgumentsAreValid = checkTypeArguments(candidate, node.typeArguments, typeArgumentTypes, /*reportErrors*/ false) + } + else { + inferenceResult = inferTypeArguments(candidate, args, typeArgumentTypes, excludeArgument); + typeArgumentsAreValid = inferenceResult.failureIndex < 0; + } if (!typeArgumentsAreValid) { break; } @@ -5259,7 +5275,7 @@ module ts { else { candidateForTypeArgumentError = originalCandidate; if (!node.typeArguments) { - indexOfUninferredTypeParameter = typeArgumentTypes.indexOf(typeArgumentInferenceFailureType); + resultOfFailedInference = inferenceResult; } } } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index ea58b1166c6..23b6bc94ca4 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1017,6 +1017,8 @@ module ts { inferenceCount: number; // Incremented for every inference made (whether new or not) inferences: Type[][]; // Inferences made for each type parameter inferredTypes: Type[]; // Inferred type for each type parameter + failureIndex?: number; // Index of type parameter for which inference failed + // It is optional because in contextual signature instantiation, nothing fails } export interface DiagnosticMessage { From 9865e09fb75c1a8688e6e38c2ee20b145f8dcc53 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Fri, 24 Oct 2014 13:51:19 -0700 Subject: [PATCH 08/13] Report type argument inference errors on specific candidates --- src/compiler/checker.ts | 89 ++++++++++++++++--- src/compiler/core.ts | 6 ++ .../diagnosticInformationMap.generated.ts | 4 +- src/compiler/diagnosticMessages.json | 11 ++- ...lTypingWithFixedTypeParameters1.errors.txt | 6 +- ...defaultBestCommonTypesHaveDecls.errors.txt | 6 +- ...erInSignatureWithRestParameters.errors.txt | 6 +- ...cCallWithFunctionTypedArguments.errors.txt | 30 ++++--- ...CallWithFunctionTypedArguments2.errors.txt | 12 ++- ...llWithGenericSignatureArguments.errors.txt | 12 ++- ...lWithGenericSignatureArguments2.errors.txt | 6 +- ...lWithGenericSignatureArguments3.errors.txt | 12 ++- ...ricCallWithNonSymmetricSubtypes.errors.txt | 12 ++- ...enericCallWithObjectLiteralArgs.errors.txt | 6 +- ...CallWithObjectLiteralArguments1.errors.txt | 6 +- .../genericCallWithObjectTypeArgs.errors.txt | 6 +- ...thObjectTypeArgsAndConstraints3.errors.txt | 6 +- ...loadedConstructorTypedArguments.errors.txt | 6 +- ...ithFunctionTypedMemberArguments.errors.txt | 24 +++-- .../reference/genericRestArgs.errors.txt | 12 ++- .../reference/parser15.4.4.14-9-2.errors.txt | 6 +- .../reference/promisePermutations.errors.txt | 30 +++++-- .../reference/promisePermutations2.errors.txt | 30 +++++-- .../reference/promisePermutations3.errors.txt | 30 +++++-- .../reference/typeArgInference2.errors.txt | 6 +- .../typeArgInference2WithError.errors.txt | 6 +- .../typeArgumentInference.errors.txt | 12 ++- ...entInferenceConstructSignatures.errors.txt | 12 ++- ...renceWithConstraintAsCommonRoot.errors.txt | 6 +- ...rgumentInferenceWithConstraints.errors.txt | 12 ++- ...eInferenceConflictingCandidates.errors.txt | 6 +- 31 files changed, 318 insertions(+), 116 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 96c4764e01a..ee975f1a134 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3138,15 +3138,23 @@ module ts { var identityRelation: Map = {}; function isTypeIdenticalTo(source: Type, target: Type): boolean { - return checkTypeRelatedTo(source, target, identityRelation, /*errorNode*/ undefined, /*chainedMessage*/ undefined, /*terminalMessage*/ undefined); + return checkTypeRelatedTo(source, target, identityRelation, + /*errorNode*/ undefined, /*chainedMessage*/ undefined, /*terminalMessage*/ undefined, /*containingMessageChain*/ undefined); } function isTypeSubtypeOf(source: Type, target: Type): boolean { - return checkTypeSubtypeOf(source, target, /*errorNode*/ undefined, /*chainedMessage*/ undefined, /*terminalMessage*/ undefined); + return checkTypeSubtypeOf(source, target, /*errorNode*/ undefined, /*chainedMessage*/ undefined, /*terminalMessage*/ undefined, /*containingMessageChain*/ undefined); } - function checkTypeSubtypeOf(source: Type, target: Type, errorNode: Node, chainedMessage: DiagnosticMessage, terminalMessage: DiagnosticMessage): boolean { - return checkTypeRelatedTo(source, target, subtypeRelation, errorNode, chainedMessage, terminalMessage); + function checkTypeSubtypeOf( + source: Type, + target: Type, + errorNode: Node, + chainedMessage: DiagnosticMessage, + terminalMessage: DiagnosticMessage, + containingMessageChain: DiagnosticMessageChain): boolean { + + return checkTypeRelatedTo(source, target, subtypeRelation, errorNode, chainedMessage, terminalMessage, containingMessageChain); } function isTypeAssignableTo(source: Type, target: Type): boolean { @@ -3154,17 +3162,19 @@ module ts { } function checkTypeAssignableTo(source: Type, target: Type, errorNode: Node, chainedMessage: DiagnosticMessage, terminalMessage: DiagnosticMessage): boolean { - return checkTypeRelatedTo(source, target, assignableRelation, errorNode, chainedMessage, terminalMessage); + return checkTypeRelatedTo(source, target, assignableRelation, errorNode, chainedMessage, terminalMessage, /*containingMessageChain*/ undefined); } function isTypeRelatedTo(source: Type, target: Type, relation: Map): boolean { - return checkTypeRelatedTo(source, target, relation, /*errorNode*/ undefined, /*chainedMessage*/ undefined, /*terminalMessage*/ undefined); + return checkTypeRelatedTo(source, target, relation, + /*errorNode*/ undefined, /*chainedMessage*/ undefined, /*terminalMessage*/ undefined, /*containingMessageChain*/ undefined); } function isSignatureAssignableTo(source: Signature, target: Signature): boolean { var sourceType = getOrCreateTypeFromSignature(source); var targetType = getOrCreateTypeFromSignature(target); - return checkTypeRelatedTo(sourceType, targetType, assignableRelation, /*errorNode*/ undefined, /*chainedMessage*/ undefined, /*terminalMessage*/ undefined); + return checkTypeRelatedTo(sourceType, targetType, assignableRelation, + /*errorNode*/ undefined, /*chainedMessage*/ undefined, /*terminalMessage*/ undefined, /*containingMessageChain*/ undefined); } function isPropertyIdenticalTo(sourceProp: Symbol, targetProp: Symbol): boolean { @@ -3228,7 +3238,15 @@ module ts { } } - function checkTypeRelatedTo(source: Type, target: Type, relation: Map, errorNode: Node, chainedMessage: DiagnosticMessage, terminalMessage: DiagnosticMessage): boolean { + function checkTypeRelatedTo( + source: Type, + target: Type, + relation: Map, + errorNode: Node, + chainedMessage: DiagnosticMessage, + terminalMessage: DiagnosticMessage, + containingMessageChain: DiagnosticMessageChain): boolean { + var errorInfo: DiagnosticMessageChain; var sourceStack: ObjectType[]; var targetStack: ObjectType[]; @@ -3243,6 +3261,9 @@ module ts { error(errorNode, Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target)); } else if (errorInfo) { + if (containingMessageChain) { + errorInfo = concatenateDiagnosticMessageChains(containingMessageChain, errorInfo); + } addDiagnostic(createDiagnosticForNodeFromMessageChain(errorNode, errorInfo, program.getCompilerHost().getNewLine())); } return result; @@ -3738,6 +3759,43 @@ module ts { return forEach(types, t => isSupertypeOfEach(t, types) ? t : undefined); } + function reportNoCommonSupertypeError(types: Type[], errorLocation: Node, errorMessageChainHead: DiagnosticMessageChain): void { + var bestSupertype: Type; + var bestSupertypeDownfallType: Type; // The type that caused bestSupertype not to be the common supertype + var bestSupertypeScore = 0; + + for (var i = 0; i < types.length; i++) { + var score = 0; + var downfallType: Type = undefined; + for (var j = 0; j < types.length; j++) { + if (types[i] === types[j] || isTypeSubtypeOf(types[j], types[i])) { + score++; + } + else if (!downfallType) { + downfallType = types[j]; + } + } + + if (score > bestSupertypeScore) { + bestSupertype = types[i]; + bestSupertypeDownfallType = downfallType; + bestSupertypeScore = score; + } + + // types.length - 1 is the maximum score, given that getCommonSupertype returned false + if (bestSupertypeScore === types.length - 1) { + break; + } + } + + // In the following errors, the {1} slot is before the {0} slot because checkTypeSubtypeOf supplies the + // subtype as the first argument to the error + checkTypeSubtypeOf(bestSupertypeDownfallType, bestSupertype, errorLocation, + Diagnostics.Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_Colon, + Diagnostics.Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0, + errorMessageChainHead); + } + function isTypeOfObjectLiteral(type: Type): boolean { return (type.flags & TypeFlags.Anonymous) && type.symbol && (type.symbol.flags & SymbolFlags.ObjectLiteral) ? true : false; } @@ -4020,7 +4078,7 @@ module ts { for (var i = 0; i < context.inferredTypes.length; i++) { getInferredType(context, i); } - context.inferences = undefined; + return context.inferredTypes; } @@ -5145,7 +5203,8 @@ module ts { // Use argument expression as error location when reporting errors var isValidArgument = checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1, - Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1); + Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1, + /*containingMessageChain*/ undefined); if (!isValidArgument) { return false; } @@ -5203,8 +5262,14 @@ module ts { } else { Debug.assert(resultOfFailedInference.failureIndex >= 0); - 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[resultOfFailedInference.failureIndex])); + var failedTypeParameter = candidateForTypeArgumentError.typeParameters[resultOfFailedInference.failureIndex]; + var inferenceCandidates = resultOfFailedInference.inferences[resultOfFailedInference.failureIndex]; + + var diagnosticChainHead = chainDiagnosticMessages(/*details*/ undefined, // details will be provided by call to reportNoCommonSupertypeError + Diagnostics.The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly_Colon, + typeToString(failedTypeParameter)); + + reportNoCommonSupertypeError(inferenceCandidates, node.func, diagnosticChainHead); } } else { diff --git a/src/compiler/core.ts b/src/compiler/core.ts index ee7f4701d19..6761b48485a 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -272,6 +272,12 @@ module ts { }; } + export function concatenateDiagnosticMessageChains(headChain: DiagnosticMessageChain, tailChain: DiagnosticMessageChain): DiagnosticMessageChain { + Debug.assert(!headChain.next); + headChain.next = tailChain; + return headChain; + } + export function flattenDiagnosticChain(file: SourceFile, start: number, length: number, diagnosticChain: DiagnosticMessageChain, newLine: string): Diagnostic { Debug.assert(start >= 0, "start must be non-negative, is " + start); Debug.assert(length >= 0, "length must be non-negative, is " + length); diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index f3043c9cc0d..7d4937b2c59 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -261,7 +261,9 @@ 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_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." }, + The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly_Colon: { code: 2448, category: DiagnosticCategory.Error, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly:" }, + Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_Colon: { code: 2449, category: DiagnosticCategory.Error, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}':" }, + Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2450, category: DiagnosticCategory.Error, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, 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 fd65342681a..63d0e13cd9d 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1036,11 +1036,20 @@ "category": "Error", "code": 2447 }, - "The type argument for type parameter '{0}' 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. Consider specifying the type arguments explicitly:": { "category": "Error", "code": 2448 }, + "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}':": { + "category": "Error", + "code": 2449 + }, + "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'.": { + "category": "Error", + "code": 2450 + }, + "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", "code": 4000 diff --git a/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.errors.txt b/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.errors.txt index 887d36f4524..956fe9f6aac 100644 --- a/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.errors.txt +++ b/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.errors.txt @@ -1,5 +1,6 @@ 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 argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: + Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. ==== tests/cases/compiler/contextualTypingWithFixedTypeParameters1.ts (2 errors) ==== @@ -9,4 +10,5 @@ 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 argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/defaultBestCommonTypesHaveDecls.errors.txt b/tests/baselines/reference/defaultBestCommonTypesHaveDecls.errors.txt index c049929b7bf..861479a0cbe 100644 --- a/tests/baselines/reference/defaultBestCommonTypesHaveDecls.errors.txt +++ b/tests/baselines/reference/defaultBestCommonTypesHaveDecls.errors.txt @@ -1,6 +1,7 @@ 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 argument for type parameter 'T' 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. 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/compiler/defaultBestCommonTypesHaveDecls.ts (3 errors) ==== @@ -17,7 +18,8 @@ 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 argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'. 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 24395528484..ab1e75790d9 100644 --- a/tests/baselines/reference/fixTypeParameterInSignatureWithRestParameters.errors.txt +++ b/tests/baselines/reference/fixTypeParameterInSignatureWithRestParameters.errors.txt @@ -1,8 +1,10 @@ -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(2,1): error TS2448: 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 'string'. ==== tests/cases/compiler/fixTypeParameterInSignatureWithRestParameters.ts (1 errors) ==== function bar(item1: T, item2: T) { } bar(1, ""); // Should be ok ~~~ -!!! 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 +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt b/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt index 3728b5e153b..58b3eb595dd 100644 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt @@ -1,8 +1,13 @@ -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(26,10): error TS2448: 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 TS2448: 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 TS2448: 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 TS2448: 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 TS2448: 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) ==== @@ -33,22 +38,27 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun var r8 = foo3(1, function (a) { return '' }, 1); // error ~~~~ -!!! error TS2448: The type argument for type parameter 'U' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'. var r9 = foo3(1, (a) => '', ''); // string function other(t: T, u: U) { var r10 = foo2(1, (x: T) => ''); // error ~~~~ -!!! error TS2448: The type argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: 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 TS2448: The type argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: 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 TS2448: The type argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: 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 TS2448: The type argument for type parameter 'U' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'. } \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments2.errors.txt b/tests/baselines/reference/genericCallWithFunctionTypedArguments2.errors.txt index 378234af8e3..d86d40c0d18 100644 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments2.errors.txt +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments2.errors.txt @@ -1,5 +1,7 @@ -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(29,10): error TS2448: 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 'string'. +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. 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/genericCallWithFunctionTypedArguments2.ts (2 errors) ==== @@ -33,7 +35,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun var r4 = foo2(1, i2); // error ~~~~ -!!! error TS2448: The type argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'. var r4b = foo2(1, a); // any var r5 = foo2(1, i); // any var r6 = foo2('', i2); // string @@ -46,5 +49,6 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun var r7b = foo3(null, a, ''); // any var r8 = foo3(1, i2, 1); // error ~~~~ -!!! error TS2448: The type argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'. 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 3220126e594..35483a9623d 100644 --- a/tests/baselines/reference/genericCallWithGenericSignatureArguments.errors.txt +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments.errors.txt @@ -1,5 +1,7 @@ -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(18,10): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: + Type argument candidate '{ x: number; y?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; z?: number; }'. +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. Consider specifying the type arguments explicitly: + Type argument candidate '{ x: number; z?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y?: number; }'. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments.ts (2 errors) ==== @@ -22,10 +24,12 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen var r4 = foo((x: typeof a) => a, (x: typeof b) => b); // typeof a => typeof a ~~~ -!!! error TS2448: The type argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate '{ x: number; y?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; z?: number; }'. var r5 = foo((x: typeof b) => b, (x: typeof a) => a); // typeof b => typeof b ~~~ -!!! error TS2448: The type argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate '{ x: number; z?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y?: number; }'. 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 a0bcb3baf6c..9eedd544892 100644 --- a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt @@ -1,4 +1,5 @@ -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(10,29): error TS2448: 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 'string'. 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 +23,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen var r1: (x: {}) => {} = foo((x: number) => 1, (x: string) => ''); ~~~ -!!! error TS2448: The type argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'. 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 292a2dd372a..7b9d2e0ffdc 100644 --- a/tests/baselines/reference/genericCallWithGenericSignatureArguments3.errors.txt +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments3.errors.txt @@ -1,5 +1,7 @@ -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(32,11): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: + Type argument candidate '(y: string) => string' is not a valid type argument because it is not a supertype of candidate '(a: string) => boolean'. +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. Consider specifying the type arguments explicitly: + Type argument candidate '(n: Object) => number' is not a valid type argument because it is not a supertype of candidate 'number'. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3.ts (2 errors) ==== @@ -36,7 +38,9 @@ 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 argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate '(y: string) => string' is not a valid type argument because it is not a supertype of candidate '(a: string) => boolean'. var r12 = foo2(x, (a1: (y: string) => boolean) => (n: Object) => 1, (a2: (z: string) => boolean) => 2); // error ~~~~ -!!! 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 +!!! error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate '(n: Object) => number' is not a valid type argument because it is not a supertype of candidate 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithNonSymmetricSubtypes.errors.txt b/tests/baselines/reference/genericCallWithNonSymmetricSubtypes.errors.txt index fbac0909634..fc9d90a5a7e 100644 --- a/tests/baselines/reference/genericCallWithNonSymmetricSubtypes.errors.txt +++ b/tests/baselines/reference/genericCallWithNonSymmetricSubtypes.errors.txt @@ -1,5 +1,7 @@ -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(12,9): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: + Type argument candidate '{ x: number; y?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; z?: number; }'. +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. Consider specifying the type arguments explicitly: + Type argument candidate '{ x: number; z?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y?: number; }'. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithNonSymmetricSubtypes.ts (2 errors) ==== @@ -16,10 +18,12 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithNon var r = foo(a, b); // { x: number; y?: number; }; ~~~ -!!! error TS2448: The type argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate '{ x: number; y?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; z?: number; }'. var r2 = foo(b, a); // { x: number; z?: number; }; ~~~ -!!! error TS2448: The type argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate '{ x: number; z?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y?: number; }'. 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 265c7f29f82..3cbfc0f0bab 100644 --- a/tests/baselines/reference/genericCallWithObjectLiteralArgs.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectLiteralArgs.errors.txt @@ -1,4 +1,5 @@ -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(5,9): error TS2448: 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 'string'. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectLiteralArgs.ts (1 errors) ==== @@ -8,7 +9,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObj var r = foo({ bar: 1, baz: '' }); // error ~~~ -!!! error TS2448: The type argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'. 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 4158ffc049f..96fdbf2a20f 100644 --- a/tests/baselines/reference/genericCallWithObjectLiteralArguments1.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectLiteralArguments1.errors.txt @@ -1,4 +1,5 @@ -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(3,9): error TS2448: 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 'string'. 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 +19,8 @@ tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts(7,22): error TS23 // these are all errors var x = foo({ x: 3, y: "" }, 4); ~~~ -!!! error TS2448: The type argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'. 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 78b50c114cb..cee7741147b 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgs.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectTypeArgs.errors.txt @@ -1,4 +1,5 @@ -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(20,9): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: + Type argument candidate 'C' is not a valid type argument because it is not a supertype of candidate 'D'. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgs.ts (1 errors) ==== @@ -23,5 +24,6 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObj var d1 = new X(); var r = foo(c1, d1); // error ~~~ -!!! error TS2448: The type argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'C' is not a valid type argument because it is not a supertype of candidate 'D'. 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 e06a351a2c5..4d479516d21 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.errors.txt @@ -1,4 +1,5 @@ -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(18,10): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: + Type argument candidate 'Derived' is not a valid type argument because it is not a supertype of candidate 'Derived2'. 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. @@ -22,7 +23,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObj var r1 = f({ x: new Derived(), y: new Derived2() }); // error because neither is supertype of the other ~ -!!! error TS2448: The type argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'Derived' is not a valid type argument because it is not a supertype of candidate 'Derived2'. function f2(a: U) { ~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.errors.txt b/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.errors.txt index b96fda8b327..0346a573757 100644 --- a/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.errors.txt +++ b/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.errors.txt @@ -1,4 +1,5 @@ -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(36,14): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: + Type argument candidate 'boolean' is not a valid type argument because it is not a supertype of candidate 'number'. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOverloadedConstructorTypedArguments.ts (1 errors) ==== @@ -39,7 +40,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOve var r8 = foo6(a); // error ~~~~ -!!! error TS2448: The type argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'boolean' is not a valid type argument because it is not a supertype of candidate 'number'. 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 c2a8b303d8e..6a4c37aeb00 100644 --- a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt +++ b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt @@ -1,7 +1,11 @@ -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(57,19): error TS2448: 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/genericClassWithFunctionTypedMemberArguments.ts(60,19): error TS2448: 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/genericClassWithFunctionTypedMemberArguments.ts(61,20): error TS2448: 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/genericClassWithFunctionTypedMemberArguments.ts(62,19): error TS2448: 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/genericClassWithFunctionTypedMemberArguments.ts (4 errors) ==== @@ -63,17 +67,21 @@ 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 argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'T'. var r10 = c.foo2(1, (x) => ''); // string var r11 = c3.foo3(1, (x: T) => '', ''); // error ~~~~~~~ -!!! error TS2448: The type argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'T'. var r11b = c3.foo3(1, (x: T) => '', 1); // error ~~~~~~~ -!!! error TS2448: The type argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'T'. var r12 = c3.foo3(1, function (a) { return '' }, 1); // error ~~~~~~~ -!!! error TS2448: The type argument for type parameter 'U' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'. } } \ No newline at end of file diff --git a/tests/baselines/reference/genericRestArgs.errors.txt b/tests/baselines/reference/genericRestArgs.errors.txt index 9c4b89639d8..dcfd7cb6b9e 100644 --- a/tests/baselines/reference/genericRestArgs.errors.txt +++ b/tests/baselines/reference/genericRestArgs.errors.txt @@ -1,6 +1,8 @@ -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(2,12): error TS2448: 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 'string'. 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 argument for type parameter 'T' 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. 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/compiler/genericRestArgs.ts(12,30): error TS2345: Argument of type 'number' is not assignable to parameter of type 'any[]'. @@ -8,7 +10,8 @@ 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 argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'. var a1Gb = makeArrayG(1, ""); var a1Gc = makeArrayG(1, ""); var a1Gd = makeArrayG(1, ""); // error @@ -20,7 +23,8 @@ tests/cases/compiler/genericRestArgs.ts(12,30): error TS2345: Argument of type ' } var a2Ga = makeArrayGOpt(1, ""); ~~~~~~~~~~~~~ -!!! error TS2448: The type argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'. 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 363094b8b08..0d8ddc7927c 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,5 @@ -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(16,15): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: + Type argument candidate 'boolean' is not a valid type argument because it is not a supertype of candidate 'string'. tests/cases/conformance/parser/ecmascript5/parser15.4.4.14-9-2.ts(25,1): error TS2304: Cannot find name 'runTestCase'. @@ -20,7 +21,8 @@ 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 argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'boolean' is not a valid type argument because it is not a supertype of candidate 'string'. 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 845db19c2f9..912ee8b9b32 100644 --- a/tests/baselines/reference/promisePermutations.errors.txt +++ b/tests/baselines/reference/promisePermutations.errors.txt @@ -20,13 +20,20 @@ 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 argument for type parameter 'U' 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. 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(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 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(137,11): error TS2448: 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(144,12): error TS2448: 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(152,12): error TS2448: 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/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 +215,9 @@ 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 argument for type parameter 'U' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'IPromise' is not a valid type argument because it is not a supertype of candidate 'IPromise': +!!! error TS2448: Type 'string' is not assignable to type 'number'. 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 +233,9 @@ 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 argument for type parameter 'U' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'IPromise' is not a valid type argument because it is not a supertype of candidate 'IPromise': +!!! error TS2448: Type 'string' is not assignable to type 'number'. var s9g = s9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var r10 = testFunction10(x => x); @@ -233,7 +244,9 @@ 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 argument for type parameter 'U' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'IPromise' is not a valid type argument because it is not a supertype of candidate 'IPromise': +!!! error TS2448: Type 'string' is not assignable to type 'number'. 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 +256,8 @@ 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 argument for type parameter 'U' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. 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 31cb1e2203b..e9c86458942 100644 --- a/tests/baselines/reference/promisePermutations2.errors.txt +++ b/tests/baselines/reference/promisePermutations2.errors.txt @@ -20,13 +20,20 @@ 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 argument for type parameter 'U' 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. 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,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 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(136,11): error TS2448: 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 TS2448: 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(151,12): error TS2448: 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'. 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 +214,9 @@ 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 argument for type parameter 'U' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'IPromise' is not a valid type argument because it is not a supertype of candidate 'IPromise': +!!! error TS2448: Type 'string' is not assignable to type 'number'. 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 +232,9 @@ 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 argument for type parameter 'U' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'IPromise' is not a valid type argument because it is not a supertype of candidate 'IPromise': +!!! error TS2448: Type 'string' is not assignable to type 'number'. var s9g = s9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var r10 = testFunction10(x => x); @@ -232,7 +243,9 @@ 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 argument for type parameter 'U' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'IPromise' is not a valid type argument because it is not a supertype of candidate 'IPromise': +!!! error TS2448: Type 'string' is not assignable to type 'number'. 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 +255,8 @@ 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 argument for type parameter 'U' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. 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 c2e200f9111..8c142e62dc9 100644 --- a/tests/baselines/reference/promisePermutations3.errors.txt +++ b/tests/baselines/reference/promisePermutations3.errors.txt @@ -21,13 +21,20 @@ 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 argument for type parameter 'U' 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. 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/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 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(136,11): error TS2448: 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/promisePermutations3.ts(143,12): error TS2448: 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/promisePermutations3.ts(151,12): error TS2448: 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/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 +218,9 @@ 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 argument for type parameter 'U' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'IPromise' is not a valid type argument because it is not a supertype of candidate 'IPromise': +!!! error TS2448: Type 'string' is not assignable to type 'number'. 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 +236,9 @@ 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 argument for type parameter 'U' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'IPromise' is not a valid type argument because it is not a supertype of candidate 'IPromise': +!!! error TS2448: Type 'string' is not assignable to type 'number'. var s9g = s9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var r10 = testFunction10(x => x); @@ -236,7 +247,9 @@ 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 argument for type parameter 'U' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'IPromise' is not a valid type argument because it is not a supertype of candidate 'IPromise': +!!! error TS2448: Type 'string' is not assignable to type 'number'. 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 +259,8 @@ 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 argument for type parameter 'U' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. 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 5c100a2f104..87268f687b8 100644 --- a/tests/baselines/reference/typeArgInference2.errors.txt +++ b/tests/baselines/reference/typeArgInference2.errors.txt @@ -1,4 +1,5 @@ -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(12,10): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: + Type argument candidate '{ name: string; a: number; }' is not a valid type argument because it is not a supertype of candidate '{ name: string; b: number; }'. ==== tests/cases/compiler/typeArgInference2.ts (1 errors) ==== @@ -15,4 +16,5 @@ 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 argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate '{ name: string; a: number; }' is not a valid type argument because it is not a supertype of candidate '{ name: string; b: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/typeArgInference2WithError.errors.txt b/tests/baselines/reference/typeArgInference2WithError.errors.txt index 2ab40a670bd..473cfbfc41b 100644 --- a/tests/baselines/reference/typeArgInference2WithError.errors.txt +++ b/tests/baselines/reference/typeArgInference2WithError.errors.txt @@ -1,4 +1,5 @@ -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(7,10): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: + Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. ==== tests/cases/compiler/typeArgInference2WithError.ts (1 errors) ==== @@ -10,4 +11,5 @@ tests/cases/compiler/typeArgInference2WithError.ts(7,10): error TS2448: The type var z7 = foo("abc", 5); // Error ~~~ -!!! 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 +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/typeArgumentInference.errors.txt b/tests/baselines/reference/typeArgumentInference.errors.txt index 5f0f24a2614..159a08c53a6 100644 --- a/tests/baselines/reference/typeArgumentInference.errors.txt +++ b/tests/baselines/reference/typeArgumentInference.errors.txt @@ -1,5 +1,7 @@ -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(68,11): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: + Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. +tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(82,11): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: + Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. ==== tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts (2 errors) ==== @@ -72,7 +74,8 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(82,11 } var a9a = someGenerics9('', 0, []); ~~~~~~~~~~~~~ -!!! error TS2448: The type argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. var a9a: {}; var a9b = someGenerics9<{ a?: number; b?: string; }>({ a: 0 }, { b: '' }, null); var a9b: { a?: number; b?: string; }; @@ -88,7 +91,8 @@ 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 argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. 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 09734d0194c..dd86ddcd234 100644 --- a/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt +++ b/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt @@ -3,9 +3,11 @@ 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 argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: + Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. 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 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,15): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: + Type argument candidate '{ x: number; z: any; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. 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 +130,8 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct var someGenerics9: someGenerics9; var a9a = new someGenerics9('', 0, []); ~~~~~~~~~~~~~ -!!! error TS2448: The type argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. var a9a: {}; var a9b = new someGenerics9<{ a?: number; b?: string; }>({ a: 0 }, { b: '' }, null); var a9b: { a?: number; b?: string; }; @@ -146,7 +149,8 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct } var a9e = new someGenerics9(undefined, { x: 6, z: window }, { x: 6, y: '' }); ~~~~~~~~~~~~~ -!!! error TS2448: The type argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate '{ x: number; z: any; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. ~~~~~~ !!! 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 ee3c71cd801..f8e90a5404b 100644 --- a/tests/baselines/reference/typeArgumentInferenceWithConstraintAsCommonRoot.errors.txt +++ b/tests/baselines/reference/typeArgumentInferenceWithConstraintAsCommonRoot.errors.txt @@ -1,4 +1,5 @@ -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(7,1): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: + Type argument candidate 'Giraffe' is not a valid type argument because it is not a supertype of candidate 'Elephant'. ==== tests/cases/compiler/typeArgumentInferenceWithConstraintAsCommonRoot.ts (1 errors) ==== @@ -10,4 +11,5 @@ 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 argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'Giraffe' is not a valid type argument because it is not a supertype of candidate 'Elephant'. \ No newline at end of file diff --git a/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt b/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt index b3a1d65b3db..469171e341c 100644 --- a/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt +++ b/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt @@ -8,9 +8,11 @@ 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 argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: + Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. 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 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,11): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: + Type argument candidate '{ x: number; z: any; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. 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 +112,8 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst } var a9a = someGenerics9('', 0, []); ~~~~~~~~~~~~~ -!!! error TS2448: The type argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. var a9a: {}; var a9b = someGenerics9<{ a?: number; b?: string; }>({ a: 0 }, { b: '' }, null); var a9b: { a?: number; b?: string; }; @@ -128,7 +131,8 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst } var a9e = someGenerics9(undefined, { x: 6, z: window }, { x: 6, y: '' }); ~~~~~~~~~~~~~ -!!! error TS2448: The type argument for type parameter 'T' 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. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate '{ x: number; z: any; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. ~~~~~~ !!! 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 f577f55c70d..1213c2b1e75 100644 --- a/tests/baselines/reference/typeInferenceConflictingCandidates.errors.txt +++ b/tests/baselines/reference/typeInferenceConflictingCandidates.errors.txt @@ -1,4 +1,5 @@ -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(3,1): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: + Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. ==== tests/cases/compiler/typeInferenceConflictingCandidates.ts (1 errors) ==== @@ -6,4 +7,5 @@ tests/cases/compiler/typeInferenceConflictingCandidates.ts(3,1): error TS2448: T g("", 3, a => a); ~ -!!! 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 +!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +!!! error TS2448: Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. \ No newline at end of file From 431bf9a74632593d2afafb9bb5e86fe0c5c30ee3 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Fri, 24 Oct 2014 16:42:22 -0700 Subject: [PATCH 09/13] Update baselines --- ...lTypingWithFixedTypeParameters1.errors.txt | 6 ++-- ...defaultBestCommonTypesHaveDecls.errors.txt | 6 ++-- ...erInSignatureWithRestParameters.errors.txt | 6 ++-- ...cCallWithFunctionTypedArguments.errors.txt | 30 +++++++++---------- ...CallWithFunctionTypedArguments2.errors.txt | 12 ++++---- ...llWithGenericSignatureArguments.errors.txt | 12 ++++---- ...lWithGenericSignatureArguments2.errors.txt | 6 ++-- ...lWithGenericSignatureArguments3.errors.txt | 12 ++++---- ...ricCallWithNonSymmetricSubtypes.errors.txt | 12 ++++---- ...enericCallWithObjectLiteralArgs.errors.txt | 6 ++-- ...CallWithObjectLiteralArguments1.errors.txt | 6 ++-- .../genericCallWithObjectTypeArgs.errors.txt | 6 ++-- ...thObjectTypeArgsAndConstraints3.errors.txt | 6 ++-- ...loadedConstructorTypedArguments.errors.txt | 6 ++-- ...ithFunctionTypedMemberArguments.errors.txt | 24 +++++++-------- .../reference/genericRestArgs.errors.txt | 12 ++++---- .../reference/parser15.4.4.14-9-2.errors.txt | 6 ++-- .../reference/promisePermutations.errors.txt | 30 +++++++++---------- .../reference/promisePermutations2.errors.txt | 30 +++++++++---------- .../reference/promisePermutations3.errors.txt | 30 +++++++++---------- .../reference/typeArgInference2.errors.txt | 6 ++-- .../typeArgInference2WithError.errors.txt | 6 ++-- .../typeArgumentInference.errors.txt | 12 ++++---- ...entInferenceConstructSignatures.errors.txt | 12 ++++---- ...renceWithConstraintAsCommonRoot.errors.txt | 6 ++-- ...rgumentInferenceWithConstraints.errors.txt | 12 ++++---- ...eInferenceConflictingCandidates.errors.txt | 6 ++-- 27 files changed, 162 insertions(+), 162 deletions(-) diff --git a/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.errors.txt b/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.errors.txt index 956fe9f6aac..bb061b341d0 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 argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/compiler/contextualTypingWithFixedTypeParameters1.ts(3,10): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. @@ -10,5 +10,5 @@ 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 argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. \ No newline at end of file +!!! 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 'string' is not a valid type argument because it is not a supertype of candidate 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/defaultBestCommonTypesHaveDecls.errors.txt b/tests/baselines/reference/defaultBestCommonTypesHaveDecls.errors.txt index 861479a0cbe..12100f8442b 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 argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts(8,14): 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 'string'. @@ -18,8 +18,8 @@ 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 argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'. +!!! 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 'string'. 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 ab1e75790d9..70fcb979228 100644 --- a/tests/baselines/reference/fixTypeParameterInSignatureWithRestParameters.errors.txt +++ b/tests/baselines/reference/fixTypeParameterInSignatureWithRestParameters.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/fixTypeParameterInSignatureWithRestParameters.ts(2,1): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/compiler/fixTypeParameterInSignatureWithRestParameters.ts(2,1): 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 'string'. @@ -6,5 +6,5 @@ tests/cases/compiler/fixTypeParameterInSignatureWithRestParameters.ts(2,1): erro function bar(item1: T, item2: T) { } bar(1, ""); // Should be ok ~~~ -!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'. \ No newline at end of file +!!! 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 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt b/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt index 58b3eb595dd..cdd15b7fb21 100644 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt @@ -1,12 +1,12 @@ -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. Consider specifying the type arguments explicitly: +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 TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +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 TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +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 TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +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 TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +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'. @@ -38,27 +38,27 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun var r8 = foo3(1, function (a) { return '' }, 1); // error ~~~~ -!!! error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'. +!!! 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(1, (a) => '', ''); // string function other(t: T, u: U) { var r10 = foo2(1, (x: T) => ''); // error ~~~~ -!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'T'. +!!! 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 TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'T'. +!!! 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 TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'T'. +!!! 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 TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'. +!!! 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'. } \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments2.errors.txt b/tests/baselines/reference/genericCallWithFunctionTypedArguments2.errors.txt index d86d40c0d18..7ce5683f335 100644 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments2.errors.txt +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments2.errors.txt @@ -1,6 +1,6 @@ -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. Consider specifying the type arguments explicitly: +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments2.ts(29,10): 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 'string'. -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. Consider specifying the type arguments explicitly: +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments2.ts(40,10): 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 'string'. @@ -35,8 +35,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun var r4 = foo2(1, i2); // error ~~~~ -!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'. +!!! 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 'string'. var r4b = foo2(1, a); // any var r5 = foo2(1, i); // any var r6 = foo2('', i2); // string @@ -49,6 +49,6 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun var r7b = foo3(null, a, ''); // any var r8 = foo3(1, i2, 1); // error ~~~~ -!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'. +!!! 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 'string'. 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 35483a9623d..12d605166c1 100644 --- a/tests/baselines/reference/genericCallWithGenericSignatureArguments.errors.txt +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments.errors.txt @@ -1,6 +1,6 @@ -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. Consider specifying the type arguments explicitly: +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments.ts(18,10): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: Type argument candidate '{ x: number; y?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; z?: number; }'. -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. Consider specifying the type arguments explicitly: +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments.ts(19,10): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: Type argument candidate '{ x: number; z?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y?: number; }'. @@ -24,12 +24,12 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen var r4 = foo((x: typeof a) => a, (x: typeof b) => b); // typeof a => typeof a ~~~ -!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate '{ x: number; y?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; z?: number; }'. +!!! 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 '{ x: number; y?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; z?: number; }'. var r5 = foo((x: typeof b) => b, (x: typeof a) => a); // typeof b => typeof b ~~~ -!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate '{ x: number; z?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y?: number; }'. +!!! 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 '{ x: number; z?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y?: number; }'. 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 9eedd544892..cea92ef6077 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 argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(10,29): 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 'string'. 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'. @@ -23,8 +23,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen var r1: (x: {}) => {} = foo((x: number) => 1, (x: string) => ''); ~~~ -!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'. +!!! 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 'string'. 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 7b9d2e0ffdc..28f142b804e 100644 --- a/tests/baselines/reference/genericCallWithGenericSignatureArguments3.errors.txt +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments3.errors.txt @@ -1,6 +1,6 @@ -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. Consider specifying the type arguments explicitly: +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3.ts(32,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: Type argument candidate '(y: string) => string' is not a valid type argument because it is not a supertype of candidate '(a: string) => boolean'. -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. Consider specifying the type arguments explicitly: +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3.ts(33,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 '(n: Object) => number' is not a valid type argument because it is not a supertype of candidate 'number'. @@ -38,9 +38,9 @@ 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 argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate '(y: string) => string' is not a valid type argument because it is not a supertype of candidate '(a: string) => boolean'. +!!! 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 '(y: string) => string' is not a valid type argument because it is not a supertype of candidate '(a: string) => boolean'. var r12 = foo2(x, (a1: (y: string) => boolean) => (n: Object) => 1, (a2: (z: string) => boolean) => 2); // error ~~~~ -!!! error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate '(n: Object) => number' is not a valid type argument because it is not a supertype of candidate 'number'. \ No newline at end of file +!!! 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 '(n: Object) => number' is not a valid type argument because it is not a supertype of candidate 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithNonSymmetricSubtypes.errors.txt b/tests/baselines/reference/genericCallWithNonSymmetricSubtypes.errors.txt index fc9d90a5a7e..eb8bcca96fc 100644 --- a/tests/baselines/reference/genericCallWithNonSymmetricSubtypes.errors.txt +++ b/tests/baselines/reference/genericCallWithNonSymmetricSubtypes.errors.txt @@ -1,6 +1,6 @@ -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. Consider specifying the type arguments explicitly: +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithNonSymmetricSubtypes.ts(12,9): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: Type argument candidate '{ x: number; y?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; z?: number; }'. -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. Consider specifying the type arguments explicitly: +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithNonSymmetricSubtypes.ts(13,10): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: Type argument candidate '{ x: number; z?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y?: number; }'. @@ -18,12 +18,12 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithNon var r = foo(a, b); // { x: number; y?: number; }; ~~~ -!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate '{ x: number; y?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; z?: number; }'. +!!! 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 '{ x: number; y?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; z?: number; }'. var r2 = foo(b, a); // { x: number; z?: number; }; ~~~ -!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate '{ x: number; z?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y?: number; }'. +!!! 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 '{ x: number; z?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y?: number; }'. 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 3cbfc0f0bab..a5702c23915 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 argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectLiteralArgs.ts(5,9): 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 'string'. @@ -9,8 +9,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObj var r = foo({ bar: 1, baz: '' }); // error ~~~ -!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'. +!!! 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 'string'. 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 96fdbf2a20f..39e757fc6b4 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 argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts(3,9): 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 'string'. 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: @@ -19,8 +19,8 @@ tests/cases/compiler/genericCallWithObjectLiteralArguments1.ts(7,22): error TS23 // these are all errors var x = foo({ x: 3, y: "" }, 4); ~~~ -!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'. +!!! 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 'string'. 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 cee7741147b..478f1404b1c 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 argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgs.ts(20,9): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: Type argument candidate 'C' is not a valid type argument because it is not a supertype of candidate 'D'. @@ -24,6 +24,6 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObj var d1 = new X(); var r = foo(c1, d1); // error ~~~ -!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'C' is not a valid type argument because it is not a supertype of candidate 'D'. +!!! 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 'C' is not a valid type argument because it is not a supertype of candidate 'D'. 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 4d479516d21..b1f00ed2abd 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 argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints3.ts(18,10): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: Type argument candidate 'Derived' is not a valid type argument because it is not a supertype of candidate 'Derived2'. 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. @@ -23,8 +23,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObj var r1 = f({ x: new Derived(), y: new Derived2() }); // error because neither is supertype of the other ~ -!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'Derived' is not a valid type argument because it is not a supertype of candidate 'Derived2'. +!!! 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 'Derived' is not a valid type argument because it is not a supertype of candidate 'Derived2'. function f2(a: U) { ~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.errors.txt b/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.errors.txt index 0346a573757..03ab33e11d6 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 argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOverloadedConstructorTypedArguments.ts(36,14): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: Type argument candidate 'boolean' is not a valid type argument because it is not a supertype of candidate 'number'. @@ -40,8 +40,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOve var r8 = foo6(a); // error ~~~~ -!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'boolean' is not a valid type argument because it is not a supertype of candidate 'number'. +!!! 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 'boolean' is not a valid type argument because it is not a supertype of candidate 'number'. 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 6a4c37aeb00..40d0b19fd7c 100644 --- a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt +++ b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt @@ -1,10 +1,10 @@ -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. Consider specifying the type arguments explicitly: +tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(57,19): 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/genericClassWithFunctionTypedMemberArguments.ts(60,19): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(60,19): 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/genericClassWithFunctionTypedMemberArguments.ts(61,20): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(61,20): 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/genericClassWithFunctionTypedMemberArguments.ts(62,19): error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(62,19): 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'. @@ -67,21 +67,21 @@ 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 argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'T'. +!!! 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 = c.foo2(1, (x) => ''); // string var r11 = c3.foo3(1, (x: T) => '', ''); // error ~~~~~~~ -!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'T'. +!!! 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 = c3.foo3(1, (x: T) => '', 1); // error ~~~~~~~ -!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'T'. +!!! 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 = c3.foo3(1, function (a) { return '' }, 1); // error ~~~~~~~ -!!! error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'. +!!! 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'. } } \ No newline at end of file diff --git a/tests/baselines/reference/genericRestArgs.errors.txt b/tests/baselines/reference/genericRestArgs.errors.txt index dcfd7cb6b9e..2cbaba80221 100644 --- a/tests/baselines/reference/genericRestArgs.errors.txt +++ b/tests/baselines/reference/genericRestArgs.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/genericRestArgs.ts(2,12): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/compiler/genericRestArgs.ts(2,12): 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 'string'. 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 argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/compiler/genericRestArgs.ts(10,12): 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 'string'. tests/cases/compiler/genericRestArgs.ts(12,30): error TS2345: Argument of type 'number' is not assignable to parameter of type 'any[]'. @@ -10,8 +10,8 @@ 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 argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'. +!!! 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 'string'. var a1Gb = makeArrayG(1, ""); var a1Gc = makeArrayG(1, ""); var a1Gd = makeArrayG(1, ""); // error @@ -23,8 +23,8 @@ tests/cases/compiler/genericRestArgs.ts(12,30): error TS2345: Argument of type ' } var a2Ga = makeArrayGOpt(1, ""); ~~~~~~~~~~~~~ -!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'. +!!! 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 'string'. 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 0d8ddc7927c..6779ebb9c07 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 argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/conformance/parser/ecmascript5/parser15.4.4.14-9-2.ts(16,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 'boolean' is not a valid type argument because it is not a supertype of candidate 'string'. tests/cases/conformance/parser/ecmascript5/parser15.4.4.14-9-2.ts(25,1): error TS2304: Cannot find name 'runTestCase'. @@ -21,8 +21,8 @@ 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 argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'boolean' is not a valid type argument because it is not a supertype of candidate 'string'. +!!! 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 'boolean' is not a valid type argument because it is not a supertype of candidate 'string'. 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 912ee8b9b32..855614eb76e 100644 --- a/tests/baselines/reference/promisePermutations.errors.txt +++ b/tests/baselines/reference/promisePermutations.errors.txt @@ -20,19 +20,19 @@ 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 argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/compiler/promisePermutations.ts(129,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/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 argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/compiler/promisePermutations.ts(137,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/promisePermutations.ts(144,12): error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +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(152,12): error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +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'. 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'. @@ -215,9 +215,9 @@ 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 argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'IPromise' is not a valid type argument because it is not a supertype of candidate 'IPromise': -!!! error TS2448: Type 'string' is not assignable to type 'number'. +!!! 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 'IPromise': +!!! error TS2453: Type 'string' is not assignable to type 'number'. var r9e = r9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s9: Promise; var s9a = s9.then(testFunction9, testFunction9, testFunction9); // error @@ -233,9 +233,9 @@ 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 argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'IPromise' is not a valid type argument because it is not a supertype of candidate 'IPromise': -!!! error TS2448: Type 'string' is not assignable to type 'number'. +!!! 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 'IPromise': +!!! error TS2453: Type 'string' is not assignable to type 'number'. var s9g = s9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var r10 = testFunction10(x => x); @@ -244,9 +244,9 @@ 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 argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'IPromise' is not a valid type argument because it is not a supertype of candidate 'IPromise': -!!! error TS2448: Type 'string' is not assignable to type 'number'. +!!! 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 'IPromise': +!!! error TS2453: Type 'string' is not assignable to type 'number'. 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 @@ -256,8 +256,8 @@ 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 argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. +!!! 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 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 e9c86458942..5338df82121 100644 --- a/tests/baselines/reference/promisePermutations2.errors.txt +++ b/tests/baselines/reference/promisePermutations2.errors.txt @@ -20,19 +20,19 @@ 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 argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +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,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 argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +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 TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +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(151,12): error TS2448: 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'. 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'. @@ -214,9 +214,9 @@ 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 argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'IPromise' is not a valid type argument because it is not a supertype of candidate 'IPromise': -!!! error TS2448: Type 'string' is not assignable to type 'number'. +!!! 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 'IPromise': +!!! error TS2453: Type 'string' is not assignable to type 'number'. var r9e = r9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s9: Promise; var s9a = s9.then(testFunction9, testFunction9, testFunction9); // error @@ -232,9 +232,9 @@ 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 argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'IPromise' is not a valid type argument because it is not a supertype of candidate 'IPromise': -!!! error TS2448: Type 'string' is not assignable to type 'number'. +!!! 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 'IPromise': +!!! error TS2453: Type 'string' is not assignable to type 'number'. var s9g = s9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var r10 = testFunction10(x => x); @@ -243,9 +243,9 @@ 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 argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'IPromise' is not a valid type argument because it is not a supertype of candidate 'IPromise': -!!! error TS2448: Type 'string' is not assignable to type 'number'. +!!! 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 'IPromise': +!!! error TS2453: Type 'string' is not assignable to type 'number'. 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 @@ -255,8 +255,8 @@ 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 argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. +!!! 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 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 8c142e62dc9..58e37629cf5 100644 --- a/tests/baselines/reference/promisePermutations3.errors.txt +++ b/tests/baselines/reference/promisePermutations3.errors.txt @@ -21,19 +21,19 @@ 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 argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/compiler/promisePermutations3.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/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 argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/compiler/promisePermutations3.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/promisePermutations3.ts(143,12): error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/compiler/promisePermutations3.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/promisePermutations3.ts(151,12): error TS2448: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/compiler/promisePermutations3.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'. 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'. @@ -218,9 +218,9 @@ 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 argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'IPromise' is not a valid type argument because it is not a supertype of candidate 'IPromise': -!!! error TS2448: Type 'string' is not assignable to type 'number'. +!!! 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 'IPromise': +!!! error TS2453: Type 'string' is not assignable to type 'number'. var r9e = r9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s9: Promise; var s9a = s9.then(testFunction9, testFunction9, testFunction9); // error @@ -236,9 +236,9 @@ 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 argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'IPromise' is not a valid type argument because it is not a supertype of candidate 'IPromise': -!!! error TS2448: Type 'string' is not assignable to type 'number'. +!!! 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 'IPromise': +!!! error TS2453: Type 'string' is not assignable to type 'number'. var s9g = s9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var r10 = testFunction10(x => x); @@ -247,9 +247,9 @@ 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 argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'IPromise' is not a valid type argument because it is not a supertype of candidate 'IPromise': -!!! error TS2448: Type 'string' is not assignable to type 'number'. +!!! 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 'IPromise': +!!! error TS2453: Type 'string' is not assignable to type 'number'. 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 @@ -259,8 +259,8 @@ 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 argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'Promise' is not a valid type argument because it is not a supertype of candidate 'IPromise'. +!!! 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 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 87268f687b8..21fa647f442 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 argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/compiler/typeArgInference2.ts(12,10): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: Type argument candidate '{ name: string; a: number; }' is not a valid type argument because it is not a supertype of candidate '{ name: string; b: number; }'. @@ -16,5 +16,5 @@ 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 argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate '{ name: string; a: number; }' is not a valid type argument because it is not a supertype of candidate '{ name: string; b: number; }'. \ No newline at end of file +!!! 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 '{ name: string; a: number; }' is not a valid type argument because it is not a supertype of candidate '{ name: string; b: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/typeArgInference2WithError.errors.txt b/tests/baselines/reference/typeArgInference2WithError.errors.txt index 473cfbfc41b..3d3e4d35426 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 argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/compiler/typeArgInference2WithError.ts(7,10): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. @@ -11,5 +11,5 @@ tests/cases/compiler/typeArgInference2WithError.ts(7,10): error TS2448: The type var z7 = foo("abc", 5); // Error ~~~ -!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. \ No newline at end of file +!!! 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 'string' is not a valid type argument because it is not a supertype of candidate 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/typeArgumentInference.errors.txt b/tests/baselines/reference/typeArgumentInference.errors.txt index 159a08c53a6..8003c0c0e6e 100644 --- a/tests/baselines/reference/typeArgumentInference.errors.txt +++ b/tests/baselines/reference/typeArgumentInference.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(68,11): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(68,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. -tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(82,11): error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(82,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. @@ -74,8 +74,8 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(82,11 } var a9a = someGenerics9('', 0, []); ~~~~~~~~~~~~~ -!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. +!!! 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 'string' is not a valid type argument because it is not a supertype of candidate 'number'. var a9a: {}; var a9b = someGenerics9<{ a?: number; b?: string; }>({ a: 0 }, { b: '' }, null); var a9b: { a?: number; b?: string; }; @@ -91,8 +91,8 @@ 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 argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. +!!! 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 '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. 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 dd86ddcd234..de36203acb0 100644 --- a/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt +++ b/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt @@ -3,10 +3,10 @@ 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 argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(106,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 'string' is not a valid type argument because it is not a supertype of candidate 'number'. 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 argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(120,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 '{ x: number; z: any; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. 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'. @@ -130,8 +130,8 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct var someGenerics9: someGenerics9; var a9a = new someGenerics9('', 0, []); ~~~~~~~~~~~~~ -!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. +!!! 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 'string' is not a valid type argument because it is not a supertype of candidate 'number'. var a9a: {}; var a9b = new someGenerics9<{ a?: number; b?: string; }>({ a: 0 }, { b: '' }, null); var a9b: { a?: number; b?: string; }; @@ -149,8 +149,8 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct } var a9e = new someGenerics9(undefined, { x: 6, z: window }, { x: 6, y: '' }); ~~~~~~~~~~~~~ -!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate '{ x: number; z: any; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. +!!! 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 '{ x: number; z: any; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. ~~~~~~ !!! 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 f8e90a5404b..96698bc80c1 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 argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/compiler/typeArgumentInferenceWithConstraintAsCommonRoot.ts(7,1): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: Type argument candidate 'Giraffe' is not a valid type argument because it is not a supertype of candidate 'Elephant'. @@ -11,5 +11,5 @@ 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 argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'Giraffe' is not a valid type argument because it is not a supertype of candidate 'Elephant'. \ No newline at end of file +!!! 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 'Giraffe' is not a valid type argument because it is not a supertype of candidate 'Elephant'. \ No newline at end of file diff --git a/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt b/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt index 469171e341c..722f28772dd 100644 --- a/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt +++ b/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt @@ -8,10 +8,10 @@ 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 argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(73,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. 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 argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(87,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: Type argument candidate '{ x: number; z: any; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. 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'. @@ -112,8 +112,8 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst } var a9a = someGenerics9('', 0, []); ~~~~~~~~~~~~~ -!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. +!!! 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 'string' is not a valid type argument because it is not a supertype of candidate 'number'. var a9a: {}; var a9b = someGenerics9<{ a?: number; b?: string; }>({ a: 0 }, { b: '' }, null); var a9b: { a?: number; b?: string; }; @@ -131,8 +131,8 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst } var a9e = someGenerics9(undefined, { x: 6, z: window }, { x: 6, y: '' }); ~~~~~~~~~~~~~ -!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate '{ x: number; z: any; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. +!!! 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 '{ x: number; z: any; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. ~~~~~~ !!! 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 1213c2b1e75..836555d7e89 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 argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: +tests/cases/compiler/typeInferenceConflictingCandidates.ts(3,1): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. @@ -7,5 +7,5 @@ tests/cases/compiler/typeInferenceConflictingCandidates.ts(3,1): error TS2448: T g("", 3, a => a); ~ -!!! error TS2448: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly: -!!! error TS2448: Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. \ No newline at end of file +!!! 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 'string' is not a valid type argument because it is not a supertype of candidate 'number'. \ No newline at end of file From 7dc86837a3b140d5420671d58c2652dd898469bc Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Mon, 27 Oct 2014 14:00:43 -0700 Subject: [PATCH 10/13] Address PR feedback --- src/compiler/checker.ts | 57 ++++++++++++++++++++++++++++++++++------- 1 file changed, 48 insertions(+), 9 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 12dc5ccce0a..52c2179a236 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3930,7 +3930,7 @@ module ts { } } - function createInferenceContext(typeParameters: TypeParameter[], inferUnionTypes: boolean, typeArgumentResultTypes?: Type[]): InferenceContext { + function createInferenceContext(typeParameters: TypeParameter[], inferUnionTypes: boolean): InferenceContext { var inferences: Type[][] = []; for (var i = 0; i < typeParameters.length; i++) inferences.push([]); return { @@ -3938,7 +3938,7 @@ module ts { inferUnionTypes: inferUnionTypes, inferenceCount: 0, inferences: inferences, - inferredTypes: typeArgumentResultTypes || new Array(typeParameters.length), + inferredTypes: new Array(typeParameters.length), }; } @@ -5154,9 +5154,9 @@ module ts { return getSignatureInstantiation(signature, getInferredTypes(context)); } - function inferTypeArguments(signature: Signature, args: Expression[], typeArgumentResultTypes: Type[], excludeArgument?: boolean[]): InferenceContext { + function inferTypeArguments(signature: Signature, args: Expression[], excludeArgument?: boolean[]): InferenceContext { var typeParameters = signature.typeParameters; - var context = createInferenceContext(typeParameters, /*inferUnionTypes*/ false, typeArgumentResultTypes); + var context = createInferenceContext(typeParameters, /*inferUnionTypes*/ false); var mapper = createInferenceMapper(context); // First infer from arguments that are not context sensitive for (var i = 0; i < args.length; i++) { @@ -5205,8 +5205,7 @@ module ts { if (typeArgumentsAreAssignable /* so far */) { var constraint = getConstraintOfTypeParameter(typeParameters[i]); if (constraint) { - typeArgumentsAreAssignable = typeArgumentsAreAssignable && - checkTypeAssignableTo(typeArgument, constraint, reportErrors ? typeArgNode : undefined, + typeArgumentsAreAssignable = checkTypeAssignableTo(typeArgument, constraint, reportErrors ? typeArgNode : undefined, Diagnostics.Type_0_does_not_satisfy_the_constraint_1_Colon, Diagnostics.Type_0_does_not_satisfy_the_constraint_1); } } @@ -5257,10 +5256,42 @@ module ts { } } + // The following variables are captured and modified by calls to chooseOverload. + // If overload resolution or type argument inference fails, we want to report the + // best error possible. The best error is one which says that an argument was not + // assignable to a parameter. This implies that everything else about the overload + // was fine. So if there is any overload that is only incorrect because of an + // argument, we will report an error on that one. + // + // function foo(s: string) {} + // function foo(n: number) {} // Report argument error on this overload + // function foo() {} + // foo(true); + // + // If none of the overloads even made it that far, there are two possibilities. + // There was a problem with type arguments for some overload, in which case + // report an error on that. Or none of the overloads even had correct arity, + // in which case give an arity error. + // + // function foo(x: T, y: T) {} // Report type argument inference error + // function foo() {} + // foo(0, true); + // var candidateForArgumentError: Signature; var candidateForTypeArgumentError: Signature; var resultOfFailedInference: InferenceContext; var result: Signature; + + // Section 4.12.1: + // if the candidate list contains one or more signatures for which the type of each argument + // expression is a subtype of each corresponding parameter type, the return type of the first + // of those signatures becomes the return type of the function call. + // Otherwise, the return type of the first signature in the candidate list becomes the return + // type of the function call. + // + // Whether the call is an error is determined by assignability of the arguments. The subtype pass + // is just important for choosing the best signature. So in the case where there is only one + // signature, the subtype pass is useless. So skipping it is an optimization. if (candidates.length > 1) { result = chooseOverload(candidates, subtypeRelation, excludeArgument); } @@ -5280,6 +5311,11 @@ module ts { // If candidate is undefined, it means that no candidates had a suitable arity. In that case, // skip the checkApplicableSignature check. if (candidateForArgumentError) { + // excludeArgument is undefined, in this case also equivalent to [undefined, undefined, ...] + // The importance of exlcludeArgument is to prevent us from typing function expression parameters + // in arguments too early. If possible, we'd like to only type them once we know the correct + // overload. However, this matters for the case where the call is correct. When the call is + // an error, we don't need to exclude any arguments, although it would cause no harm to do so. checkApplicableSignature(node, candidateForArgumentError, assignableRelation, /*excludeArgument*/ undefined, /*reportErrors*/ true); } else if (candidateForTypeArgumentError) { @@ -5329,14 +5365,16 @@ module ts { while (true) { var candidate = originalCandidate; if (candidate.typeParameters) { - var typeArgumentTypes = new Array(candidate.typeParameters.length); + var typeArgumentTypes: Type[]; var typeArgumentsAreValid: boolean; if (node.typeArguments) { + typeArgumentTypes = new Array(candidate.typeParameters.length); typeArgumentsAreValid = checkTypeArguments(candidate, node.typeArguments, typeArgumentTypes, /*reportErrors*/ false) } else { - inferenceResult = inferTypeArguments(candidate, args, typeArgumentTypes, excludeArgument); + inferenceResult = inferTypeArguments(candidate, args, excludeArgument); typeArgumentsAreValid = inferenceResult.failureIndex < 0; + typeArgumentTypes = inferenceResult.inferredTypes; } if (!typeArgumentsAreValid) { break; @@ -5371,7 +5409,8 @@ module ts { } } else { - candidateForArgumentError = originalCandidate; // Could be candidate too + Debug.assert(originalCandidate === candidate); + candidateForArgumentError = originalCandidate; } } From 962cde9fd629ef1d12bc86164f2d0b142814bcf3 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Mon, 27 Oct 2014 14:15:24 -0700 Subject: [PATCH 11/13] Make chainedMessage, terminalMessage, and containingMessageChain optional --- src/compiler/checker.ts | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 52c2179a236..be3bad3eaa2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3164,43 +3164,40 @@ module ts { var identityRelation: Map = {}; function isTypeIdenticalTo(source: Type, target: Type): boolean { - return checkTypeRelatedTo(source, target, identityRelation, - /*errorNode*/ undefined, /*chainedMessage*/ undefined, /*terminalMessage*/ undefined, /*containingMessageChain*/ undefined); + return checkTypeRelatedTo(source, target, identityRelation, /*errorNode*/ undefined); } function isTypeSubtypeOf(source: Type, target: Type): boolean { - return checkTypeSubtypeOf(source, target, /*errorNode*/ undefined, /*chainedMessage*/ undefined, /*terminalMessage*/ undefined, /*containingMessageChain*/ undefined); + return checkTypeSubtypeOf(source, target, /*errorNode*/ undefined); } function checkTypeSubtypeOf( source: Type, target: Type, errorNode: Node, - chainedMessage: DiagnosticMessage, - terminalMessage: DiagnosticMessage, - containingMessageChain: DiagnosticMessageChain): boolean { + chainedMessage?: DiagnosticMessage, + terminalMessage?: DiagnosticMessage, + containingMessageChain?: DiagnosticMessageChain): boolean { return checkTypeRelatedTo(source, target, subtypeRelation, errorNode, chainedMessage, terminalMessage, containingMessageChain); } function isTypeAssignableTo(source: Type, target: Type): boolean { - return checkTypeAssignableTo(source, target, /*errorNode*/ undefined, /*chainedMessage*/ undefined, /*terminalMessage*/ undefined); + return checkTypeAssignableTo(source, target, /*errorNode*/ undefined); } - function checkTypeAssignableTo(source: Type, target: Type, errorNode: Node, chainedMessage: DiagnosticMessage, terminalMessage: DiagnosticMessage): boolean { - return checkTypeRelatedTo(source, target, assignableRelation, errorNode, chainedMessage, terminalMessage, /*containingMessageChain*/ undefined); + function checkTypeAssignableTo(source: Type, target: Type, errorNode: Node, chainedMessage?: DiagnosticMessage, terminalMessage?: DiagnosticMessage): boolean { + return checkTypeRelatedTo(source, target, assignableRelation, errorNode, chainedMessage, terminalMessage); } function isTypeRelatedTo(source: Type, target: Type, relation: Map): boolean { - return checkTypeRelatedTo(source, target, relation, - /*errorNode*/ undefined, /*chainedMessage*/ undefined, /*terminalMessage*/ undefined, /*containingMessageChain*/ undefined); + return checkTypeRelatedTo(source, target, relation, /*errorNode*/ undefined); } function isSignatureAssignableTo(source: Signature, target: Signature): boolean { var sourceType = getOrCreateTypeFromSignature(source); var targetType = getOrCreateTypeFromSignature(target); - return checkTypeRelatedTo(sourceType, targetType, assignableRelation, - /*errorNode*/ undefined, /*chainedMessage*/ undefined, /*terminalMessage*/ undefined, /*containingMessageChain*/ undefined); + return checkTypeRelatedTo(sourceType, targetType, assignableRelation, /*errorNode*/ undefined); } function isPropertyIdenticalTo(sourceProp: Symbol, targetProp: Symbol): boolean { @@ -3269,9 +3266,9 @@ module ts { target: Type, relation: Map, errorNode: Node, - chainedMessage: DiagnosticMessage, - terminalMessage: DiagnosticMessage, - containingMessageChain: DiagnosticMessageChain): boolean { + chainedMessage?: DiagnosticMessage, + terminalMessage?: DiagnosticMessage, + containingMessageChain?: DiagnosticMessageChain): boolean { var errorInfo: DiagnosticMessageChain; var sourceStack: ObjectType[]; @@ -5228,8 +5225,7 @@ module ts { // Use argument expression as error location when reporting errors var isValidArgument = checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1, - Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1, - /*containingMessageChain*/ undefined); + Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1); if (!isValidArgument) { return false; } From d14228ed829d4bc5026faf86f72e509fd4ce4db5 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Mon, 27 Oct 2014 16:16:01 -0700 Subject: [PATCH 12/13] More PR feedback --- src/compiler/checker.ts | 26 +++++++++++++------------- src/compiler/types.ts | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e324809472b..be0ae42b848 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -130,7 +130,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 inferenceFailureType = 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); @@ -3797,7 +3797,7 @@ module ts { var score = 0; var downfallType: Type = undefined; for (var j = 0; j < types.length; j++) { - if (types[i] === types[j] || isTypeSubtypeOf(types[j], types[i])) { + if (isTypeSubtypeOf(types[j], types[i])) { score++; } else if (!downfallType) { @@ -4087,14 +4087,14 @@ module ts { if (inferences.length) { // Infer widened union or supertype, or the undefined type for no common supertype var unionOrSuperType = context.inferUnionTypes ? getUnionType(inferences) : getCommonSupertype(inferences); - inferredType = unionOrSuperType ? getWidenedType(unionOrSuperType) : typeArgumentInferenceFailureType; + inferredType = unionOrSuperType ? getWidenedType(unionOrSuperType) : inferenceFailureType; } else { // Infer the empty object type when no inferences were made inferredType = emptyObjectType; } - if (inferredType !== typeArgumentInferenceFailureType) { + if (inferredType !== inferenceFailureType) { var constraint = getConstraintOfTypeParameter(context.typeParameters[index]); inferredType = constraint && !isTypeAssignableTo(inferredType, constraint) ? constraint : inferredType; } @@ -5184,12 +5184,12 @@ module ts { } } var inferredTypes = getInferredTypes(context); - // Inference has failed if the typeArgumentInferenceFailureType type is in list of inferences - context.failureIndex = indexOf(inferredTypes, typeArgumentInferenceFailureType); + // Inference has failed if the inferenceFailureType type is in list of inferences + context.failedTypeParameterIndex = indexOf(inferredTypes, inferenceFailureType); - // Wipe out the typeArgumentInferenceFailureType from the array so that error recovery can work properly + // Wipe out the inferenceFailureType from the array so that error recovery can work properly for (var i = 0; i < inferredTypes.length; i++) { - if (inferredTypes[i] === typeArgumentInferenceFailureType) { + if (inferredTypes[i] === inferenceFailureType) { inferredTypes[i] = unknownType; } } @@ -5314,7 +5314,7 @@ module ts { // skip the checkApplicableSignature check. if (candidateForArgumentError) { // excludeArgument is undefined, in this case also equivalent to [undefined, undefined, ...] - // The importance of exlcludeArgument is to prevent us from typing function expression parameters + // The importance of excludeArgument is to prevent us from typing function expression parameters // in arguments too early. If possible, we'd like to only type them once we know the correct // overload. However, this matters for the case where the call is correct. When the call is // an error, we don't need to exclude any arguments, although it would cause no harm to do so. @@ -5325,9 +5325,9 @@ module ts { checkTypeArguments(candidateForTypeArgumentError, node.typeArguments, [], /*reportErrors*/ true) } else { - Debug.assert(resultOfFailedInference.failureIndex >= 0); - var failedTypeParameter = candidateForTypeArgumentError.typeParameters[resultOfFailedInference.failureIndex]; - var inferenceCandidates = resultOfFailedInference.inferences[resultOfFailedInference.failureIndex]; + Debug.assert(resultOfFailedInference.failedTypeParameterIndex >= 0); + var failedTypeParameter = candidateForTypeArgumentError.typeParameters[resultOfFailedInference.failedTypeParameterIndex]; + var inferenceCandidates = resultOfFailedInference.inferences[resultOfFailedInference.failedTypeParameterIndex]; var diagnosticChainHead = chainDiagnosticMessages(/*details*/ undefined, // details will be provided by call to reportNoCommonSupertypeError Diagnostics.The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly_Colon, @@ -5375,7 +5375,7 @@ module ts { } else { inferenceResult = inferTypeArguments(candidate, args, excludeArgument); - typeArgumentsAreValid = inferenceResult.failureIndex < 0; + typeArgumentsAreValid = inferenceResult.failedTypeParameterIndex < 0; typeArgumentTypes = inferenceResult.inferredTypes; } if (!typeArgumentsAreValid) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 0da2052b6da..9a7e9359038 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1034,7 +1034,7 @@ module ts { inferenceCount: number; // Incremented for every inference made (whether new or not) inferences: Type[][]; // Inferences made for each type parameter inferredTypes: Type[]; // Inferred type for each type parameter - failureIndex?: number; // Index of type parameter for which inference failed + failedTypeParameterIndex?: number; // Index of type parameter for which inference failed // It is optional because in contextual signature instantiation, nothing fails } From e3d82b7db3fbdd32922c346aad0bf2a5df147d0e Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 27 Oct 2014 18:08:49 -0700 Subject: [PATCH 13/13] Fixed findAllRefs/getOccs bug where private properties declared in the constructor were only local to the constructor. Fixes #975. --- src/compiler/types.ts | 2 +- src/services/services.ts | 2 +- .../findAllRefsOnPrivateParameterProperty1.ts | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts diff --git a/src/compiler/types.ts b/src/compiler/types.ts index aa2ca3b4ba8..c063370bcc8 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -766,7 +766,7 @@ module ts { } export enum SymbolFlags { - FunctionScopedVariable = 0x00000001, // Variable (var) or parameter + FunctionScopedVariable = 0x00000001, // Variable (var) or parameter Property = 0x00000002, // Property or enum member EnumMember = 0x00000004, // Enum member Function = 0x00000008, // Function diff --git a/src/services/services.ts b/src/services/services.ts index d853d06d68e..3100b99885a 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -3836,7 +3836,7 @@ module ts { if (symbol.getFlags() && (SymbolFlags.Property | SymbolFlags.Method)) { var privateDeclaration = forEach(symbol.getDeclarations(), d => (d.flags & NodeFlags.Private) ? d : undefined); if (privateDeclaration) { - return privateDeclaration.parent; + return getAncestor(privateDeclaration, SyntaxKind.ClassDeclaration); } } diff --git a/tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts b/tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts new file mode 100644 index 00000000000..6686a771b34 --- /dev/null +++ b/tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts @@ -0,0 +1,18 @@ +/// + +////class ABCD { +//// constructor(private x: number, public y: number, private [|z|]: number) { +//// } +//// +//// func() { +//// return this.[|z|]; +//// } +////} + +test.ranges().forEach(r => { + goTo.position(r.start); + + test.ranges().forEach(range => { + verify.referencesAtPositionContains(range); + }); +});