diff --git a/.gitignore b/.gitignore index f487ea6dd29..3147b8e8724 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ tests/services/baselines/local/* tests/baselines/prototyping/local/* tests/baselines/rwc/* tests/baselines/test262/* +tests/baselines/reference/projectOutput/* tests/baselines/local/projectOutput/* tests/services/baselines/prototyping/local/* tests/services/browser/typescriptServices.js @@ -46,4 +47,5 @@ scripts/*.js.map coverage/ internal/ **/.DS_Store -.settings/ +.settings/* +!.settings/tasks.json diff --git a/.settings/tasks.json b/.settings/tasks.json new file mode 100644 index 00000000000..e617f228378 --- /dev/null +++ b/.settings/tasks.json @@ -0,0 +1,23 @@ +// Available variables which can be used inside of strings. +// ${workspaceRoot}: the root folder of the team +// ${file}: the current opened file +// ${fileBasename}: the current opened file's basename +// ${fileDirname}: the current opened file's dirname +// ${fileExtname}: the current opened file's extension +// ${cwd}: the current working directory of the spawned process +{ + "version": "0.1.0", + "command": "jake", + "isShellCommand": true, + "showOutput": "silent", + "tasks": [ + { + "taskName": "local", + "isBuildCommand": true, + "showOutput": "silent", + "problemMatcher": [ + "$tsc" + ] + } + ] +} \ No newline at end of file diff --git a/README.md b/README.md index ac00ef085bc..7d9a430a914 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob ## Building -In order to build the TypeScript compiler, ensure that you have [Git](http://git-scm.com/downloads) and [Node.js](http://nodejs.org/) installed. +In order to build the TypeScript compiler, ensure that you have [Git](http://git-scm.com/downloads) and [Node.js](http://nodejs.org/) installed. Note that you need to have autocrlf off as we track whitespace changes (`git config --global core.autocrlf false`). Clone a copy of the repo: diff --git a/bin/lib.core.es6.d.ts b/bin/lib.core.es6.d.ts index 902962cae51..86e2fa3ad70 100644 --- a/bin/lib.core.es6.d.ts +++ b/bin/lib.core.es6.d.ts @@ -4766,6 +4766,7 @@ interface PromiseLike { * @returns A Promise for the completion of which ever callback is executed. */ then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; } /** @@ -4779,6 +4780,7 @@ interface Promise { * @returns A Promise for the completion of which ever callback is executed. */ then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; /** * Attaches a callback for only the rejection of the Promise. diff --git a/bin/lib.es6.d.ts b/bin/lib.es6.d.ts index f839a3e3a0b..d6ca7245140 100644 --- a/bin/lib.es6.d.ts +++ b/bin/lib.es6.d.ts @@ -4766,6 +4766,7 @@ interface PromiseLike { * @returns A Promise for the completion of which ever callback is executed. */ then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; } /** @@ -4779,6 +4780,7 @@ interface Promise { * @returns A Promise for the completion of which ever callback is executed. */ then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; /** * Attaches a callback for only the rejection of the Promise. diff --git a/bin/tsc.js b/bin/tsc.js index 2bde9314b4d..47c6769ae8d 100644 --- a/bin/tsc.js +++ b/bin/tsc.js @@ -431,9 +431,13 @@ var ts; return 3; return 2; } + if (path.lastIndexOf("file:///", 0) === 0) { + return "file:///".length; + } var idx = path.indexOf('://'); - if (idx !== -1) - return idx + 3; + if (idx !== -1) { + return idx + "://".length; + } return 0; } ts.getRootLength = getRootLength; @@ -584,10 +588,11 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; - var supportedExtensions = [".d.ts", ".ts", ".js"]; + ts.supportedExtensions = [".ts", ".d.ts"]; + var extensionsToRemove = [".d.ts", ".ts", ".js"]; function removeFileExtension(path) { - for (var _i = 0; _i < supportedExtensions.length; _i++) { - var ext = supportedExtensions[_i]; + for (var _i = 0; _i < extensionsToRemove.length; _i++) { + var ext = extensionsToRemove[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); } @@ -1358,8 +1363,8 @@ var ts; Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." }, Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" }, - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourceMap' option." }, + Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option." }, Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." }, @@ -1379,7 +1384,7 @@ var ts; Watch_input_files: { code: 6005, category: ts.DiagnosticCategory.Message, key: "Watch input files." }, Redirect_output_structure_to_the_directory: { code: 6006, category: ts.DiagnosticCategory.Message, key: "Redirect output structure to the directory." }, Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: ts.DiagnosticCategory.Message, key: "Do not erase const enum declarations in generated code." }, - Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any type checking errors were reported." }, + Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any errors were reported." }, Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." }, Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." }, Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, @@ -1412,7 +1417,7 @@ var ts; Corrupted_locale_file_0: { code: 6051, category: ts.DiagnosticCategory.Error, key: "Corrupted locale file {0}." }, Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: ts.DiagnosticCategory.Message, key: "Raise error on expressions and declarations with an implied 'any' type." }, File_0_not_found: { code: 6053, category: ts.DiagnosticCategory.Error, key: "File '{0}' not found." }, - File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, + File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File '{0}' has unsupported extension. The only supported extensions are {1}." }, Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." }, Preserve_new_lines_when_emitting_code: { code: 6057, category: ts.DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." }, @@ -3068,6 +3073,9 @@ var ts; else if (ts.isBlockOrCatchScoped(node)) { bindBlockScopedVariableDeclaration(node); } + else if (ts.isParameterDeclaration(node)) { + bindDeclaration(node, 1, 107455, false); + } else { bindDeclaration(node, 1, 107454, false); } @@ -3592,9 +3600,6 @@ var ts; case 141: case 143: case 144: - case 163: - case 164: - case 201: return true; } } @@ -4176,6 +4181,18 @@ var ts; return false; } ts.isModifier = isModifier; + function isParameterDeclaration(node) { + var root = getRootDeclaration(node); + return root.kind === 130; + } + ts.isParameterDeclaration = isParameterDeclaration; + function getRootDeclaration(node) { + while (node.kind === 153) { + node = node.parent.parent; + } + return node; + } + ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(n) { return isFunctionLike(n) || n.kind === 206 || n.kind === 228; } @@ -5498,13 +5515,6 @@ var ts; return token === t && tryParse(nextTokenCanFollowModifier); } function nextTokenCanFollowModifier() { - nextToken(); - return canFollowModifier(); - } - function parseAnyContextualModifier() { - return ts.isModifier(token) && tryParse(nextTokenCanFollowContextualModifier); - } - function nextTokenCanFollowContextualModifier() { if (token === 70) { return nextToken() === 77; } @@ -5521,6 +5531,9 @@ var ts; nextToken(); return canFollowModifier(); } + function parseAnyContextualModifier() { + return ts.isModifier(token) && tryParse(nextTokenCanFollowModifier); + } function canFollowModifier() { return token === 18 || token === 14 @@ -9209,10 +9222,11 @@ var ts; return symbol; } } + var fileName; var sourceFile; while (true) { - var fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts"); + fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); + sourceFile = ts.forEach(ts.supportedExtensions, function (extension) { return host.getSourceFile(fileName + extension); }); if (sourceFile || isRelative) { break; } @@ -10157,14 +10171,8 @@ var ts; resolutionTargets.pop(); return resolutionResults.pop(); } - function getRootDeclaration(node) { - while (node.kind === 153) { - node = node.parent.parent; - } - return node; - } function getDeclarationContainer(node) { - node = getRootDeclaration(node); + node = ts.getRootDeclaration(node); return node.kind === 199 ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { @@ -10314,7 +10322,7 @@ var ts; } type = declaration.dotDotDotToken ? anyArrayType : anyType; if (reportErrors && compilerOptions.noImplicitAny) { - var root = getRootDeclaration(declaration); + var root = ts.getRootDeclaration(declaration); if (!isPrivateWithinAmbient(root) && !(root.kind === 130 && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } @@ -10427,7 +10435,10 @@ var ts; function getTypeOfAlias(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - links.type = getTypeOfSymbol(resolveAlias(symbol)); + var targetSymbol = resolveAlias(symbol); + links.type = targetSymbol.flags & 107455 + ? getTypeOfSymbol(targetSymbol) + : unknownType; } return links.type; } @@ -11441,7 +11452,13 @@ var ts; } return false; } + var removeSubtypesStack = []; function removeSubtypes(types) { + var typeListId = getTypeListId(types); + if (removeSubtypesStack.lastIndexOf(typeListId) >= 0) { + return; + } + removeSubtypesStack.push(typeListId); var i = types.length; while (i > 0) { i--; @@ -11449,6 +11466,7 @@ var ts; types.splice(i, 1); } } + removeSubtypesStack.pop(); } function containsAnyType(types) { for (var _i = 0; _i < types.length; _i++) { @@ -13004,31 +13022,33 @@ var ts; if (!isTypeSubtypeOf(rightType, globalFunctionType)) { return type; } + var targetType; var prototypeProperty = getPropertyOfType(rightType, "prototype"); if (prototypeProperty) { - var targetType = getTypeOfSymbol(prototypeProperty); - if (targetType !== anyType) { - if (isTypeSubtypeOf(targetType, type)) { - return targetType; - } - if (type.flags & 16384) { - return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); - } + var prototypePropertyType = getTypeOfSymbol(prototypeProperty); + if (prototypePropertyType !== anyType) { + targetType = prototypePropertyType; } } - var constructSignatures; - if (rightType.flags & 2048) { - constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures; + if (!targetType) { + var constructSignatures; + if (rightType.flags & 2048) { + constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures; + } + else if (rightType.flags & 32768) { + constructSignatures = getSignaturesOfType(rightType, 1); + } + if (constructSignatures && constructSignatures.length) { + targetType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); })); + } } - else if (rightType.flags & 32768) { - constructSignatures = getSignaturesOfType(rightType, 1); - } - if (constructSignatures && constructSignatures.length !== 0) { - var instanceType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); })); + if (targetType) { + if (isTypeSubtypeOf(targetType, type)) { + return targetType; + } if (type.flags & 16384) { - return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, instanceType); })); + return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); } - return instanceType; } return type; } @@ -15667,7 +15687,7 @@ var ts; if (ts.isInAmbientContext(node)) { return false; } - var root = getRootDeclaration(node); + var root = ts.getRootDeclaration(node); if (root.kind === 130 && ts.nodeIsMissing(root.parent.body)) { return false; } @@ -15728,7 +15748,7 @@ var ts; // - ScriptBody : StatementList // It is a Syntax Error if any element of the LexicallyDeclaredNames of StatementList // also occurs in the VarDeclaredNames of StatementList. - if ((ts.getCombinedNodeFlags(node) & 12288) !== 0 || isParameterDeclaration(node)) { + if ((ts.getCombinedNodeFlags(node) & 12288) !== 0 || ts.isParameterDeclaration(node)) { return; } if (node.kind === 199 && !node.initializer) { @@ -15758,14 +15778,8 @@ var ts; } } } - function isParameterDeclaration(node) { - while (node.kind === 153) { - node = node.parent.parent; - } - return node.kind === 130; - } function checkParameterInitializer(node) { - if (getRootDeclaration(node).kind !== 130) { + if (ts.getRootDeclaration(node).kind !== 130) { return; } var func = ts.getContainingFunction(node); @@ -15804,7 +15818,7 @@ var ts; if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); } - if (node.initializer && getRootDeclaration(node).kind === 130 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 130 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } @@ -21259,7 +21273,7 @@ var ts; } return true; } - function emitListWithSpread(elements, multiLine, trailingComma) { + function emitListWithSpread(elements, alwaysCopy, multiLine, trailingComma) { var pos = 0; var group = 0; var length = elements.length; @@ -21275,6 +21289,9 @@ var ts; e = e.expression; emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; + if (pos === length && group === 0 && alwaysCopy && e.kind !== 154) { + write(".slice()"); + } } else { var i = pos; @@ -21312,7 +21329,7 @@ var ts; write("]"); } else { - emitListWithSpread(elements, (node.flags & 512) !== 0, elements.hasTrailingComma); + emitListWithSpread(elements, true, (node.flags & 512) !== 0, elements.hasTrailingComma); } } function emitObjectLiteralBody(node, numElements) { @@ -21638,7 +21655,7 @@ var ts; write("void 0"); } write(", "); - emitListWithSpread(node.arguments, false, false); + emitListWithSpread(node.arguments, false, false, false); write(")"); } function emitCallExpression(node) { @@ -22266,7 +22283,7 @@ var ts; if (node.flags & 1) { writeLine(); emitStart(node); - if (compilerOptions.module === 4) { + if (compilerOptions.module === 4 && node.parent === currentSourceFile) { write(exportFunctionForFile + "(\""); if (node.flags & 256) { write("default"); @@ -22604,12 +22621,14 @@ var ts; node.parent.kind === 228; } function emitVariableStatement(node) { - var startIsEmitted = true; - if (!(node.flags & 1)) { - startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + var startIsEmitted = false; + if (node.flags & 1) { + if (isES6ExportedDeclaration(node)) { + write("export "); + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + } } - else if (isES6ExportedDeclaration(node)) { - write("export "); + else { startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); } if (startIsEmitted) { @@ -23628,15 +23647,17 @@ var ts; if (!shouldEmitEnumDeclaration(node)) { return; } - if (!(node.flags & 1) || isES6ExportedDeclaration(node)) { - emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); + if (!shouldHoistDeclarationInSystemJsModule(node)) { + if (!(node.flags & 1) || isES6ExportedDeclaration(node)) { + emitStart(node); + if (isES6ExportedDeclaration(node)) { + write("export "); + } + write("var "); + emit(node.name); + emitEnd(node); + write(";"); } - write("var "); - emit(node.name); - emitEnd(node); - write(";"); } writeLine(); emitStart(node); @@ -23658,7 +23679,7 @@ var ts; emitModuleMemberName(node); write(" = {}));"); emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.flags & 1) { + if (!isES6ExportedDeclaration(node) && node.flags & 1 && !shouldHoistDeclarationInSystemJsModule(node)) { writeLine(); emitStart(node); write("var "); @@ -23669,6 +23690,14 @@ var ts; write(";"); } if (languageVersion < 2 && node.parent === currentSourceFile) { + if (compilerOptions.module === 4 && (node.flags & 1)) { + writeLine(); + write(exportFunctionForFile + "(\""); + emitDeclarationName(node); + write("\", "); + emitDeclarationName(node); + write(")"); + } emitExportMemberAssignments(node.name); } } @@ -24255,12 +24284,25 @@ var ts; if (hoistedVars) { writeLine(); write("var "); + var seen = {}; for (var i = 0; i < hoistedVars.length; ++i) { var local = hoistedVars[i]; + var name_21 = local.kind === 65 + ? local + : local.name; + if (name_21) { + var text = ts.unescapeIdentifier(name_21.text); + if (ts.hasProperty(seen, text)) { + continue; + } + else { + seen[text] = text; + } + } if (i !== 0) { write(", "); } - if (local.kind === 202 || local.kind === 206) { + if (local.kind === 202 || local.kind === 206 || local.kind === 205) { emitDeclarationName(local); } else { @@ -24291,6 +24333,9 @@ var ts; } return exportedDeclarations; function visit(node) { + if (node.flags & 2) { + return; + } if (node.kind === 201) { if (!hoistedFunctionDeclarations) { hoistedFunctionDeclarations = []; @@ -24305,24 +24350,35 @@ var ts; hoistedVars.push(node); return; } - if (node.kind === 206 && shouldEmitModuleDeclaration(node)) { - if (!hoistedVars) { - hoistedVars = []; + if (node.kind === 205) { + if (shouldEmitEnumDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + } + return; + } + if (node.kind === 206) { + if (shouldEmitModuleDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); } - hoistedVars.push(node); return; } if (node.kind === 199 || node.kind === 153) { if (shouldHoistVariable(node, false)) { - var name_21 = node.name; - if (name_21.kind === 65) { + var name_22 = node.name; + if (name_22.kind === 65) { if (!hoistedVars) { hoistedVars = []; } - hoistedVars.push(name_21); + hoistedVars.push(name_22); } else { - ts.forEachChild(name_21, visit); + ts.forEachChild(name_22, visit); } } return; @@ -24992,7 +25048,7 @@ var ts; ts.emitTime = 0; ts.ioReadTime = 0; ts.ioWriteTime = 0; - ts.version = "1.5.0"; + ts.version = "1.5.2"; var carriageReturnLineFeed = "\r\n"; var lineFeed = "\n"; function findConfigFile(searchPath) { @@ -25168,14 +25224,14 @@ var ts; if (options.noEmitOnError && getPreEmitDiagnostics(this).length > 0) { return { diagnostics: [], sourceMaps: undefined, emitSkipped: true }; } - var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile); + var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(options.out ? undefined : sourceFile); var start = new Date().getTime(); var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile); ts.emitTime += new Date().getTime() - start; return emitResult; } function getSourceFile(fileName) { - fileName = host.getCanonicalFileName(fileName); + fileName = host.getCanonicalFileName(ts.normalizeSlashes(fileName)); return ts.hasProperty(filesByName, fileName) ? filesByName[fileName] : undefined; } function getDiagnosticsHelper(sourceFile, getDiagnostics) { @@ -25231,42 +25287,49 @@ var ts; function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { var start; var length; + var extensions; + var diagnosticArgument; if (refEnd !== undefined && refPos !== undefined) { start = refPos; length = refEnd - refPos; } var diagnostic; if (hasExtension(fileName)) { - if (!options.allowNonTsExtensions && !ts.fileExtensionIs(host.getCanonicalFileName(fileName), ".ts")) { - diagnostic = ts.Diagnostics.File_0_must_have_extension_ts_or_d_ts; + if (!options.allowNonTsExtensions && !ts.forEach(ts.supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) { + diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1; + diagnosticArgument = [fileName, "'" + ts.supportedExtensions.join("', '") + "'"]; } else if (!findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; + diagnosticArgument = [fileName]; } else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) { diagnostic = ts.Diagnostics.A_file_cannot_have_a_reference_to_itself; + diagnosticArgument = [fileName]; } } else { if (options.allowNonTsExtensions && !findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; + diagnosticArgument = [fileName]; } - else if (!findSourceFile(fileName + ".ts", isDefaultLib, refFile, refPos, refEnd) && !findSourceFile(fileName + ".d.ts", isDefaultLib, refFile, refPos, refEnd)) { + else if (!ts.forEach(ts.supportedExtensions, function (extension) { return findSourceFile(fileName + extension, isDefaultLib, refFile, refPos, refEnd); })) { diagnostic = ts.Diagnostics.File_0_not_found; fileName += ".ts"; + diagnosticArgument = [fileName]; } } if (diagnostic) { if (refFile) { - diagnostics.add(ts.createFileDiagnostic(refFile, start, length, diagnostic, fileName)); + diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, start, length, diagnostic].concat(diagnosticArgument))); } else { - diagnostics.add(ts.createCompilerDiagnostic(diagnostic, fileName)); + diagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument))); } } } function findSourceFile(fileName, isDefaultLib, refFile, refStart, refLength) { - var canonicalName = host.getCanonicalFileName(fileName); + var canonicalName = host.getCanonicalFileName(ts.normalizeSlashes(fileName)); if (ts.hasProperty(filesByName, canonicalName)) { return getSourceFileFromCache(fileName, canonicalName, false); } @@ -25326,9 +25389,10 @@ var ts; var moduleNameText = moduleNameExpr.text; if (moduleNameText) { var searchPath = basePath; + var searchName; while (true) { - var searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText)); - if (findModuleSourceFile(searchName + ".ts", moduleNameExpr) || findModuleSourceFile(searchName + ".d.ts", moduleNameExpr)) { + searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText)); + if (ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, moduleNameExpr); })) { break; } var parentPath = ts.getDirectoryPath(searchPath); @@ -25348,10 +25412,7 @@ var ts; var moduleName = nameLiteral.text; if (moduleName) { var searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); - var tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral); - if (!tsFile) { - findModuleSourceFile(searchName + ".d.ts", nameLiteral); - } + ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, nameLiteral); }); } } }); @@ -25441,10 +25502,10 @@ var ts; } if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { if (options.mapRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option)); } if (options.sourceRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option)); } return; } @@ -25582,7 +25643,7 @@ var ts; { name: "noEmitOnError", type: "boolean", - description: ts.Diagnostics.Do_not_emit_outputs_if_any_type_checking_errors_were_reported + description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported }, { name: "noImplicitAny", diff --git a/bin/tsserver.js b/bin/tsserver.js index 1707ef70411..f617ae545f3 100644 --- a/bin/tsserver.js +++ b/bin/tsserver.js @@ -431,9 +431,13 @@ var ts; return 3; return 2; } + if (path.lastIndexOf("file:///", 0) === 0) { + return "file:///".length; + } var idx = path.indexOf('://'); - if (idx !== -1) - return idx + 3; + if (idx !== -1) { + return idx + "://".length; + } return 0; } ts.getRootLength = getRootLength; @@ -584,10 +588,11 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; - var supportedExtensions = [".d.ts", ".ts", ".js"]; + ts.supportedExtensions = [".ts", ".d.ts"]; + var extensionsToRemove = [".d.ts", ".ts", ".js"]; function removeFileExtension(path) { - for (var _i = 0; _i < supportedExtensions.length; _i++) { - var ext = supportedExtensions[_i]; + for (var _i = 0; _i < extensionsToRemove.length; _i++) { + var ext = extensionsToRemove[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); } @@ -1358,8 +1363,8 @@ var ts; Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." }, Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" }, - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourceMap' option." }, + Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option." }, Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." }, @@ -1379,7 +1384,7 @@ var ts; Watch_input_files: { code: 6005, category: ts.DiagnosticCategory.Message, key: "Watch input files." }, Redirect_output_structure_to_the_directory: { code: 6006, category: ts.DiagnosticCategory.Message, key: "Redirect output structure to the directory." }, Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: ts.DiagnosticCategory.Message, key: "Do not erase const enum declarations in generated code." }, - Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any type checking errors were reported." }, + Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any errors were reported." }, Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." }, Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." }, Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, @@ -1412,7 +1417,7 @@ var ts; Corrupted_locale_file_0: { code: 6051, category: ts.DiagnosticCategory.Error, key: "Corrupted locale file {0}." }, Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: ts.DiagnosticCategory.Message, key: "Raise error on expressions and declarations with an implied 'any' type." }, File_0_not_found: { code: 6053, category: ts.DiagnosticCategory.Error, key: "File '{0}' not found." }, - File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, + File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File '{0}' has unsupported extension. The only supported extensions are {1}." }, Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." }, Preserve_new_lines_when_emitting_code: { code: 6057, category: ts.DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." }, @@ -2796,7 +2801,7 @@ var ts; { name: "noEmitOnError", type: "boolean", - description: ts.Diagnostics.Do_not_emit_outputs_if_any_type_checking_errors_were_reported + description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported }, { name: "noImplicitAny", @@ -3463,9 +3468,6 @@ var ts; case 141: case 143: case 144: - case 163: - case 164: - case 201: return true; } } @@ -4047,6 +4049,18 @@ var ts; return false; } ts.isModifier = isModifier; + function isParameterDeclaration(node) { + var root = getRootDeclaration(node); + return root.kind === 130; + } + ts.isParameterDeclaration = isParameterDeclaration; + function getRootDeclaration(node) { + while (node.kind === 153) { + node = node.parent.parent; + } + return node; + } + ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(n) { return isFunctionLike(n) || n.kind === 206 || n.kind === 228; } @@ -5369,13 +5383,6 @@ var ts; return token === t && tryParse(nextTokenCanFollowModifier); } function nextTokenCanFollowModifier() { - nextToken(); - return canFollowModifier(); - } - function parseAnyContextualModifier() { - return ts.isModifier(token) && tryParse(nextTokenCanFollowContextualModifier); - } - function nextTokenCanFollowContextualModifier() { if (token === 70) { return nextToken() === 77; } @@ -5392,6 +5399,9 @@ var ts; nextToken(); return canFollowModifier(); } + function parseAnyContextualModifier() { + return ts.isModifier(token) && tryParse(nextTokenCanFollowModifier); + } function canFollowModifier() { return token === 18 || token === 14 @@ -8737,6 +8747,9 @@ var ts; else if (ts.isBlockOrCatchScoped(node)) { bindBlockScopedVariableDeclaration(node); } + else if (ts.isParameterDeclaration(node)) { + bindDeclaration(node, 1, 107455, false); + } else { bindDeclaration(node, 1, 107454, false); } @@ -9593,10 +9606,11 @@ var ts; return symbol; } } + var fileName; var sourceFile; while (true) { - var fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts"); + fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); + sourceFile = ts.forEach(ts.supportedExtensions, function (extension) { return host.getSourceFile(fileName + extension); }); if (sourceFile || isRelative) { break; } @@ -10541,14 +10555,8 @@ var ts; resolutionTargets.pop(); return resolutionResults.pop(); } - function getRootDeclaration(node) { - while (node.kind === 153) { - node = node.parent.parent; - } - return node; - } function getDeclarationContainer(node) { - node = getRootDeclaration(node); + node = ts.getRootDeclaration(node); return node.kind === 199 ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { @@ -10698,7 +10706,7 @@ var ts; } type = declaration.dotDotDotToken ? anyArrayType : anyType; if (reportErrors && compilerOptions.noImplicitAny) { - var root = getRootDeclaration(declaration); + var root = ts.getRootDeclaration(declaration); if (!isPrivateWithinAmbient(root) && !(root.kind === 130 && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } @@ -10811,7 +10819,10 @@ var ts; function getTypeOfAlias(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - links.type = getTypeOfSymbol(resolveAlias(symbol)); + var targetSymbol = resolveAlias(symbol); + links.type = targetSymbol.flags & 107455 + ? getTypeOfSymbol(targetSymbol) + : unknownType; } return links.type; } @@ -11825,7 +11836,13 @@ var ts; } return false; } + var removeSubtypesStack = []; function removeSubtypes(types) { + var typeListId = getTypeListId(types); + if (removeSubtypesStack.lastIndexOf(typeListId) >= 0) { + return; + } + removeSubtypesStack.push(typeListId); var i = types.length; while (i > 0) { i--; @@ -11833,6 +11850,7 @@ var ts; types.splice(i, 1); } } + removeSubtypesStack.pop(); } function containsAnyType(types) { for (var _i = 0; _i < types.length; _i++) { @@ -13388,31 +13406,33 @@ var ts; if (!isTypeSubtypeOf(rightType, globalFunctionType)) { return type; } + var targetType; var prototypeProperty = getPropertyOfType(rightType, "prototype"); if (prototypeProperty) { - var targetType = getTypeOfSymbol(prototypeProperty); - if (targetType !== anyType) { - if (isTypeSubtypeOf(targetType, type)) { - return targetType; - } - if (type.flags & 16384) { - return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); - } + var prototypePropertyType = getTypeOfSymbol(prototypeProperty); + if (prototypePropertyType !== anyType) { + targetType = prototypePropertyType; } } - var constructSignatures; - if (rightType.flags & 2048) { - constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures; + if (!targetType) { + var constructSignatures; + if (rightType.flags & 2048) { + constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures; + } + else if (rightType.flags & 32768) { + constructSignatures = getSignaturesOfType(rightType, 1); + } + if (constructSignatures && constructSignatures.length) { + targetType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); })); + } } - else if (rightType.flags & 32768) { - constructSignatures = getSignaturesOfType(rightType, 1); - } - if (constructSignatures && constructSignatures.length !== 0) { - var instanceType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); })); + if (targetType) { + if (isTypeSubtypeOf(targetType, type)) { + return targetType; + } if (type.flags & 16384) { - return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, instanceType); })); + return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); } - return instanceType; } return type; } @@ -16051,7 +16071,7 @@ var ts; if (ts.isInAmbientContext(node)) { return false; } - var root = getRootDeclaration(node); + var root = ts.getRootDeclaration(node); if (root.kind === 130 && ts.nodeIsMissing(root.parent.body)) { return false; } @@ -16112,7 +16132,7 @@ var ts; // - ScriptBody : StatementList // It is a Syntax Error if any element of the LexicallyDeclaredNames of StatementList // also occurs in the VarDeclaredNames of StatementList. - if ((ts.getCombinedNodeFlags(node) & 12288) !== 0 || isParameterDeclaration(node)) { + if ((ts.getCombinedNodeFlags(node) & 12288) !== 0 || ts.isParameterDeclaration(node)) { return; } if (node.kind === 199 && !node.initializer) { @@ -16142,14 +16162,8 @@ var ts; } } } - function isParameterDeclaration(node) { - while (node.kind === 153) { - node = node.parent.parent; - } - return node.kind === 130; - } function checkParameterInitializer(node) { - if (getRootDeclaration(node).kind !== 130) { + if (ts.getRootDeclaration(node).kind !== 130) { return; } var func = ts.getContainingFunction(node); @@ -16188,7 +16202,7 @@ var ts; if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); } - if (node.initializer && getRootDeclaration(node).kind === 130 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 130 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } @@ -21643,7 +21657,7 @@ var ts; } return true; } - function emitListWithSpread(elements, multiLine, trailingComma) { + function emitListWithSpread(elements, alwaysCopy, multiLine, trailingComma) { var pos = 0; var group = 0; var length = elements.length; @@ -21659,6 +21673,9 @@ var ts; e = e.expression; emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; + if (pos === length && group === 0 && alwaysCopy && e.kind !== 154) { + write(".slice()"); + } } else { var i = pos; @@ -21696,7 +21713,7 @@ var ts; write("]"); } else { - emitListWithSpread(elements, (node.flags & 512) !== 0, elements.hasTrailingComma); + emitListWithSpread(elements, true, (node.flags & 512) !== 0, elements.hasTrailingComma); } } function emitObjectLiteralBody(node, numElements) { @@ -22022,7 +22039,7 @@ var ts; write("void 0"); } write(", "); - emitListWithSpread(node.arguments, false, false); + emitListWithSpread(node.arguments, false, false, false); write(")"); } function emitCallExpression(node) { @@ -22650,7 +22667,7 @@ var ts; if (node.flags & 1) { writeLine(); emitStart(node); - if (compilerOptions.module === 4) { + if (compilerOptions.module === 4 && node.parent === currentSourceFile) { write(exportFunctionForFile + "(\""); if (node.flags & 256) { write("default"); @@ -22988,12 +23005,14 @@ var ts; node.parent.kind === 228; } function emitVariableStatement(node) { - var startIsEmitted = true; - if (!(node.flags & 1)) { - startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + var startIsEmitted = false; + if (node.flags & 1) { + if (isES6ExportedDeclaration(node)) { + write("export "); + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + } } - else if (isES6ExportedDeclaration(node)) { - write("export "); + else { startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); } if (startIsEmitted) { @@ -24012,15 +24031,17 @@ var ts; if (!shouldEmitEnumDeclaration(node)) { return; } - if (!(node.flags & 1) || isES6ExportedDeclaration(node)) { - emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); + if (!shouldHoistDeclarationInSystemJsModule(node)) { + if (!(node.flags & 1) || isES6ExportedDeclaration(node)) { + emitStart(node); + if (isES6ExportedDeclaration(node)) { + write("export "); + } + write("var "); + emit(node.name); + emitEnd(node); + write(";"); } - write("var "); - emit(node.name); - emitEnd(node); - write(";"); } writeLine(); emitStart(node); @@ -24042,7 +24063,7 @@ var ts; emitModuleMemberName(node); write(" = {}));"); emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.flags & 1) { + if (!isES6ExportedDeclaration(node) && node.flags & 1 && !shouldHoistDeclarationInSystemJsModule(node)) { writeLine(); emitStart(node); write("var "); @@ -24053,6 +24074,14 @@ var ts; write(";"); } if (languageVersion < 2 && node.parent === currentSourceFile) { + if (compilerOptions.module === 4 && (node.flags & 1)) { + writeLine(); + write(exportFunctionForFile + "(\""); + emitDeclarationName(node); + write("\", "); + emitDeclarationName(node); + write(")"); + } emitExportMemberAssignments(node.name); } } @@ -24639,12 +24668,25 @@ var ts; if (hoistedVars) { writeLine(); write("var "); + var seen = {}; for (var i = 0; i < hoistedVars.length; ++i) { var local = hoistedVars[i]; + var name_21 = local.kind === 65 + ? local + : local.name; + if (name_21) { + var text = ts.unescapeIdentifier(name_21.text); + if (ts.hasProperty(seen, text)) { + continue; + } + else { + seen[text] = text; + } + } if (i !== 0) { write(", "); } - if (local.kind === 202 || local.kind === 206) { + if (local.kind === 202 || local.kind === 206 || local.kind === 205) { emitDeclarationName(local); } else { @@ -24675,6 +24717,9 @@ var ts; } return exportedDeclarations; function visit(node) { + if (node.flags & 2) { + return; + } if (node.kind === 201) { if (!hoistedFunctionDeclarations) { hoistedFunctionDeclarations = []; @@ -24689,24 +24734,35 @@ var ts; hoistedVars.push(node); return; } - if (node.kind === 206 && shouldEmitModuleDeclaration(node)) { - if (!hoistedVars) { - hoistedVars = []; + if (node.kind === 205) { + if (shouldEmitEnumDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + } + return; + } + if (node.kind === 206) { + if (shouldEmitModuleDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); } - hoistedVars.push(node); return; } if (node.kind === 199 || node.kind === 153) { if (shouldHoistVariable(node, false)) { - var name_21 = node.name; - if (name_21.kind === 65) { + var name_22 = node.name; + if (name_22.kind === 65) { if (!hoistedVars) { hoistedVars = []; } - hoistedVars.push(name_21); + hoistedVars.push(name_22); } else { - ts.forEachChild(name_21, visit); + ts.forEachChild(name_22, visit); } } return; @@ -25376,7 +25432,7 @@ var ts; ts.emitTime = 0; ts.ioReadTime = 0; ts.ioWriteTime = 0; - ts.version = "1.5.0"; + ts.version = "1.5.2"; var carriageReturnLineFeed = "\r\n"; var lineFeed = "\n"; function findConfigFile(searchPath) { @@ -25552,14 +25608,14 @@ var ts; if (options.noEmitOnError && getPreEmitDiagnostics(this).length > 0) { return { diagnostics: [], sourceMaps: undefined, emitSkipped: true }; } - var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile); + var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(options.out ? undefined : sourceFile); var start = new Date().getTime(); var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile); ts.emitTime += new Date().getTime() - start; return emitResult; } function getSourceFile(fileName) { - fileName = host.getCanonicalFileName(fileName); + fileName = host.getCanonicalFileName(ts.normalizeSlashes(fileName)); return ts.hasProperty(filesByName, fileName) ? filesByName[fileName] : undefined; } function getDiagnosticsHelper(sourceFile, getDiagnostics) { @@ -25615,42 +25671,49 @@ var ts; function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { var start; var length; + var extensions; + var diagnosticArgument; if (refEnd !== undefined && refPos !== undefined) { start = refPos; length = refEnd - refPos; } var diagnostic; if (hasExtension(fileName)) { - if (!options.allowNonTsExtensions && !ts.fileExtensionIs(host.getCanonicalFileName(fileName), ".ts")) { - diagnostic = ts.Diagnostics.File_0_must_have_extension_ts_or_d_ts; + if (!options.allowNonTsExtensions && !ts.forEach(ts.supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) { + diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1; + diagnosticArgument = [fileName, "'" + ts.supportedExtensions.join("', '") + "'"]; } else if (!findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; + diagnosticArgument = [fileName]; } else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) { diagnostic = ts.Diagnostics.A_file_cannot_have_a_reference_to_itself; + diagnosticArgument = [fileName]; } } else { if (options.allowNonTsExtensions && !findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; + diagnosticArgument = [fileName]; } - else if (!findSourceFile(fileName + ".ts", isDefaultLib, refFile, refPos, refEnd) && !findSourceFile(fileName + ".d.ts", isDefaultLib, refFile, refPos, refEnd)) { + else if (!ts.forEach(ts.supportedExtensions, function (extension) { return findSourceFile(fileName + extension, isDefaultLib, refFile, refPos, refEnd); })) { diagnostic = ts.Diagnostics.File_0_not_found; fileName += ".ts"; + diagnosticArgument = [fileName]; } } if (diagnostic) { if (refFile) { - diagnostics.add(ts.createFileDiagnostic(refFile, start, length, diagnostic, fileName)); + diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, start, length, diagnostic].concat(diagnosticArgument))); } else { - diagnostics.add(ts.createCompilerDiagnostic(diagnostic, fileName)); + diagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument))); } } } function findSourceFile(fileName, isDefaultLib, refFile, refStart, refLength) { - var canonicalName = host.getCanonicalFileName(fileName); + var canonicalName = host.getCanonicalFileName(ts.normalizeSlashes(fileName)); if (ts.hasProperty(filesByName, canonicalName)) { return getSourceFileFromCache(fileName, canonicalName, false); } @@ -25710,9 +25773,10 @@ var ts; var moduleNameText = moduleNameExpr.text; if (moduleNameText) { var searchPath = basePath; + var searchName; while (true) { - var searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText)); - if (findModuleSourceFile(searchName + ".ts", moduleNameExpr) || findModuleSourceFile(searchName + ".d.ts", moduleNameExpr)) { + searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText)); + if (ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, moduleNameExpr); })) { break; } var parentPath = ts.getDirectoryPath(searchPath); @@ -25732,10 +25796,7 @@ var ts; var moduleName = nameLiteral.text; if (moduleName) { var searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); - var tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral); - if (!tsFile) { - findModuleSourceFile(searchName + ".d.ts", nameLiteral); - } + ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, nameLiteral); }); } } }); @@ -25825,10 +25886,10 @@ var ts; } if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { if (options.mapRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option)); } if (options.sourceRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option)); } return; } @@ -26402,10 +26463,10 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_22 in nameToDeclarations) { - var declarations = ts.getProperty(nameToDeclarations, name_22); + for (var name_23 in nameToDeclarations) { + var declarations = ts.getProperty(nameToDeclarations, name_23); if (declarations) { - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_22); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_23); if (!matches) { continue; } @@ -26416,14 +26477,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_22); + matches = patternMatcher.getMatches(containers, name_23); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_22, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_23, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -26753,9 +26814,9 @@ var ts; case 199: case 153: var variableDeclarationNode; - var name_23; + var name_24; if (node.kind === 153) { - name_23 = node.name; + name_24 = node.name; variableDeclarationNode = node; while (variableDeclarationNode && variableDeclarationNode.kind !== 199) { variableDeclarationNode = variableDeclarationNode.parent; @@ -26765,16 +26826,16 @@ var ts; else { ts.Debug.assert(!ts.isBindingPattern(node.name)); variableDeclarationNode = node; - name_23 = node.name; + name_24 = node.name; } if (ts.isConst(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.constElement); + return createItem(node, getTextOfNode(name_24), ts.ScriptElementKind.constElement); } else if (ts.isLet(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.letElement); + return createItem(node, getTextOfNode(name_24), ts.ScriptElementKind.letElement); } else { - return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.variableElement); + return createItem(node, getTextOfNode(name_24), ts.ScriptElementKind.variableElement); } case 136: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); @@ -28766,9 +28827,9 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_24 in o) { - if (o[name_24] === rule) { - return name_24; + for (var name_25 in o) { + if (o[name_25] === rule) { + return name_25; } } throw new Error("Unknown rule"); @@ -31202,8 +31263,9 @@ var ts; })(); ts.CancellationTokenObject = CancellationTokenObject; var HostCache = (function () { - function HostCache(host) { + function HostCache(host, getCanonicalFileName) { this.host = host; + this.getCanonicalFileName = getCanonicalFileName; this.fileNameToEntry = {}; var rootFileNames = host.getScriptFileNames(); for (var _i = 0; _i < rootFileNames.length; _i++) { @@ -31215,6 +31277,9 @@ var ts; HostCache.prototype.compilationSettings = function () { return this._compilationSettings; }; + HostCache.prototype.normalizeFileName = function (fileName) { + return this.getCanonicalFileName(ts.normalizeSlashes(fileName)); + }; HostCache.prototype.createEntry = function (fileName) { var entry; var scriptSnapshot = this.host.getScriptSnapshot(fileName); @@ -31225,13 +31290,13 @@ var ts; scriptSnapshot: scriptSnapshot }; } - return this.fileNameToEntry[ts.normalizeSlashes(fileName)] = entry; + return this.fileNameToEntry[this.normalizeFileName(fileName)] = entry; }; HostCache.prototype.getEntry = function (fileName) { - return ts.lookUp(this.fileNameToEntry, ts.normalizeSlashes(fileName)); + return ts.lookUp(this.fileNameToEntry, this.normalizeFileName(fileName)); }; HostCache.prototype.contains = function (fileName) { - return ts.hasProperty(this.fileNameToEntry, ts.normalizeSlashes(fileName)); + return ts.hasProperty(this.fileNameToEntry, this.normalizeFileName(fileName)); }; HostCache.prototype.getOrCreateEntry = function (fileName) { if (this.contains(fileName)) { @@ -31243,8 +31308,10 @@ var ts; var _this = this; var fileNames = []; ts.forEachKey(this.fileNameToEntry, function (key) { - if (ts.hasProperty(_this.fileNameToEntry, key) && _this.fileNameToEntry[key]) - fileNames.push(key); + var entry = _this.getEntry(key); + if (entry) { + fileNames.push(entry.hostFileName); + } }); return fileNames; }; @@ -31745,6 +31812,7 @@ var ts; var syntaxTreeCache = new SyntaxTreeCache(host); var ruleProvider; var program; + var lastProjectVersion; var useCaseSensitivefileNames = false; var cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken()); if (!ts.localizedDiagnosticMessages && host.getLocalizedDiagnosticMessages) { @@ -31774,7 +31842,16 @@ var ts; return ruleProvider; } function synchronizeHostData() { - var hostCache = new HostCache(host); + if (host.getProjectVersion) { + var hostProjectVersion = host.getProjectVersion(); + if (hostProjectVersion) { + if (lastProjectVersion === hostProjectVersion) { + return; + } + lastProjectVersion = hostProjectVersion; + } + } + var hostCache = new HostCache(host, getCanonicalFileName); if (programUpToDate()) { return; } @@ -31784,7 +31861,7 @@ var ts; var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, { getSourceFile: getOrCreateSourceFile, getCancellationToken: function () { return cancellationToken; }, - getCanonicalFileName: function (fileName) { return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); }, + getCanonicalFileName: getCanonicalFileName, useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; }, getNewLine: function () { return host.getNewLine ? host.getNewLine() : "\r\n"; }, getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); }, @@ -32211,12 +32288,14 @@ var ts; || containingNodeKind === 136 || containingNodeKind === 159 || containingNodeKind === 154 - || containingNodeKind === 170; + || containingNodeKind === 170 + || containingNodeKind === 143; case 16: return containingNodeKind === 158 || containingNodeKind === 136 || containingNodeKind === 159 - || containingNodeKind === 162; + || containingNodeKind === 162 + || containingNodeKind === 150; case 18: return containingNodeKind === 154; case 117: @@ -32310,6 +32389,8 @@ var ts; containingNodeKind === 151; case 20: return containingNodeKind === 152; + case 51: + return containingNodeKind === 153; case 18: return containingNodeKind === 152; case 16: @@ -32352,6 +32433,7 @@ var ts; case 104: case 70: case 110: + case 124: return true; } switch (previousToken.getText()) { @@ -32445,10 +32527,10 @@ var ts; for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { var sourceFile = _a[_i]; var nameTable = getNameTable(sourceFile); - for (var name_25 in nameTable) { - if (!allNames[name_25]) { - allNames[name_25] = name_25; - var displayName = getCompletionEntryDisplayName(name_25, target, true); + for (var name_26 in nameTable) { + if (!allNames[name_26]) { + allNames[name_26] = name_26; + var displayName = getCompletionEntryDisplayName(name_26, target, true); if (displayName) { var entry = { name: displayName, @@ -34127,17 +34209,17 @@ var ts; if (isNameOfPropertyAssignment(node)) { var objectLiteral = node.parent.parent; var contextualType = typeChecker.getContextualType(objectLiteral); - var name_26 = node.text; + var name_27 = node.text; if (contextualType) { if (contextualType.flags & 16384) { - var unionProperty = contextualType.getProperty(name_26); + var unionProperty = contextualType.getProperty(name_27); if (unionProperty) { return [unionProperty]; } else { var result_4 = []; ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name_26); + var symbol = t.getProperty(name_27); if (symbol) { result_4.push(symbol); } @@ -34146,7 +34228,7 @@ var ts; } } else { - var symbol_1 = contextualType.getProperty(name_26); + var symbol_1 = contextualType.getProperty(name_27); if (symbol_1) { return [symbol_1]; } @@ -34523,10 +34605,10 @@ var ts; var kind = triviaScanner.scan(); var end = triviaScanner.getTextPos(); var width = end - start; + if (!ts.isTrivia(kind)) { + return; + } if (ts.textSpanIntersectsWith(span, start, width)) { - if (!ts.isTrivia(kind)) { - return; - } if (ts.isComment(kind)) { pushClassification(start, width, 1); continue; diff --git a/bin/typescript.d.ts b/bin/typescript.d.ts index 3e765a33f01..bcb379ed52f 100644 --- a/bin/typescript.d.ts +++ b/bin/typescript.d.ts @@ -1379,6 +1379,7 @@ declare module "typescript" { interface LanguageServiceHost { getCompilationSettings(): CompilerOptions; getNewLine?(): string; + getProjectVersion?(): string; getScriptFileNames(): string[]; getScriptVersion(fileName: string): string; getScriptSnapshot(fileName: string): IScriptSnapshot; diff --git a/bin/typescript.js b/bin/typescript.js index ba375bc4096..4cab75bfcb6 100644 --- a/bin/typescript.js +++ b/bin/typescript.js @@ -1129,9 +1129,18 @@ var ts; return 3; return 2; } + // Per RFC 1738 'file' URI schema has the shape file:/// + // if is omitted then it is assumed that host value is 'localhost', + // however slash after the omitted is not removed. + // file:///folder1/file1 - this is a correct URI + // file://folder2/file2 - this is an incorrect URI + if (path.lastIndexOf("file:///", 0) === 0) { + return "file:///".length; + } var idx = path.indexOf('://'); - if (idx !== -1) - return idx + 3; + if (idx !== -1) { + return idx + "://".length; + } return 0; } ts.getRootLength = getRootLength; @@ -1302,10 +1311,14 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; - var supportedExtensions = [".d.ts", ".ts", ".js"]; + /** + * List of supported extensions in order of file resolution precedence. + */ + ts.supportedExtensions = [".ts", ".d.ts"]; + var extensionsToRemove = [".d.ts", ".ts", ".js"]; function removeFileExtension(path) { - for (var _i = 0; _i < supportedExtensions.length; _i++) { - var ext = supportedExtensions[_i]; + for (var _i = 0; _i < extensionsToRemove.length; _i++) { + var ext = extensionsToRemove[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); } @@ -2101,8 +2114,8 @@ var ts; Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." }, Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" }, - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourceMap' option." }, + Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option." }, Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." }, @@ -2122,7 +2135,7 @@ var ts; Watch_input_files: { code: 6005, category: ts.DiagnosticCategory.Message, key: "Watch input files." }, Redirect_output_structure_to_the_directory: { code: 6006, category: ts.DiagnosticCategory.Message, key: "Redirect output structure to the directory." }, Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: ts.DiagnosticCategory.Message, key: "Do not erase const enum declarations in generated code." }, - Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any type checking errors were reported." }, + Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any errors were reported." }, Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." }, Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." }, Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, @@ -2155,7 +2168,7 @@ var ts; Corrupted_locale_file_0: { code: 6051, category: ts.DiagnosticCategory.Error, key: "Corrupted locale file {0}." }, Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: ts.DiagnosticCategory.Message, key: "Raise error on expressions and declarations with an implied 'any' type." }, File_0_not_found: { code: 6053, category: ts.DiagnosticCategory.Error, key: "File '{0}' not found." }, - File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, + File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File '{0}' has unsupported extension. The only supported extensions are {1}." }, Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." }, Preserve_new_lines_when_emitting_code: { code: 6057, category: ts.DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." }, @@ -3978,6 +3991,18 @@ var ts; else if (ts.isBlockOrCatchScoped(node)) { bindBlockScopedVariableDeclaration(node); } + else if (ts.isParameterDeclaration(node)) { + // It is safe to walk up parent chain to find whether the node is a destructing parameter declaration + // because its parent chain has already been set up, since parents are set before descending into children. + // + // If node is a binding element in parameter declaration, we need to use ParameterExcludes. + // Using ParameterExcludes flag allows the compiler to report an error on duplicate identifiers in Parameter Declaration + // For example: + // function foo([a,a]) {} // Duplicate Identifier error + // function bar(a,a) {} // Duplicate Identifier error, parameter declaration in this case is handled in bindParameter + // // which correctly set excluded symbols + bindDeclaration(node, 1 /* FunctionScopedVariable */, 107455 /* ParameterExcludes */, false); + } else { bindDeclaration(node, 1 /* FunctionScopedVariable */, 107454 /* FunctionScopedVariableExcludes */, false); } @@ -4577,9 +4602,6 @@ var ts; case 141 /* IndexSignature */: case 143 /* FunctionType */: case 144 /* ConstructorType */: - case 163 /* FunctionExpression */: - case 164 /* ArrowFunction */: - case 201 /* FunctionDeclaration */: return true; } } @@ -5220,6 +5242,18 @@ var ts; return false; } ts.isModifier = isModifier; + function isParameterDeclaration(node) { + var root = getRootDeclaration(node); + return root.kind === 130 /* Parameter */; + } + ts.isParameterDeclaration = isParameterDeclaration; + function getRootDeclaration(node) { + while (node.kind === 153 /* BindingElement */) { + node = node.parent.parent; + } + return node; + } + ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(n) { return isFunctionLike(n) || n.kind === 206 /* ModuleDeclaration */ || n.kind === 228 /* SourceFile */; } @@ -6840,13 +6874,6 @@ var ts; return token === t && tryParse(nextTokenCanFollowModifier); } function nextTokenCanFollowModifier() { - nextToken(); - return canFollowModifier(); - } - function parseAnyContextualModifier() { - return ts.isModifier(token) && tryParse(nextTokenCanFollowContextualModifier); - } - function nextTokenCanFollowContextualModifier() { if (token === 70 /* ConstKeyword */) { // 'const' is only a modifier if followed by 'enum'. return nextToken() === 77 /* EnumKeyword */; @@ -6864,6 +6891,9 @@ var ts; nextToken(); return canFollowModifier(); } + function parseAnyContextualModifier() { + return ts.isModifier(token) && tryParse(nextTokenCanFollowModifier); + } function canFollowModifier() { return token === 18 /* OpenBracketToken */ || token === 14 /* OpenBraceToken */ @@ -11531,10 +11561,11 @@ var ts; return symbol; } } + var fileName; var sourceFile; while (true) { - var fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts"); + fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); + sourceFile = ts.forEach(ts.supportedExtensions, function (extension) { return host.getSourceFile(fileName + extension); }); if (sourceFile || isRelative) { break; } @@ -12605,14 +12636,8 @@ var ts; resolutionTargets.pop(); return resolutionResults.pop(); } - function getRootDeclaration(node) { - while (node.kind === 153 /* BindingElement */) { - node = node.parent.parent; - } - return node; - } function getDeclarationContainer(node) { - node = getRootDeclaration(node); + node = ts.getRootDeclaration(node); // Parent chain: // VaribleDeclaration -> VariableDeclarationList -> VariableStatement -> 'Declaration Container' return node.kind === 199 /* VariableDeclaration */ ? node.parent.parent.parent : node.parent; @@ -12823,7 +12848,7 @@ var ts; type = declaration.dotDotDotToken ? anyArrayType : anyType; // Report implicit any errors unless this is a private property within an ambient declaration if (reportErrors && compilerOptions.noImplicitAny) { - var root = getRootDeclaration(declaration); + var root = ts.getRootDeclaration(declaration); if (!isPrivateWithinAmbient(root) && !(root.kind === 130 /* Parameter */ && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } @@ -12945,7 +12970,15 @@ var ts; function getTypeOfAlias(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - links.type = getTypeOfSymbol(resolveAlias(symbol)); + var targetSymbol = resolveAlias(symbol); + // It only makes sense to get the type of a value symbol. If the result of resolving + // the alias is not a value, then it has no type. To get the type associated with a + // type symbol, call getDeclaredTypeOfSymbol. + // This check is important because without it, a call to getTypeOfSymbol could end + // up recursively calling getTypeOfAlias, causing a stack overflow. + links.type = targetSymbol.flags & 107455 /* Value */ + ? getTypeOfSymbol(targetSymbol) + : unknownType; } return links.type; } @@ -14021,7 +14054,17 @@ var ts; } return false; } + // Since removeSubtypes checks the subtype relation, and the subtype relation on a union + // may attempt to reduce a union, it is possible that removeSubtypes could be called + // recursively on the same set of types. The removeSubtypesStack is used to track which + // sets of types are currently undergoing subtype reduction. + var removeSubtypesStack = []; function removeSubtypes(types) { + var typeListId = getTypeListId(types); + if (removeSubtypesStack.lastIndexOf(typeListId) >= 0) { + return; + } + removeSubtypesStack.push(typeListId); var i = types.length; while (i > 0) { i--; @@ -14029,6 +14072,7 @@ var ts; types.splice(i, 1); } } + removeSubtypesStack.pop(); } function containsAnyType(types) { for (var _i = 0; _i < types.length; _i++) { @@ -15730,36 +15774,37 @@ var ts; if (!isTypeSubtypeOf(rightType, globalFunctionType)) { return type; } - // Target type is type of prototype property + var targetType; var prototypeProperty = getPropertyOfType(rightType, "prototype"); if (prototypeProperty) { - var targetType = getTypeOfSymbol(prototypeProperty); - if (targetType !== anyType) { - // Narrow to the target type if it's a subtype of the current type - if (isTypeSubtypeOf(targetType, type)) { - return targetType; - } - // If the current type is a union type, remove all constituents that aren't subtypes of the target. - if (type.flags & 16384 /* Union */) { - return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); - } + // Target type is type of the protoype property + var prototypePropertyType = getTypeOfSymbol(prototypeProperty); + if (prototypePropertyType !== anyType) { + targetType = prototypePropertyType; } } - // Target type is type of construct signature - var constructSignatures; - if (rightType.flags & 2048 /* Interface */) { - constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures; + if (!targetType) { + // Target type is type of construct signature + var constructSignatures; + if (rightType.flags & 2048 /* Interface */) { + constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures; + } + else if (rightType.flags & 32768 /* Anonymous */) { + constructSignatures = getSignaturesOfType(rightType, 1 /* Construct */); + } + if (constructSignatures && constructSignatures.length) { + targetType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); })); + } } - else if (rightType.flags & 32768 /* Anonymous */) { - constructSignatures = getSignaturesOfType(rightType, 1 /* Construct */); - } - if (constructSignatures && constructSignatures.length !== 0) { - var instanceType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); })); - // Pickup type from union types + if (targetType) { + // Narrow to the target type if it's a subtype of the current type + if (isTypeSubtypeOf(targetType, type)) { + return targetType; + } + // If the current type is a union type, remove all constituents that aren't subtypes of the target. if (type.flags & 16384 /* Union */) { - return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, instanceType); })); + return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); } - return instanceType; } return type; } @@ -19019,7 +19064,7 @@ var ts; // ambient context - no codegen impact return false; } - var root = getRootDeclaration(node); + var root = ts.getRootDeclaration(node); if (root.kind === 130 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { // just an overload - no codegen impact return false; @@ -19107,7 +19152,7 @@ var ts; // let x = 0; // symbol for this declaration will be 'symbol' // } // skip block-scoped variables and parameters - if ((ts.getCombinedNodeFlags(node) & 12288 /* BlockScoped */) !== 0 || isParameterDeclaration(node)) { + if ((ts.getCombinedNodeFlags(node) & 12288 /* BlockScoped */) !== 0 || ts.isParameterDeclaration(node)) { return; } // skip variable declarations that don't have initializers @@ -19146,15 +19191,9 @@ var ts; } } } - function isParameterDeclaration(node) { - while (node.kind === 153 /* BindingElement */) { - node = node.parent.parent; - } - return node.kind === 130 /* Parameter */; - } // Check that a parameter initializer contains no references to parameters declared to the right of itself function checkParameterInitializer(node) { - if (getRootDeclaration(node).kind !== 130 /* Parameter */) { + if (ts.getRootDeclaration(node).kind !== 130 /* Parameter */) { return; } var func = ts.getContainingFunction(node); @@ -19203,7 +19242,7 @@ var ts; ts.forEach(node.name.elements, checkSourceElement); } // For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body - if (node.initializer && getRootDeclaration(node).kind === 130 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 130 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } @@ -24263,7 +24302,7 @@ var ts; var exportSpecifiers; var exportEquals; var hasExportStars; - /** write emitted output to disk*/ + /** Write emitted output to disk */ var writeEmittedFiles = writeJavaScriptFile; var detachedCommentsInfo; var writeComment = ts.writeCommentRange; @@ -25321,7 +25360,7 @@ var ts; } return true; } - function emitListWithSpread(elements, multiLine, trailingComma) { + function emitListWithSpread(elements, alwaysCopy, multiLine, trailingComma) { var pos = 0; var group = 0; var length = elements.length; @@ -25338,6 +25377,9 @@ var ts; e = e.expression; emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; + if (pos === length && group === 0 && alwaysCopy && e.kind !== 154 /* ArrayLiteralExpression */) { + write(".slice()"); + } } else { var i = pos; @@ -25375,7 +25417,7 @@ var ts; write("]"); } else { - emitListWithSpread(elements, (node.flags & 512 /* MultiLine */) !== 0, + emitListWithSpread(elements, true, (node.flags & 512 /* MultiLine */) !== 0, /*trailingComma*/ elements.hasTrailingComma); } } @@ -25747,7 +25789,7 @@ var ts; write("void 0"); } write(", "); - emitListWithSpread(node.arguments, false, false); + emitListWithSpread(node.arguments, false, false, false); write(")"); } function emitCallExpression(node) { @@ -26451,7 +26493,8 @@ var ts; if (node.flags & 1 /* Export */) { writeLine(); emitStart(node); - if (compilerOptions.module === 4 /* System */) { + // emit call to exporter only for top level nodes + if (compilerOptions.module === 4 /* System */ && node.parent === currentSourceFile) { // emit export default as // export("default", ) write(exportFunctionForFile + "(\""); @@ -26824,13 +26867,15 @@ var ts; node.parent.kind === 228 /* SourceFile */; } function emitVariableStatement(node) { - var startIsEmitted = true; - if (!(node.flags & 1 /* Export */)) { - startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + var startIsEmitted = false; + if (node.flags & 1 /* Export */) { + if (isES6ExportedDeclaration(node)) { + // Exported ES6 module member + write("export "); + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + } } - else if (isES6ExportedDeclaration(node)) { - // Exported ES6 module member - write("export "); + else { startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); } if (startIsEmitted) { @@ -28028,15 +28073,18 @@ var ts; if (!shouldEmitEnumDeclaration(node)) { return; } - if (!(node.flags & 1 /* Export */) || isES6ExportedDeclaration(node)) { - emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); + if (!shouldHoistDeclarationInSystemJsModule(node)) { + // do not emit var if variable was already hoisted + if (!(node.flags & 1 /* Export */) || isES6ExportedDeclaration(node)) { + emitStart(node); + if (isES6ExportedDeclaration(node)) { + write("export "); + } + write("var "); + emit(node.name); + emitEnd(node); + write(";"); } - write("var "); - emit(node.name); - emitEnd(node); - write(";"); } writeLine(); emitStart(node); @@ -28058,7 +28106,8 @@ var ts; emitModuleMemberName(node); write(" = {}));"); emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.flags & 1 /* Export */) { + if (!isES6ExportedDeclaration(node) && node.flags & 1 /* Export */ && !shouldHoistDeclarationInSystemJsModule(node)) { + // do not emit var if variable was already hoisted writeLine(); emitStart(node); write("var "); @@ -28069,6 +28118,15 @@ var ts; write(";"); } if (languageVersion < 2 /* ES6 */ && node.parent === currentSourceFile) { + if (compilerOptions.module === 4 /* System */ && (node.flags & 1 /* Export */)) { + // write the call to exporter for enum + writeLine(); + write(exportFunctionForFile + "(\""); + emitDeclarationName(node); + write("\", "); + emitDeclarationName(node); + write(")"); + } emitExportMemberAssignments(node.name); } } @@ -28708,12 +28766,26 @@ var ts; if (hoistedVars) { writeLine(); write("var "); + var seen = {}; for (var i = 0; i < hoistedVars.length; ++i) { var local = hoistedVars[i]; + var name_21 = local.kind === 65 /* Identifier */ + ? local + : local.name; + if (name_21) { + // do not emit duplicate entries (in case of declaration merging) in the list of hoisted variables + var text = ts.unescapeIdentifier(name_21.text); + if (ts.hasProperty(seen, text)) { + continue; + } + else { + seen[text] = text; + } + } if (i !== 0) { write(", "); } - if (local.kind === 202 /* ClassDeclaration */ || local.kind === 206 /* ModuleDeclaration */) { + if (local.kind === 202 /* ClassDeclaration */ || local.kind === 206 /* ModuleDeclaration */ || local.kind === 205 /* EnumDeclaration */) { emitDeclarationName(local); } else { @@ -28744,6 +28816,9 @@ var ts; } return exportedDeclarations; function visit(node) { + if (node.flags & 2 /* Ambient */) { + return; + } if (node.kind === 201 /* FunctionDeclaration */) { if (!hoistedFunctionDeclarations) { hoistedFunctionDeclarations = []; @@ -28752,31 +28827,41 @@ var ts; return; } if (node.kind === 202 /* ClassDeclaration */) { - // TODO: rename block scoped classes if (!hoistedVars) { hoistedVars = []; } hoistedVars.push(node); return; } - if (node.kind === 206 /* ModuleDeclaration */ && shouldEmitModuleDeclaration(node)) { - if (!hoistedVars) { - hoistedVars = []; + if (node.kind === 205 /* EnumDeclaration */) { + if (shouldEmitEnumDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + } + return; + } + if (node.kind === 206 /* ModuleDeclaration */) { + if (shouldEmitModuleDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); } - hoistedVars.push(node); return; } if (node.kind === 199 /* VariableDeclaration */ || node.kind === 153 /* BindingElement */) { if (shouldHoistVariable(node, false)) { - var name_21 = node.name; - if (name_21.kind === 65 /* Identifier */) { + var name_22 = node.name; + if (name_22.kind === 65 /* Identifier */) { if (!hoistedVars) { hoistedVars = []; } - hoistedVars.push(name_21); + hoistedVars.push(name_22); } else { - ts.forEachChild(name_21, visit); + ts.forEachChild(name_22, visit); } } return; @@ -29571,7 +29656,7 @@ var ts; /* @internal */ ts.ioReadTime = 0; /* @internal */ ts.ioWriteTime = 0; /** The version of the TypeScript compiler release */ - ts.version = "1.5.0"; + ts.version = "1.5.2"; var carriageReturnLineFeed = "\r\n"; var lineFeed = "\n"; function findConfigFile(searchPath) { @@ -29755,14 +29840,19 @@ var ts; // Create the emit resolver outside of the "emitTime" tracking code below. That way // any cost associated with it (like type checking) are appropriate associated with // the type-checking counter. - var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile); + // + // If the -out option is specified, we should not pass the source file to getEmitResolver. + // This is because in the -out scenario all files need to be emitted, and therefore all + // files need to be type checked. And the way to specify that all files need to be type + // checked is to not pass the file to getEmitResolver. + var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(options.out ? undefined : sourceFile); var start = new Date().getTime(); var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile); ts.emitTime += new Date().getTime() - start; return emitResult; } function getSourceFile(fileName) { - fileName = host.getCanonicalFileName(fileName); + fileName = host.getCanonicalFileName(ts.normalizeSlashes(fileName)); return ts.hasProperty(filesByName, fileName) ? filesByName[fileName] : undefined; } function getDiagnosticsHelper(sourceFile, getDiagnostics) { @@ -29819,43 +29909,50 @@ var ts; function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { var start; var length; + var extensions; + var diagnosticArgument; if (refEnd !== undefined && refPos !== undefined) { start = refPos; length = refEnd - refPos; } var diagnostic; if (hasExtension(fileName)) { - if (!options.allowNonTsExtensions && !ts.fileExtensionIs(host.getCanonicalFileName(fileName), ".ts")) { - diagnostic = ts.Diagnostics.File_0_must_have_extension_ts_or_d_ts; + if (!options.allowNonTsExtensions && !ts.forEach(ts.supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) { + diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1; + diagnosticArgument = [fileName, "'" + ts.supportedExtensions.join("', '") + "'"]; } else if (!findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; + diagnosticArgument = [fileName]; } else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) { diagnostic = ts.Diagnostics.A_file_cannot_have_a_reference_to_itself; + diagnosticArgument = [fileName]; } } else { if (options.allowNonTsExtensions && !findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; + diagnosticArgument = [fileName]; } - else if (!findSourceFile(fileName + ".ts", isDefaultLib, refFile, refPos, refEnd) && !findSourceFile(fileName + ".d.ts", isDefaultLib, refFile, refPos, refEnd)) { + else if (!ts.forEach(ts.supportedExtensions, function (extension) { return findSourceFile(fileName + extension, isDefaultLib, refFile, refPos, refEnd); })) { diagnostic = ts.Diagnostics.File_0_not_found; fileName += ".ts"; + diagnosticArgument = [fileName]; } } if (diagnostic) { if (refFile) { - diagnostics.add(ts.createFileDiagnostic(refFile, start, length, diagnostic, fileName)); + diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, start, length, diagnostic].concat(diagnosticArgument))); } else { - diagnostics.add(ts.createCompilerDiagnostic(diagnostic, fileName)); + diagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument))); } } } // Get source file from normalized fileName function findSourceFile(fileName, isDefaultLib, refFile, refStart, refLength) { - var canonicalName = host.getCanonicalFileName(fileName); + var canonicalName = host.getCanonicalFileName(ts.normalizeSlashes(fileName)); if (ts.hasProperty(filesByName, canonicalName)) { // We've already looked for this file, use cached result return getSourceFileFromCache(fileName, canonicalName, false); @@ -29918,9 +30015,10 @@ var ts; var moduleNameText = moduleNameExpr.text; if (moduleNameText) { var searchPath = basePath; + var searchName; while (true) { - var searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText)); - if (findModuleSourceFile(searchName + ".ts", moduleNameExpr) || findModuleSourceFile(searchName + ".d.ts", moduleNameExpr)) { + searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText)); + if (ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, moduleNameExpr); })) { break; } var parentPath = ts.getDirectoryPath(searchPath); @@ -29948,10 +30046,7 @@ var ts; // An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules // only through top - level external module names. Relative external module names are not permitted. var searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); - var tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral); - if (!tsFile) { - findModuleSourceFile(searchName + ".d.ts", nameLiteral); - } + ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, nameLiteral); }); } } }); @@ -30046,10 +30141,10 @@ var ts; if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { // Error to specify --mapRoot or --sourceRoot without mapSourceFiles if (options.mapRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option)); } if (options.sourceRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option)); } return; } @@ -30197,7 +30292,7 @@ var ts; { name: "noEmitOnError", type: "boolean", - description: ts.Diagnostics.Do_not_emit_outputs_if_any_type_checking_errors_were_reported + description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported }, { name: "noImplicitAny", @@ -30684,12 +30779,12 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_22 in nameToDeclarations) { - var declarations = ts.getProperty(nameToDeclarations, name_22); + for (var name_23 in nameToDeclarations) { + var declarations = ts.getProperty(nameToDeclarations, name_23); if (declarations) { // First do a quick check to see if the name of the declaration matches the // last portion of the (possibly) dotted name they're searching for. - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_22); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_23); if (!matches) { continue; } @@ -30702,14 +30797,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_22); + matches = patternMatcher.getMatches(containers, name_23); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_22, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_23, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -31092,9 +31187,9 @@ var ts; case 199 /* VariableDeclaration */: case 153 /* BindingElement */: var variableDeclarationNode; - var name_23; + var name_24; if (node.kind === 153 /* BindingElement */) { - name_23 = node.name; + name_24 = node.name; variableDeclarationNode = node; // binding elements are added only for variable declarations // bubble up to the containing variable declaration @@ -31106,16 +31201,16 @@ var ts; else { ts.Debug.assert(!ts.isBindingPattern(node.name)); variableDeclarationNode = node; - name_23 = node.name; + name_24 = node.name; } if (ts.isConst(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.constElement); + return createItem(node, getTextOfNode(name_24), ts.ScriptElementKind.constElement); } else if (ts.isLet(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.letElement); + return createItem(node, getTextOfNode(name_24), ts.ScriptElementKind.letElement); } else { - return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.variableElement); + return createItem(node, getTextOfNode(name_24), ts.ScriptElementKind.variableElement); } case 136 /* Constructor */: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); @@ -33702,9 +33797,9 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_24 in o) { - if (o[name_24] === rule) { - return name_24; + for (var name_25 in o) { + if (o[name_25] === rule) { + return name_25; } } throw new Error("Unknown rule"); @@ -36487,8 +36582,9 @@ var ts; // at each language service public entry point, since we don't know when // set of scripts handled by the host changes. var HostCache = (function () { - function HostCache(host) { + function HostCache(host, getCanonicalFileName) { this.host = host; + this.getCanonicalFileName = getCanonicalFileName; // script id => script index this.fileNameToEntry = {}; // Initialize the list with the root file names @@ -36503,6 +36599,9 @@ var ts; HostCache.prototype.compilationSettings = function () { return this._compilationSettings; }; + HostCache.prototype.normalizeFileName = function (fileName) { + return this.getCanonicalFileName(ts.normalizeSlashes(fileName)); + }; HostCache.prototype.createEntry = function (fileName) { var entry; var scriptSnapshot = this.host.getScriptSnapshot(fileName); @@ -36513,13 +36612,13 @@ var ts; scriptSnapshot: scriptSnapshot }; } - return this.fileNameToEntry[ts.normalizeSlashes(fileName)] = entry; + return this.fileNameToEntry[this.normalizeFileName(fileName)] = entry; }; HostCache.prototype.getEntry = function (fileName) { - return ts.lookUp(this.fileNameToEntry, ts.normalizeSlashes(fileName)); + return ts.lookUp(this.fileNameToEntry, this.normalizeFileName(fileName)); }; HostCache.prototype.contains = function (fileName) { - return ts.hasProperty(this.fileNameToEntry, ts.normalizeSlashes(fileName)); + return ts.hasProperty(this.fileNameToEntry, this.normalizeFileName(fileName)); }; HostCache.prototype.getOrCreateEntry = function (fileName) { if (this.contains(fileName)) { @@ -36531,8 +36630,10 @@ var ts; var _this = this; var fileNames = []; ts.forEachKey(this.fileNameToEntry, function (key) { - if (ts.hasProperty(_this.fileNameToEntry, key) && _this.fileNameToEntry[key]) - fileNames.push(key); + var entry = _this.getEntry(key); + if (entry) { + fileNames.push(entry.hostFileName); + } }); return fileNames; }; @@ -37119,6 +37220,7 @@ var ts; var syntaxTreeCache = new SyntaxTreeCache(host); var ruleProvider; var program; + var lastProjectVersion; var useCaseSensitivefileNames = false; var cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken()); // Check if the localized messages json is set, otherwise query the host for it @@ -37150,8 +37252,18 @@ var ts; return ruleProvider; } function synchronizeHostData() { + // perform fast check if host supports it + if (host.getProjectVersion) { + var hostProjectVersion = host.getProjectVersion(); + if (hostProjectVersion) { + if (lastProjectVersion === hostProjectVersion) { + return; + } + lastProjectVersion = hostProjectVersion; + } + } // Get a fresh cache of the host information - var hostCache = new HostCache(host); + var hostCache = new HostCache(host, getCanonicalFileName); // If the program is already up-to-date, we can reuse it if (programUpToDate()) { return; @@ -37168,7 +37280,7 @@ var ts; var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, { getSourceFile: getOrCreateSourceFile, getCancellationToken: function () { return cancellationToken; }, - getCanonicalFileName: function (fileName) { return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); }, + getCanonicalFileName: getCanonicalFileName, useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; }, getNewLine: function () { return host.getNewLine ? host.getNewLine() : "\r\n"; }, getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); }, @@ -37706,12 +37818,14 @@ var ts; || containingNodeKind === 136 /* Constructor */ // constructor( a, | public, protected, private keywords are allowed here, so show completion || containingNodeKind === 159 /* NewExpression */ // new C(a, | || containingNodeKind === 154 /* ArrayLiteralExpression */ // [a, | - || containingNodeKind === 170 /* BinaryExpression */; // let x = (a, | + || containingNodeKind === 170 /* BinaryExpression */ // let x = (a, | + || containingNodeKind === 143 /* FunctionType */; // var x: (s: string, list| case 16 /* OpenParenToken */: return containingNodeKind === 158 /* CallExpression */ // func( | || containingNodeKind === 136 /* Constructor */ // constructor( | || containingNodeKind === 159 /* NewExpression */ // new C(a| - || containingNodeKind === 162 /* ParenthesizedExpression */; // let x = (a| + || containingNodeKind === 162 /* ParenthesizedExpression */ // let x = (a| + || containingNodeKind === 150 /* ParenthesizedType */; // function F(pred: (a| this can become an arrow function, where 'a' is the argument case 18 /* OpenBracketToken */: return containingNodeKind === 154 /* ArrayLiteralExpression */; // [ | case 117 /* ModuleKeyword */: // module | @@ -37808,8 +37922,10 @@ var ts; containingNodeKind === 151 /* ObjectBindingPattern */; // function func({ x, y| case 20 /* DotToken */: return containingNodeKind === 152 /* ArrayBindingPattern */; // var [.| + case 51 /* ColonToken */: + return containingNodeKind === 153 /* BindingElement */; // var {x :html| case 18 /* OpenBracketToken */: - return containingNodeKind === 152 /* ArrayBindingPattern */; // var [x| + return containingNodeKind === 152 /* ArrayBindingPattern */; // var [x| case 16 /* OpenParenToken */: return containingNodeKind === 224 /* CatchClause */ || isFunction(containingNodeKind); @@ -37822,7 +37938,7 @@ var ts; return containingNodeKind === 132 /* PropertySignature */ && previousToken.parent && previousToken.parent.parent && (previousToken.parent.parent.kind === 203 /* InterfaceDeclaration */ || - previousToken.parent.parent.kind === 146 /* TypeLiteral */); // let x : { a; | + previousToken.parent.parent.kind === 146 /* TypeLiteral */); // let x : { a; | case 24 /* LessThanToken */: return containingNodeKind === 202 /* ClassDeclaration */ || containingNodeKind === 201 /* FunctionDeclaration */ || @@ -37834,7 +37950,7 @@ var ts; return containingNodeKind === 130 /* Parameter */ || containingNodeKind === 136 /* Constructor */ || (previousToken.parent && previousToken.parent.parent && - previousToken.parent.parent.kind === 152 /* ArrayBindingPattern */); // var [ ...z| + previousToken.parent.parent.kind === 152 /* ArrayBindingPattern */); // var [...z| case 108 /* PublicKeyword */: case 106 /* PrivateKeyword */: case 107 /* ProtectedKeyword */: @@ -37850,6 +37966,7 @@ var ts; case 104 /* LetKeyword */: case 70 /* ConstKeyword */: case 110 /* YieldKeyword */: + case 124 /* TypeKeyword */: return true; } // Previous token may have been a keyword that was converted to an identifier. @@ -37948,10 +38065,10 @@ var ts; for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { var sourceFile = _a[_i]; var nameTable = getNameTable(sourceFile); - for (var name_25 in nameTable) { - if (!allNames[name_25]) { - allNames[name_25] = name_25; - var displayName = getCompletionEntryDisplayName(name_25, target, true); + for (var name_26 in nameTable) { + if (!allNames[name_26]) { + allNames[name_26] = name_26; + var displayName = getCompletionEntryDisplayName(name_26, target, true); if (displayName) { var entry = { name: displayName, @@ -39833,19 +39950,19 @@ var ts; if (isNameOfPropertyAssignment(node)) { var objectLiteral = node.parent.parent; var contextualType = typeChecker.getContextualType(objectLiteral); - var name_26 = node.text; + var name_27 = node.text; if (contextualType) { if (contextualType.flags & 16384 /* Union */) { // This is a union type, first see if the property we are looking for is a union property (i.e. exists in all types) // if not, search the constituent types for the property - var unionProperty = contextualType.getProperty(name_26); + var unionProperty = contextualType.getProperty(name_27); if (unionProperty) { return [unionProperty]; } else { var result_4 = []; ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name_26); + var symbol = t.getProperty(name_27); if (symbol) { result_4.push(symbol); } @@ -39854,7 +39971,7 @@ var ts; } } else { - var symbol_1 = contextualType.getProperty(name_26); + var symbol_1 = contextualType.getProperty(name_27); if (symbol_1) { return [symbol_1]; } @@ -40274,10 +40391,12 @@ var ts; var kind = triviaScanner.scan(); var end = triviaScanner.getTextPos(); var width = end - start; + // The moment we get something that isn't trivia, then stop processing. + if (!ts.isTrivia(kind)) { + return; + } + // Only bother with the trivia if it at least intersects the span of interest. if (ts.textSpanIntersectsWith(span, start, width)) { - if (!ts.isTrivia(kind)) { - return; - } if (ts.isComment(kind)) { // Simple comment. Just add as is. pushClassification(start, width, 1 /* comment */); @@ -41720,6 +41839,13 @@ var ts; LanguageServiceShimHostAdapter.prototype.error = function (s) { this.shimHost.error(s); }; + LanguageServiceShimHostAdapter.prototype.getProjectVersion = function () { + if (!this.shimHost.getProjectVersion) { + // shimmed host does not support getProjectVersion + return undefined; + } + return this.shimHost.getProjectVersion(); + }; LanguageServiceShimHostAdapter.prototype.getCompilationSettings = function () { var settingsJson = this.shimHost.getCompilationSettings(); if (settingsJson == null || settingsJson == "") { @@ -42232,7 +42358,7 @@ var ts; return { options: configFile.options, files: configFile.fileNames, - errors: [realizeDiagnostics(configFile.errors, '\r\n')] + errors: realizeDiagnostics(configFile.errors, '\r\n') }; }); }; diff --git a/bin/typescriptServices.d.ts b/bin/typescriptServices.d.ts index 3114c56b789..f03a7a00e46 100644 --- a/bin/typescriptServices.d.ts +++ b/bin/typescriptServices.d.ts @@ -1379,6 +1379,7 @@ declare module ts { interface LanguageServiceHost { getCompilationSettings(): CompilerOptions; getNewLine?(): string; + getProjectVersion?(): string; getScriptFileNames(): string[]; getScriptVersion(fileName: string): string; getScriptSnapshot(fileName: string): IScriptSnapshot; diff --git a/bin/typescriptServices.js b/bin/typescriptServices.js index ba375bc4096..4cab75bfcb6 100644 --- a/bin/typescriptServices.js +++ b/bin/typescriptServices.js @@ -1129,9 +1129,18 @@ var ts; return 3; return 2; } + // Per RFC 1738 'file' URI schema has the shape file:/// + // if is omitted then it is assumed that host value is 'localhost', + // however slash after the omitted is not removed. + // file:///folder1/file1 - this is a correct URI + // file://folder2/file2 - this is an incorrect URI + if (path.lastIndexOf("file:///", 0) === 0) { + return "file:///".length; + } var idx = path.indexOf('://'); - if (idx !== -1) - return idx + 3; + if (idx !== -1) { + return idx + "://".length; + } return 0; } ts.getRootLength = getRootLength; @@ -1302,10 +1311,14 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; - var supportedExtensions = [".d.ts", ".ts", ".js"]; + /** + * List of supported extensions in order of file resolution precedence. + */ + ts.supportedExtensions = [".ts", ".d.ts"]; + var extensionsToRemove = [".d.ts", ".ts", ".js"]; function removeFileExtension(path) { - for (var _i = 0; _i < supportedExtensions.length; _i++) { - var ext = supportedExtensions[_i]; + for (var _i = 0; _i < extensionsToRemove.length; _i++) { + var ext = extensionsToRemove[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); } @@ -2101,8 +2114,8 @@ var ts; Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." }, Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" }, - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourceMap' option." }, + Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option." }, Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." }, @@ -2122,7 +2135,7 @@ var ts; Watch_input_files: { code: 6005, category: ts.DiagnosticCategory.Message, key: "Watch input files." }, Redirect_output_structure_to_the_directory: { code: 6006, category: ts.DiagnosticCategory.Message, key: "Redirect output structure to the directory." }, Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: ts.DiagnosticCategory.Message, key: "Do not erase const enum declarations in generated code." }, - Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any type checking errors were reported." }, + Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any errors were reported." }, Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." }, Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." }, Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, @@ -2155,7 +2168,7 @@ var ts; Corrupted_locale_file_0: { code: 6051, category: ts.DiagnosticCategory.Error, key: "Corrupted locale file {0}." }, Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: ts.DiagnosticCategory.Message, key: "Raise error on expressions and declarations with an implied 'any' type." }, File_0_not_found: { code: 6053, category: ts.DiagnosticCategory.Error, key: "File '{0}' not found." }, - File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, + File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File '{0}' has unsupported extension. The only supported extensions are {1}." }, Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." }, Preserve_new_lines_when_emitting_code: { code: 6057, category: ts.DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." }, @@ -3978,6 +3991,18 @@ var ts; else if (ts.isBlockOrCatchScoped(node)) { bindBlockScopedVariableDeclaration(node); } + else if (ts.isParameterDeclaration(node)) { + // It is safe to walk up parent chain to find whether the node is a destructing parameter declaration + // because its parent chain has already been set up, since parents are set before descending into children. + // + // If node is a binding element in parameter declaration, we need to use ParameterExcludes. + // Using ParameterExcludes flag allows the compiler to report an error on duplicate identifiers in Parameter Declaration + // For example: + // function foo([a,a]) {} // Duplicate Identifier error + // function bar(a,a) {} // Duplicate Identifier error, parameter declaration in this case is handled in bindParameter + // // which correctly set excluded symbols + bindDeclaration(node, 1 /* FunctionScopedVariable */, 107455 /* ParameterExcludes */, false); + } else { bindDeclaration(node, 1 /* FunctionScopedVariable */, 107454 /* FunctionScopedVariableExcludes */, false); } @@ -4577,9 +4602,6 @@ var ts; case 141 /* IndexSignature */: case 143 /* FunctionType */: case 144 /* ConstructorType */: - case 163 /* FunctionExpression */: - case 164 /* ArrowFunction */: - case 201 /* FunctionDeclaration */: return true; } } @@ -5220,6 +5242,18 @@ var ts; return false; } ts.isModifier = isModifier; + function isParameterDeclaration(node) { + var root = getRootDeclaration(node); + return root.kind === 130 /* Parameter */; + } + ts.isParameterDeclaration = isParameterDeclaration; + function getRootDeclaration(node) { + while (node.kind === 153 /* BindingElement */) { + node = node.parent.parent; + } + return node; + } + ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(n) { return isFunctionLike(n) || n.kind === 206 /* ModuleDeclaration */ || n.kind === 228 /* SourceFile */; } @@ -6840,13 +6874,6 @@ var ts; return token === t && tryParse(nextTokenCanFollowModifier); } function nextTokenCanFollowModifier() { - nextToken(); - return canFollowModifier(); - } - function parseAnyContextualModifier() { - return ts.isModifier(token) && tryParse(nextTokenCanFollowContextualModifier); - } - function nextTokenCanFollowContextualModifier() { if (token === 70 /* ConstKeyword */) { // 'const' is only a modifier if followed by 'enum'. return nextToken() === 77 /* EnumKeyword */; @@ -6864,6 +6891,9 @@ var ts; nextToken(); return canFollowModifier(); } + function parseAnyContextualModifier() { + return ts.isModifier(token) && tryParse(nextTokenCanFollowModifier); + } function canFollowModifier() { return token === 18 /* OpenBracketToken */ || token === 14 /* OpenBraceToken */ @@ -11531,10 +11561,11 @@ var ts; return symbol; } } + var fileName; var sourceFile; while (true) { - var fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts"); + fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); + sourceFile = ts.forEach(ts.supportedExtensions, function (extension) { return host.getSourceFile(fileName + extension); }); if (sourceFile || isRelative) { break; } @@ -12605,14 +12636,8 @@ var ts; resolutionTargets.pop(); return resolutionResults.pop(); } - function getRootDeclaration(node) { - while (node.kind === 153 /* BindingElement */) { - node = node.parent.parent; - } - return node; - } function getDeclarationContainer(node) { - node = getRootDeclaration(node); + node = ts.getRootDeclaration(node); // Parent chain: // VaribleDeclaration -> VariableDeclarationList -> VariableStatement -> 'Declaration Container' return node.kind === 199 /* VariableDeclaration */ ? node.parent.parent.parent : node.parent; @@ -12823,7 +12848,7 @@ var ts; type = declaration.dotDotDotToken ? anyArrayType : anyType; // Report implicit any errors unless this is a private property within an ambient declaration if (reportErrors && compilerOptions.noImplicitAny) { - var root = getRootDeclaration(declaration); + var root = ts.getRootDeclaration(declaration); if (!isPrivateWithinAmbient(root) && !(root.kind === 130 /* Parameter */ && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } @@ -12945,7 +12970,15 @@ var ts; function getTypeOfAlias(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - links.type = getTypeOfSymbol(resolveAlias(symbol)); + var targetSymbol = resolveAlias(symbol); + // It only makes sense to get the type of a value symbol. If the result of resolving + // the alias is not a value, then it has no type. To get the type associated with a + // type symbol, call getDeclaredTypeOfSymbol. + // This check is important because without it, a call to getTypeOfSymbol could end + // up recursively calling getTypeOfAlias, causing a stack overflow. + links.type = targetSymbol.flags & 107455 /* Value */ + ? getTypeOfSymbol(targetSymbol) + : unknownType; } return links.type; } @@ -14021,7 +14054,17 @@ var ts; } return false; } + // Since removeSubtypes checks the subtype relation, and the subtype relation on a union + // may attempt to reduce a union, it is possible that removeSubtypes could be called + // recursively on the same set of types. The removeSubtypesStack is used to track which + // sets of types are currently undergoing subtype reduction. + var removeSubtypesStack = []; function removeSubtypes(types) { + var typeListId = getTypeListId(types); + if (removeSubtypesStack.lastIndexOf(typeListId) >= 0) { + return; + } + removeSubtypesStack.push(typeListId); var i = types.length; while (i > 0) { i--; @@ -14029,6 +14072,7 @@ var ts; types.splice(i, 1); } } + removeSubtypesStack.pop(); } function containsAnyType(types) { for (var _i = 0; _i < types.length; _i++) { @@ -15730,36 +15774,37 @@ var ts; if (!isTypeSubtypeOf(rightType, globalFunctionType)) { return type; } - // Target type is type of prototype property + var targetType; var prototypeProperty = getPropertyOfType(rightType, "prototype"); if (prototypeProperty) { - var targetType = getTypeOfSymbol(prototypeProperty); - if (targetType !== anyType) { - // Narrow to the target type if it's a subtype of the current type - if (isTypeSubtypeOf(targetType, type)) { - return targetType; - } - // If the current type is a union type, remove all constituents that aren't subtypes of the target. - if (type.flags & 16384 /* Union */) { - return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); - } + // Target type is type of the protoype property + var prototypePropertyType = getTypeOfSymbol(prototypeProperty); + if (prototypePropertyType !== anyType) { + targetType = prototypePropertyType; } } - // Target type is type of construct signature - var constructSignatures; - if (rightType.flags & 2048 /* Interface */) { - constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures; + if (!targetType) { + // Target type is type of construct signature + var constructSignatures; + if (rightType.flags & 2048 /* Interface */) { + constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures; + } + else if (rightType.flags & 32768 /* Anonymous */) { + constructSignatures = getSignaturesOfType(rightType, 1 /* Construct */); + } + if (constructSignatures && constructSignatures.length) { + targetType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); })); + } } - else if (rightType.flags & 32768 /* Anonymous */) { - constructSignatures = getSignaturesOfType(rightType, 1 /* Construct */); - } - if (constructSignatures && constructSignatures.length !== 0) { - var instanceType = getUnionType(ts.map(constructSignatures, function (signature) { return getReturnTypeOfSignature(getErasedSignature(signature)); })); - // Pickup type from union types + if (targetType) { + // Narrow to the target type if it's a subtype of the current type + if (isTypeSubtypeOf(targetType, type)) { + return targetType; + } + // If the current type is a union type, remove all constituents that aren't subtypes of the target. if (type.flags & 16384 /* Union */) { - return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, instanceType); })); + return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); } - return instanceType; } return type; } @@ -19019,7 +19064,7 @@ var ts; // ambient context - no codegen impact return false; } - var root = getRootDeclaration(node); + var root = ts.getRootDeclaration(node); if (root.kind === 130 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { // just an overload - no codegen impact return false; @@ -19107,7 +19152,7 @@ var ts; // let x = 0; // symbol for this declaration will be 'symbol' // } // skip block-scoped variables and parameters - if ((ts.getCombinedNodeFlags(node) & 12288 /* BlockScoped */) !== 0 || isParameterDeclaration(node)) { + if ((ts.getCombinedNodeFlags(node) & 12288 /* BlockScoped */) !== 0 || ts.isParameterDeclaration(node)) { return; } // skip variable declarations that don't have initializers @@ -19146,15 +19191,9 @@ var ts; } } } - function isParameterDeclaration(node) { - while (node.kind === 153 /* BindingElement */) { - node = node.parent.parent; - } - return node.kind === 130 /* Parameter */; - } // Check that a parameter initializer contains no references to parameters declared to the right of itself function checkParameterInitializer(node) { - if (getRootDeclaration(node).kind !== 130 /* Parameter */) { + if (ts.getRootDeclaration(node).kind !== 130 /* Parameter */) { return; } var func = ts.getContainingFunction(node); @@ -19203,7 +19242,7 @@ var ts; ts.forEach(node.name.elements, checkSourceElement); } // For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body - if (node.initializer && getRootDeclaration(node).kind === 130 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 130 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } @@ -24263,7 +24302,7 @@ var ts; var exportSpecifiers; var exportEquals; var hasExportStars; - /** write emitted output to disk*/ + /** Write emitted output to disk */ var writeEmittedFiles = writeJavaScriptFile; var detachedCommentsInfo; var writeComment = ts.writeCommentRange; @@ -25321,7 +25360,7 @@ var ts; } return true; } - function emitListWithSpread(elements, multiLine, trailingComma) { + function emitListWithSpread(elements, alwaysCopy, multiLine, trailingComma) { var pos = 0; var group = 0; var length = elements.length; @@ -25338,6 +25377,9 @@ var ts; e = e.expression; emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; + if (pos === length && group === 0 && alwaysCopy && e.kind !== 154 /* ArrayLiteralExpression */) { + write(".slice()"); + } } else { var i = pos; @@ -25375,7 +25417,7 @@ var ts; write("]"); } else { - emitListWithSpread(elements, (node.flags & 512 /* MultiLine */) !== 0, + emitListWithSpread(elements, true, (node.flags & 512 /* MultiLine */) !== 0, /*trailingComma*/ elements.hasTrailingComma); } } @@ -25747,7 +25789,7 @@ var ts; write("void 0"); } write(", "); - emitListWithSpread(node.arguments, false, false); + emitListWithSpread(node.arguments, false, false, false); write(")"); } function emitCallExpression(node) { @@ -26451,7 +26493,8 @@ var ts; if (node.flags & 1 /* Export */) { writeLine(); emitStart(node); - if (compilerOptions.module === 4 /* System */) { + // emit call to exporter only for top level nodes + if (compilerOptions.module === 4 /* System */ && node.parent === currentSourceFile) { // emit export default as // export("default", ) write(exportFunctionForFile + "(\""); @@ -26824,13 +26867,15 @@ var ts; node.parent.kind === 228 /* SourceFile */; } function emitVariableStatement(node) { - var startIsEmitted = true; - if (!(node.flags & 1 /* Export */)) { - startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + var startIsEmitted = false; + if (node.flags & 1 /* Export */) { + if (isES6ExportedDeclaration(node)) { + // Exported ES6 module member + write("export "); + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + } } - else if (isES6ExportedDeclaration(node)) { - // Exported ES6 module member - write("export "); + else { startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); } if (startIsEmitted) { @@ -28028,15 +28073,18 @@ var ts; if (!shouldEmitEnumDeclaration(node)) { return; } - if (!(node.flags & 1 /* Export */) || isES6ExportedDeclaration(node)) { - emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); + if (!shouldHoistDeclarationInSystemJsModule(node)) { + // do not emit var if variable was already hoisted + if (!(node.flags & 1 /* Export */) || isES6ExportedDeclaration(node)) { + emitStart(node); + if (isES6ExportedDeclaration(node)) { + write("export "); + } + write("var "); + emit(node.name); + emitEnd(node); + write(";"); } - write("var "); - emit(node.name); - emitEnd(node); - write(";"); } writeLine(); emitStart(node); @@ -28058,7 +28106,8 @@ var ts; emitModuleMemberName(node); write(" = {}));"); emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.flags & 1 /* Export */) { + if (!isES6ExportedDeclaration(node) && node.flags & 1 /* Export */ && !shouldHoistDeclarationInSystemJsModule(node)) { + // do not emit var if variable was already hoisted writeLine(); emitStart(node); write("var "); @@ -28069,6 +28118,15 @@ var ts; write(";"); } if (languageVersion < 2 /* ES6 */ && node.parent === currentSourceFile) { + if (compilerOptions.module === 4 /* System */ && (node.flags & 1 /* Export */)) { + // write the call to exporter for enum + writeLine(); + write(exportFunctionForFile + "(\""); + emitDeclarationName(node); + write("\", "); + emitDeclarationName(node); + write(")"); + } emitExportMemberAssignments(node.name); } } @@ -28708,12 +28766,26 @@ var ts; if (hoistedVars) { writeLine(); write("var "); + var seen = {}; for (var i = 0; i < hoistedVars.length; ++i) { var local = hoistedVars[i]; + var name_21 = local.kind === 65 /* Identifier */ + ? local + : local.name; + if (name_21) { + // do not emit duplicate entries (in case of declaration merging) in the list of hoisted variables + var text = ts.unescapeIdentifier(name_21.text); + if (ts.hasProperty(seen, text)) { + continue; + } + else { + seen[text] = text; + } + } if (i !== 0) { write(", "); } - if (local.kind === 202 /* ClassDeclaration */ || local.kind === 206 /* ModuleDeclaration */) { + if (local.kind === 202 /* ClassDeclaration */ || local.kind === 206 /* ModuleDeclaration */ || local.kind === 205 /* EnumDeclaration */) { emitDeclarationName(local); } else { @@ -28744,6 +28816,9 @@ var ts; } return exportedDeclarations; function visit(node) { + if (node.flags & 2 /* Ambient */) { + return; + } if (node.kind === 201 /* FunctionDeclaration */) { if (!hoistedFunctionDeclarations) { hoistedFunctionDeclarations = []; @@ -28752,31 +28827,41 @@ var ts; return; } if (node.kind === 202 /* ClassDeclaration */) { - // TODO: rename block scoped classes if (!hoistedVars) { hoistedVars = []; } hoistedVars.push(node); return; } - if (node.kind === 206 /* ModuleDeclaration */ && shouldEmitModuleDeclaration(node)) { - if (!hoistedVars) { - hoistedVars = []; + if (node.kind === 205 /* EnumDeclaration */) { + if (shouldEmitEnumDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + } + return; + } + if (node.kind === 206 /* ModuleDeclaration */) { + if (shouldEmitModuleDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); } - hoistedVars.push(node); return; } if (node.kind === 199 /* VariableDeclaration */ || node.kind === 153 /* BindingElement */) { if (shouldHoistVariable(node, false)) { - var name_21 = node.name; - if (name_21.kind === 65 /* Identifier */) { + var name_22 = node.name; + if (name_22.kind === 65 /* Identifier */) { if (!hoistedVars) { hoistedVars = []; } - hoistedVars.push(name_21); + hoistedVars.push(name_22); } else { - ts.forEachChild(name_21, visit); + ts.forEachChild(name_22, visit); } } return; @@ -29571,7 +29656,7 @@ var ts; /* @internal */ ts.ioReadTime = 0; /* @internal */ ts.ioWriteTime = 0; /** The version of the TypeScript compiler release */ - ts.version = "1.5.0"; + ts.version = "1.5.2"; var carriageReturnLineFeed = "\r\n"; var lineFeed = "\n"; function findConfigFile(searchPath) { @@ -29755,14 +29840,19 @@ var ts; // Create the emit resolver outside of the "emitTime" tracking code below. That way // any cost associated with it (like type checking) are appropriate associated with // the type-checking counter. - var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile); + // + // If the -out option is specified, we should not pass the source file to getEmitResolver. + // This is because in the -out scenario all files need to be emitted, and therefore all + // files need to be type checked. And the way to specify that all files need to be type + // checked is to not pass the file to getEmitResolver. + var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(options.out ? undefined : sourceFile); var start = new Date().getTime(); var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile); ts.emitTime += new Date().getTime() - start; return emitResult; } function getSourceFile(fileName) { - fileName = host.getCanonicalFileName(fileName); + fileName = host.getCanonicalFileName(ts.normalizeSlashes(fileName)); return ts.hasProperty(filesByName, fileName) ? filesByName[fileName] : undefined; } function getDiagnosticsHelper(sourceFile, getDiagnostics) { @@ -29819,43 +29909,50 @@ var ts; function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { var start; var length; + var extensions; + var diagnosticArgument; if (refEnd !== undefined && refPos !== undefined) { start = refPos; length = refEnd - refPos; } var diagnostic; if (hasExtension(fileName)) { - if (!options.allowNonTsExtensions && !ts.fileExtensionIs(host.getCanonicalFileName(fileName), ".ts")) { - diagnostic = ts.Diagnostics.File_0_must_have_extension_ts_or_d_ts; + if (!options.allowNonTsExtensions && !ts.forEach(ts.supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) { + diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1; + diagnosticArgument = [fileName, "'" + ts.supportedExtensions.join("', '") + "'"]; } else if (!findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; + diagnosticArgument = [fileName]; } else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) { diagnostic = ts.Diagnostics.A_file_cannot_have_a_reference_to_itself; + diagnosticArgument = [fileName]; } } else { if (options.allowNonTsExtensions && !findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; + diagnosticArgument = [fileName]; } - else if (!findSourceFile(fileName + ".ts", isDefaultLib, refFile, refPos, refEnd) && !findSourceFile(fileName + ".d.ts", isDefaultLib, refFile, refPos, refEnd)) { + else if (!ts.forEach(ts.supportedExtensions, function (extension) { return findSourceFile(fileName + extension, isDefaultLib, refFile, refPos, refEnd); })) { diagnostic = ts.Diagnostics.File_0_not_found; fileName += ".ts"; + diagnosticArgument = [fileName]; } } if (diagnostic) { if (refFile) { - diagnostics.add(ts.createFileDiagnostic(refFile, start, length, diagnostic, fileName)); + diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, start, length, diagnostic].concat(diagnosticArgument))); } else { - diagnostics.add(ts.createCompilerDiagnostic(diagnostic, fileName)); + diagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument))); } } } // Get source file from normalized fileName function findSourceFile(fileName, isDefaultLib, refFile, refStart, refLength) { - var canonicalName = host.getCanonicalFileName(fileName); + var canonicalName = host.getCanonicalFileName(ts.normalizeSlashes(fileName)); if (ts.hasProperty(filesByName, canonicalName)) { // We've already looked for this file, use cached result return getSourceFileFromCache(fileName, canonicalName, false); @@ -29918,9 +30015,10 @@ var ts; var moduleNameText = moduleNameExpr.text; if (moduleNameText) { var searchPath = basePath; + var searchName; while (true) { - var searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText)); - if (findModuleSourceFile(searchName + ".ts", moduleNameExpr) || findModuleSourceFile(searchName + ".d.ts", moduleNameExpr)) { + searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText)); + if (ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, moduleNameExpr); })) { break; } var parentPath = ts.getDirectoryPath(searchPath); @@ -29948,10 +30046,7 @@ var ts; // An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules // only through top - level external module names. Relative external module names are not permitted. var searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); - var tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral); - if (!tsFile) { - findModuleSourceFile(searchName + ".d.ts", nameLiteral); - } + ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, nameLiteral); }); } } }); @@ -30046,10 +30141,10 @@ var ts; if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { // Error to specify --mapRoot or --sourceRoot without mapSourceFiles if (options.mapRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option)); } if (options.sourceRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option)); } return; } @@ -30197,7 +30292,7 @@ var ts; { name: "noEmitOnError", type: "boolean", - description: ts.Diagnostics.Do_not_emit_outputs_if_any_type_checking_errors_were_reported + description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported }, { name: "noImplicitAny", @@ -30684,12 +30779,12 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_22 in nameToDeclarations) { - var declarations = ts.getProperty(nameToDeclarations, name_22); + for (var name_23 in nameToDeclarations) { + var declarations = ts.getProperty(nameToDeclarations, name_23); if (declarations) { // First do a quick check to see if the name of the declaration matches the // last portion of the (possibly) dotted name they're searching for. - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_22); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_23); if (!matches) { continue; } @@ -30702,14 +30797,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_22); + matches = patternMatcher.getMatches(containers, name_23); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_22, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_23, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -31092,9 +31187,9 @@ var ts; case 199 /* VariableDeclaration */: case 153 /* BindingElement */: var variableDeclarationNode; - var name_23; + var name_24; if (node.kind === 153 /* BindingElement */) { - name_23 = node.name; + name_24 = node.name; variableDeclarationNode = node; // binding elements are added only for variable declarations // bubble up to the containing variable declaration @@ -31106,16 +31201,16 @@ var ts; else { ts.Debug.assert(!ts.isBindingPattern(node.name)); variableDeclarationNode = node; - name_23 = node.name; + name_24 = node.name; } if (ts.isConst(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.constElement); + return createItem(node, getTextOfNode(name_24), ts.ScriptElementKind.constElement); } else if (ts.isLet(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.letElement); + return createItem(node, getTextOfNode(name_24), ts.ScriptElementKind.letElement); } else { - return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.variableElement); + return createItem(node, getTextOfNode(name_24), ts.ScriptElementKind.variableElement); } case 136 /* Constructor */: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); @@ -33702,9 +33797,9 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_24 in o) { - if (o[name_24] === rule) { - return name_24; + for (var name_25 in o) { + if (o[name_25] === rule) { + return name_25; } } throw new Error("Unknown rule"); @@ -36487,8 +36582,9 @@ var ts; // at each language service public entry point, since we don't know when // set of scripts handled by the host changes. var HostCache = (function () { - function HostCache(host) { + function HostCache(host, getCanonicalFileName) { this.host = host; + this.getCanonicalFileName = getCanonicalFileName; // script id => script index this.fileNameToEntry = {}; // Initialize the list with the root file names @@ -36503,6 +36599,9 @@ var ts; HostCache.prototype.compilationSettings = function () { return this._compilationSettings; }; + HostCache.prototype.normalizeFileName = function (fileName) { + return this.getCanonicalFileName(ts.normalizeSlashes(fileName)); + }; HostCache.prototype.createEntry = function (fileName) { var entry; var scriptSnapshot = this.host.getScriptSnapshot(fileName); @@ -36513,13 +36612,13 @@ var ts; scriptSnapshot: scriptSnapshot }; } - return this.fileNameToEntry[ts.normalizeSlashes(fileName)] = entry; + return this.fileNameToEntry[this.normalizeFileName(fileName)] = entry; }; HostCache.prototype.getEntry = function (fileName) { - return ts.lookUp(this.fileNameToEntry, ts.normalizeSlashes(fileName)); + return ts.lookUp(this.fileNameToEntry, this.normalizeFileName(fileName)); }; HostCache.prototype.contains = function (fileName) { - return ts.hasProperty(this.fileNameToEntry, ts.normalizeSlashes(fileName)); + return ts.hasProperty(this.fileNameToEntry, this.normalizeFileName(fileName)); }; HostCache.prototype.getOrCreateEntry = function (fileName) { if (this.contains(fileName)) { @@ -36531,8 +36630,10 @@ var ts; var _this = this; var fileNames = []; ts.forEachKey(this.fileNameToEntry, function (key) { - if (ts.hasProperty(_this.fileNameToEntry, key) && _this.fileNameToEntry[key]) - fileNames.push(key); + var entry = _this.getEntry(key); + if (entry) { + fileNames.push(entry.hostFileName); + } }); return fileNames; }; @@ -37119,6 +37220,7 @@ var ts; var syntaxTreeCache = new SyntaxTreeCache(host); var ruleProvider; var program; + var lastProjectVersion; var useCaseSensitivefileNames = false; var cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken()); // Check if the localized messages json is set, otherwise query the host for it @@ -37150,8 +37252,18 @@ var ts; return ruleProvider; } function synchronizeHostData() { + // perform fast check if host supports it + if (host.getProjectVersion) { + var hostProjectVersion = host.getProjectVersion(); + if (hostProjectVersion) { + if (lastProjectVersion === hostProjectVersion) { + return; + } + lastProjectVersion = hostProjectVersion; + } + } // Get a fresh cache of the host information - var hostCache = new HostCache(host); + var hostCache = new HostCache(host, getCanonicalFileName); // If the program is already up-to-date, we can reuse it if (programUpToDate()) { return; @@ -37168,7 +37280,7 @@ var ts; var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, { getSourceFile: getOrCreateSourceFile, getCancellationToken: function () { return cancellationToken; }, - getCanonicalFileName: function (fileName) { return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); }, + getCanonicalFileName: getCanonicalFileName, useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; }, getNewLine: function () { return host.getNewLine ? host.getNewLine() : "\r\n"; }, getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); }, @@ -37706,12 +37818,14 @@ var ts; || containingNodeKind === 136 /* Constructor */ // constructor( a, | public, protected, private keywords are allowed here, so show completion || containingNodeKind === 159 /* NewExpression */ // new C(a, | || containingNodeKind === 154 /* ArrayLiteralExpression */ // [a, | - || containingNodeKind === 170 /* BinaryExpression */; // let x = (a, | + || containingNodeKind === 170 /* BinaryExpression */ // let x = (a, | + || containingNodeKind === 143 /* FunctionType */; // var x: (s: string, list| case 16 /* OpenParenToken */: return containingNodeKind === 158 /* CallExpression */ // func( | || containingNodeKind === 136 /* Constructor */ // constructor( | || containingNodeKind === 159 /* NewExpression */ // new C(a| - || containingNodeKind === 162 /* ParenthesizedExpression */; // let x = (a| + || containingNodeKind === 162 /* ParenthesizedExpression */ // let x = (a| + || containingNodeKind === 150 /* ParenthesizedType */; // function F(pred: (a| this can become an arrow function, where 'a' is the argument case 18 /* OpenBracketToken */: return containingNodeKind === 154 /* ArrayLiteralExpression */; // [ | case 117 /* ModuleKeyword */: // module | @@ -37808,8 +37922,10 @@ var ts; containingNodeKind === 151 /* ObjectBindingPattern */; // function func({ x, y| case 20 /* DotToken */: return containingNodeKind === 152 /* ArrayBindingPattern */; // var [.| + case 51 /* ColonToken */: + return containingNodeKind === 153 /* BindingElement */; // var {x :html| case 18 /* OpenBracketToken */: - return containingNodeKind === 152 /* ArrayBindingPattern */; // var [x| + return containingNodeKind === 152 /* ArrayBindingPattern */; // var [x| case 16 /* OpenParenToken */: return containingNodeKind === 224 /* CatchClause */ || isFunction(containingNodeKind); @@ -37822,7 +37938,7 @@ var ts; return containingNodeKind === 132 /* PropertySignature */ && previousToken.parent && previousToken.parent.parent && (previousToken.parent.parent.kind === 203 /* InterfaceDeclaration */ || - previousToken.parent.parent.kind === 146 /* TypeLiteral */); // let x : { a; | + previousToken.parent.parent.kind === 146 /* TypeLiteral */); // let x : { a; | case 24 /* LessThanToken */: return containingNodeKind === 202 /* ClassDeclaration */ || containingNodeKind === 201 /* FunctionDeclaration */ || @@ -37834,7 +37950,7 @@ var ts; return containingNodeKind === 130 /* Parameter */ || containingNodeKind === 136 /* Constructor */ || (previousToken.parent && previousToken.parent.parent && - previousToken.parent.parent.kind === 152 /* ArrayBindingPattern */); // var [ ...z| + previousToken.parent.parent.kind === 152 /* ArrayBindingPattern */); // var [...z| case 108 /* PublicKeyword */: case 106 /* PrivateKeyword */: case 107 /* ProtectedKeyword */: @@ -37850,6 +37966,7 @@ var ts; case 104 /* LetKeyword */: case 70 /* ConstKeyword */: case 110 /* YieldKeyword */: + case 124 /* TypeKeyword */: return true; } // Previous token may have been a keyword that was converted to an identifier. @@ -37948,10 +38065,10 @@ var ts; for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { var sourceFile = _a[_i]; var nameTable = getNameTable(sourceFile); - for (var name_25 in nameTable) { - if (!allNames[name_25]) { - allNames[name_25] = name_25; - var displayName = getCompletionEntryDisplayName(name_25, target, true); + for (var name_26 in nameTable) { + if (!allNames[name_26]) { + allNames[name_26] = name_26; + var displayName = getCompletionEntryDisplayName(name_26, target, true); if (displayName) { var entry = { name: displayName, @@ -39833,19 +39950,19 @@ var ts; if (isNameOfPropertyAssignment(node)) { var objectLiteral = node.parent.parent; var contextualType = typeChecker.getContextualType(objectLiteral); - var name_26 = node.text; + var name_27 = node.text; if (contextualType) { if (contextualType.flags & 16384 /* Union */) { // This is a union type, first see if the property we are looking for is a union property (i.e. exists in all types) // if not, search the constituent types for the property - var unionProperty = contextualType.getProperty(name_26); + var unionProperty = contextualType.getProperty(name_27); if (unionProperty) { return [unionProperty]; } else { var result_4 = []; ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name_26); + var symbol = t.getProperty(name_27); if (symbol) { result_4.push(symbol); } @@ -39854,7 +39971,7 @@ var ts; } } else { - var symbol_1 = contextualType.getProperty(name_26); + var symbol_1 = contextualType.getProperty(name_27); if (symbol_1) { return [symbol_1]; } @@ -40274,10 +40391,12 @@ var ts; var kind = triviaScanner.scan(); var end = triviaScanner.getTextPos(); var width = end - start; + // The moment we get something that isn't trivia, then stop processing. + if (!ts.isTrivia(kind)) { + return; + } + // Only bother with the trivia if it at least intersects the span of interest. if (ts.textSpanIntersectsWith(span, start, width)) { - if (!ts.isTrivia(kind)) { - return; - } if (ts.isComment(kind)) { // Simple comment. Just add as is. pushClassification(start, width, 1 /* comment */); @@ -41720,6 +41839,13 @@ var ts; LanguageServiceShimHostAdapter.prototype.error = function (s) { this.shimHost.error(s); }; + LanguageServiceShimHostAdapter.prototype.getProjectVersion = function () { + if (!this.shimHost.getProjectVersion) { + // shimmed host does not support getProjectVersion + return undefined; + } + return this.shimHost.getProjectVersion(); + }; LanguageServiceShimHostAdapter.prototype.getCompilationSettings = function () { var settingsJson = this.shimHost.getCompilationSettings(); if (settingsJson == null || settingsJson == "") { @@ -42232,7 +42358,7 @@ var ts; return { options: configFile.options, files: configFile.fileNames, - errors: [realizeDiagnostics(configFile.errors, '\r\n')] + errors: realizeDiagnostics(configFile.errors, '\r\n') }; }); }; diff --git a/package.json b/package.json index c33f2a93ec1..ca137dcfb40 100644 --- a/package.json +++ b/package.json @@ -2,13 +2,8 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "http://typescriptlang.org/", - "version": "1.5.0", - "licenses": [ - { - "type": "Apache License 2.0", - "url": "https://github.com/Microsoft/TypeScript/blob/master/LICENSE.txt" - } - ], + "version": "1.5.2", + "license": "Apache-2.0", "description": "TypeScript is a language for application scale JavaScript development", "keywords": [ "TypeScript", diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 734cae63881..f5ba332364a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -88,6 +88,7 @@ module ts { let undefinedType = createIntrinsicType(TypeFlags.Undefined | TypeFlags.ContainsUndefinedOrNull, "undefined"); let nullType = createIntrinsicType(TypeFlags.Null | TypeFlags.ContainsUndefinedOrNull, "null"); let unknownType = createIntrinsicType(TypeFlags.Any, "unknown"); + let circularType = createIntrinsicType(TypeFlags.Any, "__circular__"); let emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); let anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); @@ -2418,7 +2419,16 @@ module ts { function getTypeOfAlias(symbol: Symbol): Type { let links = getSymbolLinks(symbol); if (!links.type) { - links.type = getTypeOfSymbol(resolveAlias(symbol)); + let targetSymbol = resolveAlias(symbol); + + // It only makes sense to get the type of a value symbol. If the result of resolving + // the alias is not a value, then it has no type. To get the type associated with a + // type symbol, call getDeclaredTypeOfSymbol. + // This check is important because without it, a call to getTypeOfSymbol could end + // up recursively calling getTypeOfAlias, causing a stack overflow. + links.type = targetSymbol.flags & SymbolFlags.Value + ? getTypeOfSymbol(targetSymbol) + : unknownType; } return links.type; } @@ -3642,10 +3652,20 @@ module ts { return type; } + // Subtype reduction is basically an optimization we do to avoid excessively large union types, which take longer + // to process and look strange in quick info and error messages. Semantically there is no difference between the + // reduced type and the type itself. So, when we detect a circularity we simply say that the reduced type is the + // type itself. function getReducedTypeOfUnionType(type: UnionType): Type { - // If union type was created without subtype reduction, perform the deferred reduction now if (!type.reducedType) { - type.reducedType = getUnionType(type.types, /*noSubtypeReduction*/ false); + type.reducedType = circularType; + let reducedType = getUnionType(type.types, /*noSubtypeReduction*/ false); + if (type.reducedType === circularType) { + type.reducedType = reducedType; + } + } + else if (type.reducedType === circularType) { + type.reducedType = type; } return type.reducedType; } @@ -7135,10 +7155,10 @@ module ts { } function resolveNewExpression(node: NewExpression, candidatesOutArray: Signature[]): Signature { - if (node.arguments && languageVersion < ScriptTarget.ES6) { + if (node.arguments && languageVersion < ScriptTarget.ES5) { let spreadIndex = getSpreadArgumentIndex(node.arguments); if (spreadIndex >= 0) { - error(node.arguments[spreadIndex], Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher); + error(node.arguments[spreadIndex], Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher); } } @@ -7156,7 +7176,7 @@ module ts { // If ConstructExpr's apparent type(section 3.8.1) is an object type with one or // more construct signatures, the expression is processed in the same manner as a // function call, but using the construct signatures as the initial set of candidate - // signatures for overload resolution.The result type of the function call becomes + // signatures for overload resolution. The result type of the function call becomes // the result type of the operation. expressionType = getApparentType(expressionType); if (expressionType === unknownType) { @@ -11301,6 +11321,7 @@ module ts { break; case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: + forEach(node.decorators, checkFunctionExpressionBodies); forEach((node).parameters, checkFunctionExpressionBodies); if (isObjectLiteralMethod(node)) { checkFunctionExpressionOrObjectLiteralMethodBody(node); @@ -11315,6 +11336,7 @@ module ts { case SyntaxKind.WithStatement: checkFunctionExpressionBodies((node).expression); break; + case SyntaxKind.Decorator: case SyntaxKind.Parameter: case SyntaxKind.PropertyDeclaration: case SyntaxKind.PropertySignature: @@ -12818,9 +12840,6 @@ module ts { else if ((node.kind === SyntaxKind.ImportDeclaration || node.kind === SyntaxKind.ImportEqualsDeclaration) && flags & NodeFlags.Ambient) { return grammarErrorOnNode(lastDeclare, Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === SyntaxKind.InterfaceDeclaration && flags & NodeFlags.Ambient) { - return grammarErrorOnNode(lastDeclare, Diagnostics.A_0_modifier_cannot_be_used_with_an_interface_declaration, "declare"); - } else if (node.kind === SyntaxKind.Parameter && (flags & NodeFlags.AccessibilityModifier) && isBindingPattern((node).name)) { return grammarErrorOnNode(node, Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 9fe9747fb57..ef7c892be9d 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -459,8 +459,18 @@ module ts { if (path.charCodeAt(2) === CharacterCodes.slash) return 3; return 2; } + // Per RFC 1738 'file' URI schema has the shape file:/// + // if is omitted then it is assumed that host value is 'localhost', + // however slash after the omitted is not removed. + // file:///folder1/file1 - this is a correct URI + // file://folder2/file2 - this is an incorrect URI + if (path.lastIndexOf("file:///", 0) === 0) { + return "file:///".length; + } let idx = path.indexOf('://'); - if (idx !== -1) return idx + 3 + if (idx !== -1) { + return idx + "://".length; + } return 0; } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 6469bf8b1bb..0981bed5170 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -345,7 +345,7 @@ module ts { The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: DiagnosticCategory.Error, key: "The '{0}' operator cannot be applied to type 'symbol'." }, Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: DiagnosticCategory.Error, key: "'Symbol' reference does not refer to the global Symbol constructor object." }, A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: DiagnosticCategory.Error, key: "A computed property name of the form '{0}' must be of type 'symbol'." }, - Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2472, category: DiagnosticCategory.Error, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." }, + Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher: { code: 2472, category: DiagnosticCategory.Error, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher." }, Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: DiagnosticCategory.Error, key: "Enum declarations must all be const or non-const." }, In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: DiagnosticCategory.Error, key: "In 'const' enum declarations member initializer must be constant expression." }, const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: DiagnosticCategory.Error, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index b1e8f565790..87fa6694c7c 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1369,7 +1369,7 @@ "category": "Error", "code": 2471 }, - "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher.": { + "Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher.": { "category": "Error", "code": 2472 }, diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 567d4420896..e911cf246ec 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -155,7 +155,7 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) { let exportEquals: ExportAssignment; let hasExportStars: boolean; - /** write emitted output to disk*/ + /** Write emitted output to disk */ let writeEmittedFiles = writeJavaScriptFile; let detachedCommentsInfo: { nodePos: number; detachedCommentEndPos: number }[]; @@ -1406,16 +1406,16 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) { return true; } - function emitListWithSpread(elements: Expression[], alwaysCopy: boolean, multiLine: boolean, trailingComma: boolean) { + function emitListWithSpread(elements: Expression[], needsUniqueCopy: boolean, multiLine: boolean, trailingComma: boolean, useConcat: boolean) { let pos = 0; let group = 0; let length = elements.length; while (pos < length) { // Emit using the pattern .concat(, , ...) - if (group === 1) { + if (group === 1 && useConcat) { write(".concat("); } - else if (group > 1) { + else if (group > 0) { write(", "); } let e = elements[pos]; @@ -1423,7 +1423,7 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) { e = (e).expression; emitParenthesizedIf(e, /*parenthesized*/ group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; - if (pos === length && group === 0 && alwaysCopy && e.kind !== SyntaxKind.ArrayLiteralExpression) { + if (pos === length && group === 0 && needsUniqueCopy && e.kind !== SyntaxKind.ArrayLiteralExpression) { write(".slice()"); } } @@ -1446,7 +1446,9 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) { group++; } if (group > 1) { - write(")"); + if(useConcat) { + write(")"); + } } } @@ -1465,8 +1467,8 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) { write("]"); } else { - emitListWithSpread(elements, /*alwaysCopy*/ true, /*multiLine*/(node.flags & NodeFlags.MultiLine) !== 0, - /*trailingComma*/ elements.hasTrailingComma); + emitListWithSpread(elements, /*needsUniqueCopy*/ true, /*multiLine*/(node.flags & NodeFlags.MultiLine) !== 0, + /*trailingComma*/ elements.hasTrailingComma, /*useConcat*/ true); } } @@ -1890,7 +1892,7 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) { write("void 0"); } write(", "); - emitListWithSpread(node.arguments, /*alwaysCopy*/ false, /*multiLine*/ false, /*trailingComma*/ false); + emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*trailingComma*/ false, /*useConcat*/ true); write(")"); } @@ -1926,11 +1928,44 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) { function emitNewExpression(node: NewExpression) { write("new "); - emit(node.expression); - if (node.arguments) { + + // Spread operator logic can be supported in new expressions in ES5 using a combination + // of Function.prototype.bind() and Function.prototype.apply(). + // + // Example: + // + // var arguments = [1, 2, 3, 4, 5]; + // new Array(...arguments); + // + // Could be transpiled into ES5: + // + // var arguments = [1, 2, 3, 4, 5]; + // new (Array.bind.apply(Array, [void 0].concat(arguments))); + // + // `[void 0]` is the first argument which represents `thisArg` to the bind method above. + // And `thisArg` will be set to the return value of the constructor when instantiated + // with the new operator — regardless of any value we set `thisArg` to. Thus, we set it + // to an undefined, `void 0`. + if (languageVersion === ScriptTarget.ES5 && + node.arguments && + hasSpreadElement(node.arguments)) { + write("("); - emitCommaList(node.arguments); - write(")"); + let target = emitCallTarget(node.expression); + write(".bind.apply("); + emit(target); + write(", [void 0].concat("); + emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiline*/ false, /*trailingComma*/ false, /*useConcat*/ false); + write(")))"); + write("()"); + } + else { + emit(node.expression); + if (node.arguments) { + write("("); + emitCommaList(node.arguments); + write(")"); + } } } @@ -2269,9 +2304,10 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) { emitEmbeddedStatement(node.statement); } - /* Returns true if start of variable declaration list was emitted. - * Return false if nothing was written - this can happen for source file level variable declarations - * in system modules - such variable declarations are hoisted. + /** + * Returns true if start of variable declaration list was emitted. + * Returns false if nothing was written - this can happen for source file level variable declarations + * in system modules where such variable declarations are hoisted. */ function tryEmitStartOfVariableDeclarationList(decl: VariableDeclarationList, startPos?: number): boolean { if (shouldHoistVariable(decl, /*checkIfSourceFileLevelDecl*/ true)) { @@ -3099,15 +3135,19 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) { } function emitVariableStatement(node: VariableStatement) { - let startIsEmitted = true; - if (!(node.flags & NodeFlags.Export)) { - startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + let startIsEmitted = false; + + if (node.flags & NodeFlags.Export) { + if (isES6ExportedDeclaration(node)) { + // Exported ES6 module member + write("export "); + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + } } - else if (isES6ExportedDeclaration(node)) { - // Exported ES6 module member - write("export "); + else { startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); } + if (startIsEmitted) { emitCommaList(node.declarationList.declarations); write(";"); @@ -3123,6 +3163,28 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) { } } + function shouldEmitLeadingAndTrailingCommentsForVariableStatement(node: VariableStatement) { + // If we're not exporting the variables, there's nothing special here. + // Always emit comments for these nodes. + if (!(node.flags & NodeFlags.Export)) { + return true; + } + + // If we are exporting, but it's a top-level ES6 module exports, + // we'll emit the declaration list verbatim, so emit comments too. + if (isES6ExportedDeclaration(node)) { + return true; + } + + // Otherwise, only emit if we have at least one initializer present. + for (let declaration of node.declarationList.declarations) { + if (declaration.initializer) { + return true; + } + } + return false; + } + function emitParameter(node: ParameterDeclaration) { if (languageVersion < ScriptTarget.ES6) { if (isBindingPattern(node.name)) { @@ -5905,6 +5967,9 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) { case SyntaxKind.ExportAssignment: return false; + case SyntaxKind.VariableStatement: + return shouldEmitLeadingAndTrailingCommentsForVariableStatement(node); + case SyntaxKind.ModuleDeclaration: // Only emit the leading/trailing comments for a module if we're actually // emitting the module as well. diff --git a/src/compiler/program.ts b/src/compiler/program.ts index f5bf44ec809..38634f1dea6 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -8,7 +8,7 @@ module ts { /* @internal */ export let ioWriteTime = 0; /** The version of the TypeScript compiler release */ - export const version = "1.5.0"; + export const version = "1.5.2"; const carriageReturnLineFeed = "\r\n"; const lineFeed = "\n"; diff --git a/src/harness/fourslashRunner.ts b/src/harness/fourslashRunner.ts index 1ab6e31cdbb..d11c5e639e5 100644 --- a/src/harness/fourslashRunner.ts +++ b/src/harness/fourslashRunner.ts @@ -35,9 +35,9 @@ class FourSlashRunner extends RunnerBase { this.tests = this.enumerateFiles(this.basePath, /\.ts/i, { recursive: false }); } - describe(this.testSuiteName, () => { this.tests.forEach((fn: string) => { - fn = ts.normalizeSlashes(fn); + describe(fn, () => { + fn = ts.normalizeSlashes(fn); var justName = fn.replace(/^.*[\\\/]/, ''); // Convert to relative path diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 9ed515eb5b6..23cdfdfb7c5 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -45,10 +45,12 @@ module Utils { export function getExecutionEnvironment() { if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { return ExecutionEnvironment.CScript; - } else if (typeof window !== "undefined") { + } + else if (typeof window !== "undefined") { return ExecutionEnvironment.Browser; - } else { - return ExecutionEnvironment.Node; + } + else { + return ExecutionEnvironment.Node; } } @@ -945,6 +947,7 @@ module Harness { options = options || { noResolve: false }; options.target = options.target || ts.ScriptTarget.ES3; options.module = options.module || ts.ModuleKind.None; + options.newLine = options.newLine || ts.NewLineKind.CarriageReturnLineFeed; options.noErrorTruncation = true; if (settingsCallback) { diff --git a/src/services/services.ts b/src/services/services.ts index 4374f3f3ea8..a6a26f0b60b 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1829,7 +1829,34 @@ module ts { if (version !== sourceFile.version) { // Once incremental parsing is ready, then just call into this function. if (!disableIncrementalParsing) { - let newSourceFile = updateSourceFile(sourceFile, scriptSnapshot.getText(0, scriptSnapshot.getLength()), textChangeRange, aggressiveChecks); + let newText: string; + + // grab the fragment from the beginning of the original text to the beginning of the span + let prefix = textChangeRange.span.start !== 0 + ? sourceFile.text.substr(0, textChangeRange.span.start) + : ""; + + // grab the fragment from the end of the span till the end of the original text + let suffix = textSpanEnd(textChangeRange.span) !== sourceFile.text.length + ? sourceFile.text.substr(textSpanEnd(textChangeRange.span)) + : ""; + + if (textChangeRange.newLength === 0) { + // edit was a deletion - just combine prefix and suffix + newText = prefix && suffix ? prefix + suffix : prefix || suffix; + } + else { + // it was actual edit, fetch the fragment of new text that correspond to new span + let changedText = scriptSnapshot.getText(textChangeRange.span.start, textChangeRange.span.start + textChangeRange.newLength); + // combine prefix, changed text and suffix + newText = prefix && suffix + ? prefix + changedText + suffix + : prefix + ? (prefix + changedText) + : (changedText + suffix); + } + + let newSourceFile = updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks); setSourceFileFields(newSourceFile, scriptSnapshot, version); // after incremental parsing nameTable might not be up-to-date // drop it so it can be lazily recreated later @@ -3039,46 +3066,47 @@ module ts { let containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case SyntaxKind.CommaToken: - return containingNodeKind === SyntaxKind.CallExpression // func( a, | - || containingNodeKind === SyntaxKind.Constructor // constructor( a, | public, protected, private keywords are allowed here, so show completion - || containingNodeKind === SyntaxKind.NewExpression // new C(a, | - || containingNodeKind === SyntaxKind.ArrayLiteralExpression // [a, | - || containingNodeKind === SyntaxKind.BinaryExpression; // let x = (a, | + return containingNodeKind === SyntaxKind.CallExpression // func( a, | + || containingNodeKind === SyntaxKind.Constructor // constructor( a, | public, protected, private keywords are allowed here, so show completion + || containingNodeKind === SyntaxKind.NewExpression // new C(a, | + || containingNodeKind === SyntaxKind.ArrayLiteralExpression // [a, | + || containingNodeKind === SyntaxKind.BinaryExpression // let x = (a, | + || containingNodeKind === SyntaxKind.FunctionType; // var x: (s: string, list| - case SyntaxKind.OpenParenToken: return containingNodeKind === SyntaxKind.CallExpression // func( | || containingNodeKind === SyntaxKind.Constructor // constructor( | || containingNodeKind === SyntaxKind.NewExpression // new C(a| - || containingNodeKind === SyntaxKind.ParenthesizedExpression; // let x = (a| + || containingNodeKind === SyntaxKind.ParenthesizedExpression // let x = (a| + || containingNodeKind === SyntaxKind.ParenthesizedType; // function F(pred: (a| this can become an arrow function, where 'a' is the argument case SyntaxKind.OpenBracketToken: - return containingNodeKind === SyntaxKind.ArrayLiteralExpression; // [ | + return containingNodeKind === SyntaxKind.ArrayLiteralExpression; // [ | - case SyntaxKind.ModuleKeyword: // module | - case SyntaxKind.NamespaceKeyword: // namespace | + case SyntaxKind.ModuleKeyword: // module | + case SyntaxKind.NamespaceKeyword: // namespace | return true; case SyntaxKind.DotToken: - return containingNodeKind === SyntaxKind.ModuleDeclaration; // module A.| + return containingNodeKind === SyntaxKind.ModuleDeclaration; // module A.| case SyntaxKind.OpenBraceToken: - return containingNodeKind === SyntaxKind.ClassDeclaration; // class A{ | + return containingNodeKind === SyntaxKind.ClassDeclaration; // class A{ | case SyntaxKind.EqualsToken: - return containingNodeKind === SyntaxKind.VariableDeclaration // let x = a| - || containingNodeKind === SyntaxKind.BinaryExpression; // x = a| + return containingNodeKind === SyntaxKind.VariableDeclaration // let x = a| + || containingNodeKind === SyntaxKind.BinaryExpression; // x = a| case SyntaxKind.TemplateHead: - return containingNodeKind === SyntaxKind.TemplateExpression; // `aa ${| + return containingNodeKind === SyntaxKind.TemplateExpression; // `aa ${| case SyntaxKind.TemplateMiddle: - return containingNodeKind === SyntaxKind.TemplateSpan; // `aa ${10} dd ${| + return containingNodeKind === SyntaxKind.TemplateSpan; // `aa ${10} dd ${| case SyntaxKind.PublicKeyword: case SyntaxKind.PrivateKeyword: case SyntaxKind.ProtectedKeyword: - return containingNodeKind === SyntaxKind.PropertyDeclaration; // class A{ public | + return containingNodeKind === SyntaxKind.PropertyDeclaration; // class A{ public | } // Previous token may have been a keyword that was converted to an identifier. @@ -3157,40 +3185,43 @@ module ts { return containingNodeKind === SyntaxKind.VariableDeclaration || containingNodeKind === SyntaxKind.VariableDeclarationList || containingNodeKind === SyntaxKind.VariableStatement || - containingNodeKind === SyntaxKind.EnumDeclaration || // enum a { foo, | + containingNodeKind === SyntaxKind.EnumDeclaration || // enum a { foo, | isFunction(containingNodeKind) || - containingNodeKind === SyntaxKind.ClassDeclaration || // class Axa[1].foo)(...[1, 2, "abc"]); - - class C { - constructor(x: number, y: number, ...z: string[]) { - this.foo(x, y); - this.foo(x, y, ...z); - } - foo(x: number, y: number, ...z: string[]) { - } - } - - class D extends C { - constructor() { - super(1, 2); - super(1, 2, ...a); - } - foo() { - super.foo(1, 2); - super.foo(1, 2, ...a); - } - } - - // Only supported in when target is ES6 - var c = new C(1, 2, ...a); - ~~~~ -!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher. - \ No newline at end of file diff --git a/tests/baselines/reference/callWithSpread.js b/tests/baselines/reference/callWithSpread.js index c9cd5d2adce..d21b4879daa 100644 --- a/tests/baselines/reference/callWithSpread.js +++ b/tests/baselines/reference/callWithSpread.js @@ -48,9 +48,6 @@ class D extends C { super.foo(1, 2, ...a); } } - -// Only supported in when target is ES6 -var c = new C(1, 2, ...a); //// [callWithSpread.js] @@ -112,6 +109,4 @@ var D = (function (_super) { }; return D; })(C); -// Only supported in when target is ES6 -var c = new C(1, 2, ...a); var _a, _b, _c; diff --git a/tests/baselines/reference/callWithSpread.symbols b/tests/baselines/reference/callWithSpread.symbols new file mode 100644 index 00000000000..c5ac7fe66b2 --- /dev/null +++ b/tests/baselines/reference/callWithSpread.symbols @@ -0,0 +1,159 @@ +=== tests/cases/conformance/expressions/functionCalls/callWithSpread.ts === +interface X { +>X : Symbol(X, Decl(callWithSpread.ts, 0, 0)) + + foo(x: number, y: number, ...z: string[]); +>foo : Symbol(foo, Decl(callWithSpread.ts, 0, 13)) +>x : Symbol(x, Decl(callWithSpread.ts, 1, 8)) +>y : Symbol(y, Decl(callWithSpread.ts, 1, 18)) +>z : Symbol(z, Decl(callWithSpread.ts, 1, 29)) +} + +function foo(x: number, y: number, ...z: string[]) { +>foo : Symbol(foo, Decl(callWithSpread.ts, 2, 1)) +>x : Symbol(x, Decl(callWithSpread.ts, 4, 13)) +>y : Symbol(y, Decl(callWithSpread.ts, 4, 23)) +>z : Symbol(z, Decl(callWithSpread.ts, 4, 34)) +} + +var a: string[]; +>a : Symbol(a, Decl(callWithSpread.ts, 7, 3)) + +var z: number[]; +>z : Symbol(z, Decl(callWithSpread.ts, 8, 3)) + +var obj: X; +>obj : Symbol(obj, Decl(callWithSpread.ts, 9, 3)) +>X : Symbol(X, Decl(callWithSpread.ts, 0, 0)) + +var xa: X[]; +>xa : Symbol(xa, Decl(callWithSpread.ts, 10, 3)) +>X : Symbol(X, Decl(callWithSpread.ts, 0, 0)) + +foo(1, 2, "abc"); +>foo : Symbol(foo, Decl(callWithSpread.ts, 2, 1)) + +foo(1, 2, ...a); +>foo : Symbol(foo, Decl(callWithSpread.ts, 2, 1)) +>a : Symbol(a, Decl(callWithSpread.ts, 7, 3)) + +foo(1, 2, ...a, "abc"); +>foo : Symbol(foo, Decl(callWithSpread.ts, 2, 1)) +>a : Symbol(a, Decl(callWithSpread.ts, 7, 3)) + +obj.foo(1, 2, "abc"); +>obj.foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13)) +>obj : Symbol(obj, Decl(callWithSpread.ts, 9, 3)) +>foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13)) + +obj.foo(1, 2, ...a); +>obj.foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13)) +>obj : Symbol(obj, Decl(callWithSpread.ts, 9, 3)) +>foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13)) +>a : Symbol(a, Decl(callWithSpread.ts, 7, 3)) + +obj.foo(1, 2, ...a, "abc"); +>obj.foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13)) +>obj : Symbol(obj, Decl(callWithSpread.ts, 9, 3)) +>foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13)) +>a : Symbol(a, Decl(callWithSpread.ts, 7, 3)) + +(obj.foo)(1, 2, "abc"); +>obj.foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13)) +>obj : Symbol(obj, Decl(callWithSpread.ts, 9, 3)) +>foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13)) + +(obj.foo)(1, 2, ...a); +>obj.foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13)) +>obj : Symbol(obj, Decl(callWithSpread.ts, 9, 3)) +>foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13)) +>a : Symbol(a, Decl(callWithSpread.ts, 7, 3)) + +(obj.foo)(1, 2, ...a, "abc"); +>obj.foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13)) +>obj : Symbol(obj, Decl(callWithSpread.ts, 9, 3)) +>foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13)) +>a : Symbol(a, Decl(callWithSpread.ts, 7, 3)) + +xa[1].foo(1, 2, "abc"); +>xa[1].foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13)) +>xa : Symbol(xa, Decl(callWithSpread.ts, 10, 3)) +>foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13)) + +xa[1].foo(1, 2, ...a); +>xa[1].foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13)) +>xa : Symbol(xa, Decl(callWithSpread.ts, 10, 3)) +>foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13)) +>a : Symbol(a, Decl(callWithSpread.ts, 7, 3)) + +xa[1].foo(1, 2, ...a, "abc"); +>xa[1].foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13)) +>xa : Symbol(xa, Decl(callWithSpread.ts, 10, 3)) +>foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13)) +>a : Symbol(a, Decl(callWithSpread.ts, 7, 3)) + +(xa[1].foo)(...[1, 2, "abc"]); +>Function : Symbol(Function, Decl(lib.d.ts, 223, 38), Decl(lib.d.ts, 269, 11)) +>xa[1].foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13)) +>xa : Symbol(xa, Decl(callWithSpread.ts, 10, 3)) +>foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13)) + +class C { +>C : Symbol(C, Decl(callWithSpread.ts, 28, 40)) + + constructor(x: number, y: number, ...z: string[]) { +>x : Symbol(x, Decl(callWithSpread.ts, 31, 16)) +>y : Symbol(y, Decl(callWithSpread.ts, 31, 26)) +>z : Symbol(z, Decl(callWithSpread.ts, 31, 37)) + + this.foo(x, y); +>this.foo : Symbol(foo, Decl(callWithSpread.ts, 34, 5)) +>this : Symbol(C, Decl(callWithSpread.ts, 28, 40)) +>foo : Symbol(foo, Decl(callWithSpread.ts, 34, 5)) +>x : Symbol(x, Decl(callWithSpread.ts, 31, 16)) +>y : Symbol(y, Decl(callWithSpread.ts, 31, 26)) + + this.foo(x, y, ...z); +>this.foo : Symbol(foo, Decl(callWithSpread.ts, 34, 5)) +>this : Symbol(C, Decl(callWithSpread.ts, 28, 40)) +>foo : Symbol(foo, Decl(callWithSpread.ts, 34, 5)) +>x : Symbol(x, Decl(callWithSpread.ts, 31, 16)) +>y : Symbol(y, Decl(callWithSpread.ts, 31, 26)) +>z : Symbol(z, Decl(callWithSpread.ts, 31, 37)) + } + foo(x: number, y: number, ...z: string[]) { +>foo : Symbol(foo, Decl(callWithSpread.ts, 34, 5)) +>x : Symbol(x, Decl(callWithSpread.ts, 35, 8)) +>y : Symbol(y, Decl(callWithSpread.ts, 35, 18)) +>z : Symbol(z, Decl(callWithSpread.ts, 35, 29)) + } +} + +class D extends C { +>D : Symbol(D, Decl(callWithSpread.ts, 37, 1)) +>C : Symbol(C, Decl(callWithSpread.ts, 28, 40)) + + constructor() { + super(1, 2); +>super : Symbol(C, Decl(callWithSpread.ts, 28, 40)) + + super(1, 2, ...a); +>super : Symbol(C, Decl(callWithSpread.ts, 28, 40)) +>a : Symbol(a, Decl(callWithSpread.ts, 7, 3)) + } + foo() { +>foo : Symbol(foo, Decl(callWithSpread.ts, 43, 5)) + + super.foo(1, 2); +>super.foo : Symbol(C.foo, Decl(callWithSpread.ts, 34, 5)) +>super : Symbol(C, Decl(callWithSpread.ts, 28, 40)) +>foo : Symbol(C.foo, Decl(callWithSpread.ts, 34, 5)) + + super.foo(1, 2, ...a); +>super.foo : Symbol(C.foo, Decl(callWithSpread.ts, 34, 5)) +>super : Symbol(C, Decl(callWithSpread.ts, 28, 40)) +>foo : Symbol(C.foo, Decl(callWithSpread.ts, 34, 5)) +>a : Symbol(a, Decl(callWithSpread.ts, 7, 3)) + } +} + diff --git a/tests/baselines/reference/callWithSpread.types b/tests/baselines/reference/callWithSpread.types new file mode 100644 index 00000000000..f7097727204 --- /dev/null +++ b/tests/baselines/reference/callWithSpread.types @@ -0,0 +1,247 @@ +=== tests/cases/conformance/expressions/functionCalls/callWithSpread.ts === +interface X { +>X : X + + foo(x: number, y: number, ...z: string[]); +>foo : (x: number, y: number, ...z: string[]) => any +>x : number +>y : number +>z : string[] +} + +function foo(x: number, y: number, ...z: string[]) { +>foo : (x: number, y: number, ...z: string[]) => void +>x : number +>y : number +>z : string[] +} + +var a: string[]; +>a : string[] + +var z: number[]; +>z : number[] + +var obj: X; +>obj : X +>X : X + +var xa: X[]; +>xa : X[] +>X : X + +foo(1, 2, "abc"); +>foo(1, 2, "abc") : void +>foo : (x: number, y: number, ...z: string[]) => void +>1 : number +>2 : number +>"abc" : string + +foo(1, 2, ...a); +>foo(1, 2, ...a) : void +>foo : (x: number, y: number, ...z: string[]) => void +>1 : number +>2 : number +>...a : string +>a : string[] + +foo(1, 2, ...a, "abc"); +>foo(1, 2, ...a, "abc") : void +>foo : (x: number, y: number, ...z: string[]) => void +>1 : number +>2 : number +>...a : string +>a : string[] +>"abc" : string + +obj.foo(1, 2, "abc"); +>obj.foo(1, 2, "abc") : any +>obj.foo : (x: number, y: number, ...z: string[]) => any +>obj : X +>foo : (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>"abc" : string + +obj.foo(1, 2, ...a); +>obj.foo(1, 2, ...a) : any +>obj.foo : (x: number, y: number, ...z: string[]) => any +>obj : X +>foo : (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>...a : string +>a : string[] + +obj.foo(1, 2, ...a, "abc"); +>obj.foo(1, 2, ...a, "abc") : any +>obj.foo : (x: number, y: number, ...z: string[]) => any +>obj : X +>foo : (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>...a : string +>a : string[] +>"abc" : string + +(obj.foo)(1, 2, "abc"); +>(obj.foo)(1, 2, "abc") : any +>(obj.foo) : (x: number, y: number, ...z: string[]) => any +>obj.foo : (x: number, y: number, ...z: string[]) => any +>obj : X +>foo : (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>"abc" : string + +(obj.foo)(1, 2, ...a); +>(obj.foo)(1, 2, ...a) : any +>(obj.foo) : (x: number, y: number, ...z: string[]) => any +>obj.foo : (x: number, y: number, ...z: string[]) => any +>obj : X +>foo : (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>...a : string +>a : string[] + +(obj.foo)(1, 2, ...a, "abc"); +>(obj.foo)(1, 2, ...a, "abc") : any +>(obj.foo) : (x: number, y: number, ...z: string[]) => any +>obj.foo : (x: number, y: number, ...z: string[]) => any +>obj : X +>foo : (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>...a : string +>a : string[] +>"abc" : string + +xa[1].foo(1, 2, "abc"); +>xa[1].foo(1, 2, "abc") : any +>xa[1].foo : (x: number, y: number, ...z: string[]) => any +>xa[1] : X +>xa : X[] +>1 : number +>foo : (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>"abc" : string + +xa[1].foo(1, 2, ...a); +>xa[1].foo(1, 2, ...a) : any +>xa[1].foo : (x: number, y: number, ...z: string[]) => any +>xa[1] : X +>xa : X[] +>1 : number +>foo : (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>...a : string +>a : string[] + +xa[1].foo(1, 2, ...a, "abc"); +>xa[1].foo(1, 2, ...a, "abc") : any +>xa[1].foo : (x: number, y: number, ...z: string[]) => any +>xa[1] : X +>xa : X[] +>1 : number +>foo : (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>...a : string +>a : string[] +>"abc" : string + +(xa[1].foo)(...[1, 2, "abc"]); +>(xa[1].foo)(...[1, 2, "abc"]) : any +>(xa[1].foo) : Function +>xa[1].foo : Function +>Function : Function +>xa[1].foo : (x: number, y: number, ...z: string[]) => any +>xa[1] : X +>xa : X[] +>1 : number +>foo : (x: number, y: number, ...z: string[]) => any +>...[1, 2, "abc"] : string | number +>[1, 2, "abc"] : (string | number)[] +>1 : number +>2 : number +>"abc" : string + +class C { +>C : C + + constructor(x: number, y: number, ...z: string[]) { +>x : number +>y : number +>z : string[] + + this.foo(x, y); +>this.foo(x, y) : void +>this.foo : (x: number, y: number, ...z: string[]) => void +>this : C +>foo : (x: number, y: number, ...z: string[]) => void +>x : number +>y : number + + this.foo(x, y, ...z); +>this.foo(x, y, ...z) : void +>this.foo : (x: number, y: number, ...z: string[]) => void +>this : C +>foo : (x: number, y: number, ...z: string[]) => void +>x : number +>y : number +>...z : string +>z : string[] + } + foo(x: number, y: number, ...z: string[]) { +>foo : (x: number, y: number, ...z: string[]) => void +>x : number +>y : number +>z : string[] + } +} + +class D extends C { +>D : D +>C : C + + constructor() { + super(1, 2); +>super(1, 2) : void +>super : typeof C +>1 : number +>2 : number + + super(1, 2, ...a); +>super(1, 2, ...a) : void +>super : typeof C +>1 : number +>2 : number +>...a : string +>a : string[] + } + foo() { +>foo : () => void + + super.foo(1, 2); +>super.foo(1, 2) : void +>super.foo : (x: number, y: number, ...z: string[]) => void +>super : C +>foo : (x: number, y: number, ...z: string[]) => void +>1 : number +>2 : number + + super.foo(1, 2, ...a); +>super.foo(1, 2, ...a) : void +>super.foo : (x: number, y: number, ...z: string[]) => void +>super : C +>foo : (x: number, y: number, ...z: string[]) => void +>1 : number +>2 : number +>...a : string +>a : string[] + } +} + diff --git a/tests/baselines/reference/callWithSpreadES6.js b/tests/baselines/reference/callWithSpreadES6.js index d6a915f5f36..11fa8d6edcd 100644 --- a/tests/baselines/reference/callWithSpreadES6.js +++ b/tests/baselines/reference/callWithSpreadES6.js @@ -49,9 +49,6 @@ class D extends C { super.foo(1, 2, ...a); } } - -// Only supported in when target is ES6 -var c = new C(1, 2, ...a); //// [callWithSpreadES6.js] @@ -92,5 +89,3 @@ class D extends C { super.foo(1, 2, ...a); } } -// Only supported in when target is ES6 -var c = new C(1, 2, ...a); diff --git a/tests/baselines/reference/callWithSpreadES6.symbols b/tests/baselines/reference/callWithSpreadES6.symbols index c642152ebc3..9cb8319d414 100644 --- a/tests/baselines/reference/callWithSpreadES6.symbols +++ b/tests/baselines/reference/callWithSpreadES6.symbols @@ -158,9 +158,3 @@ class D extends C { } } -// Only supported in when target is ES6 -var c = new C(1, 2, ...a); ->c : Symbol(c, Decl(callWithSpreadES6.ts, 52, 3)) ->C : Symbol(C, Decl(callWithSpreadES6.ts, 29, 40)) ->a : Symbol(a, Decl(callWithSpreadES6.ts, 8, 3)) - diff --git a/tests/baselines/reference/callWithSpreadES6.types b/tests/baselines/reference/callWithSpreadES6.types index 71d3cf9b2df..ba638207e8a 100644 --- a/tests/baselines/reference/callWithSpreadES6.types +++ b/tests/baselines/reference/callWithSpreadES6.types @@ -246,13 +246,3 @@ class D extends C { } } -// Only supported in when target is ES6 -var c = new C(1, 2, ...a); ->c : C ->new C(1, 2, ...a) : C ->C : typeof C ->1 : number ->2 : number ->...a : string ->a : string[] - diff --git a/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js b/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js index 21e0326f741..726f918f4e8 100644 --- a/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js +++ b/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js @@ -27,7 +27,6 @@ var A = (function () { })(); var A; (function (A) { - A.v; })(A || (A = {})); var Foo; (function (Foo) { diff --git a/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.js b/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.js index a8e0718f277..e6fbc48cadd 100644 --- a/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.js +++ b/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.js @@ -16,7 +16,6 @@ export class Test1 { } //// [classMemberInitializerWithLamdaScoping3_0.js] -exports.field1; //// [classMemberInitializerWithLamdaScoping3_1.js] var Test1 = (function () { function Test1(field1) { diff --git a/tests/baselines/reference/commentsBeforeVariableStatement1.js b/tests/baselines/reference/commentsBeforeVariableStatement1.js index 21705826555..c82909f8cd4 100644 --- a/tests/baselines/reference/commentsBeforeVariableStatement1.js +++ b/tests/baselines/reference/commentsBeforeVariableStatement1.js @@ -5,6 +5,4 @@ export var b: number; //// [commentsBeforeVariableStatement1.js] define(["require", "exports"], function (require, exports) { - /** b's comment*/ - exports.b; }); diff --git a/tests/baselines/reference/commentsExternalModules.js b/tests/baselines/reference/commentsExternalModules.js index 7f1193c7d1d..c982e66bf72 100644 --- a/tests/baselines/reference/commentsExternalModules.js +++ b/tests/baselines/reference/commentsExternalModules.js @@ -66,8 +66,6 @@ define(["require", "exports"], function (require, exports) { /** Module comment*/ var m1; (function (m1) { - /** b's comment*/ - m1.b; /** foo's comment*/ function foo() { return m1.b; @@ -97,8 +95,6 @@ define(["require", "exports"], function (require, exports) { /** Module comment */ var m4; (function (m4) { - /** b's comment */ - m4.b; /** foo's comment */ function foo() { diff --git a/tests/baselines/reference/commentsExternalModules2.js b/tests/baselines/reference/commentsExternalModules2.js index cba04c8cc02..2c8b811d754 100644 --- a/tests/baselines/reference/commentsExternalModules2.js +++ b/tests/baselines/reference/commentsExternalModules2.js @@ -66,8 +66,6 @@ define(["require", "exports"], function (require, exports) { /** Module comment*/ var m1; (function (m1) { - /** b's comment*/ - m1.b; /** foo's comment*/ function foo() { return m1.b; @@ -97,8 +95,6 @@ define(["require", "exports"], function (require, exports) { /** Module comment */ var m4; (function (m4) { - /** b's comment */ - m4.b; /** foo's comment */ function foo() { diff --git a/tests/baselines/reference/commentsExternalModules3.js b/tests/baselines/reference/commentsExternalModules3.js index ff384507b79..283e07ebc7f 100644 --- a/tests/baselines/reference/commentsExternalModules3.js +++ b/tests/baselines/reference/commentsExternalModules3.js @@ -65,8 +65,6 @@ export var newVar2 = new extMod.m4.m2.c(); /** Module comment*/ var m1; (function (m1) { - /** b's comment*/ - m1.b; /** foo's comment*/ function foo() { return m1.b; @@ -96,8 +94,6 @@ var myvar = new m1.m2.c(); /** Module comment */ var m4; (function (m4) { - /** b's comment */ - m4.b; /** foo's comment */ function foo() { diff --git a/tests/baselines/reference/commentsModules.js b/tests/baselines/reference/commentsModules.js index 7607e6e050c..aa5cd2fb7fa 100644 --- a/tests/baselines/reference/commentsModules.js +++ b/tests/baselines/reference/commentsModules.js @@ -101,8 +101,6 @@ new m7.m8.m9.c(); /** Module comment*/ var m1; (function (m1) { - /** b's comment*/ - m1.b; /** foo's comment*/ function foo() { return m1.b; diff --git a/tests/baselines/reference/complicatedPrivacy.js b/tests/baselines/reference/complicatedPrivacy.js index 3d5b321a36f..7f431f3d136 100644 --- a/tests/baselines/reference/complicatedPrivacy.js +++ b/tests/baselines/reference/complicatedPrivacy.js @@ -163,7 +163,6 @@ var m1; return C5; })(); m1.C5 = C5; - m1.v2; })(m1 || (m1 = {})); var C2 = (function () { function C2() { diff --git a/tests/baselines/reference/compoundAssignmentLHSIsValue.js b/tests/baselines/reference/compoundAssignmentLHSIsValue.js index 6e355e136e3..4c5c050dc83 100644 --- a/tests/baselines/reference/compoundAssignmentLHSIsValue.js +++ b/tests/baselines/reference/compoundAssignmentLHSIsValue.js @@ -156,7 +156,6 @@ this += value; // identifiers: module, class, enum, function var M; (function (M) { - M.a; })(M || (M = {})); M *= value; M += value; diff --git a/tests/baselines/reference/contextualTyping.js b/tests/baselines/reference/contextualTyping.js index 75b98b16c33..a763b2b6544 100644 --- a/tests/baselines/reference/contextualTyping.js +++ b/tests/baselines/reference/contextualTyping.js @@ -283,7 +283,6 @@ var C4T5 = (function () { // CONTEXT: Module property assignment var C5T5; (function (C5T5) { - C5T5.foo; C5T5.foo = function (i, s) { return s; }; diff --git a/tests/baselines/reference/contextualTyping.js.map b/tests/baselines/reference/contextualTyping.js.map index a8835dc965d..fc84d1dc318 100644 --- a/tests/baselines/reference/contextualTyping.js.map +++ b/tests/baselines/reference/contextualTyping.js.map @@ -1,2 +1,2 @@ //// [contextualTyping.js.map] -{"version":3,"file":"contextualTyping.js","sourceRoot":"","sources":["contextualTyping.ts"],"names":["C1T5","C1T5.constructor","C2T5","C4T5","C4T5.constructor","C5T5","c9t5","C11t5","C11t5.constructor","EF1","Point"],"mappings":"AAaA,AADA,sCAAsC;;IACtCA;QACIC,QAAGA,GAAqCA,UAASA,CAACA;YAC9C,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IAADD,WAACA;AAADA,CAACA,AAJD,IAIC;AAGD,AADA,uCAAuC;AACvC,IAAO,IAAI,CAIV;AAJD,WAAO,IAAI,EAAC,CAAC;IACEE,QAAGA,GAAqCA,UAASA,CAACA;QACzD,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EAJM,IAAI,KAAJ,IAAI,QAIV;AAGD,AADA,gCAAgC;IAC5B,IAAI,GAA0B,CAAC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AAC7D,IAAI,IAAI,GAAS,CAAC;IACd,CAAC,EAAE,CAAC;CACP,CAAC,CAAA;AACF,IAAI,IAAI,GAAa,EAAE,CAAC;AACxB,IAAI,IAAI,GAAe,cAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AACxD,IAAI,IAAI,GAAwB,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAClE,IAAI,IAAI,GAAmC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAChF,IAAI,IAAI,GAGJ,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9B,IAAI,IAAI,GAAqC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,IAAI,IAAI,GAAe,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AAC/B,IAAI,KAAK,GAAW,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5C,IAAI,KAAK,GAAwC,CAAC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChF,IAAI,KAAK,GAAS;IACd,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,IAAI,KAAK,GAAS,CAAC;IACf,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC,CAAA;AACF,IAAI,KAAK,GAAS,CAAC;IACf,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAGF,AADA,qCAAqC;;IAGjCC;QACIC,IAAIA,CAACA,GAAGA,GAAGA,UAASA,CAACA,EAAEA,CAACA;YACpB,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IACLD,WAACA;AAADA,CAACA,AAPD,IAOC;AAGD,AADA,sCAAsC;AACtC,IAAO,IAAI,CAKV;AALD,WAAO,IAAI,EAAC,CAAC;IACEE,QAAqCA,CAACA;IACjDA,QAAGA,GAAGA,UAASA,CAACA,EAAEA,CAACA;QACf,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EALM,IAAI,KAAJ,IAAI,QAKV;AAGD,AADA,+BAA+B;IAC3B,IAAyB,CAAC;AAC9B,IAAI,GAAwB,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAG9D,AADA,kCAAkC;IAC9B,IAAY,CAAC;AACjB,IAAI,CAAC,CAAC,CAAC,GAAS,CAAC,EAAC,CAAC,EAAE,CAAC,EAAC,CAAC,CAAC;AAuBzB,IAAI,KAAK,GAkBS,CAAC,EAAE,CAAC,CAAC;AAEvB,KAAK,CAAC,EAAE,GAAG,CAAC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AACtC,KAAK,CAAC,EAAE,GAAS,CAAC;IACd,CAAC,EAAE,CAAC;CACP,CAAC,CAAC;AACH,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;AACd,KAAK,CAAC,EAAE,GAAG,cAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAC5C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAC7C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAChD,KAAK,CAAC,EAAE,GAAG,UAAS,CAAS,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC;AAE5C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrC,KAAK,CAAC,EAAE,GAAG,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AACnB,KAAK,CAAC,GAAG,GAAG,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AACpC,KAAK,CAAC,GAAG,GAAG,CAAC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3C,KAAK,CAAC,GAAG,GAAG;IACR,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,KAAK,CAAC,GAAG,GAAS,CAAC;IACf,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC,CAAA;AACF,KAAK,CAAC,GAAG,GAAS,CAAC;IACf,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAEF,AADA,yBAAyB;cACX,CAAsB,IAAGC,CAACA;AAAA,CAAC;AACzC,IAAI,CAAC,UAAS,CAAC;IACX,MAAM,CAAO,CAAC,EAAE,CAAC,CAAC;AACtB,CAAC,CAAC,CAAC;AAGH,AADA,4BAA4B;IACxB,KAAK,GAA8B,cAAa,MAAM,CAAC,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC;AAG/F,AADA,0BAA0B;;IACZC,eAAYA,CAAsBA;IAAIC,CAACA;IAACD,YAACA;AAADA,CAACA,AAAvD,IAAuD;AAAA,CAAC;AACxD,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AAGrD,AADA,qCAAqC;IACjC,KAAK,GAA2B,CAAC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AAC/D,IAAI,KAAK,GAAU,CAAC;IAChB,CAAC,EAAE,CAAC;CACP,CAAC,CAAC;AACH,IAAI,KAAK,GAAc,EAAE,CAAC;AAC1B,IAAI,KAAK,GAAgB,cAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAC1D,IAAI,KAAK,GAAyB,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AACpE,IAAI,KAAK,GAAoC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAClF,IAAI,KAAK,GAGN,UAAS,CAAQ,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC;AAEnC,IAAI,KAAK,GAAsC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACzE,IAAI,KAAK,GAAgB,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AACjC,IAAI,MAAM,GAAY,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9C,IAAI,MAAM,GAAyC,CAAC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClF,IAAI,MAAM,GAAU;IAChB,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,IAAI,MAAM,GAAU,CAAC;IACjB,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC,CAAA;AACF,IAAI,MAAM,GAAU,CAAC;IACjB,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAOF,aAAa,CAAC,EAAC,CAAC,IAAIE,MAAMA,CAACA,CAACA,GAACA,CAACA,CAACA,CAACA,CAACA;AAEjC,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC;AAcnB,eAAe,CAAC,EAAE,CAAC;IACfC,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IACXA,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IAEXA,MAAMA,CAACA,IAAIA,CAACA;AAChBA,CAACA;AAED,KAAK,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE/B,KAAK,CAAC,SAAS,CAAC,GAAG,GAAG,UAAS,EAAE,EAAE,EAAE;IACjC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,KAAK,CAAC,SAAS,GAAG;IACd,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,GAAG,EAAE,UAAS,EAAE,EAAE,EAAE;QAChB,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/C,CAAC;CACJ,CAAC;AAIF,IAAI,CAAC,GAAM,EAAG,CAAC"} \ No newline at end of file +{"version":3,"file":"contextualTyping.js","sourceRoot":"","sources":["contextualTyping.ts"],"names":["C1T5","C1T5.constructor","C2T5","C4T5","C4T5.constructor","C5T5","c9t5","C11t5","C11t5.constructor","EF1","Point"],"mappings":"AAaA,AADA,sCAAsC;;IACtCA;QACIC,QAAGA,GAAqCA,UAASA,CAACA;YAC9C,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IAADD,WAACA;AAADA,CAACA,AAJD,IAIC;AAGD,AADA,uCAAuC;AACvC,IAAO,IAAI,CAIV;AAJD,WAAO,IAAI,EAAC,CAAC;IACEE,QAAGA,GAAqCA,UAASA,CAACA;QACzD,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EAJM,IAAI,KAAJ,IAAI,QAIV;AAGD,AADA,gCAAgC;IAC5B,IAAI,GAA0B,CAAC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AAC7D,IAAI,IAAI,GAAS,CAAC;IACd,CAAC,EAAE,CAAC;CACP,CAAC,CAAA;AACF,IAAI,IAAI,GAAa,EAAE,CAAC;AACxB,IAAI,IAAI,GAAe,cAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AACxD,IAAI,IAAI,GAAwB,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAClE,IAAI,IAAI,GAAmC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAChF,IAAI,IAAI,GAGJ,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9B,IAAI,IAAI,GAAqC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,IAAI,IAAI,GAAe,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AAC/B,IAAI,KAAK,GAAW,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5C,IAAI,KAAK,GAAwC,CAAC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChF,IAAI,KAAK,GAAS;IACd,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,IAAI,KAAK,GAAS,CAAC;IACf,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC,CAAA;AACF,IAAI,KAAK,GAAS,CAAC;IACf,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAGF,AADA,qCAAqC;;IAGjCC;QACIC,IAAIA,CAACA,GAAGA,GAAGA,UAASA,CAACA,EAAEA,CAACA;YACpB,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IACLD,WAACA;AAADA,CAACA,AAPD,IAOC;AAGD,AADA,sCAAsC;AACtC,IAAO,IAAI,CAKV;AALD,WAAO,IAAI,EAAC,CAAC;IAETE,QAAGA,GAAGA,UAASA,CAACA,EAAEA,CAACA;QACf,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EALM,IAAI,KAAJ,IAAI,QAKV;AAGD,AADA,+BAA+B;IAC3B,IAAyB,CAAC;AAC9B,IAAI,GAAwB,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAG9D,AADA,kCAAkC;IAC9B,IAAY,CAAC;AACjB,IAAI,CAAC,CAAC,CAAC,GAAS,CAAC,EAAC,CAAC,EAAE,CAAC,EAAC,CAAC,CAAC;AAuBzB,IAAI,KAAK,GAkBS,CAAC,EAAE,CAAC,CAAC;AAEvB,KAAK,CAAC,EAAE,GAAG,CAAC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AACtC,KAAK,CAAC,EAAE,GAAS,CAAC;IACd,CAAC,EAAE,CAAC;CACP,CAAC,CAAC;AACH,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;AACd,KAAK,CAAC,EAAE,GAAG,cAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAC5C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAC7C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAChD,KAAK,CAAC,EAAE,GAAG,UAAS,CAAS,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC;AAE5C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrC,KAAK,CAAC,EAAE,GAAG,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AACnB,KAAK,CAAC,GAAG,GAAG,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AACpC,KAAK,CAAC,GAAG,GAAG,CAAC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3C,KAAK,CAAC,GAAG,GAAG;IACR,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,KAAK,CAAC,GAAG,GAAS,CAAC;IACf,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC,CAAA;AACF,KAAK,CAAC,GAAG,GAAS,CAAC;IACf,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAEF,AADA,yBAAyB;cACX,CAAsB,IAAGC,CAACA;AAAA,CAAC;AACzC,IAAI,CAAC,UAAS,CAAC;IACX,MAAM,CAAO,CAAC,EAAE,CAAC,CAAC;AACtB,CAAC,CAAC,CAAC;AAGH,AADA,4BAA4B;IACxB,KAAK,GAA8B,cAAa,MAAM,CAAC,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC;AAG/F,AADA,0BAA0B;;IACZC,eAAYA,CAAsBA;IAAIC,CAACA;IAACD,YAACA;AAADA,CAACA,AAAvD,IAAuD;AAAA,CAAC;AACxD,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AAGrD,AADA,qCAAqC;IACjC,KAAK,GAA2B,CAAC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AAC/D,IAAI,KAAK,GAAU,CAAC;IAChB,CAAC,EAAE,CAAC;CACP,CAAC,CAAC;AACH,IAAI,KAAK,GAAc,EAAE,CAAC;AAC1B,IAAI,KAAK,GAAgB,cAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAC1D,IAAI,KAAK,GAAyB,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AACpE,IAAI,KAAK,GAAoC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAClF,IAAI,KAAK,GAGN,UAAS,CAAQ,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC;AAEnC,IAAI,KAAK,GAAsC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACzE,IAAI,KAAK,GAAgB,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AACjC,IAAI,MAAM,GAAY,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9C,IAAI,MAAM,GAAyC,CAAC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClF,IAAI,MAAM,GAAU;IAChB,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,IAAI,MAAM,GAAU,CAAC;IACjB,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC,CAAA;AACF,IAAI,MAAM,GAAU,CAAC;IACjB,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAOF,aAAa,CAAC,EAAC,CAAC,IAAIE,MAAMA,CAACA,CAACA,GAACA,CAACA,CAACA,CAACA,CAACA;AAEjC,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC;AAcnB,eAAe,CAAC,EAAE,CAAC;IACfC,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IACXA,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IAEXA,MAAMA,CAACA,IAAIA,CAACA;AAChBA,CAACA;AAED,KAAK,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE/B,KAAK,CAAC,SAAS,CAAC,GAAG,GAAG,UAAS,EAAE,EAAE,EAAE;IACjC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,KAAK,CAAC,SAAS,GAAG;IACd,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,GAAG,EAAE,UAAS,EAAE,EAAE,EAAE;QAChB,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/C,CAAC;CACJ,CAAC;AAIF,IAAI,CAAC,GAAM,EAAG,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping.sourcemap.txt b/tests/baselines/reference/contextualTyping.sourcemap.txt index 085f6a439ff..b6b4c18b289 100644 --- a/tests/baselines/reference/contextualTyping.sourcemap.txt +++ b/tests/baselines/reference/contextualTyping.sourcemap.txt @@ -1109,6 +1109,7 @@ sourceFile:contextualTyping.ts 3 > ^^^^ 4 > ^^ 5 > ^ +6 > ^^^^^^^^^^^^^^^-> 1-> 2 >module 3 > C5T5 @@ -1120,19 +1121,6 @@ sourceFile:contextualTyping.ts 4 >Emitted(51, 18) Source(66, 13) + SourceIndex(0) 5 >Emitted(51, 19) Source(66, 14) + SourceIndex(0) --- ->>> C5T5.foo; -1 >^^^^ -2 > ^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^-> -1 > - > export var -2 > foo: (i: number, s: string) => string -3 > ; -1 >Emitted(52, 5) Source(67, 16) + SourceIndex(0) name (C5T5) -2 >Emitted(52, 13) Source(67, 53) + SourceIndex(0) name (C5T5) -3 >Emitted(52, 14) Source(67, 54) + SourceIndex(0) name (C5T5) ---- >>> C5T5.foo = function (i, s) { 1->^^^^ 2 > ^^^^^^^^ @@ -1142,6 +1130,7 @@ sourceFile:contextualTyping.ts 6 > ^^ 7 > ^ 1-> + > export var foo: (i: number, s: string) => string; > 2 > foo 3 > = @@ -1149,13 +1138,13 @@ sourceFile:contextualTyping.ts 5 > i 6 > , 7 > s -1->Emitted(53, 5) Source(68, 5) + SourceIndex(0) name (C5T5) -2 >Emitted(53, 13) Source(68, 8) + SourceIndex(0) name (C5T5) -3 >Emitted(53, 16) Source(68, 11) + SourceIndex(0) name (C5T5) -4 >Emitted(53, 26) Source(68, 20) + SourceIndex(0) name (C5T5) -5 >Emitted(53, 27) Source(68, 21) + SourceIndex(0) name (C5T5) -6 >Emitted(53, 29) Source(68, 23) + SourceIndex(0) name (C5T5) -7 >Emitted(53, 30) Source(68, 24) + SourceIndex(0) name (C5T5) +1->Emitted(52, 5) Source(68, 5) + SourceIndex(0) name (C5T5) +2 >Emitted(52, 13) Source(68, 8) + SourceIndex(0) name (C5T5) +3 >Emitted(52, 16) Source(68, 11) + SourceIndex(0) name (C5T5) +4 >Emitted(52, 26) Source(68, 20) + SourceIndex(0) name (C5T5) +5 >Emitted(52, 27) Source(68, 21) + SourceIndex(0) name (C5T5) +6 >Emitted(52, 29) Source(68, 23) + SourceIndex(0) name (C5T5) +7 >Emitted(52, 30) Source(68, 24) + SourceIndex(0) name (C5T5) --- >>> return s; 1 >^^^^^^^^ @@ -1169,11 +1158,11 @@ sourceFile:contextualTyping.ts 3 > 4 > s 5 > ; -1 >Emitted(54, 9) Source(69, 9) + SourceIndex(0) -2 >Emitted(54, 15) Source(69, 15) + SourceIndex(0) -3 >Emitted(54, 16) Source(69, 16) + SourceIndex(0) -4 >Emitted(54, 17) Source(69, 17) + SourceIndex(0) -5 >Emitted(54, 18) Source(69, 18) + SourceIndex(0) +1 >Emitted(53, 9) Source(69, 9) + SourceIndex(0) +2 >Emitted(53, 15) Source(69, 15) + SourceIndex(0) +3 >Emitted(53, 16) Source(69, 16) + SourceIndex(0) +4 >Emitted(53, 17) Source(69, 17) + SourceIndex(0) +5 >Emitted(53, 18) Source(69, 18) + SourceIndex(0) --- >>> }; 1 >^^^^ @@ -1184,9 +1173,9 @@ sourceFile:contextualTyping.ts > 2 > } 3 > -1 >Emitted(55, 5) Source(70, 5) + SourceIndex(0) -2 >Emitted(55, 6) Source(70, 6) + SourceIndex(0) -3 >Emitted(55, 7) Source(70, 6) + SourceIndex(0) name (C5T5) +1 >Emitted(54, 5) Source(70, 5) + SourceIndex(0) +2 >Emitted(54, 6) Source(70, 6) + SourceIndex(0) +3 >Emitted(54, 7) Source(70, 6) + SourceIndex(0) name (C5T5) --- >>>})(C5T5 || (C5T5 = {})); 1-> @@ -1210,13 +1199,13 @@ sourceFile:contextualTyping.ts > return s; > } > } -1->Emitted(56, 1) Source(71, 1) + SourceIndex(0) name (C5T5) -2 >Emitted(56, 2) Source(71, 2) + SourceIndex(0) name (C5T5) -3 >Emitted(56, 4) Source(66, 8) + SourceIndex(0) -4 >Emitted(56, 8) Source(66, 12) + SourceIndex(0) -5 >Emitted(56, 13) Source(66, 8) + SourceIndex(0) -6 >Emitted(56, 17) Source(66, 12) + SourceIndex(0) -7 >Emitted(56, 25) Source(71, 2) + SourceIndex(0) +1->Emitted(55, 1) Source(71, 1) + SourceIndex(0) name (C5T5) +2 >Emitted(55, 2) Source(71, 2) + SourceIndex(0) name (C5T5) +3 >Emitted(55, 4) Source(66, 8) + SourceIndex(0) +4 >Emitted(55, 8) Source(66, 12) + SourceIndex(0) +5 >Emitted(55, 13) Source(66, 8) + SourceIndex(0) +6 >Emitted(55, 17) Source(66, 12) + SourceIndex(0) +7 >Emitted(55, 25) Source(71, 2) + SourceIndex(0) --- >>>// CONTEXT: Variable assignment 1-> @@ -1228,9 +1217,9 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Variable assignment -1->Emitted(57, 1) Source(74, 1) + SourceIndex(0) -2 >Emitted(57, 1) Source(73, 1) + SourceIndex(0) -3 >Emitted(57, 32) Source(73, 32) + SourceIndex(0) +1->Emitted(56, 1) Source(74, 1) + SourceIndex(0) +2 >Emitted(56, 1) Source(73, 1) + SourceIndex(0) +3 >Emitted(56, 32) Source(73, 32) + SourceIndex(0) --- >>>var c6t5; 1 >^^^^ @@ -1241,9 +1230,9 @@ sourceFile:contextualTyping.ts >var 2 > c6t5: (n: number) => IFoo 3 > ; -1 >Emitted(58, 5) Source(74, 5) + SourceIndex(0) -2 >Emitted(58, 9) Source(74, 30) + SourceIndex(0) -3 >Emitted(58, 10) Source(74, 31) + SourceIndex(0) +1 >Emitted(57, 5) Source(74, 5) + SourceIndex(0) +2 >Emitted(57, 9) Source(74, 30) + SourceIndex(0) +3 >Emitted(57, 10) Source(74, 31) + SourceIndex(0) --- >>>c6t5 = function (n) { return ({}); }; 1-> @@ -1277,21 +1266,21 @@ sourceFile:contextualTyping.ts 13> 14> } 15> ; -1->Emitted(59, 1) Source(75, 1) + SourceIndex(0) -2 >Emitted(59, 5) Source(75, 5) + SourceIndex(0) -3 >Emitted(59, 8) Source(75, 29) + SourceIndex(0) -4 >Emitted(59, 18) Source(75, 38) + SourceIndex(0) -5 >Emitted(59, 19) Source(75, 39) + SourceIndex(0) -6 >Emitted(59, 23) Source(75, 43) + SourceIndex(0) -7 >Emitted(59, 29) Source(75, 49) + SourceIndex(0) -8 >Emitted(59, 30) Source(75, 56) + SourceIndex(0) -9 >Emitted(59, 31) Source(75, 57) + SourceIndex(0) -10>Emitted(59, 33) Source(75, 59) + SourceIndex(0) -11>Emitted(59, 34) Source(75, 60) + SourceIndex(0) -12>Emitted(59, 35) Source(75, 60) + SourceIndex(0) -13>Emitted(59, 36) Source(75, 61) + SourceIndex(0) -14>Emitted(59, 37) Source(75, 62) + SourceIndex(0) -15>Emitted(59, 38) Source(75, 63) + SourceIndex(0) +1->Emitted(58, 1) Source(75, 1) + SourceIndex(0) +2 >Emitted(58, 5) Source(75, 5) + SourceIndex(0) +3 >Emitted(58, 8) Source(75, 29) + SourceIndex(0) +4 >Emitted(58, 18) Source(75, 38) + SourceIndex(0) +5 >Emitted(58, 19) Source(75, 39) + SourceIndex(0) +6 >Emitted(58, 23) Source(75, 43) + SourceIndex(0) +7 >Emitted(58, 29) Source(75, 49) + SourceIndex(0) +8 >Emitted(58, 30) Source(75, 56) + SourceIndex(0) +9 >Emitted(58, 31) Source(75, 57) + SourceIndex(0) +10>Emitted(58, 33) Source(75, 59) + SourceIndex(0) +11>Emitted(58, 34) Source(75, 60) + SourceIndex(0) +12>Emitted(58, 35) Source(75, 60) + SourceIndex(0) +13>Emitted(58, 36) Source(75, 61) + SourceIndex(0) +14>Emitted(58, 37) Source(75, 62) + SourceIndex(0) +15>Emitted(58, 38) Source(75, 63) + SourceIndex(0) --- >>>// CONTEXT: Array index assignment 1 > @@ -1303,9 +1292,9 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Array index assignment -1 >Emitted(60, 1) Source(78, 1) + SourceIndex(0) -2 >Emitted(60, 1) Source(77, 1) + SourceIndex(0) -3 >Emitted(60, 35) Source(77, 35) + SourceIndex(0) +1 >Emitted(59, 1) Source(78, 1) + SourceIndex(0) +2 >Emitted(59, 1) Source(77, 1) + SourceIndex(0) +3 >Emitted(59, 35) Source(77, 35) + SourceIndex(0) --- >>>var c7t2; 1 >^^^^ @@ -1316,9 +1305,9 @@ sourceFile:contextualTyping.ts >var 2 > c7t2: IFoo[] 3 > ; -1 >Emitted(61, 5) Source(78, 5) + SourceIndex(0) -2 >Emitted(61, 9) Source(78, 17) + SourceIndex(0) -3 >Emitted(61, 10) Source(78, 18) + SourceIndex(0) +1 >Emitted(60, 5) Source(78, 5) + SourceIndex(0) +2 >Emitted(60, 9) Source(78, 17) + SourceIndex(0) +3 >Emitted(60, 10) Source(78, 18) + SourceIndex(0) --- >>>c7t2[0] = ({ n: 1 }); 1-> @@ -1350,20 +1339,20 @@ sourceFile:contextualTyping.ts 12> } 13> ) 14> ; -1->Emitted(62, 1) Source(79, 1) + SourceIndex(0) -2 >Emitted(62, 5) Source(79, 5) + SourceIndex(0) -3 >Emitted(62, 6) Source(79, 6) + SourceIndex(0) -4 >Emitted(62, 7) Source(79, 7) + SourceIndex(0) -5 >Emitted(62, 8) Source(79, 8) + SourceIndex(0) -6 >Emitted(62, 11) Source(79, 17) + SourceIndex(0) -7 >Emitted(62, 12) Source(79, 18) + SourceIndex(0) -8 >Emitted(62, 14) Source(79, 19) + SourceIndex(0) -9 >Emitted(62, 15) Source(79, 20) + SourceIndex(0) -10>Emitted(62, 17) Source(79, 22) + SourceIndex(0) -11>Emitted(62, 18) Source(79, 23) + SourceIndex(0) -12>Emitted(62, 20) Source(79, 24) + SourceIndex(0) -13>Emitted(62, 21) Source(79, 25) + SourceIndex(0) -14>Emitted(62, 22) Source(79, 26) + SourceIndex(0) +1->Emitted(61, 1) Source(79, 1) + SourceIndex(0) +2 >Emitted(61, 5) Source(79, 5) + SourceIndex(0) +3 >Emitted(61, 6) Source(79, 6) + SourceIndex(0) +4 >Emitted(61, 7) Source(79, 7) + SourceIndex(0) +5 >Emitted(61, 8) Source(79, 8) + SourceIndex(0) +6 >Emitted(61, 11) Source(79, 17) + SourceIndex(0) +7 >Emitted(61, 12) Source(79, 18) + SourceIndex(0) +8 >Emitted(61, 14) Source(79, 19) + SourceIndex(0) +9 >Emitted(61, 15) Source(79, 20) + SourceIndex(0) +10>Emitted(61, 17) Source(79, 22) + SourceIndex(0) +11>Emitted(61, 18) Source(79, 23) + SourceIndex(0) +12>Emitted(61, 20) Source(79, 24) + SourceIndex(0) +13>Emitted(61, 21) Source(79, 25) + SourceIndex(0) +14>Emitted(61, 22) Source(79, 26) + SourceIndex(0) --- >>>var objc8 = ({}); 1 > @@ -1424,14 +1413,14 @@ sourceFile:contextualTyping.ts 6 > {} 7 > ) 8 > ; -1 >Emitted(63, 1) Source(102, 1) + SourceIndex(0) -2 >Emitted(63, 5) Source(102, 5) + SourceIndex(0) -3 >Emitted(63, 10) Source(102, 10) + SourceIndex(0) -4 >Emitted(63, 13) Source(120, 19) + SourceIndex(0) -5 >Emitted(63, 14) Source(120, 20) + SourceIndex(0) -6 >Emitted(63, 16) Source(120, 22) + SourceIndex(0) -7 >Emitted(63, 17) Source(120, 23) + SourceIndex(0) -8 >Emitted(63, 18) Source(120, 24) + SourceIndex(0) +1 >Emitted(62, 1) Source(102, 1) + SourceIndex(0) +2 >Emitted(62, 5) Source(102, 5) + SourceIndex(0) +3 >Emitted(62, 10) Source(102, 10) + SourceIndex(0) +4 >Emitted(62, 13) Source(120, 19) + SourceIndex(0) +5 >Emitted(62, 14) Source(120, 20) + SourceIndex(0) +6 >Emitted(62, 16) Source(120, 22) + SourceIndex(0) +7 >Emitted(62, 17) Source(120, 23) + SourceIndex(0) +8 >Emitted(62, 18) Source(120, 24) + SourceIndex(0) --- >>>objc8.t1 = (function (s) { return s; }); 1-> @@ -1470,23 +1459,23 @@ sourceFile:contextualTyping.ts 15> } 16> ) 17> ; -1->Emitted(64, 1) Source(122, 1) + SourceIndex(0) -2 >Emitted(64, 6) Source(122, 6) + SourceIndex(0) -3 >Emitted(64, 7) Source(122, 7) + SourceIndex(0) -4 >Emitted(64, 9) Source(122, 9) + SourceIndex(0) -5 >Emitted(64, 12) Source(122, 12) + SourceIndex(0) -6 >Emitted(64, 13) Source(122, 13) + SourceIndex(0) -7 >Emitted(64, 23) Source(122, 22) + SourceIndex(0) -8 >Emitted(64, 24) Source(122, 23) + SourceIndex(0) -9 >Emitted(64, 28) Source(122, 27) + SourceIndex(0) -10>Emitted(64, 34) Source(122, 33) + SourceIndex(0) -11>Emitted(64, 35) Source(122, 34) + SourceIndex(0) -12>Emitted(64, 36) Source(122, 35) + SourceIndex(0) -13>Emitted(64, 37) Source(122, 35) + SourceIndex(0) -14>Emitted(64, 38) Source(122, 36) + SourceIndex(0) -15>Emitted(64, 39) Source(122, 37) + SourceIndex(0) -16>Emitted(64, 40) Source(122, 38) + SourceIndex(0) -17>Emitted(64, 41) Source(122, 39) + SourceIndex(0) +1->Emitted(63, 1) Source(122, 1) + SourceIndex(0) +2 >Emitted(63, 6) Source(122, 6) + SourceIndex(0) +3 >Emitted(63, 7) Source(122, 7) + SourceIndex(0) +4 >Emitted(63, 9) Source(122, 9) + SourceIndex(0) +5 >Emitted(63, 12) Source(122, 12) + SourceIndex(0) +6 >Emitted(63, 13) Source(122, 13) + SourceIndex(0) +7 >Emitted(63, 23) Source(122, 22) + SourceIndex(0) +8 >Emitted(63, 24) Source(122, 23) + SourceIndex(0) +9 >Emitted(63, 28) Source(122, 27) + SourceIndex(0) +10>Emitted(63, 34) Source(122, 33) + SourceIndex(0) +11>Emitted(63, 35) Source(122, 34) + SourceIndex(0) +12>Emitted(63, 36) Source(122, 35) + SourceIndex(0) +13>Emitted(63, 37) Source(122, 35) + SourceIndex(0) +14>Emitted(63, 38) Source(122, 36) + SourceIndex(0) +15>Emitted(63, 39) Source(122, 37) + SourceIndex(0) +16>Emitted(63, 40) Source(122, 38) + SourceIndex(0) +17>Emitted(63, 41) Source(122, 39) + SourceIndex(0) --- >>>objc8.t2 = ({ 1 > @@ -1502,12 +1491,12 @@ sourceFile:contextualTyping.ts 4 > t2 5 > = 6 > ( -1 >Emitted(65, 1) Source(123, 1) + SourceIndex(0) -2 >Emitted(65, 6) Source(123, 6) + SourceIndex(0) -3 >Emitted(65, 7) Source(123, 7) + SourceIndex(0) -4 >Emitted(65, 9) Source(123, 9) + SourceIndex(0) -5 >Emitted(65, 12) Source(123, 18) + SourceIndex(0) -6 >Emitted(65, 13) Source(123, 19) + SourceIndex(0) +1 >Emitted(64, 1) Source(123, 1) + SourceIndex(0) +2 >Emitted(64, 6) Source(123, 6) + SourceIndex(0) +3 >Emitted(64, 7) Source(123, 7) + SourceIndex(0) +4 >Emitted(64, 9) Source(123, 9) + SourceIndex(0) +5 >Emitted(64, 12) Source(123, 18) + SourceIndex(0) +6 >Emitted(64, 13) Source(123, 19) + SourceIndex(0) --- >>> n: 1 1 >^^^^ @@ -1519,10 +1508,10 @@ sourceFile:contextualTyping.ts 2 > n 3 > : 4 > 1 -1 >Emitted(66, 5) Source(124, 5) + SourceIndex(0) -2 >Emitted(66, 6) Source(124, 6) + SourceIndex(0) -3 >Emitted(66, 8) Source(124, 8) + SourceIndex(0) -4 >Emitted(66, 9) Source(124, 9) + SourceIndex(0) +1 >Emitted(65, 5) Source(124, 5) + SourceIndex(0) +2 >Emitted(65, 6) Source(124, 6) + SourceIndex(0) +3 >Emitted(65, 8) Source(124, 8) + SourceIndex(0) +4 >Emitted(65, 9) Source(124, 9) + SourceIndex(0) --- >>>}); 1 >^ @@ -1533,9 +1522,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > ; -1 >Emitted(67, 2) Source(125, 2) + SourceIndex(0) -2 >Emitted(67, 3) Source(125, 3) + SourceIndex(0) -3 >Emitted(67, 4) Source(125, 4) + SourceIndex(0) +1 >Emitted(66, 2) Source(125, 2) + SourceIndex(0) +2 >Emitted(66, 3) Source(125, 3) + SourceIndex(0) +3 >Emitted(66, 4) Source(125, 4) + SourceIndex(0) --- >>>objc8.t3 = []; 1-> @@ -1554,13 +1543,13 @@ sourceFile:contextualTyping.ts 5 > = 6 > [] 7 > ; -1->Emitted(68, 1) Source(126, 1) + SourceIndex(0) -2 >Emitted(68, 6) Source(126, 6) + SourceIndex(0) -3 >Emitted(68, 7) Source(126, 7) + SourceIndex(0) -4 >Emitted(68, 9) Source(126, 9) + SourceIndex(0) -5 >Emitted(68, 12) Source(126, 12) + SourceIndex(0) -6 >Emitted(68, 14) Source(126, 14) + SourceIndex(0) -7 >Emitted(68, 15) Source(126, 15) + SourceIndex(0) +1->Emitted(67, 1) Source(126, 1) + SourceIndex(0) +2 >Emitted(67, 6) Source(126, 6) + SourceIndex(0) +3 >Emitted(67, 7) Source(126, 7) + SourceIndex(0) +4 >Emitted(67, 9) Source(126, 9) + SourceIndex(0) +5 >Emitted(67, 12) Source(126, 12) + SourceIndex(0) +6 >Emitted(67, 14) Source(126, 14) + SourceIndex(0) +7 >Emitted(67, 15) Source(126, 15) + SourceIndex(0) --- >>>objc8.t4 = function () { return ({}); }; 1-> @@ -1595,21 +1584,21 @@ sourceFile:contextualTyping.ts 13> 14> } 15> ; -1->Emitted(69, 1) Source(127, 1) + SourceIndex(0) -2 >Emitted(69, 6) Source(127, 6) + SourceIndex(0) -3 >Emitted(69, 7) Source(127, 7) + SourceIndex(0) -4 >Emitted(69, 9) Source(127, 9) + SourceIndex(0) -5 >Emitted(69, 12) Source(127, 12) + SourceIndex(0) -6 >Emitted(69, 26) Source(127, 25) + SourceIndex(0) -7 >Emitted(69, 32) Source(127, 31) + SourceIndex(0) -8 >Emitted(69, 33) Source(127, 38) + SourceIndex(0) -9 >Emitted(69, 34) Source(127, 39) + SourceIndex(0) -10>Emitted(69, 36) Source(127, 41) + SourceIndex(0) -11>Emitted(69, 37) Source(127, 42) + SourceIndex(0) -12>Emitted(69, 38) Source(127, 42) + SourceIndex(0) -13>Emitted(69, 39) Source(127, 43) + SourceIndex(0) -14>Emitted(69, 40) Source(127, 44) + SourceIndex(0) -15>Emitted(69, 41) Source(127, 45) + SourceIndex(0) +1->Emitted(68, 1) Source(127, 1) + SourceIndex(0) +2 >Emitted(68, 6) Source(127, 6) + SourceIndex(0) +3 >Emitted(68, 7) Source(127, 7) + SourceIndex(0) +4 >Emitted(68, 9) Source(127, 9) + SourceIndex(0) +5 >Emitted(68, 12) Source(127, 12) + SourceIndex(0) +6 >Emitted(68, 26) Source(127, 25) + SourceIndex(0) +7 >Emitted(68, 32) Source(127, 31) + SourceIndex(0) +8 >Emitted(68, 33) Source(127, 38) + SourceIndex(0) +9 >Emitted(68, 34) Source(127, 39) + SourceIndex(0) +10>Emitted(68, 36) Source(127, 41) + SourceIndex(0) +11>Emitted(68, 37) Source(127, 42) + SourceIndex(0) +12>Emitted(68, 38) Source(127, 42) + SourceIndex(0) +13>Emitted(68, 39) Source(127, 43) + SourceIndex(0) +14>Emitted(68, 40) Source(127, 44) + SourceIndex(0) +15>Emitted(68, 41) Source(127, 45) + SourceIndex(0) --- >>>objc8.t5 = function (n) { return ({}); }; 1-> @@ -1648,23 +1637,23 @@ sourceFile:contextualTyping.ts 15> 16> } 17> ; -1->Emitted(70, 1) Source(128, 1) + SourceIndex(0) -2 >Emitted(70, 6) Source(128, 6) + SourceIndex(0) -3 >Emitted(70, 7) Source(128, 7) + SourceIndex(0) -4 >Emitted(70, 9) Source(128, 9) + SourceIndex(0) -5 >Emitted(70, 12) Source(128, 12) + SourceIndex(0) -6 >Emitted(70, 22) Source(128, 21) + SourceIndex(0) -7 >Emitted(70, 23) Source(128, 22) + SourceIndex(0) -8 >Emitted(70, 27) Source(128, 26) + SourceIndex(0) -9 >Emitted(70, 33) Source(128, 32) + SourceIndex(0) -10>Emitted(70, 34) Source(128, 39) + SourceIndex(0) -11>Emitted(70, 35) Source(128, 40) + SourceIndex(0) -12>Emitted(70, 37) Source(128, 42) + SourceIndex(0) -13>Emitted(70, 38) Source(128, 43) + SourceIndex(0) -14>Emitted(70, 39) Source(128, 43) + SourceIndex(0) -15>Emitted(70, 40) Source(128, 44) + SourceIndex(0) -16>Emitted(70, 41) Source(128, 45) + SourceIndex(0) -17>Emitted(70, 42) Source(128, 46) + SourceIndex(0) +1->Emitted(69, 1) Source(128, 1) + SourceIndex(0) +2 >Emitted(69, 6) Source(128, 6) + SourceIndex(0) +3 >Emitted(69, 7) Source(128, 7) + SourceIndex(0) +4 >Emitted(69, 9) Source(128, 9) + SourceIndex(0) +5 >Emitted(69, 12) Source(128, 12) + SourceIndex(0) +6 >Emitted(69, 22) Source(128, 21) + SourceIndex(0) +7 >Emitted(69, 23) Source(128, 22) + SourceIndex(0) +8 >Emitted(69, 27) Source(128, 26) + SourceIndex(0) +9 >Emitted(69, 33) Source(128, 32) + SourceIndex(0) +10>Emitted(69, 34) Source(128, 39) + SourceIndex(0) +11>Emitted(69, 35) Source(128, 40) + SourceIndex(0) +12>Emitted(69, 37) Source(128, 42) + SourceIndex(0) +13>Emitted(69, 38) Source(128, 43) + SourceIndex(0) +14>Emitted(69, 39) Source(128, 43) + SourceIndex(0) +15>Emitted(69, 40) Source(128, 44) + SourceIndex(0) +16>Emitted(69, 41) Source(128, 45) + SourceIndex(0) +17>Emitted(69, 42) Source(128, 46) + SourceIndex(0) --- >>>objc8.t6 = function (n, s) { return ({}); }; 1-> @@ -1706,25 +1695,25 @@ sourceFile:contextualTyping.ts 17> 18> } 19> ; -1->Emitted(71, 1) Source(129, 1) + SourceIndex(0) -2 >Emitted(71, 6) Source(129, 6) + SourceIndex(0) -3 >Emitted(71, 7) Source(129, 7) + SourceIndex(0) -4 >Emitted(71, 9) Source(129, 9) + SourceIndex(0) -5 >Emitted(71, 12) Source(129, 12) + SourceIndex(0) -6 >Emitted(71, 22) Source(129, 21) + SourceIndex(0) -7 >Emitted(71, 23) Source(129, 22) + SourceIndex(0) -8 >Emitted(71, 25) Source(129, 24) + SourceIndex(0) -9 >Emitted(71, 26) Source(129, 25) + SourceIndex(0) -10>Emitted(71, 30) Source(129, 29) + SourceIndex(0) -11>Emitted(71, 36) Source(129, 35) + SourceIndex(0) -12>Emitted(71, 37) Source(129, 42) + SourceIndex(0) -13>Emitted(71, 38) Source(129, 43) + SourceIndex(0) -14>Emitted(71, 40) Source(129, 45) + SourceIndex(0) -15>Emitted(71, 41) Source(129, 46) + SourceIndex(0) -16>Emitted(71, 42) Source(129, 46) + SourceIndex(0) -17>Emitted(71, 43) Source(129, 47) + SourceIndex(0) -18>Emitted(71, 44) Source(129, 48) + SourceIndex(0) -19>Emitted(71, 45) Source(129, 49) + SourceIndex(0) +1->Emitted(70, 1) Source(129, 1) + SourceIndex(0) +2 >Emitted(70, 6) Source(129, 6) + SourceIndex(0) +3 >Emitted(70, 7) Source(129, 7) + SourceIndex(0) +4 >Emitted(70, 9) Source(129, 9) + SourceIndex(0) +5 >Emitted(70, 12) Source(129, 12) + SourceIndex(0) +6 >Emitted(70, 22) Source(129, 21) + SourceIndex(0) +7 >Emitted(70, 23) Source(129, 22) + SourceIndex(0) +8 >Emitted(70, 25) Source(129, 24) + SourceIndex(0) +9 >Emitted(70, 26) Source(129, 25) + SourceIndex(0) +10>Emitted(70, 30) Source(129, 29) + SourceIndex(0) +11>Emitted(70, 36) Source(129, 35) + SourceIndex(0) +12>Emitted(70, 37) Source(129, 42) + SourceIndex(0) +13>Emitted(70, 38) Source(129, 43) + SourceIndex(0) +14>Emitted(70, 40) Source(129, 45) + SourceIndex(0) +15>Emitted(70, 41) Source(129, 46) + SourceIndex(0) +16>Emitted(70, 42) Source(129, 46) + SourceIndex(0) +17>Emitted(70, 43) Source(129, 47) + SourceIndex(0) +18>Emitted(70, 44) Source(129, 48) + SourceIndex(0) +19>Emitted(70, 45) Source(129, 49) + SourceIndex(0) --- >>>objc8.t7 = function (n) { return n; }; 1 > @@ -1759,21 +1748,21 @@ sourceFile:contextualTyping.ts 13> 14> } 15> ; -1 >Emitted(72, 1) Source(130, 1) + SourceIndex(0) -2 >Emitted(72, 6) Source(130, 6) + SourceIndex(0) -3 >Emitted(72, 7) Source(130, 7) + SourceIndex(0) -4 >Emitted(72, 9) Source(130, 9) + SourceIndex(0) -5 >Emitted(72, 12) Source(130, 12) + SourceIndex(0) -6 >Emitted(72, 22) Source(130, 21) + SourceIndex(0) -7 >Emitted(72, 23) Source(130, 30) + SourceIndex(0) -8 >Emitted(72, 27) Source(130, 34) + SourceIndex(0) -9 >Emitted(72, 33) Source(130, 40) + SourceIndex(0) -10>Emitted(72, 34) Source(130, 41) + SourceIndex(0) -11>Emitted(72, 35) Source(130, 42) + SourceIndex(0) -12>Emitted(72, 36) Source(130, 42) + SourceIndex(0) -13>Emitted(72, 37) Source(130, 43) + SourceIndex(0) -14>Emitted(72, 38) Source(130, 44) + SourceIndex(0) -15>Emitted(72, 39) Source(130, 45) + SourceIndex(0) +1 >Emitted(71, 1) Source(130, 1) + SourceIndex(0) +2 >Emitted(71, 6) Source(130, 6) + SourceIndex(0) +3 >Emitted(71, 7) Source(130, 7) + SourceIndex(0) +4 >Emitted(71, 9) Source(130, 9) + SourceIndex(0) +5 >Emitted(71, 12) Source(130, 12) + SourceIndex(0) +6 >Emitted(71, 22) Source(130, 21) + SourceIndex(0) +7 >Emitted(71, 23) Source(130, 30) + SourceIndex(0) +8 >Emitted(71, 27) Source(130, 34) + SourceIndex(0) +9 >Emitted(71, 33) Source(130, 40) + SourceIndex(0) +10>Emitted(71, 34) Source(130, 41) + SourceIndex(0) +11>Emitted(71, 35) Source(130, 42) + SourceIndex(0) +12>Emitted(71, 36) Source(130, 42) + SourceIndex(0) +13>Emitted(71, 37) Source(130, 43) + SourceIndex(0) +14>Emitted(71, 38) Source(130, 44) + SourceIndex(0) +15>Emitted(71, 39) Source(130, 45) + SourceIndex(0) --- >>>objc8.t8 = function (n) { return n; }; 1-> @@ -1808,21 +1797,21 @@ sourceFile:contextualTyping.ts 13> 14> } 15> ; -1->Emitted(73, 1) Source(132, 1) + SourceIndex(0) -2 >Emitted(73, 6) Source(132, 6) + SourceIndex(0) -3 >Emitted(73, 7) Source(132, 7) + SourceIndex(0) -4 >Emitted(73, 9) Source(132, 9) + SourceIndex(0) -5 >Emitted(73, 12) Source(132, 12) + SourceIndex(0) -6 >Emitted(73, 22) Source(132, 21) + SourceIndex(0) -7 >Emitted(73, 23) Source(132, 22) + SourceIndex(0) -8 >Emitted(73, 27) Source(132, 26) + SourceIndex(0) -9 >Emitted(73, 33) Source(132, 32) + SourceIndex(0) -10>Emitted(73, 34) Source(132, 33) + SourceIndex(0) -11>Emitted(73, 35) Source(132, 34) + SourceIndex(0) -12>Emitted(73, 36) Source(132, 35) + SourceIndex(0) -13>Emitted(73, 37) Source(132, 36) + SourceIndex(0) -14>Emitted(73, 38) Source(132, 37) + SourceIndex(0) -15>Emitted(73, 39) Source(132, 38) + SourceIndex(0) +1->Emitted(72, 1) Source(132, 1) + SourceIndex(0) +2 >Emitted(72, 6) Source(132, 6) + SourceIndex(0) +3 >Emitted(72, 7) Source(132, 7) + SourceIndex(0) +4 >Emitted(72, 9) Source(132, 9) + SourceIndex(0) +5 >Emitted(72, 12) Source(132, 12) + SourceIndex(0) +6 >Emitted(72, 22) Source(132, 21) + SourceIndex(0) +7 >Emitted(72, 23) Source(132, 22) + SourceIndex(0) +8 >Emitted(72, 27) Source(132, 26) + SourceIndex(0) +9 >Emitted(72, 33) Source(132, 32) + SourceIndex(0) +10>Emitted(72, 34) Source(132, 33) + SourceIndex(0) +11>Emitted(72, 35) Source(132, 34) + SourceIndex(0) +12>Emitted(72, 36) Source(132, 35) + SourceIndex(0) +13>Emitted(72, 37) Source(132, 36) + SourceIndex(0) +14>Emitted(72, 38) Source(132, 37) + SourceIndex(0) +15>Emitted(72, 39) Source(132, 38) + SourceIndex(0) --- >>>objc8.t9 = [[], []]; 1 > @@ -1849,17 +1838,17 @@ sourceFile:contextualTyping.ts 9 > [] 10> ] 11> ; -1 >Emitted(74, 1) Source(133, 1) + SourceIndex(0) -2 >Emitted(74, 6) Source(133, 6) + SourceIndex(0) -3 >Emitted(74, 7) Source(133, 7) + SourceIndex(0) -4 >Emitted(74, 9) Source(133, 9) + SourceIndex(0) -5 >Emitted(74, 12) Source(133, 12) + SourceIndex(0) -6 >Emitted(74, 13) Source(133, 13) + SourceIndex(0) -7 >Emitted(74, 15) Source(133, 15) + SourceIndex(0) -8 >Emitted(74, 17) Source(133, 16) + SourceIndex(0) -9 >Emitted(74, 19) Source(133, 18) + SourceIndex(0) -10>Emitted(74, 20) Source(133, 19) + SourceIndex(0) -11>Emitted(74, 21) Source(133, 20) + SourceIndex(0) +1 >Emitted(73, 1) Source(133, 1) + SourceIndex(0) +2 >Emitted(73, 6) Source(133, 6) + SourceIndex(0) +3 >Emitted(73, 7) Source(133, 7) + SourceIndex(0) +4 >Emitted(73, 9) Source(133, 9) + SourceIndex(0) +5 >Emitted(73, 12) Source(133, 12) + SourceIndex(0) +6 >Emitted(73, 13) Source(133, 13) + SourceIndex(0) +7 >Emitted(73, 15) Source(133, 15) + SourceIndex(0) +8 >Emitted(73, 17) Source(133, 16) + SourceIndex(0) +9 >Emitted(73, 19) Source(133, 18) + SourceIndex(0) +10>Emitted(73, 20) Source(133, 19) + SourceIndex(0) +11>Emitted(73, 21) Source(133, 20) + SourceIndex(0) --- >>>objc8.t10 = [({}), ({})]; 1-> @@ -1894,21 +1883,21 @@ sourceFile:contextualTyping.ts 13> ) 14> ] 15> ; -1->Emitted(75, 1) Source(134, 1) + SourceIndex(0) -2 >Emitted(75, 6) Source(134, 6) + SourceIndex(0) -3 >Emitted(75, 7) Source(134, 7) + SourceIndex(0) -4 >Emitted(75, 10) Source(134, 10) + SourceIndex(0) -5 >Emitted(75, 13) Source(134, 13) + SourceIndex(0) -6 >Emitted(75, 14) Source(134, 20) + SourceIndex(0) -7 >Emitted(75, 15) Source(134, 21) + SourceIndex(0) -8 >Emitted(75, 17) Source(134, 23) + SourceIndex(0) -9 >Emitted(75, 18) Source(134, 24) + SourceIndex(0) -10>Emitted(75, 20) Source(134, 31) + SourceIndex(0) -11>Emitted(75, 21) Source(134, 32) + SourceIndex(0) -12>Emitted(75, 23) Source(134, 34) + SourceIndex(0) -13>Emitted(75, 24) Source(134, 35) + SourceIndex(0) -14>Emitted(75, 25) Source(134, 36) + SourceIndex(0) -15>Emitted(75, 26) Source(134, 37) + SourceIndex(0) +1->Emitted(74, 1) Source(134, 1) + SourceIndex(0) +2 >Emitted(74, 6) Source(134, 6) + SourceIndex(0) +3 >Emitted(74, 7) Source(134, 7) + SourceIndex(0) +4 >Emitted(74, 10) Source(134, 10) + SourceIndex(0) +5 >Emitted(74, 13) Source(134, 13) + SourceIndex(0) +6 >Emitted(74, 14) Source(134, 20) + SourceIndex(0) +7 >Emitted(74, 15) Source(134, 21) + SourceIndex(0) +8 >Emitted(74, 17) Source(134, 23) + SourceIndex(0) +9 >Emitted(74, 18) Source(134, 24) + SourceIndex(0) +10>Emitted(74, 20) Source(134, 31) + SourceIndex(0) +11>Emitted(74, 21) Source(134, 32) + SourceIndex(0) +12>Emitted(74, 23) Source(134, 34) + SourceIndex(0) +13>Emitted(74, 24) Source(134, 35) + SourceIndex(0) +14>Emitted(74, 25) Source(134, 36) + SourceIndex(0) +15>Emitted(74, 26) Source(134, 37) + SourceIndex(0) --- >>>objc8.t11 = [function (n, s) { return s; }]; 1-> @@ -1950,25 +1939,25 @@ sourceFile:contextualTyping.ts 17> } 18> ] 19> ; -1->Emitted(76, 1) Source(135, 1) + SourceIndex(0) -2 >Emitted(76, 6) Source(135, 6) + SourceIndex(0) -3 >Emitted(76, 7) Source(135, 7) + SourceIndex(0) -4 >Emitted(76, 10) Source(135, 10) + SourceIndex(0) -5 >Emitted(76, 13) Source(135, 13) + SourceIndex(0) -6 >Emitted(76, 14) Source(135, 14) + SourceIndex(0) -7 >Emitted(76, 24) Source(135, 23) + SourceIndex(0) -8 >Emitted(76, 25) Source(135, 24) + SourceIndex(0) -9 >Emitted(76, 27) Source(135, 26) + SourceIndex(0) -10>Emitted(76, 28) Source(135, 27) + SourceIndex(0) -11>Emitted(76, 32) Source(135, 31) + SourceIndex(0) -12>Emitted(76, 38) Source(135, 37) + SourceIndex(0) -13>Emitted(76, 39) Source(135, 38) + SourceIndex(0) -14>Emitted(76, 40) Source(135, 39) + SourceIndex(0) -15>Emitted(76, 41) Source(135, 40) + SourceIndex(0) -16>Emitted(76, 42) Source(135, 41) + SourceIndex(0) -17>Emitted(76, 43) Source(135, 42) + SourceIndex(0) -18>Emitted(76, 44) Source(135, 43) + SourceIndex(0) -19>Emitted(76, 45) Source(135, 44) + SourceIndex(0) +1->Emitted(75, 1) Source(135, 1) + SourceIndex(0) +2 >Emitted(75, 6) Source(135, 6) + SourceIndex(0) +3 >Emitted(75, 7) Source(135, 7) + SourceIndex(0) +4 >Emitted(75, 10) Source(135, 10) + SourceIndex(0) +5 >Emitted(75, 13) Source(135, 13) + SourceIndex(0) +6 >Emitted(75, 14) Source(135, 14) + SourceIndex(0) +7 >Emitted(75, 24) Source(135, 23) + SourceIndex(0) +8 >Emitted(75, 25) Source(135, 24) + SourceIndex(0) +9 >Emitted(75, 27) Source(135, 26) + SourceIndex(0) +10>Emitted(75, 28) Source(135, 27) + SourceIndex(0) +11>Emitted(75, 32) Source(135, 31) + SourceIndex(0) +12>Emitted(75, 38) Source(135, 37) + SourceIndex(0) +13>Emitted(75, 39) Source(135, 38) + SourceIndex(0) +14>Emitted(75, 40) Source(135, 39) + SourceIndex(0) +15>Emitted(75, 41) Source(135, 40) + SourceIndex(0) +16>Emitted(75, 42) Source(135, 41) + SourceIndex(0) +17>Emitted(75, 43) Source(135, 42) + SourceIndex(0) +18>Emitted(75, 44) Source(135, 43) + SourceIndex(0) +19>Emitted(75, 45) Source(135, 44) + SourceIndex(0) --- >>>objc8.t12 = { 1 > @@ -1983,11 +1972,11 @@ sourceFile:contextualTyping.ts 3 > . 4 > t12 5 > = -1 >Emitted(77, 1) Source(136, 1) + SourceIndex(0) -2 >Emitted(77, 6) Source(136, 6) + SourceIndex(0) -3 >Emitted(77, 7) Source(136, 7) + SourceIndex(0) -4 >Emitted(77, 10) Source(136, 10) + SourceIndex(0) -5 >Emitted(77, 13) Source(136, 13) + SourceIndex(0) +1 >Emitted(76, 1) Source(136, 1) + SourceIndex(0) +2 >Emitted(76, 6) Source(136, 6) + SourceIndex(0) +3 >Emitted(76, 7) Source(136, 7) + SourceIndex(0) +4 >Emitted(76, 10) Source(136, 10) + SourceIndex(0) +5 >Emitted(76, 13) Source(136, 13) + SourceIndex(0) --- >>> foo: ({}) 1->^^^^ @@ -2003,12 +1992,12 @@ sourceFile:contextualTyping.ts 4 > ( 5 > {} 6 > ) -1->Emitted(78, 5) Source(137, 5) + SourceIndex(0) -2 >Emitted(78, 8) Source(137, 8) + SourceIndex(0) -3 >Emitted(78, 10) Source(137, 16) + SourceIndex(0) -4 >Emitted(78, 11) Source(137, 17) + SourceIndex(0) -5 >Emitted(78, 13) Source(137, 19) + SourceIndex(0) -6 >Emitted(78, 14) Source(137, 20) + SourceIndex(0) +1->Emitted(77, 5) Source(137, 5) + SourceIndex(0) +2 >Emitted(77, 8) Source(137, 8) + SourceIndex(0) +3 >Emitted(77, 10) Source(137, 16) + SourceIndex(0) +4 >Emitted(77, 11) Source(137, 17) + SourceIndex(0) +5 >Emitted(77, 13) Source(137, 19) + SourceIndex(0) +6 >Emitted(77, 14) Source(137, 20) + SourceIndex(0) --- >>>}; 1 >^ @@ -2017,8 +2006,8 @@ sourceFile:contextualTyping.ts 1 > >} 2 > -1 >Emitted(79, 2) Source(138, 2) + SourceIndex(0) -2 >Emitted(79, 3) Source(138, 2) + SourceIndex(0) +1 >Emitted(78, 2) Source(138, 2) + SourceIndex(0) +2 >Emitted(78, 3) Source(138, 2) + SourceIndex(0) --- >>>objc8.t13 = ({ 1-> @@ -2035,12 +2024,12 @@ sourceFile:contextualTyping.ts 4 > t13 5 > = 6 > ( -1->Emitted(80, 1) Source(139, 1) + SourceIndex(0) -2 >Emitted(80, 6) Source(139, 6) + SourceIndex(0) -3 >Emitted(80, 7) Source(139, 7) + SourceIndex(0) -4 >Emitted(80, 10) Source(139, 10) + SourceIndex(0) -5 >Emitted(80, 13) Source(139, 19) + SourceIndex(0) -6 >Emitted(80, 14) Source(139, 20) + SourceIndex(0) +1->Emitted(79, 1) Source(139, 1) + SourceIndex(0) +2 >Emitted(79, 6) Source(139, 6) + SourceIndex(0) +3 >Emitted(79, 7) Source(139, 7) + SourceIndex(0) +4 >Emitted(79, 10) Source(139, 10) + SourceIndex(0) +5 >Emitted(79, 13) Source(139, 19) + SourceIndex(0) +6 >Emitted(79, 14) Source(139, 20) + SourceIndex(0) --- >>> f: function (i, s) { return s; } 1->^^^^ @@ -2072,20 +2061,20 @@ sourceFile:contextualTyping.ts 12> ; 13> 14> } -1->Emitted(81, 5) Source(140, 5) + SourceIndex(0) -2 >Emitted(81, 6) Source(140, 6) + SourceIndex(0) -3 >Emitted(81, 8) Source(140, 8) + SourceIndex(0) -4 >Emitted(81, 18) Source(140, 17) + SourceIndex(0) -5 >Emitted(81, 19) Source(140, 18) + SourceIndex(0) -6 >Emitted(81, 21) Source(140, 20) + SourceIndex(0) -7 >Emitted(81, 22) Source(140, 21) + SourceIndex(0) -8 >Emitted(81, 26) Source(140, 25) + SourceIndex(0) -9 >Emitted(81, 32) Source(140, 31) + SourceIndex(0) -10>Emitted(81, 33) Source(140, 32) + SourceIndex(0) -11>Emitted(81, 34) Source(140, 33) + SourceIndex(0) -12>Emitted(81, 35) Source(140, 34) + SourceIndex(0) -13>Emitted(81, 36) Source(140, 35) + SourceIndex(0) -14>Emitted(81, 37) Source(140, 36) + SourceIndex(0) +1->Emitted(80, 5) Source(140, 5) + SourceIndex(0) +2 >Emitted(80, 6) Source(140, 6) + SourceIndex(0) +3 >Emitted(80, 8) Source(140, 8) + SourceIndex(0) +4 >Emitted(80, 18) Source(140, 17) + SourceIndex(0) +5 >Emitted(80, 19) Source(140, 18) + SourceIndex(0) +6 >Emitted(80, 21) Source(140, 20) + SourceIndex(0) +7 >Emitted(80, 22) Source(140, 21) + SourceIndex(0) +8 >Emitted(80, 26) Source(140, 25) + SourceIndex(0) +9 >Emitted(80, 32) Source(140, 31) + SourceIndex(0) +10>Emitted(80, 33) Source(140, 32) + SourceIndex(0) +11>Emitted(80, 34) Source(140, 33) + SourceIndex(0) +12>Emitted(80, 35) Source(140, 34) + SourceIndex(0) +13>Emitted(80, 36) Source(140, 35) + SourceIndex(0) +14>Emitted(80, 37) Source(140, 36) + SourceIndex(0) --- >>>}); 1 >^ @@ -2096,9 +2085,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(82, 2) Source(141, 2) + SourceIndex(0) -2 >Emitted(82, 3) Source(141, 3) + SourceIndex(0) -3 >Emitted(82, 4) Source(141, 3) + SourceIndex(0) +1 >Emitted(81, 2) Source(141, 2) + SourceIndex(0) +2 >Emitted(81, 3) Source(141, 3) + SourceIndex(0) +3 >Emitted(81, 4) Source(141, 3) + SourceIndex(0) --- >>>objc8.t14 = ({ 1-> @@ -2114,12 +2103,12 @@ sourceFile:contextualTyping.ts 4 > t14 5 > = 6 > ( -1->Emitted(83, 1) Source(142, 1) + SourceIndex(0) -2 >Emitted(83, 6) Source(142, 6) + SourceIndex(0) -3 >Emitted(83, 7) Source(142, 7) + SourceIndex(0) -4 >Emitted(83, 10) Source(142, 10) + SourceIndex(0) -5 >Emitted(83, 13) Source(142, 19) + SourceIndex(0) -6 >Emitted(83, 14) Source(142, 20) + SourceIndex(0) +1->Emitted(82, 1) Source(142, 1) + SourceIndex(0) +2 >Emitted(82, 6) Source(142, 6) + SourceIndex(0) +3 >Emitted(82, 7) Source(142, 7) + SourceIndex(0) +4 >Emitted(82, 10) Source(142, 10) + SourceIndex(0) +5 >Emitted(82, 13) Source(142, 19) + SourceIndex(0) +6 >Emitted(82, 14) Source(142, 20) + SourceIndex(0) --- >>> a: [] 1 >^^^^ @@ -2131,10 +2120,10 @@ sourceFile:contextualTyping.ts 2 > a 3 > : 4 > [] -1 >Emitted(84, 5) Source(143, 5) + SourceIndex(0) -2 >Emitted(84, 6) Source(143, 6) + SourceIndex(0) -3 >Emitted(84, 8) Source(143, 8) + SourceIndex(0) -4 >Emitted(84, 10) Source(143, 10) + SourceIndex(0) +1 >Emitted(83, 5) Source(143, 5) + SourceIndex(0) +2 >Emitted(83, 6) Source(143, 6) + SourceIndex(0) +3 >Emitted(83, 8) Source(143, 8) + SourceIndex(0) +4 >Emitted(83, 10) Source(143, 10) + SourceIndex(0) --- >>>}); 1 >^ @@ -2145,9 +2134,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(85, 2) Source(144, 2) + SourceIndex(0) -2 >Emitted(85, 3) Source(144, 3) + SourceIndex(0) -3 >Emitted(85, 4) Source(144, 3) + SourceIndex(0) +1 >Emitted(84, 2) Source(144, 2) + SourceIndex(0) +2 >Emitted(84, 3) Source(144, 3) + SourceIndex(0) +3 >Emitted(84, 4) Source(144, 3) + SourceIndex(0) --- >>>// CONTEXT: Function call 1-> @@ -2158,9 +2147,9 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Function call -1->Emitted(86, 1) Source(146, 1) + SourceIndex(0) -2 >Emitted(86, 1) Source(145, 1) + SourceIndex(0) -3 >Emitted(86, 26) Source(145, 26) + SourceIndex(0) +1->Emitted(85, 1) Source(146, 1) + SourceIndex(0) +2 >Emitted(85, 1) Source(145, 1) + SourceIndex(0) +3 >Emitted(85, 26) Source(145, 26) + SourceIndex(0) --- >>>function c9t5(f) { } 1 >^^^^^^^^^^^^^^ @@ -2172,10 +2161,10 @@ sourceFile:contextualTyping.ts 2 > f: (n: number) => IFoo 3 > ) { 4 > } -1 >Emitted(87, 15) Source(146, 15) + SourceIndex(0) -2 >Emitted(87, 16) Source(146, 37) + SourceIndex(0) -3 >Emitted(87, 20) Source(146, 40) + SourceIndex(0) name (c9t5) -4 >Emitted(87, 21) Source(146, 41) + SourceIndex(0) name (c9t5) +1 >Emitted(86, 15) Source(146, 15) + SourceIndex(0) +2 >Emitted(86, 16) Source(146, 37) + SourceIndex(0) +3 >Emitted(86, 20) Source(146, 40) + SourceIndex(0) name (c9t5) +4 >Emitted(86, 21) Source(146, 41) + SourceIndex(0) name (c9t5) --- >>>; 1 > @@ -2183,8 +2172,8 @@ sourceFile:contextualTyping.ts 3 > ^^^^^^^^^^^^^^^^^^^-> 1 > 2 >; -1 >Emitted(88, 1) Source(146, 41) + SourceIndex(0) -2 >Emitted(88, 2) Source(146, 42) + SourceIndex(0) +1 >Emitted(87, 1) Source(146, 41) + SourceIndex(0) +2 >Emitted(87, 2) Source(146, 42) + SourceIndex(0) --- >>>c9t5(function (n) { 1-> @@ -2199,11 +2188,11 @@ sourceFile:contextualTyping.ts 3 > ( 4 > function( 5 > n -1->Emitted(89, 1) Source(147, 1) + SourceIndex(0) -2 >Emitted(89, 5) Source(147, 5) + SourceIndex(0) -3 >Emitted(89, 6) Source(147, 6) + SourceIndex(0) -4 >Emitted(89, 16) Source(147, 15) + SourceIndex(0) -5 >Emitted(89, 17) Source(147, 16) + SourceIndex(0) +1->Emitted(88, 1) Source(147, 1) + SourceIndex(0) +2 >Emitted(88, 5) Source(147, 5) + SourceIndex(0) +3 >Emitted(88, 6) Source(147, 6) + SourceIndex(0) +4 >Emitted(88, 16) Source(147, 15) + SourceIndex(0) +5 >Emitted(88, 17) Source(147, 16) + SourceIndex(0) --- >>> return ({}); 1->^^^^ @@ -2221,13 +2210,13 @@ sourceFile:contextualTyping.ts 5 > {} 6 > ) 7 > ; -1->Emitted(90, 5) Source(148, 5) + SourceIndex(0) -2 >Emitted(90, 11) Source(148, 11) + SourceIndex(0) -3 >Emitted(90, 12) Source(148, 18) + SourceIndex(0) -4 >Emitted(90, 13) Source(148, 19) + SourceIndex(0) -5 >Emitted(90, 15) Source(148, 21) + SourceIndex(0) -6 >Emitted(90, 16) Source(148, 22) + SourceIndex(0) -7 >Emitted(90, 17) Source(148, 23) + SourceIndex(0) +1->Emitted(89, 5) Source(148, 5) + SourceIndex(0) +2 >Emitted(89, 11) Source(148, 11) + SourceIndex(0) +3 >Emitted(89, 12) Source(148, 18) + SourceIndex(0) +4 >Emitted(89, 13) Source(148, 19) + SourceIndex(0) +5 >Emitted(89, 15) Source(148, 21) + SourceIndex(0) +6 >Emitted(89, 16) Source(148, 22) + SourceIndex(0) +7 >Emitted(89, 17) Source(148, 23) + SourceIndex(0) --- >>>}); 1 > @@ -2240,10 +2229,10 @@ sourceFile:contextualTyping.ts 2 >} 3 > ) 4 > ; -1 >Emitted(91, 1) Source(149, 1) + SourceIndex(0) -2 >Emitted(91, 2) Source(149, 2) + SourceIndex(0) -3 >Emitted(91, 3) Source(149, 3) + SourceIndex(0) -4 >Emitted(91, 4) Source(149, 4) + SourceIndex(0) +1 >Emitted(90, 1) Source(149, 1) + SourceIndex(0) +2 >Emitted(90, 2) Source(149, 2) + SourceIndex(0) +3 >Emitted(90, 3) Source(149, 3) + SourceIndex(0) +4 >Emitted(90, 4) Source(149, 4) + SourceIndex(0) --- >>>// CONTEXT: Return statement 1-> @@ -2256,9 +2245,9 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Return statement -1->Emitted(92, 1) Source(152, 1) + SourceIndex(0) -2 >Emitted(92, 1) Source(151, 1) + SourceIndex(0) -3 >Emitted(92, 29) Source(151, 29) + SourceIndex(0) +1->Emitted(91, 1) Source(152, 1) + SourceIndex(0) +2 >Emitted(91, 1) Source(151, 1) + SourceIndex(0) +3 >Emitted(91, 29) Source(151, 29) + SourceIndex(0) --- >>>var c10t5 = function () { return function (n) { return ({}); }; }; 1->^^^^ @@ -2304,27 +2293,27 @@ sourceFile:contextualTyping.ts 19> 20> } 21> ; -1->Emitted(93, 5) Source(152, 5) + SourceIndex(0) -2 >Emitted(93, 10) Source(152, 10) + SourceIndex(0) -3 >Emitted(93, 13) Source(152, 40) + SourceIndex(0) -4 >Emitted(93, 27) Source(152, 53) + SourceIndex(0) -5 >Emitted(93, 33) Source(152, 59) + SourceIndex(0) -6 >Emitted(93, 34) Source(152, 60) + SourceIndex(0) -7 >Emitted(93, 44) Source(152, 69) + SourceIndex(0) -8 >Emitted(93, 45) Source(152, 70) + SourceIndex(0) -9 >Emitted(93, 49) Source(152, 74) + SourceIndex(0) -10>Emitted(93, 55) Source(152, 80) + SourceIndex(0) -11>Emitted(93, 56) Source(152, 87) + SourceIndex(0) -12>Emitted(93, 57) Source(152, 88) + SourceIndex(0) -13>Emitted(93, 59) Source(152, 90) + SourceIndex(0) -14>Emitted(93, 60) Source(152, 91) + SourceIndex(0) -15>Emitted(93, 61) Source(152, 91) + SourceIndex(0) -16>Emitted(93, 62) Source(152, 92) + SourceIndex(0) -17>Emitted(93, 63) Source(152, 93) + SourceIndex(0) -18>Emitted(93, 64) Source(152, 93) + SourceIndex(0) -19>Emitted(93, 65) Source(152, 94) + SourceIndex(0) -20>Emitted(93, 66) Source(152, 95) + SourceIndex(0) -21>Emitted(93, 67) Source(152, 96) + SourceIndex(0) +1->Emitted(92, 5) Source(152, 5) + SourceIndex(0) +2 >Emitted(92, 10) Source(152, 10) + SourceIndex(0) +3 >Emitted(92, 13) Source(152, 40) + SourceIndex(0) +4 >Emitted(92, 27) Source(152, 53) + SourceIndex(0) +5 >Emitted(92, 33) Source(152, 59) + SourceIndex(0) +6 >Emitted(92, 34) Source(152, 60) + SourceIndex(0) +7 >Emitted(92, 44) Source(152, 69) + SourceIndex(0) +8 >Emitted(92, 45) Source(152, 70) + SourceIndex(0) +9 >Emitted(92, 49) Source(152, 74) + SourceIndex(0) +10>Emitted(92, 55) Source(152, 80) + SourceIndex(0) +11>Emitted(92, 56) Source(152, 87) + SourceIndex(0) +12>Emitted(92, 57) Source(152, 88) + SourceIndex(0) +13>Emitted(92, 59) Source(152, 90) + SourceIndex(0) +14>Emitted(92, 60) Source(152, 91) + SourceIndex(0) +15>Emitted(92, 61) Source(152, 91) + SourceIndex(0) +16>Emitted(92, 62) Source(152, 92) + SourceIndex(0) +17>Emitted(92, 63) Source(152, 93) + SourceIndex(0) +18>Emitted(92, 64) Source(152, 93) + SourceIndex(0) +19>Emitted(92, 65) Source(152, 94) + SourceIndex(0) +20>Emitted(92, 66) Source(152, 95) + SourceIndex(0) +21>Emitted(92, 67) Source(152, 96) + SourceIndex(0) --- >>>// CONTEXT: Newing a class 1 > @@ -2337,9 +2326,9 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Newing a class -1 >Emitted(94, 1) Source(155, 1) + SourceIndex(0) -2 >Emitted(94, 1) Source(154, 1) + SourceIndex(0) -3 >Emitted(94, 27) Source(154, 27) + SourceIndex(0) +1 >Emitted(93, 1) Source(155, 1) + SourceIndex(0) +2 >Emitted(93, 1) Source(154, 1) + SourceIndex(0) +3 >Emitted(93, 27) Source(154, 27) + SourceIndex(0) --- >>>var C11t5 = (function () { >>> function C11t5(f) { @@ -2350,9 +2339,9 @@ sourceFile:contextualTyping.ts >class C11t5 { 2 > constructor( 3 > f: (n: number) => IFoo -1->Emitted(96, 5) Source(155, 15) + SourceIndex(0) name (C11t5) -2 >Emitted(96, 20) Source(155, 27) + SourceIndex(0) name (C11t5) -3 >Emitted(96, 21) Source(155, 49) + SourceIndex(0) name (C11t5) +1->Emitted(95, 5) Source(155, 15) + SourceIndex(0) name (C11t5) +2 >Emitted(95, 20) Source(155, 27) + SourceIndex(0) name (C11t5) +3 >Emitted(95, 21) Source(155, 49) + SourceIndex(0) name (C11t5) --- >>> } 1 >^^^^ @@ -2360,16 +2349,16 @@ sourceFile:contextualTyping.ts 3 > ^^^^^^^^^^^^^-> 1 >) { 2 > } -1 >Emitted(97, 5) Source(155, 53) + SourceIndex(0) name (C11t5.constructor) -2 >Emitted(97, 6) Source(155, 54) + SourceIndex(0) name (C11t5.constructor) +1 >Emitted(96, 5) Source(155, 53) + SourceIndex(0) name (C11t5.constructor) +2 >Emitted(96, 6) Source(155, 54) + SourceIndex(0) name (C11t5.constructor) --- >>> return C11t5; 1->^^^^ 2 > ^^^^^^^^^^^^ 1-> 2 > } -1->Emitted(98, 5) Source(155, 55) + SourceIndex(0) name (C11t5) -2 >Emitted(98, 17) Source(155, 56) + SourceIndex(0) name (C11t5) +1->Emitted(97, 5) Source(155, 55) + SourceIndex(0) name (C11t5) +2 >Emitted(97, 17) Source(155, 56) + SourceIndex(0) name (C11t5) --- >>>})(); 1 > @@ -2380,10 +2369,10 @@ sourceFile:contextualTyping.ts 2 >} 3 > 4 > class C11t5 { constructor(f: (n: number) => IFoo) { } } -1 >Emitted(99, 1) Source(155, 55) + SourceIndex(0) name (C11t5) -2 >Emitted(99, 2) Source(155, 56) + SourceIndex(0) name (C11t5) -3 >Emitted(99, 2) Source(155, 1) + SourceIndex(0) -4 >Emitted(99, 6) Source(155, 56) + SourceIndex(0) +1 >Emitted(98, 1) Source(155, 55) + SourceIndex(0) name (C11t5) +2 >Emitted(98, 2) Source(155, 56) + SourceIndex(0) name (C11t5) +3 >Emitted(98, 2) Source(155, 1) + SourceIndex(0) +4 >Emitted(98, 6) Source(155, 56) + SourceIndex(0) --- >>>; 1 > @@ -2391,8 +2380,8 @@ sourceFile:contextualTyping.ts 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 2 >; -1 >Emitted(100, 1) Source(155, 56) + SourceIndex(0) -2 >Emitted(100, 2) Source(155, 57) + SourceIndex(0) +1 >Emitted(99, 1) Source(155, 56) + SourceIndex(0) +2 >Emitted(99, 2) Source(155, 57) + SourceIndex(0) --- >>>var i = new C11t5(function (n) { return ({}); }); 1-> @@ -2436,26 +2425,26 @@ sourceFile:contextualTyping.ts 18> } 19> ) 20> ; -1->Emitted(101, 1) Source(156, 1) + SourceIndex(0) -2 >Emitted(101, 5) Source(156, 5) + SourceIndex(0) -3 >Emitted(101, 6) Source(156, 6) + SourceIndex(0) -4 >Emitted(101, 9) Source(156, 9) + SourceIndex(0) -5 >Emitted(101, 13) Source(156, 13) + SourceIndex(0) -6 >Emitted(101, 18) Source(156, 18) + SourceIndex(0) -7 >Emitted(101, 19) Source(156, 19) + SourceIndex(0) -8 >Emitted(101, 29) Source(156, 28) + SourceIndex(0) -9 >Emitted(101, 30) Source(156, 29) + SourceIndex(0) -10>Emitted(101, 34) Source(156, 33) + SourceIndex(0) -11>Emitted(101, 40) Source(156, 39) + SourceIndex(0) -12>Emitted(101, 41) Source(156, 46) + SourceIndex(0) -13>Emitted(101, 42) Source(156, 47) + SourceIndex(0) -14>Emitted(101, 44) Source(156, 49) + SourceIndex(0) -15>Emitted(101, 45) Source(156, 50) + SourceIndex(0) -16>Emitted(101, 46) Source(156, 50) + SourceIndex(0) -17>Emitted(101, 47) Source(156, 51) + SourceIndex(0) -18>Emitted(101, 48) Source(156, 52) + SourceIndex(0) -19>Emitted(101, 49) Source(156, 53) + SourceIndex(0) -20>Emitted(101, 50) Source(156, 54) + SourceIndex(0) +1->Emitted(100, 1) Source(156, 1) + SourceIndex(0) +2 >Emitted(100, 5) Source(156, 5) + SourceIndex(0) +3 >Emitted(100, 6) Source(156, 6) + SourceIndex(0) +4 >Emitted(100, 9) Source(156, 9) + SourceIndex(0) +5 >Emitted(100, 13) Source(156, 13) + SourceIndex(0) +6 >Emitted(100, 18) Source(156, 18) + SourceIndex(0) +7 >Emitted(100, 19) Source(156, 19) + SourceIndex(0) +8 >Emitted(100, 29) Source(156, 28) + SourceIndex(0) +9 >Emitted(100, 30) Source(156, 29) + SourceIndex(0) +10>Emitted(100, 34) Source(156, 33) + SourceIndex(0) +11>Emitted(100, 40) Source(156, 39) + SourceIndex(0) +12>Emitted(100, 41) Source(156, 46) + SourceIndex(0) +13>Emitted(100, 42) Source(156, 47) + SourceIndex(0) +14>Emitted(100, 44) Source(156, 49) + SourceIndex(0) +15>Emitted(100, 45) Source(156, 50) + SourceIndex(0) +16>Emitted(100, 46) Source(156, 50) + SourceIndex(0) +17>Emitted(100, 47) Source(156, 51) + SourceIndex(0) +18>Emitted(100, 48) Source(156, 52) + SourceIndex(0) +19>Emitted(100, 49) Source(156, 53) + SourceIndex(0) +20>Emitted(100, 50) Source(156, 54) + SourceIndex(0) --- >>>// CONTEXT: Type annotated expression 1 > @@ -2468,9 +2457,9 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Type annotated expression -1 >Emitted(102, 1) Source(159, 1) + SourceIndex(0) -2 >Emitted(102, 1) Source(158, 1) + SourceIndex(0) -3 >Emitted(102, 38) Source(158, 38) + SourceIndex(0) +1 >Emitted(101, 1) Source(159, 1) + SourceIndex(0) +2 >Emitted(101, 1) Source(158, 1) + SourceIndex(0) +3 >Emitted(101, 38) Source(158, 38) + SourceIndex(0) --- >>>var c12t1 = (function (s) { return s; }); 1->^^^^ @@ -2504,21 +2493,21 @@ sourceFile:contextualTyping.ts 13> } 14> ) 15> ; -1->Emitted(103, 5) Source(159, 5) + SourceIndex(0) -2 >Emitted(103, 10) Source(159, 10) + SourceIndex(0) -3 >Emitted(103, 13) Source(159, 37) + SourceIndex(0) -4 >Emitted(103, 14) Source(159, 38) + SourceIndex(0) -5 >Emitted(103, 24) Source(159, 47) + SourceIndex(0) -6 >Emitted(103, 25) Source(159, 48) + SourceIndex(0) -7 >Emitted(103, 29) Source(159, 52) + SourceIndex(0) -8 >Emitted(103, 35) Source(159, 58) + SourceIndex(0) -9 >Emitted(103, 36) Source(159, 59) + SourceIndex(0) -10>Emitted(103, 37) Source(159, 60) + SourceIndex(0) -11>Emitted(103, 38) Source(159, 60) + SourceIndex(0) -12>Emitted(103, 39) Source(159, 61) + SourceIndex(0) -13>Emitted(103, 40) Source(159, 62) + SourceIndex(0) -14>Emitted(103, 41) Source(159, 63) + SourceIndex(0) -15>Emitted(103, 42) Source(159, 64) + SourceIndex(0) +1->Emitted(102, 5) Source(159, 5) + SourceIndex(0) +2 >Emitted(102, 10) Source(159, 10) + SourceIndex(0) +3 >Emitted(102, 13) Source(159, 37) + SourceIndex(0) +4 >Emitted(102, 14) Source(159, 38) + SourceIndex(0) +5 >Emitted(102, 24) Source(159, 47) + SourceIndex(0) +6 >Emitted(102, 25) Source(159, 48) + SourceIndex(0) +7 >Emitted(102, 29) Source(159, 52) + SourceIndex(0) +8 >Emitted(102, 35) Source(159, 58) + SourceIndex(0) +9 >Emitted(102, 36) Source(159, 59) + SourceIndex(0) +10>Emitted(102, 37) Source(159, 60) + SourceIndex(0) +11>Emitted(102, 38) Source(159, 60) + SourceIndex(0) +12>Emitted(102, 39) Source(159, 61) + SourceIndex(0) +13>Emitted(102, 40) Source(159, 62) + SourceIndex(0) +14>Emitted(102, 41) Source(159, 63) + SourceIndex(0) +15>Emitted(102, 42) Source(159, 64) + SourceIndex(0) --- >>>var c12t2 = ({ 1 > @@ -2532,11 +2521,11 @@ sourceFile:contextualTyping.ts 3 > c12t2 4 > = 5 > ( -1 >Emitted(104, 1) Source(160, 1) + SourceIndex(0) -2 >Emitted(104, 5) Source(160, 5) + SourceIndex(0) -3 >Emitted(104, 10) Source(160, 10) + SourceIndex(0) -4 >Emitted(104, 13) Source(160, 20) + SourceIndex(0) -5 >Emitted(104, 14) Source(160, 21) + SourceIndex(0) +1 >Emitted(103, 1) Source(160, 1) + SourceIndex(0) +2 >Emitted(103, 5) Source(160, 5) + SourceIndex(0) +3 >Emitted(103, 10) Source(160, 10) + SourceIndex(0) +4 >Emitted(103, 13) Source(160, 20) + SourceIndex(0) +5 >Emitted(103, 14) Source(160, 21) + SourceIndex(0) --- >>> n: 1 1 >^^^^ @@ -2548,10 +2537,10 @@ sourceFile:contextualTyping.ts 2 > n 3 > : 4 > 1 -1 >Emitted(105, 5) Source(161, 5) + SourceIndex(0) -2 >Emitted(105, 6) Source(161, 6) + SourceIndex(0) -3 >Emitted(105, 8) Source(161, 8) + SourceIndex(0) -4 >Emitted(105, 9) Source(161, 9) + SourceIndex(0) +1 >Emitted(104, 5) Source(161, 5) + SourceIndex(0) +2 >Emitted(104, 6) Source(161, 6) + SourceIndex(0) +3 >Emitted(104, 8) Source(161, 8) + SourceIndex(0) +4 >Emitted(104, 9) Source(161, 9) + SourceIndex(0) --- >>>}); 1 >^ @@ -2562,9 +2551,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > ; -1 >Emitted(106, 2) Source(162, 2) + SourceIndex(0) -2 >Emitted(106, 3) Source(162, 3) + SourceIndex(0) -3 >Emitted(106, 4) Source(162, 4) + SourceIndex(0) +1 >Emitted(105, 2) Source(162, 2) + SourceIndex(0) +2 >Emitted(105, 3) Source(162, 3) + SourceIndex(0) +3 >Emitted(105, 4) Source(162, 4) + SourceIndex(0) --- >>>var c12t3 = []; 1-> @@ -2581,12 +2570,12 @@ sourceFile:contextualTyping.ts 4 > = 5 > [] 6 > ; -1->Emitted(107, 1) Source(163, 1) + SourceIndex(0) -2 >Emitted(107, 5) Source(163, 5) + SourceIndex(0) -3 >Emitted(107, 10) Source(163, 10) + SourceIndex(0) -4 >Emitted(107, 13) Source(163, 24) + SourceIndex(0) -5 >Emitted(107, 15) Source(163, 26) + SourceIndex(0) -6 >Emitted(107, 16) Source(163, 27) + SourceIndex(0) +1->Emitted(106, 1) Source(163, 1) + SourceIndex(0) +2 >Emitted(106, 5) Source(163, 5) + SourceIndex(0) +3 >Emitted(106, 10) Source(163, 10) + SourceIndex(0) +4 >Emitted(106, 13) Source(163, 24) + SourceIndex(0) +5 >Emitted(106, 15) Source(163, 26) + SourceIndex(0) +6 >Emitted(106, 16) Source(163, 27) + SourceIndex(0) --- >>>var c12t4 = function () { return ({}); }; 1-> @@ -2619,20 +2608,20 @@ sourceFile:contextualTyping.ts 12> 13> } 14> ; -1->Emitted(108, 1) Source(164, 1) + SourceIndex(0) -2 >Emitted(108, 5) Source(164, 5) + SourceIndex(0) -3 >Emitted(108, 10) Source(164, 10) + SourceIndex(0) -4 >Emitted(108, 13) Source(164, 26) + SourceIndex(0) -5 >Emitted(108, 27) Source(164, 39) + SourceIndex(0) -6 >Emitted(108, 33) Source(164, 45) + SourceIndex(0) -7 >Emitted(108, 34) Source(164, 52) + SourceIndex(0) -8 >Emitted(108, 35) Source(164, 53) + SourceIndex(0) -9 >Emitted(108, 37) Source(164, 55) + SourceIndex(0) -10>Emitted(108, 38) Source(164, 56) + SourceIndex(0) -11>Emitted(108, 39) Source(164, 56) + SourceIndex(0) -12>Emitted(108, 40) Source(164, 57) + SourceIndex(0) -13>Emitted(108, 41) Source(164, 58) + SourceIndex(0) -14>Emitted(108, 42) Source(164, 59) + SourceIndex(0) +1->Emitted(107, 1) Source(164, 1) + SourceIndex(0) +2 >Emitted(107, 5) Source(164, 5) + SourceIndex(0) +3 >Emitted(107, 10) Source(164, 10) + SourceIndex(0) +4 >Emitted(107, 13) Source(164, 26) + SourceIndex(0) +5 >Emitted(107, 27) Source(164, 39) + SourceIndex(0) +6 >Emitted(107, 33) Source(164, 45) + SourceIndex(0) +7 >Emitted(107, 34) Source(164, 52) + SourceIndex(0) +8 >Emitted(107, 35) Source(164, 53) + SourceIndex(0) +9 >Emitted(107, 37) Source(164, 55) + SourceIndex(0) +10>Emitted(107, 38) Source(164, 56) + SourceIndex(0) +11>Emitted(107, 39) Source(164, 56) + SourceIndex(0) +12>Emitted(107, 40) Source(164, 57) + SourceIndex(0) +13>Emitted(107, 41) Source(164, 58) + SourceIndex(0) +14>Emitted(107, 42) Source(164, 59) + SourceIndex(0) --- >>>var c12t5 = function (n) { return ({}); }; 1-> @@ -2669,22 +2658,22 @@ sourceFile:contextualTyping.ts 14> 15> } 16> ; -1->Emitted(109, 1) Source(165, 1) + SourceIndex(0) -2 >Emitted(109, 5) Source(165, 5) + SourceIndex(0) -3 >Emitted(109, 10) Source(165, 10) + SourceIndex(0) -4 >Emitted(109, 13) Source(165, 35) + SourceIndex(0) -5 >Emitted(109, 23) Source(165, 44) + SourceIndex(0) -6 >Emitted(109, 24) Source(165, 45) + SourceIndex(0) -7 >Emitted(109, 28) Source(165, 49) + SourceIndex(0) -8 >Emitted(109, 34) Source(165, 55) + SourceIndex(0) -9 >Emitted(109, 35) Source(165, 62) + SourceIndex(0) -10>Emitted(109, 36) Source(165, 63) + SourceIndex(0) -11>Emitted(109, 38) Source(165, 65) + SourceIndex(0) -12>Emitted(109, 39) Source(165, 66) + SourceIndex(0) -13>Emitted(109, 40) Source(165, 66) + SourceIndex(0) -14>Emitted(109, 41) Source(165, 67) + SourceIndex(0) -15>Emitted(109, 42) Source(165, 68) + SourceIndex(0) -16>Emitted(109, 43) Source(165, 69) + SourceIndex(0) +1->Emitted(108, 1) Source(165, 1) + SourceIndex(0) +2 >Emitted(108, 5) Source(165, 5) + SourceIndex(0) +3 >Emitted(108, 10) Source(165, 10) + SourceIndex(0) +4 >Emitted(108, 13) Source(165, 35) + SourceIndex(0) +5 >Emitted(108, 23) Source(165, 44) + SourceIndex(0) +6 >Emitted(108, 24) Source(165, 45) + SourceIndex(0) +7 >Emitted(108, 28) Source(165, 49) + SourceIndex(0) +8 >Emitted(108, 34) Source(165, 55) + SourceIndex(0) +9 >Emitted(108, 35) Source(165, 62) + SourceIndex(0) +10>Emitted(108, 36) Source(165, 63) + SourceIndex(0) +11>Emitted(108, 38) Source(165, 65) + SourceIndex(0) +12>Emitted(108, 39) Source(165, 66) + SourceIndex(0) +13>Emitted(108, 40) Source(165, 66) + SourceIndex(0) +14>Emitted(108, 41) Source(165, 67) + SourceIndex(0) +15>Emitted(108, 42) Source(165, 68) + SourceIndex(0) +16>Emitted(108, 43) Source(165, 69) + SourceIndex(0) --- >>>var c12t6 = function (n, s) { return ({}); }; 1-> @@ -2724,24 +2713,24 @@ sourceFile:contextualTyping.ts 16> 17> } 18> ; -1->Emitted(110, 1) Source(166, 1) + SourceIndex(0) -2 >Emitted(110, 5) Source(166, 5) + SourceIndex(0) -3 >Emitted(110, 10) Source(166, 10) + SourceIndex(0) -4 >Emitted(110, 13) Source(166, 46) + SourceIndex(0) -5 >Emitted(110, 23) Source(166, 55) + SourceIndex(0) -6 >Emitted(110, 24) Source(166, 56) + SourceIndex(0) -7 >Emitted(110, 26) Source(166, 58) + SourceIndex(0) -8 >Emitted(110, 27) Source(166, 59) + SourceIndex(0) -9 >Emitted(110, 31) Source(166, 63) + SourceIndex(0) -10>Emitted(110, 37) Source(166, 69) + SourceIndex(0) -11>Emitted(110, 38) Source(166, 76) + SourceIndex(0) -12>Emitted(110, 39) Source(166, 77) + SourceIndex(0) -13>Emitted(110, 41) Source(166, 79) + SourceIndex(0) -14>Emitted(110, 42) Source(166, 80) + SourceIndex(0) -15>Emitted(110, 43) Source(166, 80) + SourceIndex(0) -16>Emitted(110, 44) Source(166, 81) + SourceIndex(0) -17>Emitted(110, 45) Source(166, 82) + SourceIndex(0) -18>Emitted(110, 46) Source(166, 83) + SourceIndex(0) +1->Emitted(109, 1) Source(166, 1) + SourceIndex(0) +2 >Emitted(109, 5) Source(166, 5) + SourceIndex(0) +3 >Emitted(109, 10) Source(166, 10) + SourceIndex(0) +4 >Emitted(109, 13) Source(166, 46) + SourceIndex(0) +5 >Emitted(109, 23) Source(166, 55) + SourceIndex(0) +6 >Emitted(109, 24) Source(166, 56) + SourceIndex(0) +7 >Emitted(109, 26) Source(166, 58) + SourceIndex(0) +8 >Emitted(109, 27) Source(166, 59) + SourceIndex(0) +9 >Emitted(109, 31) Source(166, 63) + SourceIndex(0) +10>Emitted(109, 37) Source(166, 69) + SourceIndex(0) +11>Emitted(109, 38) Source(166, 76) + SourceIndex(0) +12>Emitted(109, 39) Source(166, 77) + SourceIndex(0) +13>Emitted(109, 41) Source(166, 79) + SourceIndex(0) +14>Emitted(109, 42) Source(166, 80) + SourceIndex(0) +15>Emitted(109, 43) Source(166, 80) + SourceIndex(0) +16>Emitted(109, 44) Source(166, 81) + SourceIndex(0) +17>Emitted(109, 45) Source(166, 82) + SourceIndex(0) +18>Emitted(109, 46) Source(166, 83) + SourceIndex(0) --- >>>var c12t7 = function (n) { return n; }; 1 > @@ -2777,20 +2766,20 @@ sourceFile:contextualTyping.ts 12> 13> } 14> ; -1 >Emitted(111, 1) Source(167, 1) + SourceIndex(0) -2 >Emitted(111, 5) Source(167, 5) + SourceIndex(0) -3 >Emitted(111, 10) Source(167, 10) + SourceIndex(0) -4 >Emitted(111, 13) Source(170, 4) + SourceIndex(0) -5 >Emitted(111, 23) Source(170, 13) + SourceIndex(0) -6 >Emitted(111, 24) Source(170, 21) + SourceIndex(0) -7 >Emitted(111, 28) Source(170, 25) + SourceIndex(0) -8 >Emitted(111, 34) Source(170, 31) + SourceIndex(0) -9 >Emitted(111, 35) Source(170, 32) + SourceIndex(0) -10>Emitted(111, 36) Source(170, 33) + SourceIndex(0) -11>Emitted(111, 37) Source(170, 33) + SourceIndex(0) -12>Emitted(111, 38) Source(170, 34) + SourceIndex(0) -13>Emitted(111, 39) Source(170, 35) + SourceIndex(0) -14>Emitted(111, 40) Source(170, 36) + SourceIndex(0) +1 >Emitted(110, 1) Source(167, 1) + SourceIndex(0) +2 >Emitted(110, 5) Source(167, 5) + SourceIndex(0) +3 >Emitted(110, 10) Source(167, 10) + SourceIndex(0) +4 >Emitted(110, 13) Source(170, 4) + SourceIndex(0) +5 >Emitted(110, 23) Source(170, 13) + SourceIndex(0) +6 >Emitted(110, 24) Source(170, 21) + SourceIndex(0) +7 >Emitted(110, 28) Source(170, 25) + SourceIndex(0) +8 >Emitted(110, 34) Source(170, 31) + SourceIndex(0) +9 >Emitted(110, 35) Source(170, 32) + SourceIndex(0) +10>Emitted(110, 36) Source(170, 33) + SourceIndex(0) +11>Emitted(110, 37) Source(170, 33) + SourceIndex(0) +12>Emitted(110, 38) Source(170, 34) + SourceIndex(0) +13>Emitted(110, 39) Source(170, 35) + SourceIndex(0) +14>Emitted(110, 40) Source(170, 36) + SourceIndex(0) --- >>>var c12t8 = function (n) { return n; }; 1-> @@ -2823,20 +2812,20 @@ sourceFile:contextualTyping.ts 12> 13> } 14> ; -1->Emitted(112, 1) Source(172, 1) + SourceIndex(0) -2 >Emitted(112, 5) Source(172, 5) + SourceIndex(0) -3 >Emitted(112, 10) Source(172, 10) + SourceIndex(0) -4 >Emitted(112, 13) Source(172, 48) + SourceIndex(0) -5 >Emitted(112, 23) Source(172, 57) + SourceIndex(0) -6 >Emitted(112, 24) Source(172, 58) + SourceIndex(0) -7 >Emitted(112, 28) Source(172, 62) + SourceIndex(0) -8 >Emitted(112, 34) Source(172, 68) + SourceIndex(0) -9 >Emitted(112, 35) Source(172, 69) + SourceIndex(0) -10>Emitted(112, 36) Source(172, 70) + SourceIndex(0) -11>Emitted(112, 37) Source(172, 71) + SourceIndex(0) -12>Emitted(112, 38) Source(172, 72) + SourceIndex(0) -13>Emitted(112, 39) Source(172, 73) + SourceIndex(0) -14>Emitted(112, 40) Source(172, 74) + SourceIndex(0) +1->Emitted(111, 1) Source(172, 1) + SourceIndex(0) +2 >Emitted(111, 5) Source(172, 5) + SourceIndex(0) +3 >Emitted(111, 10) Source(172, 10) + SourceIndex(0) +4 >Emitted(111, 13) Source(172, 48) + SourceIndex(0) +5 >Emitted(111, 23) Source(172, 57) + SourceIndex(0) +6 >Emitted(111, 24) Source(172, 58) + SourceIndex(0) +7 >Emitted(111, 28) Source(172, 62) + SourceIndex(0) +8 >Emitted(111, 34) Source(172, 68) + SourceIndex(0) +9 >Emitted(111, 35) Source(172, 69) + SourceIndex(0) +10>Emitted(111, 36) Source(172, 70) + SourceIndex(0) +11>Emitted(111, 37) Source(172, 71) + SourceIndex(0) +12>Emitted(111, 38) Source(172, 72) + SourceIndex(0) +13>Emitted(111, 39) Source(172, 73) + SourceIndex(0) +14>Emitted(111, 40) Source(172, 74) + SourceIndex(0) --- >>>var c12t9 = [[], []]; 1 > @@ -2861,16 +2850,16 @@ sourceFile:contextualTyping.ts 8 > [] 9 > ] 10> ; -1 >Emitted(113, 1) Source(173, 1) + SourceIndex(0) -2 >Emitted(113, 5) Source(173, 5) + SourceIndex(0) -3 >Emitted(113, 10) Source(173, 10) + SourceIndex(0) -4 >Emitted(113, 13) Source(173, 26) + SourceIndex(0) -5 >Emitted(113, 14) Source(173, 27) + SourceIndex(0) -6 >Emitted(113, 16) Source(173, 29) + SourceIndex(0) -7 >Emitted(113, 18) Source(173, 30) + SourceIndex(0) -8 >Emitted(113, 20) Source(173, 32) + SourceIndex(0) -9 >Emitted(113, 21) Source(173, 33) + SourceIndex(0) -10>Emitted(113, 22) Source(173, 34) + SourceIndex(0) +1 >Emitted(112, 1) Source(173, 1) + SourceIndex(0) +2 >Emitted(112, 5) Source(173, 5) + SourceIndex(0) +3 >Emitted(112, 10) Source(173, 10) + SourceIndex(0) +4 >Emitted(112, 13) Source(173, 26) + SourceIndex(0) +5 >Emitted(112, 14) Source(173, 27) + SourceIndex(0) +6 >Emitted(112, 16) Source(173, 29) + SourceIndex(0) +7 >Emitted(112, 18) Source(173, 30) + SourceIndex(0) +8 >Emitted(112, 20) Source(173, 32) + SourceIndex(0) +9 >Emitted(112, 21) Source(173, 33) + SourceIndex(0) +10>Emitted(112, 22) Source(173, 34) + SourceIndex(0) --- >>>var c12t10 = [({}), ({})]; 1-> @@ -2903,20 +2892,20 @@ sourceFile:contextualTyping.ts 12> ) 13> ] 14> ; -1->Emitted(114, 1) Source(174, 1) + SourceIndex(0) -2 >Emitted(114, 5) Source(174, 5) + SourceIndex(0) -3 >Emitted(114, 11) Source(174, 11) + SourceIndex(0) -4 >Emitted(114, 14) Source(174, 23) + SourceIndex(0) -5 >Emitted(114, 15) Source(174, 30) + SourceIndex(0) -6 >Emitted(114, 16) Source(174, 31) + SourceIndex(0) -7 >Emitted(114, 18) Source(174, 33) + SourceIndex(0) -8 >Emitted(114, 19) Source(174, 34) + SourceIndex(0) -9 >Emitted(114, 21) Source(174, 41) + SourceIndex(0) -10>Emitted(114, 22) Source(174, 42) + SourceIndex(0) -11>Emitted(114, 24) Source(174, 44) + SourceIndex(0) -12>Emitted(114, 25) Source(174, 45) + SourceIndex(0) -13>Emitted(114, 26) Source(174, 46) + SourceIndex(0) -14>Emitted(114, 27) Source(174, 47) + SourceIndex(0) +1->Emitted(113, 1) Source(174, 1) + SourceIndex(0) +2 >Emitted(113, 5) Source(174, 5) + SourceIndex(0) +3 >Emitted(113, 11) Source(174, 11) + SourceIndex(0) +4 >Emitted(113, 14) Source(174, 23) + SourceIndex(0) +5 >Emitted(113, 15) Source(174, 30) + SourceIndex(0) +6 >Emitted(113, 16) Source(174, 31) + SourceIndex(0) +7 >Emitted(113, 18) Source(174, 33) + SourceIndex(0) +8 >Emitted(113, 19) Source(174, 34) + SourceIndex(0) +9 >Emitted(113, 21) Source(174, 41) + SourceIndex(0) +10>Emitted(113, 22) Source(174, 42) + SourceIndex(0) +11>Emitted(113, 24) Source(174, 44) + SourceIndex(0) +12>Emitted(113, 25) Source(174, 45) + SourceIndex(0) +13>Emitted(113, 26) Source(174, 46) + SourceIndex(0) +14>Emitted(113, 27) Source(174, 47) + SourceIndex(0) --- >>>var c12t11 = [function (n, s) { return s; }]; 1-> @@ -2956,24 +2945,24 @@ sourceFile:contextualTyping.ts 16> } 17> ] 18> ; -1->Emitted(115, 1) Source(175, 1) + SourceIndex(0) -2 >Emitted(115, 5) Source(175, 5) + SourceIndex(0) -3 >Emitted(115, 11) Source(175, 11) + SourceIndex(0) -4 >Emitted(115, 14) Source(175, 52) + SourceIndex(0) -5 >Emitted(115, 15) Source(175, 53) + SourceIndex(0) -6 >Emitted(115, 25) Source(175, 62) + SourceIndex(0) -7 >Emitted(115, 26) Source(175, 63) + SourceIndex(0) -8 >Emitted(115, 28) Source(175, 65) + SourceIndex(0) -9 >Emitted(115, 29) Source(175, 66) + SourceIndex(0) -10>Emitted(115, 33) Source(175, 70) + SourceIndex(0) -11>Emitted(115, 39) Source(175, 76) + SourceIndex(0) -12>Emitted(115, 40) Source(175, 77) + SourceIndex(0) -13>Emitted(115, 41) Source(175, 78) + SourceIndex(0) -14>Emitted(115, 42) Source(175, 79) + SourceIndex(0) -15>Emitted(115, 43) Source(175, 80) + SourceIndex(0) -16>Emitted(115, 44) Source(175, 81) + SourceIndex(0) -17>Emitted(115, 45) Source(175, 82) + SourceIndex(0) -18>Emitted(115, 46) Source(175, 83) + SourceIndex(0) +1->Emitted(114, 1) Source(175, 1) + SourceIndex(0) +2 >Emitted(114, 5) Source(175, 5) + SourceIndex(0) +3 >Emitted(114, 11) Source(175, 11) + SourceIndex(0) +4 >Emitted(114, 14) Source(175, 52) + SourceIndex(0) +5 >Emitted(114, 15) Source(175, 53) + SourceIndex(0) +6 >Emitted(114, 25) Source(175, 62) + SourceIndex(0) +7 >Emitted(114, 26) Source(175, 63) + SourceIndex(0) +8 >Emitted(114, 28) Source(175, 65) + SourceIndex(0) +9 >Emitted(114, 29) Source(175, 66) + SourceIndex(0) +10>Emitted(114, 33) Source(175, 70) + SourceIndex(0) +11>Emitted(114, 39) Source(175, 76) + SourceIndex(0) +12>Emitted(114, 40) Source(175, 77) + SourceIndex(0) +13>Emitted(114, 41) Source(175, 78) + SourceIndex(0) +14>Emitted(114, 42) Source(175, 79) + SourceIndex(0) +15>Emitted(114, 43) Source(175, 80) + SourceIndex(0) +16>Emitted(114, 44) Source(175, 81) + SourceIndex(0) +17>Emitted(114, 45) Source(175, 82) + SourceIndex(0) +18>Emitted(114, 46) Source(175, 83) + SourceIndex(0) --- >>>var c12t12 = { 1 > @@ -2986,10 +2975,10 @@ sourceFile:contextualTyping.ts 2 >var 3 > c12t12 4 > = -1 >Emitted(116, 1) Source(176, 1) + SourceIndex(0) -2 >Emitted(116, 5) Source(176, 5) + SourceIndex(0) -3 >Emitted(116, 11) Source(176, 11) + SourceIndex(0) -4 >Emitted(116, 14) Source(176, 21) + SourceIndex(0) +1 >Emitted(115, 1) Source(176, 1) + SourceIndex(0) +2 >Emitted(115, 5) Source(176, 5) + SourceIndex(0) +3 >Emitted(115, 11) Source(176, 11) + SourceIndex(0) +4 >Emitted(115, 14) Source(176, 21) + SourceIndex(0) --- >>> foo: ({}) 1->^^^^ @@ -3005,12 +2994,12 @@ sourceFile:contextualTyping.ts 4 > ( 5 > {} 6 > ) -1->Emitted(117, 5) Source(177, 5) + SourceIndex(0) -2 >Emitted(117, 8) Source(177, 8) + SourceIndex(0) -3 >Emitted(117, 10) Source(177, 16) + SourceIndex(0) -4 >Emitted(117, 11) Source(177, 17) + SourceIndex(0) -5 >Emitted(117, 13) Source(177, 19) + SourceIndex(0) -6 >Emitted(117, 14) Source(177, 20) + SourceIndex(0) +1->Emitted(116, 5) Source(177, 5) + SourceIndex(0) +2 >Emitted(116, 8) Source(177, 8) + SourceIndex(0) +3 >Emitted(116, 10) Source(177, 16) + SourceIndex(0) +4 >Emitted(116, 11) Source(177, 17) + SourceIndex(0) +5 >Emitted(116, 13) Source(177, 19) + SourceIndex(0) +6 >Emitted(116, 14) Source(177, 20) + SourceIndex(0) --- >>>}; 1 >^ @@ -3019,8 +3008,8 @@ sourceFile:contextualTyping.ts 1 > >} 2 > -1 >Emitted(118, 2) Source(178, 2) + SourceIndex(0) -2 >Emitted(118, 3) Source(178, 2) + SourceIndex(0) +1 >Emitted(117, 2) Source(178, 2) + SourceIndex(0) +2 >Emitted(117, 3) Source(178, 2) + SourceIndex(0) --- >>>var c12t13 = ({ 1-> @@ -3035,11 +3024,11 @@ sourceFile:contextualTyping.ts 3 > c12t13 4 > = 5 > ( -1->Emitted(119, 1) Source(179, 1) + SourceIndex(0) -2 >Emitted(119, 5) Source(179, 5) + SourceIndex(0) -3 >Emitted(119, 11) Source(179, 11) + SourceIndex(0) -4 >Emitted(119, 14) Source(179, 21) + SourceIndex(0) -5 >Emitted(119, 15) Source(179, 22) + SourceIndex(0) +1->Emitted(118, 1) Source(179, 1) + SourceIndex(0) +2 >Emitted(118, 5) Source(179, 5) + SourceIndex(0) +3 >Emitted(118, 11) Source(179, 11) + SourceIndex(0) +4 >Emitted(118, 14) Source(179, 21) + SourceIndex(0) +5 >Emitted(118, 15) Source(179, 22) + SourceIndex(0) --- >>> f: function (i, s) { return s; } 1->^^^^ @@ -3071,20 +3060,20 @@ sourceFile:contextualTyping.ts 12> ; 13> 14> } -1->Emitted(120, 5) Source(180, 5) + SourceIndex(0) -2 >Emitted(120, 6) Source(180, 6) + SourceIndex(0) -3 >Emitted(120, 8) Source(180, 8) + SourceIndex(0) -4 >Emitted(120, 18) Source(180, 17) + SourceIndex(0) -5 >Emitted(120, 19) Source(180, 18) + SourceIndex(0) -6 >Emitted(120, 21) Source(180, 20) + SourceIndex(0) -7 >Emitted(120, 22) Source(180, 21) + SourceIndex(0) -8 >Emitted(120, 26) Source(180, 25) + SourceIndex(0) -9 >Emitted(120, 32) Source(180, 31) + SourceIndex(0) -10>Emitted(120, 33) Source(180, 32) + SourceIndex(0) -11>Emitted(120, 34) Source(180, 33) + SourceIndex(0) -12>Emitted(120, 35) Source(180, 34) + SourceIndex(0) -13>Emitted(120, 36) Source(180, 35) + SourceIndex(0) -14>Emitted(120, 37) Source(180, 36) + SourceIndex(0) +1->Emitted(119, 5) Source(180, 5) + SourceIndex(0) +2 >Emitted(119, 6) Source(180, 6) + SourceIndex(0) +3 >Emitted(119, 8) Source(180, 8) + SourceIndex(0) +4 >Emitted(119, 18) Source(180, 17) + SourceIndex(0) +5 >Emitted(119, 19) Source(180, 18) + SourceIndex(0) +6 >Emitted(119, 21) Source(180, 20) + SourceIndex(0) +7 >Emitted(119, 22) Source(180, 21) + SourceIndex(0) +8 >Emitted(119, 26) Source(180, 25) + SourceIndex(0) +9 >Emitted(119, 32) Source(180, 31) + SourceIndex(0) +10>Emitted(119, 33) Source(180, 32) + SourceIndex(0) +11>Emitted(119, 34) Source(180, 33) + SourceIndex(0) +12>Emitted(119, 35) Source(180, 34) + SourceIndex(0) +13>Emitted(119, 36) Source(180, 35) + SourceIndex(0) +14>Emitted(119, 37) Source(180, 36) + SourceIndex(0) --- >>>}); 1 >^ @@ -3095,9 +3084,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(121, 2) Source(181, 2) + SourceIndex(0) -2 >Emitted(121, 3) Source(181, 3) + SourceIndex(0) -3 >Emitted(121, 4) Source(181, 3) + SourceIndex(0) +1 >Emitted(120, 2) Source(181, 2) + SourceIndex(0) +2 >Emitted(120, 3) Source(181, 3) + SourceIndex(0) +3 >Emitted(120, 4) Source(181, 3) + SourceIndex(0) --- >>>var c12t14 = ({ 1-> @@ -3111,11 +3100,11 @@ sourceFile:contextualTyping.ts 3 > c12t14 4 > = 5 > ( -1->Emitted(122, 1) Source(182, 1) + SourceIndex(0) -2 >Emitted(122, 5) Source(182, 5) + SourceIndex(0) -3 >Emitted(122, 11) Source(182, 11) + SourceIndex(0) -4 >Emitted(122, 14) Source(182, 21) + SourceIndex(0) -5 >Emitted(122, 15) Source(182, 22) + SourceIndex(0) +1->Emitted(121, 1) Source(182, 1) + SourceIndex(0) +2 >Emitted(121, 5) Source(182, 5) + SourceIndex(0) +3 >Emitted(121, 11) Source(182, 11) + SourceIndex(0) +4 >Emitted(121, 14) Source(182, 21) + SourceIndex(0) +5 >Emitted(121, 15) Source(182, 22) + SourceIndex(0) --- >>> a: [] 1 >^^^^ @@ -3127,10 +3116,10 @@ sourceFile:contextualTyping.ts 2 > a 3 > : 4 > [] -1 >Emitted(123, 5) Source(183, 5) + SourceIndex(0) -2 >Emitted(123, 6) Source(183, 6) + SourceIndex(0) -3 >Emitted(123, 8) Source(183, 8) + SourceIndex(0) -4 >Emitted(123, 10) Source(183, 10) + SourceIndex(0) +1 >Emitted(122, 5) Source(183, 5) + SourceIndex(0) +2 >Emitted(122, 6) Source(183, 6) + SourceIndex(0) +3 >Emitted(122, 8) Source(183, 8) + SourceIndex(0) +4 >Emitted(122, 10) Source(183, 10) + SourceIndex(0) --- >>>}); 1 >^ @@ -3141,9 +3130,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(124, 2) Source(184, 2) + SourceIndex(0) -2 >Emitted(124, 3) Source(184, 3) + SourceIndex(0) -3 >Emitted(124, 4) Source(184, 3) + SourceIndex(0) +1 >Emitted(123, 2) Source(184, 2) + SourceIndex(0) +2 >Emitted(123, 3) Source(184, 3) + SourceIndex(0) +3 >Emitted(123, 4) Source(184, 3) + SourceIndex(0) --- >>>function EF1(a, b) { return a + b; } 1-> @@ -3181,20 +3170,20 @@ sourceFile:contextualTyping.ts 12> ; 13> 14> } -1->Emitted(125, 1) Source(191, 1) + SourceIndex(0) -2 >Emitted(125, 14) Source(191, 14) + SourceIndex(0) -3 >Emitted(125, 15) Source(191, 15) + SourceIndex(0) -4 >Emitted(125, 17) Source(191, 16) + SourceIndex(0) -5 >Emitted(125, 18) Source(191, 17) + SourceIndex(0) -6 >Emitted(125, 22) Source(191, 21) + SourceIndex(0) name (EF1) -7 >Emitted(125, 28) Source(191, 27) + SourceIndex(0) name (EF1) -8 >Emitted(125, 29) Source(191, 28) + SourceIndex(0) name (EF1) -9 >Emitted(125, 30) Source(191, 29) + SourceIndex(0) name (EF1) -10>Emitted(125, 33) Source(191, 30) + SourceIndex(0) name (EF1) -11>Emitted(125, 34) Source(191, 31) + SourceIndex(0) name (EF1) -12>Emitted(125, 35) Source(191, 32) + SourceIndex(0) name (EF1) -13>Emitted(125, 36) Source(191, 33) + SourceIndex(0) name (EF1) -14>Emitted(125, 37) Source(191, 34) + SourceIndex(0) name (EF1) +1->Emitted(124, 1) Source(191, 1) + SourceIndex(0) +2 >Emitted(124, 14) Source(191, 14) + SourceIndex(0) +3 >Emitted(124, 15) Source(191, 15) + SourceIndex(0) +4 >Emitted(124, 17) Source(191, 16) + SourceIndex(0) +5 >Emitted(124, 18) Source(191, 17) + SourceIndex(0) +6 >Emitted(124, 22) Source(191, 21) + SourceIndex(0) name (EF1) +7 >Emitted(124, 28) Source(191, 27) + SourceIndex(0) name (EF1) +8 >Emitted(124, 29) Source(191, 28) + SourceIndex(0) name (EF1) +9 >Emitted(124, 30) Source(191, 29) + SourceIndex(0) name (EF1) +10>Emitted(124, 33) Source(191, 30) + SourceIndex(0) name (EF1) +11>Emitted(124, 34) Source(191, 31) + SourceIndex(0) name (EF1) +12>Emitted(124, 35) Source(191, 32) + SourceIndex(0) name (EF1) +13>Emitted(124, 36) Source(191, 33) + SourceIndex(0) name (EF1) +14>Emitted(124, 37) Source(191, 34) + SourceIndex(0) name (EF1) --- >>>var efv = EF1(1, 2); 1 > @@ -3222,17 +3211,17 @@ sourceFile:contextualTyping.ts 9 > 2 10> ) 11> ; -1 >Emitted(126, 1) Source(193, 1) + SourceIndex(0) -2 >Emitted(126, 5) Source(193, 5) + SourceIndex(0) -3 >Emitted(126, 8) Source(193, 8) + SourceIndex(0) -4 >Emitted(126, 11) Source(193, 11) + SourceIndex(0) -5 >Emitted(126, 14) Source(193, 14) + SourceIndex(0) -6 >Emitted(126, 15) Source(193, 15) + SourceIndex(0) -7 >Emitted(126, 16) Source(193, 16) + SourceIndex(0) -8 >Emitted(126, 18) Source(193, 17) + SourceIndex(0) -9 >Emitted(126, 19) Source(193, 18) + SourceIndex(0) -10>Emitted(126, 20) Source(193, 19) + SourceIndex(0) -11>Emitted(126, 21) Source(193, 20) + SourceIndex(0) +1 >Emitted(125, 1) Source(193, 1) + SourceIndex(0) +2 >Emitted(125, 5) Source(193, 5) + SourceIndex(0) +3 >Emitted(125, 8) Source(193, 8) + SourceIndex(0) +4 >Emitted(125, 11) Source(193, 11) + SourceIndex(0) +5 >Emitted(125, 14) Source(193, 14) + SourceIndex(0) +6 >Emitted(125, 15) Source(193, 15) + SourceIndex(0) +7 >Emitted(125, 16) Source(193, 16) + SourceIndex(0) +8 >Emitted(125, 18) Source(193, 17) + SourceIndex(0) +9 >Emitted(125, 19) Source(193, 18) + SourceIndex(0) +10>Emitted(125, 20) Source(193, 19) + SourceIndex(0) +11>Emitted(125, 21) Source(193, 20) + SourceIndex(0) --- >>>function Point(x, y) { 1-> @@ -3259,11 +3248,11 @@ sourceFile:contextualTyping.ts 3 > x 4 > , 5 > y -1->Emitted(127, 1) Source(207, 1) + SourceIndex(0) -2 >Emitted(127, 16) Source(207, 16) + SourceIndex(0) -3 >Emitted(127, 17) Source(207, 17) + SourceIndex(0) -4 >Emitted(127, 19) Source(207, 19) + SourceIndex(0) -5 >Emitted(127, 20) Source(207, 20) + SourceIndex(0) +1->Emitted(126, 1) Source(207, 1) + SourceIndex(0) +2 >Emitted(126, 16) Source(207, 16) + SourceIndex(0) +3 >Emitted(126, 17) Source(207, 17) + SourceIndex(0) +4 >Emitted(126, 19) Source(207, 19) + SourceIndex(0) +5 >Emitted(126, 20) Source(207, 20) + SourceIndex(0) --- >>> this.x = x; 1 >^^^^ @@ -3282,13 +3271,13 @@ sourceFile:contextualTyping.ts 5 > = 6 > x 7 > ; -1 >Emitted(128, 5) Source(208, 5) + SourceIndex(0) name (Point) -2 >Emitted(128, 9) Source(208, 9) + SourceIndex(0) name (Point) -3 >Emitted(128, 10) Source(208, 10) + SourceIndex(0) name (Point) -4 >Emitted(128, 11) Source(208, 11) + SourceIndex(0) name (Point) -5 >Emitted(128, 14) Source(208, 14) + SourceIndex(0) name (Point) -6 >Emitted(128, 15) Source(208, 15) + SourceIndex(0) name (Point) -7 >Emitted(128, 16) Source(208, 16) + SourceIndex(0) name (Point) +1 >Emitted(127, 5) Source(208, 5) + SourceIndex(0) name (Point) +2 >Emitted(127, 9) Source(208, 9) + SourceIndex(0) name (Point) +3 >Emitted(127, 10) Source(208, 10) + SourceIndex(0) name (Point) +4 >Emitted(127, 11) Source(208, 11) + SourceIndex(0) name (Point) +5 >Emitted(127, 14) Source(208, 14) + SourceIndex(0) name (Point) +6 >Emitted(127, 15) Source(208, 15) + SourceIndex(0) name (Point) +7 >Emitted(127, 16) Source(208, 16) + SourceIndex(0) name (Point) --- >>> this.y = y; 1->^^^^ @@ -3307,13 +3296,13 @@ sourceFile:contextualTyping.ts 5 > = 6 > y 7 > ; -1->Emitted(129, 5) Source(209, 5) + SourceIndex(0) name (Point) -2 >Emitted(129, 9) Source(209, 9) + SourceIndex(0) name (Point) -3 >Emitted(129, 10) Source(209, 10) + SourceIndex(0) name (Point) -4 >Emitted(129, 11) Source(209, 11) + SourceIndex(0) name (Point) -5 >Emitted(129, 14) Source(209, 14) + SourceIndex(0) name (Point) -6 >Emitted(129, 15) Source(209, 15) + SourceIndex(0) name (Point) -7 >Emitted(129, 16) Source(209, 16) + SourceIndex(0) name (Point) +1->Emitted(128, 5) Source(209, 5) + SourceIndex(0) name (Point) +2 >Emitted(128, 9) Source(209, 9) + SourceIndex(0) name (Point) +3 >Emitted(128, 10) Source(209, 10) + SourceIndex(0) name (Point) +4 >Emitted(128, 11) Source(209, 11) + SourceIndex(0) name (Point) +5 >Emitted(128, 14) Source(209, 14) + SourceIndex(0) name (Point) +6 >Emitted(128, 15) Source(209, 15) + SourceIndex(0) name (Point) +7 >Emitted(128, 16) Source(209, 16) + SourceIndex(0) name (Point) --- >>> return this; 1->^^^^ @@ -3328,11 +3317,11 @@ sourceFile:contextualTyping.ts 3 > 4 > this 5 > ; -1->Emitted(130, 5) Source(211, 5) + SourceIndex(0) name (Point) -2 >Emitted(130, 11) Source(211, 11) + SourceIndex(0) name (Point) -3 >Emitted(130, 12) Source(211, 12) + SourceIndex(0) name (Point) -4 >Emitted(130, 16) Source(211, 16) + SourceIndex(0) name (Point) -5 >Emitted(130, 17) Source(211, 17) + SourceIndex(0) name (Point) +1->Emitted(129, 5) Source(211, 5) + SourceIndex(0) name (Point) +2 >Emitted(129, 11) Source(211, 11) + SourceIndex(0) name (Point) +3 >Emitted(129, 12) Source(211, 12) + SourceIndex(0) name (Point) +4 >Emitted(129, 16) Source(211, 16) + SourceIndex(0) name (Point) +5 >Emitted(129, 17) Source(211, 17) + SourceIndex(0) name (Point) --- >>>} 1 > @@ -3341,8 +3330,8 @@ sourceFile:contextualTyping.ts 1 > > 2 >} -1 >Emitted(131, 1) Source(212, 1) + SourceIndex(0) name (Point) -2 >Emitted(131, 2) Source(212, 2) + SourceIndex(0) name (Point) +1 >Emitted(130, 1) Source(212, 1) + SourceIndex(0) name (Point) +2 >Emitted(130, 2) Source(212, 2) + SourceIndex(0) name (Point) --- >>>Point.origin = new Point(0, 0); 1-> @@ -3374,19 +3363,19 @@ sourceFile:contextualTyping.ts 11> 0 12> ) 13> ; -1->Emitted(132, 1) Source(214, 1) + SourceIndex(0) -2 >Emitted(132, 6) Source(214, 6) + SourceIndex(0) -3 >Emitted(132, 7) Source(214, 7) + SourceIndex(0) -4 >Emitted(132, 13) Source(214, 13) + SourceIndex(0) -5 >Emitted(132, 16) Source(214, 16) + SourceIndex(0) -6 >Emitted(132, 20) Source(214, 20) + SourceIndex(0) -7 >Emitted(132, 25) Source(214, 25) + SourceIndex(0) -8 >Emitted(132, 26) Source(214, 26) + SourceIndex(0) -9 >Emitted(132, 27) Source(214, 27) + SourceIndex(0) -10>Emitted(132, 29) Source(214, 29) + SourceIndex(0) -11>Emitted(132, 30) Source(214, 30) + SourceIndex(0) -12>Emitted(132, 31) Source(214, 31) + SourceIndex(0) -13>Emitted(132, 32) Source(214, 32) + SourceIndex(0) +1->Emitted(131, 1) Source(214, 1) + SourceIndex(0) +2 >Emitted(131, 6) Source(214, 6) + SourceIndex(0) +3 >Emitted(131, 7) Source(214, 7) + SourceIndex(0) +4 >Emitted(131, 13) Source(214, 13) + SourceIndex(0) +5 >Emitted(131, 16) Source(214, 16) + SourceIndex(0) +6 >Emitted(131, 20) Source(214, 20) + SourceIndex(0) +7 >Emitted(131, 25) Source(214, 25) + SourceIndex(0) +8 >Emitted(131, 26) Source(214, 26) + SourceIndex(0) +9 >Emitted(131, 27) Source(214, 27) + SourceIndex(0) +10>Emitted(131, 29) Source(214, 29) + SourceIndex(0) +11>Emitted(131, 30) Source(214, 30) + SourceIndex(0) +12>Emitted(131, 31) Source(214, 31) + SourceIndex(0) +13>Emitted(131, 32) Source(214, 32) + SourceIndex(0) --- >>>Point.prototype.add = function (dx, dy) { 1-> @@ -3414,17 +3403,17 @@ sourceFile:contextualTyping.ts 9 > dx 10> , 11> dy -1->Emitted(133, 1) Source(216, 1) + SourceIndex(0) -2 >Emitted(133, 6) Source(216, 6) + SourceIndex(0) -3 >Emitted(133, 7) Source(216, 7) + SourceIndex(0) -4 >Emitted(133, 16) Source(216, 16) + SourceIndex(0) -5 >Emitted(133, 17) Source(216, 17) + SourceIndex(0) -6 >Emitted(133, 20) Source(216, 20) + SourceIndex(0) -7 >Emitted(133, 23) Source(216, 23) + SourceIndex(0) -8 >Emitted(133, 33) Source(216, 32) + SourceIndex(0) -9 >Emitted(133, 35) Source(216, 34) + SourceIndex(0) -10>Emitted(133, 37) Source(216, 36) + SourceIndex(0) -11>Emitted(133, 39) Source(216, 38) + SourceIndex(0) +1->Emitted(132, 1) Source(216, 1) + SourceIndex(0) +2 >Emitted(132, 6) Source(216, 6) + SourceIndex(0) +3 >Emitted(132, 7) Source(216, 7) + SourceIndex(0) +4 >Emitted(132, 16) Source(216, 16) + SourceIndex(0) +5 >Emitted(132, 17) Source(216, 17) + SourceIndex(0) +6 >Emitted(132, 20) Source(216, 20) + SourceIndex(0) +7 >Emitted(132, 23) Source(216, 23) + SourceIndex(0) +8 >Emitted(132, 33) Source(216, 32) + SourceIndex(0) +9 >Emitted(132, 35) Source(216, 34) + SourceIndex(0) +10>Emitted(132, 37) Source(216, 36) + SourceIndex(0) +11>Emitted(132, 39) Source(216, 38) + SourceIndex(0) --- >>> return new Point(this.x + dx, this.y + dy); 1->^^^^ @@ -3466,25 +3455,25 @@ sourceFile:contextualTyping.ts 17> dy 18> ) 19> ; -1->Emitted(134, 5) Source(217, 5) + SourceIndex(0) -2 >Emitted(134, 11) Source(217, 11) + SourceIndex(0) -3 >Emitted(134, 12) Source(217, 12) + SourceIndex(0) -4 >Emitted(134, 16) Source(217, 16) + SourceIndex(0) -5 >Emitted(134, 21) Source(217, 21) + SourceIndex(0) -6 >Emitted(134, 22) Source(217, 22) + SourceIndex(0) -7 >Emitted(134, 26) Source(217, 26) + SourceIndex(0) -8 >Emitted(134, 27) Source(217, 27) + SourceIndex(0) -9 >Emitted(134, 28) Source(217, 28) + SourceIndex(0) -10>Emitted(134, 31) Source(217, 31) + SourceIndex(0) -11>Emitted(134, 33) Source(217, 33) + SourceIndex(0) -12>Emitted(134, 35) Source(217, 35) + SourceIndex(0) -13>Emitted(134, 39) Source(217, 39) + SourceIndex(0) -14>Emitted(134, 40) Source(217, 40) + SourceIndex(0) -15>Emitted(134, 41) Source(217, 41) + SourceIndex(0) -16>Emitted(134, 44) Source(217, 44) + SourceIndex(0) -17>Emitted(134, 46) Source(217, 46) + SourceIndex(0) -18>Emitted(134, 47) Source(217, 47) + SourceIndex(0) -19>Emitted(134, 48) Source(217, 48) + SourceIndex(0) +1->Emitted(133, 5) Source(217, 5) + SourceIndex(0) +2 >Emitted(133, 11) Source(217, 11) + SourceIndex(0) +3 >Emitted(133, 12) Source(217, 12) + SourceIndex(0) +4 >Emitted(133, 16) Source(217, 16) + SourceIndex(0) +5 >Emitted(133, 21) Source(217, 21) + SourceIndex(0) +6 >Emitted(133, 22) Source(217, 22) + SourceIndex(0) +7 >Emitted(133, 26) Source(217, 26) + SourceIndex(0) +8 >Emitted(133, 27) Source(217, 27) + SourceIndex(0) +9 >Emitted(133, 28) Source(217, 28) + SourceIndex(0) +10>Emitted(133, 31) Source(217, 31) + SourceIndex(0) +11>Emitted(133, 33) Source(217, 33) + SourceIndex(0) +12>Emitted(133, 35) Source(217, 35) + SourceIndex(0) +13>Emitted(133, 39) Source(217, 39) + SourceIndex(0) +14>Emitted(133, 40) Source(217, 40) + SourceIndex(0) +15>Emitted(133, 41) Source(217, 41) + SourceIndex(0) +16>Emitted(133, 44) Source(217, 44) + SourceIndex(0) +17>Emitted(133, 46) Source(217, 46) + SourceIndex(0) +18>Emitted(133, 47) Source(217, 47) + SourceIndex(0) +19>Emitted(133, 48) Source(217, 48) + SourceIndex(0) --- >>>}; 1 > @@ -3495,9 +3484,9 @@ sourceFile:contextualTyping.ts > 2 >} 3 > ; -1 >Emitted(135, 1) Source(218, 1) + SourceIndex(0) -2 >Emitted(135, 2) Source(218, 2) + SourceIndex(0) -3 >Emitted(135, 3) Source(218, 3) + SourceIndex(0) +1 >Emitted(134, 1) Source(218, 1) + SourceIndex(0) +2 >Emitted(134, 2) Source(218, 2) + SourceIndex(0) +3 >Emitted(134, 3) Source(218, 3) + SourceIndex(0) --- >>>Point.prototype = { 1-> @@ -3512,11 +3501,11 @@ sourceFile:contextualTyping.ts 3 > . 4 > prototype 5 > = -1->Emitted(136, 1) Source(220, 1) + SourceIndex(0) -2 >Emitted(136, 6) Source(220, 6) + SourceIndex(0) -3 >Emitted(136, 7) Source(220, 7) + SourceIndex(0) -4 >Emitted(136, 16) Source(220, 16) + SourceIndex(0) -5 >Emitted(136, 19) Source(220, 19) + SourceIndex(0) +1->Emitted(135, 1) Source(220, 1) + SourceIndex(0) +2 >Emitted(135, 6) Source(220, 6) + SourceIndex(0) +3 >Emitted(135, 7) Source(220, 7) + SourceIndex(0) +4 >Emitted(135, 16) Source(220, 16) + SourceIndex(0) +5 >Emitted(135, 19) Source(220, 19) + SourceIndex(0) --- >>> x: 0, 1 >^^^^ @@ -3529,10 +3518,10 @@ sourceFile:contextualTyping.ts 2 > x 3 > : 4 > 0 -1 >Emitted(137, 5) Source(221, 5) + SourceIndex(0) -2 >Emitted(137, 6) Source(221, 6) + SourceIndex(0) -3 >Emitted(137, 8) Source(221, 8) + SourceIndex(0) -4 >Emitted(137, 9) Source(221, 9) + SourceIndex(0) +1 >Emitted(136, 5) Source(221, 5) + SourceIndex(0) +2 >Emitted(136, 6) Source(221, 6) + SourceIndex(0) +3 >Emitted(136, 8) Source(221, 8) + SourceIndex(0) +4 >Emitted(136, 9) Source(221, 9) + SourceIndex(0) --- >>> y: 0, 1->^^^^ @@ -3545,10 +3534,10 @@ sourceFile:contextualTyping.ts 2 > y 3 > : 4 > 0 -1->Emitted(138, 5) Source(222, 5) + SourceIndex(0) -2 >Emitted(138, 6) Source(222, 6) + SourceIndex(0) -3 >Emitted(138, 8) Source(222, 8) + SourceIndex(0) -4 >Emitted(138, 9) Source(222, 9) + SourceIndex(0) +1->Emitted(137, 5) Source(222, 5) + SourceIndex(0) +2 >Emitted(137, 6) Source(222, 6) + SourceIndex(0) +3 >Emitted(137, 8) Source(222, 8) + SourceIndex(0) +4 >Emitted(137, 9) Source(222, 9) + SourceIndex(0) --- >>> add: function (dx, dy) { 1->^^^^ @@ -3567,13 +3556,13 @@ sourceFile:contextualTyping.ts 5 > dx 6 > , 7 > dy -1->Emitted(139, 5) Source(223, 5) + SourceIndex(0) -2 >Emitted(139, 8) Source(223, 8) + SourceIndex(0) -3 >Emitted(139, 10) Source(223, 10) + SourceIndex(0) -4 >Emitted(139, 20) Source(223, 19) + SourceIndex(0) -5 >Emitted(139, 22) Source(223, 21) + SourceIndex(0) -6 >Emitted(139, 24) Source(223, 23) + SourceIndex(0) -7 >Emitted(139, 26) Source(223, 25) + SourceIndex(0) +1->Emitted(138, 5) Source(223, 5) + SourceIndex(0) +2 >Emitted(138, 8) Source(223, 8) + SourceIndex(0) +3 >Emitted(138, 10) Source(223, 10) + SourceIndex(0) +4 >Emitted(138, 20) Source(223, 19) + SourceIndex(0) +5 >Emitted(138, 22) Source(223, 21) + SourceIndex(0) +6 >Emitted(138, 24) Source(223, 23) + SourceIndex(0) +7 >Emitted(138, 26) Source(223, 25) + SourceIndex(0) --- >>> return new Point(this.x + dx, this.y + dy); 1->^^^^^^^^ @@ -3615,25 +3604,25 @@ sourceFile:contextualTyping.ts 17> dy 18> ) 19> ; -1->Emitted(140, 9) Source(224, 9) + SourceIndex(0) -2 >Emitted(140, 15) Source(224, 15) + SourceIndex(0) -3 >Emitted(140, 16) Source(224, 16) + SourceIndex(0) -4 >Emitted(140, 20) Source(224, 20) + SourceIndex(0) -5 >Emitted(140, 25) Source(224, 25) + SourceIndex(0) -6 >Emitted(140, 26) Source(224, 26) + SourceIndex(0) -7 >Emitted(140, 30) Source(224, 30) + SourceIndex(0) -8 >Emitted(140, 31) Source(224, 31) + SourceIndex(0) -9 >Emitted(140, 32) Source(224, 32) + SourceIndex(0) -10>Emitted(140, 35) Source(224, 35) + SourceIndex(0) -11>Emitted(140, 37) Source(224, 37) + SourceIndex(0) -12>Emitted(140, 39) Source(224, 39) + SourceIndex(0) -13>Emitted(140, 43) Source(224, 43) + SourceIndex(0) -14>Emitted(140, 44) Source(224, 44) + SourceIndex(0) -15>Emitted(140, 45) Source(224, 45) + SourceIndex(0) -16>Emitted(140, 48) Source(224, 48) + SourceIndex(0) -17>Emitted(140, 50) Source(224, 50) + SourceIndex(0) -18>Emitted(140, 51) Source(224, 51) + SourceIndex(0) -19>Emitted(140, 52) Source(224, 52) + SourceIndex(0) +1->Emitted(139, 9) Source(224, 9) + SourceIndex(0) +2 >Emitted(139, 15) Source(224, 15) + SourceIndex(0) +3 >Emitted(139, 16) Source(224, 16) + SourceIndex(0) +4 >Emitted(139, 20) Source(224, 20) + SourceIndex(0) +5 >Emitted(139, 25) Source(224, 25) + SourceIndex(0) +6 >Emitted(139, 26) Source(224, 26) + SourceIndex(0) +7 >Emitted(139, 30) Source(224, 30) + SourceIndex(0) +8 >Emitted(139, 31) Source(224, 31) + SourceIndex(0) +9 >Emitted(139, 32) Source(224, 32) + SourceIndex(0) +10>Emitted(139, 35) Source(224, 35) + SourceIndex(0) +11>Emitted(139, 37) Source(224, 37) + SourceIndex(0) +12>Emitted(139, 39) Source(224, 39) + SourceIndex(0) +13>Emitted(139, 43) Source(224, 43) + SourceIndex(0) +14>Emitted(139, 44) Source(224, 44) + SourceIndex(0) +15>Emitted(139, 45) Source(224, 45) + SourceIndex(0) +16>Emitted(139, 48) Source(224, 48) + SourceIndex(0) +17>Emitted(139, 50) Source(224, 50) + SourceIndex(0) +18>Emitted(139, 51) Source(224, 51) + SourceIndex(0) +19>Emitted(139, 52) Source(224, 52) + SourceIndex(0) --- >>> } 1 >^^^^ @@ -3641,8 +3630,8 @@ sourceFile:contextualTyping.ts 1 > > 2 > } -1 >Emitted(141, 5) Source(225, 5) + SourceIndex(0) -2 >Emitted(141, 6) Source(225, 6) + SourceIndex(0) +1 >Emitted(140, 5) Source(225, 5) + SourceIndex(0) +2 >Emitted(140, 6) Source(225, 6) + SourceIndex(0) --- >>>}; 1 >^ @@ -3651,8 +3640,8 @@ sourceFile:contextualTyping.ts 1 > >} 2 > ; -1 >Emitted(142, 2) Source(226, 2) + SourceIndex(0) -2 >Emitted(142, 3) Source(226, 3) + SourceIndex(0) +1 >Emitted(141, 2) Source(226, 2) + SourceIndex(0) +2 >Emitted(141, 3) Source(226, 3) + SourceIndex(0) --- >>>var x = {}; 1-> @@ -3672,11 +3661,11 @@ sourceFile:contextualTyping.ts 4 > : B = 5 > { } 6 > ; -1->Emitted(143, 1) Source(230, 1) + SourceIndex(0) -2 >Emitted(143, 5) Source(230, 5) + SourceIndex(0) -3 >Emitted(143, 6) Source(230, 6) + SourceIndex(0) -4 >Emitted(143, 9) Source(230, 12) + SourceIndex(0) -5 >Emitted(143, 11) Source(230, 15) + SourceIndex(0) -6 >Emitted(143, 12) Source(230, 16) + SourceIndex(0) +1->Emitted(142, 1) Source(230, 1) + SourceIndex(0) +2 >Emitted(142, 5) Source(230, 5) + SourceIndex(0) +3 >Emitted(142, 6) Source(230, 6) + SourceIndex(0) +4 >Emitted(142, 9) Source(230, 12) + SourceIndex(0) +5 >Emitted(142, 11) Source(230, 15) + SourceIndex(0) +6 >Emitted(142, 12) Source(230, 16) + SourceIndex(0) --- >>>//# sourceMappingURL=contextualTyping.js.map \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping1.js b/tests/baselines/reference/contextualTyping1.js index 7f1e12c744b..7ceb3b582e5 100644 --- a/tests/baselines/reference/contextualTyping1.js +++ b/tests/baselines/reference/contextualTyping1.js @@ -2,4 +2,4 @@ var foo: {id:number;} = {id:4}; //// [contextualTyping1.js] -var foo = { id: 4 };\n \ No newline at end of file +var foo = { id: 4 }; diff --git a/tests/baselines/reference/declFileAmbientExternalModuleWithSingleExportedModule.js b/tests/baselines/reference/declFileAmbientExternalModuleWithSingleExportedModule.js index 1a175c3483d..a30f0f334c2 100644 --- a/tests/baselines/reference/declFileAmbientExternalModuleWithSingleExportedModule.js +++ b/tests/baselines/reference/declFileAmbientExternalModuleWithSingleExportedModule.js @@ -20,7 +20,6 @@ export var x: SubModule.m.m3.c; //// [declFileAmbientExternalModuleWithSingleExportedModule_0.js] //// [declFileAmbientExternalModuleWithSingleExportedModule_1.js] -exports.x; //// [declFileAmbientExternalModuleWithSingleExportedModule_0.d.ts] diff --git a/tests/baselines/reference/declFileExportAssignmentImportInternalModule.js b/tests/baselines/reference/declFileExportAssignmentImportInternalModule.js index f4cd27e6c01..6bd4320426c 100644 --- a/tests/baselines/reference/declFileExportAssignmentImportInternalModule.js +++ b/tests/baselines/reference/declFileExportAssignmentImportInternalModule.js @@ -24,7 +24,6 @@ export = m; //// [declFileExportAssignmentImportInternalModule.js] var m3; (function (m3) { - m3.server; })(m3 || (m3 = {})); var m = m3; module.exports = m; diff --git a/tests/baselines/reference/declFileExportAssignmentOfGenericInterface.js b/tests/baselines/reference/declFileExportAssignmentOfGenericInterface.js index 75968ed1794..4d203705c4a 100644 --- a/tests/baselines/reference/declFileExportAssignmentOfGenericInterface.js +++ b/tests/baselines/reference/declFileExportAssignmentOfGenericInterface.js @@ -17,7 +17,6 @@ define(["require", "exports"], function (require, exports) { }); //// [declFileExportAssignmentOfGenericInterface_1.js] define(["require", "exports"], function (require, exports) { - exports.x; exports.x.a; }); diff --git a/tests/baselines/reference/declFileExportImportChain.js b/tests/baselines/reference/declFileExportImportChain.js index 547189948c9..127e8010b49 100644 --- a/tests/baselines/reference/declFileExportImportChain.js +++ b/tests/baselines/reference/declFileExportImportChain.js @@ -54,7 +54,6 @@ define(["require", "exports", "declFileExportImportChain_b1"], function (require }); //// [declFileExportImportChain_d.js] define(["require", "exports"], function (require, exports) { - exports.x; }); diff --git a/tests/baselines/reference/declFileExportImportChain2.js b/tests/baselines/reference/declFileExportImportChain2.js index d1299a21c5a..3a644428b8a 100644 --- a/tests/baselines/reference/declFileExportImportChain2.js +++ b/tests/baselines/reference/declFileExportImportChain2.js @@ -47,7 +47,6 @@ define(["require", "exports", "declFileExportImportChain2_b"], function (require }); //// [declFileExportImportChain2_d.js] define(["require", "exports"], function (require, exports) { - exports.x; }); diff --git a/tests/baselines/reference/declFileForExportedImport.js b/tests/baselines/reference/declFileForExportedImport.js index 0575ea7bfd0..af7cfa46b73 100644 --- a/tests/baselines/reference/declFileForExportedImport.js +++ b/tests/baselines/reference/declFileForExportedImport.js @@ -12,7 +12,6 @@ export import b = a; var z = b.x; //// [declFileForExportedImport_0.js] -exports.x; //// [declFileForExportedImport_1.js] /// exports.a = require('declFileForExportedImport_0'); diff --git a/tests/baselines/reference/declFileGenericType.js b/tests/baselines/reference/declFileGenericType.js index 35fde5bde00..dfbe147a78d 100644 --- a/tests/baselines/reference/declFileGenericType.js +++ b/tests/baselines/reference/declFileGenericType.js @@ -80,7 +80,6 @@ var C; })(); C.D = D; })(C = exports.C || (exports.C = {})); -exports.a; exports.b = C.F; exports.c = C.F2; exports.d = C.F3; diff --git a/tests/baselines/reference/declFileTypeAnnotationTypeAlias.js b/tests/baselines/reference/declFileTypeAnnotationTypeAlias.js index 494603e286a..178511f2b78 100644 --- a/tests/baselines/reference/declFileTypeAnnotationTypeAlias.js +++ b/tests/baselines/reference/declFileTypeAnnotationTypeAlias.js @@ -34,7 +34,6 @@ module M { //// [declFileTypeAnnotationTypeAlias.js] var M; (function (M) { - M.x; var c = (function () { function c() { } @@ -61,7 +60,6 @@ var M; return Window; })(); N.Window = Window; - N.p; })(N = M.N || (M.N = {})); })(M || (M = {})); diff --git a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeAlias.js b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeAlias.js index ec653c84dc9..ebad7156617 100644 --- a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeAlias.js +++ b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeAlias.js @@ -52,7 +52,6 @@ var M; return Window; })(); N.Window = Window; - N.p; // Should report error that W is private })(N = M.N || (M.N = {})); })(M || (M = {})); var M1; @@ -65,7 +64,6 @@ var M1; return Window; })(); N.Window = Window; - N.p; // No error })(N = M1.N || (M1.N = {})); })(M1 || (M1 = {})); var M2; diff --git a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeLiteral.js b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeLiteral.js index f6bd1689e60..19bdce50cd7 100644 --- a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeLiteral.js +++ b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeLiteral.js @@ -51,7 +51,6 @@ var m; })(); m2.public1 = public1; })(m2 || (m2 = {})); - m.x; m.x2 = { x: new private1(), y: new m2.public1(), @@ -60,10 +59,6 @@ var m; } }; m.x3 = m.x; - // Function type - m.y; m.y2 = m.y; - // constructor type - m.z; m.z2 = m.z; })(m || (m = {})); diff --git a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorVariableDeclaration.js b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorVariableDeclaration.js index a097ac159db..3d4a4337ae9 100644 --- a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorVariableDeclaration.js +++ b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorVariableDeclaration.js @@ -50,11 +50,9 @@ var m; // Directly using names from this module var x; var y = new private1(); - m.k; m.l = new private1(); var x2; var y2 = new public1(); - m.k2; m.l2 = new public1(); var m2; (function (m2) { @@ -67,6 +65,5 @@ var m; })(m2 || (m2 = {})); var x3; var y3 = new m2.public2(); - m.k3; m.l3 = new m2.public2(); })(m || (m = {})); diff --git a/tests/baselines/reference/declFileTypeofModule.js b/tests/baselines/reference/declFileTypeofModule.js index b90a48fc8fa..fad0c1b25bb 100644 --- a/tests/baselines/reference/declFileTypeofModule.js +++ b/tests/baselines/reference/declFileTypeofModule.js @@ -16,13 +16,11 @@ var m2_2: typeof m2; //// [declFileTypeofModule.js] var m1; (function (m1) { - m1.c; })(m1 || (m1 = {})); var m1_1 = m1; var m1_2; var m2; (function (m2) { - m2.d; })(m2 || (m2 = {})); var m2_1 = m2; var m2_2; diff --git a/tests/baselines/reference/declarationEmitImportInExportAssignmentModule.js b/tests/baselines/reference/declarationEmitImportInExportAssignmentModule.js index 9b580bcd7a4..b82766e2834 100644 --- a/tests/baselines/reference/declarationEmitImportInExportAssignmentModule.js +++ b/tests/baselines/reference/declarationEmitImportInExportAssignmentModule.js @@ -22,7 +22,6 @@ var m; })(); c_1.c = c; })(c = m.c || (m.c = {})); - m.a; })(m || (m = {})); module.exports = m; diff --git a/tests/baselines/reference/declarationEmit_nameConflicts2.js b/tests/baselines/reference/declarationEmit_nameConflicts2.js index 2a228080c68..e7b145877f8 100644 --- a/tests/baselines/reference/declarationEmit_nameConflicts2.js +++ b/tests/baselines/reference/declarationEmit_nameConflicts2.js @@ -32,7 +32,6 @@ var X; base.C = C; var M; (function (M) { - M.v; })(M = base.M || (base.M = {})); (function (E) { })(base.E || (base.E = {})); diff --git a/tests/baselines/reference/declarationEmit_nameConflicts3.js b/tests/baselines/reference/declarationEmit_nameConflicts3.js index 8f4fa686e44..ee21d9a408d 100644 --- a/tests/baselines/reference/declarationEmit_nameConflicts3.js +++ b/tests/baselines/reference/declarationEmit_nameConflicts3.js @@ -74,7 +74,6 @@ var M; D[D["f"] = 0] = "f"; })(P.D || (P.D = {})); var D = P.D; - P.v; // ok P.w = M.D.f; // error, should be typeof M.D.f P.x = M.C.f; // error, should be typeof M.C.f P.x = M.E.f; // error, should be typeof M.E.f diff --git a/tests/baselines/reference/declarationEmit_nameConflictsWithAlias.js b/tests/baselines/reference/declarationEmit_nameConflictsWithAlias.js index 9d6ab935fdb..e5532291946 100644 --- a/tests/baselines/reference/declarationEmit_nameConflictsWithAlias.js +++ b/tests/baselines/reference/declarationEmit_nameConflictsWithAlias.js @@ -9,7 +9,6 @@ export module M { //// [declarationEmit_nameConflictsWithAlias.js] var M; (function (M) { - M.w; // Gets emitted as C.I, which is the wrong interface })(M = exports.M || (exports.M = {})); diff --git a/tests/baselines/reference/declareModifierOnTypeAlias.js b/tests/baselines/reference/declareModifierOnTypeAlias.js new file mode 100644 index 00000000000..a9bb3c6363c --- /dev/null +++ b/tests/baselines/reference/declareModifierOnTypeAlias.js @@ -0,0 +1,6 @@ +//// [declareModifierOnTypeAlias.ts] +declare type Foo = string; +type Bar = number; +declare type Baz = Bar; + +//// [declareModifierOnTypeAlias.js] diff --git a/tests/baselines/reference/declareModifierOnTypeAlias.symbols b/tests/baselines/reference/declareModifierOnTypeAlias.symbols new file mode 100644 index 00000000000..32a90fc94da --- /dev/null +++ b/tests/baselines/reference/declareModifierOnTypeAlias.symbols @@ -0,0 +1,11 @@ +=== tests/cases/compiler/declareModifierOnTypeAlias.ts === +declare type Foo = string; +>Foo : Symbol(Foo, Decl(declareModifierOnTypeAlias.ts, 0, 0)) + +type Bar = number; +>Bar : Symbol(Bar, Decl(declareModifierOnTypeAlias.ts, 0, 26)) + +declare type Baz = Bar; +>Baz : Symbol(Baz, Decl(declareModifierOnTypeAlias.ts, 1, 18)) +>Bar : Symbol(Bar, Decl(declareModifierOnTypeAlias.ts, 0, 26)) + diff --git a/tests/baselines/reference/declareModifierOnTypeAlias.types b/tests/baselines/reference/declareModifierOnTypeAlias.types new file mode 100644 index 00000000000..c53616fdff6 --- /dev/null +++ b/tests/baselines/reference/declareModifierOnTypeAlias.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/declareModifierOnTypeAlias.ts === +declare type Foo = string; +>Foo : string + +type Bar = number; +>Bar : number + +declare type Baz = Bar; +>Baz : number +>Bar : number + diff --git a/tests/baselines/reference/decoratorChecksFunctionBodies.errors.txt b/tests/baselines/reference/decoratorChecksFunctionBodies.errors.txt new file mode 100644 index 00000000000..c8166b538fd --- /dev/null +++ b/tests/baselines/reference/decoratorChecksFunctionBodies.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/decorators/class/decoratorChecksFunctionBodies.ts(9,14): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. + + +==== tests/cases/conformance/decorators/class/decoratorChecksFunctionBodies.ts (1 errors) ==== + + // from #2971 + function func(s: string): void { + } + + class A { + @(x => { + var a = 3; + func(a); + ~ +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. + return x; + }) + m() { + + } + } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorChecksFunctionBodies.js b/tests/baselines/reference/decoratorChecksFunctionBodies.js new file mode 100644 index 00000000000..020bc775aea --- /dev/null +++ b/tests/baselines/reference/decoratorChecksFunctionBodies.js @@ -0,0 +1,44 @@ +//// [decoratorChecksFunctionBodies.ts] + +// from #2971 +function func(s: string): void { +} + +class A { + @(x => { + var a = 3; + func(a); + return x; + }) + m() { + + } +} + +//// [decoratorChecksFunctionBodies.js] +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); + } +}; +// from #2971 +function func(s) { +} +var A = (function () { + function A() { + } + A.prototype.m = function () { + }; + Object.defineProperty(A.prototype, "m", + __decorate([ + (function (x) { + var a = 3; + func(a); + return x; + }) + ], A.prototype, "m", Object.getOwnPropertyDescriptor(A.prototype, "m"))); + return A; +})(); diff --git a/tests/baselines/reference/decoratorInstantiateModulesInFunctionBodies.js b/tests/baselines/reference/decoratorInstantiateModulesInFunctionBodies.js new file mode 100644 index 00000000000..313d77fa5ce --- /dev/null +++ b/tests/baselines/reference/decoratorInstantiateModulesInFunctionBodies.js @@ -0,0 +1,53 @@ +//// [tests/cases/conformance/decorators/class/decoratorInstantiateModulesInFunctionBodies.ts] //// + +//// [a.ts] + +// from #3108 +export var test = 'abc'; + +//// [b.ts] +import { test } from './a'; + +function filter(handler: any) { + return function (target: any) { + // ... + }; +} + +class Wat { + @filter(() => test == 'abc') + static whatever() { + // ... + } +} + +//// [a.js] +// from #3108 +exports.test = 'abc'; +//// [b.js] +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); + } +}; +var a_1 = require('./a'); +function filter(handler) { + return function (target) { + // ... + }; +} +var Wat = (function () { + function Wat() { + } + Wat.whatever = function () { + // ... + }; + Object.defineProperty(Wat, "whatever", + __decorate([ + filter(function () { return a_1.test == 'abc'; }) + ], Wat, "whatever", Object.getOwnPropertyDescriptor(Wat, "whatever"))); + return Wat; +})(); diff --git a/tests/baselines/reference/decoratorInstantiateModulesInFunctionBodies.symbols b/tests/baselines/reference/decoratorInstantiateModulesInFunctionBodies.symbols new file mode 100644 index 00000000000..5088e740a57 --- /dev/null +++ b/tests/baselines/reference/decoratorInstantiateModulesInFunctionBodies.symbols @@ -0,0 +1,34 @@ +=== tests/cases/conformance/decorators/class/a.ts === + +// from #3108 +export var test = 'abc'; +>test : Symbol(test, Decl(a.ts, 2, 10)) + +=== tests/cases/conformance/decorators/class/b.ts === +import { test } from './a'; +>test : Symbol(test, Decl(b.ts, 0, 8)) + +function filter(handler: any) { +>filter : Symbol(filter, Decl(b.ts, 0, 27)) +>handler : Symbol(handler, Decl(b.ts, 2, 16)) + + return function (target: any) { +>target : Symbol(target, Decl(b.ts, 3, 21)) + + // ... + }; +} + +class Wat { +>Wat : Symbol(Wat, Decl(b.ts, 6, 1)) + + @filter(() => test == 'abc') +>filter : Symbol(filter, Decl(b.ts, 0, 27)) +>test : Symbol(test, Decl(b.ts, 0, 8)) + + static whatever() { +>whatever : Symbol(Wat.whatever, Decl(b.ts, 8, 11)) + + // ... + } +} diff --git a/tests/baselines/reference/decoratorInstantiateModulesInFunctionBodies.types b/tests/baselines/reference/decoratorInstantiateModulesInFunctionBodies.types new file mode 100644 index 00000000000..18d993af9bb --- /dev/null +++ b/tests/baselines/reference/decoratorInstantiateModulesInFunctionBodies.types @@ -0,0 +1,40 @@ +=== tests/cases/conformance/decorators/class/a.ts === + +// from #3108 +export var test = 'abc'; +>test : string +>'abc' : string + +=== tests/cases/conformance/decorators/class/b.ts === +import { test } from './a'; +>test : string + +function filter(handler: any) { +>filter : (handler: any) => (target: any) => void +>handler : any + + return function (target: any) { +>function (target: any) { // ... } : (target: any) => void +>target : any + + // ... + }; +} + +class Wat { +>Wat : Wat + + @filter(() => test == 'abc') +>filter(() => test == 'abc') : (target: any) => void +>filter : (handler: any) => (target: any) => void +>() => test == 'abc' : () => boolean +>test == 'abc' : boolean +>test : string +>'abc' : string + + static whatever() { +>whatever : () => void + + // ... + } +} diff --git a/tests/baselines/reference/decoratorOnImportEquals1.js b/tests/baselines/reference/decoratorOnImportEquals1.js index 440fdb99bce..9ad94768331 100644 --- a/tests/baselines/reference/decoratorOnImportEquals1.js +++ b/tests/baselines/reference/decoratorOnImportEquals1.js @@ -13,5 +13,4 @@ module M2 { //// [decoratorOnImportEquals1.js] var M1; (function (M1) { - M1.X; })(M1 || (M1 = {})); diff --git a/tests/baselines/reference/decoratorOnImportEquals2.js b/tests/baselines/reference/decoratorOnImportEquals2.js index 7db2da6b2c2..5f54f0b4ee6 100644 --- a/tests/baselines/reference/decoratorOnImportEquals2.js +++ b/tests/baselines/reference/decoratorOnImportEquals2.js @@ -10,5 +10,4 @@ import lib = require('./decoratorOnImportEquals2_0'); declare function dec(target: T): T; //// [decoratorOnImportEquals2_0.js] -exports.X; //// [decoratorOnImportEquals2_1.js] diff --git a/tests/baselines/reference/decrementOperatorWithAnyOtherType.js b/tests/baselines/reference/decrementOperatorWithAnyOtherType.js index 34ea154daa6..155c7cede22 100644 --- a/tests/baselines/reference/decrementOperatorWithAnyOtherType.js +++ b/tests/baselines/reference/decrementOperatorWithAnyOtherType.js @@ -61,7 +61,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // any type var diff --git a/tests/baselines/reference/decrementOperatorWithAnyOtherTypeInvalidOperations.js b/tests/baselines/reference/decrementOperatorWithAnyOtherTypeInvalidOperations.js index 8e4f927a920..5b717d0669c 100644 --- a/tests/baselines/reference/decrementOperatorWithAnyOtherTypeInvalidOperations.js +++ b/tests/baselines/reference/decrementOperatorWithAnyOtherTypeInvalidOperations.js @@ -93,7 +93,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // any type var diff --git a/tests/baselines/reference/decrementOperatorWithNumberType.js b/tests/baselines/reference/decrementOperatorWithNumberType.js index 85ed9ca548a..98f9b9d8fde 100644 --- a/tests/baselines/reference/decrementOperatorWithNumberType.js +++ b/tests/baselines/reference/decrementOperatorWithNumberType.js @@ -50,7 +50,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // number type var diff --git a/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.js b/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.js index 34e862063ce..00a613a16f6 100644 --- a/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.js +++ b/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.js @@ -59,7 +59,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); //number type var diff --git a/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.js b/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.js index 2be74a64d8f..9ce6d2320be 100644 --- a/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.js +++ b/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.js @@ -66,7 +66,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // boolean type var diff --git a/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.js b/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.js index 430f9af963f..dfc828dcb28 100644 --- a/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.js +++ b/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.js @@ -78,7 +78,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // string type var diff --git a/tests/baselines/reference/defaultArgsInFunctionExpressions.js b/tests/baselines/reference/defaultArgsInFunctionExpressions.js index 3f77c4430e8..d9cae93344f 100644 --- a/tests/baselines/reference/defaultArgsInFunctionExpressions.js +++ b/tests/baselines/reference/defaultArgsInFunctionExpressions.js @@ -62,7 +62,6 @@ var f5 = function (a) { }; var U; (function (U) { - U.x; })(U || (U = {})); var f6 = function (t) { if (t === void 0) { t = T; } diff --git a/tests/baselines/reference/deleteOperatorWithAnyOtherType.js b/tests/baselines/reference/deleteOperatorWithAnyOtherType.js index e2a2be4d9aa..03558d41e87 100644 --- a/tests/baselines/reference/deleteOperatorWithAnyOtherType.js +++ b/tests/baselines/reference/deleteOperatorWithAnyOtherType.js @@ -83,7 +83,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // any type var diff --git a/tests/baselines/reference/deleteOperatorWithBooleanType.js b/tests/baselines/reference/deleteOperatorWithBooleanType.js index b0a60a23744..2b390f2dc0f 100644 --- a/tests/baselines/reference/deleteOperatorWithBooleanType.js +++ b/tests/baselines/reference/deleteOperatorWithBooleanType.js @@ -50,7 +50,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // boolean type var diff --git a/tests/baselines/reference/deleteOperatorWithNumberType.js b/tests/baselines/reference/deleteOperatorWithNumberType.js index bb70c55024d..024fc850cc4 100644 --- a/tests/baselines/reference/deleteOperatorWithNumberType.js +++ b/tests/baselines/reference/deleteOperatorWithNumberType.js @@ -58,7 +58,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // number type var diff --git a/tests/baselines/reference/deleteOperatorWithStringType.js b/tests/baselines/reference/deleteOperatorWithStringType.js index 79246e27725..9dcf113b4b2 100644 --- a/tests/baselines/reference/deleteOperatorWithStringType.js +++ b/tests/baselines/reference/deleteOperatorWithStringType.js @@ -57,7 +57,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // string type var diff --git a/tests/baselines/reference/duplicateIdentifiersAcrossContainerBoundaries.js b/tests/baselines/reference/duplicateIdentifiersAcrossContainerBoundaries.js index 6a567018d1f..944ef4e3d5f 100644 --- a/tests/baselines/reference/duplicateIdentifiersAcrossContainerBoundaries.js +++ b/tests/baselines/reference/duplicateIdentifiersAcrossContainerBoundaries.js @@ -117,7 +117,6 @@ var Foo = (function () { })(); var Foo; (function (Foo) { - Foo.x; // error for redeclaring var in a different parent })(Foo || (Foo = {})); var N; (function (N) { diff --git a/tests/baselines/reference/duplicateSymbolsExportMatching.js b/tests/baselines/reference/duplicateSymbolsExportMatching.js index 89b5a210ec4..45aee387cda 100644 --- a/tests/baselines/reference/duplicateSymbolsExportMatching.js +++ b/tests/baselines/reference/duplicateSymbolsExportMatching.js @@ -83,9 +83,7 @@ define(["require", "exports"], function (require, exports) { var M2; (function (M2) { var v; - M2.v; // one error (visibility) var w; - M2.w; // two errors (visibility and type mismatch) })(M2 || (M2 = {})); var M; (function (M) { diff --git a/tests/baselines/reference/escapedIdentifiers.js b/tests/baselines/reference/escapedIdentifiers.js index 7051d8d2433..5ab7dcc5a5a 100644 --- a/tests/baselines/reference/escapedIdentifiers.js +++ b/tests/baselines/reference/escapedIdentifiers.js @@ -140,11 +140,9 @@ b++; // modules var moduleType1; (function (moduleType1) { - moduleType1.baz1; })(moduleType1 || (moduleType1 = {})); var moduleType\u0032; (function (moduleType2) { - moduleType2.baz2; })(moduleType\u0032 || (moduleType\u0032 = {})); moduleType1.baz1 = 3; moduleType\u0031.baz1 = 3; diff --git a/tests/baselines/reference/exportAssignmentError.js b/tests/baselines/reference/exportAssignmentError.js index 3a9e57029a9..777a9fab048 100644 --- a/tests/baselines/reference/exportAssignmentError.js +++ b/tests/baselines/reference/exportAssignmentError.js @@ -12,7 +12,6 @@ export = M2; // should not error define(["require", "exports"], function (require, exports) { var M; (function (M) { - M.x; })(M || (M = {})); var M2 = M; return M2; diff --git a/tests/baselines/reference/exportAssignmentInternalModule.js b/tests/baselines/reference/exportAssignmentInternalModule.js index fb9adfd5650..3426519e626 100644 --- a/tests/baselines/reference/exportAssignmentInternalModule.js +++ b/tests/baselines/reference/exportAssignmentInternalModule.js @@ -16,7 +16,6 @@ var n: number = modM.x; define(["require", "exports"], function (require, exports) { var M; (function (M) { - M.x; })(M || (M = {})); return M; }); diff --git a/tests/baselines/reference/exportAssignmentWithImportStatementPrivacyError.js b/tests/baselines/reference/exportAssignmentWithImportStatementPrivacyError.js index cb4cb3269b1..adfb85ae4bc 100644 --- a/tests/baselines/reference/exportAssignmentWithImportStatementPrivacyError.js +++ b/tests/baselines/reference/exportAssignmentWithImportStatementPrivacyError.js @@ -25,7 +25,6 @@ export = M; define(["require", "exports"], function (require, exports) { var M; (function (M) { - M.server; })(M || (M = {})); return M; }); diff --git a/tests/baselines/reference/exportNonInitializedVariablesAMD.errors.txt b/tests/baselines/reference/exportNonInitializedVariablesAMD.errors.txt new file mode 100644 index 00000000000..ae79675d8dd --- /dev/null +++ b/tests/baselines/reference/exportNonInitializedVariablesAMD.errors.txt @@ -0,0 +1,46 @@ +tests/cases/conformance/externalModules/exportNonInitializedVariablesAMD.ts(2,4): error TS1123: Variable declaration list cannot be empty. +tests/cases/conformance/externalModules/exportNonInitializedVariablesAMD.ts(3,1): error TS2304: Cannot find name 'let'. +tests/cases/conformance/externalModules/exportNonInitializedVariablesAMD.ts(4,6): error TS1123: Variable declaration list cannot be empty. + + +==== tests/cases/conformance/externalModules/exportNonInitializedVariablesAMD.ts (3 errors) ==== + + var; + +!!! error TS1123: Variable declaration list cannot be empty. + let; + ~~~ +!!! error TS2304: Cannot find name 'let'. + const; + +!!! error TS1123: Variable declaration list cannot be empty. + + export var a; + export let b; + export var c: string; + export let d: number; + class A {} + export var e: A; + export let f: A; + + namespace B { + export let a = 1, b, c = 2; + export let x, y, z; + } + + module C { + export var a = 1, b, c = 2; + export var x, y, z; + } + + // Shouldn't be filtered + export var a1 = 1; + export let b1 = 1; + export var c1: string = 'a'; + export let d1: number = 1; + class D {} + export var e1 = new D; + export let f1 = new D; + export var g1: D = new D; + export let h1: D = new D; + \ No newline at end of file diff --git a/tests/baselines/reference/exportNonInitializedVariablesAMD.js b/tests/baselines/reference/exportNonInitializedVariablesAMD.js new file mode 100644 index 00000000000..3b61281eaba --- /dev/null +++ b/tests/baselines/reference/exportNonInitializedVariablesAMD.js @@ -0,0 +1,69 @@ +//// [exportNonInitializedVariablesAMD.ts] + +var; +let; +const; + +export var a; +export let b; +export var c: string; +export let d: number; +class A {} +export var e: A; +export let f: A; + +namespace B { + export let a = 1, b, c = 2; + export let x, y, z; +} + +module C { + export var a = 1, b, c = 2; + export var x, y, z; +} + +// Shouldn't be filtered +export var a1 = 1; +export let b1 = 1; +export var c1: string = 'a'; +export let d1: number = 1; +class D {} +export var e1 = new D; +export let f1 = new D; +export var g1: D = new D; +export let h1: D = new D; + + +//// [exportNonInitializedVariablesAMD.js] +define(["require", "exports"], function (require, exports) { + var ; + let; + var ; + var A = (function () { + function A() { + } + return A; + })(); + var B; + (function (B) { + B.a = 1, B.c = 2; + })(B || (B = {})); + var C; + (function (C) { + C.a = 1, C.c = 2; + })(C || (C = {})); + // Shouldn't be filtered + exports.a1 = 1; + exports.b1 = 1; + exports.c1 = 'a'; + exports.d1 = 1; + var D = (function () { + function D() { + } + return D; + })(); + exports.e1 = new D; + exports.f1 = new D; + exports.g1 = new D; + exports.h1 = new D; +}); diff --git a/tests/baselines/reference/exportNonInitializedVariablesCommonJS.errors.txt b/tests/baselines/reference/exportNonInitializedVariablesCommonJS.errors.txt new file mode 100644 index 00000000000..65a18649af3 --- /dev/null +++ b/tests/baselines/reference/exportNonInitializedVariablesCommonJS.errors.txt @@ -0,0 +1,46 @@ +tests/cases/conformance/externalModules/exportNonInitializedVariablesCommonJS.ts(2,4): error TS1123: Variable declaration list cannot be empty. +tests/cases/conformance/externalModules/exportNonInitializedVariablesCommonJS.ts(3,1): error TS2304: Cannot find name 'let'. +tests/cases/conformance/externalModules/exportNonInitializedVariablesCommonJS.ts(4,6): error TS1123: Variable declaration list cannot be empty. + + +==== tests/cases/conformance/externalModules/exportNonInitializedVariablesCommonJS.ts (3 errors) ==== + + var; + +!!! error TS1123: Variable declaration list cannot be empty. + let; + ~~~ +!!! error TS2304: Cannot find name 'let'. + const; + +!!! error TS1123: Variable declaration list cannot be empty. + + export var a; + export let b; + export var c: string; + export let d: number; + class A {} + export var e: A; + export let f: A; + + namespace B { + export let a = 1, b, c = 2; + export let x, y, z; + } + + module C { + export var a = 1, b, c = 2; + export var x, y, z; + } + + // Shouldn't be filtered + export var a1 = 1; + export let b1 = 1; + export var c1: string = 'a'; + export let d1: number = 1; + class D {} + export var e1 = new D; + export let f1 = new D; + export var g1: D = new D; + export let h1: D = new D; + \ No newline at end of file diff --git a/tests/baselines/reference/exportNonInitializedVariablesCommonJS.js b/tests/baselines/reference/exportNonInitializedVariablesCommonJS.js new file mode 100644 index 00000000000..c1d308b1b94 --- /dev/null +++ b/tests/baselines/reference/exportNonInitializedVariablesCommonJS.js @@ -0,0 +1,67 @@ +//// [exportNonInitializedVariablesCommonJS.ts] + +var; +let; +const; + +export var a; +export let b; +export var c: string; +export let d: number; +class A {} +export var e: A; +export let f: A; + +namespace B { + export let a = 1, b, c = 2; + export let x, y, z; +} + +module C { + export var a = 1, b, c = 2; + export var x, y, z; +} + +// Shouldn't be filtered +export var a1 = 1; +export let b1 = 1; +export var c1: string = 'a'; +export let d1: number = 1; +class D {} +export var e1 = new D; +export let f1 = new D; +export var g1: D = new D; +export let h1: D = new D; + + +//// [exportNonInitializedVariablesCommonJS.js] +var ; +let; +var ; +var A = (function () { + function A() { + } + return A; +})(); +var B; +(function (B) { + B.a = 1, B.c = 2; +})(B || (B = {})); +var C; +(function (C) { + C.a = 1, C.c = 2; +})(C || (C = {})); +// Shouldn't be filtered +exports.a1 = 1; +exports.b1 = 1; +exports.c1 = 'a'; +exports.d1 = 1; +var D = (function () { + function D() { + } + return D; +})(); +exports.e1 = new D; +exports.f1 = new D; +exports.g1 = new D; +exports.h1 = new D; diff --git a/tests/baselines/reference/exportNonInitializedVariablesES6.errors.txt b/tests/baselines/reference/exportNonInitializedVariablesES6.errors.txt new file mode 100644 index 00000000000..905d16b360f --- /dev/null +++ b/tests/baselines/reference/exportNonInitializedVariablesES6.errors.txt @@ -0,0 +1,46 @@ +tests/cases/conformance/externalModules/exportNonInitializedVariablesES6.ts(2,4): error TS1123: Variable declaration list cannot be empty. +tests/cases/conformance/externalModules/exportNonInitializedVariablesES6.ts(3,1): error TS2304: Cannot find name 'let'. +tests/cases/conformance/externalModules/exportNonInitializedVariablesES6.ts(4,6): error TS1123: Variable declaration list cannot be empty. + + +==== tests/cases/conformance/externalModules/exportNonInitializedVariablesES6.ts (3 errors) ==== + + var; + +!!! error TS1123: Variable declaration list cannot be empty. + let; + ~~~ +!!! error TS2304: Cannot find name 'let'. + const; + +!!! error TS1123: Variable declaration list cannot be empty. + + export var a; + export let b; + export var c: string; + export let d: number; + class A {} + export var e: A; + export let f: A; + + namespace B { + export let a = 1, b, c = 2; + export let x, y, z; + } + + module C { + export var a = 1, b, c = 2; + export var x, y, z; + } + + // Shouldn't be filtered + export var a1 = 1; + export let b1 = 1; + export var c1: string = 'a'; + export let d1: number = 1; + class D {} + export var e1 = new D; + export let f1 = new D; + export var g1: D = new D; + export let h1: D = new D; + \ No newline at end of file diff --git a/tests/baselines/reference/exportNonInitializedVariablesES6.js b/tests/baselines/reference/exportNonInitializedVariablesES6.js new file mode 100644 index 00000000000..e4f47b2dc68 --- /dev/null +++ b/tests/baselines/reference/exportNonInitializedVariablesES6.js @@ -0,0 +1,67 @@ +//// [exportNonInitializedVariablesES6.ts] + +var; +let; +const; + +export var a; +export let b; +export var c: string; +export let d: number; +class A {} +export var e: A; +export let f: A; + +namespace B { + export let a = 1, b, c = 2; + export let x, y, z; +} + +module C { + export var a = 1, b, c = 2; + export var x, y, z; +} + +// Shouldn't be filtered +export var a1 = 1; +export let b1 = 1; +export var c1: string = 'a'; +export let d1: number = 1; +class D {} +export var e1 = new D; +export let f1 = new D; +export var g1: D = new D; +export let h1: D = new D; + + +//// [exportNonInitializedVariablesES6.js] +var ; +let; +const ; +export var a; +export let b; +export var c; +export let d; +class A { +} +export var e; +export let f; +var B; +(function (B) { + B.a = 1, B.c = 2; +})(B || (B = {})); +var C; +(function (C) { + C.a = 1, C.c = 2; +})(C || (C = {})); +// Shouldn't be filtered +export var a1 = 1; +export let b1 = 1; +export var c1 = 'a'; +export let d1 = 1; +class D { +} +export var e1 = new D; +export let f1 = new D; +export var g1 = new D; +export let h1 = new D; diff --git a/tests/baselines/reference/exportNonInitializedVariablesSystem.errors.txt b/tests/baselines/reference/exportNonInitializedVariablesSystem.errors.txt new file mode 100644 index 00000000000..d7aeb5d2ac0 --- /dev/null +++ b/tests/baselines/reference/exportNonInitializedVariablesSystem.errors.txt @@ -0,0 +1,46 @@ +tests/cases/conformance/externalModules/exportNonInitializedVariablesSystem.ts(2,4): error TS1123: Variable declaration list cannot be empty. +tests/cases/conformance/externalModules/exportNonInitializedVariablesSystem.ts(3,1): error TS2304: Cannot find name 'let'. +tests/cases/conformance/externalModules/exportNonInitializedVariablesSystem.ts(4,6): error TS1123: Variable declaration list cannot be empty. + + +==== tests/cases/conformance/externalModules/exportNonInitializedVariablesSystem.ts (3 errors) ==== + + var; + +!!! error TS1123: Variable declaration list cannot be empty. + let; + ~~~ +!!! error TS2304: Cannot find name 'let'. + const; + +!!! error TS1123: Variable declaration list cannot be empty. + + export var a; + export let b; + export var c: string; + export let d: number; + class A {} + export var e: A; + export let f: A; + + namespace B { + export let a = 1, b, c = 2; + export let x, y, z; + } + + module C { + export var a = 1, b, c = 2; + export var x, y, z; + } + + // Shouldn't be filtered + export var a1 = 1; + export let b1 = 1; + export var c1: string = 'a'; + export let d1: number = 1; + class D {} + export var e1 = new D; + export let f1 = new D; + export var g1: D = new D; + export let h1: D = new D; + \ No newline at end of file diff --git a/tests/baselines/reference/exportNonInitializedVariablesSystem.js b/tests/baselines/reference/exportNonInitializedVariablesSystem.js new file mode 100644 index 00000000000..3b9c5d759dc --- /dev/null +++ b/tests/baselines/reference/exportNonInitializedVariablesSystem.js @@ -0,0 +1,71 @@ +//// [exportNonInitializedVariablesSystem.ts] + +var; +let; +const; + +export var a; +export let b; +export var c: string; +export let d: number; +class A {} +export var e: A; +export let f: A; + +namespace B { + export let a = 1, b, c = 2; + export let x, y, z; +} + +module C { + export var a = 1, b, c = 2; + export var x, y, z; +} + +// Shouldn't be filtered +export var a1 = 1; +export let b1 = 1; +export var c1: string = 'a'; +export let d1: number = 1; +class D {} +export var e1 = new D; +export let f1 = new D; +export var g1: D = new D; +export let h1: D = new D; + + +//// [exportNonInitializedVariablesSystem.js] +System.register([], function(exports_1) { + var a, b, c, d, A, e, f, B, C, a1, b1, c1, d1, D, e1, f1, g1, h1; + return { + setters:[], + execute: function() { + let; + A = (function () { + function A() { + } + return A; + })(); + (function (B) { + B.a = 1, B.c = 2; + })(B || (B = {})); + (function (C) { + C.a = 1, C.c = 2; + })(C || (C = {})); + // Shouldn't be filtered + exports_1("a1", a1 = 1); + exports_1("b1", b1 = 1); + exports_1("c1", c1 = 'a'); + exports_1("d1", d1 = 1); + D = (function () { + function D() { + } + return D; + })(); + exports_1("e1", e1 = new D); + exports_1("f1", f1 = new D); + exports_1("g1", g1 = new D); + exports_1("h1", h1 = new D); + } + } +}); diff --git a/tests/baselines/reference/exportNonInitializedVariablesUMD.errors.txt b/tests/baselines/reference/exportNonInitializedVariablesUMD.errors.txt new file mode 100644 index 00000000000..eaf68e67055 --- /dev/null +++ b/tests/baselines/reference/exportNonInitializedVariablesUMD.errors.txt @@ -0,0 +1,46 @@ +tests/cases/conformance/externalModules/exportNonInitializedVariablesUMD.ts(2,4): error TS1123: Variable declaration list cannot be empty. +tests/cases/conformance/externalModules/exportNonInitializedVariablesUMD.ts(3,1): error TS2304: Cannot find name 'let'. +tests/cases/conformance/externalModules/exportNonInitializedVariablesUMD.ts(4,6): error TS1123: Variable declaration list cannot be empty. + + +==== tests/cases/conformance/externalModules/exportNonInitializedVariablesUMD.ts (3 errors) ==== + + var; + +!!! error TS1123: Variable declaration list cannot be empty. + let; + ~~~ +!!! error TS2304: Cannot find name 'let'. + const; + +!!! error TS1123: Variable declaration list cannot be empty. + + export var a; + export let b; + export var c: string; + export let d: number; + class A {} + export var e: A; + export let f: A; + + namespace B { + export let a = 1, b, c = 2; + export let x, y, z; + } + + module C { + export var a = 1, b, c = 2; + export var x, y, z; + } + + // Shouldn't be filtered + export var a1 = 1; + export let b1 = 1; + export var c1: string = 'a'; + export let d1: number = 1; + class D {} + export var e1 = new D; + export let f1 = new D; + export var g1: D = new D; + export let h1: D = new D; + \ No newline at end of file diff --git a/tests/baselines/reference/exportNonInitializedVariablesUMD.js b/tests/baselines/reference/exportNonInitializedVariablesUMD.js new file mode 100644 index 00000000000..1e8b3ce4446 --- /dev/null +++ b/tests/baselines/reference/exportNonInitializedVariablesUMD.js @@ -0,0 +1,76 @@ +//// [exportNonInitializedVariablesUMD.ts] + +var; +let; +const; + +export var a; +export let b; +export var c: string; +export let d: number; +class A {} +export var e: A; +export let f: A; + +namespace B { + export let a = 1, b, c = 2; + export let x, y, z; +} + +module C { + export var a = 1, b, c = 2; + export var x, y, z; +} + +// Shouldn't be filtered +export var a1 = 1; +export let b1 = 1; +export var c1: string = 'a'; +export let d1: number = 1; +class D {} +export var e1 = new D; +export let f1 = new D; +export var g1: D = new D; +export let h1: D = new D; + + +//// [exportNonInitializedVariablesUMD.js] +(function (deps, factory) { + if (typeof module === 'object' && typeof module.exports === 'object') { + var v = factory(require, exports); if (v !== undefined) module.exports = v; + } + else if (typeof define === 'function' && define.amd) { + define(deps, factory); + } +})(["require", "exports"], function (require, exports) { + var ; + let; + var ; + var A = (function () { + function A() { + } + return A; + })(); + var B; + (function (B) { + B.a = 1, B.c = 2; + })(B || (B = {})); + var C; + (function (C) { + C.a = 1, C.c = 2; + })(C || (C = {})); + // Shouldn't be filtered + exports.a1 = 1; + exports.b1 = 1; + exports.c1 = 'a'; + exports.d1 = 1; + var D = (function () { + function D() { + } + return D; + })(); + exports.e1 = new D; + exports.f1 = new D; + exports.g1 = new D; + exports.h1 = new D; +}); diff --git a/tests/baselines/reference/exportPrivateType.js b/tests/baselines/reference/exportPrivateType.js index 11ccc037ef6..14267730dfb 100644 --- a/tests/baselines/reference/exportPrivateType.js +++ b/tests/baselines/reference/exportPrivateType.js @@ -44,10 +44,5 @@ var foo; C2.prototype.test = function () { return true; }; return C2; })(); - // None of the types are exported, so per section 10.3, should all be errors - foo.e; - foo.f; - foo.g; - foo.h; })(foo || (foo = {})); var y = foo.g; // Exported variable 'y' has or is using private type 'foo.C2'. diff --git a/tests/baselines/reference/exportsAndImports1-amd.js b/tests/baselines/reference/exportsAndImports1-amd.js index fdc6d396bad..39744c7f142 100644 --- a/tests/baselines/reference/exportsAndImports1-amd.js +++ b/tests/baselines/reference/exportsAndImports1-amd.js @@ -55,7 +55,6 @@ define(["require", "exports"], function (require, exports) { exports.E = E; var M; (function (M) { - M.x; })(M || (M = {})); exports.M = M; var a = M.x; diff --git a/tests/baselines/reference/exportsAndImports1.js b/tests/baselines/reference/exportsAndImports1.js index 87cb9e0fe13..cd7db07b569 100644 --- a/tests/baselines/reference/exportsAndImports1.js +++ b/tests/baselines/reference/exportsAndImports1.js @@ -54,7 +54,6 @@ var E; exports.E = E; var M; (function (M) { - M.x; })(M || (M = {})); exports.M = M; var a = M.x; diff --git a/tests/baselines/reference/exportsAndImports3-amd.js b/tests/baselines/reference/exportsAndImports3-amd.js index f72d063e099..e816dec9f62 100644 --- a/tests/baselines/reference/exportsAndImports3-amd.js +++ b/tests/baselines/reference/exportsAndImports3-amd.js @@ -57,7 +57,6 @@ define(["require", "exports"], function (require, exports) { exports.E1 = exports.E; var M; (function (M) { - M.x; })(M = exports.M || (exports.M = {})); exports.M1 = exports.M; exports.a = M.x; diff --git a/tests/baselines/reference/exportsAndImports3.js b/tests/baselines/reference/exportsAndImports3.js index 56baead64cc..db29b62449e 100644 --- a/tests/baselines/reference/exportsAndImports3.js +++ b/tests/baselines/reference/exportsAndImports3.js @@ -56,7 +56,6 @@ var E = exports.E; exports.E1 = exports.E; var M; (function (M) { - M.x; })(M = exports.M || (exports.M = {})); exports.M1 = exports.M; exports.a = M.x; diff --git a/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js b/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js index 9b0fbf4bcad..6dd456ab703 100644 --- a/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js +++ b/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js @@ -10,6 +10,5 @@ module foo { function foo(y, z) { return y; } var foo; (function (foo) { - foo.x; var y = 1; })(foo || (foo = {})); diff --git a/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter2.js b/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter2.js index 76b6159f487..27961a68c73 100644 --- a/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter2.js +++ b/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter2.js @@ -14,6 +14,5 @@ var foo = (function () { })(); var foo; (function (foo) { - foo.x; var y = 1; })(foo || (foo = {})); diff --git a/tests/baselines/reference/giant.js b/tests/baselines/reference/giant.js index 4409933bb19..46bdaf827d5 100644 --- a/tests/baselines/reference/giant.js +++ b/tests/baselines/reference/giant.js @@ -805,7 +805,6 @@ define(["require", "exports"], function (require, exports) { ; ; ; - M.eV; function eF() { } M.eF = eF; ; @@ -822,7 +821,6 @@ define(["require", "exports"], function (require, exports) { ; ; })(M || (M = {})); - M_1.eV; function eF() { } M_1.eF = eF; ; @@ -884,7 +882,6 @@ define(["require", "exports"], function (require, exports) { ; ; ; - eM.eV; function eF() { } eM.eF = eF; ; @@ -903,7 +900,6 @@ define(["require", "exports"], function (require, exports) { })(eM = M_1.eM || (M_1.eM = {})); ; })(M || (M = {})); - exports.eV; function eF() { } exports.eF = eF; ; @@ -1014,7 +1010,6 @@ define(["require", "exports"], function (require, exports) { ; ; ; - M.eV; function eF() { } M.eF = eF; ; @@ -1031,7 +1026,6 @@ define(["require", "exports"], function (require, exports) { ; ; })(M || (M = {})); - eM_1.eV; function eF() { } eM_1.eF = eF; ; @@ -1093,7 +1087,6 @@ define(["require", "exports"], function (require, exports) { ; ; ; - eM.eV; function eF() { } eM.eF = eF; ; diff --git a/tests/baselines/reference/importDecl.js b/tests/baselines/reference/importDecl.js index 9d4839e5e7c..fb2aa6e0d1f 100644 --- a/tests/baselines/reference/importDecl.js +++ b/tests/baselines/reference/importDecl.js @@ -88,7 +88,6 @@ var d = (function () { return d; })(); exports.d = d; -exports.x; function foo() { return null; } exports.foo = foo; //// [importDecl_require1.js] @@ -108,7 +107,6 @@ var d = (function () { return d; })(); exports.d = d; -exports.x; function foo() { return null; } exports.foo = foo; //// [importDecl_require3.js] @@ -118,7 +116,6 @@ var d = (function () { return d; })(); exports.d = d; -exports.x; function foo() { return null; } exports.foo = foo; //// [importDecl_require4.js] diff --git a/tests/baselines/reference/importDeclarationUsedAsTypeQuery.js b/tests/baselines/reference/importDeclarationUsedAsTypeQuery.js index 6f6d9367278..70244f47381 100644 --- a/tests/baselines/reference/importDeclarationUsedAsTypeQuery.js +++ b/tests/baselines/reference/importDeclarationUsedAsTypeQuery.js @@ -19,7 +19,6 @@ var B = (function () { })(); exports.B = B; //// [importDeclarationUsedAsTypeQuery_1.js] -exports.x; //// [importDeclarationUsedAsTypeQuery_require.d.ts] diff --git a/tests/baselines/reference/importOnAliasedIdentifiers.js b/tests/baselines/reference/importOnAliasedIdentifiers.js index 7034f682bf3..ceb6ebb7b2e 100644 --- a/tests/baselines/reference/importOnAliasedIdentifiers.js +++ b/tests/baselines/reference/importOnAliasedIdentifiers.js @@ -13,7 +13,6 @@ module B { //// [importOnAliasedIdentifiers.js] var A; (function (A) { - A.X; })(A || (A = {})); var B; (function (B) { diff --git a/tests/baselines/reference/incrementOperatorWithAnyOtherType.js b/tests/baselines/reference/incrementOperatorWithAnyOtherType.js index 4c9d570d07f..6cd7afc5a60 100644 --- a/tests/baselines/reference/incrementOperatorWithAnyOtherType.js +++ b/tests/baselines/reference/incrementOperatorWithAnyOtherType.js @@ -61,7 +61,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // any type var diff --git a/tests/baselines/reference/incrementOperatorWithAnyOtherTypeInvalidOperations.js b/tests/baselines/reference/incrementOperatorWithAnyOtherTypeInvalidOperations.js index 6f76fba6d8c..259dcac404e 100644 --- a/tests/baselines/reference/incrementOperatorWithAnyOtherTypeInvalidOperations.js +++ b/tests/baselines/reference/incrementOperatorWithAnyOtherTypeInvalidOperations.js @@ -90,7 +90,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // any type var diff --git a/tests/baselines/reference/incrementOperatorWithNumberType.js b/tests/baselines/reference/incrementOperatorWithNumberType.js index 09365833e3b..cf7ce435cb0 100644 --- a/tests/baselines/reference/incrementOperatorWithNumberType.js +++ b/tests/baselines/reference/incrementOperatorWithNumberType.js @@ -50,7 +50,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // number type var diff --git a/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.js b/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.js index eb9cd949280..17820b7bd86 100644 --- a/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.js +++ b/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.js @@ -59,7 +59,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); //number type var diff --git a/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.js b/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.js index 6a974443f7b..5bdba8dfee5 100644 --- a/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.js +++ b/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.js @@ -66,7 +66,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // boolean type var diff --git a/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.js b/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.js index 82bf03cd83a..baeaf9555fb 100644 --- a/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.js +++ b/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.js @@ -78,7 +78,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // string type var diff --git a/tests/baselines/reference/internalAliasInterface.js b/tests/baselines/reference/internalAliasInterface.js index d2006caf24c..aa902c2f56e 100644 --- a/tests/baselines/reference/internalAliasInterface.js +++ b/tests/baselines/reference/internalAliasInterface.js @@ -13,7 +13,6 @@ module c { //// [internalAliasInterface.js] var c; (function (c) { - c.x; })(c || (c = {})); diff --git a/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithExport.js b/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithExport.js index c4852ffe27a..8db0ad7f49e 100644 --- a/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithExport.js +++ b/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithExport.js @@ -14,7 +14,6 @@ export module c { define(["require", "exports"], function (require, exports) { var c; (function (c) { - c.x; })(c = exports.c || (exports.c = {})); }); diff --git a/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithoutExport.js b/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithoutExport.js index b09f21650e4..047553fa668 100644 --- a/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithoutExport.js +++ b/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithoutExport.js @@ -14,7 +14,6 @@ export module c { define(["require", "exports"], function (require, exports) { var c; (function (c) { - c.x; })(c = exports.c || (exports.c = {})); }); diff --git a/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithoutExportAccessError.js b/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithoutExportAccessError.js index 1d13192c928..e5ac69a44c1 100644 --- a/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithoutExportAccessError.js +++ b/tests/baselines/reference/internalAliasInterfaceInsideLocalModuleWithoutExportAccessError.js @@ -15,7 +15,6 @@ var x: c.b; define(["require", "exports"], function (require, exports) { var c; (function (c) { - c.x; })(c = exports.c || (exports.c = {})); var x; }); diff --git a/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithExport.js b/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithExport.js index a771da2d789..912336068da 100644 --- a/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithExport.js +++ b/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithExport.js @@ -9,7 +9,6 @@ export var x: b; //// [internalAliasInterfaceInsideTopLevelModuleWithExport.js] -exports.x; //// [internalAliasInterfaceInsideTopLevelModuleWithExport.d.ts] diff --git a/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithoutExport.js b/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithoutExport.js index bd1a83fdd85..3964e539fdf 100644 --- a/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithoutExport.js +++ b/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithoutExport.js @@ -10,7 +10,6 @@ export var x: b; //// [internalAliasInterfaceInsideTopLevelModuleWithoutExport.js] define(["require", "exports"], function (require, exports) { - exports.x; }); diff --git a/tests/baselines/reference/internalAliasUninitializedModule.js b/tests/baselines/reference/internalAliasUninitializedModule.js index ee62a10c1ca..5233f9a790d 100644 --- a/tests/baselines/reference/internalAliasUninitializedModule.js +++ b/tests/baselines/reference/internalAliasUninitializedModule.js @@ -16,7 +16,6 @@ module c { //// [internalAliasUninitializedModule.js] var c; (function (c) { - c.x; c.x.foo(); })(c || (c = {})); diff --git a/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithExport.js b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithExport.js index 5c67c835f1f..f6faee442c4 100644 --- a/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithExport.js +++ b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithExport.js @@ -16,7 +16,6 @@ export module c { //// [internalAliasUninitializedModuleInsideLocalModuleWithExport.js] var c; (function (c) { - c.x; c.x.foo(); })(c = exports.c || (exports.c = {})); diff --git a/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExport.js b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExport.js index 6f85a346891..2ef3c5320a8 100644 --- a/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExport.js +++ b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExport.js @@ -16,7 +16,6 @@ export module c { //// [internalAliasUninitializedModuleInsideLocalModuleWithoutExport.js] var c; (function (c) { - c.x; c.x.foo(); })(c = exports.c || (exports.c = {})); diff --git a/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError.js b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError.js index 61d1005c9f4..ea13aae8aa1 100644 --- a/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError.js +++ b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError.js @@ -20,8 +20,6 @@ export var z: c.b.I; define(["require", "exports"], function (require, exports) { var c; (function (c) { - c.x; c.x.foo(); })(c = exports.c || (exports.c = {})); - exports.z; }); diff --git a/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithExport.js b/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithExport.js index 79bc7c6c874..edfc3be8e69 100644 --- a/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithExport.js +++ b/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithExport.js @@ -14,7 +14,6 @@ x.foo(); //// [internalAliasUninitializedModuleInsideTopLevelModuleWithExport.js] define(["require", "exports"], function (require, exports) { - exports.x; exports.x.foo(); }); diff --git a/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.js b/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.js index 3f626fd37ac..6e484e67cdb 100644 --- a/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.js +++ b/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.js @@ -13,7 +13,6 @@ x.foo(); //// [internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.js] -exports.x; exports.x.foo(); diff --git a/tests/baselines/reference/internalAliasWithDottedNameEmit.js b/tests/baselines/reference/internalAliasWithDottedNameEmit.js index 98c8ce36a6c..0e74d7ecd4e 100644 --- a/tests/baselines/reference/internalAliasWithDottedNameEmit.js +++ b/tests/baselines/reference/internalAliasWithDottedNameEmit.js @@ -14,7 +14,6 @@ var a; (function (b) { var c; (function (c) { - c.d; })(c = b.c || (b.c = {})); })(b = a.b || (a.b = {})); })(a || (a = {})); diff --git a/tests/baselines/reference/intrinsics.js b/tests/baselines/reference/intrinsics.js index 5e608b7fd6a..736ffa020fa 100644 --- a/tests/baselines/reference/intrinsics.js +++ b/tests/baselines/reference/intrinsics.js @@ -19,7 +19,6 @@ var foo: (__proto__: number) => void; var hasOwnProperty; // Error var m1; (function (m1) { - m1.__proto__; var C = (function () { function C() { } diff --git a/tests/baselines/reference/invalidNestedModules.js b/tests/baselines/reference/invalidNestedModules.js index 0679dae7ac6..bec6491a636 100644 --- a/tests/baselines/reference/invalidNestedModules.js +++ b/tests/baselines/reference/invalidNestedModules.js @@ -73,6 +73,5 @@ var M2; (function (M2) { var X; (function (X) { - X.Point; // Error })(X = M2.X || (M2.X = {})); })(M2 || (M2 = {})); diff --git a/tests/baselines/reference/logicalNotOperatorWithAnyOtherType.js b/tests/baselines/reference/logicalNotOperatorWithAnyOtherType.js index 28366739233..61a1d4c01d1 100644 --- a/tests/baselines/reference/logicalNotOperatorWithAnyOtherType.js +++ b/tests/baselines/reference/logicalNotOperatorWithAnyOtherType.js @@ -81,7 +81,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // any type var diff --git a/tests/baselines/reference/logicalNotOperatorWithBooleanType.js b/tests/baselines/reference/logicalNotOperatorWithBooleanType.js index 107bd9a88ec..6af1f67f7cf 100644 --- a/tests/baselines/reference/logicalNotOperatorWithBooleanType.js +++ b/tests/baselines/reference/logicalNotOperatorWithBooleanType.js @@ -50,7 +50,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // boolean type var diff --git a/tests/baselines/reference/logicalNotOperatorWithNumberType.js b/tests/baselines/reference/logicalNotOperatorWithNumberType.js index 0d0601cad23..b291d31f5b0 100644 --- a/tests/baselines/reference/logicalNotOperatorWithNumberType.js +++ b/tests/baselines/reference/logicalNotOperatorWithNumberType.js @@ -58,7 +58,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // number type var diff --git a/tests/baselines/reference/logicalNotOperatorWithStringType.js b/tests/baselines/reference/logicalNotOperatorWithStringType.js index 7f75814d601..caf31b78057 100644 --- a/tests/baselines/reference/logicalNotOperatorWithStringType.js +++ b/tests/baselines/reference/logicalNotOperatorWithStringType.js @@ -57,7 +57,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // string type var diff --git a/tests/baselines/reference/moduleAliasAsFunctionArgument.js b/tests/baselines/reference/moduleAliasAsFunctionArgument.js index 4cf9114a26d..ae95e2f7361 100644 --- a/tests/baselines/reference/moduleAliasAsFunctionArgument.js +++ b/tests/baselines/reference/moduleAliasAsFunctionArgument.js @@ -16,7 +16,6 @@ fn(a); // Error: property 'x' is missing from 'a' //// [moduleAliasAsFunctionArgument_0.js] define(["require", "exports"], function (require, exports) { - exports.x; }); //// [moduleAliasAsFunctionArgument_1.js] define(["require", "exports", 'moduleAliasAsFunctionArgument_0'], function (require, exports, a) { diff --git a/tests/baselines/reference/moduleProperty2.js b/tests/baselines/reference/moduleProperty2.js index 715577b6458..7ed1c89108c 100644 --- a/tests/baselines/reference/moduleProperty2.js +++ b/tests/baselines/reference/moduleProperty2.js @@ -21,7 +21,6 @@ var M; var x; } var y; - M.z; var test1 = x; var test2 = y; // y visible because same module })(M || (M = {})); diff --git a/tests/baselines/reference/moduleUnassignedVariable.js b/tests/baselines/reference/moduleUnassignedVariable.js index 1765342efcd..e8719742ab6 100644 --- a/tests/baselines/reference/moduleUnassignedVariable.js +++ b/tests/baselines/reference/moduleUnassignedVariable.js @@ -13,6 +13,5 @@ var Bar; (function (Bar) { Bar.a = 1; function fooA() { return Bar.a; } // Correct: return Bar.a - Bar.b; function fooB() { return Bar.b; } // Incorrect: return b })(Bar || (Bar = {})); diff --git a/tests/baselines/reference/moduledecl.js b/tests/baselines/reference/moduledecl.js index 4a27e0fbe1f..ef3b9a2965c 100644 --- a/tests/baselines/reference/moduledecl.js +++ b/tests/baselines/reference/moduledecl.js @@ -272,11 +272,9 @@ var m; var m2; (function (m2) { var a = 10; - m2.b; })(m2 = m.m2 || (m.m2 = {})); var m3; (function (m3) { - m3.c; })(m3 = m.m3 || (m.m3 = {})); })(m || (m = {})); var m; @@ -285,7 +283,6 @@ var m; (function (m25) { var m5; (function (m5) { - m5.c; })(m5 = m25.m5 || (m25.m5 = {})); })(m25 = m.m25 || (m.m25 = {})); })(m || (m = {})); @@ -297,7 +294,6 @@ var m13; (function (m2) { var m3; (function (m3) { - m3.c; })(m3 = m2.m3 || (m2.m3 = {})); })(m2 = m4.m2 || (m4.m2 = {})); function f() { diff --git a/tests/baselines/reference/multipleExports.js b/tests/baselines/reference/multipleExports.js index b8c08952b67..ec795ef9913 100644 --- a/tests/baselines/reference/multipleExports.js +++ b/tests/baselines/reference/multipleExports.js @@ -16,7 +16,6 @@ export module M { var M; (function (M) { M.v = 0; - M.x; })(M = exports.M || (exports.M = {})); var x = 0; var M; diff --git a/tests/baselines/reference/multivar.js b/tests/baselines/reference/multivar.js index b5a997a2bd5..3f9796d2944 100644 --- a/tests/baselines/reference/multivar.js +++ b/tests/baselines/reference/multivar.js @@ -51,7 +51,7 @@ var a, b, c; var x = 1, y = 2, z = 3; var m2; (function (m2) { - m2.a, m2.b2 = 10, m2.b; + m2.b2 = 10; var m1; var a2, b22 = 10, b222; var m3; diff --git a/tests/baselines/reference/negateOperatorWithAnyOtherType.js b/tests/baselines/reference/negateOperatorWithAnyOtherType.js index 8418bbbe467..e0dd9b184c3 100644 --- a/tests/baselines/reference/negateOperatorWithAnyOtherType.js +++ b/tests/baselines/reference/negateOperatorWithAnyOtherType.js @@ -75,7 +75,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // any type var diff --git a/tests/baselines/reference/negateOperatorWithBooleanType.js b/tests/baselines/reference/negateOperatorWithBooleanType.js index 9442f54490f..c357849d8a5 100644 --- a/tests/baselines/reference/negateOperatorWithBooleanType.js +++ b/tests/baselines/reference/negateOperatorWithBooleanType.js @@ -47,7 +47,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // boolean type var diff --git a/tests/baselines/reference/negateOperatorWithNumberType.js b/tests/baselines/reference/negateOperatorWithNumberType.js index 5fa83e088c8..8a29830e3e4 100644 --- a/tests/baselines/reference/negateOperatorWithNumberType.js +++ b/tests/baselines/reference/negateOperatorWithNumberType.js @@ -54,7 +54,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // number type var diff --git a/tests/baselines/reference/negateOperatorWithStringType.js b/tests/baselines/reference/negateOperatorWithStringType.js index bdbc4a3d664..2b79819894c 100644 --- a/tests/baselines/reference/negateOperatorWithStringType.js +++ b/tests/baselines/reference/negateOperatorWithStringType.js @@ -53,7 +53,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // string type var diff --git a/tests/baselines/reference/nestedModules.js b/tests/baselines/reference/nestedModules.js index f146990ec82..c602bb765e2 100644 --- a/tests/baselines/reference/nestedModules.js +++ b/tests/baselines/reference/nestedModules.js @@ -44,7 +44,6 @@ var M2; (function (M2) { var X; (function (X) { - X.Point; })(X = M2.X || (M2.X = {})); })(M2 || (M2 = {})); var m = M2.X; diff --git a/tests/baselines/reference/newWithSpread.errors.txt b/tests/baselines/reference/newWithSpread.errors.txt new file mode 100644 index 00000000000..293c7054e4c --- /dev/null +++ b/tests/baselines/reference/newWithSpread.errors.txt @@ -0,0 +1,178 @@ +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(37,13): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(38,13): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(41,8): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(42,13): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(46,13): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(47,13): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(51,15): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(52,15): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(56,17): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(57,17): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(61,18): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(62,18): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(66,22): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(67,22): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(71,13): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(72,13): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(76,20): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(77,20): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(81,22): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(82,22): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(86,23): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(87,23): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(91,27): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(92,27): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(96,23): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/functionCalls/newWithSpread.ts(97,23): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + + +==== tests/cases/conformance/expressions/functionCalls/newWithSpread.ts (26 errors) ==== + + function f(x: number, y: number, ...z: string[]) { + } + + function f2(...x: string[]) { + } + + interface A { + f: { + new (x: number, y: number, ...z: string[]); + } + } + + class B { + constructor(x: number, y: number, ...z: string[]) {} + } + + interface C { + "a-b": typeof B; + } + + interface D { + 1: typeof B; + } + + var a: string[]; + var b: A; + var c: C; + var d: A[]; + var e: { [key: string]: A }; + var g: C[]; + var h: { [key: string]: C }; + var i: C[][]; + + // Basic expression + new f(1, 2, "string"); + new f(1, 2, ...a); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + new f(1, 2, ...a, "string"); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + + // Multiple spreads arguments + new f2(...a, ...a); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + new f(1 ,2, ...a, ...a); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + + // Call expression + new f(1, 2, "string")(); + new f(1, 2, ...a)(); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + new f(1, 2, ...a, "string")(); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + + // Property access expression + new b.f(1, 2, "string"); + new b.f(1, 2, ...a); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + new b.f(1, 2, ...a, "string"); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + + // Parenthesised expression + new (b.f)(1, 2, "string"); + new (b.f)(1, 2, ...a); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + new (b.f)(1, 2, ...a, "string"); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + + // Element access expression + new d[1].f(1, 2, "string"); + new d[1].f(1, 2, ...a); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + new d[1].f(1, 2, ...a, "string"); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + + // Element access expression with a punctuated key + new e["a-b"].f(1, 2, "string"); + new e["a-b"].f(1, 2, ...a); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + new e["a-b"].f(1, 2, ...a, "string"); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + + // Basic expression + new B(1, 2, "string"); + new B(1, 2, ...a); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + new B(1, 2, ...a, "string"); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + + // Property access expression + new c["a-b"](1, 2, "string"); + new c["a-b"](1, 2, ...a); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + new c["a-b"](1, 2, ...a, "string"); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + + // Parenthesised expression + new (c["a-b"])(1, 2, "string"); + new (c["a-b"])(1, 2, ...a); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + new (c["a-b"])(1, 2, ...a, "string"); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + + // Element access expression + new g[1]["a-b"](1, 2, "string"); + new g[1]["a-b"](1, 2, ...a); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + new g[1]["a-b"](1, 2, ...a, "string"); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + + // Element access expression with a punctuated key + new h["a-b"]["a-b"](1, 2, "string"); + new h["a-b"]["a-b"](1, 2, ...a); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + new h["a-b"]["a-b"](1, 2, ...a, "string"); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + + // Element access expression with a number + new i["a-b"][1](1, 2, "string"); + new i["a-b"][1](1, 2, ...a); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. + new i["a-b"][1](1, 2, ...a, "string"); + ~~~~ +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher. \ No newline at end of file diff --git a/tests/baselines/reference/newWithSpread.js b/tests/baselines/reference/newWithSpread.js new file mode 100644 index 00000000000..3161eb9f67e --- /dev/null +++ b/tests/baselines/reference/newWithSpread.js @@ -0,0 +1,180 @@ +//// [newWithSpread.ts] + +function f(x: number, y: number, ...z: string[]) { +} + +function f2(...x: string[]) { +} + +interface A { + f: { + new (x: number, y: number, ...z: string[]); + } +} + +class B { + constructor(x: number, y: number, ...z: string[]) {} +} + +interface C { + "a-b": typeof B; +} + +interface D { + 1: typeof B; +} + +var a: string[]; +var b: A; +var c: C; +var d: A[]; +var e: { [key: string]: A }; +var g: C[]; +var h: { [key: string]: C }; +var i: C[][]; + +// Basic expression +new f(1, 2, "string"); +new f(1, 2, ...a); +new f(1, 2, ...a, "string"); + +// Multiple spreads arguments +new f2(...a, ...a); +new f(1 ,2, ...a, ...a); + +// Call expression +new f(1, 2, "string")(); +new f(1, 2, ...a)(); +new f(1, 2, ...a, "string")(); + +// Property access expression +new b.f(1, 2, "string"); +new b.f(1, 2, ...a); +new b.f(1, 2, ...a, "string"); + +// Parenthesised expression +new (b.f)(1, 2, "string"); +new (b.f)(1, 2, ...a); +new (b.f)(1, 2, ...a, "string"); + +// Element access expression +new d[1].f(1, 2, "string"); +new d[1].f(1, 2, ...a); +new d[1].f(1, 2, ...a, "string"); + +// Element access expression with a punctuated key +new e["a-b"].f(1, 2, "string"); +new e["a-b"].f(1, 2, ...a); +new e["a-b"].f(1, 2, ...a, "string"); + +// Basic expression +new B(1, 2, "string"); +new B(1, 2, ...a); +new B(1, 2, ...a, "string"); + +// Property access expression +new c["a-b"](1, 2, "string"); +new c["a-b"](1, 2, ...a); +new c["a-b"](1, 2, ...a, "string"); + +// Parenthesised expression +new (c["a-b"])(1, 2, "string"); +new (c["a-b"])(1, 2, ...a); +new (c["a-b"])(1, 2, ...a, "string"); + +// Element access expression +new g[1]["a-b"](1, 2, "string"); +new g[1]["a-b"](1, 2, ...a); +new g[1]["a-b"](1, 2, ...a, "string"); + +// Element access expression with a punctuated key +new h["a-b"]["a-b"](1, 2, "string"); +new h["a-b"]["a-b"](1, 2, ...a); +new h["a-b"]["a-b"](1, 2, ...a, "string"); + +// Element access expression with a number +new i["a-b"][1](1, 2, "string"); +new i["a-b"][1](1, 2, ...a); +new i["a-b"][1](1, 2, ...a, "string"); + +//// [newWithSpread.js] +function f(x, y) { + var z = []; + for (var _i = 2; _i < arguments.length; _i++) { + z[_i - 2] = arguments[_i]; + } +} +function f2() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +} +var B = (function () { + function B(x, y) { + var z = []; + for (var _i = 2; _i < arguments.length; _i++) { + z[_i - 2] = arguments[_i]; + } + } + return B; +})(); +var a; +var b; +var c; +var d; +var e; +var g; +var h; +var i; +// Basic expression +new f(1, 2, "string"); +new f(1, 2, ...a); +new f(1, 2, ...a, "string"); +// Multiple spreads arguments +new f2(...a, ...a); +new f(1, 2, ...a, ...a); +// Call expression +new f(1, 2, "string")(); +new f(1, 2, ...a)(); +new f(1, 2, ...a, "string")(); +// Property access expression +new b.f(1, 2, "string"); +new b.f(1, 2, ...a); +new b.f(1, 2, ...a, "string"); +// Parenthesised expression +new (b.f)(1, 2, "string"); +new (b.f)(1, 2, ...a); +new (b.f)(1, 2, ...a, "string"); +// Element access expression +new d[1].f(1, 2, "string"); +new d[1].f(1, 2, ...a); +new d[1].f(1, 2, ...a, "string"); +// Element access expression with a punctuated key +new e["a-b"].f(1, 2, "string"); +new e["a-b"].f(1, 2, ...a); +new e["a-b"].f(1, 2, ...a, "string"); +// Basic expression +new B(1, 2, "string"); +new B(1, 2, ...a); +new B(1, 2, ...a, "string"); +// Property access expression +new c["a-b"](1, 2, "string"); +new c["a-b"](1, 2, ...a); +new c["a-b"](1, 2, ...a, "string"); +// Parenthesised expression +new (c["a-b"])(1, 2, "string"); +new (c["a-b"])(1, 2, ...a); +new (c["a-b"])(1, 2, ...a, "string"); +// Element access expression +new g[1]["a-b"](1, 2, "string"); +new g[1]["a-b"](1, 2, ...a); +new g[1]["a-b"](1, 2, ...a, "string"); +// Element access expression with a punctuated key +new h["a-b"]["a-b"](1, 2, "string"); +new h["a-b"]["a-b"](1, 2, ...a); +new h["a-b"]["a-b"](1, 2, ...a, "string"); +// Element access expression with a number +new i["a-b"][1](1, 2, "string"); +new i["a-b"][1](1, 2, ...a); +new i["a-b"][1](1, 2, ...a, "string"); diff --git a/tests/baselines/reference/newWithSpreadES5.js b/tests/baselines/reference/newWithSpreadES5.js new file mode 100644 index 00000000000..f7470266273 --- /dev/null +++ b/tests/baselines/reference/newWithSpreadES5.js @@ -0,0 +1,180 @@ +//// [newWithSpreadES5.ts] + +function f(x: number, y: number, ...z: string[]) { +} + +function f2(...x: string[]) {} + +interface A { + f: { + new (x: number, y: number, ...z: string[]); + } +} + +class B { + constructor(x: number, y: number, ...z: string[]) {} +} + +interface C { + "a-b": typeof B; +} + +interface D { + 1: typeof B; +} + +var a: string[]; +var b: A; +var c: C; +var d: A[]; +var e: { [key: string]: A }; +var g: C[]; +var h: { [key: string]: C }; +var i: C[][]; + +// Basic expression +new f(1, 2, "string"); +new f(1, 2, ...a); +new f(1, 2, ...a, "string"); + +// Multiple spreads arguments +new f2(...a, ...a); +new f(1 ,2, ...a, ...a); + +// Call expression +new f(1, 2, "string")(); +new f(1, 2, ...a)(); +new f(1, 2, ...a, "string")(); + +// Property access expression +new b.f(1, 2, "string"); +new b.f(1, 2, ...a); +new b.f(1, 2, ...a, "string"); + +// Parenthesised expression +new (b.f)(1, 2, "string"); +new (b.f)(1, 2, ...a); +new (b.f)(1, 2, ...a, "string"); + +// Element access expression +new d[1].f(1, 2, "string"); +new d[1].f(1, 2, ...a); +new d[1].f(1, 2, ...a, "string"); + +// Element access expression with a punctuated key +new e["a-b"].f(1, 2, "string"); +new e["a-b"].f(1, 2, ...a); +new e["a-b"].f(1, 2, ...a, "string"); + +// Basic expression +new B(1, 2, "string"); +new B(1, 2, ...a); +new B(1, 2, ...a, "string"); + +// Property access expression +new c["a-b"](1, 2, "string"); +new c["a-b"](1, 2, ...a); +new c["a-b"](1, 2, ...a, "string"); + +// Parenthesised expression +new (c["a-b"])(1, 2, "string"); +new (c["a-b"])(1, 2, ...a); +new (c["a-b"])(1, 2, ...a, "string"); + +// Element access expression +new g[1]["a-b"](1, 2, "string"); +new g[1]["a-b"](1, 2, ...a); +new g[1]["a-b"](1, 2, ...a, "string"); + +// Element access expression with a punctuated key +new h["a-b"]["a-b"](1, 2, "string"); +new h["a-b"]["a-b"](1, 2, ...a); +new h["a-b"]["a-b"](1, 2, ...a, "string"); + +// Element access expression with a number +new i["a-b"][1](1, 2, "string"); +new i["a-b"][1](1, 2, ...a); +new i["a-b"][1](1, 2, ...a, "string"); + +//// [newWithSpreadES5.js] +function f(x, y) { + var z = []; + for (var _i = 2; _i < arguments.length; _i++) { + z[_i - 2] = arguments[_i]; + } +} +function f2() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +} +var B = (function () { + function B(x, y) { + var z = []; + for (var _i = 2; _i < arguments.length; _i++) { + z[_i - 2] = arguments[_i]; + } + } + return B; +})(); +var a; +var b; +var c; +var d; +var e; +var g; +var h; +var i; +// Basic expression +new f(1, 2, "string"); +new (f.bind.apply(f, [void 0].concat([1, 2], a)))(); +new (f.bind.apply(f, [void 0].concat([1, 2], a, ["string"])))(); +// Multiple spreads arguments +new (f2.bind.apply(f2, [void 0].concat(a, a)))(); +new (f.bind.apply(f, [void 0].concat([1, 2], a, a)))(); +// Call expression +new f(1, 2, "string")(); +new (f.bind.apply(f, [void 0].concat([1, 2], a)))()(); +new (f.bind.apply(f, [void 0].concat([1, 2], a, ["string"])))()(); +// Property access expression +new b.f(1, 2, "string"); +new ((_a = b.f).bind.apply(_a, [void 0].concat([1, 2], a)))(); +new ((_b = b.f).bind.apply(_b, [void 0].concat([1, 2], a, ["string"])))(); +// Parenthesised expression +new (b.f)(1, 2, "string"); +new ((_c = (b.f)).bind.apply(_c, [void 0].concat([1, 2], a)))(); +new ((_d = (b.f)).bind.apply(_d, [void 0].concat([1, 2], a, ["string"])))(); +// Element access expression +new d[1].f(1, 2, "string"); +new ((_e = d[1].f).bind.apply(_e, [void 0].concat([1, 2], a)))(); +new ((_f = d[1].f).bind.apply(_f, [void 0].concat([1, 2], a, ["string"])))(); +// Element access expression with a punctuated key +new e["a-b"].f(1, 2, "string"); +new ((_g = e["a-b"].f).bind.apply(_g, [void 0].concat([1, 2], a)))(); +new ((_h = e["a-b"].f).bind.apply(_h, [void 0].concat([1, 2], a, ["string"])))(); +// Basic expression +new B(1, 2, "string"); +new (B.bind.apply(B, [void 0].concat([1, 2], a)))(); +new (B.bind.apply(B, [void 0].concat([1, 2], a, ["string"])))(); +// Property access expression +new c["a-b"](1, 2, "string"); +new ((_j = c["a-b"]).bind.apply(_j, [void 0].concat([1, 2], a)))(); +new ((_k = c["a-b"]).bind.apply(_k, [void 0].concat([1, 2], a, ["string"])))(); +// Parenthesised expression +new (c["a-b"])(1, 2, "string"); +new ((_l = (c["a-b"])).bind.apply(_l, [void 0].concat([1, 2], a)))(); +new ((_m = (c["a-b"])).bind.apply(_m, [void 0].concat([1, 2], a, ["string"])))(); +// Element access expression +new g[1]["a-b"](1, 2, "string"); +new ((_o = g[1]["a-b"]).bind.apply(_o, [void 0].concat([1, 2], a)))(); +new ((_p = g[1]["a-b"]).bind.apply(_p, [void 0].concat([1, 2], a, ["string"])))(); +// Element access expression with a punctuated key +new h["a-b"]["a-b"](1, 2, "string"); +new ((_q = h["a-b"]["a-b"]).bind.apply(_q, [void 0].concat([1, 2], a)))(); +new ((_r = h["a-b"]["a-b"]).bind.apply(_r, [void 0].concat([1, 2], a, ["string"])))(); +// Element access expression with a number +new i["a-b"][1](1, 2, "string"); +new ((_s = i["a-b"][1]).bind.apply(_s, [void 0].concat([1, 2], a)))(); +new ((_t = i["a-b"][1]).bind.apply(_t, [void 0].concat([1, 2], a, ["string"])))(); +var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t; diff --git a/tests/baselines/reference/newWithSpreadES5.symbols b/tests/baselines/reference/newWithSpreadES5.symbols new file mode 100644 index 00000000000..021674ef337 --- /dev/null +++ b/tests/baselines/reference/newWithSpreadES5.symbols @@ -0,0 +1,273 @@ +=== tests/cases/conformance/expressions/functionCalls/newWithSpreadES5.ts === + +function f(x: number, y: number, ...z: string[]) { +>f : Symbol(f, Decl(newWithSpreadES5.ts, 0, 0)) +>x : Symbol(x, Decl(newWithSpreadES5.ts, 1, 11)) +>y : Symbol(y, Decl(newWithSpreadES5.ts, 1, 21)) +>z : Symbol(z, Decl(newWithSpreadES5.ts, 1, 32)) +} + +function f2(...x: string[]) {} +>f2 : Symbol(f2, Decl(newWithSpreadES5.ts, 2, 1)) +>x : Symbol(x, Decl(newWithSpreadES5.ts, 4, 12)) + +interface A { +>A : Symbol(A, Decl(newWithSpreadES5.ts, 4, 30)) + + f: { +>f : Symbol(f, Decl(newWithSpreadES5.ts, 6, 13)) + + new (x: number, y: number, ...z: string[]); +>x : Symbol(x, Decl(newWithSpreadES5.ts, 8, 13)) +>y : Symbol(y, Decl(newWithSpreadES5.ts, 8, 23)) +>z : Symbol(z, Decl(newWithSpreadES5.ts, 8, 34)) + } +} + +class B { +>B : Symbol(B, Decl(newWithSpreadES5.ts, 10, 1)) + + constructor(x: number, y: number, ...z: string[]) {} +>x : Symbol(x, Decl(newWithSpreadES5.ts, 13, 16)) +>y : Symbol(y, Decl(newWithSpreadES5.ts, 13, 26)) +>z : Symbol(z, Decl(newWithSpreadES5.ts, 13, 37)) +} + +interface C { +>C : Symbol(C, Decl(newWithSpreadES5.ts, 14, 1)) + + "a-b": typeof B; +>B : Symbol(B, Decl(newWithSpreadES5.ts, 10, 1)) +} + +interface D { +>D : Symbol(D, Decl(newWithSpreadES5.ts, 18, 1)) + + 1: typeof B; +>B : Symbol(B, Decl(newWithSpreadES5.ts, 10, 1)) +} + +var a: string[]; +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +var b: A; +>b : Symbol(b, Decl(newWithSpreadES5.ts, 25, 3)) +>A : Symbol(A, Decl(newWithSpreadES5.ts, 4, 30)) + +var c: C; +>c : Symbol(c, Decl(newWithSpreadES5.ts, 26, 3)) +>C : Symbol(C, Decl(newWithSpreadES5.ts, 14, 1)) + +var d: A[]; +>d : Symbol(d, Decl(newWithSpreadES5.ts, 27, 3)) +>A : Symbol(A, Decl(newWithSpreadES5.ts, 4, 30)) + +var e: { [key: string]: A }; +>e : Symbol(e, Decl(newWithSpreadES5.ts, 28, 3)) +>key : Symbol(key, Decl(newWithSpreadES5.ts, 28, 10)) +>A : Symbol(A, Decl(newWithSpreadES5.ts, 4, 30)) + +var g: C[]; +>g : Symbol(g, Decl(newWithSpreadES5.ts, 29, 3)) +>C : Symbol(C, Decl(newWithSpreadES5.ts, 14, 1)) + +var h: { [key: string]: C }; +>h : Symbol(h, Decl(newWithSpreadES5.ts, 30, 3)) +>key : Symbol(key, Decl(newWithSpreadES5.ts, 30, 10)) +>C : Symbol(C, Decl(newWithSpreadES5.ts, 14, 1)) + +var i: C[][]; +>i : Symbol(i, Decl(newWithSpreadES5.ts, 31, 3)) +>C : Symbol(C, Decl(newWithSpreadES5.ts, 14, 1)) + +// Basic expression +new f(1, 2, "string"); +>f : Symbol(f, Decl(newWithSpreadES5.ts, 0, 0)) + +new f(1, 2, ...a); +>f : Symbol(f, Decl(newWithSpreadES5.ts, 0, 0)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +new f(1, 2, ...a, "string"); +>f : Symbol(f, Decl(newWithSpreadES5.ts, 0, 0)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +// Multiple spreads arguments +new f2(...a, ...a); +>f2 : Symbol(f2, Decl(newWithSpreadES5.ts, 2, 1)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +new f(1 ,2, ...a, ...a); +>f : Symbol(f, Decl(newWithSpreadES5.ts, 0, 0)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +// Call expression +new f(1, 2, "string")(); +>f : Symbol(f, Decl(newWithSpreadES5.ts, 0, 0)) + +new f(1, 2, ...a)(); +>f : Symbol(f, Decl(newWithSpreadES5.ts, 0, 0)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +new f(1, 2, ...a, "string")(); +>f : Symbol(f, Decl(newWithSpreadES5.ts, 0, 0)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +// Property access expression +new b.f(1, 2, "string"); +>b.f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>b : Symbol(b, Decl(newWithSpreadES5.ts, 25, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) + +new b.f(1, 2, ...a); +>b.f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>b : Symbol(b, Decl(newWithSpreadES5.ts, 25, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +new b.f(1, 2, ...a, "string"); +>b.f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>b : Symbol(b, Decl(newWithSpreadES5.ts, 25, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +// Parenthesised expression +new (b.f)(1, 2, "string"); +>b.f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>b : Symbol(b, Decl(newWithSpreadES5.ts, 25, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) + +new (b.f)(1, 2, ...a); +>b.f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>b : Symbol(b, Decl(newWithSpreadES5.ts, 25, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +new (b.f)(1, 2, ...a, "string"); +>b.f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>b : Symbol(b, Decl(newWithSpreadES5.ts, 25, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +// Element access expression +new d[1].f(1, 2, "string"); +>d[1].f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>d : Symbol(d, Decl(newWithSpreadES5.ts, 27, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) + +new d[1].f(1, 2, ...a); +>d[1].f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>d : Symbol(d, Decl(newWithSpreadES5.ts, 27, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +new d[1].f(1, 2, ...a, "string"); +>d[1].f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>d : Symbol(d, Decl(newWithSpreadES5.ts, 27, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +// Element access expression with a punctuated key +new e["a-b"].f(1, 2, "string"); +>e["a-b"].f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>e : Symbol(e, Decl(newWithSpreadES5.ts, 28, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) + +new e["a-b"].f(1, 2, ...a); +>e["a-b"].f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>e : Symbol(e, Decl(newWithSpreadES5.ts, 28, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +new e["a-b"].f(1, 2, ...a, "string"); +>e["a-b"].f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>e : Symbol(e, Decl(newWithSpreadES5.ts, 28, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES5.ts, 6, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +// Basic expression +new B(1, 2, "string"); +>B : Symbol(B, Decl(newWithSpreadES5.ts, 10, 1)) + +new B(1, 2, ...a); +>B : Symbol(B, Decl(newWithSpreadES5.ts, 10, 1)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +new B(1, 2, ...a, "string"); +>B : Symbol(B, Decl(newWithSpreadES5.ts, 10, 1)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +// Property access expression +new c["a-b"](1, 2, "string"); +>c : Symbol(c, Decl(newWithSpreadES5.ts, 26, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) + +new c["a-b"](1, 2, ...a); +>c : Symbol(c, Decl(newWithSpreadES5.ts, 26, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +new c["a-b"](1, 2, ...a, "string"); +>c : Symbol(c, Decl(newWithSpreadES5.ts, 26, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +// Parenthesised expression +new (c["a-b"])(1, 2, "string"); +>c : Symbol(c, Decl(newWithSpreadES5.ts, 26, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) + +new (c["a-b"])(1, 2, ...a); +>c : Symbol(c, Decl(newWithSpreadES5.ts, 26, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +new (c["a-b"])(1, 2, ...a, "string"); +>c : Symbol(c, Decl(newWithSpreadES5.ts, 26, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +// Element access expression +new g[1]["a-b"](1, 2, "string"); +>g : Symbol(g, Decl(newWithSpreadES5.ts, 29, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) + +new g[1]["a-b"](1, 2, ...a); +>g : Symbol(g, Decl(newWithSpreadES5.ts, 29, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +new g[1]["a-b"](1, 2, ...a, "string"); +>g : Symbol(g, Decl(newWithSpreadES5.ts, 29, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +// Element access expression with a punctuated key +new h["a-b"]["a-b"](1, 2, "string"); +>h : Symbol(h, Decl(newWithSpreadES5.ts, 30, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) + +new h["a-b"]["a-b"](1, 2, ...a); +>h : Symbol(h, Decl(newWithSpreadES5.ts, 30, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +new h["a-b"]["a-b"](1, 2, ...a, "string"); +>h : Symbol(h, Decl(newWithSpreadES5.ts, 30, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES5.ts, 16, 13)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +// Element access expression with a number +new i["a-b"][1](1, 2, "string"); +>i : Symbol(i, Decl(newWithSpreadES5.ts, 31, 3)) + +new i["a-b"][1](1, 2, ...a); +>i : Symbol(i, Decl(newWithSpreadES5.ts, 31, 3)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + +new i["a-b"][1](1, 2, ...a, "string"); +>i : Symbol(i, Decl(newWithSpreadES5.ts, 31, 3)) +>a : Symbol(a, Decl(newWithSpreadES5.ts, 24, 3)) + diff --git a/tests/baselines/reference/newWithSpreadES5.types b/tests/baselines/reference/newWithSpreadES5.types new file mode 100644 index 00000000000..a2c83ed6372 --- /dev/null +++ b/tests/baselines/reference/newWithSpreadES5.types @@ -0,0 +1,494 @@ +=== tests/cases/conformance/expressions/functionCalls/newWithSpreadES5.ts === + +function f(x: number, y: number, ...z: string[]) { +>f : (x: number, y: number, ...z: string[]) => void +>x : number +>y : number +>z : string[] +} + +function f2(...x: string[]) {} +>f2 : (...x: string[]) => void +>x : string[] + +interface A { +>A : A + + f: { +>f : new (x: number, y: number, ...z: string[]) => any + + new (x: number, y: number, ...z: string[]); +>x : number +>y : number +>z : string[] + } +} + +class B { +>B : B + + constructor(x: number, y: number, ...z: string[]) {} +>x : number +>y : number +>z : string[] +} + +interface C { +>C : C + + "a-b": typeof B; +>B : typeof B +} + +interface D { +>D : D + + 1: typeof B; +>B : typeof B +} + +var a: string[]; +>a : string[] + +var b: A; +>b : A +>A : A + +var c: C; +>c : C +>C : C + +var d: A[]; +>d : A[] +>A : A + +var e: { [key: string]: A }; +>e : { [key: string]: A; } +>key : string +>A : A + +var g: C[]; +>g : C[] +>C : C + +var h: { [key: string]: C }; +>h : { [key: string]: C; } +>key : string +>C : C + +var i: C[][]; +>i : C[][] +>C : C + +// Basic expression +new f(1, 2, "string"); +>new f(1, 2, "string") : any +>f : (x: number, y: number, ...z: string[]) => void +>1 : number +>2 : number +>"string" : string + +new f(1, 2, ...a); +>new f(1, 2, ...a) : any +>f : (x: number, y: number, ...z: string[]) => void +>1 : number +>2 : number +>...a : string +>a : string[] + +new f(1, 2, ...a, "string"); +>new f(1, 2, ...a, "string") : any +>f : (x: number, y: number, ...z: string[]) => void +>1 : number +>2 : number +>...a : string +>a : string[] +>"string" : string + +// Multiple spreads arguments +new f2(...a, ...a); +>new f2(...a, ...a) : any +>f2 : (...x: string[]) => void +>...a : string +>a : string[] +>...a : string +>a : string[] + +new f(1 ,2, ...a, ...a); +>new f(1 ,2, ...a, ...a) : any +>f : (x: number, y: number, ...z: string[]) => void +>1 : number +>2 : number +>...a : string +>a : string[] +>...a : string +>a : string[] + +// Call expression +new f(1, 2, "string")(); +>new f(1, 2, "string")() : any +>new f(1, 2, "string") : any +>f : (x: number, y: number, ...z: string[]) => void +>1 : number +>2 : number +>"string" : string + +new f(1, 2, ...a)(); +>new f(1, 2, ...a)() : any +>new f(1, 2, ...a) : any +>f : (x: number, y: number, ...z: string[]) => void +>1 : number +>2 : number +>...a : string +>a : string[] + +new f(1, 2, ...a, "string")(); +>new f(1, 2, ...a, "string")() : any +>new f(1, 2, ...a, "string") : any +>f : (x: number, y: number, ...z: string[]) => void +>1 : number +>2 : number +>...a : string +>a : string[] +>"string" : string + +// Property access expression +new b.f(1, 2, "string"); +>new b.f(1, 2, "string") : any +>b.f : new (x: number, y: number, ...z: string[]) => any +>b : A +>f : new (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>"string" : string + +new b.f(1, 2, ...a); +>new b.f(1, 2, ...a) : any +>b.f : new (x: number, y: number, ...z: string[]) => any +>b : A +>f : new (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>...a : string +>a : string[] + +new b.f(1, 2, ...a, "string"); +>new b.f(1, 2, ...a, "string") : any +>b.f : new (x: number, y: number, ...z: string[]) => any +>b : A +>f : new (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>...a : string +>a : string[] +>"string" : string + +// Parenthesised expression +new (b.f)(1, 2, "string"); +>new (b.f)(1, 2, "string") : any +>(b.f) : new (x: number, y: number, ...z: string[]) => any +>b.f : new (x: number, y: number, ...z: string[]) => any +>b : A +>f : new (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>"string" : string + +new (b.f)(1, 2, ...a); +>new (b.f)(1, 2, ...a) : any +>(b.f) : new (x: number, y: number, ...z: string[]) => any +>b.f : new (x: number, y: number, ...z: string[]) => any +>b : A +>f : new (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>...a : string +>a : string[] + +new (b.f)(1, 2, ...a, "string"); +>new (b.f)(1, 2, ...a, "string") : any +>(b.f) : new (x: number, y: number, ...z: string[]) => any +>b.f : new (x: number, y: number, ...z: string[]) => any +>b : A +>f : new (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>...a : string +>a : string[] +>"string" : string + +// Element access expression +new d[1].f(1, 2, "string"); +>new d[1].f(1, 2, "string") : any +>d[1].f : new (x: number, y: number, ...z: string[]) => any +>d[1] : A +>d : A[] +>1 : number +>f : new (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>"string" : string + +new d[1].f(1, 2, ...a); +>new d[1].f(1, 2, ...a) : any +>d[1].f : new (x: number, y: number, ...z: string[]) => any +>d[1] : A +>d : A[] +>1 : number +>f : new (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>...a : string +>a : string[] + +new d[1].f(1, 2, ...a, "string"); +>new d[1].f(1, 2, ...a, "string") : any +>d[1].f : new (x: number, y: number, ...z: string[]) => any +>d[1] : A +>d : A[] +>1 : number +>f : new (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>...a : string +>a : string[] +>"string" : string + +// Element access expression with a punctuated key +new e["a-b"].f(1, 2, "string"); +>new e["a-b"].f(1, 2, "string") : any +>e["a-b"].f : new (x: number, y: number, ...z: string[]) => any +>e["a-b"] : A +>e : { [key: string]: A; } +>"a-b" : string +>f : new (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>"string" : string + +new e["a-b"].f(1, 2, ...a); +>new e["a-b"].f(1, 2, ...a) : any +>e["a-b"].f : new (x: number, y: number, ...z: string[]) => any +>e["a-b"] : A +>e : { [key: string]: A; } +>"a-b" : string +>f : new (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>...a : string +>a : string[] + +new e["a-b"].f(1, 2, ...a, "string"); +>new e["a-b"].f(1, 2, ...a, "string") : any +>e["a-b"].f : new (x: number, y: number, ...z: string[]) => any +>e["a-b"] : A +>e : { [key: string]: A; } +>"a-b" : string +>f : new (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>...a : string +>a : string[] +>"string" : string + +// Basic expression +new B(1, 2, "string"); +>new B(1, 2, "string") : B +>B : typeof B +>1 : number +>2 : number +>"string" : string + +new B(1, 2, ...a); +>new B(1, 2, ...a) : B +>B : typeof B +>1 : number +>2 : number +>...a : string +>a : string[] + +new B(1, 2, ...a, "string"); +>new B(1, 2, ...a, "string") : B +>B : typeof B +>1 : number +>2 : number +>...a : string +>a : string[] +>"string" : string + +// Property access expression +new c["a-b"](1, 2, "string"); +>new c["a-b"](1, 2, "string") : B +>c["a-b"] : typeof B +>c : C +>"a-b" : string +>1 : number +>2 : number +>"string" : string + +new c["a-b"](1, 2, ...a); +>new c["a-b"](1, 2, ...a) : B +>c["a-b"] : typeof B +>c : C +>"a-b" : string +>1 : number +>2 : number +>...a : string +>a : string[] + +new c["a-b"](1, 2, ...a, "string"); +>new c["a-b"](1, 2, ...a, "string") : B +>c["a-b"] : typeof B +>c : C +>"a-b" : string +>1 : number +>2 : number +>...a : string +>a : string[] +>"string" : string + +// Parenthesised expression +new (c["a-b"])(1, 2, "string"); +>new (c["a-b"])(1, 2, "string") : B +>(c["a-b"]) : typeof B +>c["a-b"] : typeof B +>c : C +>"a-b" : string +>1 : number +>2 : number +>"string" : string + +new (c["a-b"])(1, 2, ...a); +>new (c["a-b"])(1, 2, ...a) : B +>(c["a-b"]) : typeof B +>c["a-b"] : typeof B +>c : C +>"a-b" : string +>1 : number +>2 : number +>...a : string +>a : string[] + +new (c["a-b"])(1, 2, ...a, "string"); +>new (c["a-b"])(1, 2, ...a, "string") : B +>(c["a-b"]) : typeof B +>c["a-b"] : typeof B +>c : C +>"a-b" : string +>1 : number +>2 : number +>...a : string +>a : string[] +>"string" : string + +// Element access expression +new g[1]["a-b"](1, 2, "string"); +>new g[1]["a-b"](1, 2, "string") : B +>g[1]["a-b"] : typeof B +>g[1] : C +>g : C[] +>1 : number +>"a-b" : string +>1 : number +>2 : number +>"string" : string + +new g[1]["a-b"](1, 2, ...a); +>new g[1]["a-b"](1, 2, ...a) : B +>g[1]["a-b"] : typeof B +>g[1] : C +>g : C[] +>1 : number +>"a-b" : string +>1 : number +>2 : number +>...a : string +>a : string[] + +new g[1]["a-b"](1, 2, ...a, "string"); +>new g[1]["a-b"](1, 2, ...a, "string") : B +>g[1]["a-b"] : typeof B +>g[1] : C +>g : C[] +>1 : number +>"a-b" : string +>1 : number +>2 : number +>...a : string +>a : string[] +>"string" : string + +// Element access expression with a punctuated key +new h["a-b"]["a-b"](1, 2, "string"); +>new h["a-b"]["a-b"](1, 2, "string") : B +>h["a-b"]["a-b"] : typeof B +>h["a-b"] : C +>h : { [key: string]: C; } +>"a-b" : string +>"a-b" : string +>1 : number +>2 : number +>"string" : string + +new h["a-b"]["a-b"](1, 2, ...a); +>new h["a-b"]["a-b"](1, 2, ...a) : B +>h["a-b"]["a-b"] : typeof B +>h["a-b"] : C +>h : { [key: string]: C; } +>"a-b" : string +>"a-b" : string +>1 : number +>2 : number +>...a : string +>a : string[] + +new h["a-b"]["a-b"](1, 2, ...a, "string"); +>new h["a-b"]["a-b"](1, 2, ...a, "string") : B +>h["a-b"]["a-b"] : typeof B +>h["a-b"] : C +>h : { [key: string]: C; } +>"a-b" : string +>"a-b" : string +>1 : number +>2 : number +>...a : string +>a : string[] +>"string" : string + +// Element access expression with a number +new i["a-b"][1](1, 2, "string"); +>new i["a-b"][1](1, 2, "string") : any +>i["a-b"][1] : any +>i["a-b"] : any +>i : C[][] +>"a-b" : string +>1 : number +>1 : number +>2 : number +>"string" : string + +new i["a-b"][1](1, 2, ...a); +>new i["a-b"][1](1, 2, ...a) : any +>i["a-b"][1] : any +>i["a-b"] : any +>i : C[][] +>"a-b" : string +>1 : number +>1 : number +>2 : number +>...a : string +>a : string[] + +new i["a-b"][1](1, 2, ...a, "string"); +>new i["a-b"][1](1, 2, ...a, "string") : any +>i["a-b"][1] : any +>i["a-b"] : any +>i : C[][] +>"a-b" : string +>1 : number +>1 : number +>2 : number +>...a : string +>a : string[] +>"string" : string + diff --git a/tests/baselines/reference/newWithSpreadES6.js b/tests/baselines/reference/newWithSpreadES6.js new file mode 100644 index 00000000000..b712984f05e --- /dev/null +++ b/tests/baselines/reference/newWithSpreadES6.js @@ -0,0 +1,167 @@ +//// [newWithSpreadES6.ts] + +function f(x: number, y: number, ...z: string[]) { +} + +function f2(...x: string[]) { +} + +interface A { + f: { + new (x: number, y: number, ...z: string[]); + } +} + +class B { + constructor(x: number, y: number, ...z: string[]) {} +} + +interface C { + "a-b": typeof B; +} + +interface D { + 1: typeof B; +} + +var a: string[]; +var b: A; +var c: C; +var d: A[]; +var e: { [key: string]: A }; +var g: C[]; +var h: { [key: string]: C }; +var i: C[][]; + +// Basic expression +new f(1, 2, "string"); +new f(1, 2, ...a); +new f(1, 2, ...a, "string"); + +// Multiple spreads arguments +new f2(...a, ...a); +new f(1 ,2, ...a, ...a); + +// Call expression +new f(1, 2, "string")(); +new f(1, 2, ...a)(); +new f(1, 2, ...a, "string")(); + +// Property access expression +new b.f(1, 2, "string"); +new b.f(1, 2, ...a); +new b.f(1, 2, ...a, "string"); + +// Parenthesised expression +new (b.f)(1, 2, "string"); +new (b.f)(1, 2, ...a); +new (b.f)(1, 2, ...a, "string"); + +// Element access expression +new d[1].f(1, 2, "string"); +new d[1].f(1, 2, ...a); +new d[1].f(1, 2, ...a, "string"); + +// Element access expression with a punctuated key +new e["a-b"].f(1, 2, "string"); +new e["a-b"].f(1, 2, ...a); +new e["a-b"].f(1, 2, ...a, "string"); + +// Basic expression +new B(1, 2, "string"); +new B(1, 2, ...a); +new B(1, 2, ...a, "string"); + +// Property access expression +new c["a-b"](1, 2, "string"); +new c["a-b"](1, 2, ...a); +new c["a-b"](1, 2, ...a, "string"); + +// Parenthesised expression +new (c["a-b"])(1, 2, "string"); +new (c["a-b"])(1, 2, ...a); +new (c["a-b"])(1, 2, ...a, "string"); + +// Element access expression +new g[1]["a-b"](1, 2, "string"); +new g[1]["a-b"](1, 2, ...a); +new g[1]["a-b"](1, 2, ...a, "string"); + +// Element access expression with a punctuated key +new h["a-b"]["a-b"](1, 2, "string"); +new h["a-b"]["a-b"](1, 2, ...a); +new h["a-b"]["a-b"](1, 2, ...a, "string"); + +// Element access expression with a number +new i["a-b"][1](1, 2, "string"); +new i["a-b"][1](1, 2, ...a); +new i["a-b"][1](1, 2, ...a, "string"); + +//// [newWithSpreadES6.js] +function f(x, y, ...z) { +} +function f2(...x) { +} +class B { + constructor(x, y, ...z) { + } +} +var a; +var b; +var c; +var d; +var e; +var g; +var h; +var i; +// Basic expression +new f(1, 2, "string"); +new f(1, 2, ...a); +new f(1, 2, ...a, "string"); +// Multiple spreads arguments +new f2(...a, ...a); +new f(1, 2, ...a, ...a); +// Call expression +new f(1, 2, "string")(); +new f(1, 2, ...a)(); +new f(1, 2, ...a, "string")(); +// Property access expression +new b.f(1, 2, "string"); +new b.f(1, 2, ...a); +new b.f(1, 2, ...a, "string"); +// Parenthesised expression +new (b.f)(1, 2, "string"); +new (b.f)(1, 2, ...a); +new (b.f)(1, 2, ...a, "string"); +// Element access expression +new d[1].f(1, 2, "string"); +new d[1].f(1, 2, ...a); +new d[1].f(1, 2, ...a, "string"); +// Element access expression with a punctuated key +new e["a-b"].f(1, 2, "string"); +new e["a-b"].f(1, 2, ...a); +new e["a-b"].f(1, 2, ...a, "string"); +// Basic expression +new B(1, 2, "string"); +new B(1, 2, ...a); +new B(1, 2, ...a, "string"); +// Property access expression +new c["a-b"](1, 2, "string"); +new c["a-b"](1, 2, ...a); +new c["a-b"](1, 2, ...a, "string"); +// Parenthesised expression +new (c["a-b"])(1, 2, "string"); +new (c["a-b"])(1, 2, ...a); +new (c["a-b"])(1, 2, ...a, "string"); +// Element access expression +new g[1]["a-b"](1, 2, "string"); +new g[1]["a-b"](1, 2, ...a); +new g[1]["a-b"](1, 2, ...a, "string"); +// Element access expression with a punctuated key +new h["a-b"]["a-b"](1, 2, "string"); +new h["a-b"]["a-b"](1, 2, ...a); +new h["a-b"]["a-b"](1, 2, ...a, "string"); +// Element access expression with a number +new i["a-b"][1](1, 2, "string"); +new i["a-b"][1](1, 2, ...a); +new i["a-b"][1](1, 2, ...a, "string"); diff --git a/tests/baselines/reference/newWithSpreadES6.symbols b/tests/baselines/reference/newWithSpreadES6.symbols new file mode 100644 index 00000000000..51a34ad73ef --- /dev/null +++ b/tests/baselines/reference/newWithSpreadES6.symbols @@ -0,0 +1,274 @@ +=== tests/cases/conformance/expressions/functionCalls/newWithSpreadES6.ts === + +function f(x: number, y: number, ...z: string[]) { +>f : Symbol(f, Decl(newWithSpreadES6.ts, 0, 0)) +>x : Symbol(x, Decl(newWithSpreadES6.ts, 1, 11)) +>y : Symbol(y, Decl(newWithSpreadES6.ts, 1, 21)) +>z : Symbol(z, Decl(newWithSpreadES6.ts, 1, 32)) +} + +function f2(...x: string[]) { +>f2 : Symbol(f2, Decl(newWithSpreadES6.ts, 2, 1)) +>x : Symbol(x, Decl(newWithSpreadES6.ts, 4, 12)) +} + +interface A { +>A : Symbol(A, Decl(newWithSpreadES6.ts, 5, 1)) + + f: { +>f : Symbol(f, Decl(newWithSpreadES6.ts, 7, 13)) + + new (x: number, y: number, ...z: string[]); +>x : Symbol(x, Decl(newWithSpreadES6.ts, 9, 13)) +>y : Symbol(y, Decl(newWithSpreadES6.ts, 9, 23)) +>z : Symbol(z, Decl(newWithSpreadES6.ts, 9, 34)) + } +} + +class B { +>B : Symbol(B, Decl(newWithSpreadES6.ts, 11, 1)) + + constructor(x: number, y: number, ...z: string[]) {} +>x : Symbol(x, Decl(newWithSpreadES6.ts, 14, 16)) +>y : Symbol(y, Decl(newWithSpreadES6.ts, 14, 26)) +>z : Symbol(z, Decl(newWithSpreadES6.ts, 14, 37)) +} + +interface C { +>C : Symbol(C, Decl(newWithSpreadES6.ts, 15, 1)) + + "a-b": typeof B; +>B : Symbol(B, Decl(newWithSpreadES6.ts, 11, 1)) +} + +interface D { +>D : Symbol(D, Decl(newWithSpreadES6.ts, 19, 1)) + + 1: typeof B; +>B : Symbol(B, Decl(newWithSpreadES6.ts, 11, 1)) +} + +var a: string[]; +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +var b: A; +>b : Symbol(b, Decl(newWithSpreadES6.ts, 26, 3)) +>A : Symbol(A, Decl(newWithSpreadES6.ts, 5, 1)) + +var c: C; +>c : Symbol(c, Decl(newWithSpreadES6.ts, 27, 3)) +>C : Symbol(C, Decl(newWithSpreadES6.ts, 15, 1)) + +var d: A[]; +>d : Symbol(d, Decl(newWithSpreadES6.ts, 28, 3)) +>A : Symbol(A, Decl(newWithSpreadES6.ts, 5, 1)) + +var e: { [key: string]: A }; +>e : Symbol(e, Decl(newWithSpreadES6.ts, 29, 3)) +>key : Symbol(key, Decl(newWithSpreadES6.ts, 29, 10)) +>A : Symbol(A, Decl(newWithSpreadES6.ts, 5, 1)) + +var g: C[]; +>g : Symbol(g, Decl(newWithSpreadES6.ts, 30, 3)) +>C : Symbol(C, Decl(newWithSpreadES6.ts, 15, 1)) + +var h: { [key: string]: C }; +>h : Symbol(h, Decl(newWithSpreadES6.ts, 31, 3)) +>key : Symbol(key, Decl(newWithSpreadES6.ts, 31, 10)) +>C : Symbol(C, Decl(newWithSpreadES6.ts, 15, 1)) + +var i: C[][]; +>i : Symbol(i, Decl(newWithSpreadES6.ts, 32, 3)) +>C : Symbol(C, Decl(newWithSpreadES6.ts, 15, 1)) + +// Basic expression +new f(1, 2, "string"); +>f : Symbol(f, Decl(newWithSpreadES6.ts, 0, 0)) + +new f(1, 2, ...a); +>f : Symbol(f, Decl(newWithSpreadES6.ts, 0, 0)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +new f(1, 2, ...a, "string"); +>f : Symbol(f, Decl(newWithSpreadES6.ts, 0, 0)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +// Multiple spreads arguments +new f2(...a, ...a); +>f2 : Symbol(f2, Decl(newWithSpreadES6.ts, 2, 1)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +new f(1 ,2, ...a, ...a); +>f : Symbol(f, Decl(newWithSpreadES6.ts, 0, 0)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +// Call expression +new f(1, 2, "string")(); +>f : Symbol(f, Decl(newWithSpreadES6.ts, 0, 0)) + +new f(1, 2, ...a)(); +>f : Symbol(f, Decl(newWithSpreadES6.ts, 0, 0)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +new f(1, 2, ...a, "string")(); +>f : Symbol(f, Decl(newWithSpreadES6.ts, 0, 0)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +// Property access expression +new b.f(1, 2, "string"); +>b.f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>b : Symbol(b, Decl(newWithSpreadES6.ts, 26, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) + +new b.f(1, 2, ...a); +>b.f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>b : Symbol(b, Decl(newWithSpreadES6.ts, 26, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +new b.f(1, 2, ...a, "string"); +>b.f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>b : Symbol(b, Decl(newWithSpreadES6.ts, 26, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +// Parenthesised expression +new (b.f)(1, 2, "string"); +>b.f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>b : Symbol(b, Decl(newWithSpreadES6.ts, 26, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) + +new (b.f)(1, 2, ...a); +>b.f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>b : Symbol(b, Decl(newWithSpreadES6.ts, 26, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +new (b.f)(1, 2, ...a, "string"); +>b.f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>b : Symbol(b, Decl(newWithSpreadES6.ts, 26, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +// Element access expression +new d[1].f(1, 2, "string"); +>d[1].f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>d : Symbol(d, Decl(newWithSpreadES6.ts, 28, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) + +new d[1].f(1, 2, ...a); +>d[1].f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>d : Symbol(d, Decl(newWithSpreadES6.ts, 28, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +new d[1].f(1, 2, ...a, "string"); +>d[1].f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>d : Symbol(d, Decl(newWithSpreadES6.ts, 28, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +// Element access expression with a punctuated key +new e["a-b"].f(1, 2, "string"); +>e["a-b"].f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>e : Symbol(e, Decl(newWithSpreadES6.ts, 29, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) + +new e["a-b"].f(1, 2, ...a); +>e["a-b"].f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>e : Symbol(e, Decl(newWithSpreadES6.ts, 29, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +new e["a-b"].f(1, 2, ...a, "string"); +>e["a-b"].f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>e : Symbol(e, Decl(newWithSpreadES6.ts, 29, 3)) +>f : Symbol(A.f, Decl(newWithSpreadES6.ts, 7, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +// Basic expression +new B(1, 2, "string"); +>B : Symbol(B, Decl(newWithSpreadES6.ts, 11, 1)) + +new B(1, 2, ...a); +>B : Symbol(B, Decl(newWithSpreadES6.ts, 11, 1)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +new B(1, 2, ...a, "string"); +>B : Symbol(B, Decl(newWithSpreadES6.ts, 11, 1)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +// Property access expression +new c["a-b"](1, 2, "string"); +>c : Symbol(c, Decl(newWithSpreadES6.ts, 27, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) + +new c["a-b"](1, 2, ...a); +>c : Symbol(c, Decl(newWithSpreadES6.ts, 27, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +new c["a-b"](1, 2, ...a, "string"); +>c : Symbol(c, Decl(newWithSpreadES6.ts, 27, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +// Parenthesised expression +new (c["a-b"])(1, 2, "string"); +>c : Symbol(c, Decl(newWithSpreadES6.ts, 27, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) + +new (c["a-b"])(1, 2, ...a); +>c : Symbol(c, Decl(newWithSpreadES6.ts, 27, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +new (c["a-b"])(1, 2, ...a, "string"); +>c : Symbol(c, Decl(newWithSpreadES6.ts, 27, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +// Element access expression +new g[1]["a-b"](1, 2, "string"); +>g : Symbol(g, Decl(newWithSpreadES6.ts, 30, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) + +new g[1]["a-b"](1, 2, ...a); +>g : Symbol(g, Decl(newWithSpreadES6.ts, 30, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +new g[1]["a-b"](1, 2, ...a, "string"); +>g : Symbol(g, Decl(newWithSpreadES6.ts, 30, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +// Element access expression with a punctuated key +new h["a-b"]["a-b"](1, 2, "string"); +>h : Symbol(h, Decl(newWithSpreadES6.ts, 31, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) + +new h["a-b"]["a-b"](1, 2, ...a); +>h : Symbol(h, Decl(newWithSpreadES6.ts, 31, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +new h["a-b"]["a-b"](1, 2, ...a, "string"); +>h : Symbol(h, Decl(newWithSpreadES6.ts, 31, 3)) +>"a-b" : Symbol(C."a-b", Decl(newWithSpreadES6.ts, 17, 13)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +// Element access expression with a number +new i["a-b"][1](1, 2, "string"); +>i : Symbol(i, Decl(newWithSpreadES6.ts, 32, 3)) + +new i["a-b"][1](1, 2, ...a); +>i : Symbol(i, Decl(newWithSpreadES6.ts, 32, 3)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + +new i["a-b"][1](1, 2, ...a, "string"); +>i : Symbol(i, Decl(newWithSpreadES6.ts, 32, 3)) +>a : Symbol(a, Decl(newWithSpreadES6.ts, 25, 3)) + diff --git a/tests/baselines/reference/newWithSpreadES6.types b/tests/baselines/reference/newWithSpreadES6.types new file mode 100644 index 00000000000..52951729e3d --- /dev/null +++ b/tests/baselines/reference/newWithSpreadES6.types @@ -0,0 +1,495 @@ +=== tests/cases/conformance/expressions/functionCalls/newWithSpreadES6.ts === + +function f(x: number, y: number, ...z: string[]) { +>f : (x: number, y: number, ...z: string[]) => void +>x : number +>y : number +>z : string[] +} + +function f2(...x: string[]) { +>f2 : (...x: string[]) => void +>x : string[] +} + +interface A { +>A : A + + f: { +>f : new (x: number, y: number, ...z: string[]) => any + + new (x: number, y: number, ...z: string[]); +>x : number +>y : number +>z : string[] + } +} + +class B { +>B : B + + constructor(x: number, y: number, ...z: string[]) {} +>x : number +>y : number +>z : string[] +} + +interface C { +>C : C + + "a-b": typeof B; +>B : typeof B +} + +interface D { +>D : D + + 1: typeof B; +>B : typeof B +} + +var a: string[]; +>a : string[] + +var b: A; +>b : A +>A : A + +var c: C; +>c : C +>C : C + +var d: A[]; +>d : A[] +>A : A + +var e: { [key: string]: A }; +>e : { [key: string]: A; } +>key : string +>A : A + +var g: C[]; +>g : C[] +>C : C + +var h: { [key: string]: C }; +>h : { [key: string]: C; } +>key : string +>C : C + +var i: C[][]; +>i : C[][] +>C : C + +// Basic expression +new f(1, 2, "string"); +>new f(1, 2, "string") : any +>f : (x: number, y: number, ...z: string[]) => void +>1 : number +>2 : number +>"string" : string + +new f(1, 2, ...a); +>new f(1, 2, ...a) : any +>f : (x: number, y: number, ...z: string[]) => void +>1 : number +>2 : number +>...a : string +>a : string[] + +new f(1, 2, ...a, "string"); +>new f(1, 2, ...a, "string") : any +>f : (x: number, y: number, ...z: string[]) => void +>1 : number +>2 : number +>...a : string +>a : string[] +>"string" : string + +// Multiple spreads arguments +new f2(...a, ...a); +>new f2(...a, ...a) : any +>f2 : (...x: string[]) => void +>...a : string +>a : string[] +>...a : string +>a : string[] + +new f(1 ,2, ...a, ...a); +>new f(1 ,2, ...a, ...a) : any +>f : (x: number, y: number, ...z: string[]) => void +>1 : number +>2 : number +>...a : string +>a : string[] +>...a : string +>a : string[] + +// Call expression +new f(1, 2, "string")(); +>new f(1, 2, "string")() : any +>new f(1, 2, "string") : any +>f : (x: number, y: number, ...z: string[]) => void +>1 : number +>2 : number +>"string" : string + +new f(1, 2, ...a)(); +>new f(1, 2, ...a)() : any +>new f(1, 2, ...a) : any +>f : (x: number, y: number, ...z: string[]) => void +>1 : number +>2 : number +>...a : string +>a : string[] + +new f(1, 2, ...a, "string")(); +>new f(1, 2, ...a, "string")() : any +>new f(1, 2, ...a, "string") : any +>f : (x: number, y: number, ...z: string[]) => void +>1 : number +>2 : number +>...a : string +>a : string[] +>"string" : string + +// Property access expression +new b.f(1, 2, "string"); +>new b.f(1, 2, "string") : any +>b.f : new (x: number, y: number, ...z: string[]) => any +>b : A +>f : new (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>"string" : string + +new b.f(1, 2, ...a); +>new b.f(1, 2, ...a) : any +>b.f : new (x: number, y: number, ...z: string[]) => any +>b : A +>f : new (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>...a : string +>a : string[] + +new b.f(1, 2, ...a, "string"); +>new b.f(1, 2, ...a, "string") : any +>b.f : new (x: number, y: number, ...z: string[]) => any +>b : A +>f : new (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>...a : string +>a : string[] +>"string" : string + +// Parenthesised expression +new (b.f)(1, 2, "string"); +>new (b.f)(1, 2, "string") : any +>(b.f) : new (x: number, y: number, ...z: string[]) => any +>b.f : new (x: number, y: number, ...z: string[]) => any +>b : A +>f : new (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>"string" : string + +new (b.f)(1, 2, ...a); +>new (b.f)(1, 2, ...a) : any +>(b.f) : new (x: number, y: number, ...z: string[]) => any +>b.f : new (x: number, y: number, ...z: string[]) => any +>b : A +>f : new (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>...a : string +>a : string[] + +new (b.f)(1, 2, ...a, "string"); +>new (b.f)(1, 2, ...a, "string") : any +>(b.f) : new (x: number, y: number, ...z: string[]) => any +>b.f : new (x: number, y: number, ...z: string[]) => any +>b : A +>f : new (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>...a : string +>a : string[] +>"string" : string + +// Element access expression +new d[1].f(1, 2, "string"); +>new d[1].f(1, 2, "string") : any +>d[1].f : new (x: number, y: number, ...z: string[]) => any +>d[1] : A +>d : A[] +>1 : number +>f : new (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>"string" : string + +new d[1].f(1, 2, ...a); +>new d[1].f(1, 2, ...a) : any +>d[1].f : new (x: number, y: number, ...z: string[]) => any +>d[1] : A +>d : A[] +>1 : number +>f : new (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>...a : string +>a : string[] + +new d[1].f(1, 2, ...a, "string"); +>new d[1].f(1, 2, ...a, "string") : any +>d[1].f : new (x: number, y: number, ...z: string[]) => any +>d[1] : A +>d : A[] +>1 : number +>f : new (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>...a : string +>a : string[] +>"string" : string + +// Element access expression with a punctuated key +new e["a-b"].f(1, 2, "string"); +>new e["a-b"].f(1, 2, "string") : any +>e["a-b"].f : new (x: number, y: number, ...z: string[]) => any +>e["a-b"] : A +>e : { [key: string]: A; } +>"a-b" : string +>f : new (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>"string" : string + +new e["a-b"].f(1, 2, ...a); +>new e["a-b"].f(1, 2, ...a) : any +>e["a-b"].f : new (x: number, y: number, ...z: string[]) => any +>e["a-b"] : A +>e : { [key: string]: A; } +>"a-b" : string +>f : new (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>...a : string +>a : string[] + +new e["a-b"].f(1, 2, ...a, "string"); +>new e["a-b"].f(1, 2, ...a, "string") : any +>e["a-b"].f : new (x: number, y: number, ...z: string[]) => any +>e["a-b"] : A +>e : { [key: string]: A; } +>"a-b" : string +>f : new (x: number, y: number, ...z: string[]) => any +>1 : number +>2 : number +>...a : string +>a : string[] +>"string" : string + +// Basic expression +new B(1, 2, "string"); +>new B(1, 2, "string") : B +>B : typeof B +>1 : number +>2 : number +>"string" : string + +new B(1, 2, ...a); +>new B(1, 2, ...a) : B +>B : typeof B +>1 : number +>2 : number +>...a : string +>a : string[] + +new B(1, 2, ...a, "string"); +>new B(1, 2, ...a, "string") : B +>B : typeof B +>1 : number +>2 : number +>...a : string +>a : string[] +>"string" : string + +// Property access expression +new c["a-b"](1, 2, "string"); +>new c["a-b"](1, 2, "string") : B +>c["a-b"] : typeof B +>c : C +>"a-b" : string +>1 : number +>2 : number +>"string" : string + +new c["a-b"](1, 2, ...a); +>new c["a-b"](1, 2, ...a) : B +>c["a-b"] : typeof B +>c : C +>"a-b" : string +>1 : number +>2 : number +>...a : string +>a : string[] + +new c["a-b"](1, 2, ...a, "string"); +>new c["a-b"](1, 2, ...a, "string") : B +>c["a-b"] : typeof B +>c : C +>"a-b" : string +>1 : number +>2 : number +>...a : string +>a : string[] +>"string" : string + +// Parenthesised expression +new (c["a-b"])(1, 2, "string"); +>new (c["a-b"])(1, 2, "string") : B +>(c["a-b"]) : typeof B +>c["a-b"] : typeof B +>c : C +>"a-b" : string +>1 : number +>2 : number +>"string" : string + +new (c["a-b"])(1, 2, ...a); +>new (c["a-b"])(1, 2, ...a) : B +>(c["a-b"]) : typeof B +>c["a-b"] : typeof B +>c : C +>"a-b" : string +>1 : number +>2 : number +>...a : string +>a : string[] + +new (c["a-b"])(1, 2, ...a, "string"); +>new (c["a-b"])(1, 2, ...a, "string") : B +>(c["a-b"]) : typeof B +>c["a-b"] : typeof B +>c : C +>"a-b" : string +>1 : number +>2 : number +>...a : string +>a : string[] +>"string" : string + +// Element access expression +new g[1]["a-b"](1, 2, "string"); +>new g[1]["a-b"](1, 2, "string") : B +>g[1]["a-b"] : typeof B +>g[1] : C +>g : C[] +>1 : number +>"a-b" : string +>1 : number +>2 : number +>"string" : string + +new g[1]["a-b"](1, 2, ...a); +>new g[1]["a-b"](1, 2, ...a) : B +>g[1]["a-b"] : typeof B +>g[1] : C +>g : C[] +>1 : number +>"a-b" : string +>1 : number +>2 : number +>...a : string +>a : string[] + +new g[1]["a-b"](1, 2, ...a, "string"); +>new g[1]["a-b"](1, 2, ...a, "string") : B +>g[1]["a-b"] : typeof B +>g[1] : C +>g : C[] +>1 : number +>"a-b" : string +>1 : number +>2 : number +>...a : string +>a : string[] +>"string" : string + +// Element access expression with a punctuated key +new h["a-b"]["a-b"](1, 2, "string"); +>new h["a-b"]["a-b"](1, 2, "string") : B +>h["a-b"]["a-b"] : typeof B +>h["a-b"] : C +>h : { [key: string]: C; } +>"a-b" : string +>"a-b" : string +>1 : number +>2 : number +>"string" : string + +new h["a-b"]["a-b"](1, 2, ...a); +>new h["a-b"]["a-b"](1, 2, ...a) : B +>h["a-b"]["a-b"] : typeof B +>h["a-b"] : C +>h : { [key: string]: C; } +>"a-b" : string +>"a-b" : string +>1 : number +>2 : number +>...a : string +>a : string[] + +new h["a-b"]["a-b"](1, 2, ...a, "string"); +>new h["a-b"]["a-b"](1, 2, ...a, "string") : B +>h["a-b"]["a-b"] : typeof B +>h["a-b"] : C +>h : { [key: string]: C; } +>"a-b" : string +>"a-b" : string +>1 : number +>2 : number +>...a : string +>a : string[] +>"string" : string + +// Element access expression with a number +new i["a-b"][1](1, 2, "string"); +>new i["a-b"][1](1, 2, "string") : any +>i["a-b"][1] : any +>i["a-b"] : any +>i : C[][] +>"a-b" : string +>1 : number +>1 : number +>2 : number +>"string" : string + +new i["a-b"][1](1, 2, ...a); +>new i["a-b"][1](1, 2, ...a) : any +>i["a-b"][1] : any +>i["a-b"] : any +>i : C[][] +>"a-b" : string +>1 : number +>1 : number +>2 : number +>...a : string +>a : string[] + +new i["a-b"][1](1, 2, ...a, "string"); +>new i["a-b"][1](1, 2, ...a, "string") : any +>i["a-b"][1] : any +>i["a-b"] : any +>i : C[][] +>"a-b" : string +>1 : number +>1 : number +>2 : number +>...a : string +>a : string[] +>"string" : string + diff --git a/tests/baselines/reference/nonExportedElementsOfMergedModules.js b/tests/baselines/reference/nonExportedElementsOfMergedModules.js index 25efa8a7ec4..e46bf62c05f 100644 --- a/tests/baselines/reference/nonExportedElementsOfMergedModules.js +++ b/tests/baselines/reference/nonExportedElementsOfMergedModules.js @@ -25,7 +25,6 @@ var One; })(A || (A = {})); var B; (function (B) { - B.x; })(B || (B = {})); })(One || (One = {})); var One; @@ -36,7 +35,6 @@ var One; })(A || (A = {})); var B; (function (B) { - B.y; })(B || (B = {})); B.x; B.y; diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesErrorWithModule.js b/tests/baselines/reference/objectLiteralShorthandPropertiesErrorWithModule.js index 010afbc4b9e..65ba94f86a3 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesErrorWithModule.js +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesErrorWithModule.js @@ -20,7 +20,6 @@ m.y.x; var x = "Foo"; var m; (function (m) { - m.x; })(m || (m = {})); var n; (function (n) { diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesWithModule.js b/tests/baselines/reference/objectLiteralShorthandPropertiesWithModule.js index e2eb1fc128c..83dd0210a4c 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesWithModule.js +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesWithModule.js @@ -18,7 +18,6 @@ module m { // module export var m; (function (m) { - m.x; })(m || (m = {})); var m; (function (m) { diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesWithModuleES6.js b/tests/baselines/reference/objectLiteralShorthandPropertiesWithModuleES6.js index edb4e6c2953..7a5aaa34242 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesWithModuleES6.js +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesWithModuleES6.js @@ -16,7 +16,6 @@ module m { //// [objectLiteralShorthandPropertiesWithModuleES6.js] var m; (function (m) { - m.x; })(m || (m = {})); var m; (function (m) { diff --git a/tests/baselines/reference/parserInterfaceDeclaration5.errors.txt b/tests/baselines/reference/parserInterfaceDeclaration5.errors.txt deleted file mode 100644 index 2b7ea65e95b..00000000000 --- a/tests/baselines/reference/parserInterfaceDeclaration5.errors.txt +++ /dev/null @@ -1,8 +0,0 @@ -tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration5.ts(1,1): error TS1045: A 'declare' modifier cannot be used with an interface declaration. - - -==== tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration5.ts (1 errors) ==== - declare interface I { - ~~~~~~~ -!!! error TS1045: A 'declare' modifier cannot be used with an interface declaration. - } \ No newline at end of file diff --git a/tests/baselines/reference/parserInterfaceDeclaration5.symbols b/tests/baselines/reference/parserInterfaceDeclaration5.symbols new file mode 100644 index 00000000000..f9b738347ca --- /dev/null +++ b/tests/baselines/reference/parserInterfaceDeclaration5.symbols @@ -0,0 +1,4 @@ +=== tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration5.ts === +declare interface I { +>I : Symbol(I, Decl(parserInterfaceDeclaration5.ts, 0, 0)) +} diff --git a/tests/baselines/reference/parserInterfaceDeclaration5.types b/tests/baselines/reference/parserInterfaceDeclaration5.types new file mode 100644 index 00000000000..c89559fc5c7 --- /dev/null +++ b/tests/baselines/reference/parserInterfaceDeclaration5.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration5.ts === +declare interface I { +>I : I +} diff --git a/tests/baselines/reference/parserharness.js b/tests/baselines/reference/parserharness.js index d74e81fad27..4e22c804ab6 100644 --- a/tests/baselines/reference/parserharness.js +++ b/tests/baselines/reference/parserharness.js @@ -2503,8 +2503,6 @@ var Harness; (function (Perf) { var Clock; (function (Clock) { - Clock.now; - Clock.resolution; if (typeof WScript !== "undefined" && typeof global['WScript'].InitializeProjection !== "undefined") { // Running in JSHost. global['WScript'].InitializeProjection(); diff --git a/tests/baselines/reference/plusOperatorWithAnyOtherType.js b/tests/baselines/reference/plusOperatorWithAnyOtherType.js index 33ac4ebb144..0356bad198e 100644 --- a/tests/baselines/reference/plusOperatorWithAnyOtherType.js +++ b/tests/baselines/reference/plusOperatorWithAnyOtherType.js @@ -78,7 +78,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // any other type var diff --git a/tests/baselines/reference/plusOperatorWithBooleanType.js b/tests/baselines/reference/plusOperatorWithBooleanType.js index 5af1a8fb903..d48066707aa 100644 --- a/tests/baselines/reference/plusOperatorWithBooleanType.js +++ b/tests/baselines/reference/plusOperatorWithBooleanType.js @@ -47,7 +47,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // boolean type var diff --git a/tests/baselines/reference/plusOperatorWithNumberType.js b/tests/baselines/reference/plusOperatorWithNumberType.js index a0adaa5dec2..8da631aa7a8 100644 --- a/tests/baselines/reference/plusOperatorWithNumberType.js +++ b/tests/baselines/reference/plusOperatorWithNumberType.js @@ -54,7 +54,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // number type var diff --git a/tests/baselines/reference/plusOperatorWithStringType.js b/tests/baselines/reference/plusOperatorWithStringType.js index ed2c60111b3..dbe7e23a3d6 100644 --- a/tests/baselines/reference/plusOperatorWithStringType.js +++ b/tests/baselines/reference/plusOperatorWithStringType.js @@ -53,7 +53,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // string type var diff --git a/tests/baselines/reference/privacyCheckTypeOfFunction.js b/tests/baselines/reference/privacyCheckTypeOfFunction.js index 757416c691b..b29a21b98b5 100644 --- a/tests/baselines/reference/privacyCheckTypeOfFunction.js +++ b/tests/baselines/reference/privacyCheckTypeOfFunction.js @@ -8,5 +8,4 @@ export var b = foo; //// [privacyCheckTypeOfFunction.js] function foo() { } -exports.x; exports.b = foo; diff --git a/tests/baselines/reference/privacyCheckTypeOfInvisibleModuleError.js b/tests/baselines/reference/privacyCheckTypeOfInvisibleModuleError.js index 80941509d4f..e2ee218de06 100644 --- a/tests/baselines/reference/privacyCheckTypeOfInvisibleModuleError.js +++ b/tests/baselines/reference/privacyCheckTypeOfInvisibleModuleError.js @@ -13,7 +13,5 @@ var Outer; (function (Outer) { var Inner; (function (Inner) { - Inner.m; })(Inner || (Inner = {})); - Outer.f; })(Outer || (Outer = {})); diff --git a/tests/baselines/reference/privacyCheckTypeOfInvisibleModuleNoError.js b/tests/baselines/reference/privacyCheckTypeOfInvisibleModuleNoError.js index 832c7d2e50d..6dd486e87d2 100644 --- a/tests/baselines/reference/privacyCheckTypeOfInvisibleModuleNoError.js +++ b/tests/baselines/reference/privacyCheckTypeOfInvisibleModuleNoError.js @@ -13,7 +13,5 @@ var Outer; (function (Outer) { var Inner; (function (Inner) { - Inner.m; })(Inner || (Inner = {})); - Outer.f; // Since we dont unwind inner any more, it is error here })(Outer || (Outer = {})); diff --git a/tests/baselines/reference/privacyGloImport.js b/tests/baselines/reference/privacyGloImport.js index 9f29e383786..7f832ef75fe 100644 --- a/tests/baselines/reference/privacyGloImport.js +++ b/tests/baselines/reference/privacyGloImport.js @@ -168,7 +168,6 @@ var m1; } m1_M1_public.f1 = f1; m1_M1_public.v1 = c1; - m1_M1_public.v2; })(m1_M1_public = m1.m1_M1_public || (m1.m1_M1_public = {})); var m1_M2_private; (function (m1_M2_private) { @@ -183,7 +182,6 @@ var m1; } m1_M2_private.f1 = f1; m1_M2_private.v1 = c1; - m1_M2_private.v2; })(m1_M2_private || (m1_M2_private = {})); //export declare module "m1_M3_public" { // export function f1(); @@ -251,7 +249,6 @@ var glo_M1_public; } glo_M1_public.f1 = f1; glo_M1_public.v1 = c1; - glo_M1_public.v2; })(glo_M1_public || (glo_M1_public = {})); var m2; (function (m2) { diff --git a/tests/baselines/reference/privacyGloImportParseErrors.js b/tests/baselines/reference/privacyGloImportParseErrors.js index d5a089a7678..f99fdaca8cc 100644 --- a/tests/baselines/reference/privacyGloImportParseErrors.js +++ b/tests/baselines/reference/privacyGloImportParseErrors.js @@ -168,7 +168,6 @@ var m1; } m1_M1_public.f1 = f1; m1_M1_public.v1 = c1; - m1_M1_public.v2; })(m1_M1_public = m1.m1_M1_public || (m1.m1_M1_public = {})); var m1_M2_private; (function (m1_M2_private) { @@ -183,7 +182,6 @@ var m1; } m1_M2_private.f1 = f1; m1_M2_private.v1 = c1; - m1_M2_private.v2; })(m1_M2_private || (m1_M2_private = {})); var m1_im1_private = m1_M1_public; m1.m1_im1_private_v1_public = m1_im1_private.c1; @@ -235,7 +233,6 @@ var glo_M1_public; } glo_M1_public.f1 = f1; glo_M1_public.v1 = c1; - glo_M1_public.v2; })(glo_M1_public || (glo_M1_public = {})); var m2; (function (m2_1) { diff --git a/tests/baselines/reference/privacyGloVar.js b/tests/baselines/reference/privacyGloVar.js index edfefc1fdb1..e4bda49698f 100644 --- a/tests/baselines/reference/privacyGloVar.js +++ b/tests/baselines/reference/privacyGloVar.js @@ -124,9 +124,7 @@ var m1; return C4_public; })(); var m1_v1_private; - m1.m1_v2_public; var m1_v3_private; - m1.m1_v4_public; // error var m1_v11_private = new C1_public(); m1.m1_v12_public = new C1_public(); var m1_v13_private = new C2_private(); diff --git a/tests/baselines/reference/privacyImport.js b/tests/baselines/reference/privacyImport.js index fb200cac363..02ee47341c4 100644 --- a/tests/baselines/reference/privacyImport.js +++ b/tests/baselines/reference/privacyImport.js @@ -372,7 +372,6 @@ var m1; } m1_M1_public.f1 = f1; m1_M1_public.v1 = c1; - m1_M1_public.v2; })(m1_M1_public = m1.m1_M1_public || (m1.m1_M1_public = {})); var m1_M2_private; (function (m1_M2_private) { @@ -387,7 +386,6 @@ var m1; } m1_M2_private.f1 = f1; m1_M2_private.v1 = c1; - m1_M2_private.v2; })(m1_M2_private || (m1_M2_private = {})); //export declare module "m1_M3_public" { // export function f1(); @@ -457,7 +455,6 @@ var m2; } m2_M1_public.f1 = f1; m2_M1_public.v1 = c1; - m2_M1_public.v2; })(m2_M1_public = m2.m2_M1_public || (m2.m2_M1_public = {})); var m2_M2_private; (function (m2_M2_private) { @@ -472,7 +469,6 @@ var m2; } m2_M2_private.f1 = f1; m2_M2_private.v1 = c1; - m2_M2_private.v2; })(m2_M2_private || (m2_M2_private = {})); //export declare module "m2_M3_public" { // export function f1(); @@ -541,7 +537,6 @@ var glo_M1_public; } glo_M1_public.f1 = f1; glo_M1_public.v1 = c1; - glo_M1_public.v2; })(glo_M1_public = exports.glo_M1_public || (exports.glo_M1_public = {})); //export declare module "glo_M2_public" { // export function f1(); @@ -563,7 +558,6 @@ var glo_M3_private; } glo_M3_private.f1 = f1; glo_M3_private.v1 = c1; - glo_M3_private.v2; })(glo_M3_private = exports.glo_M3_private || (exports.glo_M3_private = {})); //export declare module "glo_M4_private" { // export function f1(); diff --git a/tests/baselines/reference/privacyImportParseErrors.js b/tests/baselines/reference/privacyImportParseErrors.js index 90e4a7cb097..71f20286f90 100644 --- a/tests/baselines/reference/privacyImportParseErrors.js +++ b/tests/baselines/reference/privacyImportParseErrors.js @@ -372,7 +372,6 @@ var m1; } m1_M1_public.f1 = f1; m1_M1_public.v1 = c1; - m1_M1_public.v2; })(m1_M1_public = m1.m1_M1_public || (m1.m1_M1_public = {})); var m1_M2_private; (function (m1_M2_private) { @@ -387,7 +386,6 @@ var m1; } m1_M2_private.f1 = f1; m1_M2_private.v1 = c1; - m1_M2_private.v2; })(m1_M2_private || (m1_M2_private = {})); var m1_im1_private = m1_M1_public; m1.m1_im1_private_v1_public = m1_im1_private.c1; @@ -441,7 +439,6 @@ var m2; } m2_M1_public.f1 = f1; m2_M1_public.v1 = c1; - m2_M1_public.v2; })(m2_M1_public = m2.m2_M1_public || (m2.m2_M1_public = {})); var m2_M2_private; (function (m2_M2_private) { @@ -456,7 +453,6 @@ var m2; } m2_M2_private.f1 = f1; m2_M2_private.v1 = c1; - m2_M2_private.v2; })(m2_M2_private || (m2_M2_private = {})); var m1_im1_private = m2_M1_public; m2.m1_im1_private_v1_public = m1_im1_private.c1; @@ -509,7 +505,6 @@ var glo_M1_public; } glo_M1_public.f1 = f1; glo_M1_public.v1 = c1; - glo_M1_public.v2; })(glo_M1_public = exports.glo_M1_public || (exports.glo_M1_public = {})); var glo_M3_private; (function (glo_M3_private) { @@ -524,7 +519,6 @@ var glo_M3_private; } glo_M3_private.f1 = f1; glo_M3_private.v1 = c1; - glo_M3_private.v2; })(glo_M3_private = exports.glo_M3_private || (exports.glo_M3_private = {})); var glo_im1_private = glo_M1_public; exports.glo_im1_private_v1_public = glo_im1_private.c1; diff --git a/tests/baselines/reference/privacyLocalInternalReferenceImportWithExport.js b/tests/baselines/reference/privacyLocalInternalReferenceImportWithExport.js index 9093787a6fc..20881230156 100644 --- a/tests/baselines/reference/privacyLocalInternalReferenceImportWithExport.js +++ b/tests/baselines/reference/privacyLocalInternalReferenceImportWithExport.js @@ -229,11 +229,9 @@ var import_public; var privateUse_im_public_v_private = import_public.im_public_v_private; import_public.publicUse_im_public_v_private = import_public.im_public_v_private; var privateUse_im_public_i_private; - import_public.publicUse_im_public_i_private; var privateUse_im_public_mi_private = new import_public.im_public_mi_private.c(); import_public.publicUse_im_public_mi_private = new import_public.im_public_mi_private.c(); var privateUse_im_public_mu_private; - import_public.publicUse_im_public_mu_private; // No Privacy errors - importing public elements import_public.im_public_c_public = m_public.c_public; import_public.im_public_e_public = m_public.e_public; @@ -250,11 +248,9 @@ var import_public; var privateUse_im_public_v_public = import_public.im_public_v_public; import_public.publicUse_im_public_v_public = import_public.im_public_v_public; var privateUse_im_public_i_public; - import_public.publicUse_im_public_i_public; var privateUse_im_public_mi_public = new import_public.im_public_mi_public.c(); import_public.publicUse_im_public_mi_public = new import_public.im_public_mi_public.c(); var privateUse_im_public_mu_public; - import_public.publicUse_im_public_mu_public; })(import_public = exports.import_public || (exports.import_public = {})); var import_private; (function (import_private) { @@ -274,11 +270,9 @@ var import_private; var privateUse_im_private_v_private = import_private.im_private_v_private; import_private.publicUse_im_private_v_private = import_private.im_private_v_private; var privateUse_im_private_i_private; - import_private.publicUse_im_private_i_private; var privateUse_im_private_mi_private = new import_private.im_private_mi_private.c(); import_private.publicUse_im_private_mi_private = new import_private.im_private_mi_private.c(); var privateUse_im_private_mu_private; - import_private.publicUse_im_private_mu_private; // No privacy Error - importing public elements import_private.im_private_c_public = m_public.c_public; import_private.im_private_e_public = m_public.e_public; @@ -295,9 +289,7 @@ var import_private; var privateUse_im_private_v_public = import_private.im_private_v_public; import_private.publicUse_im_private_v_public = import_private.im_private_v_public; var privateUse_im_private_i_public; - import_private.publicUse_im_private_i_public; var privateUse_im_private_mi_public = new import_private.im_private_mi_public.c(); import_private.publicUse_im_private_mi_public = new import_private.im_private_mi_public.c(); var privateUse_im_private_mu_public; - import_private.publicUse_im_private_mu_public; })(import_private || (import_private = {})); diff --git a/tests/baselines/reference/privacyLocalInternalReferenceImportWithoutExport.js b/tests/baselines/reference/privacyLocalInternalReferenceImportWithoutExport.js index f3b8da0de82..65565d3a5de 100644 --- a/tests/baselines/reference/privacyLocalInternalReferenceImportWithoutExport.js +++ b/tests/baselines/reference/privacyLocalInternalReferenceImportWithoutExport.js @@ -230,11 +230,9 @@ define(["require", "exports"], function (require, exports) { var privateUse_im_private_v_private = im_private_v_private; import_public.publicUse_im_private_v_private = im_private_v_private; var privateUse_im_private_i_private; - import_public.publicUse_im_private_i_private; var privateUse_im_private_mi_private = new im_private_mi_private.c(); import_public.publicUse_im_private_mi_private = new im_private_mi_private.c(); var privateUse_im_private_mu_private; - import_public.publicUse_im_private_mu_private; // No Privacy errors - importing public elements var im_private_c_public = m_public.c_public; var im_private_e_public = m_public.e_public; @@ -251,11 +249,9 @@ define(["require", "exports"], function (require, exports) { var privateUse_im_private_v_public = im_private_v_public; import_public.publicUse_im_private_v_public = im_private_v_public; var privateUse_im_private_i_public; - import_public.publicUse_im_private_i_public; var privateUse_im_private_mi_public = new im_private_mi_public.c(); import_public.publicUse_im_private_mi_public = new im_private_mi_public.c(); var privateUse_im_private_mu_public; - import_public.publicUse_im_private_mu_public; })(import_public = exports.import_public || (exports.import_public = {})); var import_private; (function (import_private) { @@ -275,11 +271,9 @@ define(["require", "exports"], function (require, exports) { var privateUse_im_private_v_private = im_private_v_private; import_private.publicUse_im_private_v_private = im_private_v_private; var privateUse_im_private_i_private; - import_private.publicUse_im_private_i_private; var privateUse_im_private_mi_private = new im_private_mi_private.c(); import_private.publicUse_im_private_mi_private = new im_private_mi_private.c(); var privateUse_im_private_mu_private; - import_private.publicUse_im_private_mu_private; // No privacy Error - importing public elements var im_private_c_public = m_public.c_public; var im_private_e_public = m_public.e_public; @@ -296,10 +290,8 @@ define(["require", "exports"], function (require, exports) { var privateUse_im_private_v_public = im_private_v_public; import_private.publicUse_im_private_v_public = im_private_v_public; var privateUse_im_private_i_public; - import_private.publicUse_im_private_i_public; var privateUse_im_private_mi_public = new im_private_mi_public.c(); import_private.publicUse_im_private_mi_public = new im_private_mi_public.c(); var privateUse_im_private_mu_public; - import_private.publicUse_im_private_mu_public; })(import_private || (import_private = {})); }); diff --git a/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithExport.js b/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithExport.js index e73e398d437..ec2d039df01 100644 --- a/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithExport.js +++ b/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithExport.js @@ -175,11 +175,9 @@ define(["require", "exports"], function (require, exports) { var privateUse_im_public_v_private = exports.im_public_v_private; exports.publicUse_im_public_v_private = exports.im_public_v_private; var privateUse_im_public_i_private; - exports.publicUse_im_public_i_private; var privateUse_im_public_mi_private = new exports.im_public_mi_private.c(); exports.publicUse_im_public_mi_private = new exports.im_public_mi_private.c(); var privateUse_im_public_mu_private; - exports.publicUse_im_public_mu_private; // No Privacy errors - importing public elements exports.im_public_c_public = m_public.c_public; exports.im_public_e_public = m_public.e_public; @@ -196,9 +194,7 @@ define(["require", "exports"], function (require, exports) { var privateUse_im_public_v_public = exports.im_public_v_public; exports.publicUse_im_public_v_public = exports.im_public_v_public; var privateUse_im_public_i_public; - exports.publicUse_im_public_i_public; var privateUse_im_public_mi_public = new exports.im_public_mi_public.c(); exports.publicUse_im_public_mi_public = new exports.im_public_mi_public.c(); var privateUse_im_public_mu_public; - exports.publicUse_im_public_mu_public; }); diff --git a/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithoutExport.js b/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithoutExport.js index 11cd8c260b7..a0eb39985b4 100644 --- a/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithoutExport.js +++ b/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithoutExport.js @@ -176,11 +176,9 @@ define(["require", "exports"], function (require, exports) { var privateUse_im_private_v_private = im_private_v_private; exports.publicUse_im_private_v_private = im_private_v_private; var privateUse_im_private_i_private; - exports.publicUse_im_private_i_private; var privateUse_im_private_mi_private = new im_private_mi_private.c(); exports.publicUse_im_private_mi_private = new im_private_mi_private.c(); var privateUse_im_private_mu_private; - exports.publicUse_im_private_mu_private; // No Privacy errors - importing public elements var im_private_c_public = m_public.c_public; var im_private_e_public = m_public.e_public; @@ -197,9 +195,7 @@ define(["require", "exports"], function (require, exports) { var privateUse_im_private_v_public = im_private_v_public; exports.publicUse_im_private_v_public = im_private_v_public; var privateUse_im_private_i_public; - exports.publicUse_im_private_i_public; var privateUse_im_private_mi_public = new im_private_mi_public.c(); exports.publicUse_im_private_mi_public = new im_private_mi_public.c(); var privateUse_im_private_mu_public; - exports.publicUse_im_private_mu_public; }); diff --git a/tests/baselines/reference/privacyVar.js b/tests/baselines/reference/privacyVar.js index 04b4cc28dd5..17c7b1a74d1 100644 --- a/tests/baselines/reference/privacyVar.js +++ b/tests/baselines/reference/privacyVar.js @@ -218,9 +218,7 @@ var m1; return C4_public; })(); var m1_v1_private; - m1.m1_v2_public; var m1_v3_private; - m1.m1_v4_public; // error var m1_v11_private = new C1_public(); m1.m1_v12_public = new C1_public(); var m1_v13_private = new C2_private(); @@ -273,9 +271,7 @@ var m2; return m2_C4_public; })(); var m2_v1_private; - m2.m2_v2_public; var m2_v3_private; - m2.m2_v4_public; var m2_v11_private = new m2_C1_public(); m2.m2_v12_public = new m2_C1_public(); var m2_v13_private = new m2_C2_private(); @@ -326,9 +322,7 @@ var glo_C4_public = (function () { return glo_C4_public; })(); var glo_v1_private; -exports.glo_v2_public; var glo_v3_private; -exports.glo_v4_public; // error var glo_v11_private = new glo_C1_public(); exports.glo_v12_public = new glo_C1_public(); var glo_v13_private = new glo_C2_private(); diff --git a/tests/baselines/reference/privacyVarDeclFile.js b/tests/baselines/reference/privacyVarDeclFile.js index 1f0a14fc7cf..4632ef8c60a 100644 --- a/tests/baselines/reference/privacyVarDeclFile.js +++ b/tests/baselines/reference/privacyVarDeclFile.js @@ -459,8 +459,6 @@ var privateClassWithWithPublicPropertyTypes = (function () { } return privateClassWithWithPublicPropertyTypes; })(); -exports.publicVarWithPrivatePropertyTypes; // Error -exports.publicVarWithPublicPropertyTypes; var privateVarWithPrivatePropertyTypes; var privateVarWithPublicPropertyTypes; var publicClassWithPrivateModulePropertyTypes = (function () { @@ -469,7 +467,6 @@ var publicClassWithPrivateModulePropertyTypes = (function () { return publicClassWithPrivateModulePropertyTypes; })(); exports.publicClassWithPrivateModulePropertyTypes = publicClassWithPrivateModulePropertyTypes; -exports.publicVarWithPrivateModulePropertyTypes; // Error var privateClassWithPrivateModulePropertyTypes = (function () { function privateClassWithPrivateModulePropertyTypes() { } @@ -511,8 +508,6 @@ var publicModule; } return privateClassWithWithPublicPropertyTypes; })(); - publicModule.publicVarWithPrivatePropertyTypes; // Error - publicModule.publicVarWithPublicPropertyTypes; var privateVarWithPrivatePropertyTypes; var privateVarWithPublicPropertyTypes; var publicClassWithPrivateModulePropertyTypes = (function () { @@ -521,7 +516,6 @@ var publicModule; return publicClassWithPrivateModulePropertyTypes; })(); publicModule.publicClassWithPrivateModulePropertyTypes = publicClassWithPrivateModulePropertyTypes; - publicModule.publicVarWithPrivateModulePropertyTypes; // Error var privateClassWithPrivateModulePropertyTypes = (function () { function privateClassWithPrivateModulePropertyTypes() { } @@ -564,8 +558,6 @@ var privateModule; } return privateClassWithWithPublicPropertyTypes; })(); - privateModule.publicVarWithPrivatePropertyTypes; - privateModule.publicVarWithPublicPropertyTypes; var privateVarWithPrivatePropertyTypes; var privateVarWithPublicPropertyTypes; var publicClassWithPrivateModulePropertyTypes = (function () { @@ -574,7 +566,6 @@ var privateModule; return publicClassWithPrivateModulePropertyTypes; })(); privateModule.publicClassWithPrivateModulePropertyTypes = publicClassWithPrivateModulePropertyTypes; - privateModule.publicVarWithPrivateModulePropertyTypes; var privateClassWithPrivateModulePropertyTypes = (function () { function privateClassWithPrivateModulePropertyTypes() { } @@ -642,8 +633,6 @@ var publicModuleInGlobal; } return privateClassWithWithPublicPropertyTypes; })(); - privateModule.publicVarWithPrivatePropertyTypes; - privateModule.publicVarWithPublicPropertyTypes; var privateVarWithPrivatePropertyTypes; var privateVarWithPublicPropertyTypes; var publicClassWithPrivateModulePropertyTypes = (function () { @@ -652,7 +641,6 @@ var publicModuleInGlobal; return publicClassWithPrivateModulePropertyTypes; })(); privateModule.publicClassWithPrivateModulePropertyTypes = publicClassWithPrivateModulePropertyTypes; - privateModule.publicVarWithPrivateModulePropertyTypes; var privateClassWithPrivateModulePropertyTypes = (function () { function privateClassWithPrivateModulePropertyTypes() { } @@ -682,8 +670,6 @@ var publicModuleInGlobal; } return privateClassWithWithPublicPropertyTypes; })(); - publicModuleInGlobal.publicVarWithPrivatePropertyTypes; // Error - publicModuleInGlobal.publicVarWithPublicPropertyTypes; var privateVarWithPrivatePropertyTypes; var privateVarWithPublicPropertyTypes; var publicClassWithPrivateModulePropertyTypes = (function () { @@ -692,7 +678,6 @@ var publicModuleInGlobal; return publicClassWithPrivateModulePropertyTypes; })(); publicModuleInGlobal.publicClassWithPrivateModulePropertyTypes = publicClassWithPrivateModulePropertyTypes; - publicModuleInGlobal.publicVarWithPrivateModulePropertyTypes; // Error var privateClassWithPrivateModulePropertyTypes = (function () { function privateClassWithPrivateModulePropertyTypes() { } diff --git a/tests/baselines/reference/project/declarationsCascadingImports/amd/m4.js b/tests/baselines/reference/project/declarationsCascadingImports/amd/m4.js index dcde28794d1..c89712ecc7f 100644 --- a/tests/baselines/reference/project/declarationsCascadingImports/amd/m4.js +++ b/tests/baselines/reference/project/declarationsCascadingImports/amd/m4.js @@ -6,7 +6,6 @@ define(["require", "exports"], function (require, exports) { })(); exports.d = d; ; - exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsCascadingImports/node/m4.js b/tests/baselines/reference/project/declarationsCascadingImports/node/m4.js index 69fc2903493..2c8c4f07149 100644 --- a/tests/baselines/reference/project/declarationsCascadingImports/node/m4.js +++ b/tests/baselines/reference/project/declarationsCascadingImports/node/m4.js @@ -5,7 +5,6 @@ var d = (function () { })(); exports.d = d; ; -exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsGlobalImport/amd/glo_m4.js b/tests/baselines/reference/project/declarationsGlobalImport/amd/glo_m4.js index dcde28794d1..c89712ecc7f 100644 --- a/tests/baselines/reference/project/declarationsGlobalImport/amd/glo_m4.js +++ b/tests/baselines/reference/project/declarationsGlobalImport/amd/glo_m4.js @@ -6,7 +6,6 @@ define(["require", "exports"], function (require, exports) { })(); exports.d = d; ; - exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsGlobalImport/node/glo_m4.js b/tests/baselines/reference/project/declarationsGlobalImport/node/glo_m4.js index 69fc2903493..2c8c4f07149 100644 --- a/tests/baselines/reference/project/declarationsGlobalImport/node/glo_m4.js +++ b/tests/baselines/reference/project/declarationsGlobalImport/node/glo_m4.js @@ -5,7 +5,6 @@ var d = (function () { })(); exports.d = d; ; -exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsImportedInPrivate/amd/private_m4.js b/tests/baselines/reference/project/declarationsImportedInPrivate/amd/private_m4.js index dcde28794d1..c89712ecc7f 100644 --- a/tests/baselines/reference/project/declarationsImportedInPrivate/amd/private_m4.js +++ b/tests/baselines/reference/project/declarationsImportedInPrivate/amd/private_m4.js @@ -6,7 +6,6 @@ define(["require", "exports"], function (require, exports) { })(); exports.d = d; ; - exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsImportedInPrivate/amd/useModule.js b/tests/baselines/reference/project/declarationsImportedInPrivate/amd/useModule.js index 640e4412366..fd6c8ad47f4 100644 --- a/tests/baselines/reference/project/declarationsImportedInPrivate/amd/useModule.js +++ b/tests/baselines/reference/project/declarationsImportedInPrivate/amd/useModule.js @@ -4,6 +4,5 @@ define(["require", "exports", "private_m4"], function (require, exports, private var x3 = private_m4.x; var d3 = private_m4.d; var f3 = private_m4.foo(); - usePrivate_m4_m1.numberVar; })(usePrivate_m4_m1 = exports.usePrivate_m4_m1 || (exports.usePrivate_m4_m1 = {})); }); diff --git a/tests/baselines/reference/project/declarationsImportedInPrivate/node/private_m4.js b/tests/baselines/reference/project/declarationsImportedInPrivate/node/private_m4.js index 69fc2903493..2c8c4f07149 100644 --- a/tests/baselines/reference/project/declarationsImportedInPrivate/node/private_m4.js +++ b/tests/baselines/reference/project/declarationsImportedInPrivate/node/private_m4.js @@ -5,7 +5,6 @@ var d = (function () { })(); exports.d = d; ; -exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsImportedInPrivate/node/useModule.js b/tests/baselines/reference/project/declarationsImportedInPrivate/node/useModule.js index 77f1d44c2a9..8fe4cca6e92 100644 --- a/tests/baselines/reference/project/declarationsImportedInPrivate/node/useModule.js +++ b/tests/baselines/reference/project/declarationsImportedInPrivate/node/useModule.js @@ -5,5 +5,4 @@ var usePrivate_m4_m1; var x3 = private_m4.x; var d3 = private_m4.d; var f3 = private_m4.foo(); - usePrivate_m4_m1.numberVar; })(usePrivate_m4_m1 = exports.usePrivate_m4_m1 || (exports.usePrivate_m4_m1 = {})); diff --git a/tests/baselines/reference/project/declarationsImportedUseInFunction/amd/fncOnly_m4.js b/tests/baselines/reference/project/declarationsImportedUseInFunction/amd/fncOnly_m4.js index dcde28794d1..c89712ecc7f 100644 --- a/tests/baselines/reference/project/declarationsImportedUseInFunction/amd/fncOnly_m4.js +++ b/tests/baselines/reference/project/declarationsImportedUseInFunction/amd/fncOnly_m4.js @@ -6,7 +6,6 @@ define(["require", "exports"], function (require, exports) { })(); exports.d = d; ; - exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsImportedUseInFunction/node/fncOnly_m4.js b/tests/baselines/reference/project/declarationsImportedUseInFunction/node/fncOnly_m4.js index 69fc2903493..2c8c4f07149 100644 --- a/tests/baselines/reference/project/declarationsImportedUseInFunction/node/fncOnly_m4.js +++ b/tests/baselines/reference/project/declarationsImportedUseInFunction/node/fncOnly_m4.js @@ -5,7 +5,6 @@ var d = (function () { })(); exports.d = d; ; -exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/amd/m4.js b/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/amd/m4.js index dcde28794d1..c89712ecc7f 100644 --- a/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/amd/m4.js +++ b/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/amd/m4.js @@ -6,7 +6,6 @@ define(["require", "exports"], function (require, exports) { })(); exports.d = d; ; - exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/node/m4.js b/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/node/m4.js index 69fc2903493..2c8c4f07149 100644 --- a/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/node/m4.js +++ b/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/node/m4.js @@ -5,7 +5,6 @@ var d = (function () { })(); exports.d = d; ; -exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsMultipleTimesImport/amd/m4.js b/tests/baselines/reference/project/declarationsMultipleTimesImport/amd/m4.js index dcde28794d1..c89712ecc7f 100644 --- a/tests/baselines/reference/project/declarationsMultipleTimesImport/amd/m4.js +++ b/tests/baselines/reference/project/declarationsMultipleTimesImport/amd/m4.js @@ -6,7 +6,6 @@ define(["require", "exports"], function (require, exports) { })(); exports.d = d; ; - exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsMultipleTimesImport/node/m4.js b/tests/baselines/reference/project/declarationsMultipleTimesImport/node/m4.js index 69fc2903493..2c8c4f07149 100644 --- a/tests/baselines/reference/project/declarationsMultipleTimesImport/node/m4.js +++ b/tests/baselines/reference/project/declarationsMultipleTimesImport/node/m4.js @@ -5,7 +5,6 @@ var d = (function () { })(); exports.d = d; ; -exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/amd/m4.js b/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/amd/m4.js index dcde28794d1..c89712ecc7f 100644 --- a/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/amd/m4.js +++ b/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/amd/m4.js @@ -6,7 +6,6 @@ define(["require", "exports"], function (require, exports) { })(); exports.d = d; ; - exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/node/m4.js b/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/node/m4.js index 69fc2903493..2c8c4f07149 100644 --- a/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/node/m4.js +++ b/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/node/m4.js @@ -5,7 +5,6 @@ var d = (function () { })(); exports.d = d; ; -exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsSimpleImport/amd/m4.js b/tests/baselines/reference/project/declarationsSimpleImport/amd/m4.js index dcde28794d1..c89712ecc7f 100644 --- a/tests/baselines/reference/project/declarationsSimpleImport/amd/m4.js +++ b/tests/baselines/reference/project/declarationsSimpleImport/amd/m4.js @@ -6,7 +6,6 @@ define(["require", "exports"], function (require, exports) { })(); exports.d = d; ; - exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsSimpleImport/node/m4.js b/tests/baselines/reference/project/declarationsSimpleImport/node/m4.js index 69fc2903493..2c8c4f07149 100644 --- a/tests/baselines/reference/project/declarationsSimpleImport/node/m4.js +++ b/tests/baselines/reference/project/declarationsSimpleImport/node/m4.js @@ -5,7 +5,6 @@ var d = (function () { })(); exports.d = d; ; -exports.x; function foo() { return new d(); } diff --git a/tests/baselines/reference/propertyNamesWithStringLiteral.js b/tests/baselines/reference/propertyNamesWithStringLiteral.js index 9c1bc04a95e..1474847723f 100644 --- a/tests/baselines/reference/propertyNamesWithStringLiteral.js +++ b/tests/baselines/reference/propertyNamesWithStringLiteral.js @@ -24,7 +24,6 @@ var _Color = (function () { })(); var Color; (function (Color) { - Color.namedColors; })(Color || (Color = {})); var a = Color.namedColors["azure"]; var a = Color.namedColors.blue; // Should not error diff --git a/tests/baselines/reference/protoAsIndexInIndexExpression.js b/tests/baselines/reference/protoAsIndexInIndexExpression.js index 489e624cdc6..a003c70468e 100644 --- a/tests/baselines/reference/protoAsIndexInIndexExpression.js +++ b/tests/baselines/reference/protoAsIndexInIndexExpression.js @@ -20,7 +20,6 @@ class C { } //// [protoAsIndexInIndexExpression_0.js] -exports.x; //// [protoAsIndexInIndexExpression_1.js] /// var EntityPrototype = undefined; diff --git a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType1.js b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType1.js index 59f4f8c8a94..866a54e964f 100644 --- a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType1.js +++ b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType1.js @@ -27,5 +27,4 @@ define(["require", "exports"], function (require, exports) { }); //// [recursiveExportAssignmentAndFindAliasedType1_moduleA.js] define(["require", "exports"], function (require, exports) { - exports.b; // This should result in type ClassB }); diff --git a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType2.js b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType2.js index 48f35df3097..8398d252c87 100644 --- a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType2.js +++ b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType2.js @@ -31,5 +31,4 @@ define(["require", "exports"], function (require, exports) { }); //// [recursiveExportAssignmentAndFindAliasedType2_moduleA.js] define(["require", "exports"], function (require, exports) { - exports.b; // This should result in type ClassB }); diff --git a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType3.js b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType3.js index c7456cda942..9d992596f40 100644 --- a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType3.js +++ b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType3.js @@ -35,5 +35,4 @@ define(["require", "exports"], function (require, exports) { }); //// [recursiveExportAssignmentAndFindAliasedType3_moduleA.js] define(["require", "exports"], function (require, exports) { - exports.b; // This should result in type ClassB }); diff --git a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType4.js b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType4.js index 1a9e00675a7..109950d0301 100644 --- a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType4.js +++ b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType4.js @@ -27,5 +27,4 @@ define(["require", "exports"], function (require, exports) { }); //// [recursiveExportAssignmentAndFindAliasedType4_moduleA.js] define(["require", "exports"], function (require, exports) { - exports.b; // This should result in type ClassB }); diff --git a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType5.js b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType5.js index dd94524bfa2..2b5353f2796 100644 --- a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType5.js +++ b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType5.js @@ -34,5 +34,4 @@ define(["require", "exports"], function (require, exports) { }); //// [recursiveExportAssignmentAndFindAliasedType5_moduleA.js] define(["require", "exports"], function (require, exports) { - exports.b; // This should result in type ClassB }); diff --git a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType6.js b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType6.js index 792f09b5579..6ae03f9c9b8 100644 --- a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType6.js +++ b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType6.js @@ -41,5 +41,4 @@ define(["require", "exports"], function (require, exports) { }); //// [recursiveExportAssignmentAndFindAliasedType6_moduleA.js] define(["require", "exports"], function (require, exports) { - exports.b; // This should result in type ClassB }); diff --git a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType7.js b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType7.js index f5568b5e39d..8e87b0bc3a0 100644 --- a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType7.js +++ b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType7.js @@ -46,5 +46,4 @@ define(["require", "exports"], function (require, exports) { }); //// [recursiveExportAssignmentAndFindAliasedType7_moduleA.js] define(["require", "exports"], function (require, exports) { - exports.b; // This should result in type ClassB }); diff --git a/tests/baselines/reference/scopeResolutionIdentifiers.js b/tests/baselines/reference/scopeResolutionIdentifiers.js index 1d72bbbf966..42a1e684015 100644 --- a/tests/baselines/reference/scopeResolutionIdentifiers.js +++ b/tests/baselines/reference/scopeResolutionIdentifiers.js @@ -43,7 +43,6 @@ module M3 { var s; var M1; (function (M1) { - M1.s; var n = M1.s; var n; })(M1 || (M1 = {})); diff --git a/tests/baselines/reference/separateCompilationSpecifiedModule.js b/tests/baselines/reference/separateCompilationSpecifiedModule.js index 5f3c7ceb39c..02616b75874 100644 --- a/tests/baselines/reference/separateCompilationSpecifiedModule.js +++ b/tests/baselines/reference/separateCompilationSpecifiedModule.js @@ -2,4 +2,3 @@ export var x; //// [separateCompilationSpecifiedModule.js] -exports.x; diff --git a/tests/baselines/reference/separateCompilationUnspecifiedModule.js b/tests/baselines/reference/separateCompilationUnspecifiedModule.js index 0f2e5c71a87..1525207a93d 100644 --- a/tests/baselines/reference/separateCompilationUnspecifiedModule.js +++ b/tests/baselines/reference/separateCompilationUnspecifiedModule.js @@ -2,4 +2,3 @@ export var x; //// [separateCompilationUnspecifiedModule.js] -exports.x; diff --git a/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js new file mode 100644 index 00000000000..4e894fb99ad --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js @@ -0,0 +1,17 @@ +//// [sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts] +module Q { + function P() { + // Test this + var a = 1; + } +} + +//// [sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js] +var Q; +(function (Q) { + function P() { + // Test this + var a = 1; + } +})(Q || (Q = {})); +//# sourceMappingURL=sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map new file mode 100644 index 00000000000..217105d88d2 --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map @@ -0,0 +1,2 @@ +//// [sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map] +{"version":3,"file":"sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js","sourceRoot":"","sources":["sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts"],"names":["Q","Q.P"],"mappings":"AAAA,IAAO,CAAC,CAKP;AALD,WAAO,CAAC,EAAC,CAAC;IACNA;QAEIC,AADAA,YAAYA;YACRA,CAACA,GAAGA,CAACA,CAACA;IACdA,CAACA;AACLD,CAACA,EALM,CAAC,KAAD,CAAC,QAKP"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.sourcemap.txt b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.sourcemap.txt new file mode 100644 index 00000000000..669481b46a2 --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.sourcemap.txt @@ -0,0 +1,127 @@ +=================================================================== +JsFile: sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js +mapUrl: sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map +sourceRoot: +sources: sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js +sourceFile:sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts +------------------------------------------------------------------- +>>>var Q; +1 > +2 >^^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^-> +1 > +2 >module +3 > Q +4 > { + > function P() { + > // Test this + > var a = 1; + > } + > } +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0) +3 >Emitted(1, 6) Source(1, 9) + SourceIndex(0) +4 >Emitted(1, 7) Source(6, 2) + SourceIndex(0) +--- +>>>(function (Q) { +1-> +2 >^^^^^^^^^^^ +3 > ^ +4 > ^^ +5 > ^ +6 > ^^^^-> +1-> +2 >module +3 > Q +4 > +5 > { +1->Emitted(2, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(2, 12) Source(1, 8) + SourceIndex(0) +3 >Emitted(2, 13) Source(1, 9) + SourceIndex(0) +4 >Emitted(2, 15) Source(1, 10) + SourceIndex(0) +5 >Emitted(2, 16) Source(1, 11) + SourceIndex(0) +--- +>>> function P() { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(3, 5) Source(2, 5) + SourceIndex(0) name (Q) +--- +>>> // Test this +1->^^^^^^^^ +2 > +3 > ^^^^^^^^^^^^ +1->function P() { + > // Test this + > +2 > +3 > // Test this +1->Emitted(4, 9) Source(4, 9) + SourceIndex(0) name (Q.P) +2 >Emitted(4, 9) Source(3, 9) + SourceIndex(0) name (Q.P) +3 >Emitted(4, 21) Source(3, 21) + SourceIndex(0) name (Q.P) +--- +>>> var a = 1; +1 >^^^^^^^^^^^^ +2 > ^ +3 > ^^^ +4 > ^ +5 > ^ +1 > + > var +2 > a +3 > = +4 > 1 +5 > ; +1 >Emitted(5, 13) Source(4, 13) + SourceIndex(0) name (Q.P) +2 >Emitted(5, 14) Source(4, 14) + SourceIndex(0) name (Q.P) +3 >Emitted(5, 17) Source(4, 17) + SourceIndex(0) name (Q.P) +4 >Emitted(5, 18) Source(4, 18) + SourceIndex(0) name (Q.P) +5 >Emitted(5, 19) Source(4, 19) + SourceIndex(0) name (Q.P) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(6, 5) Source(5, 5) + SourceIndex(0) name (Q.P) +2 >Emitted(6, 6) Source(5, 6) + SourceIndex(0) name (Q.P) +--- +>>>})(Q || (Q = {})); +1-> +2 >^ +3 > ^^ +4 > ^ +5 > ^^^^^ +6 > ^ +7 > ^^^^^^^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >} +3 > +4 > Q +5 > +6 > Q +7 > { + > function P() { + > // Test this + > var a = 1; + > } + > } +1->Emitted(7, 1) Source(6, 1) + SourceIndex(0) name (Q) +2 >Emitted(7, 2) Source(6, 2) + SourceIndex(0) name (Q) +3 >Emitted(7, 4) Source(1, 8) + SourceIndex(0) +4 >Emitted(7, 5) Source(1, 9) + SourceIndex(0) +5 >Emitted(7, 10) Source(1, 8) + SourceIndex(0) +6 >Emitted(7, 11) Source(1, 9) + SourceIndex(0) +7 >Emitted(7, 19) Source(6, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.symbols b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.symbols new file mode 100644 index 00000000000..285a6a0ad92 --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.symbols @@ -0,0 +1,12 @@ +=== tests/cases/compiler/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts === +module Q { +>Q : Symbol(Q, Decl(sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts, 0, 0)) + + function P() { +>P : Symbol(P, Decl(sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts, 0, 10)) + + // Test this + var a = 1; +>a : Symbol(a, Decl(sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts, 3, 11)) + } +} diff --git a/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.types b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.types new file mode 100644 index 00000000000..db4f2c320b4 --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts === +module Q { +>Q : typeof Q + + function P() { +>P : () => void + + // Test this + var a = 1; +>a : number +>1 : number + } +} diff --git a/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.js b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.js new file mode 100644 index 00000000000..885ece077d7 --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.js @@ -0,0 +1,12 @@ +//// [sourceMapForFunctionWithCommentPrecedingStatement01.ts] +function P() { + // Test this + var a = 1; +} + +//// [sourceMapForFunctionWithCommentPrecedingStatement01.js] +function P() { + // Test this + var a = 1; +} +//# sourceMappingURL=sourceMapForFunctionWithCommentPrecedingStatement01.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.js.map b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.js.map new file mode 100644 index 00000000000..7a84caf3879 --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.js.map @@ -0,0 +1,2 @@ +//// [sourceMapForFunctionWithCommentPrecedingStatement01.js.map] +{"version":3,"file":"sourceMapForFunctionWithCommentPrecedingStatement01.js","sourceRoot":"","sources":["sourceMapForFunctionWithCommentPrecedingStatement01.ts"],"names":["P"],"mappings":"AAAA;IAEIA,AADAA,YAAYA;QACRA,CAACA,GAAGA,CAACA,CAACA;AACdA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.sourcemap.txt b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.sourcemap.txt new file mode 100644 index 00000000000..cbeed192d31 --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.sourcemap.txt @@ -0,0 +1,58 @@ +=================================================================== +JsFile: sourceMapForFunctionWithCommentPrecedingStatement01.js +mapUrl: sourceMapForFunctionWithCommentPrecedingStatement01.js.map +sourceRoot: +sources: sourceMapForFunctionWithCommentPrecedingStatement01.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapForFunctionWithCommentPrecedingStatement01.js +sourceFile:sourceMapForFunctionWithCommentPrecedingStatement01.ts +------------------------------------------------------------------- +>>>function P() { +1 > +2 >^^^^^^^^^^^^^^^^^-> +1 > +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +--- +>>> // Test this +1->^^^^ +2 > +3 > ^^^^^^^^^^^^ +1->function P() { + > // Test this + > +2 > +3 > // Test this +1->Emitted(2, 5) Source(3, 5) + SourceIndex(0) name (P) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) name (P) +3 >Emitted(2, 17) Source(2, 17) + SourceIndex(0) name (P) +--- +>>> var a = 1; +1 >^^^^^^^^ +2 > ^ +3 > ^^^ +4 > ^ +5 > ^ +1 > + > var +2 > a +3 > = +4 > 1 +5 > ; +1 >Emitted(3, 9) Source(3, 9) + SourceIndex(0) name (P) +2 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) name (P) +3 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) name (P) +4 >Emitted(3, 14) Source(3, 14) + SourceIndex(0) name (P) +5 >Emitted(3, 15) Source(3, 15) + SourceIndex(0) name (P) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(4, 1) Source(4, 1) + SourceIndex(0) name (P) +2 >Emitted(4, 2) Source(4, 2) + SourceIndex(0) name (P) +--- +>>>//# sourceMappingURL=sourceMapForFunctionWithCommentPrecedingStatement01.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.symbols b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.symbols new file mode 100644 index 00000000000..b9f50a929af --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.symbols @@ -0,0 +1,8 @@ +=== tests/cases/compiler/sourceMapForFunctionWithCommentPrecedingStatement01.ts === +function P() { +>P : Symbol(P, Decl(sourceMapForFunctionWithCommentPrecedingStatement01.ts, 0, 0)) + + // Test this + var a = 1; +>a : Symbol(a, Decl(sourceMapForFunctionWithCommentPrecedingStatement01.ts, 2, 7)) +} diff --git a/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.types b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.types new file mode 100644 index 00000000000..5e3d01a6b5b --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/sourceMapForFunctionWithCommentPrecedingStatement01.ts === +function P() { +>P : () => void + + // Test this + var a = 1; +>a : number +>1 : number +} diff --git a/tests/baselines/reference/structuralTypeInDeclareFileForModule.js b/tests/baselines/reference/structuralTypeInDeclareFileForModule.js index 8dfb775662b..b7d5615d3ff 100644 --- a/tests/baselines/reference/structuralTypeInDeclareFileForModule.js +++ b/tests/baselines/reference/structuralTypeInDeclareFileForModule.js @@ -6,7 +6,6 @@ var m = M; //// [structuralTypeInDeclareFileForModule.js] var M; (function (M) { - M.x; })(M || (M = {})); var m = M; diff --git a/tests/baselines/reference/symbolProperty49.js b/tests/baselines/reference/symbolProperty49.js index 5ed756b0863..616683ed404 100644 --- a/tests/baselines/reference/symbolProperty49.js +++ b/tests/baselines/reference/symbolProperty49.js @@ -10,7 +10,6 @@ module M { //// [symbolProperty49.js] var M; (function (M) { - M.Symbol; class C { [M.Symbol.iterator]() { } } diff --git a/tests/baselines/reference/systemModule11.js b/tests/baselines/reference/systemModule11.js index 91c05e8263a..55011214042 100644 --- a/tests/baselines/reference/systemModule11.js +++ b/tests/baselines/reference/systemModule11.js @@ -61,7 +61,6 @@ System.register(['bar'], function(exports_1) { exportStar_1(_bar_1); }], execute: function() { - exports_1("x", x); } } }); @@ -128,7 +127,6 @@ System.register(['a'], function(exports_1) { exports_1("s2", _a_1["s1"]); }], execute: function() { - exports_1("x", x); exports_1("z", z); exports_1("z2", z1); } diff --git a/tests/baselines/reference/systemModule4.js b/tests/baselines/reference/systemModule4.js index 0b045b620ff..2b06d04e06f 100644 --- a/tests/baselines/reference/systemModule4.js +++ b/tests/baselines/reference/systemModule4.js @@ -10,7 +10,6 @@ System.register([], function(exports_1) { setters:[], execute: function() { exports_1("x", x = 1); - exports_1("y", y); } } }); diff --git a/tests/baselines/reference/systemModule8.js b/tests/baselines/reference/systemModule8.js index 578814d0ab2..6196005dc62 100644 --- a/tests/baselines/reference/systemModule8.js +++ b/tests/baselines/reference/systemModule8.js @@ -39,7 +39,6 @@ System.register([], function(exports_1) { return { setters:[], execute: function() { - exports_1("x", x); exports_1("x", x = 1); (exports_1("x", ++x) - 1); (exports_1("x", --x) + 1); diff --git a/tests/baselines/reference/topLevelFileModule.js b/tests/baselines/reference/topLevelFileModule.js index 4f8bc94dcf4..5d655f78397 100644 --- a/tests/baselines/reference/topLevelFileModule.js +++ b/tests/baselines/reference/topLevelFileModule.js @@ -13,7 +13,6 @@ var z = foo.x + fum.y; //// [foo_0.js] -exports.x; //// [foo_1.js] var foo = require("vs/foo_0"); var fum = require("vs/fum"); diff --git a/tests/baselines/reference/typeGuardsInExternalModule.js b/tests/baselines/reference/typeGuardsInExternalModule.js index 29950ece95a..88423e65ca1 100644 --- a/tests/baselines/reference/typeGuardsInExternalModule.js +++ b/tests/baselines/reference/typeGuardsInExternalModule.js @@ -37,7 +37,6 @@ else { } // exported variable in external module var strOrNum; -exports.var2; if (typeof exports.var2 === "string") { // export makes the var property and not variable strOrNum = exports.var2; // string | number diff --git a/tests/baselines/reference/typeGuardsInModule.js b/tests/baselines/reference/typeGuardsInModule.js index c72b9e58aa2..6c1ccdbb5af 100644 --- a/tests/baselines/reference/typeGuardsInModule.js +++ b/tests/baselines/reference/typeGuardsInModule.js @@ -107,8 +107,6 @@ var m1; else { num = var2; // number } - // exported variable in the module - m1.var3; if (typeof m1.var3 === "string") { strOrNum = m1.var3; // string | number } @@ -120,7 +118,6 @@ var m1; var m2; (function (m2) { var var2; - m2.var3; var m3; (function (m3) { // global vars in function declaration @@ -137,8 +134,6 @@ var m2; else { num = var4; // number } - // exported variable in the module - m3.var5; if (typeof m3.var5 === "string") { strOrNum = m3.var5; // string | number } @@ -162,8 +157,6 @@ var m3; else { num = var2; // number } - // exported variable in the module - m4.var3; if (typeof m4.var3 === "string") { strOrNum = m4.var3; // string | number } diff --git a/tests/baselines/reference/typeofANonExportedType.js b/tests/baselines/reference/typeofANonExportedType.js index bb41ddfab7a..5b24d9bc102 100644 --- a/tests/baselines/reference/typeofANonExportedType.js +++ b/tests/baselines/reference/typeofANonExportedType.js @@ -53,23 +53,14 @@ export var r13: typeof foo; //// [typeofANonExportedType.js] var x = 1; -exports.r1; var y = { foo: '' }; -exports.r2; var C = (function () { function C() { } return C; })(); -exports.c; var c2; -exports.r3; -exports.r4; -exports.r4b; -exports.i; var i2; -exports.r5; -exports.r5; var M; (function (M) { M.foo = ''; @@ -80,17 +71,10 @@ var M; })(); M.C = C; })(M || (M = {})); -exports.r6; -exports.r7; -exports.r8; -exports.r9; var E; (function (E) { E[E["A"] = 0] = "A"; })(E || (E = {})); -exports.r10; -exports.r11; -exports.r12; function foo() { } var foo; (function (foo) { @@ -102,4 +86,3 @@ var foo; })(); foo.C = C; })(foo || (foo = {})); -exports.r13; diff --git a/tests/baselines/reference/typeofAnExportedType.js b/tests/baselines/reference/typeofAnExportedType.js index af6c405a3cf..54de4f7566b 100644 --- a/tests/baselines/reference/typeofAnExportedType.js +++ b/tests/baselines/reference/typeofAnExportedType.js @@ -53,24 +53,15 @@ export var r13: typeof foo; //// [typeofAnExportedType.js] exports.x = 1; -exports.r1; exports.y = { foo: '' }; -exports.r2; var C = (function () { function C() { } return C; })(); exports.C = C; -exports.c; var c2; -exports.r3; -exports.r4; -exports.r4b; -exports.i; var i2; -exports.r5; -exports.r5; var M; (function (M) { M.foo = ''; @@ -81,18 +72,11 @@ var M; })(); M.C = C; })(M = exports.M || (exports.M = {})); -exports.r6; -exports.r7; exports.Z = M; -exports.r8; -exports.r9; (function (E) { E[E["A"] = 0] = "A"; })(exports.E || (exports.E = {})); var E = exports.E; -exports.r10; -exports.r11; -exports.r12; function foo() { } exports.foo = foo; var foo; @@ -105,4 +89,3 @@ var foo; })(); foo.C = C; })(foo = exports.foo || (exports.foo = {})); -exports.r13; diff --git a/tests/baselines/reference/typeofOperatorWithAnyOtherType.js b/tests/baselines/reference/typeofOperatorWithAnyOtherType.js index a497519f249..1c66c5f4d1e 100644 --- a/tests/baselines/reference/typeofOperatorWithAnyOtherType.js +++ b/tests/baselines/reference/typeofOperatorWithAnyOtherType.js @@ -96,7 +96,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // any type var diff --git a/tests/baselines/reference/typeofOperatorWithBooleanType.js b/tests/baselines/reference/typeofOperatorWithBooleanType.js index 82af3eac26f..c0538b78b14 100644 --- a/tests/baselines/reference/typeofOperatorWithBooleanType.js +++ b/tests/baselines/reference/typeofOperatorWithBooleanType.js @@ -62,7 +62,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // boolean type var diff --git a/tests/baselines/reference/typeofOperatorWithNumberType.js b/tests/baselines/reference/typeofOperatorWithNumberType.js index 14b45ab518f..b980b820ce1 100644 --- a/tests/baselines/reference/typeofOperatorWithNumberType.js +++ b/tests/baselines/reference/typeofOperatorWithNumberType.js @@ -70,7 +70,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // number type var diff --git a/tests/baselines/reference/typeofOperatorWithStringType.js b/tests/baselines/reference/typeofOperatorWithStringType.js index 381205ff8c1..9b5cbb20b36 100644 --- a/tests/baselines/reference/typeofOperatorWithStringType.js +++ b/tests/baselines/reference/typeofOperatorWithStringType.js @@ -70,7 +70,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // string type var diff --git a/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.js b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.js new file mode 100644 index 00000000000..f8a5cd96b48 --- /dev/null +++ b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.js @@ -0,0 +1,44 @@ +//// [unionTypeWithRecursiveSubtypeReduction1.ts] +class Module { + public members: Class[]; +} + +class Namespace { + public members: (Class | Property)[]; +} + +class Class { + public parent: Namespace; +} + +class Property { + public parent: Module | Class; +} + +var t: Class | Property; +t.parent; + + +//// [unionTypeWithRecursiveSubtypeReduction1.js] +var Module = (function () { + function Module() { + } + return Module; +})(); +var Namespace = (function () { + function Namespace() { + } + return Namespace; +})(); +var Class = (function () { + function Class() { + } + return Class; +})(); +var Property = (function () { + function Property() { + } + return Property; +})(); +var t; +t.parent; diff --git a/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.symbols b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.symbols new file mode 100644 index 00000000000..24ba3b8a8cd --- /dev/null +++ b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.symbols @@ -0,0 +1,45 @@ +=== tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction1.ts === +class Module { +>Module : Symbol(Module, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 0, 0)) + + public members: Class[]; +>members : Symbol(members, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 0, 14)) +>Class : Symbol(Class, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 6, 1)) +} + +class Namespace { +>Namespace : Symbol(Namespace, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 2, 1)) + + public members: (Class | Property)[]; +>members : Symbol(members, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 4, 17)) +>Class : Symbol(Class, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 6, 1)) +>Property : Symbol(Property, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 10, 1)) +} + +class Class { +>Class : Symbol(Class, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 6, 1)) + + public parent: Namespace; +>parent : Symbol(parent, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 8, 13)) +>Namespace : Symbol(Namespace, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 2, 1)) +} + +class Property { +>Property : Symbol(Property, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 10, 1)) + + public parent: Module | Class; +>parent : Symbol(parent, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 12, 16)) +>Module : Symbol(Module, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 0, 0)) +>Class : Symbol(Class, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 6, 1)) +} + +var t: Class | Property; +>t : Symbol(t, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 16, 3)) +>Class : Symbol(Class, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 6, 1)) +>Property : Symbol(Property, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 10, 1)) + +t.parent; +>t.parent : Symbol(parent, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 8, 13), Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 12, 16)) +>t : Symbol(t, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 16, 3)) +>parent : Symbol(parent, Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 8, 13), Decl(unionTypeWithRecursiveSubtypeReduction1.ts, 12, 16)) + diff --git a/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.types b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.types new file mode 100644 index 00000000000..c6fa610e68a --- /dev/null +++ b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.types @@ -0,0 +1,45 @@ +=== tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction1.ts === +class Module { +>Module : Module + + public members: Class[]; +>members : Class[] +>Class : Class +} + +class Namespace { +>Namespace : Namespace + + public members: (Class | Property)[]; +>members : (Class | Property)[] +>Class : Class +>Property : Property +} + +class Class { +>Class : Class + + public parent: Namespace; +>parent : Namespace +>Namespace : Namespace +} + +class Property { +>Property : Property + + public parent: Module | Class; +>parent : Module | Class +>Module : Module +>Class : Class +} + +var t: Class | Property; +>t : Class | Property +>Class : Class +>Property : Property + +t.parent; +>t.parent : Class | Namespace +>t : Class | Property +>parent : Class | Namespace + diff --git a/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction2.errors.txt b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction2.errors.txt new file mode 100644 index 00000000000..d481b88810c --- /dev/null +++ b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction2.errors.txt @@ -0,0 +1,46 @@ +tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction2.ts(19,1): error TS2322: Type 'Property' is not assignable to type 'Class'. + Types of property 'parent' are incompatible. + Type 'Module | Class' is not assignable to type 'Namespace'. + Type 'Class' is not assignable to type 'Namespace'. + Property 'members' is missing in type 'Class'. +tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction2.ts(20,1): error TS2322: Type 'Class' is not assignable to type 'Property'. + Types of property 'parent' are incompatible. + Type 'Namespace' is not assignable to type 'Module | Class'. + Type 'Namespace' is not assignable to type 'Class'. + Property 'parent' is missing in type 'Namespace'. + + +==== tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction2.ts (2 errors) ==== + class Module { + public members: Class[]; + } + + class Namespace { + public members: (Class | Property)[]; + } + + class Class { + public parent: Namespace; + } + + class Property { + public parent: Module | Class; + } + + var c: Class; + var p: Property; + c = p; + ~ +!!! error TS2322: Type 'Property' is not assignable to type 'Class'. +!!! error TS2322: Types of property 'parent' are incompatible. +!!! error TS2322: Type 'Module | Class' is not assignable to type 'Namespace'. +!!! error TS2322: Type 'Class' is not assignable to type 'Namespace'. +!!! error TS2322: Property 'members' is missing in type 'Class'. + p = c; + ~ +!!! error TS2322: Type 'Class' is not assignable to type 'Property'. +!!! error TS2322: Types of property 'parent' are incompatible. +!!! error TS2322: Type 'Namespace' is not assignable to type 'Module | Class'. +!!! error TS2322: Type 'Namespace' is not assignable to type 'Class'. +!!! error TS2322: Property 'parent' is missing in type 'Namespace'. + \ No newline at end of file diff --git a/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction2.js b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction2.js new file mode 100644 index 00000000000..69411b1ffcb --- /dev/null +++ b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction2.js @@ -0,0 +1,48 @@ +//// [unionTypeWithRecursiveSubtypeReduction2.ts] +class Module { + public members: Class[]; +} + +class Namespace { + public members: (Class | Property)[]; +} + +class Class { + public parent: Namespace; +} + +class Property { + public parent: Module | Class; +} + +var c: Class; +var p: Property; +c = p; +p = c; + + +//// [unionTypeWithRecursiveSubtypeReduction2.js] +var Module = (function () { + function Module() { + } + return Module; +})(); +var Namespace = (function () { + function Namespace() { + } + return Namespace; +})(); +var Class = (function () { + function Class() { + } + return Class; +})(); +var Property = (function () { + function Property() { + } + return Property; +})(); +var c; +var p; +c = p; +p = c; diff --git a/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction3.errors.txt b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction3.errors.txt new file mode 100644 index 00000000000..279119e679a --- /dev/null +++ b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction3.errors.txt @@ -0,0 +1,14 @@ +tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction3.ts(5,5): error TS2322: Type '{ prop: number; } | { prop: { prop: number; } | any; }' is not assignable to type 'string'. + Type '{ prop: number; }' is not assignable to type 'string'. + + +==== tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction3.ts (1 errors) ==== + var a27: { prop: number } | { prop: T27 }; + type T27 = typeof a27; + + var b: T27; + var s: string = b; + ~ +!!! error TS2322: Type '{ prop: number; } | { prop: { prop: number; } | any; }' is not assignable to type 'string'. +!!! error TS2322: Type '{ prop: number; }' is not assignable to type 'string'. + \ No newline at end of file diff --git a/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction3.js b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction3.js new file mode 100644 index 00000000000..7c336015059 --- /dev/null +++ b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction3.js @@ -0,0 +1,12 @@ +//// [unionTypeWithRecursiveSubtypeReduction3.ts] +var a27: { prop: number } | { prop: T27 }; +type T27 = typeof a27; + +var b: T27; +var s: string = b; + + +//// [unionTypeWithRecursiveSubtypeReduction3.js] +var a27; +var b; +var s = b; diff --git a/tests/baselines/reference/varBlock.js b/tests/baselines/reference/varBlock.js index 25ee5001d70..a3309338ecb 100644 --- a/tests/baselines/reference/varBlock.js +++ b/tests/baselines/reference/varBlock.js @@ -42,7 +42,7 @@ declare var c = 10; //// [varBlock.js] var m2; (function (m2) { - m2.a, m2.b2 = 10, m2.b; + m2.b2 = 10; })(m2 || (m2 = {})); var m3; (function (m3) { diff --git a/tests/baselines/reference/vardecl.js b/tests/baselines/reference/vardecl.js index 3ff8f4e8ab3..9b19e1000a9 100644 --- a/tests/baselines/reference/vardecl.js +++ b/tests/baselines/reference/vardecl.js @@ -130,7 +130,7 @@ var n4; var d4; var m2; (function (m2) { - m2.a, m2.b2 = 10, m2.b; + m2.b2 = 10; var m1; var a2, b22 = 10, b222; var m3; @@ -149,8 +149,6 @@ var m2; m2.C2 = C2; var m; var b23; - m2.mE; - m2.b2E; })(m2 || (m2 = {})); var a22, b22 = 10, c22 = 30; var nn; diff --git a/tests/baselines/reference/voidOperatorWithAnyOtherType.js b/tests/baselines/reference/voidOperatorWithAnyOtherType.js index e06aae7fe46..fbe85326d3a 100644 --- a/tests/baselines/reference/voidOperatorWithAnyOtherType.js +++ b/tests/baselines/reference/voidOperatorWithAnyOtherType.js @@ -82,7 +82,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // any type var diff --git a/tests/baselines/reference/voidOperatorWithBooleanType.js b/tests/baselines/reference/voidOperatorWithBooleanType.js index 69c609c1280..25099108b9b 100644 --- a/tests/baselines/reference/voidOperatorWithBooleanType.js +++ b/tests/baselines/reference/voidOperatorWithBooleanType.js @@ -50,7 +50,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // boolean type var diff --git a/tests/baselines/reference/voidOperatorWithNumberType.js b/tests/baselines/reference/voidOperatorWithNumberType.js index 2426690489d..9a0a31d4fe5 100644 --- a/tests/baselines/reference/voidOperatorWithNumberType.js +++ b/tests/baselines/reference/voidOperatorWithNumberType.js @@ -58,7 +58,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // number type var diff --git a/tests/baselines/reference/voidOperatorWithStringType.js b/tests/baselines/reference/voidOperatorWithStringType.js index 9f30d1fcb0c..5949c93acd4 100644 --- a/tests/baselines/reference/voidOperatorWithStringType.js +++ b/tests/baselines/reference/voidOperatorWithStringType.js @@ -57,7 +57,6 @@ var A = (function () { })(); var M; (function (M) { - M.n; })(M || (M = {})); var objA = new A(); // string type var diff --git a/tests/baselines/reference/withExportDecl.js b/tests/baselines/reference/withExportDecl.js index ccd13123721..8d8b8b817ea 100644 --- a/tests/baselines/reference/withExportDecl.js +++ b/tests/baselines/reference/withExportDecl.js @@ -61,7 +61,6 @@ export var eVar3 = 10, eVar4, eVar5; //// [withExportDecl.js] define(["require", "exports"], function (require, exports) { var simpleVar; - exports.exportedSimpleVar; var anotherVar; var varWithSimpleType; var varWithArrayType; @@ -70,7 +69,6 @@ define(["require", "exports"], function (require, exports) { var withComplicatedValue = { x: 30, y: 70, desc: "position" }; exports.exportedWithComplicatedValue = { x: 30, y: 70, desc: "position" }; var arrayVar = ['a', 'b']; - exports.exportedArrayVar; exports.exportedArrayVar.push({ x: 30, y: 'hello world' }); function simpleFunction() { return { @@ -97,9 +95,9 @@ define(["require", "exports"], function (require, exports) { } m3.foo = foo; })(m3 = exports.m3 || (exports.m3 = {})); - exports.eVar1, exports.eVar2 = 10; + exports.eVar2 = 10; var eVar22; - exports.eVar3 = 10, exports.eVar4, exports.eVar5; + exports.eVar3 = 10; }); diff --git a/tests/cases/compiler/declareModifierOnTypeAlias.ts b/tests/cases/compiler/declareModifierOnTypeAlias.ts new file mode 100644 index 00000000000..0dd23f7eda8 --- /dev/null +++ b/tests/cases/compiler/declareModifierOnTypeAlias.ts @@ -0,0 +1,3 @@ +declare type Foo = string; +type Bar = number; +declare type Baz = Bar; \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts b/tests/cases/compiler/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts new file mode 100644 index 00000000000..d12e894b0a9 --- /dev/null +++ b/tests/cases/compiler/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts @@ -0,0 +1,7 @@ +//@sourceMap: true +module Q { + function P() { + // Test this + var a = 1; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapForFunctionWithCommentPrecedingStatement01.ts b/tests/cases/compiler/sourceMapForFunctionWithCommentPrecedingStatement01.ts new file mode 100644 index 00000000000..e883b202ca1 --- /dev/null +++ b/tests/cases/compiler/sourceMapForFunctionWithCommentPrecedingStatement01.ts @@ -0,0 +1,5 @@ +//@sourceMap: true +function P() { + // Test this + var a = 1; +} \ No newline at end of file diff --git a/tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction1.ts b/tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction1.ts new file mode 100644 index 00000000000..acdb91c9935 --- /dev/null +++ b/tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction1.ts @@ -0,0 +1,18 @@ +class Module { + public members: Class[]; +} + +class Namespace { + public members: (Class | Property)[]; +} + +class Class { + public parent: Namespace; +} + +class Property { + public parent: Module | Class; +} + +var t: Class | Property; +t.parent; diff --git a/tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction2.ts b/tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction2.ts new file mode 100644 index 00000000000..cddcf4d4566 --- /dev/null +++ b/tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction2.ts @@ -0,0 +1,20 @@ +class Module { + public members: Class[]; +} + +class Namespace { + public members: (Class | Property)[]; +} + +class Class { + public parent: Namespace; +} + +class Property { + public parent: Module | Class; +} + +var c: Class; +var p: Property; +c = p; +p = c; diff --git a/tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction3.ts b/tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction3.ts new file mode 100644 index 00000000000..4bac9ca1b9c --- /dev/null +++ b/tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction3.ts @@ -0,0 +1,5 @@ +var a27: { prop: number } | { prop: T27 }; +type T27 = typeof a27; + +var b: T27; +var s: string = b; diff --git a/tests/cases/conformance/decorators/class/decoratorChecksFunctionBodies.ts b/tests/cases/conformance/decorators/class/decoratorChecksFunctionBodies.ts new file mode 100644 index 00000000000..31f5fe82551 --- /dev/null +++ b/tests/cases/conformance/decorators/class/decoratorChecksFunctionBodies.ts @@ -0,0 +1,16 @@ +// @target:es5 + +// from #2971 +function func(s: string): void { +} + +class A { + @(x => { + var a = 3; + func(a); + return x; + }) + m() { + + } +} \ No newline at end of file diff --git a/tests/cases/conformance/decorators/class/decoratorInstantiateModulesInFunctionBodies.ts b/tests/cases/conformance/decorators/class/decoratorInstantiateModulesInFunctionBodies.ts new file mode 100644 index 00000000000..7fa7ab8dd84 --- /dev/null +++ b/tests/cases/conformance/decorators/class/decoratorInstantiateModulesInFunctionBodies.ts @@ -0,0 +1,22 @@ +// @target:es5 +// @module:commonjs +// @filename: a.ts + +// from #3108 +export var test = 'abc'; + +// @filename: b.ts +import { test } from './a'; + +function filter(handler: any) { + return function (target: any) { + // ... + }; +} + +class Wat { + @filter(() => test == 'abc') + static whatever() { + // ... + } +} \ No newline at end of file diff --git a/tests/cases/conformance/expressions/functionCalls/callWithSpread.ts b/tests/cases/conformance/expressions/functionCalls/callWithSpread.ts index 9acba00697a..245028db3d4 100644 --- a/tests/cases/conformance/expressions/functionCalls/callWithSpread.ts +++ b/tests/cases/conformance/expressions/functionCalls/callWithSpread.ts @@ -47,6 +47,3 @@ class D extends C { super.foo(1, 2, ...a); } } - -// Only supported in when target is ES6 -var c = new C(1, 2, ...a); diff --git a/tests/cases/conformance/expressions/functionCalls/callWithSpreadES6.ts b/tests/cases/conformance/expressions/functionCalls/callWithSpreadES6.ts index 2f7d16ba368..accb6df135d 100644 --- a/tests/cases/conformance/expressions/functionCalls/callWithSpreadES6.ts +++ b/tests/cases/conformance/expressions/functionCalls/callWithSpreadES6.ts @@ -49,6 +49,3 @@ class D extends C { super.foo(1, 2, ...a); } } - -// Only supported in when target is ES6 -var c = new C(1, 2, ...a); diff --git a/tests/cases/conformance/expressions/functionCalls/newWithSpread.ts b/tests/cases/conformance/expressions/functionCalls/newWithSpread.ts new file mode 100644 index 00000000000..d17919a7036 --- /dev/null +++ b/tests/cases/conformance/expressions/functionCalls/newWithSpread.ts @@ -0,0 +1,97 @@ + +function f(x: number, y: number, ...z: string[]) { +} + +function f2(...x: string[]) { +} + +interface A { + f: { + new (x: number, y: number, ...z: string[]); + } +} + +class B { + constructor(x: number, y: number, ...z: string[]) {} +} + +interface C { + "a-b": typeof B; +} + +interface D { + 1: typeof B; +} + +var a: string[]; +var b: A; +var c: C; +var d: A[]; +var e: { [key: string]: A }; +var g: C[]; +var h: { [key: string]: C }; +var i: C[][]; + +// Basic expression +new f(1, 2, "string"); +new f(1, 2, ...a); +new f(1, 2, ...a, "string"); + +// Multiple spreads arguments +new f2(...a, ...a); +new f(1 ,2, ...a, ...a); + +// Call expression +new f(1, 2, "string")(); +new f(1, 2, ...a)(); +new f(1, 2, ...a, "string")(); + +// Property access expression +new b.f(1, 2, "string"); +new b.f(1, 2, ...a); +new b.f(1, 2, ...a, "string"); + +// Parenthesised expression +new (b.f)(1, 2, "string"); +new (b.f)(1, 2, ...a); +new (b.f)(1, 2, ...a, "string"); + +// Element access expression +new d[1].f(1, 2, "string"); +new d[1].f(1, 2, ...a); +new d[1].f(1, 2, ...a, "string"); + +// Element access expression with a punctuated key +new e["a-b"].f(1, 2, "string"); +new e["a-b"].f(1, 2, ...a); +new e["a-b"].f(1, 2, ...a, "string"); + +// Basic expression +new B(1, 2, "string"); +new B(1, 2, ...a); +new B(1, 2, ...a, "string"); + +// Property access expression +new c["a-b"](1, 2, "string"); +new c["a-b"](1, 2, ...a); +new c["a-b"](1, 2, ...a, "string"); + +// Parenthesised expression +new (c["a-b"])(1, 2, "string"); +new (c["a-b"])(1, 2, ...a); +new (c["a-b"])(1, 2, ...a, "string"); + +// Element access expression +new g[1]["a-b"](1, 2, "string"); +new g[1]["a-b"](1, 2, ...a); +new g[1]["a-b"](1, 2, ...a, "string"); + +// Element access expression with a punctuated key +new h["a-b"]["a-b"](1, 2, "string"); +new h["a-b"]["a-b"](1, 2, ...a); +new h["a-b"]["a-b"](1, 2, ...a, "string"); + +// Element access expression with a number +new i["a-b"][1](1, 2, "string"); +new i["a-b"][1](1, 2, ...a); +new i["a-b"][1](1, 2, ...a, "string"); \ No newline at end of file diff --git a/tests/cases/conformance/expressions/functionCalls/newWithSpreadES5.ts b/tests/cases/conformance/expressions/functionCalls/newWithSpreadES5.ts new file mode 100644 index 00000000000..25ef3444669 --- /dev/null +++ b/tests/cases/conformance/expressions/functionCalls/newWithSpreadES5.ts @@ -0,0 +1,97 @@ +//@target: ES5 + +function f(x: number, y: number, ...z: string[]) { +} + +function f2(...x: string[]) {} + +interface A { + f: { + new (x: number, y: number, ...z: string[]); + } +} + +class B { + constructor(x: number, y: number, ...z: string[]) {} +} + +interface C { + "a-b": typeof B; +} + +interface D { + 1: typeof B; +} + +var a: string[]; +var b: A; +var c: C; +var d: A[]; +var e: { [key: string]: A }; +var g: C[]; +var h: { [key: string]: C }; +var i: C[][]; + +// Basic expression +new f(1, 2, "string"); +new f(1, 2, ...a); +new f(1, 2, ...a, "string"); + +// Multiple spreads arguments +new f2(...a, ...a); +new f(1 ,2, ...a, ...a); + +// Call expression +new f(1, 2, "string")(); +new f(1, 2, ...a)(); +new f(1, 2, ...a, "string")(); + +// Property access expression +new b.f(1, 2, "string"); +new b.f(1, 2, ...a); +new b.f(1, 2, ...a, "string"); + +// Parenthesised expression +new (b.f)(1, 2, "string"); +new (b.f)(1, 2, ...a); +new (b.f)(1, 2, ...a, "string"); + +// Element access expression +new d[1].f(1, 2, "string"); +new d[1].f(1, 2, ...a); +new d[1].f(1, 2, ...a, "string"); + +// Element access expression with a punctuated key +new e["a-b"].f(1, 2, "string"); +new e["a-b"].f(1, 2, ...a); +new e["a-b"].f(1, 2, ...a, "string"); + +// Basic expression +new B(1, 2, "string"); +new B(1, 2, ...a); +new B(1, 2, ...a, "string"); + +// Property access expression +new c["a-b"](1, 2, "string"); +new c["a-b"](1, 2, ...a); +new c["a-b"](1, 2, ...a, "string"); + +// Parenthesised expression +new (c["a-b"])(1, 2, "string"); +new (c["a-b"])(1, 2, ...a); +new (c["a-b"])(1, 2, ...a, "string"); + +// Element access expression +new g[1]["a-b"](1, 2, "string"); +new g[1]["a-b"](1, 2, ...a); +new g[1]["a-b"](1, 2, ...a, "string"); + +// Element access expression with a punctuated key +new h["a-b"]["a-b"](1, 2, "string"); +new h["a-b"]["a-b"](1, 2, ...a); +new h["a-b"]["a-b"](1, 2, ...a, "string"); + +// Element access expression with a number +new i["a-b"][1](1, 2, "string"); +new i["a-b"][1](1, 2, ...a); +new i["a-b"][1](1, 2, ...a, "string"); \ No newline at end of file diff --git a/tests/cases/conformance/expressions/functionCalls/newWithSpreadES6.ts b/tests/cases/conformance/expressions/functionCalls/newWithSpreadES6.ts new file mode 100644 index 00000000000..0068b6cf80e --- /dev/null +++ b/tests/cases/conformance/expressions/functionCalls/newWithSpreadES6.ts @@ -0,0 +1,98 @@ +//@target: ES6 + +function f(x: number, y: number, ...z: string[]) { +} + +function f2(...x: string[]) { +} + +interface A { + f: { + new (x: number, y: number, ...z: string[]); + } +} + +class B { + constructor(x: number, y: number, ...z: string[]) {} +} + +interface C { + "a-b": typeof B; +} + +interface D { + 1: typeof B; +} + +var a: string[]; +var b: A; +var c: C; +var d: A[]; +var e: { [key: string]: A }; +var g: C[]; +var h: { [key: string]: C }; +var i: C[][]; + +// Basic expression +new f(1, 2, "string"); +new f(1, 2, ...a); +new f(1, 2, ...a, "string"); + +// Multiple spreads arguments +new f2(...a, ...a); +new f(1 ,2, ...a, ...a); + +// Call expression +new f(1, 2, "string")(); +new f(1, 2, ...a)(); +new f(1, 2, ...a, "string")(); + +// Property access expression +new b.f(1, 2, "string"); +new b.f(1, 2, ...a); +new b.f(1, 2, ...a, "string"); + +// Parenthesised expression +new (b.f)(1, 2, "string"); +new (b.f)(1, 2, ...a); +new (b.f)(1, 2, ...a, "string"); + +// Element access expression +new d[1].f(1, 2, "string"); +new d[1].f(1, 2, ...a); +new d[1].f(1, 2, ...a, "string"); + +// Element access expression with a punctuated key +new e["a-b"].f(1, 2, "string"); +new e["a-b"].f(1, 2, ...a); +new e["a-b"].f(1, 2, ...a, "string"); + +// Basic expression +new B(1, 2, "string"); +new B(1, 2, ...a); +new B(1, 2, ...a, "string"); + +// Property access expression +new c["a-b"](1, 2, "string"); +new c["a-b"](1, 2, ...a); +new c["a-b"](1, 2, ...a, "string"); + +// Parenthesised expression +new (c["a-b"])(1, 2, "string"); +new (c["a-b"])(1, 2, ...a); +new (c["a-b"])(1, 2, ...a, "string"); + +// Element access expression +new g[1]["a-b"](1, 2, "string"); +new g[1]["a-b"](1, 2, ...a); +new g[1]["a-b"](1, 2, ...a, "string"); + +// Element access expression with a punctuated key +new h["a-b"]["a-b"](1, 2, "string"); +new h["a-b"]["a-b"](1, 2, ...a); +new h["a-b"]["a-b"](1, 2, ...a, "string"); + +// Element access expression with a number +new i["a-b"][1](1, 2, "string"); +new i["a-b"][1](1, 2, ...a); +new i["a-b"][1](1, 2, ...a, "string"); \ No newline at end of file diff --git a/tests/cases/conformance/externalModules/exportNonInitializedVariablesAMD.ts b/tests/cases/conformance/externalModules/exportNonInitializedVariablesAMD.ts new file mode 100644 index 00000000000..f6ad233d4f6 --- /dev/null +++ b/tests/cases/conformance/externalModules/exportNonInitializedVariablesAMD.ts @@ -0,0 +1,34 @@ +//@module: amd + +var; +let; +const; + +export var a; +export let b; +export var c: string; +export let d: number; +class A {} +export var e: A; +export let f: A; + +namespace B { + export let a = 1, b, c = 2; + export let x, y, z; +} + +module C { + export var a = 1, b, c = 2; + export var x, y, z; +} + +// Shouldn't be filtered +export var a1 = 1; +export let b1 = 1; +export var c1: string = 'a'; +export let d1: number = 1; +class D {} +export var e1 = new D; +export let f1 = new D; +export var g1: D = new D; +export let h1: D = new D; diff --git a/tests/cases/conformance/externalModules/exportNonInitializedVariablesCommonJS.ts b/tests/cases/conformance/externalModules/exportNonInitializedVariablesCommonJS.ts new file mode 100644 index 00000000000..dd43474972c --- /dev/null +++ b/tests/cases/conformance/externalModules/exportNonInitializedVariablesCommonJS.ts @@ -0,0 +1,34 @@ +//@module: commonjs + +var; +let; +const; + +export var a; +export let b; +export var c: string; +export let d: number; +class A {} +export var e: A; +export let f: A; + +namespace B { + export let a = 1, b, c = 2; + export let x, y, z; +} + +module C { + export var a = 1, b, c = 2; + export var x, y, z; +} + +// Shouldn't be filtered +export var a1 = 1; +export let b1 = 1; +export var c1: string = 'a'; +export let d1: number = 1; +class D {} +export var e1 = new D; +export let f1 = new D; +export var g1: D = new D; +export let h1: D = new D; diff --git a/tests/cases/conformance/externalModules/exportNonInitializedVariablesES6.ts b/tests/cases/conformance/externalModules/exportNonInitializedVariablesES6.ts new file mode 100644 index 00000000000..86319311f96 --- /dev/null +++ b/tests/cases/conformance/externalModules/exportNonInitializedVariablesES6.ts @@ -0,0 +1,34 @@ +//@target: ES6 + +var; +let; +const; + +export var a; +export let b; +export var c: string; +export let d: number; +class A {} +export var e: A; +export let f: A; + +namespace B { + export let a = 1, b, c = 2; + export let x, y, z; +} + +module C { + export var a = 1, b, c = 2; + export var x, y, z; +} + +// Shouldn't be filtered +export var a1 = 1; +export let b1 = 1; +export var c1: string = 'a'; +export let d1: number = 1; +class D {} +export var e1 = new D; +export let f1 = new D; +export var g1: D = new D; +export let h1: D = new D; diff --git a/tests/cases/conformance/externalModules/exportNonInitializedVariablesSystem.ts b/tests/cases/conformance/externalModules/exportNonInitializedVariablesSystem.ts new file mode 100644 index 00000000000..2105dd61b1c --- /dev/null +++ b/tests/cases/conformance/externalModules/exportNonInitializedVariablesSystem.ts @@ -0,0 +1,34 @@ +//@module: system + +var; +let; +const; + +export var a; +export let b; +export var c: string; +export let d: number; +class A {} +export var e: A; +export let f: A; + +namespace B { + export let a = 1, b, c = 2; + export let x, y, z; +} + +module C { + export var a = 1, b, c = 2; + export var x, y, z; +} + +// Shouldn't be filtered +export var a1 = 1; +export let b1 = 1; +export var c1: string = 'a'; +export let d1: number = 1; +class D {} +export var e1 = new D; +export let f1 = new D; +export var g1: D = new D; +export let h1: D = new D; diff --git a/tests/cases/conformance/externalModules/exportNonInitializedVariablesUMD.ts b/tests/cases/conformance/externalModules/exportNonInitializedVariablesUMD.ts new file mode 100644 index 00000000000..b4d767a223c --- /dev/null +++ b/tests/cases/conformance/externalModules/exportNonInitializedVariablesUMD.ts @@ -0,0 +1,34 @@ +//@module: umd + +var; +let; +const; + +export var a; +export let b; +export var c: string; +export let d: number; +class A {} +export var e: A; +export let f: A; + +namespace B { + export let a = 1, b, c = 2; + export let x, y, z; +} + +module C { + export var a = 1, b, c = 2; + export var x, y, z; +} + +// Shouldn't be filtered +export var a1 = 1; +export let b1 = 1; +export var c1: string = 'a'; +export let d1: number = 1; +class D {} +export var e1 = new D; +export let f1 = new D; +export var g1: D = new D; +export let h1: D = new D; diff --git a/tests/cases/conformance/internalModules/exportDeclarations/NonInitializedExportInInternalModule.ts b/tests/cases/conformance/internalModules/exportDeclarations/NonInitializedExportInInternalModule.ts new file mode 100644 index 00000000000..cd08ae00041 --- /dev/null +++ b/tests/cases/conformance/internalModules/exportDeclarations/NonInitializedExportInInternalModule.ts @@ -0,0 +1,35 @@ + +module Inner { + var; + let; + const; + + export var a; + export let b; + export var c: string; + export let d: number; + class A {} + export var e: A; + export let f: A; + + namespace B { + export let a = 1, b, c = 2; + export let x, y, z; + } + + module C { + export var a = 1, b, c = 2; + export var x, y, z; + } + + // Shouldn't be filtered + export var a1 = 1; + export let b1 = 1; + export var c1: string = 'a'; + export let d1: number = 1; + class D {} + export var e1 = new D; + export let f1 = new D; + export var g1: D = new D; + export let h1: D = new D; +} \ No newline at end of file diff --git a/tests/cases/fourslash/aliasMergingWithNamespace.ts b/tests/cases/fourslash/aliasMergingWithNamespace.ts new file mode 100644 index 00000000000..66ab97890ce --- /dev/null +++ b/tests/cases/fourslash/aliasMergingWithNamespace.ts @@ -0,0 +1,9 @@ +/// + +////namespace bar { } +////import bar = bar/**/; + +goTo.marker(); +verify.quickInfoIs( +`namespace bar +import bar = bar`); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListAtInvalidLocations.ts b/tests/cases/fourslash/completionListAtInvalidLocations.ts index 96368280371..6e4b4056a7d 100644 --- a/tests/cases/fourslash/completionListAtInvalidLocations.ts +++ b/tests/cases/fourslash/completionListAtInvalidLocations.ts @@ -18,7 +18,8 @@ /////* /*inComment5*/ ////var v11 = ''; //// // /*inComment6*/ -//// +////var v12 = ''; +////type htm/*inTypeAlias*/ /// ////// /*inComment7*/ ////foo; diff --git a/tests/cases/fourslash/completionListNewIdentifierBindingElement.ts b/tests/cases/fourslash/completionListNewIdentifierBindingElement.ts new file mode 100644 index 00000000000..753d6c7d4d2 --- /dev/null +++ b/tests/cases/fourslash/completionListNewIdentifierBindingElement.ts @@ -0,0 +1,6 @@ +/// + +////var { x:html/*1*/ + +goTo.marker("1"); +verify.completionListIsEmpty(); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListNewIdentifierFunctionDeclaration.ts b/tests/cases/fourslash/completionListNewIdentifierFunctionDeclaration.ts new file mode 100644 index 00000000000..8a9a5bfb9ed --- /dev/null +++ b/tests/cases/fourslash/completionListNewIdentifierFunctionDeclaration.ts @@ -0,0 +1,9 @@ +/// + +////function F(pref: (a/*1*/ + +test.markers().forEach((m) => { + goTo.position(m.position, m.fileName); + verify.not.completionListIsEmpty(); + verify.completionListAllowsNewIdentifier(); +}); diff --git a/tests/cases/fourslash/completionListNewIdentifierVariableDeclaration.ts b/tests/cases/fourslash/completionListNewIdentifierVariableDeclaration.ts new file mode 100644 index 00000000000..534011b7ee1 --- /dev/null +++ b/tests/cases/fourslash/completionListNewIdentifierVariableDeclaration.ts @@ -0,0 +1,11 @@ +/// + +////var x : (s/*1*/ + +////var y : (s:string, list/*2*/ + +test.markers().forEach((m) => { + goTo.position(m.position, m.fileName); + verify.not.completionListIsEmpty(); + verify.completionListAllowsNewIdentifier(); +}); \ No newline at end of file