diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md index 6add1cccb58..5711c8f950d 100644 --- a/.github/ISSUE_TEMPLATE/Bug_report.md +++ b/.github/ISSUE_TEMPLATE/Bug_report.md @@ -16,7 +16,7 @@ Please fill in the *entire* template below. --> -**TypeScript Version:** 3.2.0-dev.201xxxxx +**TypeScript Version:** 3.3.0-dev.201xxxxx **Search Terms:** diff --git a/Gulpfile.js b/Gulpfile.js index 867f35d4ff7..df8a832426d 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -117,7 +117,8 @@ const generatedLCGFile = "built/local/enu/diagnosticMessages.generated.json.lcg" * 2. 'src\compiler\diagnosticMessages.generated.json' => 'built\local\ENU\diagnosticMessages.generated.json.lcg' * generate the lcg file (source of messages to localize) from the diagnosticMessages.generated.json */ -const localizationTargets = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-BR", "ru", "tr", "zh-CN", "zh-TW"] +const localizationTargets = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-br", "ru", "tr", "zh-cn", "zh-tw"] + .map(f => f.toLowerCase()) .map(f => `built/local/${f}/diagnosticMessages.generated.json`) .concat(generatedLCGFile); diff --git a/Jakefile.js b/Jakefile.js index 68cfbf7eef6..1413230c079 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -24,8 +24,6 @@ else if (process.env.PATH !== undefined) { const host = process.env.TYPESCRIPT_HOST || process.env.host || "node"; -const locales = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-BR", "ru", "tr", "zh-CN", "zh-TW"]; - const defaultTestTimeout = 40000; let useDebugMode = true; @@ -709,19 +707,6 @@ const Travis = { } }; -function buildLocalizedTargets() { - /** - * The localization target produces the two following transformations: - * 1. 'src\loc\lcl\\diagnosticMessages.generated.json.lcl' => 'built\local\\diagnosticMessages.generated.json' - * convert localized resources into a .json file the compiler can understand - * 2. 'src\compiler\diagnosticMessages.generated.json' => 'built\local\ENU\diagnosticMessages.generated.json.lcg' - * generate the lcg file (source of messages to localize) from the diagnosticMessages.generated.json - */ - const localizationTargets = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-br", "ru", "tr", "zh-cn", "zh-tw"] - .map(f => path.join(Paths.builtLocal,f)) - .concat(path.dirname(Paths.generatedLCGFile)); -} - function toNs(diff) { return diff[0] * 1e9 + diff[1]; } diff --git a/scripts/generateLocalizedDiagnosticMessages.ts b/scripts/generateLocalizedDiagnosticMessages.ts index 09d117d533b..a9183c8ddbe 100644 --- a/scripts/generateLocalizedDiagnosticMessages.ts +++ b/scripts/generateLocalizedDiagnosticMessages.ts @@ -36,7 +36,7 @@ function main(): void { console.error("Unexpected XML file structure. Expected to find result.LCX.$.TgtCul."); process.exit(1); } - const outputDirectoryName = getPreferedLocaleName(result.LCX.$.TgtCul); + const outputDirectoryName = getPreferedLocaleName(result.LCX.$.TgtCul).toLowerCase(); if (!outputDirectoryName) { console.error(`Invalid output locale name for '${result.LCX.$.TgtCul}'.`); process.exit(1); diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index ed44d8b4140..73c93f48cbf 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1419,12 +1419,18 @@ namespace ts { } } break; + case SyntaxKind.ArrowFunction: + // when targeting ES6 or higher there is no 'arguments' in an arrow function + // for lower compile targets the resolved symbol is used to emit an error + if (compilerOptions.target! >= ScriptTarget.ES2015) { + break; + } + // falls through case SyntaxKind.MethodDeclaration: case SyntaxKind.Constructor: case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: case SyntaxKind.FunctionDeclaration: - case SyntaxKind.ArrowFunction: if (meaning & SymbolFlags.Variable && name === "arguments") { result = argumentsSymbol; break loop; @@ -4709,6 +4715,10 @@ namespace ts { return prop ? getTypeOfSymbol(prop) : undefined; } + function getTypeOfPropertyOrIndexSignature(type: Type, name: __String): Type { + return getTypeOfPropertyOfType(type, name) || isNumericLiteralName(name) && getIndexTypeOfType(type, IndexKind.Number) || getIndexTypeOfType(type, IndexKind.String) || unknownType; + } + function isTypeAny(type: Type | undefined) { return type && (type.flags & TypeFlags.Any) !== 0; } @@ -12168,10 +12178,6 @@ namespace ts { return result; } - function getConstraintForRelation(type: Type) { - return relation === definitelyAssignableRelation ? undefined : getConstraintOfType(type); - } - function structuredTypeRelatedTo(source: Type, target: Type, reportErrors: boolean, isIntersectionConstituent: boolean): Ternary { const flags = source.flags & target.flags; if (relation === identityRelation && !(flags & TypeFlags.Object)) { @@ -12304,24 +12310,26 @@ namespace ts { return result; } } - const constraint = getConstraintForRelation(source); - if (!constraint || (source.flags & TypeFlags.TypeParameter && constraint.flags & TypeFlags.AnyOrUnknown)) { - // A type variable with no constraint is not related to the non-primitive object type. - if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~TypeFlags.NonPrimitive))) { + if (relation !== definitelyAssignableRelation) { + const constraint = getConstraintOfType(source); + if (!constraint || (source.flags & TypeFlags.TypeParameter && constraint.flags & TypeFlags.Any)) { + // A type variable with no constraint is not related to the non-primitive object type. + if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~TypeFlags.NonPrimitive))) { + errorInfo = saveErrorInfo; + return result; + } + } + // hi-speed no-this-instantiation check (less accurate, but avoids costly `this`-instantiation when the constraint will suffice), see #28231 for report on why this is needed + else if (result = isRelatedTo(constraint, target, /*reportErrors*/ false, /*headMessage*/ undefined, isIntersectionConstituent)) { + errorInfo = saveErrorInfo; + return result; + } + // slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example + else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent)) { errorInfo = saveErrorInfo; return result; } } - // hi-speed no-this-instantiation check (less accurate, but avoids costly `this`-instantiation when the constraint will suffice), see #28231 for report on why this is needed - else if (result = isRelatedTo(constraint, target, /*reportErrors*/ false, /*headMessage*/ undefined, isIntersectionConstituent)) { - errorInfo = saveErrorInfo; - return result; - } - // slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example - else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent)) { - errorInfo = saveErrorInfo; - return result; - } } else if (source.flags & TypeFlags.Index) { if (result = isRelatedTo(keyofConstraintType, target, reportErrors)) { @@ -12473,10 +12481,10 @@ namespace ts { return propertiesIdenticalTo(source, target); } const requireOptionalProperties = relation === subtypeRelation && !isObjectLiteralType(source) && !isEmptyArrayLiteralType(source) && !isTupleType(source); - const unmatchedProperty = getUnmatchedProperty(source, target, requireOptionalProperties); + const unmatchedProperty = getUnmatchedProperty(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false); if (unmatchedProperty) { if (reportErrors) { - const props = arrayFrom(getUnmatchedProperties(source, target, requireOptionalProperties)); + const props = arrayFrom(getUnmatchedProperties(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false)); if (!headMessage || (headMessage.code !== Diagnostics.Class_0_incorrectly_implements_interface_1.code && headMessage.code !== Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code)) { suppressNextError = true; // Retain top-level error for interface implementing issues, otherwise omit it @@ -13900,7 +13908,7 @@ namespace ts { return getTypeFromInference(inference); } - function* getUnmatchedProperties(source: Type, target: Type, requireOptionalProperties: boolean) { + function* getUnmatchedProperties(source: Type, target: Type, requireOptionalProperties: boolean, matchDiscriminantProperties: boolean) { const properties = target.flags & TypeFlags.Intersection ? getPropertiesOfUnionOrIntersectionType(target) : getPropertiesOfObjectType(target); for (const targetProp of properties) { if (requireOptionalProperties || !(targetProp.flags & SymbolFlags.Optional)) { @@ -13908,12 +13916,21 @@ namespace ts { if (!sourceProp) { yield targetProp; } + else if (matchDiscriminantProperties) { + const targetType = getTypeOfSymbol(targetProp); + if (targetType.flags & TypeFlags.Unit) { + const sourceType = getTypeOfSymbol(sourceProp); + if (!(sourceType.flags & TypeFlags.Any || getRegularTypeOfLiteralType(sourceType) === getRegularTypeOfLiteralType(targetType))) { + yield targetProp; + } + } + } } } } - function getUnmatchedProperty(source: Type, target: Type, requireOptionalProperties: boolean): Symbol | undefined { - return getUnmatchedProperties(source, target, requireOptionalProperties).next().value; + function getUnmatchedProperty(source: Type, target: Type, requireOptionalProperties: boolean, matchDiscriminantProperties: boolean): Symbol | undefined { + return getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties).next().value; } function tupleTypesDefinitelyUnrelated(source: TupleTypeReference, target: TupleTypeReference) { @@ -13925,7 +13942,8 @@ namespace ts { // Two tuple types with incompatible arities are definitely unrelated. // Two object types that each have a property that is unmatched in the other are definitely unrelated. return isTupleType(source) && isTupleType(target) && tupleTypesDefinitelyUnrelated(source, target) || - !!getUnmatchedProperty(source, target, /*requireOptionalProperties*/ false) && !!getUnmatchedProperty(target, source, /*requireOptionalProperties*/ false); + !!getUnmatchedProperty(source, target, /*requireOptionalProperties*/ false, /*matchDiscriminantProperties*/ true) && + !!getUnmatchedProperty(target, source, /*requireOptionalProperties*/ false, /*matchDiscriminantProperties*/ true); } function getTypeFromInference(inference: InferenceInfo) { @@ -15643,7 +15661,7 @@ namespace ts { } const propType = getTypeOfPropertyOfType(type, propName); const narrowedPropType = propType && narrowType(propType); - return propType === narrowedPropType ? type : filterType(type, t => isTypeComparableTo(getTypeOfPropertyOfType(t, propName)!, narrowedPropType!)); + return propType === narrowedPropType ? type : filterType(type, t => isTypeComparableTo(getTypeOfPropertyOrIndexSignature(t, propName), narrowedPropType!)); } function narrowTypeByTruthiness(type: Type, expr: Expression, assumeTrue: boolean): Type { @@ -19872,14 +19890,31 @@ namespace ts { } function getTypeArgumentArityError(node: Node, signatures: ReadonlyArray, typeArguments: NodeArray) { - let min = Infinity; - let max = -Infinity; - for (const sig of signatures) { - min = Math.min(min, getMinTypeArgumentCount(sig.typeParameters)); - max = Math.max(max, length(sig.typeParameters)); + const argCount = typeArguments.length; + // No overloads exist + if (signatures.length === 1) { + const sig = signatures[0]; + const min = getMinTypeArgumentCount(sig.typeParameters); + const max = length(sig.typeParameters); + return createDiagnosticForNodeArray(getSourceFileOfNode(node), typeArguments, Diagnostics.Expected_0_type_arguments_but_got_1, min < max ? min + "-" + max : min , argCount); } - const paramCount = min === max ? min : min + "-" + max; - return createDiagnosticForNodeArray(getSourceFileOfNode(node), typeArguments, Diagnostics.Expected_0_type_arguments_but_got_1, paramCount, typeArguments.length); + // Overloads exist + let belowArgCount = -Infinity; + let aboveArgCount = Infinity; + for (const sig of signatures) { + const min = getMinTypeArgumentCount(sig.typeParameters); + const max = length(sig.typeParameters); + if (min > argCount) { + aboveArgCount = Math.min(aboveArgCount, min); + } + else if (max < argCount) { + belowArgCount = Math.max(belowArgCount, max); + } + } + if (belowArgCount !== -Infinity && aboveArgCount !== Infinity) { + return createDiagnosticForNodeArray(getSourceFileOfNode(node), typeArguments, Diagnostics.No_overload_expects_0_type_arguments_but_overloads_do_exist_that_expect_either_1_or_2_type_arguments, argCount, belowArgCount, aboveArgCount); + } + return createDiagnosticForNodeArray(getSourceFileOfNode(node), typeArguments, Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount); } function resolveCall(node: CallLikeExpression, signatures: ReadonlyArray, candidatesOutArray: Signature[] | undefined, isForSignatureHelp: boolean, fallbackError?: DiagnosticMessage): Signature { @@ -23633,7 +23668,6 @@ namespace ts { break; } } - checkGrammarForDisallowedTrailingComma(node.elementTypes); forEach(node.elementTypes, checkSourceElement); } diff --git a/src/compiler/core.ts b/src/compiler/core.ts index f585ce2ec96..322355117ec 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -2165,6 +2165,10 @@ namespace ts { } export function fill(length: number, cb: (index: number) => T): T[] { - return new Array(length).fill(0).map((_, i) => cb(i)); + const result = Array(length); + for (let i = 0; i < length; i++) { + result[i] = cb(i); + } + return result; } } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index e3f8e1a7ad5..2cbf5784d07 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1011,6 +1011,10 @@ "category": "Message", "code": 1350 }, + "An identifier or keyword cannot immediately follow a numeric literal.": { + "category": "Error", + "code": 1351 + }, "Duplicate identifier '{0}'.": { "category": "Error", @@ -2529,6 +2533,10 @@ "category": "Error", "code": 2742 }, + "No overload expects {0} type arguments, but overloads do exist that expect either {1} or {2} type arguments.": { + "category": "Error", + "code": 2743 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", diff --git a/src/compiler/inspectValue.ts b/src/compiler/inspectValue.ts index 8433ee6e489..fab4a57ef1b 100644 --- a/src/compiler/inspectValue.ts +++ b/src/compiler/inspectValue.ts @@ -40,18 +40,18 @@ namespace ts { type Recurser = (obj: unknown, name: string, cbOk: () => T, cbFail: (isCircularReference: boolean, keyStack: ReadonlyArray) => T) => T; function getRecurser(): Recurser { - const seen = new Set(); + const seen: unknown[] = []; const nameStack: string[] = []; return (obj, name, cbOk, cbFail) => { - if (seen.has(obj) || nameStack.length > 4) { - return cbFail(seen.has(obj), nameStack); + if (seen.indexOf(obj) !== -1 || nameStack.length > 4) { + return cbFail(seen.indexOf(obj) !== -1, nameStack); } - seen.add(obj); + seen.push(obj); nameStack.push(name); const res = cbOk(); nameStack.pop(); - seen.delete(obj); + seen.pop(); return res; }; } @@ -104,8 +104,8 @@ namespace ts { key === "constructor" ? undefined : getValueInfo(key, value, recurser)); } - const ignoredProperties: ReadonlySet = new Set(["arguments", "caller", "constructor", "eval", "super_"]); - const reservedFunctionProperties: ReadonlySet = new Set(Object.getOwnPropertyNames(noop)); + const ignoredProperties: ReadonlyArray = ["arguments", "caller", "constructor", "eval", "super_"]; + const reservedFunctionProperties: ReadonlyArray = Object.getOwnPropertyNames(noop); interface ObjectEntry { readonly key: string; readonly value: unknown; } function getEntriesOfObject(obj: object): ReadonlyArray { const seen = createMap(); @@ -114,8 +114,8 @@ namespace ts { while (!isNullOrUndefined(chain) && chain !== Object.prototype && chain !== Function.prototype) { for (const key of Object.getOwnPropertyNames(chain)) { if (!isJsPrivate(key) && - !ignoredProperties.has(key) && - (typeof obj !== "function" || !reservedFunctionProperties.has(key)) && + ignoredProperties.indexOf(key) === -1 && + (typeof obj !== "function" || reservedFunctionProperties.indexOf(key) === -1) && // Don't add property from a higher prototype if it already exists in a lower one addToSeen(seen, key)) { const value = safeGetPropertyOfObject(chain, key); @@ -148,7 +148,7 @@ namespace ts { } export function isJsPrivate(name: string): boolean { - return name.startsWith("_"); + return startsWith(name, "_"); } function tryRequire(fileNameToRequire: string): unknown { diff --git a/src/compiler/moduleSpecifiers.ts b/src/compiler/moduleSpecifiers.ts index 1913ee90b2b..f5bac45f6ab 100644 --- a/src/compiler/moduleSpecifiers.ts +++ b/src/compiler/moduleSpecifiers.ts @@ -203,7 +203,7 @@ namespace ts.moduleSpecifiers { return; // Don't want to a package to globally import from itself } - const target = targets.find(t => compareStrings(t.slice(0, resolved.length + 1), resolved + "/") === Comparison.EqualTo); + const target = find(targets, t => compareStrings(t.slice(0, resolved.length + 1), resolved + "/") === Comparison.EqualTo); if (target === undefined) return; const relative = getRelativePathFromDirectory(resolved, target, getCanonicalFileName); diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 9eedfeefb53..a9438110593 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -974,7 +974,9 @@ namespace ts { else { result = text.substring(start, end); // No need to use all the fragments; no _ removal needed } + if (decimalFragment !== undefined || tokenFlags & TokenFlags.Scientific) { + checkForIdentifierStartAfterNumericLiteral(); return { type: SyntaxKind.NumericLiteral, value: "" + +result // if value is not an integer, it can be safely coerced to a number @@ -983,10 +985,22 @@ namespace ts { else { tokenValue = result; const type = checkBigIntSuffix(); // if value is an integer, check whether it is a bigint + checkForIdentifierStartAfterNumericLiteral(); return { type, value: tokenValue }; } } + function checkForIdentifierStartAfterNumericLiteral() { + if (!isIdentifierStart(text.charCodeAt(pos), languageVersion)) { + return; + } + + const identifierStart = pos; + const { length } = scanIdentifierParts(); + error(Diagnostics.An_identifier_or_keyword_cannot_immediately_follow_a_numeric_literal, identifierStart, length); + pos = identifierStart; + } + function scanOctalDigits(): number { const start = pos; while (isOctalDigit(text.charCodeAt(pos))) { diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index b79a154c555..b02aff523d1 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -4450,6 +4450,8 @@ namespace FourSlashInterface { interfaceEntry("ObjectConstructor"), constEntry("Function"), interfaceEntry("FunctionConstructor"), + typeEntry("ThisParameterType"), + typeEntry("OmitThisParameter"), interfaceEntry("CallableFunction"), interfaceEntry("NewableFunction"), interfaceEntry("IArguments"), diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index c8e99f0d1db..308af721af6 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -295,6 +295,16 @@ interface FunctionConstructor { declare const Function: FunctionConstructor; +/** + * Extracts the type of the 'this' parameter of a function type, or 'unknown' if the function type has no 'this' parameter. + */ +type ThisParameterType = T extends (this: unknown, ...args: any[]) => any ? unknown : T extends (this: infer U, ...args: any[]) => any ? U : unknown; + +/** + * Removes the 'this' parameter from a function type. + */ +type OmitThisParameter = unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T; + interface CallableFunction extends Function { /** * Calls the function with the specified object as the this value and the elements of specified array as the arguments. @@ -317,7 +327,7 @@ interface CallableFunction extends Function { * @param thisArg The object to be used as the this object. * @param args Arguments to bind to the parameters of the function. */ - bind(this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; + bind(this: T, thisArg: ThisParameterType): OmitThisParameter; bind(this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; bind(this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; bind(this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; @@ -347,7 +357,7 @@ interface NewableFunction extends Function { * @param thisArg The object to be used as the this object. * @param args Arguments to bind to the parameters of the function. */ - bind(this: new (...args: A) => R, thisArg: any): new (...args: A) => R; + bind(this: T, thisArg: any): T; bind(this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; bind(this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; bind(this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index 0ed29a73bb5..f290826690e 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -1428,6 +1428,10 @@ namespace ts.FindAllReferences.Core { return [{ definition: { type: DefinitionKind.Symbol, symbol: searchSpaceNode.symbol }, references }]; } + function isParameterName(node: Node) { + return node.kind === SyntaxKind.Identifier && node.parent.kind === SyntaxKind.Parameter && (node.parent).name === node; + } + function getReferencesForThisKeyword(thisOrSuperKeyword: Node, sourceFiles: ReadonlyArray, cancellationToken: CancellationToken): SymbolAndEntries[] | undefined { let searchSpaceNode = getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); @@ -1450,7 +1454,7 @@ namespace ts.FindAllReferences.Core { searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; case SyntaxKind.SourceFile: - if (isExternalModule(searchSpaceNode)) { + if (isExternalModule(searchSpaceNode) || isParameterName(thisOrSuperKeyword)) { return undefined; } // falls through @@ -1483,7 +1487,7 @@ namespace ts.FindAllReferences.Core { // and has the appropriate static modifier from the original container. return container.parent && searchSpaceNode.symbol === container.parent.symbol && (getModifierFlags(container) & ModifierFlags.Static) === staticFlag; case SyntaxKind.SourceFile: - return container.kind === SyntaxKind.SourceFile && !isExternalModule(container); + return container.kind === SyntaxKind.SourceFile && !isExternalModule(container) && !isParameterName(node); } }); }).map(n => nodeEntry(n)); diff --git a/src/services/rename.ts b/src/services/rename.ts index 7ba32c91309..a51d79797bf 100644 --- a/src/services/rename.ts +++ b/src/services/rename.ts @@ -45,7 +45,7 @@ namespace ts.Rename { const moduleSourceFile = find(moduleSymbol.declarations, isSourceFile); if (!moduleSourceFile) return undefined; - const withoutIndex = node.text.endsWith("/index") || node.text.endsWith("/index.js") ? undefined : tryRemoveSuffix(removeFileExtension(moduleSourceFile.fileName), "/index"); + const withoutIndex = endsWith(node.text, "/index") || endsWith(node.text, "/index.js") ? undefined : tryRemoveSuffix(removeFileExtension(moduleSourceFile.fileName), "/index"); const name = withoutIndex === undefined ? moduleSourceFile.fileName : withoutIndex; const kind = withoutIndex === undefined ? ScriptElementKind.moduleElement : ScriptElementKind.directory; const indexAfterLastSlash = node.text.lastIndexOf("/") + 1; diff --git a/src/tsc/tsc.ts b/src/tsc/tsc.ts index ec3da718ef4..9d363dc4715 100644 --- a/src/tsc/tsc.ts +++ b/src/tsc/tsc.ts @@ -133,6 +133,11 @@ namespace ts { if (configFileName) { const configParseResult = parseConfigFileWithSystem(configFileName, commandLineOptions, sys, reportDiagnostic)!; // TODO: GH#18217 if (commandLineOptions.showConfig) { + if (configParseResult.errors.length !== 0) { + updateReportDiagnostic(configParseResult.options); + configParseResult.errors.forEach(reportDiagnostic); + return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); + } // tslint:disable-next-line:no-null-keyword sys.write(JSON.stringify(convertToTSConfig(configParseResult, configFileName, sys), null, 4) + sys.newLine); return sys.exit(ExitStatus.Success); diff --git a/src/tsconfig-base.json b/src/tsconfig-base.json index e9925f3a98b..4d83436a538 100644 --- a/src/tsconfig-base.json +++ b/src/tsconfig-base.json @@ -1,7 +1,7 @@ { "compilerOptions": { "pretty": true, - "lib": ["es2015"], + "lib": ["es2015.iterable", "es5"], "target": "es5", "rootDir": ".", diff --git a/tests/baselines/reference/TupleType5.errors.txt b/tests/baselines/reference/TupleType5.errors.txt deleted file mode 100644 index 1a6ca7f99b3..00000000000 --- a/tests/baselines/reference/TupleType5.errors.txt +++ /dev/null @@ -1,7 +0,0 @@ -tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType5.ts(1,15): error TS1009: Trailing comma not allowed. - - -==== tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType5.ts (1 errors) ==== - var v: [number,] - ~ -!!! error TS1009: Trailing comma not allowed. \ No newline at end of file diff --git a/tests/baselines/reference/TupleType6.errors.txt b/tests/baselines/reference/TupleType6.errors.txt new file mode 100644 index 00000000000..1c3427b8f38 --- /dev/null +++ b/tests/baselines/reference/TupleType6.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType6.ts(1,16): error TS1110: Type expected. + + +==== tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType6.ts (1 errors) ==== + var v: [number,,] + ~ +!!! error TS1110: Type expected. \ No newline at end of file diff --git a/tests/baselines/reference/TupleType6.js b/tests/baselines/reference/TupleType6.js new file mode 100644 index 00000000000..828d90a72bf --- /dev/null +++ b/tests/baselines/reference/TupleType6.js @@ -0,0 +1,5 @@ +//// [TupleType6.ts] +var v: [number,,] + +//// [TupleType6.js] +var v; diff --git a/tests/baselines/reference/TupleType6.symbols b/tests/baselines/reference/TupleType6.symbols new file mode 100644 index 00000000000..b02a0d6eb5e --- /dev/null +++ b/tests/baselines/reference/TupleType6.symbols @@ -0,0 +1,4 @@ +=== tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType6.ts === +var v: [number,,] +>v : Symbol(v, Decl(TupleType6.ts, 0, 3)) + diff --git a/tests/baselines/reference/TupleType6.types b/tests/baselines/reference/TupleType6.types new file mode 100644 index 00000000000..a5f9c5e59eb --- /dev/null +++ b/tests/baselines/reference/TupleType6.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType6.ts === +var v: [number,,] +>v : [number, any] + diff --git a/tests/baselines/reference/arguments.errors.txt b/tests/baselines/reference/arguments.errors.txt index de6aa35333f..882477aaac9 100644 --- a/tests/baselines/reference/arguments.errors.txt +++ b/tests/baselines/reference/arguments.errors.txt @@ -1,15 +1,21 @@ -tests/cases/compiler/arguments.ts(6,25): error TS2304: Cannot find name 'arguments'. -tests/cases/compiler/arguments.ts(7,23): error TS2304: Cannot find name 'arguments'. -tests/cases/compiler/arguments.ts(8,19): error TS2304: Cannot find name 'arguments'. -tests/cases/compiler/arguments.ts(9,23): error TS2304: Cannot find name 'arguments'. -tests/cases/compiler/arguments.ts(10,34): error TS2304: Cannot find name 'arguments'. +tests/cases/compiler/arguments.ts(6,8): error TS2304: Cannot find name 'arguments'. +tests/cases/compiler/arguments.ts(9,25): error TS2304: Cannot find name 'arguments'. +tests/cases/compiler/arguments.ts(10,23): error TS2304: Cannot find name 'arguments'. +tests/cases/compiler/arguments.ts(11,19): error TS2304: Cannot find name 'arguments'. +tests/cases/compiler/arguments.ts(12,23): error TS2304: Cannot find name 'arguments'. +tests/cases/compiler/arguments.ts(13,34): error TS2304: Cannot find name 'arguments'. -==== tests/cases/compiler/arguments.ts (5 errors) ==== +==== tests/cases/compiler/arguments.ts (6 errors) ==== function f() { var x=arguments[12]; + (() => arguments)(); } + (() => arguments)(); + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'arguments'. + interface I { method(args: typeof arguments): void; ~~~~~~~~~ diff --git a/tests/baselines/reference/arguments.js b/tests/baselines/reference/arguments.js index 8622c084503..3dd362506c6 100644 --- a/tests/baselines/reference/arguments.js +++ b/tests/baselines/reference/arguments.js @@ -1,8 +1,11 @@ //// [arguments.ts] function f() { var x=arguments[12]; + (() => arguments)(); } +(() => arguments)(); + interface I { method(args: typeof arguments): void; fn: (args: typeof arguments) => void; @@ -14,4 +17,6 @@ interface I { //// [arguments.js] function f() { var x = arguments[12]; + (() => arguments)(); } +(() => arguments)(); diff --git a/tests/baselines/reference/arguments.symbols b/tests/baselines/reference/arguments.symbols index c8be643332c..770077a90b2 100644 --- a/tests/baselines/reference/arguments.symbols +++ b/tests/baselines/reference/arguments.symbols @@ -4,27 +4,32 @@ function f() { var x=arguments[12]; >x : Symbol(x, Decl(arguments.ts, 1, 7)) +>arguments : Symbol(arguments) + + (() => arguments)(); >arguments : Symbol(arguments) } +(() => arguments)(); + interface I { ->I : Symbol(I, Decl(arguments.ts, 2, 1)) +>I : Symbol(I, Decl(arguments.ts, 5, 20)) method(args: typeof arguments): void; ->method : Symbol(I.method, Decl(arguments.ts, 4, 13)) ->args : Symbol(args, Decl(arguments.ts, 5, 11)) +>method : Symbol(I.method, Decl(arguments.ts, 7, 13)) +>args : Symbol(args, Decl(arguments.ts, 8, 11)) fn: (args: typeof arguments) => void; ->fn : Symbol(I.fn, Decl(arguments.ts, 5, 41)) ->args : Symbol(args, Decl(arguments.ts, 6, 9)) +>fn : Symbol(I.fn, Decl(arguments.ts, 8, 41)) +>args : Symbol(args, Decl(arguments.ts, 9, 9)) (args: typeof arguments): void; ->args : Symbol(args, Decl(arguments.ts, 7, 5)) +>args : Symbol(args, Decl(arguments.ts, 10, 5)) new (args: typeof arguments): void; ->args : Symbol(args, Decl(arguments.ts, 8, 9)) +>args : Symbol(args, Decl(arguments.ts, 11, 9)) construct: new (args: typeof arguments) => void; ->construct : Symbol(I.construct, Decl(arguments.ts, 8, 39)) ->args : Symbol(args, Decl(arguments.ts, 9, 20)) +>construct : Symbol(I.construct, Decl(arguments.ts, 11, 39)) +>args : Symbol(args, Decl(arguments.ts, 12, 20)) } diff --git a/tests/baselines/reference/arguments.types b/tests/baselines/reference/arguments.types index 655f6182c6f..a46f4b3015e 100644 --- a/tests/baselines/reference/arguments.types +++ b/tests/baselines/reference/arguments.types @@ -7,8 +7,20 @@ function f() { >arguments[12] : any >arguments : IArguments >12 : 12 + + (() => arguments)(); +>(() => arguments)() : IArguments +>(() => arguments) : () => IArguments +>() => arguments : () => IArguments +>arguments : IArguments } +(() => arguments)(); +>(() => arguments)() : any +>(() => arguments) : () => any +>() => arguments : () => any +>arguments : any + interface I { method(args: typeof arguments): void; >method : (args: any) => void diff --git a/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt b/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt index e51ee68b604..035d912b638 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt +++ b/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt @@ -41,7 +41,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts( a1(...array2); // Error parameter type is (number|string)[] ~~~~~~ !!! error TS2552: Cannot find name 'array2'. Did you mean 'Array'? -!!! related TS2728 /.ts/lib.es5.d.ts:1358:15: 'Array' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1368:15: 'Array' is declared here. a5([1, 2, "string", false, true]); // Error, parameter type is [any, any, [[any]]] ~~~~~~~~ !!! error TS2322: Type 'string' is not assignable to type '[[any]]'. diff --git a/tests/baselines/reference/discriminatedUnionInference.js b/tests/baselines/reference/discriminatedUnionInference.js new file mode 100644 index 00000000000..df45edeb237 --- /dev/null +++ b/tests/baselines/reference/discriminatedUnionInference.js @@ -0,0 +1,27 @@ +//// [discriminatedUnionInference.ts] +// Repro from #28862 + +type Foo = { type: "foo", (): A[] }; +type Bar = { type: "bar", (): A }; + +type FooBar = Foo | Bar; + +type InferA = T extends FooBar ? A : never; + +type FooA = InferA>; // number + +// Repro from #28862 + +type Item = { kind: 'a', data: T } | { kind: 'b', data: T[] }; + +declare function foo(item: Item): T; + +let x1 = foo({ kind: 'a', data: 42 }); // number +let x2 = foo({ kind: 'b', data: [1, 2] }); // number + + +//// [discriminatedUnionInference.js] +"use strict"; +// Repro from #28862 +var x1 = foo({ kind: 'a', data: 42 }); // number +var x2 = foo({ kind: 'b', data: [1, 2] }); // number diff --git a/tests/baselines/reference/discriminatedUnionInference.symbols b/tests/baselines/reference/discriminatedUnionInference.symbols new file mode 100644 index 00000000000..d8643b7ba6a --- /dev/null +++ b/tests/baselines/reference/discriminatedUnionInference.symbols @@ -0,0 +1,68 @@ +=== tests/cases/conformance/types/typeRelationships/typeInference/discriminatedUnionInference.ts === +// Repro from #28862 + +type Foo = { type: "foo", (): A[] }; +>Foo : Symbol(Foo, Decl(discriminatedUnionInference.ts, 0, 0)) +>A : Symbol(A, Decl(discriminatedUnionInference.ts, 2, 9)) +>type : Symbol(type, Decl(discriminatedUnionInference.ts, 2, 15)) +>A : Symbol(A, Decl(discriminatedUnionInference.ts, 2, 9)) + +type Bar = { type: "bar", (): A }; +>Bar : Symbol(Bar, Decl(discriminatedUnionInference.ts, 2, 39)) +>A : Symbol(A, Decl(discriminatedUnionInference.ts, 3, 9)) +>type : Symbol(type, Decl(discriminatedUnionInference.ts, 3, 15)) +>A : Symbol(A, Decl(discriminatedUnionInference.ts, 3, 9)) + +type FooBar = Foo | Bar; +>FooBar : Symbol(FooBar, Decl(discriminatedUnionInference.ts, 3, 37)) +>A : Symbol(A, Decl(discriminatedUnionInference.ts, 5, 12)) +>Foo : Symbol(Foo, Decl(discriminatedUnionInference.ts, 0, 0)) +>A : Symbol(A, Decl(discriminatedUnionInference.ts, 5, 12)) +>Bar : Symbol(Bar, Decl(discriminatedUnionInference.ts, 2, 39)) +>A : Symbol(A, Decl(discriminatedUnionInference.ts, 5, 12)) + +type InferA = T extends FooBar ? A : never; +>InferA : Symbol(InferA, Decl(discriminatedUnionInference.ts, 5, 33)) +>T : Symbol(T, Decl(discriminatedUnionInference.ts, 7, 12)) +>T : Symbol(T, Decl(discriminatedUnionInference.ts, 7, 12)) +>FooBar : Symbol(FooBar, Decl(discriminatedUnionInference.ts, 3, 37)) +>A : Symbol(A, Decl(discriminatedUnionInference.ts, 7, 39)) +>A : Symbol(A, Decl(discriminatedUnionInference.ts, 7, 39)) + +type FooA = InferA>; // number +>FooA : Symbol(FooA, Decl(discriminatedUnionInference.ts, 7, 55)) +>InferA : Symbol(InferA, Decl(discriminatedUnionInference.ts, 5, 33)) +>Foo : Symbol(Foo, Decl(discriminatedUnionInference.ts, 0, 0)) + +// Repro from #28862 + +type Item = { kind: 'a', data: T } | { kind: 'b', data: T[] }; +>Item : Symbol(Item, Decl(discriminatedUnionInference.ts, 9, 32)) +>T : Symbol(T, Decl(discriminatedUnionInference.ts, 13, 10)) +>kind : Symbol(kind, Decl(discriminatedUnionInference.ts, 13, 16)) +>data : Symbol(data, Decl(discriminatedUnionInference.ts, 13, 27)) +>T : Symbol(T, Decl(discriminatedUnionInference.ts, 13, 10)) +>kind : Symbol(kind, Decl(discriminatedUnionInference.ts, 13, 41)) +>data : Symbol(data, Decl(discriminatedUnionInference.ts, 13, 52)) +>T : Symbol(T, Decl(discriminatedUnionInference.ts, 13, 10)) + +declare function foo(item: Item): T; +>foo : Symbol(foo, Decl(discriminatedUnionInference.ts, 13, 65)) +>T : Symbol(T, Decl(discriminatedUnionInference.ts, 15, 21)) +>item : Symbol(item, Decl(discriminatedUnionInference.ts, 15, 24)) +>Item : Symbol(Item, Decl(discriminatedUnionInference.ts, 9, 32)) +>T : Symbol(T, Decl(discriminatedUnionInference.ts, 15, 21)) +>T : Symbol(T, Decl(discriminatedUnionInference.ts, 15, 21)) + +let x1 = foo({ kind: 'a', data: 42 }); // number +>x1 : Symbol(x1, Decl(discriminatedUnionInference.ts, 17, 3)) +>foo : Symbol(foo, Decl(discriminatedUnionInference.ts, 13, 65)) +>kind : Symbol(kind, Decl(discriminatedUnionInference.ts, 17, 14)) +>data : Symbol(data, Decl(discriminatedUnionInference.ts, 17, 25)) + +let x2 = foo({ kind: 'b', data: [1, 2] }); // number +>x2 : Symbol(x2, Decl(discriminatedUnionInference.ts, 18, 3)) +>foo : Symbol(foo, Decl(discriminatedUnionInference.ts, 13, 65)) +>kind : Symbol(kind, Decl(discriminatedUnionInference.ts, 18, 14)) +>data : Symbol(data, Decl(discriminatedUnionInference.ts, 18, 25)) + diff --git a/tests/baselines/reference/discriminatedUnionInference.types b/tests/baselines/reference/discriminatedUnionInference.types new file mode 100644 index 00000000000..65e3db1510a --- /dev/null +++ b/tests/baselines/reference/discriminatedUnionInference.types @@ -0,0 +1,55 @@ +=== tests/cases/conformance/types/typeRelationships/typeInference/discriminatedUnionInference.ts === +// Repro from #28862 + +type Foo = { type: "foo", (): A[] }; +>Foo : Foo +>type : "foo" + +type Bar = { type: "bar", (): A }; +>Bar : Bar +>type : "bar" + +type FooBar = Foo | Bar; +>FooBar : FooBar + +type InferA = T extends FooBar ? A : never; +>InferA : InferA + +type FooA = InferA>; // number +>FooA : number + +// Repro from #28862 + +type Item = { kind: 'a', data: T } | { kind: 'b', data: T[] }; +>Item : Item +>kind : "a" +>data : T +>kind : "b" +>data : T[] + +declare function foo(item: Item): T; +>foo : (item: Item) => T +>item : Item + +let x1 = foo({ kind: 'a', data: 42 }); // number +>x1 : number +>foo({ kind: 'a', data: 42 }) : number +>foo : (item: Item) => T +>{ kind: 'a', data: 42 } : { kind: "a"; data: number; } +>kind : "a" +>'a' : "a" +>data : number +>42 : 42 + +let x2 = foo({ kind: 'b', data: [1, 2] }); // number +>x2 : number +>foo({ kind: 'b', data: [1, 2] }) : number +>foo : (item: Item) => T +>{ kind: 'b', data: [1, 2] } : { kind: "b"; data: number[]; } +>kind : "b" +>'b' : "b" +>data : number[] +>[1, 2] : number[] +>1 : 1 +>2 : 2 + diff --git a/tests/baselines/reference/discriminatedUnionTypes2.errors.txt b/tests/baselines/reference/discriminatedUnionTypes2.errors.txt index c50f7a2767a..15ed6968aea 100644 --- a/tests/baselines/reference/discriminatedUnionTypes2.errors.txt +++ b/tests/baselines/reference/discriminatedUnionTypes2.errors.txt @@ -83,4 +83,26 @@ tests/cases/conformance/types/union/discriminatedUnionTypes2.ts(32,11): error TS const data: null = carrier.data } } + + // Repro from #28935 + + type Foo = { tag: true, x: number } | { tag: false, y: number } | { [x: string]: string }; + + function f30(foo: Foo) { + if (foo.tag) { + foo; + } + else { + foo; + } + } + + function f31(foo: Foo) { + if (foo.tag === true) { + foo; + } + else { + foo; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/discriminatedUnionTypes2.js b/tests/baselines/reference/discriminatedUnionTypes2.js index e2b5d99ddcd..ec5b2a6b5f1 100644 --- a/tests/baselines/reference/discriminatedUnionTypes2.js +++ b/tests/baselines/reference/discriminatedUnionTypes2.js @@ -71,6 +71,28 @@ function f20(carrier: DataCarrier) { const data: null = carrier.data } } + +// Repro from #28935 + +type Foo = { tag: true, x: number } | { tag: false, y: number } | { [x: string]: string }; + +function f30(foo: Foo) { + if (foo.tag) { + foo; + } + else { + foo; + } +} + +function f31(foo: Foo) { + if (foo.tag === true) { + foo; + } + else { + foo; + } +} //// [discriminatedUnionTypes2.js] @@ -126,3 +148,19 @@ function f20(carrier) { var data = carrier.data; } } +function f30(foo) { + if (foo.tag) { + foo; + } + else { + foo; + } +} +function f31(foo) { + if (foo.tag === true) { + foo; + } + else { + foo; + } +} diff --git a/tests/baselines/reference/discriminatedUnionTypes2.symbols b/tests/baselines/reference/discriminatedUnionTypes2.symbols index 38cfcb0b23a..682c62b9be5 100644 --- a/tests/baselines/reference/discriminatedUnionTypes2.symbols +++ b/tests/baselines/reference/discriminatedUnionTypes2.symbols @@ -225,3 +225,51 @@ function f20(carrier: DataCarrier) { } } +// Repro from #28935 + +type Foo = { tag: true, x: number } | { tag: false, y: number } | { [x: string]: string }; +>Foo : Symbol(Foo, Decl(discriminatedUnionTypes2.ts, 71, 1)) +>tag : Symbol(tag, Decl(discriminatedUnionTypes2.ts, 75, 12)) +>x : Symbol(x, Decl(discriminatedUnionTypes2.ts, 75, 23)) +>tag : Symbol(tag, Decl(discriminatedUnionTypes2.ts, 75, 39)) +>y : Symbol(y, Decl(discriminatedUnionTypes2.ts, 75, 51)) +>x : Symbol(x, Decl(discriminatedUnionTypes2.ts, 75, 69)) + +function f30(foo: Foo) { +>f30 : Symbol(f30, Decl(discriminatedUnionTypes2.ts, 75, 90)) +>foo : Symbol(foo, Decl(discriminatedUnionTypes2.ts, 77, 13)) +>Foo : Symbol(Foo, Decl(discriminatedUnionTypes2.ts, 71, 1)) + + if (foo.tag) { +>foo.tag : Symbol(tag, Decl(discriminatedUnionTypes2.ts, 75, 12), Decl(discriminatedUnionTypes2.ts, 75, 39)) +>foo : Symbol(foo, Decl(discriminatedUnionTypes2.ts, 77, 13)) +>tag : Symbol(tag, Decl(discriminatedUnionTypes2.ts, 75, 12), Decl(discriminatedUnionTypes2.ts, 75, 39)) + + foo; +>foo : Symbol(foo, Decl(discriminatedUnionTypes2.ts, 77, 13)) + } + else { + foo; +>foo : Symbol(foo, Decl(discriminatedUnionTypes2.ts, 77, 13)) + } +} + +function f31(foo: Foo) { +>f31 : Symbol(f31, Decl(discriminatedUnionTypes2.ts, 84, 1)) +>foo : Symbol(foo, Decl(discriminatedUnionTypes2.ts, 86, 13)) +>Foo : Symbol(Foo, Decl(discriminatedUnionTypes2.ts, 71, 1)) + + if (foo.tag === true) { +>foo.tag : Symbol(tag, Decl(discriminatedUnionTypes2.ts, 75, 12), Decl(discriminatedUnionTypes2.ts, 75, 39)) +>foo : Symbol(foo, Decl(discriminatedUnionTypes2.ts, 86, 13)) +>tag : Symbol(tag, Decl(discriminatedUnionTypes2.ts, 75, 12), Decl(discriminatedUnionTypes2.ts, 75, 39)) + + foo; +>foo : Symbol(foo, Decl(discriminatedUnionTypes2.ts, 86, 13)) + } + else { + foo; +>foo : Symbol(foo, Decl(discriminatedUnionTypes2.ts, 86, 13)) + } +} + diff --git a/tests/baselines/reference/discriminatedUnionTypes2.types b/tests/baselines/reference/discriminatedUnionTypes2.types index b654fc1a78d..58819d0d349 100644 --- a/tests/baselines/reference/discriminatedUnionTypes2.types +++ b/tests/baselines/reference/discriminatedUnionTypes2.types @@ -239,3 +239,53 @@ function f20(carrier: DataCarrier) { } } +// Repro from #28935 + +type Foo = { tag: true, x: number } | { tag: false, y: number } | { [x: string]: string }; +>Foo : Foo +>tag : true +>true : true +>x : number +>tag : false +>false : false +>y : number +>x : string + +function f30(foo: Foo) { +>f30 : (foo: Foo) => void +>foo : Foo + + if (foo.tag) { +>foo.tag : string | boolean +>foo : Foo +>tag : string | boolean + + foo; +>foo : { tag: true; x: number; } | { [x: string]: string; } + } + else { + foo; +>foo : { tag: false; y: number; } | { [x: string]: string; } + } +} + +function f31(foo: Foo) { +>f31 : (foo: Foo) => void +>foo : Foo + + if (foo.tag === true) { +>foo.tag === true : boolean +>foo.tag : string | boolean +>foo : Foo +>tag : string | boolean +>true : true + + foo; +>foo : { tag: true; x: number; } + } + else { + foo; +>foo : { tag: false; y: number; } | { [x: string]: string; } + } +} + diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments01_ES6.errors.txt b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments01_ES6.errors.txt new file mode 100644 index 00000000000..5f1a0525fd8 --- /dev/null +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments01_ES6.errors.txt @@ -0,0 +1,40 @@ +tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments01_ES6.ts(2,15): error TS2304: Cannot find name 'arguments'. +tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments01_ES6.ts(19,15): error TS2304: Cannot find name 'arguments'. + + +==== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments01_ES6.ts (2 errors) ==== + var a = () => { + var arg = arguments[0]; // error + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'arguments'. + } + + var b = function () { + var a = () => { + var arg = arguments[0]; // error + } + } + + function baz() { + () => { + var arg = arguments[0]; + } + } + + function foo(inputFunc: () => void) { } + foo(() => { + var arg = arguments[0]; // error + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'arguments'. + }); + + function bar() { + var arg = arguments[0]; // no error + } + + + () => { + function foo() { + var arg = arguments[0]; // no error + } + } \ No newline at end of file diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments01_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments01_ES6.symbols index 698b32da7ad..9298998fb74 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments01_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments01_ES6.symbols @@ -4,7 +4,6 @@ var a = () => { var arg = arguments[0]; // error >arg : Symbol(arg, Decl(emitArrowFunctionWhenUsingArguments01_ES6.ts, 1, 7)) ->arguments : Symbol(arguments) } var b = function () { @@ -38,7 +37,6 @@ foo(() => { var arg = arguments[0]; // error >arg : Symbol(arg, Decl(emitArrowFunctionWhenUsingArguments01_ES6.ts, 18, 7)) ->arguments : Symbol(arguments) }); diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments01_ES6.types b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments01_ES6.types index 6da6a224a6c..2e47d402986 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments01_ES6.types +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments01_ES6.types @@ -6,7 +6,7 @@ var a = () => { var arg = arguments[0]; // error >arg : any >arguments[0] : any ->arguments : IArguments +>arguments : any >0 : 0 } @@ -52,7 +52,7 @@ foo(() => { var arg = arguments[0]; // error >arg : any >arguments[0] : any ->arguments : IArguments +>arguments : any >0 : 0 }); diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments02_ES6.errors.txt b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments02_ES6.errors.txt new file mode 100644 index 00000000000..653ed55592e --- /dev/null +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments02_ES6.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments02_ES6.ts(1,15): error TS2304: Cannot find name 'arguments'. + + +==== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments02_ES6.ts (1 errors) ==== + var a = () => arguments; + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'arguments'. \ No newline at end of file diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments02_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments02_ES6.symbols index 4843562aaec..87bafa16224 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments02_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments02_ES6.symbols @@ -1,5 +1,4 @@ === tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments02_ES6.ts === var a = () => arguments; >a : Symbol(a, Decl(emitArrowFunctionWhenUsingArguments02_ES6.ts, 0, 3)) ->arguments : Symbol(arguments) diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments02_ES6.types b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments02_ES6.types index 40859c33cc3..541105ac689 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments02_ES6.types +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments02_ES6.types @@ -1,6 +1,6 @@ === tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments02_ES6.ts === var a = () => arguments; ->a : () => IArguments ->() => arguments : () => IArguments ->arguments : IArguments +>a : () => any +>() => arguments : () => any +>arguments : any diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments03_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments03_ES6.symbols index 71518083b1f..22a6602c178 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments03_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments03_ES6.symbols @@ -4,5 +4,5 @@ var arguments; var a = () => arguments; >a : Symbol(a, Decl(emitArrowFunctionWhenUsingArguments03_ES6.ts, 1, 3)) ->arguments : Symbol(arguments) +>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments03_ES6.ts, 0, 3)) diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments03_ES6.types b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments03_ES6.types index ad46bec71b6..f4dab85c46d 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments03_ES6.types +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments03_ES6.types @@ -3,7 +3,7 @@ var arguments; >arguments : any var a = () => arguments; ->a : () => IArguments ->() => arguments : () => IArguments ->arguments : IArguments +>a : () => any +>() => arguments : () => any +>arguments : any diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments04_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments04_ES6.symbols index d42db50fa3b..80848c3536a 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments04_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments04_ES6.symbols @@ -7,5 +7,5 @@ function f() { var a = () => arguments; >a : Symbol(a, Decl(emitArrowFunctionWhenUsingArguments04_ES6.ts, 2, 7)) ->arguments : Symbol(arguments) +>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments04_ES6.ts, 1, 7)) } diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments04_ES6.types b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments04_ES6.types index e371862ee4d..8eb25aa52cc 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments04_ES6.types +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments04_ES6.types @@ -6,7 +6,7 @@ function f() { >arguments : any var a = () => arguments; ->a : () => IArguments ->() => arguments : () => IArguments ->arguments : IArguments +>a : () => any +>() => arguments : () => any +>arguments : any } diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments05_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments05_ES6.symbols index cfa539d1948..9b380c12aca 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments05_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments05_ES6.symbols @@ -5,5 +5,5 @@ function f(arguments) { var a = () => arguments; >a : Symbol(a, Decl(emitArrowFunctionWhenUsingArguments05_ES6.ts, 1, 7)) ->arguments : Symbol(arguments) +>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments05_ES6.ts, 0, 11)) } diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments05_ES6.types b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments05_ES6.types index bcb452f0940..dc6b35bf6ab 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments05_ES6.types +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments05_ES6.types @@ -4,7 +4,7 @@ function f(arguments) { >arguments : any var a = () => arguments; ->a : () => IArguments ->() => arguments : () => IArguments ->arguments : IArguments +>a : () => any +>() => arguments : () => any +>arguments : any } diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments06_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments06_ES6.symbols index 0aef2f06c45..6152d5f0bc0 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments06_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments06_ES6.symbols @@ -5,5 +5,5 @@ function f(arguments) { var a = () => () => arguments; >a : Symbol(a, Decl(emitArrowFunctionWhenUsingArguments06_ES6.ts, 1, 7)) ->arguments : Symbol(arguments) +>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments06_ES6.ts, 0, 11)) } diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments06_ES6.types b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments06_ES6.types index f29eb52f32b..98370e538b1 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments06_ES6.types +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments06_ES6.types @@ -4,8 +4,8 @@ function f(arguments) { >arguments : any var a = () => () => arguments; ->a : () => () => IArguments ->() => () => arguments : () => () => IArguments ->() => arguments : () => IArguments ->arguments : IArguments +>a : () => () => any +>() => () => arguments : () => () => any +>() => arguments : () => any +>arguments : any } diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments07_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments07_ES6.symbols index 4fdce2cccb1..d5bd8c1afba 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments07_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments07_ES6.symbols @@ -6,5 +6,5 @@ function f(arguments) { var a = (arguments) => () => arguments; >a : Symbol(a, Decl(emitArrowFunctionWhenUsingArguments07_ES6.ts, 1, 7)) >arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments07_ES6.ts, 1, 13)) ->arguments : Symbol(arguments) +>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments07_ES6.ts, 1, 13)) } diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments07_ES6.types b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments07_ES6.types index 168ffac3c5e..eb7f40e6a05 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments07_ES6.types +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments07_ES6.types @@ -4,9 +4,9 @@ function f(arguments) { >arguments : any var a = (arguments) => () => arguments; ->a : (arguments: any) => () => IArguments ->(arguments) => () => arguments : (arguments: any) => () => IArguments +>a : (arguments: any) => () => any +>(arguments) => () => arguments : (arguments: any) => () => any +>arguments : any +>() => arguments : () => any >arguments : any ->() => arguments : () => IArguments ->arguments : IArguments } diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments11_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments11_ES6.symbols index 1af084727be..d307681a7d2 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments11_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments11_ES6.symbols @@ -8,5 +8,5 @@ function f(arguments) { var a = () => () => arguments; >a : Symbol(a, Decl(emitArrowFunctionWhenUsingArguments11_ES6.ts, 2, 7)) ->arguments : Symbol(arguments) +>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments11_ES6.ts, 0, 11)) } diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments11_ES6.types b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments11_ES6.types index fa19fe7b9b1..12ae41331db 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments11_ES6.types +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments11_ES6.types @@ -8,8 +8,8 @@ function f(arguments) { >10 : 10 var a = () => () => arguments; ->a : () => () => IArguments ->() => () => arguments : () => () => IArguments ->() => arguments : () => IArguments ->arguments : IArguments +>a : () => () => any +>() => () => arguments : () => () => any +>() => arguments : () => any +>arguments : any } diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments12_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments12_ES6.symbols index 4824a8fbbc3..62e950ecfe6 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments12_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments12_ES6.symbols @@ -8,6 +8,6 @@ class C { var a = () => arguments; >a : Symbol(a, Decl(emitArrowFunctionWhenUsingArguments12_ES6.ts, 2, 11)) ->arguments : Symbol(arguments) +>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments12_ES6.ts, 1, 6)) } } diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments12_ES6.types b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments12_ES6.types index b41dda95439..42bed2b7089 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments12_ES6.types +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments12_ES6.types @@ -7,8 +7,8 @@ class C { >arguments : any var a = () => arguments; ->a : () => IArguments ->() => arguments : () => IArguments ->arguments : IArguments +>a : () => any +>() => arguments : () => any +>arguments : any } } diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.symbols index b984e697d02..fdb8e605cc6 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.symbols @@ -11,6 +11,6 @@ function f() { >arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments14_ES6.ts, 2, 11)) return () => arguments; ->arguments : Symbol(arguments) +>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments14_ES6.ts, 2, 11)) } } diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.types b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.types index 19526febab3..e5a6188c449 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.types +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.types @@ -1,6 +1,6 @@ === tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments14_ES6.ts === function f() { ->f : () => () => IArguments +>f : () => () => number if (Math.random()) { >Math.random() : number @@ -13,7 +13,7 @@ function f() { >100 : 100 return () => arguments; ->() => arguments : () => IArguments ->arguments : IArguments +>() => arguments : () => number +>arguments : number } } diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.symbols index 95693995e7f..05c53206e5f 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.symbols @@ -14,6 +14,6 @@ function f() { >arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments15_ES6.ts, 3, 13)) return () => arguments; ->arguments : Symbol(arguments) +>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments15_ES6.ts, 3, 13)) } } diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.types b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.types index 69b1e795071..adf53c18826 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.types +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.types @@ -1,6 +1,6 @@ === tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments15_ES6.ts === function f() { ->f : () => () => IArguments +>f : () => () => number var arguments = "hello"; >arguments : string @@ -17,7 +17,7 @@ function f() { >100 : 100 return () => arguments; ->() => arguments : () => IArguments ->arguments : IArguments +>() => arguments : () => number +>arguments : 100 } } diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.symbols index accf6365cd4..356a3841ea1 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.symbols @@ -11,7 +11,7 @@ function f() { >random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) return () => arguments[0]; ->arguments : Symbol(arguments) +>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments16_ES6.ts, 1, 7), Decl(emitArrowFunctionWhenUsingArguments16_ES6.ts, 5, 7)) } var arguments = "world"; >arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments16_ES6.ts, 1, 7), Decl(emitArrowFunctionWhenUsingArguments16_ES6.ts, 5, 7)) diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.types b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.types index 50c619035ac..7c9495808ad 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.types +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.types @@ -1,6 +1,6 @@ === tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments16_ES6.ts === function f() { ->f : () => () => any +>f : () => () => string var arguments = "hello"; >arguments : string @@ -13,9 +13,9 @@ function f() { >random : () => number return () => arguments[0]; ->() => arguments[0] : () => any ->arguments[0] : any ->arguments : IArguments +>() => arguments[0] : () => string +>arguments[0] : string +>arguments : string >0 : 0 } var arguments = "world"; diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.symbols index 7cfb86db049..c889a9ada61 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.symbols @@ -12,7 +12,7 @@ function f() { >random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) return () => arguments[0]; ->arguments : Symbol(arguments) +>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments17_ES6.ts, 1, 9), Decl(emitArrowFunctionWhenUsingArguments17_ES6.ts, 5, 7)) } var arguments = "world"; >arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments17_ES6.ts, 1, 9), Decl(emitArrowFunctionWhenUsingArguments17_ES6.ts, 5, 7)) diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.types b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.types index e0ea34ba0fe..30facb027e4 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.types +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.types @@ -1,6 +1,6 @@ === tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments17_ES6.ts === function f() { ->f : () => () => any +>f : () => () => string var { arguments } = { arguments: "hello" }; >arguments : string @@ -15,9 +15,9 @@ function f() { >random : () => number return () => arguments[0]; ->() => arguments[0] : () => any ->arguments[0] : any ->arguments : IArguments +>() => arguments[0] : () => string +>arguments[0] : string +>arguments : string >0 : 0 } var arguments = "world"; diff --git a/tests/baselines/reference/externModule.errors.txt b/tests/baselines/reference/externModule.errors.txt index 377fe025cc6..8e95e2c8101 100644 --- a/tests/baselines/reference/externModule.errors.txt +++ b/tests/baselines/reference/externModule.errors.txt @@ -69,20 +69,20 @@ tests/cases/compiler/externModule.ts(37,3): error TS2552: Cannot find name 'XDat var d=new XDate(); ~~~~~ !!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'? -!!! related TS2728 /.ts/lib.es5.d.ts:897:15: 'Date' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:907:15: 'Date' is declared here. d.getDay(); d=new XDate(1978,2); ~~~~~ !!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'? -!!! related TS2728 /.ts/lib.es5.d.ts:897:15: 'Date' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:907:15: 'Date' is declared here. d.getXDate(); var n=XDate.parse("3/2/2004"); ~~~~~ !!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'? -!!! related TS2728 /.ts/lib.es5.d.ts:897:15: 'Date' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:907:15: 'Date' is declared here. n=XDate.UTC(1964,2,1); ~~~~~ !!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'? -!!! related TS2728 /.ts/lib.es5.d.ts:897:15: 'Date' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:907:15: 'Date' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/functionTypeArgumentArityErrors.errors.txt b/tests/baselines/reference/functionTypeArgumentArityErrors.errors.txt new file mode 100644 index 00000000000..22e22785a24 --- /dev/null +++ b/tests/baselines/reference/functionTypeArgumentArityErrors.errors.txt @@ -0,0 +1,57 @@ +tests/cases/compiler/functionTypeArgumentArityErrors.ts(4,4): error TS2743: No overload expects 2 type arguments, but overloads do exist that expect either 1 or 3 type arguments. +tests/cases/compiler/functionTypeArgumentArityErrors.ts(5,4): error TS2558: Expected 4 type arguments, but got 5. +tests/cases/compiler/functionTypeArgumentArityErrors.ts(10,4): error TS2743: No overload expects 2 type arguments, but overloads do exist that expect either 1 or 3 type arguments. +tests/cases/compiler/functionTypeArgumentArityErrors.ts(11,4): error TS2558: Expected 3 type arguments, but got 4. +tests/cases/compiler/functionTypeArgumentArityErrors.ts(16,4): error TS2558: Expected 0 type arguments, but got 1. +tests/cases/compiler/functionTypeArgumentArityErrors.ts(20,4): error TS2558: Expected 2-3 type arguments, but got 1. +tests/cases/compiler/functionTypeArgumentArityErrors.ts(21,4): error TS2558: Expected 2-3 type arguments, but got 4. +tests/cases/compiler/functionTypeArgumentArityErrors.ts(25,4): error TS2558: Expected 2 type arguments, but got 1. +tests/cases/compiler/functionTypeArgumentArityErrors.ts(26,4): error TS2558: Expected 2 type arguments, but got 3. + + +==== tests/cases/compiler/functionTypeArgumentArityErrors.ts (9 errors) ==== + // Overloaded functions with default type arguments + declare function f1(): void; + declare function f1(): void; + f1(); + ~~~~~~~~~~~~~~ +!!! error TS2743: No overload expects 2 type arguments, but overloads do exist that expect either 1 or 3 type arguments. + f1(); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2558: Expected 4 type arguments, but got 5. + + // Overloaded functions with no default type arguments + declare function f2(): void; + declare function f2(): void; + f2(); + ~~~~~~~~~~~~~~ +!!! error TS2743: No overload expects 2 type arguments, but overloads do exist that expect either 1 or 3 type arguments. + f2(); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2558: Expected 3 type arguments, but got 4. + + // Overloaded non-generic functions + declare function f3(): void; + declare function f3(a): void; + f3(); + ~~~~~~ +!!! error TS2558: Expected 0 type arguments, but got 1. + + // Generic function with default type parameters + declare function f4(): void; + f4(); + ~~~~~~ +!!! error TS2558: Expected 2-3 type arguments, but got 1. + f4(); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2558: Expected 2-3 type arguments, but got 4. + + // Generic function with no default type arguments + declare function f5(): void; + f5(); + ~~~~~~ +!!! error TS2558: Expected 2 type arguments, but got 1. + f5(); + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2558: Expected 2 type arguments, but got 3. + \ No newline at end of file diff --git a/tests/baselines/reference/functionTypeArgumentArityErrors.js b/tests/baselines/reference/functionTypeArgumentArityErrors.js new file mode 100644 index 00000000000..9c150bea78b --- /dev/null +++ b/tests/baselines/reference/functionTypeArgumentArityErrors.js @@ -0,0 +1,39 @@ +//// [functionTypeArgumentArityErrors.ts] +// Overloaded functions with default type arguments +declare function f1(): void; +declare function f1(): void; +f1(); +f1(); + +// Overloaded functions with no default type arguments +declare function f2(): void; +declare function f2(): void; +f2(); +f2(); + +// Overloaded non-generic functions +declare function f3(): void; +declare function f3(a): void; +f3(); + +// Generic function with default type parameters +declare function f4(): void; +f4(); +f4(); + +// Generic function with no default type arguments +declare function f5(): void; +f5(); +f5(); + + +//// [functionTypeArgumentArityErrors.js] +f1(); +f1(); +f2(); +f2(); +f3(); +f4(); +f4(); +f5(); +f5(); diff --git a/tests/baselines/reference/functionTypeArgumentArityErrors.symbols b/tests/baselines/reference/functionTypeArgumentArityErrors.symbols new file mode 100644 index 00000000000..48c702f968b --- /dev/null +++ b/tests/baselines/reference/functionTypeArgumentArityErrors.symbols @@ -0,0 +1,72 @@ +=== tests/cases/compiler/functionTypeArgumentArityErrors.ts === +// Overloaded functions with default type arguments +declare function f1(): void; +>f1 : Symbol(f1, Decl(functionTypeArgumentArityErrors.ts, 0, 0), Decl(functionTypeArgumentArityErrors.ts, 1, 37)) +>A : Symbol(A, Decl(functionTypeArgumentArityErrors.ts, 1, 20)) + +declare function f1(): void; +>f1 : Symbol(f1, Decl(functionTypeArgumentArityErrors.ts, 0, 0), Decl(functionTypeArgumentArityErrors.ts, 1, 37)) +>A : Symbol(A, Decl(functionTypeArgumentArityErrors.ts, 2, 20)) +>B : Symbol(B, Decl(functionTypeArgumentArityErrors.ts, 2, 22)) +>C : Symbol(C, Decl(functionTypeArgumentArityErrors.ts, 2, 25)) +>D : Symbol(D, Decl(functionTypeArgumentArityErrors.ts, 2, 28)) + +f1(); +>f1 : Symbol(f1, Decl(functionTypeArgumentArityErrors.ts, 0, 0), Decl(functionTypeArgumentArityErrors.ts, 1, 37)) + +f1(); +>f1 : Symbol(f1, Decl(functionTypeArgumentArityErrors.ts, 0, 0), Decl(functionTypeArgumentArityErrors.ts, 1, 37)) + +// Overloaded functions with no default type arguments +declare function f2(): void; +>f2 : Symbol(f2, Decl(functionTypeArgumentArityErrors.ts, 4, 45), Decl(functionTypeArgumentArityErrors.ts, 7, 31)) +>A : Symbol(A, Decl(functionTypeArgumentArityErrors.ts, 7, 20)) + +declare function f2(): void; +>f2 : Symbol(f2, Decl(functionTypeArgumentArityErrors.ts, 4, 45), Decl(functionTypeArgumentArityErrors.ts, 7, 31)) +>A : Symbol(A, Decl(functionTypeArgumentArityErrors.ts, 8, 20)) +>B : Symbol(B, Decl(functionTypeArgumentArityErrors.ts, 8, 22)) +>C : Symbol(C, Decl(functionTypeArgumentArityErrors.ts, 8, 25)) + +f2(); +>f2 : Symbol(f2, Decl(functionTypeArgumentArityErrors.ts, 4, 45), Decl(functionTypeArgumentArityErrors.ts, 7, 31)) + +f2(); +>f2 : Symbol(f2, Decl(functionTypeArgumentArityErrors.ts, 4, 45), Decl(functionTypeArgumentArityErrors.ts, 7, 31)) + +// Overloaded non-generic functions +declare function f3(): void; +>f3 : Symbol(f3, Decl(functionTypeArgumentArityErrors.ts, 10, 37), Decl(functionTypeArgumentArityErrors.ts, 13, 28)) + +declare function f3(a): void; +>f3 : Symbol(f3, Decl(functionTypeArgumentArityErrors.ts, 10, 37), Decl(functionTypeArgumentArityErrors.ts, 13, 28)) +>a : Symbol(a, Decl(functionTypeArgumentArityErrors.ts, 14, 20)) + +f3(); +>f3 : Symbol(f3, Decl(functionTypeArgumentArityErrors.ts, 10, 37), Decl(functionTypeArgumentArityErrors.ts, 13, 28)) + +// Generic function with default type parameters +declare function f4(): void; +>f4 : Symbol(f4, Decl(functionTypeArgumentArityErrors.ts, 15, 13)) +>A : Symbol(A, Decl(functionTypeArgumentArityErrors.ts, 18, 20)) +>B : Symbol(B, Decl(functionTypeArgumentArityErrors.ts, 18, 22)) +>C : Symbol(C, Decl(functionTypeArgumentArityErrors.ts, 18, 25)) + +f4(); +>f4 : Symbol(f4, Decl(functionTypeArgumentArityErrors.ts, 15, 13)) + +f4(); +>f4 : Symbol(f4, Decl(functionTypeArgumentArityErrors.ts, 15, 13)) + +// Generic function with no default type arguments +declare function f5(): void; +>f5 : Symbol(f5, Decl(functionTypeArgumentArityErrors.ts, 20, 37)) +>A : Symbol(A, Decl(functionTypeArgumentArityErrors.ts, 23, 20)) +>B : Symbol(B, Decl(functionTypeArgumentArityErrors.ts, 23, 22)) + +f5(); +>f5 : Symbol(f5, Decl(functionTypeArgumentArityErrors.ts, 20, 37)) + +f5(); +>f5 : Symbol(f5, Decl(functionTypeArgumentArityErrors.ts, 20, 37)) + diff --git a/tests/baselines/reference/functionTypeArgumentArityErrors.types b/tests/baselines/reference/functionTypeArgumentArityErrors.types new file mode 100644 index 00000000000..c91cf39674f --- /dev/null +++ b/tests/baselines/reference/functionTypeArgumentArityErrors.types @@ -0,0 +1,67 @@ +=== tests/cases/compiler/functionTypeArgumentArityErrors.ts === +// Overloaded functions with default type arguments +declare function f1(): void; +>f1 : { (): void; (): void; } + +declare function f1(): void; +>f1 : { (): void; (): void; } + +f1(); +>f1() : any +>f1 : { (): void; (): void; } + +f1(); +>f1() : any +>f1 : { (): void; (): void; } + +// Overloaded functions with no default type arguments +declare function f2(): void; +>f2 : { (): void; (): void; } + +declare function f2(): void; +>f2 : { (): void; (): void; } + +f2(); +>f2() : any +>f2 : { (): void; (): void; } + +f2(); +>f2() : any +>f2 : { (): void; (): void; } + +// Overloaded non-generic functions +declare function f3(): void; +>f3 : { (): void; (a: any): void; } + +declare function f3(a): void; +>f3 : { (): void; (a: any): void; } +>a : any + +f3(); +>f3() : any +>f3 : { (): void; (a: any): void; } + +// Generic function with default type parameters +declare function f4(): void; +>f4 : () => void + +f4(); +>f4() : any +>f4 : () => void + +f4(); +>f4() : any +>f4 : () => void + +// Generic function with no default type arguments +declare function f5(): void; +>f5 : () => void + +f5(); +>f5() : any +>f5 : () => void + +f5(); +>f5() : any +>f5 : () => void + diff --git a/tests/baselines/reference/genericRestParameters3.errors.txt b/tests/baselines/reference/genericRestParameters3.errors.txt index f9af3c54555..cd9f677c549 100644 --- a/tests/baselines/reference/genericRestParameters3.errors.txt +++ b/tests/baselines/reference/genericRestParameters3.errors.txt @@ -22,8 +22,8 @@ tests/cases/conformance/types/rest/genericRestParameters3.ts(31,21): error TS234 Property '0' is missing in type 'CoolArray' but required in type '[(...args: any[]) => void]'. tests/cases/conformance/types/rest/genericRestParameters3.ts(38,32): error TS2345: Argument of type '[10, 20]' is not assignable to parameter of type 'CoolArray'. Property 'hello' is missing in type '[10, 20]' but required in type 'CoolArray'. -tests/cases/conformance/types/rest/genericRestParameters3.ts(43,1): error TS2345: Argument of type '[]' is not assignable to parameter of type 'CoolArray'. - Property 'hello' is missing in type '[]' but required in type 'CoolArray'. +tests/cases/conformance/types/rest/genericRestParameters3.ts(43,1): error TS2345: Argument of type '[]' is not assignable to parameter of type 'CoolArray<{}>'. + Property 'hello' is missing in type '[]' but required in type 'CoolArray<{}>'. tests/cases/conformance/types/rest/genericRestParameters3.ts(44,5): error TS2345: Argument of type '[number]' is not assignable to parameter of type 'CoolArray<{}>'. Property 'hello' is missing in type '[number]' but required in type 'CoolArray<{}>'. tests/cases/conformance/types/rest/genericRestParameters3.ts(45,5): error TS2345: Argument of type '[number, number]' is not assignable to parameter of type 'CoolArray<{}>'. @@ -115,8 +115,8 @@ tests/cases/conformance/types/rest/genericRestParameters3.ts(53,5): error TS2345 baz(); // Error ~~~~~ -!!! error TS2345: Argument of type '[]' is not assignable to parameter of type 'CoolArray'. -!!! error TS2345: Property 'hello' is missing in type '[]' but required in type 'CoolArray'. +!!! error TS2345: Argument of type '[]' is not assignable to parameter of type 'CoolArray<{}>'. +!!! error TS2345: Property 'hello' is missing in type '[]' but required in type 'CoolArray<{}>'. !!! related TS2728 tests/cases/conformance/types/rest/genericRestParameters3.ts:24:5: 'hello' is declared here. baz(1); // Error ~ diff --git a/tests/baselines/reference/identifierStartAfterNumericLiteral.errors.txt b/tests/baselines/reference/identifierStartAfterNumericLiteral.errors.txt new file mode 100644 index 00000000000..2b4884f7303 --- /dev/null +++ b/tests/baselines/reference/identifierStartAfterNumericLiteral.errors.txt @@ -0,0 +1,135 @@ +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(1,16): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(3,2): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(3,2): error TS2304: Cannot find name 'a'. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(4,4): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(4,4): error TS2304: Cannot find name 'a'. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(5,3): error TS1124: Digit expected. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(5,4): error TS2538: Type 'null' cannot be used as an index type. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(6,5): error TS1124: Digit expected. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(6,6): error TS2538: Type 'null' cannot be used as an index type. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(7,2): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(8,4): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(9,3): error TS1124: Digit expected. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(9,3): error TS2304: Cannot find name 'n'. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(10,5): error TS1124: Digit expected. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(10,5): error TS2304: Cannot find name 'n'. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(11,2): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(11,2): error TS2304: Cannot find name 'a'. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(12,4): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(12,4): error TS2304: Cannot find name 'a'. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(13,4): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(13,4): error TS2304: Cannot find name 'abc'. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(14,3): error TS1124: Digit expected. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(15,5): error TS1124: Digit expected. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(18,3): error TS1124: Digit expected. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(18,3): error TS2304: Cannot find name 'e'. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(19,5): error TS1124: Digit expected. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(19,5): error TS2304: Cannot find name 'e'. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(22,3): error TS1005: ';' expected. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(23,5): error TS1005: ';' expected. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(24,3): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(24,3): error TS2304: Cannot find name 'a'. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(25,5): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(25,5): error TS2304: Cannot find name 'a'. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(26,5): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. +tests/cases/compiler/identifierStartAfterNumericLiteral.ts(26,5): error TS2304: Cannot find name 'abc'. + + +==== tests/cases/compiler/identifierStartAfterNumericLiteral.ts (35 errors) ==== + let valueIn = 3in[null]; + ~~ +!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. + + 3a[null] + ~ +!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. + ~ +!!! error TS2304: Cannot find name 'a'. + 123a[null] + ~ +!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. + ~ +!!! error TS2304: Cannot find name 'a'. + 3e[null] + +!!! error TS1124: Digit expected. + ~~~~ +!!! error TS2538: Type 'null' cannot be used as an index type. + 123e[null] + +!!! error TS1124: Digit expected. + ~~~~ +!!! error TS2538: Type 'null' cannot be used as an index type. + 3in[null] + ~~ +!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. + 123in[null] + ~~ +!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. + 3en[null] + +!!! error TS1124: Digit expected. + ~ +!!! error TS2304: Cannot find name 'n'. + 123en[null] + +!!! error TS1124: Digit expected. + ~ +!!! error TS2304: Cannot find name 'n'. + 1a + ~ +!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. + ~ +!!! error TS2304: Cannot find name 'a'. + 123a + ~ +!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. + ~ +!!! error TS2304: Cannot find name 'a'. + 123abc + ~~~ +!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. + ~~~ +!!! error TS2304: Cannot find name 'abc'. + 1e + +!!! error TS1124: Digit expected. + 123e + +!!! error TS1124: Digit expected. + 1e9 + 123e9 + 1ee + +!!! error TS1124: Digit expected. + ~ +!!! error TS2304: Cannot find name 'e'. + 123ee + +!!! error TS1124: Digit expected. + ~ +!!! error TS2304: Cannot find name 'e'. + 1n + 123n + 2n2 + ~ +!!! error TS1005: ';' expected. + 123n2 + ~ +!!! error TS1005: ';' expected. + 2na + ~ +!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. + ~ +!!! error TS2304: Cannot find name 'a'. + 123na + ~ +!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. + ~ +!!! error TS2304: Cannot find name 'a'. + 123nabc + ~~~ +!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. + ~~~ +!!! error TS2304: Cannot find name 'abc'. + \ No newline at end of file diff --git a/tests/baselines/reference/identifierStartAfterNumericLiteral.js b/tests/baselines/reference/identifierStartAfterNumericLiteral.js new file mode 100644 index 00000000000..59ece3e1c7e --- /dev/null +++ b/tests/baselines/reference/identifierStartAfterNumericLiteral.js @@ -0,0 +1,69 @@ +//// [identifierStartAfterNumericLiteral.ts] +let valueIn = 3in[null]; + +3a[null] +123a[null] +3e[null] +123e[null] +3in[null] +123in[null] +3en[null] +123en[null] +1a +123a +123abc +1e +123e +1e9 +123e9 +1ee +123ee +1n +123n +2n2 +123n2 +2na +123na +123nabc + + +//// [identifierStartAfterNumericLiteral.js] +var valueIn = 3 in [null]; +3; +a[null]; +123; +a[null]; +3e[null]; +123e[null]; +3 in [null]; +123 in [null]; +3e; +n[null]; +123e; +n[null]; +1; +a; +123; +a; +123; +abc; +1e; +123e; +1e9; +123e9; +1e; +e; +123e; +e; +1n; +123n; +2n; +2; +123n; +2; +2n; +a; +123n; +a; +123n; +abc; diff --git a/tests/baselines/reference/identifierStartAfterNumericLiteral.symbols b/tests/baselines/reference/identifierStartAfterNumericLiteral.symbols new file mode 100644 index 00000000000..8237191eee4 --- /dev/null +++ b/tests/baselines/reference/identifierStartAfterNumericLiteral.symbols @@ -0,0 +1,29 @@ +=== tests/cases/compiler/identifierStartAfterNumericLiteral.ts === +let valueIn = 3in[null]; +>valueIn : Symbol(valueIn, Decl(identifierStartAfterNumericLiteral.ts, 0, 3)) + +3a[null] +123a[null] +3e[null] +123e[null] +3in[null] +123in[null] +3en[null] +123en[null] +1a +123a +123abc +1e +123e +1e9 +123e9 +1ee +123ee +1n +123n +2n2 +123n2 +2na +123na +123nabc + diff --git a/tests/baselines/reference/identifierStartAfterNumericLiteral.types b/tests/baselines/reference/identifierStartAfterNumericLiteral.types new file mode 100644 index 00000000000..af3399a6d13 --- /dev/null +++ b/tests/baselines/reference/identifierStartAfterNumericLiteral.types @@ -0,0 +1,112 @@ +=== tests/cases/compiler/identifierStartAfterNumericLiteral.ts === +let valueIn = 3in[null]; +>valueIn : boolean +>3in[null] : boolean +>3 : 3 +>[null] : null[] +>null : null + +3a[null] +>3 : 3 +>a[null] : any +>a : any +>null : null + +123a[null] +>123 : 123 +>a[null] : any +>a : any +>null : null + +3e[null] +>3e[null] : any +>3e : 3 +>null : null + +123e[null] +>123e[null] : any +>123e : 123 +>null : null + +3in[null] +>3in[null] : boolean +>3 : 3 +>[null] : null[] +>null : null + +123in[null] +>123in[null] : boolean +>123 : 123 +>[null] : null[] +>null : null + +3en[null] +>3e : 3 +>n[null] : any +>n : any +>null : null + +123en[null] +>123e : 123 +>n[null] : any +>n : any +>null : null + +1a +>1 : 1 +>a : any + +123a +>123 : 123 +>a : any + +123abc +>123 : 123 +>abc : any + +1e +>1e : 1 + +123e +>123e : 123 + +1e9 +>1e9 : 1000000000 + +123e9 +>123e9 : 123000000000 + +1ee +>1e : 1 +>e : any + +123ee +>123e : 123 +>e : any + +1n +>1n : 1n + +123n +>123n : 123n + +2n2 +>2n : 2n +>2 : 2 + +123n2 +>123n : 123n +>2 : 2 + +2na +>2n : 2n +>a : any + +123na +>123n : 123n +>a : any + +123nabc +>123n : 123n +>abc : any + diff --git a/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.errors.txt b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.errors.txt index f2c77d62984..db1b2840132 100644 --- a/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.errors.txt +++ b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.errors.txt @@ -41,7 +41,7 @@ tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.t Math.sign(1); ~~~~ !!! error TS2551: Property 'sign' does not exist on type 'Math'. Did you mean 'sin'? -!!! related TS2728 /.ts/lib.es5.d.ts:703:5: 'sin' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:713:5: 'sin' is declared here. // Using ES6 object var o = { diff --git a/tests/baselines/reference/narrowExceptionVariableInCatchClause.errors.txt b/tests/baselines/reference/narrowExceptionVariableInCatchClause.errors.txt index 12b2790c3de..c5a85483631 100644 --- a/tests/baselines/reference/narrowExceptionVariableInCatchClause.errors.txt +++ b/tests/baselines/reference/narrowExceptionVariableInCatchClause.errors.txt @@ -24,7 +24,7 @@ tests/cases/conformance/types/any/narrowExceptionVariableInCatchClause.ts(16,17) err.massage; // ERROR: Property 'massage' does not exist on type 'Error' ~~~~~~~ !!! error TS2551: Property 'massage' does not exist on type 'Error'. Did you mean 'message'? -!!! related TS2728 /.ts/lib.es5.d.ts:964:5: 'message' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:5: 'message' is declared here. } else { diff --git a/tests/baselines/reference/narrowFromAnyWithInstanceof.errors.txt b/tests/baselines/reference/narrowFromAnyWithInstanceof.errors.txt index f5c0c5728f1..6e7ae406bcf 100644 --- a/tests/baselines/reference/narrowFromAnyWithInstanceof.errors.txt +++ b/tests/baselines/reference/narrowFromAnyWithInstanceof.errors.txt @@ -22,7 +22,7 @@ tests/cases/conformance/types/any/narrowFromAnyWithInstanceof.ts(22,7): error TS x.mesage; ~~~~~~ !!! error TS2551: Property 'mesage' does not exist on type 'Error'. Did you mean 'message'? -!!! related TS2728 /.ts/lib.es5.d.ts:964:5: 'message' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:5: 'message' is declared here. } if (x instanceof Date) { @@ -30,6 +30,6 @@ tests/cases/conformance/types/any/narrowFromAnyWithInstanceof.ts(22,7): error TS x.getHuors(); ~~~~~~~~ !!! error TS2551: Property 'getHuors' does not exist on type 'Date'. Did you mean 'getHours'? -!!! related TS2728 /.ts/lib.es5.d.ts:753:5: 'getHours' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:763:5: 'getHours' is declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/narrowFromAnyWithTypePredicate.errors.txt b/tests/baselines/reference/narrowFromAnyWithTypePredicate.errors.txt index 385357f2204..0cf20b5c86b 100644 --- a/tests/baselines/reference/narrowFromAnyWithTypePredicate.errors.txt +++ b/tests/baselines/reference/narrowFromAnyWithTypePredicate.errors.txt @@ -39,7 +39,7 @@ tests/cases/conformance/types/any/narrowFromAnyWithTypePredicate.ts(33,7): error x.mesage; ~~~~~~ !!! error TS2551: Property 'mesage' does not exist on type 'Error'. Did you mean 'message'? -!!! related TS2728 /.ts/lib.es5.d.ts:964:5: 'message' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:5: 'message' is declared here. } if (isDate(x)) { @@ -47,6 +47,6 @@ tests/cases/conformance/types/any/narrowFromAnyWithTypePredicate.ts(33,7): error x.getHuors(); ~~~~~~~~ !!! error TS2551: Property 'getHuors' does not exist on type 'Date'. Did you mean 'getHours'? -!!! related TS2728 /.ts/lib.es5.d.ts:753:5: 'getHours' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:763:5: 'getHours' is declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/newMap.errors.txt b/tests/baselines/reference/newMap.errors.txt index 46668890b07..d8a4f1c5222 100644 --- a/tests/baselines/reference/newMap.errors.txt +++ b/tests/baselines/reference/newMap.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/newMap.ts(1,9): error TS2558: Expected 0-2 type arguments, but got 1. +tests/cases/compiler/newMap.ts(1,9): error TS2743: No overload expects 1 type arguments, but overloads do exist that expect either 0 or 2 type arguments. ==== tests/cases/compiler/newMap.ts (1 errors) ==== new Map(); ~~~~~~ -!!! error TS2558: Expected 0-2 type arguments, but got 1. +!!! error TS2743: No overload expects 1 type arguments, but overloads do exist that expect either 0 or 2 type arguments. \ No newline at end of file diff --git a/tests/baselines/reference/numericLiteralsWithTrailingDecimalPoints01.errors.txt b/tests/baselines/reference/numericLiteralsWithTrailingDecimalPoints01.errors.txt index d89255a9568..c9ed7b5c8af 100644 --- a/tests/baselines/reference/numericLiteralsWithTrailingDecimalPoints01.errors.txt +++ b/tests/baselines/reference/numericLiteralsWithTrailingDecimalPoints01.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/numericLiteralsWithTrailingDecimalPoints01.ts(3,3): error TS1005: ';' expected. -tests/cases/compiler/numericLiteralsWithTrailingDecimalPoints01.ts(9,15): error TS1005: ',' expected. +tests/cases/compiler/numericLiteralsWithTrailingDecimalPoints01.ts(3,3): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. +tests/cases/compiler/numericLiteralsWithTrailingDecimalPoints01.ts(9,15): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. tests/cases/compiler/numericLiteralsWithTrailingDecimalPoints01.ts(9,23): error TS1005: ',' expected. tests/cases/compiler/numericLiteralsWithTrailingDecimalPoints01.ts(9,24): error TS1109: Expression expected. @@ -9,7 +9,7 @@ tests/cases/compiler/numericLiteralsWithTrailingDecimalPoints01.ts(9,24): error 1.0.toString(); 1.toString(); ~~~~~~~~ -!!! error TS1005: ';' expected. +!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. 1.+2.0 + 3. ; // Preserve whitespace and comments where important for JS compatibility @@ -17,7 +17,7 @@ tests/cases/compiler/numericLiteralsWithTrailingDecimalPoints01.ts(9,24): error var test1 = i.toString(); var test2 = 2.toString(); ~~~~~~~~ -!!! error TS1005: ',' expected. +!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. ~ !!! error TS1005: ',' expected. ~ diff --git a/tests/baselines/reference/overloadResolution.errors.txt b/tests/baselines/reference/overloadResolution.errors.txt index 6710f697b3c..27d0392ca8d 100644 --- a/tests/baselines/reference/overloadResolution.errors.txt +++ b/tests/baselines/reference/overloadResolution.errors.txt @@ -1,6 +1,6 @@ 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 '""' is not assignable to parameter of type 'number'. -tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(63,5): error TS2558: Expected 1-3 type arguments, but got 4. +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(63,5): error TS2558: Expected 3 type arguments, but got 4. tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(70,21): error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(71,21): error TS2345: Argument of type '""' 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'. @@ -79,7 +79,7 @@ tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(91,22): // Generic overloads with differing arity called with type argument count that doesn't match any overload fn3(); // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2558: Expected 1-3 type arguments, but got 4. +!!! error TS2558: Expected 3 type arguments, but got 4. // Generic overloads with constraints called with type arguments that satisfy the constraints function fn4(n: T, m: U); diff --git a/tests/baselines/reference/overloadResolutionConstructors.errors.txt b/tests/baselines/reference/overloadResolutionConstructors.errors.txt index fe1c955651b..2e09a84d138 100644 --- a/tests/baselines/reference/overloadResolutionConstructors.errors.txt +++ b/tests/baselines/reference/overloadResolutionConstructors.errors.txt @@ -1,6 +1,6 @@ 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 '""' is not assignable to parameter of type 'number'. -tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(67,9): error TS2558: Expected 1-3 type arguments, but got 4. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(67,9): error TS2558: Expected 3 type arguments, but got 4. tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(77,25): error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(78,25): error TS2345: Argument of type '""' 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'. @@ -83,7 +83,7 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors // Generic overloads with differing arity called with type argument count that doesn't match any overload new fn3(); // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2558: Expected 1-3 type arguments, but got 4. +!!! error TS2558: Expected 3 type arguments, but got 4. // Generic overloads with constraints called with type arguments that satisfy the constraints interface fn4 { diff --git a/tests/baselines/reference/overloadsAndTypeArgumentArityErrors.errors.txt b/tests/baselines/reference/overloadsAndTypeArgumentArityErrors.errors.txt index 1993a6d7f2c..6b64cd8a773 100644 --- a/tests/baselines/reference/overloadsAndTypeArgumentArityErrors.errors.txt +++ b/tests/baselines/reference/overloadsAndTypeArgumentArityErrors.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts(5,11): error TS2558: Expected 0-2 type arguments, but got 3. -tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts(6,15): error TS2558: Expected 0-2 type arguments, but got 3. +tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts(5,11): error TS2558: Expected 2 type arguments, but got 3. +tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts(6,15): error TS2558: Expected 2 type arguments, but got 3. tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts(9,1): error TS2554: Expected 1 arguments, but got 0. @@ -10,10 +10,10 @@ tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts(9,1): error TS2554: Callbacks('s'); // wrong number of type arguments ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2558: Expected 0-2 type arguments, but got 3. +!!! error TS2558: Expected 2 type arguments, but got 3. new Callbacks('s'); // wrong number of type arguments ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2558: Expected 0-2 type arguments, but got 3. +!!! error TS2558: Expected 2 type arguments, but got 3. declare function f(arg: number): void; f(); // wrong number of arguments (#25683) diff --git a/tests/baselines/reference/parseBigInt.errors.txt b/tests/baselines/reference/parseBigInt.errors.txt index 9c273542c0b..16878e75fe9 100644 --- a/tests/baselines/reference/parseBigInt.errors.txt +++ b/tests/baselines/reference/parseBigInt.errors.txt @@ -1,9 +1,9 @@ tests/cases/compiler/parseBigInt.ts(51,20): error TS2736: Operator '+' cannot be applied to type '123n'. tests/cases/compiler/parseBigInt.ts(52,23): error TS2736: Operator '+' cannot be applied to type '291n'. tests/cases/compiler/parseBigInt.ts(56,25): error TS1005: ',' expected. -tests/cases/compiler/parseBigInt.ts(57,25): error TS1005: ',' expected. -tests/cases/compiler/parseBigInt.ts(58,22): error TS1005: ',' expected. -tests/cases/compiler/parseBigInt.ts(59,28): error TS1005: ',' expected. +tests/cases/compiler/parseBigInt.ts(57,25): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. +tests/cases/compiler/parseBigInt.ts(58,22): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. +tests/cases/compiler/parseBigInt.ts(59,28): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. tests/cases/compiler/parseBigInt.ts(60,23): error TS1177: Binary digit expected. tests/cases/compiler/parseBigInt.ts(61,20): error TS1178: Octal digit expected. tests/cases/compiler/parseBigInt.ts(62,20): error TS1125: Hexadecimal digit expected. @@ -82,13 +82,13 @@ tests/cases/compiler/parseBigInt.ts(70,72): error TS2345: Argument of type '3' i !!! error TS1005: ',' expected. { const scientific = 1e2n; } ~ -!!! error TS1005: ',' expected. +!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. { const decimal = 4.1n; } ~ -!!! error TS1005: ',' expected. +!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. { const leadingDecimal = .1n; } ~ -!!! error TS1005: ',' expected. +!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. const emptyBinary = 0bn; // should error but infer 0n !!! error TS1177: Binary digit expected. diff --git a/tests/baselines/reference/parser.numericSeparators.binaryNegative.errors.txt b/tests/baselines/reference/parser.numericSeparators.binaryNegative.errors.txt index 15e08088b1e..93118bc9c7f 100644 --- a/tests/baselines/reference/parser.numericSeparators.binaryNegative.errors.txt +++ b/tests/baselines/reference/parser.numericSeparators.binaryNegative.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts(1,5): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,2): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS2304: Cannot find name 'B0101'. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,6): error TS6189: Multiple consecutive numeric separators are not permitted. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,13): error TS6189: Multiple consecutive numeric separators are not permitted. @@ -25,7 +25,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,5): error ~ !!! error TS6188: Numeric separators are not allowed here. ~~~~~ -!!! error TS1005: ';' expected. +!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. ~~~~~ !!! error TS2304: Cannot find name 'B0101'. diff --git a/tests/baselines/reference/parser.numericSeparators.hexNegative.errors.txt b/tests/baselines/reference/parser.numericSeparators.hexNegative.errors.txt index 2fe62bc06d3..c6048a1bbfb 100644 --- a/tests/baselines/reference/parser.numericSeparators.hexNegative.errors.txt +++ b/tests/baselines/reference/parser.numericSeparators.hexNegative.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts(1,5): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,2): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS2304: Cannot find name 'X0101'. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,6): error TS6189: Multiple consecutive numeric separators are not permitted. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,13): error TS6189: Multiple consecutive numeric separators are not permitted. @@ -25,7 +25,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,5): error ~ !!! error TS6188: Numeric separators are not allowed here. ~~~~~ -!!! error TS1005: ';' expected. +!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. ~~~~~ !!! error TS2304: Cannot find name 'X0101'. diff --git a/tests/baselines/reference/parser.numericSeparators.octalNegative.errors.txt b/tests/baselines/reference/parser.numericSeparators.octalNegative.errors.txt index e4c05472106..ebdec3371aa 100644 --- a/tests/baselines/reference/parser.numericSeparators.octalNegative.errors.txt +++ b/tests/baselines/reference/parser.numericSeparators.octalNegative.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/1.ts(1,5): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/2.ts(1,3): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,2): error TS6188: Numeric separators are not allowed here. -tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/3.ts(1,3): error TS2304: Cannot find name 'O0101'. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/4.ts(1,6): error TS6189: Multiple consecutive numeric separators are not permitted. tests/cases/conformance/parser/ecmascriptnext/numericSeparators/5.ts(1,13): error TS6189: Multiple consecutive numeric separators are not permitted. @@ -25,7 +25,7 @@ tests/cases/conformance/parser/ecmascriptnext/numericSeparators/6.ts(1,5): error ~ !!! error TS6188: Numeric separators are not allowed here. ~~~~~ -!!! error TS1005: ';' expected. +!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. ~~~~~ !!! error TS2304: Cannot find name 'O0101'. diff --git a/tests/baselines/reference/parserMemberAccessAfterPostfixExpression1.errors.txt b/tests/baselines/reference/parserMemberAccessAfterPostfixExpression1.errors.txt index bd7db9c44fe..ab9d0a34a55 100644 --- a/tests/baselines/reference/parserMemberAccessAfterPostfixExpression1.errors.txt +++ b/tests/baselines/reference/parserMemberAccessAfterPostfixExpression1.errors.txt @@ -11,4 +11,4 @@ tests/cases/conformance/parser/ecmascript5/Expressions/parserMemberAccessAfterPo !!! error TS1005: ';' expected. ~~~~~~~~ !!! error TS2552: Cannot find name 'toString'. Did you mean 'String'? -!!! related TS2728 /.ts/lib.es5.d.ts:517:15: 'String' is declared here. \ No newline at end of file +!!! related TS2728 /.ts/lib.es5.d.ts:527:15: 'String' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/parserS7.2_A1.5_T2.errors.txt b/tests/baselines/reference/parserS7.2_A1.5_T2.errors.txt index 136d4477268..5d1059f6eff 100644 --- a/tests/baselines/reference/parserS7.2_A1.5_T2.errors.txt +++ b/tests/baselines/reference/parserS7.2_A1.5_T2.errors.txt @@ -19,7 +19,7 @@ tests/cases/conformance/parser/ecmascript5/parserS7.2_A1.5_T2.ts(20,3): error TS $ERROR('#1: eval("\\u00A0var x\\u00A0= 1\\u00A0"); x === 1. Actual: ' + (x)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } //CHECK#2 @@ -28,7 +28,7 @@ tests/cases/conformance/parser/ecmascript5/parserS7.2_A1.5_T2.ts(20,3): error TS $ERROR('#2:  var x = 1 ; x === 1. Actual: ' + (x)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } diff --git a/tests/baselines/reference/parserS7.3_A1.1_T2.errors.txt b/tests/baselines/reference/parserS7.3_A1.1_T2.errors.txt index 3a35d5f0a83..1f8845e808a 100644 --- a/tests/baselines/reference/parserS7.3_A1.1_T2.errors.txt +++ b/tests/baselines/reference/parserS7.3_A1.1_T2.errors.txt @@ -21,7 +21,7 @@ tests/cases/conformance/parser/ecmascript5/parserS7.3_A1.1_T2.ts(17,3): error TS $ERROR('#1: var\\nx\\n=\\n1\\n; x === 1. Actual: ' + (x)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/parserS7.6_A4.2_T1.errors.txt b/tests/baselines/reference/parserS7.6_A4.2_T1.errors.txt index 35fc8935b73..4242d1faeca 100644 --- a/tests/baselines/reference/parserS7.6_A4.2_T1.errors.txt +++ b/tests/baselines/reference/parserS7.6_A4.2_T1.errors.txt @@ -50,70 +50,70 @@ tests/cases/conformance/parser/ecmascript5/parserS7.6_A4.2_T1.ts(142,3): error T $ERROR('#А'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0411 = 1; if (Б !== 1) { $ERROR('#Б'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0412 = 1; if (В !== 1) { $ERROR('#В'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0413 = 1; if (Г !== 1) { $ERROR('#Г'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0414 = 1; if (Д !== 1) { $ERROR('#Д'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0415 = 1; if (Е !== 1) { $ERROR('#Е'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0416 = 1; if (Ж !== 1) { $ERROR('#Ж'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0417 = 1; if (З !== 1) { $ERROR('#З'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0418 = 1; if (И !== 1) { $ERROR('#И'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0419 = 1; if (Й !== 1) { $ERROR('#Й'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u041A = 1; if (К !== 1) { diff --git a/tests/baselines/reference/parserUnicode1.errors.txt b/tests/baselines/reference/parserUnicode1.errors.txt index 2e16f696620..aa9cf504714 100644 --- a/tests/baselines/reference/parserUnicode1.errors.txt +++ b/tests/baselines/reference/parserUnicode1.errors.txt @@ -11,13 +11,13 @@ tests/cases/conformance/parser/ecmascript5/parserUnicode1.ts(10,5): error TS2552 $ERROR('#6.1: var \\u0078x = 1; xx === 6. Actual: ' + (xx)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } } catch (e) { $ERROR('#6.2: var \\u0078x = 1; xx === 6. Actual: ' + (xx)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/promisePermutations.errors.txt b/tests/baselines/reference/promisePermutations.errors.txt index 7d1112dab17..c719d8a9b95 100644 --- a/tests/baselines/reference/promisePermutations.errors.txt +++ b/tests/baselines/reference/promisePermutations.errors.txt @@ -295,7 +295,7 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t ~~~~~~~~~ !!! error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. !!! error TS2345: Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. -!!! related TS2728 /.ts/lib.es5.d.ts:1403:5: 'catch' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1413:5: 'catch' is declared here. 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 10abb661feb..b88ef28ca5c 100644 --- a/tests/baselines/reference/promisePermutations2.errors.txt +++ b/tests/baselines/reference/promisePermutations2.errors.txt @@ -294,7 +294,7 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of ~~~~~~~~~ !!! error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. !!! error TS2345: Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. -!!! related TS2728 /.ts/lib.es5.d.ts:1403:5: 'catch' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1413:5: 'catch' is declared here. 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 733eae63c5f..7f12ee8609a 100644 --- a/tests/baselines/reference/promisePermutations3.errors.txt +++ b/tests/baselines/reference/promisePermutations3.errors.txt @@ -303,7 +303,7 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of ~~~~~~~~~ !!! error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. !!! error TS2345: Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. -!!! related TS2728 /.ts/lib.es5.d.ts:1403:5: 'catch' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1413:5: 'catch' is declared here. var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok var r11: IPromise; @@ -340,5 +340,5 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of ~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '{ (x: T): IPromise; (x: T, y: T): Promise; }' is not assignable to parameter of type '(value: (x: any) => any) => Promise<{}>'. !!! error TS2345: Property 'catch' is missing in type 'IPromise' but required in type 'Promise<{}>'. -!!! related TS2728 /.ts/lib.es5.d.ts:1403:5: 'catch' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1413:5: 'catch' is declared here. var s12c = s12.then(testFunction12P, testFunction12, testFunction12); // ok \ No newline at end of file diff --git a/tests/baselines/reference/promiseTypeInference.errors.txt b/tests/baselines/reference/promiseTypeInference.errors.txt index 5edf8f5b091..1996f37e540 100644 --- a/tests/baselines/reference/promiseTypeInference.errors.txt +++ b/tests/baselines/reference/promiseTypeInference.errors.txt @@ -26,5 +26,5 @@ tests/cases/compiler/promiseTypeInference.ts(10,39): error TS2322: Type 'IPromis !!! error TS2322: Types of parameters 'success' and 'onfulfilled' are incompatible. !!! error TS2322: Type 'TResult1 | PromiseLike' is not assignable to type 'IPromise'. !!! error TS2322: Type 'TResult1' is not assignable to type 'IPromise'. -!!! related TS6502 /.ts/lib.es5.d.ts:1396:57: The expected type comes from the return type of this signature. +!!! related TS6502 /.ts/lib.es5.d.ts:1406:57: The expected type comes from the return type of this signature. \ No newline at end of file diff --git a/tests/baselines/reference/scannerS7.2_A1.5_T2.errors.txt b/tests/baselines/reference/scannerS7.2_A1.5_T2.errors.txt index f61392a51ec..473590f63e5 100644 --- a/tests/baselines/reference/scannerS7.2_A1.5_T2.errors.txt +++ b/tests/baselines/reference/scannerS7.2_A1.5_T2.errors.txt @@ -19,7 +19,7 @@ tests/cases/conformance/scanner/ecmascript5/scannerS7.2_A1.5_T2.ts(20,3): error $ERROR('#1: eval("\\u00A0var x\\u00A0= 1\\u00A0"); x === 1. Actual: ' + (x)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } //CHECK#2 @@ -28,7 +28,7 @@ tests/cases/conformance/scanner/ecmascript5/scannerS7.2_A1.5_T2.ts(20,3): error $ERROR('#2:  var x = 1 ; x === 1. Actual: ' + (x)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } diff --git a/tests/baselines/reference/scannerS7.3_A1.1_T2.errors.txt b/tests/baselines/reference/scannerS7.3_A1.1_T2.errors.txt index f7ab44d83d5..fa25b5cc170 100644 --- a/tests/baselines/reference/scannerS7.3_A1.1_T2.errors.txt +++ b/tests/baselines/reference/scannerS7.3_A1.1_T2.errors.txt @@ -21,7 +21,7 @@ tests/cases/conformance/scanner/ecmascript5/scannerS7.3_A1.1_T2.ts(17,3): error $ERROR('#1: var\\nx\\n=\\n1\\n; x === 1. Actual: ' + (x)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/scannerS7.6_A4.2_T1.errors.txt b/tests/baselines/reference/scannerS7.6_A4.2_T1.errors.txt index ab3bddb5bc6..6dc7a99446b 100644 --- a/tests/baselines/reference/scannerS7.6_A4.2_T1.errors.txt +++ b/tests/baselines/reference/scannerS7.6_A4.2_T1.errors.txt @@ -50,70 +50,70 @@ tests/cases/conformance/scanner/ecmascript5/scannerS7.6_A4.2_T1.ts(142,3): error $ERROR('#А'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0411 = 1; if (Б !== 1) { $ERROR('#Б'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0412 = 1; if (В !== 1) { $ERROR('#В'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0413 = 1; if (Г !== 1) { $ERROR('#Г'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0414 = 1; if (Д !== 1) { $ERROR('#Д'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0415 = 1; if (Е !== 1) { $ERROR('#Е'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0416 = 1; if (Ж !== 1) { $ERROR('#Ж'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0417 = 1; if (З !== 1) { $ERROR('#З'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0418 = 1; if (И !== 1) { $ERROR('#И'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0419 = 1; if (Й !== 1) { $ERROR('#Й'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u041A = 1; if (К !== 1) { diff --git a/tests/baselines/reference/strictBindCallApply1.errors.txt b/tests/baselines/reference/strictBindCallApply1.errors.txt index e8f48e5597c..0931a837bac 100644 --- a/tests/baselines/reference/strictBindCallApply1.errors.txt +++ b/tests/baselines/reference/strictBindCallApply1.errors.txt @@ -1,35 +1,40 @@ -tests/cases/conformance/functions/strictBindCallApply1.ts(6,35): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. -tests/cases/conformance/functions/strictBindCallApply1.ts(9,11): error TS2554: Expected 3 arguments, but got 2. -tests/cases/conformance/functions/strictBindCallApply1.ts(10,35): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. -tests/cases/conformance/functions/strictBindCallApply1.ts(11,11): error TS2554: Expected 3 arguments, but got 4. -tests/cases/conformance/functions/strictBindCallApply1.ts(14,32): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. +tests/cases/conformance/functions/strictBindCallApply1.ts(11,35): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(17,11): error TS2554: Expected 3 arguments, but got 2. +tests/cases/conformance/functions/strictBindCallApply1.ts(18,35): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(19,11): error TS2554: Expected 3 arguments, but got 4. +tests/cases/conformance/functions/strictBindCallApply1.ts(22,32): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. Property '1' is missing in type '[number]' but required in type '[number, string]'. -tests/cases/conformance/functions/strictBindCallApply1.ts(15,37): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/conformance/functions/strictBindCallApply1.ts(16,32): error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. +tests/cases/conformance/functions/strictBindCallApply1.ts(23,37): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(24,32): error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. Types of property 'length' are incompatible. Type '3' is not assignable to type '2'. -tests/cases/conformance/functions/strictBindCallApply1.ts(29,29): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. -tests/cases/conformance/functions/strictBindCallApply1.ts(30,22): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. -tests/cases/conformance/functions/strictBindCallApply1.ts(33,11): error TS2554: Expected 3 arguments, but got 2. -tests/cases/conformance/functions/strictBindCallApply1.ts(34,29): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. -tests/cases/conformance/functions/strictBindCallApply1.ts(35,11): error TS2554: Expected 3 arguments, but got 4. -tests/cases/conformance/functions/strictBindCallApply1.ts(36,22): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. -tests/cases/conformance/functions/strictBindCallApply1.ts(39,26): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. -tests/cases/conformance/functions/strictBindCallApply1.ts(40,31): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/conformance/functions/strictBindCallApply1.ts(41,26): error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. -tests/cases/conformance/functions/strictBindCallApply1.ts(42,23): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. -tests/cases/conformance/functions/strictBindCallApply1.ts(47,33): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. -tests/cases/conformance/functions/strictBindCallApply1.ts(50,1): error TS2554: Expected 3 arguments, but got 2. -tests/cases/conformance/functions/strictBindCallApply1.ts(51,15): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. -tests/cases/conformance/functions/strictBindCallApply1.ts(52,1): error TS2554: Expected 3 arguments, but got 4. -tests/cases/conformance/functions/strictBindCallApply1.ts(55,12): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. -tests/cases/conformance/functions/strictBindCallApply1.ts(56,17): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/conformance/functions/strictBindCallApply1.ts(57,12): error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. +tests/cases/conformance/functions/strictBindCallApply1.ts(41,29): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(42,22): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. +tests/cases/conformance/functions/strictBindCallApply1.ts(48,11): error TS2554: Expected 3 arguments, but got 2. +tests/cases/conformance/functions/strictBindCallApply1.ts(49,29): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(50,11): error TS2554: Expected 3 arguments, but got 4. +tests/cases/conformance/functions/strictBindCallApply1.ts(51,22): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. +tests/cases/conformance/functions/strictBindCallApply1.ts(54,26): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. +tests/cases/conformance/functions/strictBindCallApply1.ts(55,31): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(56,26): error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. +tests/cases/conformance/functions/strictBindCallApply1.ts(57,23): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. +tests/cases/conformance/functions/strictBindCallApply1.ts(62,33): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(65,1): error TS2554: Expected 3 arguments, but got 2. +tests/cases/conformance/functions/strictBindCallApply1.ts(66,15): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(67,1): error TS2554: Expected 3 arguments, but got 4. +tests/cases/conformance/functions/strictBindCallApply1.ts(70,12): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. +tests/cases/conformance/functions/strictBindCallApply1.ts(71,17): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. ==== tests/cases/conformance/functions/strictBindCallApply1.ts (24 errors) ==== declare function foo(a: number, b: string): string; + declare function overloaded(s: string): number; + declare function overloaded(n: number): string; + + declare function generic(x: T): T; + let f00 = foo.bind(undefined); let f01 = foo.bind(undefined, 10); let f02 = foo.bind(undefined, 10, "hello"); @@ -37,6 +42,9 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(57,12): error TS2345: ~~ !!! error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. + let f04 = overloaded.bind(undefined); // typeof overloaded + let f05 = generic.bind(undefined); // typeof generic + let c00 = foo.call(undefined, 10, "hello"); let c01 = foo.call(undefined, 10); // Error ~~~~~~~~~~~~~~~~~~~~~~~ @@ -65,6 +73,10 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(57,12): error TS2345: class C { constructor(a: number, b: string) {} foo(this: this, a: number, b: string): string { return "" } + overloaded(s: string): number; + overloaded(n: number): string; + overloaded(x: any): any { return undefined } + generic(x: T): T { return x } } declare let c: C; @@ -80,6 +92,9 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(57,12): error TS2345: ~~~~~~~~~ !!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. + let f15 = c.overloaded.bind(c); // typeof C.prototype.overloaded + let f16 = c.generic.bind(c); // typeof C.prototype.generic + let c10 = c.foo.call(c, 10, "hello"); let c11 = c.foo.call(c, 10); // Error ~~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/strictBindCallApply1.js b/tests/baselines/reference/strictBindCallApply1.js index e43c84edbf1..fc90729a8d6 100644 --- a/tests/baselines/reference/strictBindCallApply1.js +++ b/tests/baselines/reference/strictBindCallApply1.js @@ -1,11 +1,19 @@ //// [strictBindCallApply1.ts] declare function foo(a: number, b: string): string; +declare function overloaded(s: string): number; +declare function overloaded(n: number): string; + +declare function generic(x: T): T; + let f00 = foo.bind(undefined); let f01 = foo.bind(undefined, 10); let f02 = foo.bind(undefined, 10, "hello"); let f03 = foo.bind(undefined, 10, 20); // Error +let f04 = overloaded.bind(undefined); // typeof overloaded +let f05 = generic.bind(undefined); // typeof generic + let c00 = foo.call(undefined, 10, "hello"); let c01 = foo.call(undefined, 10); // Error let c02 = foo.call(undefined, 10, 20); // Error @@ -19,6 +27,10 @@ let a03 = foo.apply(undefined, [10, "hello", 30]); // Error class C { constructor(a: number, b: string) {} foo(this: this, a: number, b: string): string { return "" } + overloaded(s: string): number; + overloaded(n: number): string; + overloaded(x: any): any { return undefined } + generic(x: T): T { return x } } declare let c: C; @@ -30,6 +42,9 @@ let f12 = c.foo.bind(c, 10, "hello"); let f13 = c.foo.bind(c, 10, 20); // Error let f14 = c.foo.bind(undefined); // Error +let f15 = c.overloaded.bind(c); // typeof C.prototype.overloaded +let f16 = c.generic.bind(c); // typeof C.prototype.generic + let c10 = c.foo.call(c, 10, "hello"); let c11 = c.foo.call(c, 10); // Error let c12 = c.foo.call(c, 10, 20); // Error @@ -64,6 +79,8 @@ var f00 = foo.bind(undefined); var f01 = foo.bind(undefined, 10); var f02 = foo.bind(undefined, 10, "hello"); var f03 = foo.bind(undefined, 10, 20); // Error +var f04 = overloaded.bind(undefined); // typeof overloaded +var f05 = generic.bind(undefined); // typeof generic var c00 = foo.call(undefined, 10, "hello"); var c01 = foo.call(undefined, 10); // Error var c02 = foo.call(undefined, 10, 20); // Error @@ -76,6 +93,8 @@ var C = /** @class */ (function () { function C(a, b) { } C.prototype.foo = function (a, b) { return ""; }; + C.prototype.overloaded = function (x) { return undefined; }; + C.prototype.generic = function (x) { return x; }; return C; }()); var f10 = c.foo.bind(c); @@ -83,6 +102,8 @@ var f11 = c.foo.bind(c, 10); var f12 = c.foo.bind(c, 10, "hello"); var f13 = c.foo.bind(c, 10, 20); // Error var f14 = c.foo.bind(undefined); // Error +var f15 = c.overloaded.bind(c); // typeof C.prototype.overloaded +var f16 = c.generic.bind(c); // typeof C.prototype.generic var c10 = c.foo.call(c, 10, "hello"); var c11 = c.foo.call(c, 10); // Error var c12 = c.foo.call(c, 10, 20); // Error diff --git a/tests/baselines/reference/strictBindCallApply1.symbols b/tests/baselines/reference/strictBindCallApply1.symbols index b8133a65a78..705df6da699 100644 --- a/tests/baselines/reference/strictBindCallApply1.symbols +++ b/tests/baselines/reference/strictBindCallApply1.symbols @@ -4,319 +4,387 @@ declare function foo(a: number, b: string): string; >a : Symbol(a, Decl(strictBindCallApply1.ts, 0, 21)) >b : Symbol(b, Decl(strictBindCallApply1.ts, 0, 31)) +declare function overloaded(s: string): number; +>overloaded : Symbol(overloaded, Decl(strictBindCallApply1.ts, 0, 51), Decl(strictBindCallApply1.ts, 2, 47)) +>s : Symbol(s, Decl(strictBindCallApply1.ts, 2, 28)) + +declare function overloaded(n: number): string; +>overloaded : Symbol(overloaded, Decl(strictBindCallApply1.ts, 0, 51), Decl(strictBindCallApply1.ts, 2, 47)) +>n : Symbol(n, Decl(strictBindCallApply1.ts, 3, 28)) + +declare function generic(x: T): T; +>generic : Symbol(generic, Decl(strictBindCallApply1.ts, 3, 47)) +>T : Symbol(T, Decl(strictBindCallApply1.ts, 5, 25)) +>x : Symbol(x, Decl(strictBindCallApply1.ts, 5, 28)) +>T : Symbol(T, Decl(strictBindCallApply1.ts, 5, 25)) +>T : Symbol(T, Decl(strictBindCallApply1.ts, 5, 25)) + let f00 = foo.bind(undefined); ->f00 : Symbol(f00, Decl(strictBindCallApply1.ts, 2, 3)) +>f00 : Symbol(f00, Decl(strictBindCallApply1.ts, 7, 3)) >foo.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) >foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) >bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) >undefined : Symbol(undefined) let f01 = foo.bind(undefined, 10); ->f01 : Symbol(f01, Decl(strictBindCallApply1.ts, 3, 3)) +>f01 : Symbol(f01, Decl(strictBindCallApply1.ts, 8, 3)) >foo.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) >foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) >bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) >undefined : Symbol(undefined) let f02 = foo.bind(undefined, 10, "hello"); ->f02 : Symbol(f02, Decl(strictBindCallApply1.ts, 4, 3)) +>f02 : Symbol(f02, Decl(strictBindCallApply1.ts, 9, 3)) >foo.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) >foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) >bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) >undefined : Symbol(undefined) let f03 = foo.bind(undefined, 10, 20); // Error ->f03 : Symbol(f03, Decl(strictBindCallApply1.ts, 5, 3)) +>f03 : Symbol(f03, Decl(strictBindCallApply1.ts, 10, 3)) >foo.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) >foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) >bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) >undefined : Symbol(undefined) +let f04 = overloaded.bind(undefined); // typeof overloaded +>f04 : Symbol(f04, Decl(strictBindCallApply1.ts, 12, 3)) +>overloaded.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>overloaded : Symbol(overloaded, Decl(strictBindCallApply1.ts, 0, 51), Decl(strictBindCallApply1.ts, 2, 47)) +>bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>undefined : Symbol(undefined) + +let f05 = generic.bind(undefined); // typeof generic +>f05 : Symbol(f05, Decl(strictBindCallApply1.ts, 13, 3)) +>generic.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>generic : Symbol(generic, Decl(strictBindCallApply1.ts, 3, 47)) +>bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>undefined : Symbol(undefined) + let c00 = foo.call(undefined, 10, "hello"); ->c00 : Symbol(c00, Decl(strictBindCallApply1.ts, 7, 3)) +>c00 : Symbol(c00, Decl(strictBindCallApply1.ts, 15, 3)) >foo.call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) >foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) >call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) >undefined : Symbol(undefined) let c01 = foo.call(undefined, 10); // Error ->c01 : Symbol(c01, Decl(strictBindCallApply1.ts, 8, 3)) +>c01 : Symbol(c01, Decl(strictBindCallApply1.ts, 16, 3)) >foo.call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) >foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) >call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) >undefined : Symbol(undefined) let c02 = foo.call(undefined, 10, 20); // Error ->c02 : Symbol(c02, Decl(strictBindCallApply1.ts, 9, 3)) +>c02 : Symbol(c02, Decl(strictBindCallApply1.ts, 17, 3)) >foo.call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) >foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) >call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) >undefined : Symbol(undefined) let c03 = foo.call(undefined, 10, "hello", 30); // Error ->c03 : Symbol(c03, Decl(strictBindCallApply1.ts, 10, 3)) +>c03 : Symbol(c03, Decl(strictBindCallApply1.ts, 18, 3)) >foo.call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) >foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) >call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) >undefined : Symbol(undefined) let a00 = foo.apply(undefined, [10, "hello"]); ->a00 : Symbol(a00, Decl(strictBindCallApply1.ts, 12, 3)) +>a00 : Symbol(a00, Decl(strictBindCallApply1.ts, 20, 3)) >foo.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) >apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >undefined : Symbol(undefined) let a01 = foo.apply(undefined, [10]); // Error ->a01 : Symbol(a01, Decl(strictBindCallApply1.ts, 13, 3)) +>a01 : Symbol(a01, Decl(strictBindCallApply1.ts, 21, 3)) >foo.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) >apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >undefined : Symbol(undefined) let a02 = foo.apply(undefined, [10, 20]); // Error ->a02 : Symbol(a02, Decl(strictBindCallApply1.ts, 14, 3)) +>a02 : Symbol(a02, Decl(strictBindCallApply1.ts, 22, 3)) >foo.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) >apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >undefined : Symbol(undefined) let a03 = foo.apply(undefined, [10, "hello", 30]); // Error ->a03 : Symbol(a03, Decl(strictBindCallApply1.ts, 15, 3)) +>a03 : Symbol(a03, Decl(strictBindCallApply1.ts, 23, 3)) >foo.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) >apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >undefined : Symbol(undefined) class C { ->C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 50)) constructor(a: number, b: string) {} ->a : Symbol(a, Decl(strictBindCallApply1.ts, 18, 16)) ->b : Symbol(b, Decl(strictBindCallApply1.ts, 18, 26)) +>a : Symbol(a, Decl(strictBindCallApply1.ts, 26, 16)) +>b : Symbol(b, Decl(strictBindCallApply1.ts, 26, 26)) foo(this: this, a: number, b: string): string { return "" } ->foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) ->this : Symbol(this, Decl(strictBindCallApply1.ts, 19, 8)) ->a : Symbol(a, Decl(strictBindCallApply1.ts, 19, 19)) ->b : Symbol(b, Decl(strictBindCallApply1.ts, 19, 30)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>this : Symbol(this, Decl(strictBindCallApply1.ts, 27, 8)) +>a : Symbol(a, Decl(strictBindCallApply1.ts, 27, 19)) +>b : Symbol(b, Decl(strictBindCallApply1.ts, 27, 30)) + + overloaded(s: string): number; +>overloaded : Symbol(C.overloaded, Decl(strictBindCallApply1.ts, 27, 63), Decl(strictBindCallApply1.ts, 28, 34), Decl(strictBindCallApply1.ts, 29, 34)) +>s : Symbol(s, Decl(strictBindCallApply1.ts, 28, 15)) + + overloaded(n: number): string; +>overloaded : Symbol(C.overloaded, Decl(strictBindCallApply1.ts, 27, 63), Decl(strictBindCallApply1.ts, 28, 34), Decl(strictBindCallApply1.ts, 29, 34)) +>n : Symbol(n, Decl(strictBindCallApply1.ts, 29, 15)) + + overloaded(x: any): any { return undefined } +>overloaded : Symbol(C.overloaded, Decl(strictBindCallApply1.ts, 27, 63), Decl(strictBindCallApply1.ts, 28, 34), Decl(strictBindCallApply1.ts, 29, 34)) +>x : Symbol(x, Decl(strictBindCallApply1.ts, 30, 15)) +>undefined : Symbol(undefined) + + generic(x: T): T { return x } +>generic : Symbol(C.generic, Decl(strictBindCallApply1.ts, 30, 53)) +>T : Symbol(T, Decl(strictBindCallApply1.ts, 31, 12)) +>x : Symbol(x, Decl(strictBindCallApply1.ts, 31, 15)) +>T : Symbol(T, Decl(strictBindCallApply1.ts, 31, 12)) +>T : Symbol(T, Decl(strictBindCallApply1.ts, 31, 12)) +>x : Symbol(x, Decl(strictBindCallApply1.ts, 31, 15)) } declare let c: C; ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) ->C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 50)) declare let obj: {}; ->obj : Symbol(obj, Decl(strictBindCallApply1.ts, 23, 11)) +>obj : Symbol(obj, Decl(strictBindCallApply1.ts, 35, 11)) let f10 = c.foo.bind(c); ->f10 : Symbol(f10, Decl(strictBindCallApply1.ts, 25, 3)) +>f10 : Symbol(f10, Decl(strictBindCallApply1.ts, 37, 3)) >c.foo.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) ->c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) ->foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) >bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) let f11 = c.foo.bind(c, 10); ->f11 : Symbol(f11, Decl(strictBindCallApply1.ts, 26, 3)) +>f11 : Symbol(f11, Decl(strictBindCallApply1.ts, 38, 3)) >c.foo.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) ->c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) ->foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) >bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) let f12 = c.foo.bind(c, 10, "hello"); ->f12 : Symbol(f12, Decl(strictBindCallApply1.ts, 27, 3)) +>f12 : Symbol(f12, Decl(strictBindCallApply1.ts, 39, 3)) >c.foo.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) ->c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) ->foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) >bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) let f13 = c.foo.bind(c, 10, 20); // Error ->f13 : Symbol(f13, Decl(strictBindCallApply1.ts, 28, 3)) +>f13 : Symbol(f13, Decl(strictBindCallApply1.ts, 40, 3)) >c.foo.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) ->c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) ->foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) >bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) let f14 = c.foo.bind(undefined); // Error ->f14 : Symbol(f14, Decl(strictBindCallApply1.ts, 29, 3)) +>f14 : Symbol(f14, Decl(strictBindCallApply1.ts, 41, 3)) >c.foo.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) ->c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) ->foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) >bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) >undefined : Symbol(undefined) +let f15 = c.overloaded.bind(c); // typeof C.prototype.overloaded +>f15 : Symbol(f15, Decl(strictBindCallApply1.ts, 43, 3)) +>c.overloaded.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>c.overloaded : Symbol(C.overloaded, Decl(strictBindCallApply1.ts, 27, 63), Decl(strictBindCallApply1.ts, 28, 34), Decl(strictBindCallApply1.ts, 29, 34)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>overloaded : Symbol(C.overloaded, Decl(strictBindCallApply1.ts, 27, 63), Decl(strictBindCallApply1.ts, 28, 34), Decl(strictBindCallApply1.ts, 29, 34)) +>bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) + +let f16 = c.generic.bind(c); // typeof C.prototype.generic +>f16 : Symbol(f16, Decl(strictBindCallApply1.ts, 44, 3)) +>c.generic.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>c.generic : Symbol(C.generic, Decl(strictBindCallApply1.ts, 30, 53)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>generic : Symbol(C.generic, Decl(strictBindCallApply1.ts, 30, 53)) +>bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) + let c10 = c.foo.call(c, 10, "hello"); ->c10 : Symbol(c10, Decl(strictBindCallApply1.ts, 31, 3)) +>c10 : Symbol(c10, Decl(strictBindCallApply1.ts, 46, 3)) >c.foo.call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) ->c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) ->foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) >call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) let c11 = c.foo.call(c, 10); // Error ->c11 : Symbol(c11, Decl(strictBindCallApply1.ts, 32, 3)) +>c11 : Symbol(c11, Decl(strictBindCallApply1.ts, 47, 3)) >c.foo.call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) ->c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) ->foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) >call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) let c12 = c.foo.call(c, 10, 20); // Error ->c12 : Symbol(c12, Decl(strictBindCallApply1.ts, 33, 3)) +>c12 : Symbol(c12, Decl(strictBindCallApply1.ts, 48, 3)) >c.foo.call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) ->c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) ->foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) >call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) let c13 = c.foo.call(c, 10, "hello", 30); // Error ->c13 : Symbol(c13, Decl(strictBindCallApply1.ts, 34, 3)) +>c13 : Symbol(c13, Decl(strictBindCallApply1.ts, 49, 3)) >c.foo.call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) ->c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) ->foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) >call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) let c14 = c.foo.call(undefined, 10, "hello"); // Error ->c14 : Symbol(c14, Decl(strictBindCallApply1.ts, 35, 3)) +>c14 : Symbol(c14, Decl(strictBindCallApply1.ts, 50, 3)) >c.foo.call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) ->c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) ->foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) >call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) >undefined : Symbol(undefined) let a10 = c.foo.apply(c, [10, "hello"]); ->a10 : Symbol(a10, Decl(strictBindCallApply1.ts, 37, 3)) +>a10 : Symbol(a10, Decl(strictBindCallApply1.ts, 52, 3)) >c.foo.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) ->foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) >apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) let a11 = c.foo.apply(c, [10]); // Error ->a11 : Symbol(a11, Decl(strictBindCallApply1.ts, 38, 3)) +>a11 : Symbol(a11, Decl(strictBindCallApply1.ts, 53, 3)) >c.foo.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) ->foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) >apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) let a12 = c.foo.apply(c, [10, 20]); // Error ->a12 : Symbol(a12, Decl(strictBindCallApply1.ts, 39, 3)) +>a12 : Symbol(a12, Decl(strictBindCallApply1.ts, 54, 3)) >c.foo.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) ->foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) >apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) let a13 = c.foo.apply(c, [10, "hello", 30]); // Error ->a13 : Symbol(a13, Decl(strictBindCallApply1.ts, 40, 3)) +>a13 : Symbol(a13, Decl(strictBindCallApply1.ts, 55, 3)) >c.foo.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) ->foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) >apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) let a14 = c.foo.apply(undefined, [10, "hello"]); // Error ->a14 : Symbol(a14, Decl(strictBindCallApply1.ts, 41, 3)) +>a14 : Symbol(a14, Decl(strictBindCallApply1.ts, 56, 3)) >c.foo.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) ->foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) >apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >undefined : Symbol(undefined) let f20 = C.bind(undefined); ->f20 : Symbol(f20, Decl(strictBindCallApply1.ts, 43, 3)) +>f20 : Symbol(f20, Decl(strictBindCallApply1.ts, 58, 3)) >C.bind : Symbol(NewableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) ->C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 50)) >bind : Symbol(NewableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) >undefined : Symbol(undefined) let f21 = C.bind(undefined, 10); ->f21 : Symbol(f21, Decl(strictBindCallApply1.ts, 44, 3)) +>f21 : Symbol(f21, Decl(strictBindCallApply1.ts, 59, 3)) >C.bind : Symbol(NewableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) ->C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 50)) >bind : Symbol(NewableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) >undefined : Symbol(undefined) let f22 = C.bind(undefined, 10, "hello"); ->f22 : Symbol(f22, Decl(strictBindCallApply1.ts, 45, 3)) +>f22 : Symbol(f22, Decl(strictBindCallApply1.ts, 60, 3)) >C.bind : Symbol(NewableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) ->C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 50)) >bind : Symbol(NewableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) >undefined : Symbol(undefined) let f23 = C.bind(undefined, 10, 20); // Error ->f23 : Symbol(f23, Decl(strictBindCallApply1.ts, 46, 3)) +>f23 : Symbol(f23, Decl(strictBindCallApply1.ts, 61, 3)) >C.bind : Symbol(NewableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) ->C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 50)) >bind : Symbol(NewableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) >undefined : Symbol(undefined) C.call(c, 10, "hello"); >C.call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) ->C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 50)) >call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) C.call(c, 10); // Error >C.call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) ->C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 50)) >call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) C.call(c, 10, 20); // Error >C.call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) ->C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 50)) >call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) C.call(c, 10, "hello", 30); // Error >C.call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) ->C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 50)) >call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) C.apply(c, [10, "hello"]); >C.apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 50)) >apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) C.apply(c, [10]); // Error >C.apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 50)) >apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) C.apply(c, [10, 20]); // Error >C.apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 50)) >apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) C.apply(c, [10, "hello", 30]); // Error >C.apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 50)) >apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) diff --git a/tests/baselines/reference/strictBindCallApply1.types b/tests/baselines/reference/strictBindCallApply1.types index a895447e182..7237c1d3142 100644 --- a/tests/baselines/reference/strictBindCallApply1.types +++ b/tests/baselines/reference/strictBindCallApply1.types @@ -4,29 +4,41 @@ declare function foo(a: number, b: string): string; >a : number >b : string +declare function overloaded(s: string): number; +>overloaded : { (s: string): number; (n: number): string; } +>s : string + +declare function overloaded(n: number): string; +>overloaded : { (s: string): number; (n: number): string; } +>n : number + +declare function generic(x: T): T; +>generic : (x: T) => T +>x : T + let f00 = foo.bind(undefined); >f00 : (a: number, b: string) => string >foo.bind(undefined) : (a: number, b: string) => string ->foo.bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } >foo : (a: number, b: string) => string ->bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } >undefined : undefined let f01 = foo.bind(undefined, 10); >f01 : (b: string) => string >foo.bind(undefined, 10) : (b: string) => string ->foo.bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } >foo : (a: number, b: string) => string ->bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } >undefined : undefined >10 : 10 let f02 = foo.bind(undefined, 10, "hello"); >f02 : () => string >foo.bind(undefined, 10, "hello") : () => string ->foo.bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } >foo : (a: number, b: string) => string ->bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } >undefined : undefined >10 : 10 >"hello" : "hello" @@ -34,13 +46,29 @@ let f02 = foo.bind(undefined, 10, "hello"); let f03 = foo.bind(undefined, 10, 20); // Error >f03 : any >foo.bind(undefined, 10, 20) : any ->foo.bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } >foo : (a: number, b: string) => string ->bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } >undefined : undefined >10 : 10 >20 : 20 +let f04 = overloaded.bind(undefined); // typeof overloaded +>f04 : { (s: string): number; (n: number): string; } +>overloaded.bind(undefined) : { (s: string): number; (n: number): string; } +>overloaded.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>overloaded : { (s: string): number; (n: number): string; } +>bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>undefined : undefined + +let f05 = generic.bind(undefined); // typeof generic +>f05 : (x: T) => T +>generic.bind(undefined) : (x: T) => T +>generic.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>generic : (x: T) => T +>bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>undefined : undefined + let c00 = foo.call(undefined, 10, "hello"); >c00 : string >foo.call(undefined, 10, "hello") : string @@ -138,6 +166,25 @@ class C { >a : number >b : string >"" : "" + + overloaded(s: string): number; +>overloaded : { (s: string): number; (n: number): string; } +>s : string + + overloaded(n: number): string; +>overloaded : { (s: string): number; (n: number): string; } +>n : number + + overloaded(x: any): any { return undefined } +>overloaded : { (s: string): number; (n: number): string; } +>x : any +>undefined : any +>undefined : undefined + + generic(x: T): T { return x } +>generic : (x: T) => T +>x : T +>x : T } declare let c: C; @@ -149,32 +196,32 @@ declare let obj: {}; let f10 = c.foo.bind(c); >f10 : (a: number, b: string) => string >c.foo.bind(c) : (a: number, b: string) => string ->c.foo.bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>c.foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } >c.foo : (this: C, a: number, b: string) => string >c : C >foo : (this: C, a: number, b: string) => string ->bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } >c : C let f11 = c.foo.bind(c, 10); >f11 : (b: string) => string >c.foo.bind(c, 10) : (b: string) => string ->c.foo.bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>c.foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } >c.foo : (this: C, a: number, b: string) => string >c : C >foo : (this: C, a: number, b: string) => string ->bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } >c : C >10 : 10 let f12 = c.foo.bind(c, 10, "hello"); >f12 : () => string >c.foo.bind(c, 10, "hello") : () => string ->c.foo.bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>c.foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } >c.foo : (this: C, a: number, b: string) => string >c : C >foo : (this: C, a: number, b: string) => string ->bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } >c : C >10 : 10 >"hello" : "hello" @@ -182,11 +229,11 @@ let f12 = c.foo.bind(c, 10, "hello"); let f13 = c.foo.bind(c, 10, 20); // Error >f13 : any >c.foo.bind(c, 10, 20) : any ->c.foo.bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>c.foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } >c.foo : (this: C, a: number, b: string) => string >c : C >foo : (this: C, a: number, b: string) => string ->bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } >c : C >10 : 10 >20 : 20 @@ -194,13 +241,33 @@ let f13 = c.foo.bind(c, 10, 20); // Error let f14 = c.foo.bind(undefined); // Error >f14 : any >c.foo.bind(undefined) : any ->c.foo.bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>c.foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } >c.foo : (this: C, a: number, b: string) => string >c : C >foo : (this: C, a: number, b: string) => string ->bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } >undefined : undefined +let f15 = c.overloaded.bind(c); // typeof C.prototype.overloaded +>f15 : { (s: string): number; (n: number): string; } +>c.overloaded.bind(c) : { (s: string): number; (n: number): string; } +>c.overloaded.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>c.overloaded : { (s: string): number; (n: number): string; } +>c : C +>overloaded : { (s: string): number; (n: number): string; } +>bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>c : C + +let f16 = c.generic.bind(c); // typeof C.prototype.generic +>f16 : (x: T) => T +>c.generic.bind(c) : (x: T) => T +>c.generic.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>c.generic : (x: T) => T +>c : C +>generic : (x: T) => T +>bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>c : C + let c10 = c.foo.call(c, 10, "hello"); >c10 : string >c.foo.call(c, 10, "hello") : string @@ -327,28 +394,28 @@ let a14 = c.foo.apply(undefined, [10, "hello"]); // Error >"hello" : "hello" let f20 = C.bind(undefined); ->f20 : new (a: number, b: string) => C ->C.bind(undefined) : new (a: number, b: string) => C ->C.bind : { (this: new (...args: A) => R, thisArg: any): new (...args: A) => R; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } +>f20 : typeof C +>C.bind(undefined) : typeof C +>C.bind : { (this: T, thisArg: any): T; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } >C : typeof C ->bind : { (this: new (...args: A) => R, thisArg: any): new (...args: A) => R; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } +>bind : { (this: T, thisArg: any): T; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } >undefined : undefined let f21 = C.bind(undefined, 10); >f21 : new (b: string) => C >C.bind(undefined, 10) : new (b: string) => C ->C.bind : { (this: new (...args: A) => R, thisArg: any): new (...args: A) => R; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } +>C.bind : { (this: T, thisArg: any): T; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } >C : typeof C ->bind : { (this: new (...args: A) => R, thisArg: any): new (...args: A) => R; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } +>bind : { (this: T, thisArg: any): T; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } >undefined : undefined >10 : 10 let f22 = C.bind(undefined, 10, "hello"); >f22 : new () => C >C.bind(undefined, 10, "hello") : new () => C ->C.bind : { (this: new (...args: A) => R, thisArg: any): new (...args: A) => R; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } +>C.bind : { (this: T, thisArg: any): T; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } >C : typeof C ->bind : { (this: new (...args: A) => R, thisArg: any): new (...args: A) => R; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } +>bind : { (this: T, thisArg: any): T; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } >undefined : undefined >10 : 10 >"hello" : "hello" @@ -356,9 +423,9 @@ let f22 = C.bind(undefined, 10, "hello"); let f23 = C.bind(undefined, 10, 20); // Error >f23 : any >C.bind(undefined, 10, 20) : any ->C.bind : { (this: new (...args: A) => R, thisArg: any): new (...args: A) => R; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } +>C.bind : { (this: T, thisArg: any): T; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } >C : typeof C ->bind : { (this: new (...args: A) => R, thisArg: any): new (...args: A) => R; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } +>bind : { (this: T, thisArg: any): T; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } >undefined : undefined >10 : 10 >20 : 20 diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt index b70344e0a06..f4bcdb5a1ac 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt @@ -22,7 +22,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio ~~ !!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. !!! error TS2345: Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. -!!! related TS2728 /.ts/lib.es5.d.ts:595:14: 'raw' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:605:14: 'raw' is declared here. var b = foo([], 1); // string ~~ !!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1_ES6.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1_ES6.errors.txt index 7cdc02c457d..a6f6708074c 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1_ES6.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1_ES6.errors.txt @@ -22,7 +22,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio ~~ !!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. !!! error TS2345: Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. -!!! related TS2728 /.ts/lib.es5.d.ts:595:14: 'raw' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:605:14: 'raw' is declared here. var b = foo([], 1); // string ~~ !!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. diff --git a/tests/baselines/reference/tsxAttributeInvalidNames.errors.txt b/tests/baselines/reference/tsxAttributeInvalidNames.errors.txt index e83b588ef76..d0b521d0454 100644 --- a/tests/baselines/reference/tsxAttributeInvalidNames.errors.txt +++ b/tests/baselines/reference/tsxAttributeInvalidNames.errors.txt @@ -1,5 +1,6 @@ tests/cases/conformance/jsx/file.tsx(10,8): error TS1003: Identifier expected. tests/cases/conformance/jsx/file.tsx(10,10): error TS1005: ';' expected. +tests/cases/conformance/jsx/file.tsx(10,10): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. tests/cases/conformance/jsx/file.tsx(10,10): error TS2304: Cannot find name 'data'. tests/cases/conformance/jsx/file.tsx(10,15): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type. tests/cases/conformance/jsx/file.tsx(10,18): error TS1005: ':' expected. @@ -12,7 +13,7 @@ tests/cases/conformance/jsx/file.tsx(11,13): error TS1005: ';' expected. tests/cases/conformance/jsx/file.tsx(11,20): error TS1161: Unterminated regular expression literal. -==== tests/cases/conformance/jsx/file.tsx (12 errors) ==== +==== tests/cases/conformance/jsx/file.tsx (13 errors) ==== declare module JSX { interface Element { } interface IntrinsicElements { @@ -28,6 +29,8 @@ tests/cases/conformance/jsx/file.tsx(11,20): error TS1161: Unterminated regular ~~~~ !!! error TS1005: ';' expected. ~~~~ +!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. + ~~~~ !!! error TS2304: Cannot find name 'data'. ~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type. diff --git a/tests/baselines/reference/unknownType1.errors.txt b/tests/baselines/reference/unknownType1.errors.txt index 83849184dce..57fb6114069 100644 --- a/tests/baselines/reference/unknownType1.errors.txt +++ b/tests/baselines/reference/unknownType1.errors.txt @@ -17,13 +17,18 @@ tests/cases/conformance/types/unknown/unknownType1.ts(113,9): error TS2322: Type tests/cases/conformance/types/unknown/unknownType1.ts(114,9): error TS2322: Type 'unknown' is not assignable to type '{} | null | undefined'. Type 'unknown' is not assignable to type '{}'. tests/cases/conformance/types/unknown/unknownType1.ts(120,9): error TS2322: Type 'T' is not assignable to type 'object'. + Type 'unknown' is not assignable to type 'object'. tests/cases/conformance/types/unknown/unknownType1.ts(129,5): error TS2322: Type '123' is not assignable to type '{ [x: string]: unknown; }'. tests/cases/conformance/types/unknown/unknownType1.ts(149,17): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. tests/cases/conformance/types/unknown/unknownType1.ts(155,14): error TS2700: Rest types may only be created from object types. tests/cases/conformance/types/unknown/unknownType1.ts(161,5): error TS2564: Property 'a' has no initializer and is not definitely assigned in the constructor. +tests/cases/conformance/types/unknown/unknownType1.ts(170,9): error TS2322: Type 'U' is not assignable to type '{}'. + Type 'unknown' is not assignable to type '{}'. +tests/cases/conformance/types/unknown/unknownType1.ts(180,5): error TS2322: Type 'T' is not assignable to type '{}'. + Type 'unknown' is not assignable to type '{}'. -==== tests/cases/conformance/types/unknown/unknownType1.ts (22 errors) ==== +==== tests/cases/conformance/types/unknown/unknownType1.ts (24 errors) ==== // In an intersection everything absorbs unknown type T00 = unknown & null; // null @@ -181,6 +186,7 @@ tests/cases/conformance/types/unknown/unknownType1.ts(161,5): error TS2564: Prop let y: object = x; // Error ~ !!! error TS2322: Type 'T' is not assignable to type 'object'. +!!! error TS2322: Type 'unknown' is not assignable to type 'object'. } // Anything but primitive assignable to { [x: string]: unknown } @@ -233,4 +239,27 @@ tests/cases/conformance/types/unknown/unknownType1.ts(161,5): error TS2564: Prop b: unknown; c: any; } + + // Type parameter with explicit 'unknown' constraint not assignable to '{}' + + function f30(t: T, u: U) { + let x: {} = t; + let y: {} = u; + ~ +!!! error TS2322: Type 'U' is not assignable to type '{}'. +!!! error TS2322: Type 'unknown' is not assignable to type '{}'. + } + + // Repro from #26796 + + type Test1 = [unknown] extends [{}] ? true : false; // false + type IsDefinitelyDefined = [T] extends [{}] ? true : false; + type Test2 = IsDefinitelyDefined; // false + + function oops(arg: T): {} { + return arg; // Error + ~~~~~~~~~~~ +!!! error TS2322: Type 'T' is not assignable to type '{}'. +!!! error TS2322: Type 'unknown' is not assignable to type '{}'. + } \ No newline at end of file diff --git a/tests/baselines/reference/unknownType1.js b/tests/baselines/reference/unknownType1.js index 81a787b5827..9dd1568861f 100644 --- a/tests/baselines/reference/unknownType1.js +++ b/tests/baselines/reference/unknownType1.js @@ -163,6 +163,23 @@ class C1 { b: unknown; c: any; } + +// Type parameter with explicit 'unknown' constraint not assignable to '{}' + +function f30(t: T, u: U) { + let x: {} = t; + let y: {} = u; +} + +// Repro from #26796 + +type Test1 = [unknown] extends [{}] ? true : false; // false +type IsDefinitelyDefined = [T] extends [{}] ? true : false; +type Test2 = IsDefinitelyDefined; // false + +function oops(arg: T): {} { + return arg; // Error +} //// [unknownType1.js] @@ -276,3 +293,11 @@ var C1 = /** @class */ (function () { } return C1; }()); +// Type parameter with explicit 'unknown' constraint not assignable to '{}' +function f30(t, u) { + var x = t; + var y = u; +} +function oops(arg) { + return arg; // Error +} diff --git a/tests/baselines/reference/unknownType1.symbols b/tests/baselines/reference/unknownType1.symbols index bf4088c6e38..a91664fe029 100644 --- a/tests/baselines/reference/unknownType1.symbols +++ b/tests/baselines/reference/unknownType1.symbols @@ -407,3 +407,47 @@ class C1 { >c : Symbol(C1.c, Decl(unknownType1.ts, 161, 15)) } +// Type parameter with explicit 'unknown' constraint not assignable to '{}' + +function f30(t: T, u: U) { +>f30 : Symbol(f30, Decl(unknownType1.ts, 163, 1)) +>T : Symbol(T, Decl(unknownType1.ts, 167, 13)) +>U : Symbol(U, Decl(unknownType1.ts, 167, 15)) +>t : Symbol(t, Decl(unknownType1.ts, 167, 35)) +>T : Symbol(T, Decl(unknownType1.ts, 167, 13)) +>u : Symbol(u, Decl(unknownType1.ts, 167, 40)) +>U : Symbol(U, Decl(unknownType1.ts, 167, 15)) + + let x: {} = t; +>x : Symbol(x, Decl(unknownType1.ts, 168, 7)) +>t : Symbol(t, Decl(unknownType1.ts, 167, 35)) + + let y: {} = u; +>y : Symbol(y, Decl(unknownType1.ts, 169, 7)) +>u : Symbol(u, Decl(unknownType1.ts, 167, 40)) +} + +// Repro from #26796 + +type Test1 = [unknown] extends [{}] ? true : false; // false +>Test1 : Symbol(Test1, Decl(unknownType1.ts, 170, 1)) + +type IsDefinitelyDefined = [T] extends [{}] ? true : false; +>IsDefinitelyDefined : Symbol(IsDefinitelyDefined, Decl(unknownType1.ts, 174, 51)) +>T : Symbol(T, Decl(unknownType1.ts, 175, 25)) +>T : Symbol(T, Decl(unknownType1.ts, 175, 25)) + +type Test2 = IsDefinitelyDefined; // false +>Test2 : Symbol(Test2, Decl(unknownType1.ts, 175, 78)) +>IsDefinitelyDefined : Symbol(IsDefinitelyDefined, Decl(unknownType1.ts, 174, 51)) + +function oops(arg: T): {} { +>oops : Symbol(oops, Decl(unknownType1.ts, 176, 42)) +>T : Symbol(T, Decl(unknownType1.ts, 178, 14)) +>arg : Symbol(arg, Decl(unknownType1.ts, 178, 33)) +>T : Symbol(T, Decl(unknownType1.ts, 178, 14)) + + return arg; // Error +>arg : Symbol(arg, Decl(unknownType1.ts, 178, 33)) +} + diff --git a/tests/baselines/reference/unknownType1.types b/tests/baselines/reference/unknownType1.types index bf177d4fde8..bd3408a914d 100644 --- a/tests/baselines/reference/unknownType1.types +++ b/tests/baselines/reference/unknownType1.types @@ -453,3 +453,42 @@ class C1 { >c : any } +// Type parameter with explicit 'unknown' constraint not assignable to '{}' + +function f30(t: T, u: U) { +>f30 : (t: T, u: U) => void +>t : T +>u : U + + let x: {} = t; +>x : {} +>t : T + + let y: {} = u; +>y : {} +>u : U +} + +// Repro from #26796 + +type Test1 = [unknown] extends [{}] ? true : false; // false +>Test1 : false +>true : true +>false : false + +type IsDefinitelyDefined = [T] extends [{}] ? true : false; +>IsDefinitelyDefined : IsDefinitelyDefined +>true : true +>false : false + +type Test2 = IsDefinitelyDefined; // false +>Test2 : false + +function oops(arg: T): {} { +>oops : (arg: T) => {} +>arg : T + + return arg; // Error +>arg : T +} + diff --git a/tests/baselines/reference/user/chrome-devtools-frontend.log b/tests/baselines/reference/user/chrome-devtools-frontend.log index e515fb02779..268d9e869c4 100644 --- a/tests/baselines/reference/user/chrome-devtools-frontend.log +++ b/tests/baselines/reference/user/chrome-devtools-frontend.log @@ -11,8 +11,8 @@ Standard output: ../../../../built/local/lib.dom.d.ts(12039,13): error TS2300: Duplicate identifier 'Request'. ../../../../built/local/lib.dom.d.ts(16513,11): error TS2300: Duplicate identifier 'Window'. ../../../../built/local/lib.dom.d.ts(16644,13): error TS2300: Duplicate identifier 'Window'. -../../../../built/local/lib.es5.d.ts(1406,11): error TS2300: Duplicate identifier 'ArrayLike'. -../../../../built/local/lib.es5.d.ts(1442,6): error TS2300: Duplicate identifier 'Record'. +../../../../built/local/lib.es5.d.ts(1416,11): error TS2300: Duplicate identifier 'ArrayLike'. +../../../../built/local/lib.es5.d.ts(1452,6): error TS2300: Duplicate identifier 'Record'. ../../../../node_modules/@types/node/index.d.ts(150,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'module' must be of type '{}', but here has type 'NodeModule'. node_modules/chrome-devtools-frontend/front_end/Runtime.js(43,8): error TS2339: Property '_importScriptPathPrefix' does not exist on type 'Window'. node_modules/chrome-devtools-frontend/front_end/Runtime.js(77,16): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. @@ -7661,7 +7661,7 @@ node_modules/chrome-devtools-frontend/front_end/network/RequestTimingView.js(271 node_modules/chrome-devtools-frontend/front_end/network/RequestTimingView.js(272,52): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/network/RequestTimingView.js(274,52): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/network/RequestTimingView.js(288,74): error TS2345: Argument of type '{ min: number; max: number; count: number; }' is not assignable to parameter of type 'number | { min: number; max: number; }'. - Object literal may only specify known properties, and 'count' does not exist in type 'number | { min: number; max: number; }'. + Object literal may only specify known properties, and 'count' does not exist in type '{ min: number; max: number; }'. node_modules/chrome-devtools-frontend/front_end/network/RequestTimingView.js(290,29): error TS2339: Property 'createChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/network/RequestTimingView.js(307,34): error TS2339: Property 'millisToString' does not exist on type 'NumberConstructor'. node_modules/chrome-devtools-frontend/front_end/network/RequestTimingView.js(315,37): error TS2339: Property 'createChild' does not exist on type 'Element'. @@ -13639,7 +13639,7 @@ node_modules/chrome-devtools-frontend/front_end/ui/XWidget.js(75,15): error TS70 node_modules/chrome-devtools-frontend/front_end/ui/XWidget.js(82,15): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. node_modules/chrome-devtools-frontend/front_end/ui/XWidget.js(89,15): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. node_modules/chrome-devtools-frontend/front_end/ui/XWidget.js(100,79): error TS2345: Argument of type '{ passive: boolean; capture: false; }' is not assignable to parameter of type 'boolean | EventListenerOptions'. - Object literal may only specify known properties, and 'passive' does not exist in type 'boolean | EventListenerOptions'. + Object literal may only specify known properties, and 'passive' does not exist in type 'EventListenerOptions'. node_modules/chrome-devtools-frontend/front_end/ui/XWidget.js(108,19): error TS2551: Property '_scrollTop' does not exist on type 'Element'. Did you mean 'scrollTop'? node_modules/chrome-devtools-frontend/front_end/ui/XWidget.js(109,37): error TS2551: Property '_scrollTop' does not exist on type 'Element'. Did you mean 'scrollTop'? node_modules/chrome-devtools-frontend/front_end/ui/XWidget.js(110,19): error TS2551: Property '_scrollLeft' does not exist on type 'Element'. Did you mean 'scrollLeft'? diff --git a/tests/baselines/reference/user/puppeteer.log b/tests/baselines/reference/user/puppeteer.log index b799b7125ab..9d6c2b26482 100644 --- a/tests/baselines/reference/user/puppeteer.log +++ b/tests/baselines/reference/user/puppeteer.log @@ -8,9 +8,9 @@ lib/Browser.js(71,49): error TS2322: Type 'Promise' is not assignabl Type 'T' is not assignable to type 'string | symbol'. Type 'string | number | symbol' is not assignable to type 'string | symbol'. Type 'number' is not assignable to type 'string | symbol'. - Type 'T' is not assignable to type 'string'. - Type 'string | number | symbol' is not assignable to type 'string'. - Type 'number' is not assignable to type 'string'. + Type 'T' is not assignable to type 'symbol'. + Type 'string | number | symbol' is not assignable to type 'symbol'. + Type 'string' is not assignable to type 'symbol'. lib/BrowserFetcher.js(100,15): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. lib/BrowserFetcher.js(195,13): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. lib/Connection.js(91,14): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. diff --git a/tests/cases/compiler/arguments.ts b/tests/cases/compiler/arguments.ts index b486d5eed95..9e91e898776 100644 --- a/tests/cases/compiler/arguments.ts +++ b/tests/cases/compiler/arguments.ts @@ -1,7 +1,11 @@ +// @target: ES6 function f() { var x=arguments[12]; + (() => arguments)(); } +(() => arguments)(); + interface I { method(args: typeof arguments): void; fn: (args: typeof arguments) => void; diff --git a/tests/cases/compiler/functionTypeArgumentArityErrors.ts b/tests/cases/compiler/functionTypeArgumentArityErrors.ts new file mode 100644 index 00000000000..5cf681effa6 --- /dev/null +++ b/tests/cases/compiler/functionTypeArgumentArityErrors.ts @@ -0,0 +1,26 @@ +// Overloaded functions with default type arguments +declare function f1(): void; +declare function f1(): void; +f1(); +f1(); + +// Overloaded functions with no default type arguments +declare function f2(): void; +declare function f2(): void; +f2(); +f2(); + +// Overloaded non-generic functions +declare function f3(): void; +declare function f3(a): void; +f3(); + +// Generic function with default type parameters +declare function f4(): void; +f4(); +f4(); + +// Generic function with no default type arguments +declare function f5(): void; +f5(); +f5(); diff --git a/tests/cases/compiler/identifierStartAfterNumericLiteral.ts b/tests/cases/compiler/identifierStartAfterNumericLiteral.ts new file mode 100644 index 00000000000..14e5cca0e25 --- /dev/null +++ b/tests/cases/compiler/identifierStartAfterNumericLiteral.ts @@ -0,0 +1,26 @@ +let valueIn = 3in[null]; + +3a[null] +123a[null] +3e[null] +123e[null] +3in[null] +123in[null] +3en[null] +123en[null] +1a +123a +123abc +1e +123e +1e9 +123e9 +1ee +123ee +1n +123n +2n2 +123n2 +2na +123na +123nabc diff --git a/tests/cases/conformance/functions/strictBindCallApply1.ts b/tests/cases/conformance/functions/strictBindCallApply1.ts index 5a94d4b5416..4194c41ec24 100644 --- a/tests/cases/conformance/functions/strictBindCallApply1.ts +++ b/tests/cases/conformance/functions/strictBindCallApply1.ts @@ -2,11 +2,19 @@ declare function foo(a: number, b: string): string; +declare function overloaded(s: string): number; +declare function overloaded(n: number): string; + +declare function generic(x: T): T; + let f00 = foo.bind(undefined); let f01 = foo.bind(undefined, 10); let f02 = foo.bind(undefined, 10, "hello"); let f03 = foo.bind(undefined, 10, 20); // Error +let f04 = overloaded.bind(undefined); // typeof overloaded +let f05 = generic.bind(undefined); // typeof generic + let c00 = foo.call(undefined, 10, "hello"); let c01 = foo.call(undefined, 10); // Error let c02 = foo.call(undefined, 10, 20); // Error @@ -20,6 +28,10 @@ let a03 = foo.apply(undefined, [10, "hello", 30]); // Error class C { constructor(a: number, b: string) {} foo(this: this, a: number, b: string): string { return "" } + overloaded(s: string): number; + overloaded(n: number): string; + overloaded(x: any): any { return undefined } + generic(x: T): T { return x } } declare let c: C; @@ -31,6 +43,9 @@ let f12 = c.foo.bind(c, 10, "hello"); let f13 = c.foo.bind(c, 10, 20); // Error let f14 = c.foo.bind(undefined); // Error +let f15 = c.overloaded.bind(c); // typeof C.prototype.overloaded +let f16 = c.generic.bind(c); // typeof C.prototype.generic + let c10 = c.foo.call(c, 10, "hello"); let c11 = c.foo.call(c, 10); // Error let c12 = c.foo.call(c, 10, 20); // Error diff --git a/tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType6.ts b/tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType6.ts new file mode 100644 index 00000000000..50cca65c6dc --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType6.ts @@ -0,0 +1 @@ +var v: [number,,] \ No newline at end of file diff --git a/tests/cases/conformance/types/typeRelationships/typeInference/discriminatedUnionInference.ts b/tests/cases/conformance/types/typeRelationships/typeInference/discriminatedUnionInference.ts new file mode 100644 index 00000000000..8009ae23537 --- /dev/null +++ b/tests/cases/conformance/types/typeRelationships/typeInference/discriminatedUnionInference.ts @@ -0,0 +1,21 @@ +// @strict: true + +// Repro from #28862 + +type Foo = { type: "foo", (): A[] }; +type Bar = { type: "bar", (): A }; + +type FooBar = Foo | Bar; + +type InferA = T extends FooBar ? A : never; + +type FooA = InferA>; // number + +// Repro from #28862 + +type Item = { kind: 'a', data: T } | { kind: 'b', data: T[] }; + +declare function foo(item: Item): T; + +let x1 = foo({ kind: 'a', data: 42 }); // number +let x2 = foo({ kind: 'b', data: [1, 2] }); // number diff --git a/tests/cases/conformance/types/union/discriminatedUnionTypes2.ts b/tests/cases/conformance/types/union/discriminatedUnionTypes2.ts index 789bc263c7e..a11e1447780 100644 --- a/tests/cases/conformance/types/union/discriminatedUnionTypes2.ts +++ b/tests/cases/conformance/types/union/discriminatedUnionTypes2.ts @@ -72,3 +72,25 @@ function f20(carrier: DataCarrier) { const data: null = carrier.data } } + +// Repro from #28935 + +type Foo = { tag: true, x: number } | { tag: false, y: number } | { [x: string]: string }; + +function f30(foo: Foo) { + if (foo.tag) { + foo; + } + else { + foo; + } +} + +function f31(foo: Foo) { + if (foo.tag === true) { + foo; + } + else { + foo; + } +} diff --git a/tests/cases/conformance/types/unknown/unknownType1.ts b/tests/cases/conformance/types/unknown/unknownType1.ts index 3307f5c4481..d1f5ce11261 100644 --- a/tests/cases/conformance/types/unknown/unknownType1.ts +++ b/tests/cases/conformance/types/unknown/unknownType1.ts @@ -164,3 +164,20 @@ class C1 { b: unknown; c: any; } + +// Type parameter with explicit 'unknown' constraint not assignable to '{}' + +function f30(t: T, u: U) { + let x: {} = t; + let y: {} = u; +} + +// Repro from #26796 + +type Test1 = [unknown] extends [{}] ? true : false; // false +type IsDefinitelyDefined = [T] extends [{}] ? true : false; +type Test2 = IsDefinitelyDefined; // false + +function oops(arg: T): {} { + return arg; // Error +}