diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 24174483fdc6d..07f390f03f4bf 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -409,6 +409,7 @@ namespace ts { const printerOptions: PrinterOptions = { removeComments: compilerOptions.removeComments, newLine: compilerOptions.newLine, + preserveSourceNewlines: true, noEmitHelpers: compilerOptions.noEmitHelpers, module: compilerOptions.module, target: compilerOptions.target, @@ -920,7 +921,7 @@ namespace ts { let containerEnd = -1; let declarationListContainerEnd = -1; let currentLineMap: readonly number[] | undefined; - let detachedCommentsInfo: { nodePos: number, detachedCommentEndPos: number}[] | undefined; + let detachedCommentsInfo: { nodePos: number, detachedCommentEndPos: number }[] | undefined; let hasWrittenComment = false; let commentsDisabled = !!printerOptions.removeComments; let lastNode: Node | undefined; @@ -4490,7 +4491,7 @@ namespace ts { // JsxText will be written with its leading whitespace, so don't add more manually. return 0; } - else if (!nodeIsSynthesized(previousNode) && !nodeIsSynthesized(nextNode) && previousNode.parent === nextNode.parent) { + else if (siblingNodePositionsAreComparable(previousNode, nextNode)) { if (preserveSourceNewlines) { return getEffectiveLines( includeComments => getLinesBetweenRangeEndAndRangeStart( @@ -4511,6 +4512,28 @@ namespace ts { return format & ListFormat.MultiLine ? 1 : 0; } + function siblingNodePositionsAreComparable(previousNode: Node, nextNode: Node) { + if (nodeIsSynthesized(previousNode) || nodeIsSynthesized(nextNode) || previousNode.parent !== nextNode.parent) { + return false; + } + + if (nextNode.pos < previousNode.end) { + return false; + } + + if (!previousNode.parent || !nextNode.parent) { + const previousParent = getOriginalNode(previousNode).parent; + return previousParent && previousParent === getOriginalNode(nextNode).parent; + } + + // Get the next specifier and compare against nextNode. If they are not equal, nodes have been rearranged and positions cannot be compared. + if (!nodeIsFirstNodeAtOrAfterPosition(currentSourceFile!, getOriginalNode(nextNode), previousNode.end)) { + return false; + } + + return true; + } + function getClosingLineTerminatorCount(parentNode: TextRange, children: readonly Node[], format: ListFormat): number { if (format & ListFormat.PreserveLines || preserveSourceNewlines) { if (format & ListFormat.PreferNewLine) { @@ -4661,7 +4684,7 @@ namespace ts { const text = isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode(textSourceNode); return jsxAttributeEscape ? `"${escapeJsxAttributeString(text)}"` : neverAsciiEscape || (getEmitFlags(node) & EmitFlags.NoAsciiEscaping) ? `"${escapeString(text)}"` : - `"${escapeNonAsciiString(text)}"`; + `"${escapeNonAsciiString(text)}"`; } else { return getLiteralTextOfNode(textSourceNode, neverAsciiEscape, jsxAttributeEscape); diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 0756ac92f3071..3c7ad8e4a9074 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -2355,22 +2355,6 @@ namespace ts { } } - /** Returns a token if position is in [start-of-leading-trivia, end), includes JSDoc only in JS files */ - function getNodeAtPosition(sourceFile: SourceFile, position: number): Node { - let current: Node = sourceFile; - const getContainingChild = (child: Node) => { - if (child.pos <= position && (position < child.end || (position === child.end && (child.kind === SyntaxKind.EndOfFileToken)))) { - return child; - } - }; - while (true) { - const child = isJavaScriptFile && hasJSDocNodes(current) && forEach(current.jsDoc, getContainingChild) || forEachChild(current, getContainingChild); - if (!child) { - return current; - } - current = child; - } - } } function getLibFileFromReference(ref: FileReference) { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index b40527cb03e53..8d3f9634c1ee2 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -7066,4 +7066,54 @@ namespace ts { return false; } } + + /** Returns a token if position is in [start-of-leading-trivia, end), includes JSDoc only in JS files */ + export function getNodeAtPosition(sourceFile: SourceFile, position: number): Node { + let current: Node = sourceFile; + const getContainingChild = (child: Node) => { + if (child.pos <= position && (position < child.end || (position === child.end && (child.kind === SyntaxKind.EndOfFileToken)))) { + return child; + } + }; + while (true) { + const child = isSourceFileJS(sourceFile) && hasJSDocNodes(current) && forEach(current.jsDoc, getContainingChild) || forEachChild(current, getContainingChild); + if (!child) { + return current; + } + current = child; + } + } + + export function nodeIsFirstNodeAtOrAfterPosition(sourceFile: SourceFile, node: Node, position: number): boolean { + if (node.pos === position) return true; + if (node.pos < position) return false; + let current: Node = sourceFile; + let next: Node | undefined; + const getContainingChild = (child: Node) => { + if (child.pos <= position && (position < child.end || (position === child.end && (child.kind === SyntaxKind.EndOfFileToken)))) { + return child; + } + else if (!next && child.pos > position) { + next = child; + } + }; + while (true) { + const child = isSourceFileJS(sourceFile) && hasJSDocNodes(current) && forEach(current.jsDoc, getContainingChild) || forEachChild(current, getContainingChild); + if (child === node || next === node) { + return true; + } + if (!child) { + if (next) { + // 'position' fell between two nodes (e.g., the comma between + // two ImportSpecifiers). Instead of stopping at the parent node, + // shift forward to the next node and continue searching there. + position = next.pos; + next = undefined; + continue; + } + return false; + } + current = child; + } + } } diff --git a/tests/baselines/reference/1.0lib-noErrors.js b/tests/baselines/reference/1.0lib-noErrors.js index 3dac98d9e5647..bc21f205bef2e 100644 --- a/tests/baselines/reference/1.0lib-noErrors.js +++ b/tests/baselines/reference/1.0lib-noErrors.js @@ -1158,4 +1158,42 @@ MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ + /// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/baselines/reference/APISample_Watch.js b/tests/baselines/reference/APISample_Watch.js index e675f2ec4eb47..bb63cc3f04135 100644 --- a/tests/baselines/reference/APISample_Watch.js +++ b/tests/baselines/reference/APISample_Watch.js @@ -90,12 +90,15 @@ watchMain(); * Please log a "breaking change" issue for any API breaking change affecting this issue */ exports.__esModule = true; + var ts = require("typescript"); + var formatHost = { getCanonicalFileName: function (path) { return path; }, getCurrentDirectory: ts.sys.getCurrentDirectory, getNewLine: function () { return ts.sys.newLine; } }; + function watchMain() { var configPath = ts.findConfigFile(/*searchPath*/ "./", ts.sys.fileExists, "tsconfig.json"); if (!configPath) { @@ -111,7 +114,12 @@ function watchMain() { // Between `createEmitAndSemanticDiagnosticsBuilderProgram` and `createSemanticDiagnosticsBuilderProgram`, the only difference is emit. // For pure type-checking scenarios, or when another tool/process handles emit, using `createSemanticDiagnosticsBuilderProgram` may be more desirable. // Note that there is another overload for `createWatchCompilerHost` that takes a set of root files. - var host = ts.createWatchCompilerHost(configPath, {}, ts.sys, ts.createSemanticDiagnosticsBuilderProgram, reportDiagnostic, reportWatchStatusChanged); + var host = ts.createWatchCompilerHost(configPath, {}, ts.sys, + ts.createSemanticDiagnosticsBuilderProgram, + reportDiagnostic, + reportWatchStatusChanged + ); + // You can technically override any given hook on the host, though you probably don't need to. // Note that we're assuming `origCreateProgram` and `origPostProgramCreate` doesn't use `this` at all. var origCreateProgram = host.createProgram; @@ -120,6 +128,7 @@ function watchMain() { return origCreateProgram(rootNames, options, host, oldProgram); }; var origPostProgramCreate = host.afterProgramCreate; + host.afterProgramCreate = function (program) { console.log("** We finished making the program! **"); origPostProgramCreate(program); @@ -127,9 +136,13 @@ function watchMain() { // `createWatchProgram` creates an initial program, watches files, and updates the program over time. ts.createWatchProgram(host); } + function reportDiagnostic(diagnostic) { - console.error("Error", diagnostic.code, ":", ts.flattenDiagnosticMessageText(diagnostic.messageText, formatHost.getNewLine())); + console.error("Error", diagnostic.code, ":", + ts.flattenDiagnosticMessageText(diagnostic.messageText, formatHost.getNewLine()) + ); } + /** * Prints a diagnostic every time the watch status changes. * This is mainly for messages like "Starting compilation" or "Compilation completed". diff --git a/tests/baselines/reference/APISample_WatchWithDefaults.js b/tests/baselines/reference/APISample_WatchWithDefaults.js index 63bfa4965e51e..c9a88678c8c4f 100644 --- a/tests/baselines/reference/APISample_WatchWithDefaults.js +++ b/tests/baselines/reference/APISample_WatchWithDefaults.js @@ -62,7 +62,9 @@ watchMain(); * Please log a "breaking change" issue for any API breaking change affecting this issue */ exports.__esModule = true; + var ts = require("typescript"); + function watchMain() { var configPath = ts.findConfigFile(/*searchPath*/ "./", ts.sys.fileExists, "tsconfig.json"); if (!configPath) { @@ -79,6 +81,7 @@ function watchMain() { // For pure type-checking scenarios, or when another tool/process handles emit, using `createSemanticDiagnosticsBuilderProgram` may be more desirable. // Note that there is another overload for `createWatchCompilerHost` that takes a set of root files. var host = ts.createWatchCompilerHost(configPath, {}, ts.sys); + // You can technically override any given hook on the host, though you probably don't need to. // Note that we're assuming `origCreateProgram` and `origPostProgramCreate` doesn't use `this` at all. var origCreateProgram = host.createProgram; @@ -87,6 +90,7 @@ function watchMain() { return origCreateProgram(rootNames, options, host, oldProgram); }; var origPostProgramCreate = host.afterProgramCreate; + host.afterProgramCreate = function (program) { console.log("** We finished making the program! **"); origPostProgramCreate(program); diff --git a/tests/baselines/reference/APISample_WatchWithOwnWatchHost.js b/tests/baselines/reference/APISample_WatchWithOwnWatchHost.js index 75444a614f952..25164e1c3b4c8 100644 --- a/tests/baselines/reference/APISample_WatchWithOwnWatchHost.js +++ b/tests/baselines/reference/APISample_WatchWithOwnWatchHost.js @@ -69,11 +69,14 @@ watchMain(); * Please log a "breaking change" issue for any API breaking change affecting this issue */ exports.__esModule = true; + var ts = require("typescript"); + function watchMain() { // get list of files and compiler options somehow var files = []; var options = {}; + var host = { rootFiles: files, options: options, @@ -91,6 +94,7 @@ function watchMain() { watchDirectory: ts.sys.watchDirectory, createProgram: ts.createAbstractBuilder }; + // You can technically override any given hook on the host, though you probably don't need to. // Note that we're assuming `origCreateProgram` and `origPostProgramCreate` doesn't use `this` at all. var origCreateProgram = host.createProgram; @@ -99,6 +103,7 @@ function watchMain() { return origCreateProgram(rootNames, options, host, oldProgram); }; var origPostProgramCreate = host.afterProgramCreate; + host.afterProgramCreate = function (program) { console.log("** We finished making the program! **"); origPostProgramCreate(program); diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 673dc047fa163..62eb61e2df2a5 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -54,10 +54,13 @@ compile(process.argv.slice(2), { */ exports.__esModule = true; exports.compile = void 0; + var ts = require("typescript"); + function compile(fileNames, options) { var program = ts.createProgram(fileNames, options); var emitResult = program.emit(); + var allDiagnostics = ts.getPreEmitDiagnostics(program); allDiagnostics.forEach(function (diagnostic) { var message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'); diff --git a/tests/baselines/reference/APISample_jsdoc.js b/tests/baselines/reference/APISample_jsdoc.js index 9c1dd5f824fdb..2b2b9ef6b92a8 100644 --- a/tests/baselines/reference/APISample_jsdoc.js +++ b/tests/baselines/reference/APISample_jsdoc.js @@ -129,19 +129,26 @@ function getSomeOtherTags(node: ts.Node) { * Please log a "breaking change" issue for any API breaking change affecting this issue */ exports.__esModule = true; + var ts = require("typescript"); + // excerpted from https://github.com/YousefED/typescript-json-schema // (converted from a method and modified; for example, `this: any` to compensate, among other changes) -function parseCommentsIntoDefinition(symbol, definition, otherAnnotations) { +function parseCommentsIntoDefinition( +symbol, + definition, + otherAnnotations) { var _this = this; if (!symbol) { return; } // the comments for a symbol var comments = symbol.getDocumentationComment(undefined); + if (comments.length) { definition.description = comments.map(function (comment) { return comment.kind === "lineBreak" ? comment.text : comment.text.trim().replace(/\r\n/g, "\n"); }).join(""); } + // jsdocs are separate from comments var jsdocs = symbol.getJsDocTags(); jsdocs.forEach(function (doc) { @@ -149,13 +156,14 @@ function parseCommentsIntoDefinition(symbol, definition, otherAnnotations) { var name = doc.name, text = doc.text; if (_this.userValidationKeywords[name]) { definition[name] = _this.parseValue(text); - } - else { + } else { // special annotations otherAnnotations[doc.name] = true; } }); } + + function getAnnotations(node) { var _this = this; var symbol = node.symbol; @@ -171,10 +179,12 @@ function getAnnotations(node) { if (value !== undefined) { result[jsDocTag.name] = value; } + return result; }, {}); return Object.keys(annotations).length ? annotations : undefined; } + // these examples are artificial and mostly nonsensical function parseSpecificTags(node) { if (node.kind === ts.SyntaxKind.Parameter) { @@ -193,6 +203,7 @@ function parseSpecificTags(node) { } } } + function getReturnTypeFromJSDoc(node) { if (node.kind === ts.SyntaxKind.FunctionDeclaration) { return ts.getJSDocReturnType(node); @@ -202,9 +213,11 @@ function getReturnTypeFromJSDoc(node) { return type.type; } } + function getAllTags(node) { ts.getJSDocTags(node); } + function getSomeOtherTags(node) { var tags = []; tags.push(ts.getJSDocAugmentsTag(node)); diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index a51c9cde268b7..20e22c35a0be9 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -79,7 +79,9 @@ fileNames.forEach(fileName => { */ exports.__esModule = true; exports.delint = void 0; + var ts = require("typescript"); + function delint(sourceFile) { delintNode(sourceFile); function delintNode(node) { @@ -92,6 +94,7 @@ function delint(sourceFile) { report(node, "A looping statement's contents should be wrapped in a block body."); } break; + case ts.SyntaxKind.IfStatement: var ifStatement = node; if (ifStatement.thenStatement.kind !== ts.SyntaxKind.Block) { @@ -103,6 +106,7 @@ function delint(sourceFile) { report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body."); } break; + case ts.SyntaxKind.BinaryExpression: var op = node.operatorToken.kind; if (op === ts.SyntaxKind.EqualsEqualsToken || op == ts.SyntaxKind.ExclamationEqualsToken) { @@ -112,6 +116,7 @@ function delint(sourceFile) { } ts.forEachChild(node, delintNode); } + function report(node, message) { var _a = sourceFile.getLineAndCharacterOfPosition(node.getStart()), line = _a.line, character = _a.character; console.log(sourceFile.fileName + " (" + (line + 1) + "," + (character + 1) + "): " + message); diff --git a/tests/baselines/reference/APISample_parseConfig.js b/tests/baselines/reference/APISample_parseConfig.js index ffd27fdbabbcf..931569c991426 100644 --- a/tests/baselines/reference/APISample_parseConfig.js +++ b/tests/baselines/reference/APISample_parseConfig.js @@ -51,13 +51,16 @@ export function createProgram(rootFiles: string[], compilerOptionsJson: string): */ exports.__esModule = true; exports.createProgram = void 0; + var ts = require("typescript"); + function printError(error) { if (!error) { return; } console.log((error.file && error.file.fileName) + ": " + error.messageText); } + function createProgram(rootFiles, compilerOptionsJson) { var _a = ts.parseConfigFileTextToJson("tsconfig.json", compilerOptionsJson), config = _a.config, error = _a.error; if (error) { diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index db25c1bd1dd06..965132ff1b1fe 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -30,7 +30,10 @@ console.log(JSON.stringify(result)); * Please log a "breaking change" issue for any API breaking change affecting this issue */ exports.__esModule = true; + var ts = require("typescript"); + var source = "let x: string = 'string'"; + var result = ts.transpile(source, { module: ts.ModuleKind.CommonJS }); console.log(JSON.stringify(result)); diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index e93856a31656b..c3d48c4d84bbc 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -124,13 +124,17 @@ watch(currentDirectoryFiles, { module: ts.ModuleKind.CommonJS }); * Please log a "breaking change" issue for any API breaking change affecting this issue */ exports.__esModule = true; + var ts = require("typescript"); + function watch(rootFileNames, options) { var files = {}; + // initialize the list of files rootFileNames.forEach(function (fileName) { files[fileName] = { version: 0 }; }); + // Create the language service host to allow the LS to communicate with the host var servicesHost = { getScriptFileNames: function () { return rootFileNames; }, @@ -139,32 +143,40 @@ function watch(rootFileNames, options) { if (!fs.existsSync(fileName)) { return undefined; } + return ts.ScriptSnapshot.fromString(fs.readFileSync(fileName).toString()); }, getCurrentDirectory: function () { return process.cwd(); }, getCompilationSettings: function () { return options; }, getDefaultLibFileName: function (options) { return ts.getDefaultLibFilePath(options); } }; + // Create the language service files var services = ts.createLanguageService(servicesHost, ts.createDocumentRegistry()); + // Now let's watch the files rootFileNames.forEach(function (fileName) { // First time around, emit all files emitFile(fileName); // Add a watch on the file to handle next change - fs.watchFile(fileName, { persistent: true, interval: 250 }, function (curr, prev) { + fs.watchFile(fileName, + { persistent: true, interval: 250 }, function (curr, prev) { // Check timestamp if (+curr.mtime <= +prev.mtime) { return; } + // Update the version to signal a change in the file files[fileName].version++; + // write the changes to disk emitFile(fileName); }); }); + function emitFile(fileName) { var output = services.getEmitOutput(fileName); + if (!output.emitSkipped) { console.log("Emitting " + fileName); } @@ -172,14 +184,17 @@ function watch(rootFileNames, options) { console.log("Emitting " + fileName + " failed"); logErrors(fileName); } + output.outputFiles.forEach(function (o) { fs.writeFileSync(o.name, o.text, "utf8"); }); } + function logErrors(fileName) { var allDiagnostics = services.getCompilerOptionsDiagnostics() .concat(services.getSyntacticDiagnostics(fileName)) .concat(services.getSemanticDiagnostics(fileName)); + allDiagnostics.forEach(function (diagnostic) { var message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"); if (diagnostic.file) { @@ -192,6 +207,7 @@ function watch(rootFileNames, options) { }); } } + // Initialize files constituting the program as all .ts files in the current directory var currentDirectoryFiles = fs.readdirSync(process.cwd()). filter(function (fileName) { return fileName.length >= 3 && fileName.substr(fileName.length - 3, 3) === ".ts"; }); diff --git a/tests/baselines/reference/ArrowFunction3.js b/tests/baselines/reference/ArrowFunction3.js index 41182da2eeddb..0189786bd6eb0 100644 --- a/tests/baselines/reference/ArrowFunction3.js +++ b/tests/baselines/reference/ArrowFunction3.js @@ -4,7 +4,5 @@ var v = (a): => { }; //// [ArrowFunction3.js] -var v = (a); -{ -} -; +var v = (a);{ +}; diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js b/tests/baselines/reference/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js index f266c117dff68..28ffb1b9b59bd 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js @@ -51,6 +51,7 @@ module clodule4 { //// [ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js] // all expected to be errors + var clodule1 = /** @class */ (function () { function clodule1() { } @@ -66,6 +67,7 @@ var clodule2 = /** @class */ (function () { }()); (function (clodule2) { var x; + var D = /** @class */ (function () { function D() { } diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js index db07e83eb7f81..2059040f7b409 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js @@ -35,8 +35,7 @@ var Point = /** @class */ (function () { Point.Origin = ""; //expected duplicate identifier error })(Point || (Point = {})); var A; -(function (A) { - var Point = /** @class */ (function () { +(function (A) {var Point = /** @class */ (function () { function Point(x, y) { this.x = x; this.y = y; diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.js index 246acf9af117b..1f88b392dcf9d 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.js @@ -35,8 +35,7 @@ var Point = /** @class */ (function () { var Origin = ""; // not an error, since not exported })(Point || (Point = {})); var A; -(function (A) { - var Point = /** @class */ (function () { +(function (A) {var Point = /** @class */ (function () { function Point(x, y) { this.x = x; this.y = y; diff --git a/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.js b/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.js index a6ca39648ae61..419372c511054 100644 --- a/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.js @@ -42,8 +42,7 @@ var a: { id: string }; //// [class.js] var X; -(function (X) { - var Y; +(function (X) {var Y; (function (Y) { var Point = /** @class */ (function () { function Point(x, y) { @@ -57,10 +56,8 @@ var X; })(X || (X = {})); //// [module.js] var X; -(function (X) { - var Y; - (function (Y) { - var Point; +(function (X) {var Y; + (function (Y) {var Point; (function (Point) { Point.Origin = new Point(0, 0); })(Point = Y.Point || (Y.Point = {})); diff --git a/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRootES6.js b/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRootES6.js index 9187c99c84038..e5d66bc465516 100644 --- a/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRootES6.js +++ b/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRootES6.js @@ -42,8 +42,7 @@ var a: { id: string }; //// [class.js] var X; -(function (X) { - var Y; +(function (X) {var Y; (function (Y) { class Point { constructor(x, y) { @@ -56,10 +55,8 @@ var X; })(X || (X = {})); //// [module.js] var X; -(function (X) { - var Y; - (function (Y) { - let Point; +(function (X) {var Y; + (function (Y) {let Point; (function (Point) { Point.Origin = new Point(0, 0); })(Point = Y.Point || (Y.Point = {})); @@ -69,6 +66,7 @@ var X; //var cl: { x: number; y: number; } var cl = new X.Y.Point(1, 1); var cl = X.Y.Point.Origin; // error not expected here same as bug 83996 ? + //// [simple.js] class A { } diff --git a/tests/baselines/reference/ClassDeclaration15.js b/tests/baselines/reference/ClassDeclaration15.js index f5040f9c63b93..728be72d0fc2b 100644 --- a/tests/baselines/reference/ClassDeclaration15.js +++ b/tests/baselines/reference/ClassDeclaration15.js @@ -6,7 +6,6 @@ class C { //// [ClassDeclaration15.js] var C = /** @class */ (function () { - function C() { - } + function C() {} return C; }()); diff --git a/tests/baselines/reference/ES5For-of33.js b/tests/baselines/reference/ES5For-of33.js index e177630b00c47..b5d2235b0d445 100644 --- a/tests/baselines/reference/ES5For-of33.js +++ b/tests/baselines/reference/ES5For-of33.js @@ -21,12 +21,7 @@ try { var v = _c.value; console.log(v); } -} -catch (e_1_1) { e_1 = { error: e_1_1 }; } -finally { - try { - if (_c && !_c.done && (_a = _b["return"])) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } +} catch (e_1_1) { e_1 = { error: e_1_1 }; } finally {try {if (_c && !_c.done && (_a = _b["return"])) _a.call(_b); + } finally { if (e_1) throw e_1.error; } } //# sourceMappingURL=ES5For-of33.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of33.js.map b/tests/baselines/reference/ES5For-of33.js.map index 879d181e5fa9d..4284928a6cd54 100644 --- a/tests/baselines/reference/ES5For-of33.js.map +++ b/tests/baselines/reference/ES5For-of33.js.map @@ -1,3 +1,3 @@ //// [ES5For-of33.js.map] {"version":3,"file":"ES5For-of33.js","sourceRoot":"","sources":["ES5For-of33.ts"],"names":[],"mappings":";;;;;;;;;;;;;IAAA,KAAc,IAAA,KAAA,SAAA,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA,gBAAA,4BAAE;QAA1B,IAAI,CAAC,WAAA;QACN,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KAClB"} -//// https://sokra.github.io/source-map-visualization#base64,dmFyIF9fdmFsdWVzID0gKHRoaXMgJiYgdGhpcy5fX3ZhbHVlcykgfHwgZnVuY3Rpb24obykgew0KICAgIHZhciBzID0gdHlwZW9mIFN5bWJvbCA9PT0gImZ1bmN0aW9uIiAmJiBTeW1ib2wuaXRlcmF0b3IsIG0gPSBzICYmIG9bc10sIGkgPSAwOw0KICAgIGlmIChtKSByZXR1cm4gbS5jYWxsKG8pOw0KICAgIGlmIChvICYmIHR5cGVvZiBvLmxlbmd0aCA9PT0gIm51bWJlciIpIHJldHVybiB7DQogICAgICAgIG5leHQ6IGZ1bmN0aW9uICgpIHsNCiAgICAgICAgICAgIGlmIChvICYmIGkgPj0gby5sZW5ndGgpIG8gPSB2b2lkIDA7DQogICAgICAgICAgICByZXR1cm4geyB2YWx1ZTogbyAmJiBvW2krK10sIGRvbmU6ICFvIH07DQogICAgICAgIH0NCiAgICB9Ow0KICAgIHRocm93IG5ldyBUeXBlRXJyb3IocyA/ICJPYmplY3QgaXMgbm90IGl0ZXJhYmxlLiIgOiAiU3ltYm9sLml0ZXJhdG9yIGlzIG5vdCBkZWZpbmVkLiIpOw0KfTsNCnZhciBlXzEsIF9hOw0KdHJ5IHsNCiAgICBmb3IgKHZhciBfYiA9IF9fdmFsdWVzKFsnYScsICdiJywgJ2MnXSksIF9jID0gX2IubmV4dCgpOyAhX2MuZG9uZTsgX2MgPSBfYi5uZXh0KCkpIHsNCiAgICAgICAgdmFyIHYgPSBfYy52YWx1ZTsNCiAgICAgICAgY29uc29sZS5sb2codik7DQogICAgfQ0KfQ0KY2F0Y2ggKGVfMV8xKSB7IGVfMSA9IHsgZXJyb3I6IGVfMV8xIH07IH0NCmZpbmFsbHkgew0KICAgIHRyeSB7DQogICAgICAgIGlmIChfYyAmJiAhX2MuZG9uZSAmJiAoX2EgPSBfYlsicmV0dXJuIl0pKSBfYS5jYWxsKF9iKTsNCiAgICB9DQogICAgZmluYWxseSB7IGlmIChlXzEpIHRocm93IGVfMS5lcnJvcjsgfQ0KfQ0KLy8jIHNvdXJjZU1hcHBpbmdVUkw9RVM1Rm9yLW9mMzMuanMubWFw,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRVM1Rm9yLW9mMzMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJFUzVGb3Itb2YzMy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7O0lBQUEsS0FBYyxJQUFBLEtBQUEsU0FBQSxDQUFDLEdBQUcsRUFBRSxHQUFHLEVBQUUsR0FBRyxDQUFDLENBQUEsZ0JBQUEsNEJBQUU7UUFBMUIsSUFBSSxDQUFDLFdBQUE7UUFDTixPQUFPLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDO0tBQ2xCIn0=,Zm9yICh2YXIgdiBvZiBbJ2EnLCAnYicsICdjJ10pIHsKICAgIGNvbnNvbGUubG9nKHYpOwp9 +//// https://sokra.github.io/source-map-visualization#base64,dmFyIF9fdmFsdWVzID0gKHRoaXMgJiYgdGhpcy5fX3ZhbHVlcykgfHwgZnVuY3Rpb24obykgew0KICAgIHZhciBzID0gdHlwZW9mIFN5bWJvbCA9PT0gImZ1bmN0aW9uIiAmJiBTeW1ib2wuaXRlcmF0b3IsIG0gPSBzICYmIG9bc10sIGkgPSAwOw0KICAgIGlmIChtKSByZXR1cm4gbS5jYWxsKG8pOw0KICAgIGlmIChvICYmIHR5cGVvZiBvLmxlbmd0aCA9PT0gIm51bWJlciIpIHJldHVybiB7DQogICAgICAgIG5leHQ6IGZ1bmN0aW9uICgpIHsNCiAgICAgICAgICAgIGlmIChvICYmIGkgPj0gby5sZW5ndGgpIG8gPSB2b2lkIDA7DQogICAgICAgICAgICByZXR1cm4geyB2YWx1ZTogbyAmJiBvW2krK10sIGRvbmU6ICFvIH07DQogICAgICAgIH0NCiAgICB9Ow0KICAgIHRocm93IG5ldyBUeXBlRXJyb3IocyA/ICJPYmplY3QgaXMgbm90IGl0ZXJhYmxlLiIgOiAiU3ltYm9sLml0ZXJhdG9yIGlzIG5vdCBkZWZpbmVkLiIpOw0KfTsNCnZhciBlXzEsIF9hOw0KdHJ5IHsNCiAgICBmb3IgKHZhciBfYiA9IF9fdmFsdWVzKFsnYScsICdiJywgJ2MnXSksIF9jID0gX2IubmV4dCgpOyAhX2MuZG9uZTsgX2MgPSBfYi5uZXh0KCkpIHsNCiAgICAgICAgdmFyIHYgPSBfYy52YWx1ZTsNCiAgICAgICAgY29uc29sZS5sb2codik7DQogICAgfQ0KfSBjYXRjaCAoZV8xXzEpIHsgZV8xID0geyBlcnJvcjogZV8xXzEgfTsgfSBmaW5hbGx5IHt0cnkge2lmIChfYyAmJiAhX2MuZG9uZSAmJiAoX2EgPSBfYlsicmV0dXJuIl0pKSBfYS5jYWxsKF9iKTsNCiAgICB9IGZpbmFsbHkgeyBpZiAoZV8xKSB0aHJvdyBlXzEuZXJyb3I7IH0NCn0NCi8vIyBzb3VyY2VNYXBwaW5nVVJMPUVTNUZvci1vZjMzLmpzLm1hcA==,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRVM1Rm9yLW9mMzMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJFUzVGb3Itb2YzMy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7O0lBQUEsS0FBYyxJQUFBLEtBQUEsU0FBQSxDQUFDLEdBQUcsRUFBRSxHQUFHLEVBQUUsR0FBRyxDQUFDLENBQUEsZ0JBQUEsNEJBQUU7UUFBMUIsSUFBSSxDQUFDLFdBQUE7UUFDTixPQUFPLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDO0tBQ2xCIn0=,Zm9yICh2YXIgdiBvZiBbJ2EnLCAnYicsICdjJ10pIHsKICAgIGNvbnNvbGUubG9nKHYpOwp9 diff --git a/tests/baselines/reference/ES5For-of33.sourcemap.txt b/tests/baselines/reference/ES5For-of33.sourcemap.txt index b1be3f06d4549..376a1bd701ca6 100644 --- a/tests/baselines/reference/ES5For-of33.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of33.sourcemap.txt @@ -111,16 +111,12 @@ sourceFile:ES5For-of33.ts --- >>> } 1 >^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > >} 1 >Emitted(17, 6) Source(3, 2) + SourceIndex(0) --- ->>>} ->>>catch (e_1_1) { e_1 = { error: e_1_1 }; } ->>>finally { ->>> try { ->>> if (_c && !_c.done && (_a = _b["return"])) _a.call(_b); ->>> } ->>> finally { if (e_1) throw e_1.error; } +>>>} catch (e_1_1) { e_1 = { error: e_1_1 }; } finally {try {if (_c && !_c.done && (_a = _b["return"])) _a.call(_b); +>>> } finally { if (e_1) throw e_1.error; } >>>} >>>//# sourceMappingURL=ES5For-of33.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of34.js b/tests/baselines/reference/ES5For-of34.js index 2f0ee24e3d815..8487449d514d9 100644 --- a/tests/baselines/reference/ES5For-of34.js +++ b/tests/baselines/reference/ES5For-of34.js @@ -27,12 +27,7 @@ try { foo().x = _c.value; var p = foo().x; } -} -catch (e_1_1) { e_1 = { error: e_1_1 }; } -finally { - try { - if (_c && !_c.done && (_a = _b["return"])) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } +} catch (e_1_1) { e_1 = { error: e_1_1 }; } finally {try {if (_c && !_c.done && (_a = _b["return"])) _a.call(_b); + } finally { if (e_1) throw e_1.error; } } //# sourceMappingURL=ES5For-of34.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of34.js.map b/tests/baselines/reference/ES5For-of34.js.map index 731837e75cd87..326c8e5251a8f 100644 --- a/tests/baselines/reference/ES5For-of34.js.map +++ b/tests/baselines/reference/ES5For-of34.js.map @@ -1,3 +1,3 @@ //// [ES5For-of34.js.map] {"version":3,"file":"ES5For-of34.js","sourceRoot":"","sources":["ES5For-of34.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,SAAS,GAAG;IACR,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACpB,CAAC;;IACD,KAAgB,IAAA,KAAA,SAAA,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA,gBAAA,4BAAE;QAA5B,GAAG,EAAE,CAAC,CAAC,WAAA;QACR,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;KACnB"} -//// https://sokra.github.io/source-map-visualization#base64,dmFyIF9fdmFsdWVzID0gKHRoaXMgJiYgdGhpcy5fX3ZhbHVlcykgfHwgZnVuY3Rpb24obykgew0KICAgIHZhciBzID0gdHlwZW9mIFN5bWJvbCA9PT0gImZ1bmN0aW9uIiAmJiBTeW1ib2wuaXRlcmF0b3IsIG0gPSBzICYmIG9bc10sIGkgPSAwOw0KICAgIGlmIChtKSByZXR1cm4gbS5jYWxsKG8pOw0KICAgIGlmIChvICYmIHR5cGVvZiBvLmxlbmd0aCA9PT0gIm51bWJlciIpIHJldHVybiB7DQogICAgICAgIG5leHQ6IGZ1bmN0aW9uICgpIHsNCiAgICAgICAgICAgIGlmIChvICYmIGkgPj0gby5sZW5ndGgpIG8gPSB2b2lkIDA7DQogICAgICAgICAgICByZXR1cm4geyB2YWx1ZTogbyAmJiBvW2krK10sIGRvbmU6ICFvIH07DQogICAgICAgIH0NCiAgICB9Ow0KICAgIHRocm93IG5ldyBUeXBlRXJyb3IocyA/ICJPYmplY3QgaXMgbm90IGl0ZXJhYmxlLiIgOiAiU3ltYm9sLml0ZXJhdG9yIGlzIG5vdCBkZWZpbmVkLiIpOw0KfTsNCnZhciBlXzEsIF9hOw0KZnVuY3Rpb24gZm9vKCkgew0KICAgIHJldHVybiB7IHg6IDAgfTsNCn0NCnRyeSB7DQogICAgZm9yICh2YXIgX2IgPSBfX3ZhbHVlcyhbJ2EnLCAnYicsICdjJ10pLCBfYyA9IF9iLm5leHQoKTsgIV9jLmRvbmU7IF9jID0gX2IubmV4dCgpKSB7DQogICAgICAgIGZvbygpLnggPSBfYy52YWx1ZTsNCiAgICAgICAgdmFyIHAgPSBmb28oKS54Ow0KICAgIH0NCn0NCmNhdGNoIChlXzFfMSkgeyBlXzEgPSB7IGVycm9yOiBlXzFfMSB9OyB9DQpmaW5hbGx5IHsNCiAgICB0cnkgew0KICAgICAgICBpZiAoX2MgJiYgIV9jLmRvbmUgJiYgKF9hID0gX2JbInJldHVybiJdKSkgX2EuY2FsbChfYik7DQogICAgfQ0KICAgIGZpbmFsbHkgeyBpZiAoZV8xKSB0aHJvdyBlXzEuZXJyb3I7IH0NCn0NCi8vIyBzb3VyY2VNYXBwaW5nVVJMPUVTNUZvci1vZjM0LmpzLm1hcA==,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRVM1Rm9yLW9mMzQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJFUzVGb3Itb2YzNC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7QUFBQSxTQUFTLEdBQUc7SUFDUixPQUFPLEVBQUUsQ0FBQyxFQUFFLENBQUMsRUFBRSxDQUFDO0FBQ3BCLENBQUM7O0lBQ0QsS0FBZ0IsSUFBQSxLQUFBLFNBQUEsQ0FBQyxHQUFHLEVBQUUsR0FBRyxFQUFFLEdBQUcsQ0FBQyxDQUFBLGdCQUFBLDRCQUFFO1FBQTVCLEdBQUcsRUFBRSxDQUFDLENBQUMsV0FBQTtRQUNSLElBQUksQ0FBQyxHQUFHLEdBQUcsRUFBRSxDQUFDLENBQUMsQ0FBQztLQUNuQiJ9,ZnVuY3Rpb24gZm9vKCkgewogICAgcmV0dXJuIHsgeDogMCB9Owp9CmZvciAoZm9vKCkueCBvZiBbJ2EnLCAnYicsICdjJ10pIHsKICAgIHZhciBwID0gZm9vKCkueDsKfQ== +//// https://sokra.github.io/source-map-visualization#base64,dmFyIF9fdmFsdWVzID0gKHRoaXMgJiYgdGhpcy5fX3ZhbHVlcykgfHwgZnVuY3Rpb24obykgew0KICAgIHZhciBzID0gdHlwZW9mIFN5bWJvbCA9PT0gImZ1bmN0aW9uIiAmJiBTeW1ib2wuaXRlcmF0b3IsIG0gPSBzICYmIG9bc10sIGkgPSAwOw0KICAgIGlmIChtKSByZXR1cm4gbS5jYWxsKG8pOw0KICAgIGlmIChvICYmIHR5cGVvZiBvLmxlbmd0aCA9PT0gIm51bWJlciIpIHJldHVybiB7DQogICAgICAgIG5leHQ6IGZ1bmN0aW9uICgpIHsNCiAgICAgICAgICAgIGlmIChvICYmIGkgPj0gby5sZW5ndGgpIG8gPSB2b2lkIDA7DQogICAgICAgICAgICByZXR1cm4geyB2YWx1ZTogbyAmJiBvW2krK10sIGRvbmU6ICFvIH07DQogICAgICAgIH0NCiAgICB9Ow0KICAgIHRocm93IG5ldyBUeXBlRXJyb3IocyA/ICJPYmplY3QgaXMgbm90IGl0ZXJhYmxlLiIgOiAiU3ltYm9sLml0ZXJhdG9yIGlzIG5vdCBkZWZpbmVkLiIpOw0KfTsNCnZhciBlXzEsIF9hOw0KZnVuY3Rpb24gZm9vKCkgew0KICAgIHJldHVybiB7IHg6IDAgfTsNCn0NCnRyeSB7DQogICAgZm9yICh2YXIgX2IgPSBfX3ZhbHVlcyhbJ2EnLCAnYicsICdjJ10pLCBfYyA9IF9iLm5leHQoKTsgIV9jLmRvbmU7IF9jID0gX2IubmV4dCgpKSB7DQogICAgICAgIGZvbygpLnggPSBfYy52YWx1ZTsNCiAgICAgICAgdmFyIHAgPSBmb28oKS54Ow0KICAgIH0NCn0gY2F0Y2ggKGVfMV8xKSB7IGVfMSA9IHsgZXJyb3I6IGVfMV8xIH07IH0gZmluYWxseSB7dHJ5IHtpZiAoX2MgJiYgIV9jLmRvbmUgJiYgKF9hID0gX2JbInJldHVybiJdKSkgX2EuY2FsbChfYik7DQogICAgfSBmaW5hbGx5IHsgaWYgKGVfMSkgdGhyb3cgZV8xLmVycm9yOyB9DQp9DQovLyMgc291cmNlTWFwcGluZ1VSTD1FUzVGb3Itb2YzNC5qcy5tYXA=,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRVM1Rm9yLW9mMzQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJFUzVGb3Itb2YzNC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7QUFBQSxTQUFTLEdBQUc7SUFDUixPQUFPLEVBQUUsQ0FBQyxFQUFFLENBQUMsRUFBRSxDQUFDO0FBQ3BCLENBQUM7O0lBQ0QsS0FBZ0IsSUFBQSxLQUFBLFNBQUEsQ0FBQyxHQUFHLEVBQUUsR0FBRyxFQUFFLEdBQUcsQ0FBQyxDQUFBLGdCQUFBLDRCQUFFO1FBQTVCLEdBQUcsRUFBRSxDQUFDLENBQUMsV0FBQTtRQUNSLElBQUksQ0FBQyxHQUFHLEdBQUcsRUFBRSxDQUFDLENBQUMsQ0FBQztLQUNuQiJ9,ZnVuY3Rpb24gZm9vKCkgewogICAgcmV0dXJuIHsgeDogMCB9Owp9CmZvciAoZm9vKCkueCBvZiBbJ2EnLCAnYicsICdjJ10pIHsKICAgIHZhciBwID0gZm9vKCkueDsKfQ== diff --git a/tests/baselines/reference/ES5For-of34.sourcemap.txt b/tests/baselines/reference/ES5For-of34.sourcemap.txt index 5694d550cf665..31d791fce48a5 100644 --- a/tests/baselines/reference/ES5For-of34.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of34.sourcemap.txt @@ -170,16 +170,12 @@ sourceFile:ES5For-of34.ts --- >>> } 1 >^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > >} 1 >Emitted(20, 6) Source(6, 2) + SourceIndex(0) --- ->>>} ->>>catch (e_1_1) { e_1 = { error: e_1_1 }; } ->>>finally { ->>> try { ->>> if (_c && !_c.done && (_a = _b["return"])) _a.call(_b); ->>> } ->>> finally { if (e_1) throw e_1.error; } +>>>} catch (e_1_1) { e_1 = { error: e_1_1 }; } finally {try {if (_c && !_c.done && (_a = _b["return"])) _a.call(_b); +>>> } finally { if (e_1) throw e_1.error; } >>>} >>>//# sourceMappingURL=ES5For-of34.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of35.js b/tests/baselines/reference/ES5For-of35.js index fb0ac5d2d2b82..aef6639d1d1da 100644 --- a/tests/baselines/reference/ES5For-of35.js +++ b/tests/baselines/reference/ES5For-of35.js @@ -18,17 +18,11 @@ var __values = (this && this.__values) || function(o) { }; var e_1, _a; try { - for (var _b = __values([2, 3]), _c = _b.next(); !_c.done; _c = _b.next()) { - var _d = _c.value, _e = _d.x, a = _e === void 0 ? 0 : _e, _f = _d.y, b = _f === void 0 ? 1 : _f; + for (var _b = __values([2, 3]), _c = _b.next(); !_c.done; _c = _b.next()) {var _d = _c.value, _e = _d.x, a = _e === void 0 ? 0 : _e, _f = _d.y, b = _f === void 0 ? 1 : _f; a; b; } -} -catch (e_1_1) { e_1 = { error: e_1_1 }; } -finally { - try { - if (_c && !_c.done && (_a = _b["return"])) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } +} catch (e_1_1) { e_1 = { error: e_1_1 }; } finally {try {if (_c && !_c.done && (_a = _b["return"])) _a.call(_b); + } finally { if (e_1) throw e_1.error; } } //# sourceMappingURL=ES5For-of35.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of35.js.map b/tests/baselines/reference/ES5For-of35.js.map index 82dd37421f79f..d54ea03c6fb50 100644 --- a/tests/baselines/reference/ES5For-of35.js.map +++ b/tests/baselines/reference/ES5For-of35.js.map @@ -1,3 +1,3 @@ //// [ES5For-of35.js.map] -{"version":3,"file":"ES5For-of35.js","sourceRoot":"","sources":["ES5For-of35.ts"],"names":[],"mappings":";;;;;;;;;;;;;IAAA,KAAmC,IAAA,KAAA,SAAA,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,gBAAA,4BAAE;QAAhC,IAAA,aAAoB,EAAnB,SAAQ,EAAL,CAAC,mBAAG,CAAC,KAAA,EAAE,SAAQ,EAAL,CAAC,mBAAG,CAAC,KAAA;QAC1B,CAAC,CAAC;QACF,CAAC,CAAC;KACL"} -//// https://sokra.github.io/source-map-visualization#base64,dmFyIF9fdmFsdWVzID0gKHRoaXMgJiYgdGhpcy5fX3ZhbHVlcykgfHwgZnVuY3Rpb24obykgew0KICAgIHZhciBzID0gdHlwZW9mIFN5bWJvbCA9PT0gImZ1bmN0aW9uIiAmJiBTeW1ib2wuaXRlcmF0b3IsIG0gPSBzICYmIG9bc10sIGkgPSAwOw0KICAgIGlmIChtKSByZXR1cm4gbS5jYWxsKG8pOw0KICAgIGlmIChvICYmIHR5cGVvZiBvLmxlbmd0aCA9PT0gIm51bWJlciIpIHJldHVybiB7DQogICAgICAgIG5leHQ6IGZ1bmN0aW9uICgpIHsNCiAgICAgICAgICAgIGlmIChvICYmIGkgPj0gby5sZW5ndGgpIG8gPSB2b2lkIDA7DQogICAgICAgICAgICByZXR1cm4geyB2YWx1ZTogbyAmJiBvW2krK10sIGRvbmU6ICFvIH07DQogICAgICAgIH0NCiAgICB9Ow0KICAgIHRocm93IG5ldyBUeXBlRXJyb3IocyA/ICJPYmplY3QgaXMgbm90IGl0ZXJhYmxlLiIgOiAiU3ltYm9sLml0ZXJhdG9yIGlzIG5vdCBkZWZpbmVkLiIpOw0KfTsNCnZhciBlXzEsIF9hOw0KdHJ5IHsNCiAgICBmb3IgKHZhciBfYiA9IF9fdmFsdWVzKFsyLCAzXSksIF9jID0gX2IubmV4dCgpOyAhX2MuZG9uZTsgX2MgPSBfYi5uZXh0KCkpIHsNCiAgICAgICAgdmFyIF9kID0gX2MudmFsdWUsIF9lID0gX2QueCwgYSA9IF9lID09PSB2b2lkIDAgPyAwIDogX2UsIF9mID0gX2QueSwgYiA9IF9mID09PSB2b2lkIDAgPyAxIDogX2Y7DQogICAgICAgIGE7DQogICAgICAgIGI7DQogICAgfQ0KfQ0KY2F0Y2ggKGVfMV8xKSB7IGVfMSA9IHsgZXJyb3I6IGVfMV8xIH07IH0NCmZpbmFsbHkgew0KICAgIHRyeSB7DQogICAgICAgIGlmIChfYyAmJiAhX2MuZG9uZSAmJiAoX2EgPSBfYlsicmV0dXJuIl0pKSBfYS5jYWxsKF9iKTsNCiAgICB9DQogICAgZmluYWxseSB7IGlmIChlXzEpIHRocm93IGVfMS5lcnJvcjsgfQ0KfQ0KLy8jIHNvdXJjZU1hcHBpbmdVUkw9RVM1Rm9yLW9mMzUuanMubWFw,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRVM1Rm9yLW9mMzUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJFUzVGb3Itb2YzNS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7O0lBQUEsS0FBbUMsSUFBQSxLQUFBLFNBQUEsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUEsZ0JBQUEsNEJBQUU7UUFBaEMsSUFBQSxhQUFvQixFQUFuQixTQUFRLEVBQUwsQ0FBQyxtQkFBRyxDQUFDLEtBQUEsRUFBRSxTQUFRLEVBQUwsQ0FBQyxtQkFBRyxDQUFDLEtBQUE7UUFDMUIsQ0FBQyxDQUFDO1FBQ0YsQ0FBQyxDQUFDO0tBQ0wifQ==,Zm9yIChjb25zdCB7eDogYSA9IDAsIHk6IGIgPSAxfSBvZiBbMiwgM10pIHsKICAgIGE7CiAgICBiOwp9 +{"version":3,"file":"ES5For-of35.js","sourceRoot":"","sources":["ES5For-of35.ts"],"names":[],"mappings":";;;;;;;;;;;;;IAAA,KAAmC,IAAA,KAAA,SAAA,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,gBAAA,4BAAE,CAAhC,IAAA,aAAoB,EAAnB,SAAQ,EAAL,CAAC,mBAAG,CAAC,KAAA,EAAE,SAAQ,EAAL,CAAC,mBAAG,CAAC,KAAA;QAC1B,CAAC,CAAC;QACF,CAAC,CAAC;KACL"} +//// https://sokra.github.io/source-map-visualization#base64,dmFyIF9fdmFsdWVzID0gKHRoaXMgJiYgdGhpcy5fX3ZhbHVlcykgfHwgZnVuY3Rpb24obykgew0KICAgIHZhciBzID0gdHlwZW9mIFN5bWJvbCA9PT0gImZ1bmN0aW9uIiAmJiBTeW1ib2wuaXRlcmF0b3IsIG0gPSBzICYmIG9bc10sIGkgPSAwOw0KICAgIGlmIChtKSByZXR1cm4gbS5jYWxsKG8pOw0KICAgIGlmIChvICYmIHR5cGVvZiBvLmxlbmd0aCA9PT0gIm51bWJlciIpIHJldHVybiB7DQogICAgICAgIG5leHQ6IGZ1bmN0aW9uICgpIHsNCiAgICAgICAgICAgIGlmIChvICYmIGkgPj0gby5sZW5ndGgpIG8gPSB2b2lkIDA7DQogICAgICAgICAgICByZXR1cm4geyB2YWx1ZTogbyAmJiBvW2krK10sIGRvbmU6ICFvIH07DQogICAgICAgIH0NCiAgICB9Ow0KICAgIHRocm93IG5ldyBUeXBlRXJyb3IocyA/ICJPYmplY3QgaXMgbm90IGl0ZXJhYmxlLiIgOiAiU3ltYm9sLml0ZXJhdG9yIGlzIG5vdCBkZWZpbmVkLiIpOw0KfTsNCnZhciBlXzEsIF9hOw0KdHJ5IHsNCiAgICBmb3IgKHZhciBfYiA9IF9fdmFsdWVzKFsyLCAzXSksIF9jID0gX2IubmV4dCgpOyAhX2MuZG9uZTsgX2MgPSBfYi5uZXh0KCkpIHt2YXIgX2QgPSBfYy52YWx1ZSwgX2UgPSBfZC54LCBhID0gX2UgPT09IHZvaWQgMCA/IDAgOiBfZSwgX2YgPSBfZC55LCBiID0gX2YgPT09IHZvaWQgMCA/IDEgOiBfZjsNCiAgICAgICAgYTsNCiAgICAgICAgYjsNCiAgICB9DQp9IGNhdGNoIChlXzFfMSkgeyBlXzEgPSB7IGVycm9yOiBlXzFfMSB9OyB9IGZpbmFsbHkge3RyeSB7aWYgKF9jICYmICFfYy5kb25lICYmIChfYSA9IF9iWyJyZXR1cm4iXSkpIF9hLmNhbGwoX2IpOw0KICAgIH0gZmluYWxseSB7IGlmIChlXzEpIHRocm93IGVfMS5lcnJvcjsgfQ0KfQ0KLy8jIHNvdXJjZU1hcHBpbmdVUkw9RVM1Rm9yLW9mMzUuanMubWFw,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRVM1Rm9yLW9mMzUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJFUzVGb3Itb2YzNS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7O0lBQUEsS0FBbUMsSUFBQSxLQUFBLFNBQUEsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUEsZ0JBQUEsNEJBQUUsQ0FBaEMsSUFBQSxhQUFvQixFQUFuQixTQUFRLEVBQUwsQ0FBQyxtQkFBRyxDQUFDLEtBQUEsRUFBRSxTQUFRLEVBQUwsQ0FBQyxtQkFBRyxDQUFDLEtBQUE7UUFDMUIsQ0FBQyxDQUFDO1FBQ0YsQ0FBQyxDQUFDO0tBQ0wifQ==,Zm9yIChjb25zdCB7eDogYSA9IDAsIHk6IGIgPSAxfSBvZiBbMiwgM10pIHsKICAgIGE7CiAgICBiOwp9 diff --git a/tests/baselines/reference/ES5For-of35.sourcemap.txt b/tests/baselines/reference/ES5For-of35.sourcemap.txt index 5cd145f407a2d..b144170db45ee 100644 --- a/tests/baselines/reference/ES5For-of35.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of35.sourcemap.txt @@ -21,7 +21,7 @@ sourceFile:ES5For-of35.ts >>>}; >>>var e_1, _a; >>>try { ->>> for (var _b = __values([2, 3]), _c = _b.next(); !_c.done; _c = _b.next()) { +>>> for (var _b = __values([2, 3]), _c = _b.next(); !_c.done; _c = _b.next()) {var _d = _c.value, _e = _d.x, a = _e === void 0 ? 0 : _e, _f = _d.y, b = _f === void 0 ? 1 : _f; 1 >^^^^ 2 > ^^^^^ 3 > ^^^^ @@ -35,7 +35,23 @@ sourceFile:ES5For-of35.ts 11> ^ 12> ^^^^^^^^^^^^^^^^ 13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +14> ^ +15> ^^^^ +16> ^^^^^^^^^^^^^ +17> ^^ +18> ^^^^^^^^^ +19> ^^ +20> ^ +21> ^^^^^^^^^^^^^^^^^^^ +22> ^ +23> ^^^^^ +24> ^^ +25> ^^^^^^^^^ +26> ^^ +27> ^ +28> ^^^^^^^^^^^^^^^^^^^ +29> ^ +30> ^^^^^ 1 > 2 > for (const {x: a = 0, y: b = 1} of 3 > @@ -49,6 +65,23 @@ sourceFile:ES5For-of35.ts 11> 12> 13> ) +14> +15> +16> {x: a = 0, y: b = 1} +17> +18> x: a = 0 +19> +20> a +21> = +22> 0 +23> +24> , +25> y: b = 1 +26> +27> b +28> = +29> 1 +30> 1 >Emitted(14, 5) Source(1, 1) + SourceIndex(0) 2 >Emitted(14, 10) Source(1, 36) + SourceIndex(0) 3 >Emitted(14, 14) Source(1, 36) + SourceIndex(0) @@ -62,59 +95,23 @@ sourceFile:ES5For-of35.ts 11>Emitted(14, 35) Source(1, 42) + SourceIndex(0) 12>Emitted(14, 51) Source(1, 42) + SourceIndex(0) 13>Emitted(14, 79) Source(1, 44) + SourceIndex(0) ---- ->>> var _d = _c.value, _e = _d.x, a = _e === void 0 ? 0 : _e, _f = _d.y, b = _f === void 0 ? 1 : _f; -1->^^^^^^^^ -2 > ^^^^ -3 > ^^^^^^^^^^^^^ -4 > ^^ -5 > ^^^^^^^^^ -6 > ^^ -7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^ -9 > ^ -10> ^^^^^ -11> ^^ -12> ^^^^^^^^^ -13> ^^ -14> ^ -15> ^^^^^^^^^^^^^^^^^^^ -16> ^ -17> ^^^^^ -1-> -2 > -3 > {x: a = 0, y: b = 1} -4 > -5 > x: a = 0 -6 > -7 > a -8 > = -9 > 0 -10> -11> , -12> y: b = 1 -13> -14> b -15> = -16> 1 -17> -1->Emitted(15, 9) Source(1, 12) + SourceIndex(0) -2 >Emitted(15, 13) Source(1, 12) + SourceIndex(0) -3 >Emitted(15, 26) Source(1, 32) + SourceIndex(0) -4 >Emitted(15, 28) Source(1, 13) + SourceIndex(0) -5 >Emitted(15, 37) Source(1, 21) + SourceIndex(0) -6 >Emitted(15, 39) Source(1, 16) + SourceIndex(0) -7 >Emitted(15, 40) Source(1, 17) + SourceIndex(0) -8 >Emitted(15, 59) Source(1, 20) + SourceIndex(0) -9 >Emitted(15, 60) Source(1, 21) + SourceIndex(0) -10>Emitted(15, 65) Source(1, 21) + SourceIndex(0) -11>Emitted(15, 67) Source(1, 23) + SourceIndex(0) -12>Emitted(15, 76) Source(1, 31) + SourceIndex(0) -13>Emitted(15, 78) Source(1, 26) + SourceIndex(0) -14>Emitted(15, 79) Source(1, 27) + SourceIndex(0) -15>Emitted(15, 98) Source(1, 30) + SourceIndex(0) -16>Emitted(15, 99) Source(1, 31) + SourceIndex(0) -17>Emitted(15, 104) Source(1, 31) + SourceIndex(0) +14>Emitted(14, 80) Source(1, 12) + SourceIndex(0) +15>Emitted(14, 84) Source(1, 12) + SourceIndex(0) +16>Emitted(14, 97) Source(1, 32) + SourceIndex(0) +17>Emitted(14, 99) Source(1, 13) + SourceIndex(0) +18>Emitted(14, 108) Source(1, 21) + SourceIndex(0) +19>Emitted(14, 110) Source(1, 16) + SourceIndex(0) +20>Emitted(14, 111) Source(1, 17) + SourceIndex(0) +21>Emitted(14, 130) Source(1, 20) + SourceIndex(0) +22>Emitted(14, 131) Source(1, 21) + SourceIndex(0) +23>Emitted(14, 136) Source(1, 21) + SourceIndex(0) +24>Emitted(14, 138) Source(1, 23) + SourceIndex(0) +25>Emitted(14, 147) Source(1, 31) + SourceIndex(0) +26>Emitted(14, 149) Source(1, 26) + SourceIndex(0) +27>Emitted(14, 150) Source(1, 27) + SourceIndex(0) +28>Emitted(14, 169) Source(1, 30) + SourceIndex(0) +29>Emitted(14, 170) Source(1, 31) + SourceIndex(0) +30>Emitted(14, 175) Source(1, 31) + SourceIndex(0) --- >>> a; 1 >^^^^^^^^ @@ -125,9 +122,9 @@ sourceFile:ES5For-of35.ts > 2 > a 3 > ; -1 >Emitted(16, 9) Source(2, 5) + SourceIndex(0) -2 >Emitted(16, 10) Source(2, 6) + SourceIndex(0) -3 >Emitted(16, 11) Source(2, 7) + SourceIndex(0) +1 >Emitted(15, 9) Source(2, 5) + SourceIndex(0) +2 >Emitted(15, 10) Source(2, 6) + SourceIndex(0) +3 >Emitted(15, 11) Source(2, 7) + SourceIndex(0) --- >>> b; 1->^^^^^^^^ @@ -137,22 +134,18 @@ sourceFile:ES5For-of35.ts > 2 > b 3 > ; -1->Emitted(17, 9) Source(3, 5) + SourceIndex(0) -2 >Emitted(17, 10) Source(3, 6) + SourceIndex(0) -3 >Emitted(17, 11) Source(3, 7) + SourceIndex(0) +1->Emitted(16, 9) Source(3, 5) + SourceIndex(0) +2 >Emitted(16, 10) Source(3, 6) + SourceIndex(0) +3 >Emitted(16, 11) Source(3, 7) + SourceIndex(0) --- >>> } 1 >^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > >} -1 >Emitted(18, 6) Source(4, 2) + SourceIndex(0) +1 >Emitted(17, 6) Source(4, 2) + SourceIndex(0) --- ->>>} ->>>catch (e_1_1) { e_1 = { error: e_1_1 }; } ->>>finally { ->>> try { ->>> if (_c && !_c.done && (_a = _b["return"])) _a.call(_b); ->>> } ->>> finally { if (e_1) throw e_1.error; } +>>>} catch (e_1_1) { e_1 = { error: e_1_1 }; } finally {try {if (_c && !_c.done && (_a = _b["return"])) _a.call(_b); +>>> } finally { if (e_1) throw e_1.error; } >>>} >>>//# sourceMappingURL=ES5For-of35.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of36.js b/tests/baselines/reference/ES5For-of36.js index da5d6b854e36d..704c8cb6e4834 100644 --- a/tests/baselines/reference/ES5For-of36.js +++ b/tests/baselines/reference/ES5For-of36.js @@ -34,17 +34,11 @@ var __read = (this && this.__read) || function (o, n) { }; var e_1, _a; try { - for (var _b = __values([2, 3]), _c = _b.next(); !_c.done; _c = _b.next()) { - var _d = __read(_c.value, 2), _e = _d[0], a = _e === void 0 ? 0 : _e, _f = _d[1], b = _f === void 0 ? 1 : _f; + for (var _b = __values([2, 3]), _c = _b.next(); !_c.done; _c = _b.next()) {var _d = __read(_c.value, 2), _e = _d[0], a = _e === void 0 ? 0 : _e, _f = _d[1], b = _f === void 0 ? 1 : _f; a; b; } -} -catch (e_1_1) { e_1 = { error: e_1_1 }; } -finally { - try { - if (_c && !_c.done && (_a = _b["return"])) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } +} catch (e_1_1) { e_1 = { error: e_1_1 }; } finally {try {if (_c && !_c.done && (_a = _b["return"])) _a.call(_b); + } finally { if (e_1) throw e_1.error; } } //# sourceMappingURL=ES5For-of36.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of36.js.map b/tests/baselines/reference/ES5For-of36.js.map index 13230ff044ac8..5f8665167e9f3 100644 --- a/tests/baselines/reference/ES5For-of36.js.map +++ b/tests/baselines/reference/ES5For-of36.js.map @@ -1,3 +1,3 @@ //// [ES5For-of36.js.map] -{"version":3,"file":"ES5For-of36.js","sourceRoot":"","sources":["ES5For-of36.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAA,KAA2B,IAAA,KAAA,SAAA,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,gBAAA,4BAAE;QAA1B,IAAA,KAAA,mBAAc,EAAb,UAAK,EAAL,CAAC,mBAAG,CAAC,KAAA,EAAE,UAAK,EAAL,CAAC,mBAAG,CAAC,KAAA;QAClB,CAAC,CAAC;QACF,CAAC,CAAC;KACL"} -//// https://sokra.github.io/source-map-visualization#base64,dmFyIF9fdmFsdWVzID0gKHRoaXMgJiYgdGhpcy5fX3ZhbHVlcykgfHwgZnVuY3Rpb24obykgew0KICAgIHZhciBzID0gdHlwZW9mIFN5bWJvbCA9PT0gImZ1bmN0aW9uIiAmJiBTeW1ib2wuaXRlcmF0b3IsIG0gPSBzICYmIG9bc10sIGkgPSAwOw0KICAgIGlmIChtKSByZXR1cm4gbS5jYWxsKG8pOw0KICAgIGlmIChvICYmIHR5cGVvZiBvLmxlbmd0aCA9PT0gIm51bWJlciIpIHJldHVybiB7DQogICAgICAgIG5leHQ6IGZ1bmN0aW9uICgpIHsNCiAgICAgICAgICAgIGlmIChvICYmIGkgPj0gby5sZW5ndGgpIG8gPSB2b2lkIDA7DQogICAgICAgICAgICByZXR1cm4geyB2YWx1ZTogbyAmJiBvW2krK10sIGRvbmU6ICFvIH07DQogICAgICAgIH0NCiAgICB9Ow0KICAgIHRocm93IG5ldyBUeXBlRXJyb3IocyA/ICJPYmplY3QgaXMgbm90IGl0ZXJhYmxlLiIgOiAiU3ltYm9sLml0ZXJhdG9yIGlzIG5vdCBkZWZpbmVkLiIpOw0KfTsNCnZhciBfX3JlYWQgPSAodGhpcyAmJiB0aGlzLl9fcmVhZCkgfHwgZnVuY3Rpb24gKG8sIG4pIHsNCiAgICB2YXIgbSA9IHR5cGVvZiBTeW1ib2wgPT09ICJmdW5jdGlvbiIgJiYgb1tTeW1ib2wuaXRlcmF0b3JdOw0KICAgIGlmICghbSkgcmV0dXJuIG87DQogICAgdmFyIGkgPSBtLmNhbGwobyksIHIsIGFyID0gW10sIGU7DQogICAgdHJ5IHsNCiAgICAgICAgd2hpbGUgKChuID09PSB2b2lkIDAgfHwgbi0tID4gMCkgJiYgIShyID0gaS5uZXh0KCkpLmRvbmUpIGFyLnB1c2goci52YWx1ZSk7DQogICAgfQ0KICAgIGNhdGNoIChlcnJvcikgeyBlID0geyBlcnJvcjogZXJyb3IgfTsgfQ0KICAgIGZpbmFsbHkgew0KICAgICAgICB0cnkgew0KICAgICAgICAgICAgaWYgKHIgJiYgIXIuZG9uZSAmJiAobSA9IGlbInJldHVybiJdKSkgbS5jYWxsKGkpOw0KICAgICAgICB9DQogICAgICAgIGZpbmFsbHkgeyBpZiAoZSkgdGhyb3cgZS5lcnJvcjsgfQ0KICAgIH0NCiAgICByZXR1cm4gYXI7DQp9Ow0KdmFyIGVfMSwgX2E7DQp0cnkgew0KICAgIGZvciAodmFyIF9iID0gX192YWx1ZXMoWzIsIDNdKSwgX2MgPSBfYi5uZXh0KCk7ICFfYy5kb25lOyBfYyA9IF9iLm5leHQoKSkgew0KICAgICAgICB2YXIgX2QgPSBfX3JlYWQoX2MudmFsdWUsIDIpLCBfZSA9IF9kWzBdLCBhID0gX2UgPT09IHZvaWQgMCA/IDAgOiBfZSwgX2YgPSBfZFsxXSwgYiA9IF9mID09PSB2b2lkIDAgPyAxIDogX2Y7DQogICAgICAgIGE7DQogICAgICAgIGI7DQogICAgfQ0KfQ0KY2F0Y2ggKGVfMV8xKSB7IGVfMSA9IHsgZXJyb3I6IGVfMV8xIH07IH0NCmZpbmFsbHkgew0KICAgIHRyeSB7DQogICAgICAgIGlmIChfYyAmJiAhX2MuZG9uZSAmJiAoX2EgPSBfYlsicmV0dXJuIl0pKSBfYS5jYWxsKF9iKTsNCiAgICB9DQogICAgZmluYWxseSB7IGlmIChlXzEpIHRocm93IGVfMS5lcnJvcjsgfQ0KfQ0KLy8jIHNvdXJjZU1hcHBpbmdVUkw9RVM1Rm9yLW9mMzYuanMubWFw,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRVM1Rm9yLW9mMzYuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJFUzVGb3Itb2YzNi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztJQUFBLEtBQTJCLElBQUEsS0FBQSxTQUFBLENBQUMsQ0FBQyxFQUFFLENBQUMsQ0FBQyxDQUFBLGdCQUFBLDRCQUFFO1FBQTFCLElBQUEsS0FBQSxtQkFBYyxFQUFiLFVBQUssRUFBTCxDQUFDLG1CQUFHLENBQUMsS0FBQSxFQUFFLFVBQUssRUFBTCxDQUFDLG1CQUFHLENBQUMsS0FBQTtRQUNsQixDQUFDLENBQUM7UUFDRixDQUFDLENBQUM7S0FDTCJ9,Zm9yIChsZXQgW2EgPSAwLCBiID0gMV0gb2YgWzIsIDNdKSB7CiAgICBhOwogICAgYjsKfQ== +{"version":3,"file":"ES5For-of36.js","sourceRoot":"","sources":["ES5For-of36.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAA,KAA2B,IAAA,KAAA,SAAA,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,gBAAA,4BAAE,CAA1B,IAAA,KAAA,mBAAc,EAAb,UAAK,EAAL,CAAC,mBAAG,CAAC,KAAA,EAAE,UAAK,EAAL,CAAC,mBAAG,CAAC,KAAA;QAClB,CAAC,CAAC;QACF,CAAC,CAAC;KACL"} +//// https://sokra.github.io/source-map-visualization#base64,dmFyIF9fdmFsdWVzID0gKHRoaXMgJiYgdGhpcy5fX3ZhbHVlcykgfHwgZnVuY3Rpb24obykgew0KICAgIHZhciBzID0gdHlwZW9mIFN5bWJvbCA9PT0gImZ1bmN0aW9uIiAmJiBTeW1ib2wuaXRlcmF0b3IsIG0gPSBzICYmIG9bc10sIGkgPSAwOw0KICAgIGlmIChtKSByZXR1cm4gbS5jYWxsKG8pOw0KICAgIGlmIChvICYmIHR5cGVvZiBvLmxlbmd0aCA9PT0gIm51bWJlciIpIHJldHVybiB7DQogICAgICAgIG5leHQ6IGZ1bmN0aW9uICgpIHsNCiAgICAgICAgICAgIGlmIChvICYmIGkgPj0gby5sZW5ndGgpIG8gPSB2b2lkIDA7DQogICAgICAgICAgICByZXR1cm4geyB2YWx1ZTogbyAmJiBvW2krK10sIGRvbmU6ICFvIH07DQogICAgICAgIH0NCiAgICB9Ow0KICAgIHRocm93IG5ldyBUeXBlRXJyb3IocyA/ICJPYmplY3QgaXMgbm90IGl0ZXJhYmxlLiIgOiAiU3ltYm9sLml0ZXJhdG9yIGlzIG5vdCBkZWZpbmVkLiIpOw0KfTsNCnZhciBfX3JlYWQgPSAodGhpcyAmJiB0aGlzLl9fcmVhZCkgfHwgZnVuY3Rpb24gKG8sIG4pIHsNCiAgICB2YXIgbSA9IHR5cGVvZiBTeW1ib2wgPT09ICJmdW5jdGlvbiIgJiYgb1tTeW1ib2wuaXRlcmF0b3JdOw0KICAgIGlmICghbSkgcmV0dXJuIG87DQogICAgdmFyIGkgPSBtLmNhbGwobyksIHIsIGFyID0gW10sIGU7DQogICAgdHJ5IHsNCiAgICAgICAgd2hpbGUgKChuID09PSB2b2lkIDAgfHwgbi0tID4gMCkgJiYgIShyID0gaS5uZXh0KCkpLmRvbmUpIGFyLnB1c2goci52YWx1ZSk7DQogICAgfQ0KICAgIGNhdGNoIChlcnJvcikgeyBlID0geyBlcnJvcjogZXJyb3IgfTsgfQ0KICAgIGZpbmFsbHkgew0KICAgICAgICB0cnkgew0KICAgICAgICAgICAgaWYgKHIgJiYgIXIuZG9uZSAmJiAobSA9IGlbInJldHVybiJdKSkgbS5jYWxsKGkpOw0KICAgICAgICB9DQogICAgICAgIGZpbmFsbHkgeyBpZiAoZSkgdGhyb3cgZS5lcnJvcjsgfQ0KICAgIH0NCiAgICByZXR1cm4gYXI7DQp9Ow0KdmFyIGVfMSwgX2E7DQp0cnkgew0KICAgIGZvciAodmFyIF9iID0gX192YWx1ZXMoWzIsIDNdKSwgX2MgPSBfYi5uZXh0KCk7ICFfYy5kb25lOyBfYyA9IF9iLm5leHQoKSkge3ZhciBfZCA9IF9fcmVhZChfYy52YWx1ZSwgMiksIF9lID0gX2RbMF0sIGEgPSBfZSA9PT0gdm9pZCAwID8gMCA6IF9lLCBfZiA9IF9kWzFdLCBiID0gX2YgPT09IHZvaWQgMCA/IDEgOiBfZjsNCiAgICAgICAgYTsNCiAgICAgICAgYjsNCiAgICB9DQp9IGNhdGNoIChlXzFfMSkgeyBlXzEgPSB7IGVycm9yOiBlXzFfMSB9OyB9IGZpbmFsbHkge3RyeSB7aWYgKF9jICYmICFfYy5kb25lICYmIChfYSA9IF9iWyJyZXR1cm4iXSkpIF9hLmNhbGwoX2IpOw0KICAgIH0gZmluYWxseSB7IGlmIChlXzEpIHRocm93IGVfMS5lcnJvcjsgfQ0KfQ0KLy8jIHNvdXJjZU1hcHBpbmdVUkw9RVM1Rm9yLW9mMzYuanMubWFw,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRVM1Rm9yLW9mMzYuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJFUzVGb3Itb2YzNi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztJQUFBLEtBQTJCLElBQUEsS0FBQSxTQUFBLENBQUMsQ0FBQyxFQUFFLENBQUMsQ0FBQyxDQUFBLGdCQUFBLDRCQUFFLENBQTFCLElBQUEsS0FBQSxtQkFBYyxFQUFiLFVBQUssRUFBTCxDQUFDLG1CQUFHLENBQUMsS0FBQSxFQUFFLFVBQUssRUFBTCxDQUFDLG1CQUFHLENBQUMsS0FBQTtRQUNsQixDQUFDLENBQUM7UUFDRixDQUFDLENBQUM7S0FDTCJ9,Zm9yIChsZXQgW2EgPSAwLCBiID0gMV0gb2YgWzIsIDNdKSB7CiAgICBhOwogICAgYjsKfQ== diff --git a/tests/baselines/reference/ES5For-of36.sourcemap.txt b/tests/baselines/reference/ES5For-of36.sourcemap.txt index c0033e3e12789..d6c28b2a5eeea 100644 --- a/tests/baselines/reference/ES5For-of36.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of36.sourcemap.txt @@ -37,7 +37,7 @@ sourceFile:ES5For-of36.ts >>>}; >>>var e_1, _a; >>>try { ->>> for (var _b = __values([2, 3]), _c = _b.next(); !_c.done; _c = _b.next()) { +>>> for (var _b = __values([2, 3]), _c = _b.next(); !_c.done; _c = _b.next()) {var _d = __read(_c.value, 2), _e = _d[0], a = _e === void 0 ? 0 : _e, _f = _d[1], b = _f === void 0 ? 1 : _f; 1 >^^^^ 2 > ^^^^^ 3 > ^^^^ @@ -51,7 +51,24 @@ sourceFile:ES5For-of36.ts 11> ^ 12> ^^^^^^^^^^^^^^^^ 13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +14> ^ +15> ^^^^ +16> ^^^^^ +17> ^^^^^^^^^^^^^^^^^^^ +18> ^^ +19> ^^^^^^^^^^ +20> ^^ +21> ^ +22> ^^^^^^^^^^^^^^^^^^^ +23> ^ +24> ^^^^^ +25> ^^ +26> ^^^^^^^^^^ +27> ^^ +28> ^ +29> ^^^^^^^^^^^^^^^^^^^ +30> ^ +31> ^^^^^ 1 > 2 > for (let [a = 0, b = 1] of 3 > @@ -65,6 +82,24 @@ sourceFile:ES5For-of36.ts 11> 12> 13> ) +14> +15> +16> +17> [a = 0, b = 1] +18> +19> a = 0 +20> +21> a +22> = +23> 0 +24> +25> , +26> b = 1 +27> +28> b +29> = +30> 1 +31> 1 >Emitted(30, 5) Source(1, 1) + SourceIndex(0) 2 >Emitted(30, 10) Source(1, 28) + SourceIndex(0) 3 >Emitted(30, 14) Source(1, 28) + SourceIndex(0) @@ -78,62 +113,24 @@ sourceFile:ES5For-of36.ts 11>Emitted(30, 35) Source(1, 34) + SourceIndex(0) 12>Emitted(30, 51) Source(1, 34) + SourceIndex(0) 13>Emitted(30, 79) Source(1, 36) + SourceIndex(0) ---- ->>> var _d = __read(_c.value, 2), _e = _d[0], a = _e === void 0 ? 0 : _e, _f = _d[1], b = _f === void 0 ? 1 : _f; -1->^^^^^^^^ -2 > ^^^^ -3 > ^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^ -5 > ^^ -6 > ^^^^^^^^^^ -7 > ^^ -8 > ^ -9 > ^^^^^^^^^^^^^^^^^^^ -10> ^ -11> ^^^^^ -12> ^^ -13> ^^^^^^^^^^ -14> ^^ -15> ^ -16> ^^^^^^^^^^^^^^^^^^^ -17> ^ -18> ^^^^^ -1-> -2 > -3 > -4 > [a = 0, b = 1] -5 > -6 > a = 0 -7 > -8 > a -9 > = -10> 0 -11> -12> , -13> b = 1 -14> -15> b -16> = -17> 1 -18> -1->Emitted(31, 9) Source(1, 10) + SourceIndex(0) -2 >Emitted(31, 13) Source(1, 10) + SourceIndex(0) -3 >Emitted(31, 18) Source(1, 10) + SourceIndex(0) -4 >Emitted(31, 37) Source(1, 24) + SourceIndex(0) -5 >Emitted(31, 39) Source(1, 11) + SourceIndex(0) -6 >Emitted(31, 49) Source(1, 16) + SourceIndex(0) -7 >Emitted(31, 51) Source(1, 11) + SourceIndex(0) -8 >Emitted(31, 52) Source(1, 12) + SourceIndex(0) -9 >Emitted(31, 71) Source(1, 15) + SourceIndex(0) -10>Emitted(31, 72) Source(1, 16) + SourceIndex(0) -11>Emitted(31, 77) Source(1, 16) + SourceIndex(0) -12>Emitted(31, 79) Source(1, 18) + SourceIndex(0) -13>Emitted(31, 89) Source(1, 23) + SourceIndex(0) -14>Emitted(31, 91) Source(1, 18) + SourceIndex(0) -15>Emitted(31, 92) Source(1, 19) + SourceIndex(0) -16>Emitted(31, 111) Source(1, 22) + SourceIndex(0) -17>Emitted(31, 112) Source(1, 23) + SourceIndex(0) -18>Emitted(31, 117) Source(1, 23) + SourceIndex(0) +14>Emitted(30, 80) Source(1, 10) + SourceIndex(0) +15>Emitted(30, 84) Source(1, 10) + SourceIndex(0) +16>Emitted(30, 89) Source(1, 10) + SourceIndex(0) +17>Emitted(30, 108) Source(1, 24) + SourceIndex(0) +18>Emitted(30, 110) Source(1, 11) + SourceIndex(0) +19>Emitted(30, 120) Source(1, 16) + SourceIndex(0) +20>Emitted(30, 122) Source(1, 11) + SourceIndex(0) +21>Emitted(30, 123) Source(1, 12) + SourceIndex(0) +22>Emitted(30, 142) Source(1, 15) + SourceIndex(0) +23>Emitted(30, 143) Source(1, 16) + SourceIndex(0) +24>Emitted(30, 148) Source(1, 16) + SourceIndex(0) +25>Emitted(30, 150) Source(1, 18) + SourceIndex(0) +26>Emitted(30, 160) Source(1, 23) + SourceIndex(0) +27>Emitted(30, 162) Source(1, 18) + SourceIndex(0) +28>Emitted(30, 163) Source(1, 19) + SourceIndex(0) +29>Emitted(30, 182) Source(1, 22) + SourceIndex(0) +30>Emitted(30, 183) Source(1, 23) + SourceIndex(0) +31>Emitted(30, 188) Source(1, 23) + SourceIndex(0) --- >>> a; 1 >^^^^^^^^ @@ -144,9 +141,9 @@ sourceFile:ES5For-of36.ts > 2 > a 3 > ; -1 >Emitted(32, 9) Source(2, 5) + SourceIndex(0) -2 >Emitted(32, 10) Source(2, 6) + SourceIndex(0) -3 >Emitted(32, 11) Source(2, 7) + SourceIndex(0) +1 >Emitted(31, 9) Source(2, 5) + SourceIndex(0) +2 >Emitted(31, 10) Source(2, 6) + SourceIndex(0) +3 >Emitted(31, 11) Source(2, 7) + SourceIndex(0) --- >>> b; 1->^^^^^^^^ @@ -156,22 +153,18 @@ sourceFile:ES5For-of36.ts > 2 > b 3 > ; -1->Emitted(33, 9) Source(3, 5) + SourceIndex(0) -2 >Emitted(33, 10) Source(3, 6) + SourceIndex(0) -3 >Emitted(33, 11) Source(3, 7) + SourceIndex(0) +1->Emitted(32, 9) Source(3, 5) + SourceIndex(0) +2 >Emitted(32, 10) Source(3, 6) + SourceIndex(0) +3 >Emitted(32, 11) Source(3, 7) + SourceIndex(0) --- >>> } 1 >^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > >} -1 >Emitted(34, 6) Source(4, 2) + SourceIndex(0) +1 >Emitted(33, 6) Source(4, 2) + SourceIndex(0) --- ->>>} ->>>catch (e_1_1) { e_1 = { error: e_1_1 }; } ->>>finally { ->>> try { ->>> if (_c && !_c.done && (_a = _b["return"])) _a.call(_b); ->>> } ->>> finally { if (e_1) throw e_1.error; } +>>>} catch (e_1_1) { e_1 = { error: e_1_1 }; } finally {try {if (_c && !_c.done && (_a = _b["return"])) _a.call(_b); +>>> } finally { if (e_1) throw e_1.error; } >>>} >>>//# sourceMappingURL=ES5For-of36.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of37.js b/tests/baselines/reference/ES5For-of37.js index 7b4baf8f9a0ca..4f35506e2dccc 100644 --- a/tests/baselines/reference/ES5For-of37.js +++ b/tests/baselines/reference/ES5For-of37.js @@ -41,25 +41,14 @@ try { throw new Error('ERR'); } } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (_f && !_f.done && (_b = _e["return"])) _b.call(_e); - } - finally { if (e_2) throw e_2.error; } + } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally {try {if (_f && !_f.done && (_b = _e["return"])) _b.call(_e); + } finally { if (e_2) throw e_2.error; } } console.log(i); - } - catch (err) { + } catch (err) { console.log('E %s %s', i, err); } } -} -catch (e_1_1) { e_1 = { error: e_1_1 }; } -finally { - try { - if (_d && !_d.done && (_a = _c["return"])) _a.call(_c); - } - finally { if (e_1) throw e_1.error; } +} catch (e_1_1) { e_1 = { error: e_1_1 }; } finally {try {if (_d && !_d.done && (_a = _c["return"])) _a.call(_c); + } finally { if (e_1) throw e_1.error; } } diff --git a/tests/baselines/reference/ES5SymbolProperty1.js b/tests/baselines/reference/ES5SymbolProperty1.js index 4300218c62668..cf08c304e97ec 100644 --- a/tests/baselines/reference/ES5SymbolProperty1.js +++ b/tests/baselines/reference/ES5SymbolProperty1.js @@ -13,6 +13,7 @@ obj[Symbol.foo]; //// [ES5SymbolProperty1.js] var _a; var Symbol; + var obj = (_a = {}, _a[Symbol.foo] = 0, _a); diff --git a/tests/baselines/reference/ES5SymbolProperty2.js b/tests/baselines/reference/ES5SymbolProperty2.js index 3de8541a6c94d..11341266a0bb9 100644 --- a/tests/baselines/reference/ES5SymbolProperty2.js +++ b/tests/baselines/reference/ES5SymbolProperty2.js @@ -14,6 +14,7 @@ module M { var M; (function (M) { var Symbol; + var C = /** @class */ (function () { function C() { } diff --git a/tests/baselines/reference/ES5SymbolProperty3.js b/tests/baselines/reference/ES5SymbolProperty3.js index 362fcfc7375ed..e5470ad414c6d 100644 --- a/tests/baselines/reference/ES5SymbolProperty3.js +++ b/tests/baselines/reference/ES5SymbolProperty3.js @@ -9,6 +9,7 @@ class C { //// [ES5SymbolProperty3.js] var Symbol; + var C = /** @class */ (function () { function C() { } diff --git a/tests/baselines/reference/ES5SymbolProperty4.js b/tests/baselines/reference/ES5SymbolProperty4.js index f756a730d52d8..4d4f1c6989b69 100644 --- a/tests/baselines/reference/ES5SymbolProperty4.js +++ b/tests/baselines/reference/ES5SymbolProperty4.js @@ -9,6 +9,7 @@ class C { //// [ES5SymbolProperty4.js] var Symbol; + var C = /** @class */ (function () { function C() { } diff --git a/tests/baselines/reference/ES5SymbolProperty5.js b/tests/baselines/reference/ES5SymbolProperty5.js index c146b8dd5f1e5..9ac3ee0941ae5 100644 --- a/tests/baselines/reference/ES5SymbolProperty5.js +++ b/tests/baselines/reference/ES5SymbolProperty5.js @@ -9,6 +9,7 @@ class C { //// [ES5SymbolProperty5.js] var Symbol; + var C = /** @class */ (function () { function C() { } diff --git a/tests/baselines/reference/ES5SymbolProperty7.js b/tests/baselines/reference/ES5SymbolProperty7.js index f874c4c77cd39..08bd994b7298c 100644 --- a/tests/baselines/reference/ES5SymbolProperty7.js +++ b/tests/baselines/reference/ES5SymbolProperty7.js @@ -9,6 +9,7 @@ class C { //// [ES5SymbolProperty7.js] var Symbol; + var C = /** @class */ (function () { function C() { } diff --git a/tests/baselines/reference/ES5for-of32.js b/tests/baselines/reference/ES5for-of32.js index 747f9524062f6..302e7557deac8 100644 --- a/tests/baselines/reference/ES5for-of32.js +++ b/tests/baselines/reference/ES5for-of32.js @@ -18,5 +18,6 @@ for (var _i = 0, array_1 = array; _i < array_1.length; _i++) { if (sum === 0) { array = [4, 5, 6]; } + sum += num; } diff --git a/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.js b/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.js index 40075310eb1f5..984af148cb48e 100644 --- a/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.js @@ -23,6 +23,7 @@ var enumdule; enumdule[enumdule["Blue"] = 1] = "Blue"; })(enumdule || (enumdule = {})); (function (enumdule) { + var Point = /** @class */ (function () { function Point(x, y) { this.x = x; diff --git a/tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.js b/tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.js index 94faa0dd4b34c..a9d170dd2ef19 100644 --- a/tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.js +++ b/tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.js @@ -22,6 +22,8 @@ module A { //// [ExportClassWhichExtendsInterfaceWithInaccessibleType.js] var A; (function (A) { + + var Point2d = /** @class */ (function () { function Point2d(x, y) { this.x = x; diff --git a/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js index 55effcf4cfdb8..2de7c3a95150f 100644 --- a/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js +++ b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js @@ -38,6 +38,7 @@ var __extends = (this && this.__extends) || (function () { })(); var A; (function (A) { + var Point = /** @class */ (function () { function Point() { } diff --git a/tests/baselines/reference/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.js b/tests/baselines/reference/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.js index 7642a6cbe871a..db7d84739d538 100644 --- a/tests/baselines/reference/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.js +++ b/tests/baselines/reference/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.js @@ -18,6 +18,7 @@ module A { //// [ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.js] var A; (function (A) { + var Point = /** @class */ (function () { function Point() { } diff --git a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js index 761537e7d5b20..6a585203517d3 100644 --- a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js +++ b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js @@ -42,6 +42,7 @@ var __extends = (this && this.__extends) || (function () { })(); var A; (function (A) { + var Point = /** @class */ (function () { function Point() { } diff --git a/tests/baselines/reference/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.js b/tests/baselines/reference/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.js index 2d7e408d81ba6..351730b7a9a08 100644 --- a/tests/baselines/reference/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.js +++ b/tests/baselines/reference/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.js @@ -18,6 +18,7 @@ module A { //// [ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.js] var A; (function (A) { + var Point = /** @class */ (function () { function Point() { } diff --git a/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.js b/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.js index ac8e36d42224a..1779aee97723a 100644 --- a/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.js +++ b/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.js @@ -18,6 +18,7 @@ module A { //// [ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.js] var A; (function (A) { + var Point = /** @class */ (function () { function Point() { } diff --git a/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.js b/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.js index b2abc1a4d31fc..192f39d0610d7 100644 --- a/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.js +++ b/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.js @@ -18,6 +18,7 @@ module A { //// [ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.js] var A; (function (A) { + var Point = /** @class */ (function () { function Point() { } diff --git a/tests/baselines/reference/ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js b/tests/baselines/reference/ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js index e2b32a3bca409..4e992aa979fd5 100644 --- a/tests/baselines/reference/ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js +++ b/tests/baselines/reference/ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js @@ -25,6 +25,7 @@ module A { //// [ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js] var A; (function (A) { + A.Origin = { x: 0, y: 0 }; A.Origin3d = { x: 0, y: 0, z: 0 }; })(A || (A = {})); diff --git a/tests/baselines/reference/ExportInterfaceWithInaccessibleTypeInIndexerTypeAnnotations.js b/tests/baselines/reference/ExportInterfaceWithInaccessibleTypeInIndexerTypeAnnotations.js index 8f5df1d3fceba..2b8fd1d2cd7f1 100644 --- a/tests/baselines/reference/ExportInterfaceWithInaccessibleTypeInIndexerTypeAnnotations.js +++ b/tests/baselines/reference/ExportInterfaceWithInaccessibleTypeInIndexerTypeAnnotations.js @@ -16,3 +16,4 @@ module A { //// [ExportInterfaceWithInaccessibleTypeInIndexerTypeAnnotations.js] + diff --git a/tests/baselines/reference/ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.js b/tests/baselines/reference/ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.js index 7625500a1d0a4..439c109a06491 100644 --- a/tests/baselines/reference/ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.js +++ b/tests/baselines/reference/ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.js @@ -26,6 +26,7 @@ module A { //// [ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.js] var A; (function (A) { + A.Origin = { x: 0, y: 0 }; A.Origin3d = { x: 0, y: 0, z: 0 }; })(A || (A = {})); diff --git a/tests/baselines/reference/ExportModuleWithAccessibleTypesOnItsExportedMembers.js b/tests/baselines/reference/ExportModuleWithAccessibleTypesOnItsExportedMembers.js index 401962dd2616f..d2fdfd934f724 100644 --- a/tests/baselines/reference/ExportModuleWithAccessibleTypesOnItsExportedMembers.js +++ b/tests/baselines/reference/ExportModuleWithAccessibleTypesOnItsExportedMembers.js @@ -23,6 +23,7 @@ module A { //// [ExportModuleWithAccessibleTypesOnItsExportedMembers.js] var A; (function (A) { + var Point = /** @class */ (function () { function Point(x, y) { this.x = x; diff --git a/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.js b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.js index 0990c9bf2bd2d..0d627af536a4d 100644 --- a/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.js +++ b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.js @@ -14,6 +14,7 @@ module A { //// [ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.js] var A; (function (A) { + var Point = /** @class */ (function () { function Point(x, y) { this.x = x; diff --git a/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.js b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.js index b454d785e9c7a..f546142945e1c 100644 --- a/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.js +++ b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.js @@ -14,6 +14,7 @@ module A { //// [ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.js] var A; (function (A) { + var Point = /** @class */ (function () { function Point(x, y) { this.x = x; diff --git a/tests/baselines/reference/ExportVariableWithAccessibleTypeInTypeAnnotation.js b/tests/baselines/reference/ExportVariableWithAccessibleTypeInTypeAnnotation.js index 591845b627e2b..2a10cb71d40c3 100644 --- a/tests/baselines/reference/ExportVariableWithAccessibleTypeInTypeAnnotation.js +++ b/tests/baselines/reference/ExportVariableWithAccessibleTypeInTypeAnnotation.js @@ -14,6 +14,7 @@ module A { //// [ExportVariableWithAccessibleTypeInTypeAnnotation.js] var A; (function (A) { + // valid since Point is exported A.Origin = { x: 0, y: 0 }; })(A || (A = {})); diff --git a/tests/baselines/reference/ExportVariableWithInaccessibleTypeInTypeAnnotation.js b/tests/baselines/reference/ExportVariableWithInaccessibleTypeInTypeAnnotation.js index d63edb655691a..75bb695701d85 100644 --- a/tests/baselines/reference/ExportVariableWithInaccessibleTypeInTypeAnnotation.js +++ b/tests/baselines/reference/ExportVariableWithInaccessibleTypeInTypeAnnotation.js @@ -21,6 +21,7 @@ module A { //// [ExportVariableWithInaccessibleTypeInTypeAnnotation.js] var A; (function (A) { + // valid since Point is exported A.Origin = { x: 0, y: 0 }; // invalid Point3d is not exported diff --git a/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.js b/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.js index daa56620014bd..ef21a4b0474a5 100644 --- a/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.js @@ -53,8 +53,7 @@ var A; })(A || (A = {})); //// [module.js] var A; -(function (A) { - var Point; +(function (A) {var Point; (function (Point) { Point.Origin = { x: 0, y: 0 }; })(Point = A.Point || (A.Point = {})); @@ -68,6 +67,7 @@ var cl = A.Point.Origin; // not expected to be an error. //// [simple.js] var B; (function (B) { + function Point() { return { x: 0, y: 0 }; } diff --git a/tests/baselines/reference/FunctionAndModuleWithSameNameAndDifferentCommonRoot.js b/tests/baselines/reference/FunctionAndModuleWithSameNameAndDifferentCommonRoot.js index 13302ea391a09..c74cf61d93a3e 100644 --- a/tests/baselines/reference/FunctionAndModuleWithSameNameAndDifferentCommonRoot.js +++ b/tests/baselines/reference/FunctionAndModuleWithSameNameAndDifferentCommonRoot.js @@ -32,8 +32,7 @@ var A; })(A || (A = {})); //// [module.js] var B; -(function (B) { - var Point; +(function (B) {var Point; (function (Point) { Point.Origin = { x: 0, y: 0 }; })(Point = B.Point || (B.Point = {})); diff --git a/tests/baselines/reference/MemberFunctionDeclaration8_es6.js b/tests/baselines/reference/MemberFunctionDeclaration8_es6.js index a44ff273fa000..39d702b5cd497 100644 --- a/tests/baselines/reference/MemberFunctionDeclaration8_es6.js +++ b/tests/baselines/reference/MemberFunctionDeclaration8_es6.js @@ -12,8 +12,7 @@ class C { foo() { // Make sure we don't think of *bar as the start of a generator method. if (a) - ; - * bar; + ; * bar; return bar; } } diff --git a/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.js b/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.js index 699e7ce7678c5..6890a8e2ffc65 100644 --- a/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.js @@ -33,10 +33,8 @@ class A { //// [module.js] var X; -(function (X) { - var Y; - (function (Y) { - var Point; +(function (X) {var Y; + (function (Y) {var Point; (function (Point) { Point.Origin = new Point(0, 0); })(Point = Y.Point || (Y.Point = {})); @@ -44,8 +42,7 @@ var X; })(X || (X = {})); //// [classPoint.js] var X; -(function (X) { - var Y; +(function (X) {var Y; (function (Y) { // duplicate identifier var Point = /** @class */ (function () { diff --git a/tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.js b/tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.js index 740d02edd17ff..652bedde77a50 100644 --- a/tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.js @@ -19,6 +19,7 @@ var y = new enumdule.Point(0, 0); //// [ModuleAndEnumWithSameNameAndCommonRoot.js] var enumdule; (function (enumdule) { + var Point = /** @class */ (function () { function Point(x, y) { this.x = x; diff --git a/tests/baselines/reference/ModuleAndFunctionWithSameNameAndCommonRoot.js b/tests/baselines/reference/ModuleAndFunctionWithSameNameAndCommonRoot.js index e9b8f44f89543..43ad9ef1c1686 100644 --- a/tests/baselines/reference/ModuleAndFunctionWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/ModuleAndFunctionWithSameNameAndCommonRoot.js @@ -31,8 +31,7 @@ module B { //// [module.js] var A; -(function (A) { - var Point; +(function (A) {var Point; (function (Point) { Point.Origin = { x: 0, y: 0 }; })(Point = A.Point || (A.Point = {})); @@ -48,8 +47,7 @@ var A; })(A || (A = {})); //// [simple.js] var B; -(function (B) { - var Point; +(function (B) {var Point; (function (Point) { Point.Origin = { x: 0, y: 0 }; })(Point = B.Point || (B.Point = {})); diff --git a/tests/baselines/reference/ModuleWithExportedAndNonExportedClasses.js b/tests/baselines/reference/ModuleWithExportedAndNonExportedClasses.js index 26d014f16c2f3..48caf642e663f 100644 --- a/tests/baselines/reference/ModuleWithExportedAndNonExportedClasses.js +++ b/tests/baselines/reference/ModuleWithExportedAndNonExportedClasses.js @@ -66,3 +66,4 @@ var AG = new A.AG(); // errors expected, these are not exported var a2 = new A.A2(); var ag2 = new A.A2(); + diff --git a/tests/baselines/reference/ModuleWithExportedAndNonExportedEnums.js b/tests/baselines/reference/ModuleWithExportedAndNonExportedEnums.js index 713d2ac7f1870..ac6521d82f735 100644 --- a/tests/baselines/reference/ModuleWithExportedAndNonExportedEnums.js +++ b/tests/baselines/reference/ModuleWithExportedAndNonExportedEnums.js @@ -13,8 +13,7 @@ var b = A.Day.Monday; //// [ModuleWithExportedAndNonExportedEnums.js] var A; -(function (A) { - var Color; +(function (A) {var Color; (function (Color) { Color[Color["Red"] = 0] = "Red"; Color[Color["Blue"] = 1] = "Blue"; diff --git a/tests/baselines/reference/ModuleWithExportedAndNonExportedFunctions.js b/tests/baselines/reference/ModuleWithExportedAndNonExportedFunctions.js index ed0e1f90bf33f..c6e81798cc135 100644 --- a/tests/baselines/reference/ModuleWithExportedAndNonExportedFunctions.js +++ b/tests/baselines/reference/ModuleWithExportedAndNonExportedFunctions.js @@ -32,6 +32,7 @@ var fng2 = A.fng2; //// [ModuleWithExportedAndNonExportedFunctions.js] var A; (function (A) { + function fn(s) { return true; } @@ -43,6 +44,7 @@ var A; function fn2(s) { return false; } + function fng2(s) { return null; } @@ -52,6 +54,8 @@ var fn; var fn = A.fn; var fng; var fng = A.fng; // bug 838015 + + // these should be errors since the functions are not exported var fn2 = A.fn2; var fng2 = A.fng2; diff --git a/tests/baselines/reference/ModuleWithExportedAndNonExportedImportAlias.js b/tests/baselines/reference/ModuleWithExportedAndNonExportedImportAlias.js index e1c36200005c5..1072066f87315 100644 --- a/tests/baselines/reference/ModuleWithExportedAndNonExportedImportAlias.js +++ b/tests/baselines/reference/ModuleWithExportedAndNonExportedImportAlias.js @@ -64,5 +64,6 @@ var p; var p = Geometry.Origin; var line; var line = Geometry.Unit; + // not expected to work since non are exported var line = Geometry.Lines.Line; diff --git a/tests/baselines/reference/ModuleWithExportedAndNonExportedVariables.js b/tests/baselines/reference/ModuleWithExportedAndNonExportedVariables.js index 0a2c63342c6f4..be6459b95d02c 100644 --- a/tests/baselines/reference/ModuleWithExportedAndNonExportedVariables.js +++ b/tests/baselines/reference/ModuleWithExportedAndNonExportedVariables.js @@ -20,5 +20,6 @@ var A; })(A || (A = {})); var x; var x = A.x; + // Error, since y is not exported var y = A.y; diff --git a/tests/baselines/reference/NonInitializedExportInInternalModule.js b/tests/baselines/reference/NonInitializedExportInInternalModule.js index e1df1d41f5483..0dbb970754c8e 100644 --- a/tests/baselines/reference/NonInitializedExportInInternalModule.js +++ b/tests/baselines/reference/NonInitializedExportInInternalModule.js @@ -40,9 +40,13 @@ var Inner; var ; let; var ; + + + + + var A = /** @class */ (function () { - function A() { - } + function A() {} return A; }()); var B; @@ -59,8 +63,7 @@ var Inner; Inner.c1 = 'a'; Inner.d1 = 1; var D = /** @class */ (function () { - function D() { - } + function D() {} return D; }()); Inner.e1 = new D; diff --git a/tests/baselines/reference/Protected3.js b/tests/baselines/reference/Protected3.js index 29b1f96effe8e..bfb44dc226c2f 100644 --- a/tests/baselines/reference/Protected3.js +++ b/tests/baselines/reference/Protected3.js @@ -5,7 +5,6 @@ class C { //// [Protected3.js] var C = /** @class */ (function () { - function C() { - } + function C() {} return C; }()); diff --git a/tests/baselines/reference/SystemModuleForStatementNoInitializer.js b/tests/baselines/reference/SystemModuleForStatementNoInitializer.js index ff31b3c73e284..079efeb3be997 100644 --- a/tests/baselines/reference/SystemModuleForStatementNoInitializer.js +++ b/tests/baselines/reference/SystemModuleForStatementNoInitializer.js @@ -19,8 +19,7 @@ for (; ;) { //// [SystemModuleForStatementNoInitializer.js] System.register([], function (exports_1, context_1) { - "use strict"; - var i, limit; + "use strict";var i, limit; var __moduleName = context_1 && context_1.id; return { setters: [], @@ -30,9 +29,11 @@ System.register([], function (exports_1, context_1) { for (; i < limit; ++i) { break; } + for (;; ++i) { break; } + for (;;) { break; } diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.js b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.js index 134c14e3a8ecb..425e55073a45a 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.js +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.js @@ -64,10 +64,8 @@ var A; var p; var p; var X; -(function (X) { - var Y; - (function (Y) { - var Z; +(function (X) {var Y; + (function (Y) {var Z; (function (Z) { var Line = /** @class */ (function () { function Line() { @@ -78,10 +76,8 @@ var X; })(Z = Y.Z || (Y.Z = {})); })(Y = X.Y || (X.Y = {})); })(X || (X = {})); -(function (X) { - var Y; - (function (Y) { - var Z; +(function (X) {var Y; + (function (Y) {var Z; (function (Z) { var Line = /** @class */ (function () { function Line() { @@ -94,3 +90,4 @@ var X; // ensure merges as expected var l; var l; + diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.js b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.js index b9218ea1a555a..870ffaaea37f0 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.js +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.js @@ -38,9 +38,14 @@ var l: X.Y.Z.Line; //// [TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.js] + + // ensure merges as expected var p; var p; + + + // ensure merges as expected var l; var l; diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.js b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.js index 16c37108d3f0a..66ca6cd1497b9 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.js +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.js @@ -72,6 +72,7 @@ var A; })(A || (A = {})); //// [part3.js] // test the merging actually worked + var o; var o; var o = A.Origin; diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.js b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.js index 9e7c7d46aee56..c243d924bc005 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.js +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.js @@ -52,10 +52,8 @@ var A; A.Point = Point; })(A || (A = {})); var X; -(function (X) { - var Y; - (function (Y) { - var Z; +(function (X) {var Y; + (function (Y) {var Z; (function (Z) { var Line = /** @class */ (function () { function Line() { @@ -66,10 +64,8 @@ var X; })(Z = Y.Z || (Y.Z = {})); })(Y = X.Y || (X.Y = {})); })(X || (X = {})); -(function (X) { - var Y; - (function (Y) { - var Z; +(function (X) {var Y; + (function (Y) {var Z; (function (Z) { // expected error var Line = /** @class */ (function () { diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.js b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.js index b54a0938a32ba..4b955ff6f2cbe 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.js +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.js @@ -38,9 +38,14 @@ var l: X.Y.Z.Line; //// [TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.js] + + // ensure merges as expected var p; var p; + + + // ensure merges as expected var l; var l; diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.js b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.js index c3c05c722539d..f1b114892ca03 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.js +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.js @@ -36,13 +36,11 @@ var l: X.Y.Z.Line; //// [TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.js] var A; -(function (A) { - var B; +(function (A) {var B; (function (B) { })(B = A.B || (A.B = {})); })(A || (A = {})); -(function (A) { - var B; +(function (A) {var B; (function (B) { })(B || (B = {})); })(A || (A = {})); @@ -50,10 +48,8 @@ var A; var x; var x = A.B.x; var X; -(function (X) { - var Y; - (function (Y) { - var Z; +(function (X) {var Y; + (function (Y) {var Z; (function (Z) { var Line = /** @class */ (function () { function Line() { @@ -64,10 +60,8 @@ var X; })(Z = Y.Z || (Y.Z = {})); })(Y = X.Y || (X.Y = {})); })(X || (X = {})); -(function (X) { - var Y; - (function (Y) { - var Z; +(function (X) {var Y; + (function (Y) {var Z; (function (Z) { var Line = /** @class */ (function () { function Line() { diff --git a/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.js b/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.js index 4b6ee2b14e4bd..4f782440c3b35 100644 --- a/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.js +++ b/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.js @@ -32,8 +32,7 @@ module otherRoot { //// [part1.js] var Root; -(function (Root) { - var A; +(function (Root) {var A; (function (A) { var Utils; (function (Utils) { @@ -46,8 +45,7 @@ var Root; })(Root || (Root = {})); //// [part2.js] var otherRoot; -(function (otherRoot) { - var A; +(function (otherRoot) {var A; (function (A) { // have to be fully qualified since in different root A.Origin = { x: 0, y: 0 }; diff --git a/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndSameCommonRoot.js b/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndSameCommonRoot.js index d221274edd87b..e899ebca1b3dc 100644 --- a/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndSameCommonRoot.js +++ b/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndSameCommonRoot.js @@ -68,6 +68,7 @@ var A; })(A || (A = {})); //// [part3.js] // test the merging actually worked + var o; var o; var o = A.Origin; diff --git a/tests/baselines/reference/TypeArgumentList1.js b/tests/baselines/reference/TypeArgumentList1.js index f6f5412ce1624..b76ec2b036b3d 100644 --- a/tests/baselines/reference/TypeArgumentList1.js +++ b/tests/baselines/reference/TypeArgumentList1.js @@ -2,5 +2,4 @@ Foo(4, 5, 6); //// [TypeArgumentList1.js] -Foo < A, B, ; -C > (4, 5, 6); +Foo < A, B, ;C > (4, 5, 6); diff --git a/tests/baselines/reference/TypeGuardWithEnumUnion.js b/tests/baselines/reference/TypeGuardWithEnumUnion.js index f582c70857af7..8f5ca6c42587c 100644 --- a/tests/baselines/reference/TypeGuardWithEnumUnion.js +++ b/tests/baselines/reference/TypeGuardWithEnumUnion.js @@ -53,6 +53,7 @@ function f1(x) { var z; } } + function f2(x) { if (typeof x === "object") { var y = x; diff --git a/tests/baselines/reference/VariableDeclaration12_es6.js b/tests/baselines/reference/VariableDeclaration12_es6.js index da0748d2191a1..e0567d1345eed 100644 --- a/tests/baselines/reference/VariableDeclaration12_es6.js +++ b/tests/baselines/reference/VariableDeclaration12_es6.js @@ -3,4 +3,5 @@ let x //// [VariableDeclaration12_es6.js] -let x; +let +x; diff --git a/tests/baselines/reference/VariableDeclaration13_es6.js b/tests/baselines/reference/VariableDeclaration13_es6.js index 152ca6a26d6c8..66ffa72d16b62 100644 --- a/tests/baselines/reference/VariableDeclaration13_es6.js +++ b/tests/baselines/reference/VariableDeclaration13_es6.js @@ -8,6 +8,4 @@ let[0] = 100; // An ExpressionStatement cannot start with the two token sequence `let [` because // that would make it ambiguous with a `let` LexicalDeclaration whose first LexicalBinding was an ArrayBindingPattern. var let; -let []; -0; -100; +let [];0;100; diff --git a/tests/baselines/reference/abstractClassInLocalScope.js b/tests/baselines/reference/abstractClassInLocalScope.js index b7409b6f9aa1c..19f6e21c096b9 100644 --- a/tests/baselines/reference/abstractClassInLocalScope.js +++ b/tests/baselines/reference/abstractClassInLocalScope.js @@ -22,11 +22,9 @@ var __extends = (this && this.__extends) || (function () { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -})(); -(function () { +})();(function () { var A = /** @class */ (function () { - function A() { - } + function A() {} return A; }()); var B = /** @class */ (function (_super) { diff --git a/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js b/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js index eda0c54ae060d..6ed0afe447e6c 100644 --- a/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js +++ b/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js @@ -22,11 +22,9 @@ var __extends = (this && this.__extends) || (function () { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -})(); -(function () { +})();(function () { var A = /** @class */ (function () { - function A() { - } + function A() {} return A; }()); var B = /** @class */ (function (_super) { diff --git a/tests/baselines/reference/abstractIdentifierNameStrict.js b/tests/baselines/reference/abstractIdentifierNameStrict.js index 92d159766d7e8..949159cb8b1e4 100644 --- a/tests/baselines/reference/abstractIdentifierNameStrict.js +++ b/tests/baselines/reference/abstractIdentifierNameStrict.js @@ -8,6 +8,7 @@ function foo() { //// [abstractIdentifierNameStrict.js] var abstract = true; + function foo() { "use strict"; var abstract = true; diff --git a/tests/baselines/reference/abstractProperty(target=es2015).js b/tests/baselines/reference/abstractProperty(target=es2015).js index 37eb53fd7cb0c..575436f87ec23 100644 --- a/tests/baselines/reference/abstractProperty(target=es2015).js +++ b/tests/baselines/reference/abstractProperty(target=es2015).js @@ -21,7 +21,9 @@ class A { console.log(this.x); } } + class B extends A { + constructor() { super(...arguments); Object.defineProperty(this, "x", { @@ -32,6 +34,7 @@ class B extends A { }); } } + class C extends A { get x() { return 'C.x'; } ; diff --git a/tests/baselines/reference/abstractProperty(target=esnext).js b/tests/baselines/reference/abstractProperty(target=esnext).js index dd2f6822080d9..88f1b01190b43 100644 --- a/tests/baselines/reference/abstractProperty(target=esnext).js +++ b/tests/baselines/reference/abstractProperty(target=esnext).js @@ -21,9 +21,11 @@ class A { console.log(this.x); } } + class B extends A { x = 'B.x'; } + class C extends A { get x() { return 'C.x'; } ; diff --git a/tests/baselines/reference/abstractPropertyInConstructor.js b/tests/baselines/reference/abstractPropertyInConstructor.js index 9048a5b9c416a..c1da10ece91b3 100644 --- a/tests/baselines/reference/abstractPropertyInConstructor.js +++ b/tests/baselines/reference/abstractPropertyInConstructor.js @@ -86,8 +86,7 @@ var __extends = (this && this.__extends) || (function () { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -})(); -var AbstractClass = /** @class */ (function () { +})();var AbstractClass = /** @class */ (function () { function AbstractClass(str, other) { var _this = this; this.other = this.prop; @@ -117,7 +116,9 @@ var DerivedAbstractClass = /** @class */ (function (_super) { _this.cb = function (s) { }; // there is no implementation of 'prop' in any base class _this.cb(_this.prop.toLowerCase()); + _this.method(1); + // OK, references are to another instance other.cb(other.prop); yetAnother.cb(yetAnother.prop); diff --git a/tests/baselines/reference/accessOverriddenBaseClassMember1.js b/tests/baselines/reference/accessOverriddenBaseClassMember1.js index b235ca259297a..c580165092b68 100644 --- a/tests/baselines/reference/accessOverriddenBaseClassMember1.js +++ b/tests/baselines/reference/accessOverriddenBaseClassMember1.js @@ -30,8 +30,7 @@ var __extends = (this && this.__extends) || (function () { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -})(); -var Point = /** @class */ (function () { +})();var Point = /** @class */ (function () { function Point(x, y) { this.x = x; this.y = y; diff --git a/tests/baselines/reference/accessorWithES3.js b/tests/baselines/reference/accessorWithES3.js index 5137754c845d1..e9a264b775a10 100644 --- a/tests/baselines/reference/accessorWithES3.js +++ b/tests/baselines/reference/accessorWithES3.js @@ -22,6 +22,7 @@ var y = { //// [accessorWithES3.js] // error to use accessors in ES3 mode + var C = /** @class */ (function () { function C() { } @@ -48,6 +49,7 @@ var D = /** @class */ (function () { var x = { get a() { return 1; } }; + var y = { set b(v) { } }; diff --git a/tests/baselines/reference/accessorWithES5.js b/tests/baselines/reference/accessorWithES5.js index 0f75d614de3e0..cdb4d597ab818 100644 --- a/tests/baselines/reference/accessorWithES5.js +++ b/tests/baselines/reference/accessorWithES5.js @@ -45,6 +45,7 @@ var D = /** @class */ (function () { var x = { get a() { return 1; } }; + var y = { set b(v) { } }; diff --git a/tests/baselines/reference/accessorWithInitializer.js b/tests/baselines/reference/accessorWithInitializer.js index 9fa2908855c36..823c7b7bc352c 100644 --- a/tests/baselines/reference/accessorWithInitializer.js +++ b/tests/baselines/reference/accessorWithInitializer.js @@ -9,16 +9,12 @@ var C = /** @class */ (function () { function C() { } Object.defineProperty(C.prototype, "X", { - set: function (v) { - if (v === void 0) { v = 0; } - }, + set: function (v) {if (v === void 0) { v = 0; }}, enumerable: false, configurable: true }); Object.defineProperty(C, "X", { - set: function (v2) { - if (v2 === void 0) { v2 = 0; } - }, + set: function (v2) {if (v2 === void 0) { v2 = 0; }}, enumerable: false, configurable: true }); diff --git a/tests/baselines/reference/accessorWithRestParam.js b/tests/baselines/reference/accessorWithRestParam.js index c9afc192f5064..f9457fa6e7417 100644 --- a/tests/baselines/reference/accessorWithRestParam.js +++ b/tests/baselines/reference/accessorWithRestParam.js @@ -9,8 +9,7 @@ var C = /** @class */ (function () { function C() { } Object.defineProperty(C.prototype, "X", { - set: function () { - var v = []; + set: function () {var v = []; for (var _i = 0; _i < arguments.length; _i++) { v[_i] = arguments[_i]; } @@ -19,8 +18,7 @@ var C = /** @class */ (function () { configurable: true }); Object.defineProperty(C, "X", { - set: function () { - var v2 = []; + set: function () {var v2 = []; for (var _i = 0; _i < arguments.length; _i++) { v2[_i] = arguments[_i]; } diff --git a/tests/baselines/reference/accessorsAreNotContextuallyTyped.js b/tests/baselines/reference/accessorsAreNotContextuallyTyped.js index 171fce799b9dd..097628aee7f5d 100644 --- a/tests/baselines/reference/accessorsAreNotContextuallyTyped.js +++ b/tests/baselines/reference/accessorsAreNotContextuallyTyped.js @@ -15,6 +15,7 @@ var r = c.x(''); // string //// [accessorsAreNotContextuallyTyped.js] // accessors are not contextually typed + var C = /** @class */ (function () { function C() { } diff --git a/tests/baselines/reference/accessorsEmit.js b/tests/baselines/reference/accessorsEmit.js index 46c35a643d5f2..6947390ac73d6 100644 --- a/tests/baselines/reference/accessorsEmit.js +++ b/tests/baselines/reference/accessorsEmit.js @@ -17,8 +17,7 @@ class Test2 { //// [accessorsEmit.js] var Result = /** @class */ (function () { - function Result() { - } + function Result() {} return Result; }()); var Test = /** @class */ (function () { diff --git a/tests/baselines/reference/accessorsInAmbientContext.js b/tests/baselines/reference/accessorsInAmbientContext.js index 8e608edae1a50..7c1afd7377de2 100644 --- a/tests/baselines/reference/accessorsInAmbientContext.js +++ b/tests/baselines/reference/accessorsInAmbientContext.js @@ -18,3 +18,4 @@ declare class C { } //// [accessorsInAmbientContext.js] + diff --git a/tests/baselines/reference/accessorsOverrideProperty2.js b/tests/baselines/reference/accessorsOverrideProperty2.js index e16ae60363e36..3a15aef291a8a 100644 --- a/tests/baselines/reference/accessorsOverrideProperty2.js +++ b/tests/baselines/reference/accessorsOverrideProperty2.js @@ -16,9 +16,11 @@ console.log(obj.x); // 1 class Base { x = 1; } + class Derived extends Base { get x() { return 2; } // should be an error set x(value) { console.log(`x was set to ${value}`); } } + const obj = new Derived(); // nothing printed console.log(obj.x); // 1 diff --git a/tests/baselines/reference/accessorsOverrideProperty5.js b/tests/baselines/reference/accessorsOverrideProperty5.js index fb7cee0630b67..c909c993789ce 100644 --- a/tests/baselines/reference/accessorsOverrideProperty5.js +++ b/tests/baselines/reference/accessorsOverrideProperty5.js @@ -11,8 +11,7 @@ class C extends B { //// [accessorsOverrideProperty5.js] -class B { -} +class B {} class C extends B { get p() { return 1; } set p(value) { } diff --git a/tests/baselines/reference/accessorsOverrideProperty6.js b/tests/baselines/reference/accessorsOverrideProperty6.js index 3cd61062c8626..b7480df638fb6 100644 --- a/tests/baselines/reference/accessorsOverrideProperty6.js +++ b/tests/baselines/reference/accessorsOverrideProperty6.js @@ -16,16 +16,14 @@ class D extends C { //// [accessorsOverrideProperty6.js] -class A { - constructor() { +class A {constructor() { this.p = 'yep'; } } class B extends A { get p() { return 'oh no'; } // error } -class C { - constructor() { +class C {constructor() { this.p = 101; } } diff --git a/tests/baselines/reference/accessorsOverrideProperty7.js b/tests/baselines/reference/accessorsOverrideProperty7.js index a879d2fe6eb6d..4941ae0282817 100644 --- a/tests/baselines/reference/accessorsOverrideProperty7.js +++ b/tests/baselines/reference/accessorsOverrideProperty7.js @@ -22,8 +22,7 @@ var __extends = (this && this.__extends) || (function () { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -})(); -var A = /** @class */ (function () { +})();var A = /** @class */ (function () { function A() { } return A; diff --git a/tests/baselines/reference/accessors_spec_section-4.5_inference.js b/tests/baselines/reference/accessors_spec_section-4.5_inference.js index 68e78690218e8..26014afbc2b2d 100644 --- a/tests/baselines/reference/accessors_spec_section-4.5_inference.js +++ b/tests/baselines/reference/accessors_spec_section-4.5_inference.js @@ -39,10 +39,8 @@ var __extends = (this && this.__extends) || (function () { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -})(); -var A = /** @class */ (function () { - function A() { - } +})();var A = /** @class */ (function () { + function A() {} return A; }()); var B = /** @class */ (function (_super) { diff --git a/tests/baselines/reference/addMoreCallSignaturesToBaseSignature.js b/tests/baselines/reference/addMoreCallSignaturesToBaseSignature.js index a08a0f4ba7594..ea17dbdbca710 100644 --- a/tests/baselines/reference/addMoreCallSignaturesToBaseSignature.js +++ b/tests/baselines/reference/addMoreCallSignaturesToBaseSignature.js @@ -12,5 +12,7 @@ var kitty = a(); //// [addMoreCallSignaturesToBaseSignature.js] + + var a; var kitty = a(); diff --git a/tests/baselines/reference/addMoreCallSignaturesToBaseSignature2.js b/tests/baselines/reference/addMoreCallSignaturesToBaseSignature2.js index 73f7316dedc3c..cd54d07cfd103 100644 --- a/tests/baselines/reference/addMoreCallSignaturesToBaseSignature2.js +++ b/tests/baselines/reference/addMoreCallSignaturesToBaseSignature2.js @@ -11,5 +11,7 @@ var a: Bar; var kitty = a(1); //// [addMoreCallSignaturesToBaseSignature2.js] + + var a; var kitty = a(1); diff --git a/tests/baselines/reference/addMoreOverloadsToBaseSignature.js b/tests/baselines/reference/addMoreOverloadsToBaseSignature.js index 3a821da7382f4..9b8f8886168e9 100644 --- a/tests/baselines/reference/addMoreOverloadsToBaseSignature.js +++ b/tests/baselines/reference/addMoreOverloadsToBaseSignature.js @@ -9,3 +9,4 @@ interface Bar extends Foo { //// [addMoreOverloadsToBaseSignature.js] + diff --git a/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js b/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js index 82559b521dd85..a5f95d54743d1 100644 --- a/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js +++ b/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js @@ -54,8 +54,7 @@ var E; E[E["c"] = 2] = "c"; })(E || (E = {})); var M; -(function (M) { -})(M || (M = {})); +(function (M) {})(M || (M = {})); var a; var b; var c; @@ -67,11 +66,13 @@ var r2 = a + b; var r3 = a + c; var r4 = a + d; var r5 = a + e; + // any as right operand, result is type Any except plusing string var r6 = b + a; var r7 = c + a; var r8 = d + a; var r9 = e + a; + // other cases var r10 = a + foo; var r11 = a + foo(); diff --git a/tests/baselines/reference/additionOperatorWithInvalidOperands.js b/tests/baselines/reference/additionOperatorWithInvalidOperands.js index fe7a332b5eef1..a268d301ee8b2 100644 --- a/tests/baselines/reference/additionOperatorWithInvalidOperands.js +++ b/tests/baselines/reference/additionOperatorWithInvalidOperands.js @@ -55,8 +55,7 @@ var E; E[E["c"] = 2] = "c"; })(E || (E = {})); var M; -(function (M) { -})(M || (M = {})); +(function (M) {})(M || (M = {})); var a; var b; var c; @@ -65,14 +64,17 @@ var d; var r1 = a + a; var r2 = a + b; var r3 = a + c; + // number + every type except any and string var r4 = b + a; var r5 = b + b; // number + number is valid var r6 = b + c; + // object + every type except any and string var r7 = c + a; var r8 = c + b; var r9 = c + c; + // other cases var r10 = a + true; var r11 = true + false; diff --git a/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js b/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js index 79d3c0b9b8da0..55887dac7051d 100644 --- a/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js +++ b/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js @@ -25,7 +25,9 @@ var r11 = null + (() => { }); //// [additionOperatorWithNullValueAndInvalidOperator.js] // If one operand is the null or undefined value, it is treated as having the type of the other operand. + function foo() { return undefined; } + var a; var b; var c; @@ -37,6 +39,7 @@ var r3 = null + c; var r4 = a + null; var r5 = b + null; var r6 = null + c; + // other cases var r7 = null + d; var r8 = null + true; diff --git a/tests/baselines/reference/additionOperatorWithNullValueAndValidOperator.js b/tests/baselines/reference/additionOperatorWithNullValueAndValidOperator.js index 1b5cb877d21bc..a358cb2141484 100644 --- a/tests/baselines/reference/additionOperatorWithNullValueAndValidOperator.js +++ b/tests/baselines/reference/additionOperatorWithNullValueAndValidOperator.js @@ -42,6 +42,7 @@ var a; var b; var c; var d; + // null + any var r1 = null + a; var r2 = a + null; @@ -56,6 +57,7 @@ var r9 = 1 + null; var r10 = c + null; var r11 = E.a + null; var r12 = E['a'] + null; + // null + string var r13 = null + d; var r14 = null + ''; diff --git a/tests/baselines/reference/additionOperatorWithNumberAndEnum.js b/tests/baselines/reference/additionOperatorWithNumberAndEnum.js index d559e98dc3eff..cf13789132bcc 100644 --- a/tests/baselines/reference/additionOperatorWithNumberAndEnum.js +++ b/tests/baselines/reference/additionOperatorWithNumberAndEnum.js @@ -42,11 +42,13 @@ var r1 = a + a; var r2 = a + b; var r3 = b + a; var r4 = b + b; + var r5 = 0 + a; var r6 = E.a + 0; var r7 = E.a + E.b; var r8 = E['a'] + E['b']; var r9 = E['a'] + F['c']; + var r10 = a + c; var r11 = c + a; var r12 = b + c; diff --git a/tests/baselines/reference/additionOperatorWithStringAndEveryType.js b/tests/baselines/reference/additionOperatorWithStringAndEveryType.js index 03456020c802f..d81939a318c03 100644 --- a/tests/baselines/reference/additionOperatorWithStringAndEveryType.js +++ b/tests/baselines/reference/additionOperatorWithStringAndEveryType.js @@ -52,6 +52,7 @@ var d; var e; var f; var g; + var x; // string could plus every type, and the result is always string // string as left operand @@ -62,6 +63,7 @@ var r4 = x + d; var r5 = x + e; var r6 = x + f; var r7 = x + g; + // string as right operand var r8 = a + x; var r9 = b + x; @@ -70,6 +72,7 @@ var r11 = d + x; var r12 = e + x; var r13 = f + x; var r14 = g + x; + // other cases var r15 = x + E; var r16 = x + E.a; diff --git a/tests/baselines/reference/additionOperatorWithTypeParameter.js b/tests/baselines/reference/additionOperatorWithTypeParameter.js index a568f420a32a4..c040fa6d32281 100644 --- a/tests/baselines/reference/additionOperatorWithTypeParameter.js +++ b/tests/baselines/reference/additionOperatorWithTypeParameter.js @@ -53,6 +53,7 @@ function foo(t, u) { var e; var g; var f; + // type parameter as left operand var r1 = t + a; // ok, one operand is any var r2 = t + b; @@ -61,6 +62,7 @@ function foo(t, u) { var r5 = t + e; var r6 = t + g; var r7 = t + f; + // type parameter as right operand var r8 = a + t; // ok, one operand is any var r9 = b + t; @@ -69,6 +71,7 @@ function foo(t, u) { var r12 = e + t; var r13 = g + t; var r14 = f + t; + // other cases var r15 = t + null; var r16 = t + undefined; diff --git a/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js b/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js index 98935db2b86e6..108510c24f80a 100644 --- a/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js +++ b/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js @@ -25,7 +25,9 @@ var r11 = undefined + (() => { }); //// [additionOperatorWithUndefinedValueAndInvalidOperands.js] // If one operand is the null or undefined value, it is treated as having the type of the other operand. + function foo() { return undefined; } + var a; var b; var c; @@ -37,6 +39,7 @@ var r3 = undefined + c; var r4 = a + undefined; var r5 = b + undefined; var r6 = undefined + c; + // other cases var r7 = undefined + d; var r8 = undefined + true; diff --git a/tests/baselines/reference/additionOperatorWithUndefinedValueAndValidOperator.js b/tests/baselines/reference/additionOperatorWithUndefinedValueAndValidOperator.js index 68804694449e1..65ee95df1c4a6 100644 --- a/tests/baselines/reference/additionOperatorWithUndefinedValueAndValidOperator.js +++ b/tests/baselines/reference/additionOperatorWithUndefinedValueAndValidOperator.js @@ -42,6 +42,7 @@ var a; var b; var c; var d; + // undefined + any var r1 = undefined + a; var r2 = a + undefined; @@ -56,6 +57,7 @@ var r9 = 1 + undefined; var r10 = c + undefined; var r11 = E.a + undefined; var r12 = E['a'] + undefined; + // undefined + string var r13 = undefined + d; var r14 = undefined + ''; diff --git a/tests/baselines/reference/aliasBug.js b/tests/baselines/reference/aliasBug.js index 502bc9e11a715..3a5cdeeffcce1 100644 --- a/tests/baselines/reference/aliasBug.js +++ b/tests/baselines/reference/aliasBug.js @@ -29,12 +29,9 @@ var foo; }()); foo.Provide = Provide; var bar; - (function (bar) { - var baz; - (function (baz) { - var boo = /** @class */ (function () { - function boo() { - } + (function (bar) {var baz; + (function (baz) {var boo = /** @class */ (function () { + function boo() {} return boo; }()); baz.boo = boo; diff --git a/tests/baselines/reference/aliasErrors.js b/tests/baselines/reference/aliasErrors.js index 54edb24fff32d..b28d9dbfec8a9 100644 --- a/tests/baselines/reference/aliasErrors.js +++ b/tests/baselines/reference/aliasErrors.js @@ -40,12 +40,9 @@ var foo; }()); foo.Provide = Provide; var bar; - (function (bar) { - var baz; - (function (baz) { - var boo = /** @class */ (function () { - function boo() { - } + (function (bar) {var baz; + (function (baz) {var boo = /** @class */ (function () { + function boo() {} return boo; }()); baz.boo = boo; @@ -55,6 +52,7 @@ var foo; var provide = foo; var booz = foo.bar.baz; var beez = foo.bar; + var m = no; var m2 = no.mod; 5; @@ -63,9 +61,11 @@ null; var r = undefined; var p = new provide.Provide(); function use() { + beez.baz.boo; var p1; var p2; var p3; var p22 = new provide.Provide(); } + diff --git a/tests/baselines/reference/aliasInaccessibleModule2.js b/tests/baselines/reference/aliasInaccessibleModule2.js index 89b7e66c96224..e10650ea1475d 100644 --- a/tests/baselines/reference/aliasInaccessibleModule2.js +++ b/tests/baselines/reference/aliasInaccessibleModule2.js @@ -11,8 +11,7 @@ module M { //// [aliasInaccessibleModule2.js] var M; -(function (M) { - var N; +(function (M) {var N; (function (N) { var C = /** @class */ (function () { function C() { diff --git a/tests/baselines/reference/aliasOfGenericFunctionWithRestBehavedSameAsUnaliased.js b/tests/baselines/reference/aliasOfGenericFunctionWithRestBehavedSameAsUnaliased.js index 567b75e850241..9fbad672a51f6 100644 --- a/tests/baselines/reference/aliasOfGenericFunctionWithRestBehavedSameAsUnaliased.js +++ b/tests/baselines/reference/aliasOfGenericFunctionWithRestBehavedSameAsUnaliased.js @@ -37,6 +37,28 @@ let check3: test3 = "y"; "use strict"; // the type printback for every `test` below should be "y" var check = "y"; + + + + + + + + + var check1 = "y"; + + + + + + + + var check2 = "y"; + + + + + var check3 = "y"; diff --git a/tests/baselines/reference/aliasUsageInArray.js b/tests/baselines/reference/aliasUsageInArray.js index bbb7e86ab5677..749844c3e101b 100644 --- a/tests/baselines/reference/aliasUsageInArray.js +++ b/tests/baselines/reference/aliasUsageInArray.js @@ -63,5 +63,6 @@ exports.VisualizationModel = VisualizationModel; "use strict"; exports.__esModule = true; var moduleA = require("./aliasUsageInArray_moduleA"); + var xs = [moduleA]; var xs2 = [moduleA]; diff --git a/tests/baselines/reference/aliasUsedAsNameValue.js b/tests/baselines/reference/aliasUsedAsNameValue.js index 82ff8fc411cec..a4fae5f330c90 100644 --- a/tests/baselines/reference/aliasUsedAsNameValue.js +++ b/tests/baselines/reference/aliasUsedAsNameValue.js @@ -36,6 +36,7 @@ exports.a = void 0; /// var mod = require("./aliasUsedAsNameValue_0"); var b = require("./aliasUsedAsNameValue_1"); + var a = function () { //var x = mod.id; // TODO needed hack that mod is loaded b.b(mod); diff --git a/tests/baselines/reference/aliasesInSystemModule1.js b/tests/baselines/reference/aliasesInSystemModule1.js index 468ff805b2dde..df9deade0fc19 100644 --- a/tests/baselines/reference/aliasesInSystemModule1.js +++ b/tests/baselines/reference/aliasesInSystemModule1.js @@ -17,13 +17,11 @@ module M { //// [aliasesInSystemModule1.js] System.register(["foo"], function (exports_1, context_1) { - "use strict"; - var alias, cls, cls2, x, y, z, M; + "use strict";var alias, cls, cls2, x, y, z, M; var __moduleName = context_1 && context_1.id; return { setters: [ - function (alias_1) { - alias = alias_1; + function (alias_1) {alias = alias_1; } ], execute: function () { diff --git a/tests/baselines/reference/aliasesInSystemModule2.js b/tests/baselines/reference/aliasesInSystemModule2.js index af7208d5c99ec..242c34ea4c8ab 100644 --- a/tests/baselines/reference/aliasesInSystemModule2.js +++ b/tests/baselines/reference/aliasesInSystemModule2.js @@ -16,13 +16,11 @@ module M { //// [aliasesInSystemModule2.js] System.register(["foo"], function (exports_1, context_1) { - "use strict"; - var foo_1, cls, cls2, x, y, z, M; + "use strict";var foo_1, cls, cls2, x, y, z, M; var __moduleName = context_1 && context_1.id; return { setters: [ - function (foo_1_1) { - foo_1 = foo_1_1; + function (foo_1_1) {foo_1 = foo_1_1; } ], execute: function () { diff --git a/tests/baselines/reference/allowImportClausesToMergeWithTypes.js b/tests/baselines/reference/allowImportClausesToMergeWithTypes.js index 9c50acdfb1a90..26c81a23771a4 100644 --- a/tests/baselines/reference/allowImportClausesToMergeWithTypes.js +++ b/tests/baselines/reference/allowImportClausesToMergeWithTypes.js @@ -37,6 +37,7 @@ exports["default"] = exports.zzz; "use strict"; exports.__esModule = true; exports["default"] = void 0; + var b_1 = require("./b"); exports["default"] = b_1["default"]; var x = { x: "" }; diff --git a/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.js b/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.js index 43fdb9f639a76..6d71d3520d1d0 100644 --- a/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.js +++ b/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.js @@ -23,6 +23,7 @@ export var a = vextend({ "use strict"; exports.__esModule = true; exports.vextend = void 0; + exports.vextend = extend; //// [app.js] "use strict"; diff --git a/tests/baselines/reference/allowSyntheticDefaultImports2.js b/tests/baselines/reference/allowSyntheticDefaultImports2.js index ea83065c884f4..c1ffd46f7db20 100644 --- a/tests/baselines/reference/allowSyntheticDefaultImports2.js +++ b/tests/baselines/reference/allowSyntheticDefaultImports2.js @@ -11,13 +11,11 @@ export class Foo { //// [a.js] System.register(["./b"], function (exports_1, context_1) { - "use strict"; - var b_1, x; + "use strict";var b_1, x; var __moduleName = context_1 && context_1.id; return { setters: [ - function (b_1_1) { - b_1 = b_1_1; + function (b_1_1) {b_1 = b_1_1; } ], execute: function () { diff --git a/tests/baselines/reference/allowSyntheticDefaultImports3.js b/tests/baselines/reference/allowSyntheticDefaultImports3.js index d7eca3ead884d..337fb80869ca8 100644 --- a/tests/baselines/reference/allowSyntheticDefaultImports3.js +++ b/tests/baselines/reference/allowSyntheticDefaultImports3.js @@ -12,14 +12,12 @@ export class Foo { //// [b.js] System.register([], function (exports_1, context_1) { - "use strict"; - var Foo; + "use strict";var Foo; var __moduleName = context_1 && context_1.id; return { setters: [], execute: function () { - Foo = /** @class */ (function () { - function Foo() { + Foo = /** @class */ (function () {function Foo() { } return Foo; }()); @@ -29,13 +27,11 @@ System.register([], function (exports_1, context_1) { }); //// [a.js] System.register(["./b"], function (exports_1, context_1) { - "use strict"; - var b_1, x; + "use strict";var b_1, x; var __moduleName = context_1 && context_1.id; return { setters: [ - function (b_1_1) { - b_1 = b_1_1; + function (b_1_1) {b_1 = b_1_1; } ], execute: function () { diff --git a/tests/baselines/reference/allowSyntheticDefaultImports5.js b/tests/baselines/reference/allowSyntheticDefaultImports5.js index 81de76c395fd4..130abddc75f96 100644 --- a/tests/baselines/reference/allowSyntheticDefaultImports5.js +++ b/tests/baselines/reference/allowSyntheticDefaultImports5.js @@ -13,13 +13,11 @@ export var x = new Foo(); //// [a.js] System.register(["./b"], function (exports_1, context_1) { - "use strict"; - var b_1, x; + "use strict";var b_1, x; var __moduleName = context_1 && context_1.id; return { setters: [ - function (b_1_1) { - b_1 = b_1_1; + function (b_1_1) {b_1 = b_1_1; } ], execute: function () { diff --git a/tests/baselines/reference/allowSyntheticDefaultImports6.js b/tests/baselines/reference/allowSyntheticDefaultImports6.js index 7d351b6508177..da9d63f5cc105 100644 --- a/tests/baselines/reference/allowSyntheticDefaultImports6.js +++ b/tests/baselines/reference/allowSyntheticDefaultImports6.js @@ -13,13 +13,11 @@ export var x = new Foo(); //// [a.js] System.register(["./b"], function (exports_1, context_1) { - "use strict"; - var b_1, x; + "use strict";var b_1, x; var __moduleName = context_1 && context_1.id; return { setters: [ - function (b_1_1) { - b_1 = b_1_1; + function (b_1_1) {b_1 = b_1_1; } ], execute: function () { diff --git a/tests/baselines/reference/allowSyntheticDefaultImports7.js b/tests/baselines/reference/allowSyntheticDefaultImports7.js index 39e6c2ae5e033..23ccd7fe1390b 100644 --- a/tests/baselines/reference/allowSyntheticDefaultImports7.js +++ b/tests/baselines/reference/allowSyntheticDefaultImports7.js @@ -12,13 +12,11 @@ Foo.foo(); //// [a.js] System.register(["./b"], function (exports_1, context_1) { - "use strict"; - var b_1; + "use strict";var b_1; var __moduleName = context_1 && context_1.id; return { setters: [ - function (b_1_1) { - b_1 = b_1_1; + function (b_1_1) {b_1 = b_1_1; } ], execute: function () { diff --git a/tests/baselines/reference/allowSyntheticDefaultImports8.js b/tests/baselines/reference/allowSyntheticDefaultImports8.js index e1157b8297a24..ad8928419aad8 100644 --- a/tests/baselines/reference/allowSyntheticDefaultImports8.js +++ b/tests/baselines/reference/allowSyntheticDefaultImports8.js @@ -12,13 +12,11 @@ Foo.foo(); //// [a.js] System.register(["./b"], function (exports_1, context_1) { - "use strict"; - var b_1; + "use strict";var b_1; var __moduleName = context_1 && context_1.id; return { setters: [ - function (b_1_1) { - b_1 = b_1_1; + function (b_1_1) {b_1 = b_1_1; } ], execute: function () { diff --git a/tests/baselines/reference/ambient.js b/tests/baselines/reference/ambient.js index 6d4190bf34cdb..6f8a06ffecbb0 100644 --- a/tests/baselines/reference/ambient.js +++ b/tests/baselines/reference/ambient.js @@ -16,8 +16,7 @@ declare namespace ns { exports.__esModule = true; exports.A = void 0; var A = /** @class */ (function () { - function A() { - } + function A() {} return A; }()); exports.A = A; diff --git a/tests/baselines/reference/ambientClassDeclarationWithExtends.js b/tests/baselines/reference/ambientClassDeclarationWithExtends.js index 1b7bcf88b2084..fd7efd8926fba 100644 --- a/tests/baselines/reference/ambientClassDeclarationWithExtends.js +++ b/tests/baselines/reference/ambientClassDeclarationWithExtends.js @@ -24,10 +24,12 @@ var f: E = new F(); //// [ambientClassDeclarationExtends_singleFile.js] + var D; (function (D) { var x; })(D || (D = {})); + var d = new D(); //// [ambientClassDeclarationExtends_file1.js] var F; diff --git a/tests/baselines/reference/ambientDeclarations.js b/tests/baselines/reference/ambientDeclarations.js index 729ecf7d45e21..10b6dbccaa9bd 100644 --- a/tests/baselines/reference/ambientDeclarations.js +++ b/tests/baselines/reference/ambientDeclarations.js @@ -77,7 +77,17 @@ declare module 'external1' { //// [ambientDeclarations.js] + + + + + + + + + var x = E3.B; // Ambient module members are always exported with or without export keyword var p = M1.x; var q = M1.fn(); + diff --git a/tests/baselines/reference/ambientDeclarationsExternal.js b/tests/baselines/reference/ambientDeclarationsExternal.js index ed413fb0d8e2f..eac515ebb70d0 100644 --- a/tests/baselines/reference/ambientDeclarationsExternal.js +++ b/tests/baselines/reference/ambientDeclarationsExternal.js @@ -24,6 +24,8 @@ var n: number; //// [decls.js] + + // Ambient external import declaration referencing ambient external module using top level module name //// [consumer.js] "use strict"; diff --git a/tests/baselines/reference/ambientDeclarationsPatterns_merging1.js b/tests/baselines/reference/ambientDeclarationsPatterns_merging1.js index 56abd8298cdf2..b947d0f6b7ade 100644 --- a/tests/baselines/reference/ambientDeclarationsPatterns_merging1.js +++ b/tests/baselines/reference/ambientDeclarationsPatterns_merging1.js @@ -17,6 +17,7 @@ import { everywhere, onlyInA } from "b.foo"; // Error //// [types.js] + //// [testA.js] "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/ambientDeclarationsPatterns_merging2.js b/tests/baselines/reference/ambientDeclarationsPatterns_merging2.js index 65726bba7225e..8f1ee0800c4b6 100644 --- a/tests/baselines/reference/ambientDeclarationsPatterns_merging2.js +++ b/tests/baselines/reference/ambientDeclarationsPatterns_merging2.js @@ -19,6 +19,7 @@ declare module "a.foo" { } //// [types.js] + //// [testA.js] "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/ambientDeclarationsPatterns_merging3.js b/tests/baselines/reference/ambientDeclarationsPatterns_merging3.js index 763f0e94bdb56..a03c4a7d78553 100644 --- a/tests/baselines/reference/ambientDeclarationsPatterns_merging3.js +++ b/tests/baselines/reference/ambientDeclarationsPatterns_merging3.js @@ -18,4 +18,5 @@ ohno.a // oh no //// [test.js] "use strict"; exports.__esModule = true; + ohno.a; // oh no diff --git a/tests/baselines/reference/ambientEnum1.js b/tests/baselines/reference/ambientEnum1.js index 8a477ab99fabe..b768b25faf8ab 100644 --- a/tests/baselines/reference/ambientEnum1.js +++ b/tests/baselines/reference/ambientEnum1.js @@ -9,3 +9,4 @@ } //// [ambientEnum1.js] + diff --git a/tests/baselines/reference/ambientEnumDeclaration1.js b/tests/baselines/reference/ambientEnumDeclaration1.js index dcdb100e90696..d6d4e5aa3e340 100644 --- a/tests/baselines/reference/ambientEnumDeclaration1.js +++ b/tests/baselines/reference/ambientEnumDeclaration1.js @@ -11,3 +11,4 @@ declare enum E { //// [ambientEnumDeclaration1.js] // In ambient enum declarations, all values specified in enum member declarations must be classified as constant enum expressions. + diff --git a/tests/baselines/reference/ambientEnumDeclaration2.js b/tests/baselines/reference/ambientEnumDeclaration2.js index 8ef6facfe6d0d..4796b275013ef 100644 --- a/tests/baselines/reference/ambientEnumDeclaration2.js +++ b/tests/baselines/reference/ambientEnumDeclaration2.js @@ -15,3 +15,5 @@ declare const enum E1 { //// [ambientEnumDeclaration2.js] // In ambient enum declarations that specify no const modifier, enum member declarations // that omit a value are considered computed members (as opposed to having auto- incremented values assigned). + + diff --git a/tests/baselines/reference/ambientErrors.js b/tests/baselines/reference/ambientErrors.js index c524a6cfe72fc..80d346399e689 100644 --- a/tests/baselines/reference/ambientErrors.js +++ b/tests/baselines/reference/ambientErrors.js @@ -60,4 +60,14 @@ declare module 'bar' { //// [ambientErrors.js] + + + + + ; + + + + + diff --git a/tests/baselines/reference/ambientExternalModuleInAnotherExternalModule.js b/tests/baselines/reference/ambientExternalModuleInAnotherExternalModule.js index d6db77b6050ef..ebb7ab1e3c5f3 100644 --- a/tests/baselines/reference/ambientExternalModuleInAnotherExternalModule.js +++ b/tests/baselines/reference/ambientExternalModuleInAnotherExternalModule.js @@ -12,10 +12,8 @@ var x = ext; //// [ambientExternalModuleInAnotherExternalModule.js] define(["require", "exports", "ext"], function (require, exports, ext) { - "use strict"; - var D = /** @class */ (function () { - function D() { - } + "use strict";var D = /** @class */ (function () { + function D() {} return D; }()); var x = ext; diff --git a/tests/baselines/reference/ambientExternalModuleInsideNonAmbientExternalModule.js b/tests/baselines/reference/ambientExternalModuleInsideNonAmbientExternalModule.js index 401af4b5214b1..76a10a1d949bf 100644 --- a/tests/baselines/reference/ambientExternalModuleInsideNonAmbientExternalModule.js +++ b/tests/baselines/reference/ambientExternalModuleInsideNonAmbientExternalModule.js @@ -3,6 +3,5 @@ export declare module "M" { } //// [ambientExternalModuleInsideNonAmbientExternalModule.js] define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; }); diff --git a/tests/baselines/reference/ambientExternalModuleMerging.js b/tests/baselines/reference/ambientExternalModuleMerging.js index 6c2de62c90a66..e17e116211847 100644 --- a/tests/baselines/reference/ambientExternalModuleMerging.js +++ b/tests/baselines/reference/ambientExternalModuleMerging.js @@ -18,10 +18,10 @@ declare module "M" { //// [ambientExternalModuleMerging_use.js] define(["require", "exports", "M"], function (require, exports, M) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; // Should be strings var x = M.x; var y = M.y; }); //// [ambientExternalModuleMerging_declare.js] + diff --git a/tests/baselines/reference/ambientExternalModuleWithInternalImportDeclaration.js b/tests/baselines/reference/ambientExternalModuleWithInternalImportDeclaration.js index 9efd9e4ada9fc..5af9913c55964 100644 --- a/tests/baselines/reference/ambientExternalModuleWithInternalImportDeclaration.js +++ b/tests/baselines/reference/ambientExternalModuleWithInternalImportDeclaration.js @@ -21,7 +21,6 @@ var c = new A(); //// [ambientExternalModuleWithInternalImportDeclaration_0.js] //// [ambientExternalModuleWithInternalImportDeclaration_1.js] define(["require", "exports", "M"], function (require, exports, A) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; var c = new A(); }); diff --git a/tests/baselines/reference/ambientExternalModuleWithRelativeModuleName.js b/tests/baselines/reference/ambientExternalModuleWithRelativeModuleName.js index 9a4622a1b7e97..c00140e931516 100644 --- a/tests/baselines/reference/ambientExternalModuleWithRelativeModuleName.js +++ b/tests/baselines/reference/ambientExternalModuleWithRelativeModuleName.js @@ -8,3 +8,4 @@ declare module ".\\relativeModule" { } //// [ambientExternalModuleWithRelativeModuleName.js] + diff --git a/tests/baselines/reference/ambientExternalModuleWithoutInternalImportDeclaration.js b/tests/baselines/reference/ambientExternalModuleWithoutInternalImportDeclaration.js index 98d3d46912aae..8010cc784164f 100644 --- a/tests/baselines/reference/ambientExternalModuleWithoutInternalImportDeclaration.js +++ b/tests/baselines/reference/ambientExternalModuleWithoutInternalImportDeclaration.js @@ -20,7 +20,6 @@ var c = new A(); //// [ambientExternalModuleWithoutInternalImportDeclaration_0.js] //// [ambientExternalModuleWithoutInternalImportDeclaration_1.js] define(["require", "exports", "M"], function (require, exports, A) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; var c = new A(); }); diff --git a/tests/baselines/reference/ambientGetters.js b/tests/baselines/reference/ambientGetters.js index db2310646afa8..ef8fe50b95cf6 100644 --- a/tests/baselines/reference/ambientGetters.js +++ b/tests/baselines/reference/ambientGetters.js @@ -8,3 +8,4 @@ declare class B { } //// [ambientGetters.js] + diff --git a/tests/baselines/reference/ambientInsideNonAmbientExternalModule.js b/tests/baselines/reference/ambientInsideNonAmbientExternalModule.js index 689cd6a12420b..c9ee50475cb94 100644 --- a/tests/baselines/reference/ambientInsideNonAmbientExternalModule.js +++ b/tests/baselines/reference/ambientInsideNonAmbientExternalModule.js @@ -7,6 +7,5 @@ export declare module M { } //// [ambientInsideNonAmbientExternalModule.js] define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; }); diff --git a/tests/baselines/reference/ambientRequireFunction.js b/tests/baselines/reference/ambientRequireFunction.js index 348ee0a144389..81a28cebc4785 100644 --- a/tests/baselines/reference/ambientRequireFunction.js +++ b/tests/baselines/reference/ambientRequireFunction.js @@ -15,5 +15,6 @@ const text = fs.readFileSync("/a/b/c"); //// [app.js] /// + var fs = require("fs"); var text = fs.readFileSync("/a/b/c"); diff --git a/tests/baselines/reference/ambiguousCallsWhereReturnTypesAgree.js b/tests/baselines/reference/ambiguousCallsWhereReturnTypesAgree.js index 6937384136dda..56c04b53471e2 100644 --- a/tests/baselines/reference/ambiguousCallsWhereReturnTypesAgree.js +++ b/tests/baselines/reference/ambiguousCallsWhereReturnTypesAgree.js @@ -34,6 +34,9 @@ var TestClass = /** @class */ (function () { } TestClass.prototype.bar = function (x) { }; + + + TestClass.prototype.foo = function (x) { this.bar(x); // should not error }; @@ -45,6 +48,9 @@ var TestClass2 = /** @class */ (function () { TestClass2.prototype.bar = function (x) { return 0; }; + + + TestClass2.prototype.foo = function (x) { return this.bar(x); // should not error }; diff --git a/tests/baselines/reference/ambiguousGenericAssertion1.js b/tests/baselines/reference/ambiguousGenericAssertion1.js index 8d40873036caa..24508ea2bbd04 100644 --- a/tests/baselines/reference/ambiguousGenericAssertion1.js +++ b/tests/baselines/reference/ambiguousGenericAssertion1.js @@ -9,5 +9,4 @@ var r3 = <(x: T) => T>f; // ambiguous, appears to the parser as a << operatio function f(x) { return null; } var r = function (x) { return x; }; var r2 = f; // valid -var r3 = << T > (x), T; -T > f; // ambiguous, appears to the parser as a << operation +var r3 = << T > (x), T;T > f; // ambiguous, appears to the parser as a << operation diff --git a/tests/baselines/reference/ambiguousOverload.js b/tests/baselines/reference/ambiguousOverload.js index 642f09dca1683..cfbe62e7c2c72 100644 --- a/tests/baselines/reference/ambiguousOverload.js +++ b/tests/baselines/reference/ambiguousOverload.js @@ -16,6 +16,7 @@ function foof(bar) { return bar; } ; var x = foof("s", null); var y = foof("s", null); + function foof2(bar) { return bar; } ; var x2 = foof2("s", null); diff --git a/tests/baselines/reference/ambiguousOverloadResolution.js b/tests/baselines/reference/ambiguousOverloadResolution.js index 640be084fbaca..4c86ae0f53fad 100644 --- a/tests/baselines/reference/ambiguousOverloadResolution.js +++ b/tests/baselines/reference/ambiguousOverloadResolution.js @@ -23,10 +23,8 @@ var __extends = (this && this.__extends) || (function () { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -})(); -var A = /** @class */ (function () { - function A() { - } +})();var A = /** @class */ (function () { + function A() {} return A; }()); var B = /** @class */ (function (_super) { @@ -36,5 +34,6 @@ var B = /** @class */ (function (_super) { } return B; }(A)); + var x; var t = f(x, x); // Not an error diff --git a/tests/baselines/reference/amdDeclarationEmitNoExtraDeclare.js b/tests/baselines/reference/amdDeclarationEmitNoExtraDeclare.js index 294bbd4ab01bc..65ca081411701 100644 --- a/tests/baselines/reference/amdDeclarationEmitNoExtraDeclare.js +++ b/tests/baselines/reference/amdDeclarationEmitNoExtraDeclare.js @@ -38,14 +38,12 @@ var __extends = (this && this.__extends) || (function () { }; })(); define("Configurable", ["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; exports.Configurable = void 0; function Configurable(base) { return /** @class */ (function (_super) { __extends(class_1, _super); - function class_1() { - var args = []; + function class_1() {var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } @@ -57,12 +55,10 @@ define("Configurable", ["require", "exports"], function (require, exports) { exports.Configurable = Configurable; }); define("Class", ["require", "exports", "Configurable"], function (require, exports, Configurable_1) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; exports.ActualClass = exports.HiddenClass = void 0; var HiddenClass = /** @class */ (function () { - function HiddenClass() { - } + function HiddenClass() {} return HiddenClass; }()); exports.HiddenClass = HiddenClass; diff --git a/tests/baselines/reference/amdDependencyComment2.js b/tests/baselines/reference/amdDependencyComment2.js index 222093cf15933..6c14194b76014 100644 --- a/tests/baselines/reference/amdDependencyComment2.js +++ b/tests/baselines/reference/amdDependencyComment2.js @@ -7,7 +7,6 @@ m1.f(); //// [amdDependencyComment2.js] /// define(["require", "exports", "m2", "bar"], function (require, exports, m1) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; m1.f(); }); diff --git a/tests/baselines/reference/amdDependencyCommentName2.js b/tests/baselines/reference/amdDependencyCommentName2.js index c39902371a0cf..eab22208247b4 100644 --- a/tests/baselines/reference/amdDependencyCommentName2.js +++ b/tests/baselines/reference/amdDependencyCommentName2.js @@ -7,7 +7,6 @@ m1.f(); //// [amdDependencyCommentName2.js] /// define(["require", "exports", "bar", "m2"], function (require, exports, b, m1) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; m1.f(); }); diff --git a/tests/baselines/reference/amdDependencyCommentName3.js b/tests/baselines/reference/amdDependencyCommentName3.js index f842ad0cbf8c5..d9751485e1f8b 100644 --- a/tests/baselines/reference/amdDependencyCommentName3.js +++ b/tests/baselines/reference/amdDependencyCommentName3.js @@ -11,7 +11,6 @@ m1.f(); /// /// define(["require", "exports", "bar", "goo", "m2", "foo"], function (require, exports, b, c, m1) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; m1.f(); }); diff --git a/tests/baselines/reference/amdDependencyCommentName4.js b/tests/baselines/reference/amdDependencyCommentName4.js index 6542aa14fa299..255347caa3387 100644 --- a/tests/baselines/reference/amdDependencyCommentName4.js +++ b/tests/baselines/reference/amdDependencyCommentName4.js @@ -26,8 +26,7 @@ import "unaliasedModule2"; /// /// define(["require", "exports", "aliasedModule5", "aliasedModule6", "aliasedModule1", "aliasedModule2", "aliasedModule3", "aliasedModule4", "unaliasedModule3", "unaliasedModule4", "unaliasedModule1", "unaliasedModule2"], function (require, exports, n1, n2, r1, aliasedModule2_1, aliasedModule3_1, ns) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; r1; aliasedModule2_1.p1; aliasedModule3_1["default"]; diff --git a/tests/baselines/reference/amdImportAsPrimaryExpression.js b/tests/baselines/reference/amdImportAsPrimaryExpression.js index e056952ca4d7a..9cbfd540cd6c3 100644 --- a/tests/baselines/reference/amdImportAsPrimaryExpression.js +++ b/tests/baselines/reference/amdImportAsPrimaryExpression.js @@ -14,8 +14,7 @@ if(foo.E1.A === 0){ //// [foo_0.js] define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; exports.E1 = void 0; var E1; (function (E1) { @@ -26,8 +25,7 @@ define(["require", "exports"], function (require, exports) { }); //// [foo_1.js] define(["require", "exports", "./foo_0"], function (require, exports, foo) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; if (foo.E1.A === 0) { // Should cause runtime import - interesting optimization possibility, as gets inlined to 0. } diff --git a/tests/baselines/reference/amdImportNotAsPrimaryExpression.js b/tests/baselines/reference/amdImportNotAsPrimaryExpression.js index 6020113e64b87..3b68c95132366 100644 --- a/tests/baselines/reference/amdImportNotAsPrimaryExpression.js +++ b/tests/baselines/reference/amdImportNotAsPrimaryExpression.js @@ -33,8 +33,7 @@ var e: number = 0; //// [foo_0.js] define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; exports.E1 = exports.C1 = void 0; var C1 = /** @class */ (function () { function C1() { @@ -44,6 +43,7 @@ define(["require", "exports"], function (require, exports) { return C1; }()); exports.C1 = C1; + var E1; (function (E1) { E1[E1["A"] = 0] = "A"; @@ -53,8 +53,7 @@ define(["require", "exports"], function (require, exports) { }); //// [foo_1.js] define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; var i; var x = {}; var y = false; diff --git a/tests/baselines/reference/amdModuleBundleNoDuplicateDeclarationEmitComments.js b/tests/baselines/reference/amdModuleBundleNoDuplicateDeclarationEmitComments.js index ab9cd9794077d..2b3245826edcb 100644 --- a/tests/baselines/reference/amdModuleBundleNoDuplicateDeclarationEmitComments.js +++ b/tests/baselines/reference/amdModuleBundleNoDuplicateDeclarationEmitComments.js @@ -9,25 +9,21 @@ export class Bar {} //// [out.js] define("mynamespace::SomeModuleA", ["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; exports.Foo = void 0; /// var Foo = /** @class */ (function () { - function Foo() { - } + function Foo() {} return Foo; }()); exports.Foo = Foo; }); define("mynamespace::SomeModuleB", ["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; exports.Bar = void 0; /// var Bar = /** @class */ (function () { - function Bar() { - } + function Bar() {} return Bar; }()); exports.Bar = Bar; diff --git a/tests/baselines/reference/amdModuleConstEnumUsage.js b/tests/baselines/reference/amdModuleConstEnumUsage.js index 76670fe871f53..1a20ebd1d1761 100644 --- a/tests/baselines/reference/amdModuleConstEnumUsage.js +++ b/tests/baselines/reference/amdModuleConstEnumUsage.js @@ -16,8 +16,7 @@ export class User { //// [cc.js] define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; exports.CharCode = void 0; var CharCode; (function (CharCode) { @@ -27,8 +26,7 @@ define(["require", "exports"], function (require, exports) { }); //// [file.js] define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; exports.User = void 0; var User = /** @class */ (function () { function User() { diff --git a/tests/baselines/reference/amdModuleName1.js b/tests/baselines/reference/amdModuleName1.js index 4fc15202c0dc2..cfb142e691b80 100644 --- a/tests/baselines/reference/amdModuleName1.js +++ b/tests/baselines/reference/amdModuleName1.js @@ -11,7 +11,7 @@ export = Foo; //// [amdModuleName1.js] define("NamedModule", ["require", "exports"], function (require, exports) { - "use strict"; + "use strict";/// /// var Foo = /** @class */ (function () { function Foo() { diff --git a/tests/baselines/reference/amdModuleName2.js b/tests/baselines/reference/amdModuleName2.js index 7e65e8a4d18be..abb83026ee99c 100644 --- a/tests/baselines/reference/amdModuleName2.js +++ b/tests/baselines/reference/amdModuleName2.js @@ -12,7 +12,7 @@ export = Foo; //// [amdModuleName2.js] define("SecondModuleName", ["require", "exports"], function (require, exports) { - "use strict"; + "use strict";/// /// /// var Foo = /** @class */ (function () { diff --git a/tests/baselines/reference/anonymousClassExpression1.js b/tests/baselines/reference/anonymousClassExpression1.js index 7223b816b9031..9ef4aa5bfa46e 100644 --- a/tests/baselines/reference/anonymousClassExpression1.js +++ b/tests/baselines/reference/anonymousClassExpression1.js @@ -6,8 +6,7 @@ function f() { //// [anonymousClassExpression1.js] function f() { return typeof /** @class */ (function () { - function class_1() { - } + function class_1() {} return class_1; }()) === "function"; } diff --git a/tests/baselines/reference/anonymousDefaultExportsAmd.js b/tests/baselines/reference/anonymousDefaultExportsAmd.js index 24e833b7542ee..25d1bb181bec1 100644 --- a/tests/baselines/reference/anonymousDefaultExportsAmd.js +++ b/tests/baselines/reference/anonymousDefaultExportsAmd.js @@ -8,16 +8,13 @@ export default function() {} //// [a.js] define(["require", "exports"], function (require, exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - class default_1 { - } + "use strict";Object.defineProperty(exports, "__esModule", { value: true }); + class default_1 {} exports.default = default_1; }); //// [b.js] define(["require", "exports"], function (require, exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); + "use strict";Object.defineProperty(exports, "__esModule", { value: true }); function default_1() { } exports.default = default_1; }); diff --git a/tests/baselines/reference/anonymousDefaultExportsCommonjs.js b/tests/baselines/reference/anonymousDefaultExportsCommonjs.js index e22000856d686..9e4bc52ab1cb9 100644 --- a/tests/baselines/reference/anonymousDefaultExportsCommonjs.js +++ b/tests/baselines/reference/anonymousDefaultExportsCommonjs.js @@ -9,8 +9,7 @@ export default function() {} //// [a.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -class default_1 { -} +class default_1 {} exports.default = default_1; //// [b.js] "use strict"; diff --git a/tests/baselines/reference/anonymousDefaultExportsSystem.js b/tests/baselines/reference/anonymousDefaultExportsSystem.js index 48071da9e9b47..c2efac17f8435 100644 --- a/tests/baselines/reference/anonymousDefaultExportsSystem.js +++ b/tests/baselines/reference/anonymousDefaultExportsSystem.js @@ -8,27 +8,23 @@ export default function() {} //// [a.js] System.register([], function (exports_1, context_1) { - "use strict"; - var default_1; + "use strict";var default_1; var __moduleName = context_1 && context_1.id; return { setters: [], execute: function () { - default_1 = class { - }; + default_1 = class {}; exports_1("default", default_1); } }; }); //// [b.js] System.register([], function (exports_1, context_1) { - "use strict"; - var __moduleName = context_1 && context_1.id; + "use strict";var __moduleName = context_1 && context_1.id; function default_1() { } exports_1("default", default_1); return { setters: [], - execute: function () { - } + execute: function () {} }; }); diff --git a/tests/baselines/reference/anonymousDefaultExportsUmd.js b/tests/baselines/reference/anonymousDefaultExportsUmd.js index 484238b8722cf..882d90affa925 100644 --- a/tests/baselines/reference/anonymousDefaultExportsUmd.js +++ b/tests/baselines/reference/anonymousDefaultExportsUmd.js @@ -7,33 +7,22 @@ export default class {} export default function() {} //// [a.js] -(function (factory) { - if (typeof module === "object" && typeof module.exports === "object") { - var v = factory(require, exports); +(function (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(["require", "exports"], factory); + } else if (typeof define === "function" && define.amd) {define(["require", "exports"], factory); } })(function (require, exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - class default_1 { - } + "use strict";Object.defineProperty(exports, "__esModule", { value: true }); + class default_1 {} exports.default = default_1; }); //// [b.js] -(function (factory) { - if (typeof module === "object" && typeof module.exports === "object") { - var v = factory(require, exports); +(function (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(["require", "exports"], factory); + } else if (typeof define === "function" && define.amd) {define(["require", "exports"], factory); } })(function (require, exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); + "use strict";Object.defineProperty(exports, "__esModule", { value: true }); function default_1() { } exports.default = default_1; }); diff --git a/tests/baselines/reference/anonymousModules.js b/tests/baselines/reference/anonymousModules.js index 5270594e8ee99..8684854c021ba 100644 --- a/tests/baselines/reference/anonymousModules.js +++ b/tests/baselines/reference/anonymousModules.js @@ -14,16 +14,16 @@ module { } //// [anonymousModules.js] -module; -{ +module;{ export var foo = 1; - module; - { + + module;{ export var bar = 1; } + var bar = 2; - module; - { + + module;{ var x = bar; } } diff --git a/tests/baselines/reference/anyAndUnknownHaveFalsyComponents.js b/tests/baselines/reference/anyAndUnknownHaveFalsyComponents.js index 2d33681fedac6..f357ebde5f7d1 100644 --- a/tests/baselines/reference/anyAndUnknownHaveFalsyComponents.js +++ b/tests/baselines/reference/anyAndUnknownHaveFalsyComponents.js @@ -41,12 +41,15 @@ var __assign = (this && this.__assign) || function () { return __assign.apply(this, arguments); }; var y1 = x1 && 3; + function foo1() { return __assign({ display: "block" }, (isTreeHeader1 && { display: "flex" })); } + var y2 = x2 && 3; + function foo2() { return __assign({ display: "block" }, (isTreeHeader1 && { display: "flex" diff --git a/tests/baselines/reference/anyAsConstructor.js b/tests/baselines/reference/anyAsConstructor.js index 2dfa9a5398b95..4ee849c5d6cd3 100644 --- a/tests/baselines/reference/anyAsConstructor.js +++ b/tests/baselines/reference/anyAsConstructor.js @@ -13,6 +13,7 @@ var d = new x(x); // no error //// [anyAsConstructor.js] // any is considered an untyped function call // can be called except with type arguments which is an error + var x; var a = new x(); var b = new x('hello'); diff --git a/tests/baselines/reference/anyAsFunctionCall.js b/tests/baselines/reference/anyAsFunctionCall.js index 9b1e0852de991..340d7444f567a 100644 --- a/tests/baselines/reference/anyAsFunctionCall.js +++ b/tests/baselines/reference/anyAsFunctionCall.js @@ -10,6 +10,7 @@ var c = x(x); //// [anyAsFunctionCall.js] // any is considered an untyped function call // can be called except with type arguments which is an error + var x; var a = x(); var b = x('hello'); diff --git a/tests/baselines/reference/anyAsGenericFunctionCall.js b/tests/baselines/reference/anyAsGenericFunctionCall.js index 085e1065a07c2..a6f497a862d14 100644 --- a/tests/baselines/reference/anyAsGenericFunctionCall.js +++ b/tests/baselines/reference/anyAsGenericFunctionCall.js @@ -13,12 +13,13 @@ var d = x(x); //// [anyAsGenericFunctionCall.js] // any is considered an untyped function call // can be called except with type arguments which is an error + var x; var a = x(); var b = x('hello'); + var C = /** @class */ (function () { - function C() { - } + function C() {} return C; }()); var c = x(x); diff --git a/tests/baselines/reference/anyAsReturnTypeForNewOnCall.js b/tests/baselines/reference/anyAsReturnTypeForNewOnCall.js index a6b26d3890e40..74add24b35331 100644 --- a/tests/baselines/reference/anyAsReturnTypeForNewOnCall.js +++ b/tests/baselines/reference/anyAsReturnTypeForNewOnCall.js @@ -16,8 +16,13 @@ var xx = o.x; //// [anyAsReturnTypeForNewOnCall.js] function Point(x, y) { + this.x = x; + this.y = y; + } + var o = new Point(3, 4); + var xx = o.x; diff --git a/tests/baselines/reference/anyAssignabilityInInheritance.js b/tests/baselines/reference/anyAssignabilityInInheritance.js index 6871d6738aca7..cf98112cb6adb 100644 --- a/tests/baselines/reference/anyAssignabilityInInheritance.js +++ b/tests/baselines/reference/anyAssignabilityInInheritance.js @@ -90,7 +90,10 @@ var r3 = foo3(a); // any //// [anyAssignabilityInInheritance.js] // any is not a subtype of any other types, errors expected on all the below derived classes unless otherwise noted + + var a; + var r3 = foo2(a); // any, not a subtype of number so it skips that overload, is a subtype of itself so it picks second (if truly ambiguous it would pick first overload) var r3 = foo3(a); // any var r3 = foo3(a); // any @@ -100,14 +103,12 @@ var r3 = foo3(a); // any var r3 = foo3(a); // any var r3 = foo3(a); // any var A = /** @class */ (function () { - function A() { - } + function A() {} return A; }()); var r3 = foo3(a); // any var A2 = /** @class */ (function () { - function A2() { - } + function A2() {} return A2; }()); var r3 = foo3(a); // any @@ -118,14 +119,14 @@ var E; E[E["A"] = 0] = "A"; })(E || (E = {})); var r3 = foo3(a); // any + function f() { } (function (f) { f.bar = 1; })(f || (f = {})); var r3 = foo3(a); // any var CC = /** @class */ (function () { - function CC() { - } + function CC() {} return CC; }()); (function (CC) { diff --git a/tests/baselines/reference/anyAssignableToEveryType.js b/tests/baselines/reference/anyAssignableToEveryType.js index eff97905e4f4a..b5ad284ed69bb 100644 --- a/tests/baselines/reference/anyAssignableToEveryType.js +++ b/tests/baselines/reference/anyAssignableToEveryType.js @@ -47,6 +47,7 @@ function foo(x: T, y: U, z: V) { //// [anyAssignableToEveryType.js] var a; + var C = /** @class */ (function () { function C() { } @@ -59,6 +60,7 @@ var E; E[E["A"] = 0] = "A"; })(E || (E = {})); var ae; + var b = a; var c = a; var d = a; @@ -78,11 +80,13 @@ var n = a; var o = a; var p = a; var q = a; + function foo(x, y, z) { x = a; y = a; z = a; } + //function foo(x: T, y: U, z: V) { // x = a; // y = a; diff --git a/tests/baselines/reference/anyAssignableToEveryType2.js b/tests/baselines/reference/anyAssignableToEveryType2.js index 28b4ab7148d90..1250002ba7f97 100644 --- a/tests/baselines/reference/anyAssignableToEveryType2.js +++ b/tests/baselines/reference/anyAssignableToEveryType2.js @@ -132,16 +132,37 @@ interface I20 { //// [anyAssignableToEveryType2.js] // any is not a subtype of any other types, but is assignable, all the below should work + + + + + + + + + + + + + + + + + + var A = /** @class */ (function () { - function A() { - } + function A() {} return A; }()); + var A2 = /** @class */ (function () { - function A2() { - } + function A2() {} return A2; }()); + + + + var E; (function (E) { E[E["A"] = 0] = "A"; @@ -150,11 +171,20 @@ function f() { } (function (f) { f.bar = 1; })(f || (f = {})); + + var c = /** @class */ (function () { - function c() { - } + function c() {} return c; }()); (function (c) { c.bar = 1; })(c || (c = {})); + + + + + + + + diff --git a/tests/baselines/reference/anyIdenticalToItself.js b/tests/baselines/reference/anyIdenticalToItself.js index 6ec3d0d43e619..f162234934dbe 100644 --- a/tests/baselines/reference/anyIdenticalToItself.js +++ b/tests/baselines/reference/anyIdenticalToItself.js @@ -14,6 +14,7 @@ class C { //// [anyIdenticalToItself.js] function foo(x, y) { } + var C = /** @class */ (function () { function C() { } diff --git a/tests/baselines/reference/anyInferenceAnonymousFunctions.js b/tests/baselines/reference/anyInferenceAnonymousFunctions.js index df921965994d7..86c8a9e16460f 100644 --- a/tests/baselines/reference/anyInferenceAnonymousFunctions.js +++ b/tests/baselines/reference/anyInferenceAnonymousFunctions.js @@ -20,11 +20,16 @@ paired.map(function (c2) { return c2.count; }); //// [anyInferenceAnonymousFunctions.js] var paired; paired.reduce(function (a1, a2) { + return a1.concat({}); + }, []); paired.reduce(function (b1, b2) { + return b1.concat({}); }, []); + paired.reduce(function (b3, b4) { return b3.concat({}); }, []); + paired.map(function (c1) { return c1.count; }); paired.map(function (c2) { return c2.count; }); diff --git a/tests/baselines/reference/anyIsAssignableToObject.js b/tests/baselines/reference/anyIsAssignableToObject.js index fc333cb15e06b..b15cec3fc6e51 100644 --- a/tests/baselines/reference/anyIsAssignableToObject.js +++ b/tests/baselines/reference/anyIsAssignableToObject.js @@ -8,3 +8,4 @@ interface Q extends P { // Check assignability here. Any is assignable to {} } //// [anyIsAssignableToObject.js] + diff --git a/tests/baselines/reference/anyIsAssignableToVoid.js b/tests/baselines/reference/anyIsAssignableToVoid.js index 75e6e979ac3ff..f427136ede39f 100644 --- a/tests/baselines/reference/anyIsAssignableToVoid.js +++ b/tests/baselines/reference/anyIsAssignableToVoid.js @@ -8,3 +8,4 @@ interface Q extends P { // check assignability here. any is assignable to void. } //// [anyIsAssignableToVoid.js] + diff --git a/tests/baselines/reference/apparentTypeSubtyping.js b/tests/baselines/reference/apparentTypeSubtyping.js index 7aa0f6e37462d..346793b5b5bb9 100644 --- a/tests/baselines/reference/apparentTypeSubtyping.js +++ b/tests/baselines/reference/apparentTypeSubtyping.js @@ -39,6 +39,7 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + var Base = /** @class */ (function () { function Base() { } diff --git a/tests/baselines/reference/apparentTypeSupertype.js b/tests/baselines/reference/apparentTypeSupertype.js index 213b16448fe6a..00533681b5892 100644 --- a/tests/baselines/reference/apparentTypeSupertype.js +++ b/tests/baselines/reference/apparentTypeSupertype.js @@ -29,6 +29,7 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + var Base = /** @class */ (function () { function Base() { } diff --git a/tests/baselines/reference/argumentExpressionContextualTyping.js b/tests/baselines/reference/argumentExpressionContextualTyping.js index 1dbae2e7a1a93..082e87a0ee6c3 100644 --- a/tests/baselines/reference/argumentExpressionContextualTyping.js +++ b/tests/baselines/reference/argumentExpressionContextualTyping.js @@ -36,10 +36,12 @@ var o = { x: ["string", 1], y: { c: true, d: "world", e: 3 } }; var o1 = { x: ["string", 1], y: { c: true, d: "world", e: 3 } }; foo(o1); // Not error since x has contextual type of tuple namely [string, number] foo({ x: ["string", 1], y: { c: true, d: "world", e: 3 } }); // Not error + var array = ["string", 1, true]; var tuple = ["string", 1, true]; baz(tuple); baz(["string", 1, true]); + baz(array); // Error baz(__spreadArray(["string", 1, true], array)); // Error foo(o); // Error because x has an array type namely (string|number)[] diff --git a/tests/baselines/reference/arguments.js b/tests/baselines/reference/arguments.js index 3dd362506c6cb..d159a09c2960f 100644 --- a/tests/baselines/reference/arguments.js +++ b/tests/baselines/reference/arguments.js @@ -19,4 +19,5 @@ function f() { var x = arguments[12]; (() => arguments)(); } + (() => arguments)(); diff --git a/tests/baselines/reference/argumentsAsPropertyName.js b/tests/baselines/reference/argumentsAsPropertyName.js index a4197c0a1d249..c619e51ac3463 100644 --- a/tests/baselines/reference/argumentsAsPropertyName.js +++ b/tests/baselines/reference/argumentsAsPropertyName.js @@ -16,6 +16,8 @@ function myFunction(myType: MyType) { } //// [argumentsAsPropertyName.js] + + function myFunction(myType) { var _loop_1 = function (i) { use(myType.arguments[i]); diff --git a/tests/baselines/reference/argumentsAsPropertyName2.js b/tests/baselines/reference/argumentsAsPropertyName2.js index 878178ed39c2b..d30d2051c026d 100644 --- a/tests/baselines/reference/argumentsAsPropertyName2.js +++ b/tests/baselines/reference/argumentsAsPropertyName2.js @@ -14,6 +14,7 @@ function foo() { //// [argumentsAsPropertyName2.js] // target: es5 + function foo() { var _loop_1 = function (x) { var i; diff --git a/tests/baselines/reference/argumentsObjectIterator02_ES5.js b/tests/baselines/reference/argumentsObjectIterator02_ES5.js index ae8675d97453b..4f07608380968 100644 --- a/tests/baselines/reference/argumentsObjectIterator02_ES5.js +++ b/tests/baselines/reference/argumentsObjectIterator02_ES5.js @@ -14,6 +14,7 @@ function doubleAndReturnAsArray(x: number, y: number, z: number): [number, numbe //// [argumentsObjectIterator02_ES5.js] function doubleAndReturnAsArray(x, y, z) { var blah = arguments[Symbol.iterator]; + var result = []; for (var _i = 0, _a = blah(); _i < _a.length; _i++) { var arg = _a[_i]; @@ -21,3 +22,4 @@ function doubleAndReturnAsArray(x, y, z) { } return result; } + diff --git a/tests/baselines/reference/argumentsObjectIterator02_ES6.js b/tests/baselines/reference/argumentsObjectIterator02_ES6.js index 1155ab929eab5..63d3e0d282949 100644 --- a/tests/baselines/reference/argumentsObjectIterator02_ES6.js +++ b/tests/baselines/reference/argumentsObjectIterator02_ES6.js @@ -14,9 +14,11 @@ function doubleAndReturnAsArray(x: number, y: number, z: number): [number, numbe //// [argumentsObjectIterator02_ES6.js] function doubleAndReturnAsArray(x, y, z) { let blah = arguments[Symbol.iterator]; + let result = []; for (let arg of blah()) { result.push(arg + arg); } return result; } + diff --git a/tests/baselines/reference/argumentsObjectIterator03_ES5.js b/tests/baselines/reference/argumentsObjectIterator03_ES5.js index 837808a6d926d..1788e1210af9f 100644 --- a/tests/baselines/reference/argumentsObjectIterator03_ES5.js +++ b/tests/baselines/reference/argumentsObjectIterator03_ES5.js @@ -12,3 +12,4 @@ function asReversedTuple(a, b, c) { var x = arguments[0], y = arguments[1], z = arguments[2]; return [z, y, x]; } + diff --git a/tests/baselines/reference/argumentsObjectIterator03_ES6.js b/tests/baselines/reference/argumentsObjectIterator03_ES6.js index 789bcc9390d51..53af8d4ea978f 100644 --- a/tests/baselines/reference/argumentsObjectIterator03_ES6.js +++ b/tests/baselines/reference/argumentsObjectIterator03_ES6.js @@ -10,5 +10,7 @@ function asReversedTuple(a: number, b: string, c: boolean): [boolean, string, nu //// [argumentsObjectIterator03_ES6.js] function asReversedTuple(a, b, c) { let [x, y, z] = arguments; + return [z, y, x]; } + diff --git a/tests/baselines/reference/arithAssignTyping.js b/tests/baselines/reference/arithAssignTyping.js index 7bb31b2804533..4d59d53d3023f 100644 --- a/tests/baselines/reference/arithAssignTyping.js +++ b/tests/baselines/reference/arithAssignTyping.js @@ -16,8 +16,7 @@ f ^= 1; // error //// [arithAssignTyping.js] var f = /** @class */ (function () { - function f() { - } + function f() {} return f; }()); f += ''; // error diff --git a/tests/baselines/reference/arithmeticOperatorWithAnyAndNumber.js b/tests/baselines/reference/arithmeticOperatorWithAnyAndNumber.js index 7cb45f63230dd..9a9803a20a50f 100644 --- a/tests/baselines/reference/arithmeticOperatorWithAnyAndNumber.js +++ b/tests/baselines/reference/arithmeticOperatorWithAnyAndNumber.js @@ -114,6 +114,7 @@ var ra5 = 0 * 0; var ra6 = b * 0; var ra7 = 0 * b; var ra8 = b * b; + // operator / var rb1 = a / a; var rb2 = a / b; @@ -123,6 +124,7 @@ var rb5 = 0 / 0; var rb6 = b / 0; var rb7 = 0 / b; var rb8 = b / b; + // operator % var rc1 = a % a; var rc2 = a % b; @@ -132,6 +134,7 @@ var rc5 = 0 % 0; var rc6 = b % 0; var rc7 = 0 % b; var rc8 = b % b; + // operator - var rd1 = a - a; var rd2 = a - b; @@ -141,6 +144,7 @@ var rd5 = 0 - 0; var rd6 = b - 0; var rd7 = 0 - b; var rd8 = b - b; + // operator << var re1 = a << a; var re2 = a << b; @@ -150,6 +154,7 @@ var re5 = 0 << 0; var re6 = b << 0; var re7 = 0 << b; var re8 = b << b; + // operator >> var rf1 = a >> a; var rf2 = a >> b; @@ -159,6 +164,7 @@ var rf5 = 0 >> 0; var rf6 = b >> 0; var rf7 = 0 >> b; var rf8 = b >> b; + // operator >>> var rg1 = a >>> a; var rg2 = a >>> b; @@ -168,6 +174,7 @@ var rg5 = 0 >>> 0; var rg6 = b >>> 0; var rg7 = 0 >>> b; var rg8 = b >>> b; + // operator & var rh1 = a & a; var rh2 = a & b; @@ -177,6 +184,7 @@ var rh5 = 0 & 0; var rh6 = b & 0; var rh7 = 0 & b; var rh8 = b & b; + // operator ^ var ri1 = a ^ a; var ri2 = a ^ b; @@ -186,6 +194,7 @@ var ri5 = 0 ^ 0; var ri6 = b ^ 0; var ri7 = 0 ^ b; var ri8 = b ^ b; + // operator | var rj1 = a | a; var rj2 = a | b; diff --git a/tests/baselines/reference/arithmeticOperatorWithEnum.js b/tests/baselines/reference/arithmeticOperatorWithEnum.js index 3572f3ecc41e4..d6fd8dfe89d3e 100644 --- a/tests/baselines/reference/arithmeticOperatorWithEnum.js +++ b/tests/baselines/reference/arithmeticOperatorWithEnum.js @@ -173,6 +173,7 @@ var ra9 = E.a * 1; var ra10 = a * E.b; var ra11 = b * E.b; var ra12 = 1 * E.b; + // operator / var rb1 = c / a; var rb2 = c / b; @@ -186,6 +187,7 @@ var rb9 = E.a / 1; var rb10 = a / E.b; var rb11 = b / E.b; var rb12 = 1 / E.b; + // operator % var rc1 = c % a; var rc2 = c % b; @@ -199,6 +201,7 @@ var rc9 = E.a % 1; var rc10 = a % E.b; var rc11 = b % E.b; var rc12 = 1 % E.b; + // operator - var rd1 = c - a; var rd2 = c - b; @@ -212,6 +215,7 @@ var rd9 = E.a - 1; var rd10 = a - E.b; var rd11 = b - E.b; var rd12 = 1 - E.b; + // operator << var re1 = c << a; var re2 = c << b; @@ -225,6 +229,7 @@ var re9 = E.a << 1; var re10 = a << E.b; var re11 = b << E.b; var re12 = 1 << E.b; + // operator >> var rf1 = c >> a; var rf2 = c >> b; @@ -238,6 +243,7 @@ var rf9 = E.a >> 1; var rf10 = a >> E.b; var rf11 = b >> E.b; var rf12 = 1 >> E.b; + // operator >>> var rg1 = c >>> a; var rg2 = c >>> b; @@ -251,6 +257,7 @@ var rg9 = E.a >>> 1; var rg10 = a >>> E.b; var rg11 = b >>> E.b; var rg12 = 1 >>> E.b; + // operator & var rh1 = c & a; var rh2 = c & b; @@ -264,6 +271,7 @@ var rh9 = E.a & 1; var rh10 = a & E.b; var rh11 = b & E.b; var rh12 = 1 & E.b; + // operator ^ var ri1 = c ^ a; var ri2 = c ^ b; @@ -277,6 +285,7 @@ var ri9 = E.a ^ 1; var ri10 = a ^ E.b; var ri11 = b ^ E.b; var ri12 = 1 ^ E.b; + // operator | var rj1 = c | a; var rj2 = c | b; diff --git a/tests/baselines/reference/arithmeticOperatorWithEnumUnion.js b/tests/baselines/reference/arithmeticOperatorWithEnumUnion.js index 95bc0b866c91c..47470438bdd57 100644 --- a/tests/baselines/reference/arithmeticOperatorWithEnumUnion.js +++ b/tests/baselines/reference/arithmeticOperatorWithEnumUnion.js @@ -182,6 +182,7 @@ var ra9 = E.a * 1; var ra10 = a * E.b; var ra11 = b * E.b; var ra12 = 1 * E.b; + // operator / var rb1 = c / a; var rb2 = c / b; @@ -195,6 +196,7 @@ var rb9 = E.a / 1; var rb10 = a / E.b; var rb11 = b / E.b; var rb12 = 1 / E.b; + // operator % var rc1 = c % a; var rc2 = c % b; @@ -208,6 +210,7 @@ var rc9 = E.a % 1; var rc10 = a % E.b; var rc11 = b % E.b; var rc12 = 1 % E.b; + // operator - var rd1 = c - a; var rd2 = c - b; @@ -221,6 +224,7 @@ var rd9 = E.a - 1; var rd10 = a - E.b; var rd11 = b - E.b; var rd12 = 1 - E.b; + // operator << var re1 = c << a; var re2 = c << b; @@ -234,6 +238,7 @@ var re9 = E.a << 1; var re10 = a << E.b; var re11 = b << E.b; var re12 = 1 << E.b; + // operator >> var rf1 = c >> a; var rf2 = c >> b; @@ -247,6 +252,7 @@ var rf9 = E.a >> 1; var rf10 = a >> E.b; var rf11 = b >> E.b; var rf12 = 1 >> E.b; + // operator >>> var rg1 = c >>> a; var rg2 = c >>> b; @@ -260,6 +266,7 @@ var rg9 = E.a >>> 1; var rg10 = a >>> E.b; var rg11 = b >>> E.b; var rg12 = 1 >>> E.b; + // operator & var rh1 = c & a; var rh2 = c & b; @@ -273,6 +280,7 @@ var rh9 = E.a & 1; var rh10 = a & E.b; var rh11 = b & E.b; var rh12 = 1 & E.b; + // operator ^ var ri1 = c ^ a; var ri2 = c ^ b; @@ -286,6 +294,7 @@ var ri9 = E.a ^ 1; var ri10 = a ^ E.b; var ri11 = b ^ E.b; var ri12 = 1 ^ E.b; + // operator | var rj1 = c | a; var rj2 = c | b; diff --git a/tests/baselines/reference/arithmeticOperatorWithInvalidOperands.js b/tests/baselines/reference/arithmeticOperatorWithInvalidOperands.js index 974e9930103d7..0f5615d6cbfbd 100644 --- a/tests/baselines/reference/arithmeticOperatorWithInvalidOperands.js +++ b/tests/baselines/reference/arithmeticOperatorWithInvalidOperands.js @@ -604,48 +604,56 @@ var r1a3 = a * c; //ok var r1a4 = a * d; var r1a5 = a * e; var r1a6 = a * f; + var r1b1 = b * a; var r1b2 = b * b; var r1b3 = b * c; var r1b4 = b * d; var r1b5 = b * e; var r1b6 = b * f; + var r1c1 = c * a; //ok var r1c2 = c * b; var r1c3 = c * c; //ok var r1c4 = c * d; var r1c5 = c * e; var r1c6 = c * f; + var r1d1 = d * a; var r1d2 = d * b; var r1d3 = d * c; var r1d4 = d * d; var r1d5 = d * e; var r1d6 = d * f; + var r1e1 = e * a; var r1e2 = e * b; var r1e3 = e * c; var r1e4 = e * d; var r1e5 = e * e; var r1e6 = e * f; + var r1f1 = f * a; var r1f2 = f * b; var r1f3 = f * c; var r1f4 = f * d; var r1f5 = f * e; var r1f6 = f * f; + var r1g1 = E.a * a; //ok var r1g2 = E.a * b; var r1g3 = E.a * c; //ok var r1g4 = E.a * d; var r1g5 = E.a * e; var r1g6 = E.a * f; + var r1h1 = a * E.b; //ok var r1h2 = b * E.b; var r1h3 = c * E.b; //ok var r1h4 = d * E.b; var r1h5 = e * E.b; var r1h6 = f * E.b; + // operator / var r2a1 = a / a; //ok var r2a2 = a / b; @@ -653,48 +661,56 @@ var r2a3 = a / c; //ok var r2a4 = a / d; var r2a5 = a / e; var r2a6 = a / f; + var r2b1 = b / a; var r2b2 = b / b; var r2b3 = b / c; var r2b4 = b / d; var r2b5 = b / e; var r2b6 = b / f; + var r2c1 = c / a; //ok var r2c2 = c / b; var r2c3 = c / c; //ok var r2c4 = c / d; var r2c5 = c / e; var r2c6 = c / f; + var r2d1 = d / a; var r2d2 = d / b; var r2d3 = d / c; var r2d4 = d / d; var r2d5 = d / e; var r2d6 = d / f; + var r2e1 = e / a; var r2e2 = e / b; var r2e3 = e / c; var r2e4 = e / d; var r2e5 = e / e; var r2e6 = e / f; + var r2f1 = f / a; var r2f2 = f / b; var r2f3 = f / c; var r2f4 = f / d; var r2f5 = f / e; var r2f6 = f / f; + var r2g1 = E.a / a; //ok var r2g2 = E.a / b; var r2g3 = E.a / c; //ok var r2g4 = E.a / d; var r2g5 = E.a / e; var r2g6 = E.a / f; + var r2h1 = a / E.b; //ok var r2h2 = b / E.b; var r2h3 = c / E.b; //ok var r2h4 = d / E.b; var r2h5 = e / E.b; var r2h6 = f / E.b; + // operator % var r3a1 = a % a; //ok var r3a2 = a % b; @@ -702,48 +718,56 @@ var r3a3 = a % c; //ok var r3a4 = a % d; var r3a5 = a % e; var r3a6 = a % f; + var r3b1 = b % a; var r3b2 = b % b; var r3b3 = b % c; var r3b4 = b % d; var r3b5 = b % e; var r3b6 = b % f; + var r3c1 = c % a; //ok var r3c2 = c % b; var r3c3 = c % c; //ok var r3c4 = c % d; var r3c5 = c % e; var r3c6 = c % f; + var r3d1 = d % a; var r3d2 = d % b; var r3d3 = d % c; var r3d4 = d % d; var r3d5 = d % e; var r3d6 = d % f; + var r3e1 = e % a; var r3e2 = e % b; var r3e3 = e % c; var r3e4 = e % d; var r3e5 = e % e; var r3e6 = e % f; + var r3f1 = f % a; var r3f2 = f % b; var r3f3 = f % c; var r3f4 = f % d; var r3f5 = f % e; var r3f6 = f % f; + var r3g1 = E.a % a; //ok var r3g2 = E.a % b; var r3g3 = E.a % c; //ok var r3g4 = E.a % d; var r3g5 = E.a % e; var r3g6 = E.a % f; + var r3h1 = a % E.b; //ok var r3h2 = b % E.b; var r3h3 = c % E.b; //ok var r3h4 = d % E.b; var r3h5 = e % E.b; var r3h6 = f % E.b; + // operator - var r4a1 = a - a; //ok var r4a2 = a - b; @@ -751,48 +775,56 @@ var r4a3 = a - c; //ok var r4a4 = a - d; var r4a5 = a - e; var r4a6 = a - f; + var r4b1 = b - a; var r4b2 = b - b; var r4b3 = b - c; var r4b4 = b - d; var r4b5 = b - e; var r4b6 = b - f; + var r4c1 = c - a; //ok var r4c2 = c - b; var r4c3 = c - c; //ok var r4c4 = c - d; var r4c5 = c - e; var r4c6 = c - f; + var r4d1 = d - a; var r4d2 = d - b; var r4d3 = d - c; var r4d4 = d - d; var r4d5 = d - e; var r4d6 = d - f; + var r4e1 = e - a; var r4e2 = e - b; var r4e3 = e - c; var r4e4 = e - d; var r4e5 = e - e; var r4e6 = e - f; + var r4f1 = f - a; var r4f2 = f - b; var r4f3 = f - c; var r4f4 = f - d; var r4f5 = f - e; var r4f6 = f - f; + var r4g1 = E.a - a; //ok var r4g2 = E.a - b; var r4g3 = E.a - c; //ok var r4g4 = E.a - d; var r4g5 = E.a - e; var r4g6 = E.a - f; + var r4h1 = a - E.b; //ok var r4h2 = b - E.b; var r4h3 = c - E.b; //ok var r4h4 = d - E.b; var r4h5 = e - E.b; var r4h6 = f - E.b; + // operator << var r5a1 = a << a; //ok var r5a2 = a << b; @@ -800,48 +832,56 @@ var r5a3 = a << c; //ok var r5a4 = a << d; var r5a5 = a << e; var r5a6 = a << f; + var r5b1 = b << a; var r5b2 = b << b; var r5b3 = b << c; var r5b4 = b << d; var r5b5 = b << e; var r5b6 = b << f; + var r5c1 = c << a; //ok var r5c2 = c << b; var r5c3 = c << c; //ok var r5c4 = c << d; var r5c5 = c << e; var r5c6 = c << f; + var r5d1 = d << a; var r5d2 = d << b; var r5d3 = d << c; var r5d4 = d << d; var r5d5 = d << e; var r5d6 = d << f; + var r5e1 = e << a; var r5e2 = e << b; var r5e3 = e << c; var r5e4 = e << d; var r5e5 = e << e; var r5e6 = e << f; + var r5f1 = f << a; var r5f2 = f << b; var r5f3 = f << c; var r5f4 = f << d; var r5f5 = f << e; var r5f6 = f << f; + var r5g1 = E.a << a; //ok var r5g2 = E.a << b; var r5g3 = E.a << c; //ok var r5g4 = E.a << d; var r5g5 = E.a << e; var r5g6 = E.a << f; + var r5h1 = a << E.b; //ok var r5h2 = b << E.b; var r5h3 = c << E.b; //ok var r5h4 = d << E.b; var r5h5 = e << E.b; var r5h6 = f << E.b; + // operator >> var r6a1 = a >> a; //ok var r6a2 = a >> b; @@ -849,48 +889,56 @@ var r6a3 = a >> c; //ok var r6a4 = a >> d; var r6a5 = a >> e; var r6a6 = a >> f; + var r6b1 = b >> a; var r6b2 = b >> b; var r6b3 = b >> c; var r6b4 = b >> d; var r6b5 = b >> e; var r6b6 = b >> f; + var r6c1 = c >> a; //ok var r6c2 = c >> b; var r6c3 = c >> c; //ok var r6c4 = c >> d; var r6c5 = c >> e; var r6c6 = c >> f; + var r6d1 = d >> a; var r6d2 = d >> b; var r6d3 = d >> c; var r6d4 = d >> d; var r6d5 = d >> e; var r6d6 = d >> f; + var r6e1 = e >> a; var r6e2 = e >> b; var r6e3 = e >> c; var r6e4 = e >> d; var r6e5 = e >> e; var r6e6 = e >> f; + var r6f1 = f >> a; var r6f2 = f >> b; var r6f3 = f >> c; var r6f4 = f >> d; var r6f5 = f >> e; var r6f6 = f >> f; + var r6g1 = E.a >> a; //ok var r6g2 = E.a >> b; var r6g3 = E.a >> c; //ok var r6g4 = E.a >> d; var r6g5 = E.a >> e; var r6g6 = E.a >> f; + var r6h1 = a >> E.b; //ok var r6h2 = b >> E.b; var r6h3 = c >> E.b; //ok var r6h4 = d >> E.b; var r6h5 = e >> E.b; var r6h6 = f >> E.b; + // operator >>> var r7a1 = a >>> a; //ok var r7a2 = a >>> b; @@ -898,48 +946,56 @@ var r7a3 = a >>> c; //ok var r7a4 = a >>> d; var r7a5 = a >>> e; var r7a6 = a >>> f; + var r7b1 = b >>> a; var r7b2 = b >>> b; var r7b3 = b >>> c; var r7b4 = b >>> d; var r7b5 = b >>> e; var r7b6 = b >>> f; + var r7c1 = c >>> a; //ok var r7c2 = c >>> b; var r7c3 = c >>> c; //ok var r7c4 = c >>> d; var r7c5 = c >>> e; var r7c6 = c >>> f; + var r7d1 = d >>> a; var r7d2 = d >>> b; var r7d3 = d >>> c; var r7d4 = d >>> d; var r7d5 = d >>> e; var r7d6 = d >>> f; + var r7e1 = e >>> a; var r7e2 = e >>> b; var r7e3 = e >>> c; var r7e4 = e >>> d; var r7e5 = e >>> e; var r7e6 = e >>> f; + var r7f1 = f >>> a; var r7f2 = f >>> b; var r7f3 = f >>> c; var r7f4 = f >>> d; var r7f5 = f >>> e; var r7f6 = f >>> f; + var r7g1 = E.a >>> a; //ok var r7g2 = E.a >>> b; var r7g3 = E.a >>> c; //ok var r7g4 = E.a >>> d; var r7g5 = E.a >>> e; var r7g6 = E.a >>> f; + var r7h1 = a >>> E.b; //ok var r7h2 = b >>> E.b; var r7h3 = c >>> E.b; //ok var r7h4 = d >>> E.b; var r7h5 = e >>> E.b; var r7h6 = f >>> E.b; + // operator & var r8a1 = a & a; //ok var r8a2 = a & b; @@ -947,48 +1003,56 @@ var r8a3 = a & c; //ok var r8a4 = a & d; var r8a5 = a & e; var r8a6 = a & f; + var r8b1 = b & a; var r8b2 = b & b; var r8b3 = b & c; var r8b4 = b & d; var r8b5 = b & e; var r8b6 = b & f; + var r8c1 = c & a; //ok var r8c2 = c & b; var r8c3 = c & c; //ok var r8c4 = c & d; var r8c5 = c & e; var r8c6 = c & f; + var r8d1 = d & a; var r8d2 = d & b; var r8d3 = d & c; var r8d4 = d & d; var r8d5 = d & e; var r8d6 = d & f; + var r8e1 = e & a; var r8e2 = e & b; var r8e3 = e & c; var r8e4 = e & d; var r8e5 = e & e; var r8e6 = e & f; + var r8f1 = f & a; var r8f2 = f & b; var r8f3 = f & c; var r8f4 = f & d; var r8f5 = f & e; var r8f6 = f & f; + var r8g1 = E.a & a; //ok var r8g2 = E.a & b; var r8g3 = E.a & c; //ok var r8g4 = E.a & d; var r8g5 = E.a & e; var r8g6 = E.a & f; + var r8h1 = a & E.b; //ok var r8h2 = b & E.b; var r8h3 = c & E.b; //ok var r8h4 = d & E.b; var r8h5 = e & E.b; var r8h6 = f & E.b; + // operator ^ var r9a1 = a ^ a; //ok var r9a2 = a ^ b; @@ -996,48 +1060,56 @@ var r9a3 = a ^ c; //ok var r9a4 = a ^ d; var r9a5 = a ^ e; var r9a6 = a ^ f; + var r9b1 = b ^ a; var r9b2 = b ^ b; var r9b3 = b ^ c; var r9b4 = b ^ d; var r9b5 = b ^ e; var r9b6 = b ^ f; + var r9c1 = c ^ a; //ok var r9c2 = c ^ b; var r9c3 = c ^ c; //ok var r9c4 = c ^ d; var r9c5 = c ^ e; var r9c6 = c ^ f; + var r9d1 = d ^ a; var r9d2 = d ^ b; var r9d3 = d ^ c; var r9d4 = d ^ d; var r9d5 = d ^ e; var r9d6 = d ^ f; + var r9e1 = e ^ a; var r9e2 = e ^ b; var r9e3 = e ^ c; var r9e4 = e ^ d; var r9e5 = e ^ e; var r9e6 = e ^ f; + var r9f1 = f ^ a; var r9f2 = f ^ b; var r9f3 = f ^ c; var r9f4 = f ^ d; var r9f5 = f ^ e; var r9f6 = f ^ f; + var r9g1 = E.a ^ a; //ok var r9g2 = E.a ^ b; var r9g3 = E.a ^ c; //ok var r9g4 = E.a ^ d; var r9g5 = E.a ^ e; var r9g6 = E.a ^ f; + var r9h1 = a ^ E.b; //ok var r9h2 = b ^ E.b; var r9h3 = c ^ E.b; //ok var r9h4 = d ^ E.b; var r9h5 = e ^ E.b; var r9h6 = f ^ E.b; + // operator | var r10a1 = a | a; //ok var r10a2 = a | b; @@ -1045,42 +1117,49 @@ var r10a3 = a | c; //ok var r10a4 = a | d; var r10a5 = a | e; var r10a6 = a | f; + var r10b1 = b | a; var r10b2 = b | b; var r10b3 = b | c; var r10b4 = b | d; var r10b5 = b | e; var r10b6 = b | f; + var r10c1 = c | a; //ok var r10c2 = c | b; var r10c3 = c | c; //ok var r10c4 = c | d; var r10c5 = c | e; var r10c6 = c | f; + var r10d1 = d | a; var r10d2 = d | b; var r10d3 = d | c; var r10d4 = d | d; var r10d5 = d | e; var r10d6 = d | f; + var r10e1 = e | a; var r10e2 = e | b; var r10e3 = e | c; var r10e4 = e | d; var r10e5 = e | e; var r10e6 = e | f; + var r10f1 = f | a; var r10f2 = f | b; var r10f3 = f | c; var r10f4 = f | d; var r10f5 = f | e; var r10f6 = f | f; + var r10g1 = E.a | a; //ok var r10g2 = E.a | b; var r10g3 = E.a | c; //ok var r10g4 = E.a | d; var r10g5 = E.a | e; var r10g6 = E.a | f; + var r10h1 = a | E.b; //ok var r10h2 = b | E.b; var r10h3 = c | E.b; //ok diff --git a/tests/baselines/reference/arithmeticOperatorWithNullValueAndInvalidOperands.js b/tests/baselines/reference/arithmeticOperatorWithNullValueAndInvalidOperands.js index b277abb668d86..8ee96317b9f9c 100644 --- a/tests/baselines/reference/arithmeticOperatorWithNullValueAndInvalidOperands.js +++ b/tests/baselines/reference/arithmeticOperatorWithNullValueAndInvalidOperands.js @@ -179,6 +179,7 @@ var r10d3 = {} | null; //// [arithmeticOperatorWithNullValueAndInvalidOperands.js] // If one operand is the null or undefined value, it is treated as having the type of the // other operand. + var a; var b; var c; @@ -186,129 +187,168 @@ var c; var r1a1 = null * a; var r1a2 = null * b; var r1a3 = null * c; + var r1b1 = a * null; var r1b2 = b * null; var r1b3 = c * null; + var r1c1 = null * true; var r1c2 = null * ''; var r1c3 = null * {}; + var r1d1 = true * null; var r1d2 = '' * null; var r1d3 = {} * null; + // operator / var r2a1 = null / a; var r2a2 = null / b; var r2a3 = null / c; + var r2b1 = a / null; var r2b2 = b / null; var r2b3 = c / null; + var r2c1 = null / true; var r2c2 = null / ''; var r2c3 = null / {}; + var r2d1 = true / null; var r2d2 = '' / null; var r2d3 = {} / null; + // operator % var r3a1 = null % a; var r3a2 = null % b; var r3a3 = null % c; + var r3b1 = a % null; var r3b2 = b % null; var r3b3 = c % null; + var r3c1 = null % true; var r3c2 = null % ''; var r3c3 = null % {}; + var r3d1 = true % null; var r3d2 = '' % null; var r3d3 = {} % null; + // operator - var r4a1 = null - a; var r4a2 = null - b; var r4a3 = null - c; + var r4b1 = a - null; var r4b2 = b - null; var r4b3 = c - null; + var r4c1 = null - true; var r4c2 = null - ''; var r4c3 = null - {}; + var r4d1 = true - null; var r4d2 = '' - null; var r4d3 = {} - null; + // operator << var r5a1 = null << a; var r5a2 = null << b; var r5a3 = null << c; + var r5b1 = a << null; var r5b2 = b << null; var r5b3 = c << null; + var r5c1 = null << true; var r5c2 = null << ''; var r5c3 = null << {}; + var r5d1 = true << null; var r5d2 = '' << null; var r5d3 = {} << null; + // operator >> var r6a1 = null >> a; var r6a2 = null >> b; var r6a3 = null >> c; + var r6b1 = a >> null; var r6b2 = b >> null; var r6b3 = c >> null; + var r6c1 = null >> true; var r6c2 = null >> ''; var r6c3 = null >> {}; + var r6d1 = true >> null; var r6d2 = '' >> null; var r6d3 = {} >> null; + // operator >>> var r7a1 = null >>> a; var r7a2 = null >>> b; var r7a3 = null >>> c; + var r7b1 = a >>> null; var r7b2 = b >>> null; var r7b3 = c >>> null; + var r7c1 = null >>> true; var r7c2 = null >>> ''; var r7c3 = null >>> {}; + var r7d1 = true >>> null; var r7d2 = '' >>> null; var r7d3 = {} >>> null; + // operator & var r8a1 = null & a; var r8a2 = null & b; var r8a3 = null & c; + var r8b1 = a & null; var r8b2 = b & null; var r8b3 = c & null; + var r8c1 = null & true; var r8c2 = null & ''; var r8c3 = null & {}; + var r8d1 = true & null; var r8d2 = '' & null; var r8d3 = {} & null; + // operator ^ var r9a1 = null ^ a; var r9a2 = null ^ b; var r9a3 = null ^ c; + var r9b1 = a ^ null; var r9b2 = b ^ null; var r9b3 = c ^ null; + var r9c1 = null ^ true; var r9c2 = null ^ ''; var r9c3 = null ^ {}; + var r9d1 = true ^ null; var r9d2 = '' ^ null; var r9d3 = {} ^ null; + // operator | var r10a1 = null | a; var r10a2 = null | b; var r10a3 = null | c; + var r10b1 = a | null; var r10b2 = b | null; var r10b3 = c | null; + var r10c1 = null | true; var r10c2 = null | ''; var r10c3 = null | {}; + var r10d1 = true | null; var r10d2 = '' | null; var r10d3 = {} | null; diff --git a/tests/baselines/reference/arithmeticOperatorWithNullValueAndValidOperands.js b/tests/baselines/reference/arithmeticOperatorWithNullValueAndValidOperands.js index 0c30e8d048492..f38cfd8ba31c2 100644 --- a/tests/baselines/reference/arithmeticOperatorWithNullValueAndValidOperands.js +++ b/tests/baselines/reference/arithmeticOperatorWithNullValueAndValidOperands.js @@ -129,6 +129,7 @@ var ra5 = a * null; var ra6 = b * null; var ra7 = 0 * null; var ra8 = E.b * null; + // operator / var rb1 = null / a; var rb2 = null / b; @@ -138,6 +139,7 @@ var rb5 = a / null; var rb6 = b / null; var rb7 = 0 / null; var rb8 = E.b / null; + // operator % var rc1 = null % a; var rc2 = null % b; @@ -147,6 +149,7 @@ var rc5 = a % null; var rc6 = b % null; var rc7 = 0 % null; var rc8 = E.b % null; + // operator - var rd1 = null - a; var rd2 = null - b; @@ -156,6 +159,7 @@ var rd5 = a - null; var rd6 = b - null; var rd7 = 0 - null; var rd8 = E.b - null; + // operator << var re1 = null << a; var re2 = null << b; @@ -165,6 +169,7 @@ var re5 = a << null; var re6 = b << null; var re7 = 0 << null; var re8 = E.b << null; + // operator >> var rf1 = null >> a; var rf2 = null >> b; @@ -174,6 +179,7 @@ var rf5 = a >> null; var rf6 = b >> null; var rf7 = 0 >> null; var rf8 = E.b >> null; + // operator >>> var rg1 = null >>> a; var rg2 = null >>> b; @@ -183,6 +189,7 @@ var rg5 = a >>> null; var rg6 = b >>> null; var rg7 = 0 >>> null; var rg8 = E.b >>> null; + // operator & var rh1 = null & a; var rh2 = null & b; @@ -192,6 +199,7 @@ var rh5 = a & null; var rh6 = b & null; var rh7 = 0 & null; var rh8 = E.b & null; + // operator ^ var ri1 = null ^ a; var ri2 = null ^ b; @@ -201,6 +209,7 @@ var ri5 = a ^ null; var ri6 = b ^ null; var ri7 = 0 ^ null; var ri8 = E.b ^ null; + // operator | var rj1 = null | a; var rj2 = null | b; diff --git a/tests/baselines/reference/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.js b/tests/baselines/reference/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.js index f1421a6b5c974..82e1428b5c3d6 100644 --- a/tests/baselines/reference/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.js +++ b/tests/baselines/reference/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.js @@ -65,46 +65,55 @@ var ra1 = null * null; var ra2 = null * undefined; var ra3 = undefined * null; var ra4 = undefined * undefined; + // operator / var rb1 = null / null; var rb2 = null / undefined; var rb3 = undefined / null; var rb4 = undefined / undefined; + // operator % var rc1 = null % null; var rc2 = null % undefined; var rc3 = undefined % null; var rc4 = undefined % undefined; + // operator - var rd1 = null - null; var rd2 = null - undefined; var rd3 = undefined - null; var rd4 = undefined - undefined; + // operator << var re1 = null << null; var re2 = null << undefined; var re3 = undefined << null; var re4 = undefined << undefined; + // operator >> var rf1 = null >> null; var rf2 = null >> undefined; var rf3 = undefined >> null; var rf4 = undefined >> undefined; + // operator >>> var rg1 = null >>> null; var rg2 = null >>> undefined; var rg3 = undefined >>> null; var rg4 = undefined >>> undefined; + // operator & var rh1 = null & null; var rh2 = null & undefined; var rh3 = undefined & null; var rh4 = undefined & undefined; + // operator ^ var ri1 = null ^ null; var ri2 = null ^ undefined; var ri3 = undefined ^ null; var ri4 = undefined ^ undefined; + // operator | var rj1 = null | null; var rj2 = null | undefined; diff --git a/tests/baselines/reference/arithmeticOperatorWithTypeParameter.js b/tests/baselines/reference/arithmeticOperatorWithTypeParameter.js index 94475b88fd807..af309ebd18f8f 100644 --- a/tests/baselines/reference/arithmeticOperatorWithTypeParameter.js +++ b/tests/baselines/reference/arithmeticOperatorWithTypeParameter.js @@ -147,6 +147,7 @@ function foo(t) { var r1a8 = a & t; var r1a9 = a ^ t; var r1a10 = a | t; + var r2a1 = t * a; var r2a2 = t / a; var r2a3 = t % a; @@ -157,6 +158,7 @@ function foo(t) { var r2a8 = t & a; var r2a9 = t ^ a; var r2a10 = t | a; + var r1b1 = b * t; var r1b2 = b / t; var r1b3 = b % t; @@ -167,6 +169,7 @@ function foo(t) { var r1b8 = b & t; var r1b9 = b ^ t; var r1b10 = b | t; + var r2b1 = t * b; var r2b2 = t / b; var r2b3 = t % b; @@ -177,6 +180,7 @@ function foo(t) { var r2b8 = t & b; var r2b9 = t ^ b; var r2b10 = t | b; + var r1c1 = c * t; var r1c2 = c / t; var r1c3 = c % t; @@ -187,6 +191,7 @@ function foo(t) { var r1c8 = c & t; var r1c9 = c ^ t; var r1c10 = c | t; + var r2c1 = t * c; var r2c2 = t / c; var r2c3 = t % c; @@ -197,6 +202,7 @@ function foo(t) { var r2c8 = t & c; var r2c9 = t ^ c; var r2c10 = t | c; + var r1d1 = d * t; var r1d2 = d / t; var r1d3 = d % t; @@ -207,6 +213,7 @@ function foo(t) { var r1d8 = d & t; var r1d9 = d ^ t; var r1d10 = d | t; + var r2d1 = t * d; var r2d2 = t / d; var r2d3 = t % d; @@ -217,6 +224,7 @@ function foo(t) { var r2d8 = t & d; var r2d9 = t ^ d; var r2d10 = t | d; + var r1e1 = e * t; var r1e2 = e / t; var r1e3 = e % t; @@ -227,6 +235,7 @@ function foo(t) { var r1e8 = e & t; var r1e9 = e ^ t; var r1e10 = e | t; + var r2e1 = t * e; var r2e2 = t / e; var r2e3 = t % e; @@ -237,6 +246,7 @@ function foo(t) { var r2e8 = t & e; var r2e9 = t ^ e; var r2e10 = t | e; + var r1f1 = t * t; var r1f2 = t / t; var r1f3 = t % t; diff --git a/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndInvalidOperands.js b/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndInvalidOperands.js index b64c2d9dc0945..6c63109f6e749 100644 --- a/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndInvalidOperands.js +++ b/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndInvalidOperands.js @@ -179,6 +179,7 @@ var r10d3 = {} | undefined; //// [arithmeticOperatorWithUndefinedValueAndInvalidOperands.js] // If one operand is the undefined or undefined value, it is treated as having the type of the // other operand. + var a; var b; var c; @@ -186,129 +187,168 @@ var c; var r1a1 = undefined * a; var r1a2 = undefined * b; var r1a3 = undefined * c; + var r1b1 = a * undefined; var r1b2 = b * undefined; var r1b3 = c * undefined; + var r1c1 = undefined * true; var r1c2 = undefined * ''; var r1c3 = undefined * {}; + var r1d1 = true * undefined; var r1d2 = '' * undefined; var r1d3 = {} * undefined; + // operator / var r2a1 = undefined / a; var r2a2 = undefined / b; var r2a3 = undefined / c; + var r2b1 = a / undefined; var r2b2 = b / undefined; var r2b3 = c / undefined; + var r2c1 = undefined / true; var r2c2 = undefined / ''; var r2c3 = undefined / {}; + var r2d1 = true / undefined; var r2d2 = '' / undefined; var r2d3 = {} / undefined; + // operator % var r3a1 = undefined % a; var r3a2 = undefined % b; var r3a3 = undefined % c; + var r3b1 = a % undefined; var r3b2 = b % undefined; var r3b3 = c % undefined; + var r3c1 = undefined % true; var r3c2 = undefined % ''; var r3c3 = undefined % {}; + var r3d1 = true % undefined; var r3d2 = '' % undefined; var r3d3 = {} % undefined; + // operator - var r4a1 = undefined - a; var r4a2 = undefined - b; var r4a3 = undefined - c; + var r4b1 = a - undefined; var r4b2 = b - undefined; var r4b3 = c - undefined; + var r4c1 = undefined - true; var r4c2 = undefined - ''; var r4c3 = undefined - {}; + var r4d1 = true - undefined; var r4d2 = '' - undefined; var r4d3 = {} - undefined; + // operator << var r5a1 = undefined << a; var r5a2 = undefined << b; var r5a3 = undefined << c; + var r5b1 = a << undefined; var r5b2 = b << undefined; var r5b3 = c << undefined; + var r5c1 = undefined << true; var r5c2 = undefined << ''; var r5c3 = undefined << {}; + var r5d1 = true << undefined; var r5d2 = '' << undefined; var r5d3 = {} << undefined; + // operator >> var r6a1 = undefined >> a; var r6a2 = undefined >> b; var r6a3 = undefined >> c; + var r6b1 = a >> undefined; var r6b2 = b >> undefined; var r6b3 = c >> undefined; + var r6c1 = undefined >> true; var r6c2 = undefined >> ''; var r6c3 = undefined >> {}; + var r6d1 = true >> undefined; var r6d2 = '' >> undefined; var r6d3 = {} >> undefined; + // operator >>> var r7a1 = undefined >>> a; var r7a2 = undefined >>> b; var r7a3 = undefined >>> c; + var r7b1 = a >>> undefined; var r7b2 = b >>> undefined; var r7b3 = c >>> undefined; + var r7c1 = undefined >>> true; var r7c2 = undefined >>> ''; var r7c3 = undefined >>> {}; + var r7d1 = true >>> undefined; var r7d2 = '' >>> undefined; var r7d3 = {} >>> undefined; + // operator & var r8a1 = undefined & a; var r8a2 = undefined & b; var r8a3 = undefined & c; + var r8b1 = a & undefined; var r8b2 = b & undefined; var r8b3 = c & undefined; + var r8c1 = undefined & true; var r8c2 = undefined & ''; var r8c3 = undefined & {}; + var r8d1 = true & undefined; var r8d2 = '' & undefined; var r8d3 = {} & undefined; + // operator ^ var r9a1 = undefined ^ a; var r9a2 = undefined ^ b; var r9a3 = undefined ^ c; + var r9b1 = a ^ undefined; var r9b2 = b ^ undefined; var r9b3 = c ^ undefined; + var r9c1 = undefined ^ true; var r9c2 = undefined ^ ''; var r9c3 = undefined ^ {}; + var r9d1 = true ^ undefined; var r9d2 = '' ^ undefined; var r9d3 = {} ^ undefined; + // operator | var r10a1 = undefined | a; var r10a2 = undefined | b; var r10a3 = undefined | c; + var r10b1 = a | undefined; var r10b2 = b | undefined; var r10b3 = c | undefined; + var r10c1 = undefined | true; var r10c2 = undefined | ''; var r10c3 = undefined | {}; + var r10d1 = true | undefined; var r10d2 = '' | undefined; var r10d3 = {} | undefined; diff --git a/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndValidOperands.js b/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndValidOperands.js index 60ea9af32c2b5..c2b56232cb975 100644 --- a/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndValidOperands.js +++ b/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndValidOperands.js @@ -129,6 +129,7 @@ var ra5 = a * undefined; var ra6 = b * undefined; var ra7 = 0 * undefined; var ra8 = E.b * undefined; + // operator / var rb1 = undefined / a; var rb2 = undefined / b; @@ -138,6 +139,7 @@ var rb5 = a / undefined; var rb6 = b / undefined; var rb7 = 0 / undefined; var rb8 = E.b / undefined; + // operator % var rc1 = undefined % a; var rc2 = undefined % b; @@ -147,6 +149,7 @@ var rc5 = a % undefined; var rc6 = b % undefined; var rc7 = 0 % undefined; var rc8 = E.b % undefined; + // operator - var rd1 = undefined - a; var rd2 = undefined - b; @@ -156,6 +159,7 @@ var rd5 = a - undefined; var rd6 = b - undefined; var rd7 = 0 - undefined; var rd8 = E.b - undefined; + // operator << var re1 = undefined << a; var re2 = undefined << b; @@ -165,6 +169,7 @@ var re5 = a << undefined; var re6 = b << undefined; var re7 = 0 << undefined; var re8 = E.b << undefined; + // operator >> var rf1 = undefined >> a; var rf2 = undefined >> b; @@ -174,6 +179,7 @@ var rf5 = a >> undefined; var rf6 = b >> undefined; var rf7 = 0 >> undefined; var rf8 = E.b >> undefined; + // operator >>> var rg1 = undefined >>> a; var rg2 = undefined >>> b; @@ -183,6 +189,7 @@ var rg5 = a >>> undefined; var rg6 = b >>> undefined; var rg7 = 0 >>> undefined; var rg8 = E.b >>> undefined; + // operator & var rh1 = undefined & a; var rh2 = undefined & b; @@ -192,6 +199,7 @@ var rh5 = a & undefined; var rh6 = b & undefined; var rh7 = 0 & undefined; var rh8 = E.b & undefined; + // operator ^ var ri1 = undefined ^ a; var ri2 = undefined ^ b; @@ -201,6 +209,7 @@ var ri5 = a ^ undefined; var ri6 = b ^ undefined; var ri7 = 0 ^ undefined; var ri8 = E.b ^ undefined; + // operator | var rj1 = undefined | a; var rj2 = undefined | b; diff --git a/tests/baselines/reference/arityAndOrderCompatibility01.js b/tests/baselines/reference/arityAndOrderCompatibility01.js index bf7736a80c997..2e3079e659fce 100644 --- a/tests/baselines/reference/arityAndOrderCompatibility01.js +++ b/tests/baselines/reference/arityAndOrderCompatibility01.js @@ -37,9 +37,11 @@ var o3: [string, number] = y; //// [arityAndOrderCompatibility01.js] + var x; var y; var z; + var a = x[0], b = x[1], c = x[2]; var d = y[0], e = y[1], f = y[2]; var g = z[0], h = z[1], i = z[2]; diff --git a/tests/baselines/reference/arityErrorRelatedSpanBindingPattern.js b/tests/baselines/reference/arityErrorRelatedSpanBindingPattern.js index 66f9316457d12..76ee0a680ef98 100644 --- a/tests/baselines/reference/arityErrorRelatedSpanBindingPattern.js +++ b/tests/baselines/reference/arityErrorRelatedSpanBindingPattern.js @@ -12,8 +12,10 @@ bar("", 0); function foo(a, b, _a) { var c = _a.c; } + function bar(a, b, _a) { var c = _a[0]; } foo("", 0); + bar("", 0); diff --git a/tests/baselines/reference/arrayAssignmentTest1.js b/tests/baselines/reference/arrayAssignmentTest1.js index 5ceebf7c0a187..f8d88b5a894c2 100644 --- a/tests/baselines/reference/arrayAssignmentTest1.js +++ b/tests/baselines/reference/arrayAssignmentTest1.js @@ -101,6 +101,7 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + var C1 = /** @class */ (function () { function C1() { } @@ -148,6 +149,7 @@ var arr_i1_2 = []; var arr_c1_2 = []; var arr_c2_2 = []; var arr_c3 = []; + var i1_error = []; // should be an error - is var c1_error = []; // should be an error - is var c2_error = []; // should be an error - is @@ -156,24 +158,32 @@ arr_any = arr_i1; // should be ok - is arr_any = arr_c1; // should be ok - is arr_any = arr_c2; // should be ok - is arr_any = arr_c3; // should be ok - is + arr_i1 = arr_i1; // should be ok - subtype relationship - is arr_i1 = arr_c1; // should be ok - subtype relationship - is arr_i1 = arr_c2; // should be ok - subtype relationship - is arr_i1 = arr_c3; // should be an error - is + arr_c1 = arr_c1; // should be ok - subtype relationship - is arr_c1 = arr_c2; // should be ok - subtype relationship - is arr_c1 = arr_i1; // should be an error - is arr_c1 = arr_c3; // should be an error - is + arr_c2 = arr_c2; // should be ok - subtype relationship - is arr_c2 = arr_c1; // should be an error - subtype relationship - is arr_c2 = arr_i1; // should be an error - subtype relationship - is arr_c2 = arr_c3; // should be an error - is + + + + // "clean up bug" occurs at this point // if you move these three expressions to another file, they raise an error // something to do with state from the above propagating forward? arr_c3 = arr_c2_2; // should be an error - is arr_c3 = arr_c1_2; // should be an error - is arr_c3 = arr_i1_2; // should be an error - is + arr_any = f1; // should be an error - is arr_any = o1; // should be an error - is arr_any = a1; // should be ok - is diff --git a/tests/baselines/reference/arrayAssignmentTest2.js b/tests/baselines/reference/arrayAssignmentTest2.js index 536a61692ec96..28c3b814ffde6 100644 --- a/tests/baselines/reference/arrayAssignmentTest2.js +++ b/tests/baselines/reference/arrayAssignmentTest2.js @@ -75,6 +75,7 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + var C1 = /** @class */ (function () { function C1() { } @@ -126,6 +127,7 @@ var arr_c3 = []; arr_c3 = arr_c2_2; // should be an error - is arr_c3 = arr_c1_2; // should be an error - is arr_c3 = arr_i1_2; // should be an error - is + arr_any = f1; // should be an error - is arr_any = function () { return null; }; // should be an error - is arr_any = o1; // should be an error - is diff --git a/tests/baselines/reference/arrayAssignmentTest3.js b/tests/baselines/reference/arrayAssignmentTest3.js index 965da445a2ba8..6f967c190703e 100644 --- a/tests/baselines/reference/arrayAssignmentTest3.js +++ b/tests/baselines/reference/arrayAssignmentTest3.js @@ -19,8 +19,7 @@ var xx = new a(null, 7, new B()); // Michal saw no error if he used number instead of B, // but I do... var B = /** @class */ (function () { - function B() { - } + function B() {} return B; }()); var a = /** @class */ (function () { diff --git a/tests/baselines/reference/arrayBestCommonTypes.js b/tests/baselines/reference/arrayBestCommonTypes.js index 7acf6feb591e4..e245a33f2891c 100644 --- a/tests/baselines/reference/arrayBestCommonTypes.js +++ b/tests/baselines/reference/arrayBestCommonTypes.js @@ -126,13 +126,11 @@ var __extends = (this && this.__extends) || (function () { var EmptyTypes; (function (EmptyTypes) { var base = /** @class */ (function () { - function base() { - } + function base() {} return base; }()); var base2 = /** @class */ (function () { - function base2() { - } + function base2() {} return base2; }()); var derived = /** @class */ (function (_super) { @@ -145,10 +143,10 @@ var EmptyTypes; var f = /** @class */ (function () { function f() { } - f.prototype.voidIfAny = function (x, y) { - if (y === void 0) { y = false; } + f.prototype.voidIfAny = function (x, y) {if (y === void 0) { y = false; } return null; }; + f.prototype.x = function () { (this.voidIfAny([4, 2][0])); (this.voidIfAny([4, 2, undefined][0])); @@ -156,16 +154,21 @@ var EmptyTypes; (this.voidIfAny([null, 2, 4][0])); (this.voidIfAny([2, 4, null][0])); (this.voidIfAny([undefined, 4, null][0])); + (this.voidIfAny(['', "q"][0])); (this.voidIfAny(['', "q", undefined][0])); (this.voidIfAny([undefined, "q", ''][0])); (this.voidIfAny([null, "q", ''][0])); (this.voidIfAny(["q", '', null][0])); (this.voidIfAny([undefined, '', null][0])); + (this.voidIfAny([[3, 4], [null]][0][0])); + + var t1 = [{ x: 7, y: new derived() }, { x: 5, y: new base() }]; var t2 = [{ x: true, y: new derived() }, { x: false, y: new base() }]; var t3 = [{ x: undefined, y: new base() }, { x: '', y: new derived() }]; + var anyObj = null; // Order matters here so test all the variants var a1 = [{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }]; @@ -174,6 +177,7 @@ var EmptyTypes; var ifaceObj = null; var baseObj = new base(); var base2Obj = new base2(); + var b1 = [baseObj, base2Obj, ifaceObj]; var b2 = [base2Obj, baseObj, ifaceObj]; var b3 = [baseObj, ifaceObj, base2Obj]; @@ -185,13 +189,11 @@ var EmptyTypes; var NonEmptyTypes; (function (NonEmptyTypes) { var base = /** @class */ (function () { - function base() { - } + function base() {} return base; }()); var base2 = /** @class */ (function () { - function base2() { - } + function base2() {} return base2; }()); var derived = /** @class */ (function (_super) { @@ -204,10 +206,10 @@ var NonEmptyTypes; var f = /** @class */ (function () { function f() { } - f.prototype.voidIfAny = function (x, y) { - if (y === void 0) { y = false; } + f.prototype.voidIfAny = function (x, y) {if (y === void 0) { y = false; } return null; }; + f.prototype.x = function () { (this.voidIfAny([4, 2][0])); (this.voidIfAny([4, 2, undefined][0])); @@ -215,16 +217,21 @@ var NonEmptyTypes; (this.voidIfAny([null, 2, 4][0])); (this.voidIfAny([2, 4, null][0])); (this.voidIfAny([undefined, 4, null][0])); + (this.voidIfAny(['', "q"][0])); (this.voidIfAny(['', "q", undefined][0])); (this.voidIfAny([undefined, "q", ''][0])); (this.voidIfAny([null, "q", ''][0])); (this.voidIfAny(["q", '', null][0])); (this.voidIfAny([undefined, '', null][0])); + (this.voidIfAny([[3, 4], [null]][0][0])); + + var t1 = [{ x: 7, y: new derived() }, { x: 5, y: new base() }]; var t2 = [{ x: true, y: new derived() }, { x: false, y: new base() }]; var t3 = [{ x: undefined, y: new base() }, { x: '', y: new derived() }]; + var anyObj = null; // Order matters here so test all the variants var a1 = [{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }]; @@ -233,6 +240,7 @@ var NonEmptyTypes; var ifaceObj = null; var baseObj = new base(); var base2Obj = new base2(); + var b1 = [baseObj, base2Obj, ifaceObj]; var b2 = [base2Obj, baseObj, ifaceObj]; var b3 = [baseObj, ifaceObj, base2Obj]; diff --git a/tests/baselines/reference/arrayBindingPatternOmittedExpressions.js b/tests/baselines/reference/arrayBindingPatternOmittedExpressions.js index 916eee6218392..fda4278446873 100644 --- a/tests/baselines/reference/arrayBindingPatternOmittedExpressions.js +++ b/tests/baselines/reference/arrayBindingPatternOmittedExpressions.js @@ -24,6 +24,8 @@ var results; b }; } + + function f([, a, , b, , , , s, , ,] = results) { a = s[1]; b = s[2]; diff --git a/tests/baselines/reference/arrayCast.js b/tests/baselines/reference/arrayCast.js index 214bf642250b9..784eaeede25ea 100644 --- a/tests/baselines/reference/arrayCast.js +++ b/tests/baselines/reference/arrayCast.js @@ -10,5 +10,6 @@ // Should fail. Even though the array is contextually typed with { id: number }[], it still // has type { foo: string }[], which is not assignable to { id: number }[]. [{ foo: "s" }]; + // Should succeed, as the {} element causes the type of the array to be {}[] [{ foo: "s" }, {}]; diff --git a/tests/baselines/reference/arrayConcat2.js b/tests/baselines/reference/arrayConcat2.js index 8db2d62e1d357..9a0d8ca3332cc 100644 --- a/tests/baselines/reference/arrayConcat2.js +++ b/tests/baselines/reference/arrayConcat2.js @@ -11,6 +11,7 @@ b.concat('hello'); //// [arrayConcat2.js] var a = []; a.concat("hello", 'world'); + a.concat('Hello'); var b = new Array(); b.concat('hello'); diff --git a/tests/baselines/reference/arrayConstructors1.js b/tests/baselines/reference/arrayConstructors1.js index 488cf49a3160b..ae92444f33f13 100644 --- a/tests/baselines/reference/arrayConstructors1.js +++ b/tests/baselines/reference/arrayConstructors1.js @@ -14,6 +14,7 @@ var x; x = new Array(1); x = new Array('hi', 'bye'); x = new Array('hi', 'bye'); + var y; y = new Array(1); y = new Array(1, 2); diff --git a/tests/baselines/reference/arrayEvery.js b/tests/baselines/reference/arrayEvery.js index 35aa5aa5b409b..54708a6b83a31 100644 --- a/tests/baselines/reference/arrayEvery.js +++ b/tests/baselines/reference/arrayEvery.js @@ -10,6 +10,7 @@ if (foo.every(isString)) { //// [arrayEvery.js] var foo = ['aaa']; + var isString = function (x) { return typeof x === 'string'; }; if (foo.every(isString)) { foo[0].slice(0); diff --git a/tests/baselines/reference/arrayFakeFlatNoCrashInferenceDeclarations.js b/tests/baselines/reference/arrayFakeFlatNoCrashInferenceDeclarations.js index 3879383270a28..7ed4642d626df 100644 --- a/tests/baselines/reference/arrayFakeFlatNoCrashInferenceDeclarations.js +++ b/tests/baselines/reference/arrayFakeFlatNoCrashInferenceDeclarations.js @@ -17,6 +17,7 @@ function foo(arr: T[], depth: number) { //// [arrayFakeFlatNoCrashInferenceDeclarations.js] "use strict"; + function foo(arr, depth) { return flat(arr, depth); } diff --git a/tests/baselines/reference/arrayFind.js b/tests/baselines/reference/arrayFind.js index 1926c3a8dcc15..d62e8ed6270f4 100644 --- a/tests/baselines/reference/arrayFind.js +++ b/tests/baselines/reference/arrayFind.js @@ -16,7 +16,9 @@ const readonlyFoundNumber: number | undefined = readonlyArrayOfStringsNumbersAnd function isNumber(x) { return typeof x === "number"; } + var arrayOfStringsNumbersAndBooleans = ["string", false, 0, "strung", 1, true]; var foundNumber = arrayOfStringsNumbersAndBooleans.find(isNumber); + var readonlyArrayOfStringsNumbersAndBooleans = arrayOfStringsNumbersAndBooleans; var readonlyFoundNumber = readonlyArrayOfStringsNumbersAndBooleans.find(isNumber); diff --git a/tests/baselines/reference/arrayFrom.js b/tests/baselines/reference/arrayFrom.js index ea6fcf8fcf03f..300d408fd2b68 100644 --- a/tests/baselines/reference/arrayFrom.js +++ b/tests/baselines/reference/arrayFrom.js @@ -39,34 +39,35 @@ function getEither (in1: Iterable, in2: ArrayLike) { //// [arrayFrom.js] // Tests fix for #20432, ensures Array.from accepts all valid inputs // Also tests for #19682 + + + var inputA = []; var inputB = []; var inputALike = { length: 0 }; var inputARand = getEither(inputA, inputALike); var inputASet = new Set(); + var result1 = Array.from(inputA); var result2 = Array.from(inputA.values()); var result3 = Array.from(inputA.values()); // expect error var result4 = Array.from(inputB, function (_a) { var b = _a.b; - return ({ a: b }); -}); + return ({ a: b });}); var result5 = Array.from(inputALike); var result6 = Array.from(inputALike); // expect error var result7 = Array.from(inputALike, function (_a) { var a = _a.a; - return ({ b: a }); -}); + return ({ b: a });}); var result8 = Array.from(inputARand); var result9 = Array.from(inputARand, function (_a) { var a = _a.a; - return ({ b: a }); -}); + return ({ b: a });}); var result10 = Array.from(new Set()); var result11 = Array.from(inputASet, function (_a) { var a = _a.a; - return ({ b: a }); -}); + return ({ b: a });}); + // if this is written inline, the compiler seems to infer // the ?: as always taking the false branch, narrowing to ArrayLike, // even when the type is written as : Iterable|ArrayLike diff --git a/tests/baselines/reference/arrayLiteral.js b/tests/baselines/reference/arrayLiteral.js index ae210aabd42c2..a1e96dbdc9f65 100644 --- a/tests/baselines/reference/arrayLiteral.js +++ b/tests/baselines/reference/arrayLiteral.js @@ -17,13 +17,17 @@ var y2: number[] = new Array(); //// [arrayLiteral.js] // valid uses of array literals + var x = []; var x = new Array(1); + var y = [1]; var y = [1, 2]; var y = new Array(); + var x2 = []; var x2 = new Array(1); + var y2 = [1]; var y2 = [1, 2]; var y2 = new Array(); diff --git a/tests/baselines/reference/arrayLiteralAndArrayConstructorEquivalence1.js b/tests/baselines/reference/arrayLiteralAndArrayConstructorEquivalence1.js index 0b9f543e38242..3f46477eed29c 100644 --- a/tests/baselines/reference/arrayLiteralAndArrayConstructorEquivalence1.js +++ b/tests/baselines/reference/arrayLiteralAndArrayConstructorEquivalence1.js @@ -21,6 +21,7 @@ var myCars5; myCars = myCars3; myCars = myCars4; myCars = myCars5; + myCars3 = myCars; myCars3 = myCars4; myCars3 = myCars5; diff --git a/tests/baselines/reference/arrayLiteralContextualType.js b/tests/baselines/reference/arrayLiteralContextualType.js index 2d48085c80ff3..1ba4e6228d67c 100644 --- a/tests/baselines/reference/arrayLiteralContextualType.js +++ b/tests/baselines/reference/arrayLiteralContextualType.js @@ -30,6 +30,7 @@ foo(arr); // ok because arr is Array not {}[] bar(arr); // ok because arr is Array not {}[] //// [arrayLiteralContextualType.js] + var Giraffe = /** @class */ (function () { function Giraffe() { this.name = "Giraffe"; @@ -54,6 +55,7 @@ bar([ new Giraffe(), new Elephant() ]); // Legal because of the contextual type IAnimal provided by the parameter + var arr = [new Giraffe(), new Elephant()]; foo(arr); // ok because arr is Array not {}[] bar(arr); // ok because arr is Array not {}[] diff --git a/tests/baselines/reference/arrayLiteralExpressionContextualTyping.js b/tests/baselines/reference/arrayLiteralExpressionContextualTyping.js index ca78193f03a5b..b90d5488e476b 100644 --- a/tests/baselines/reference/arrayLiteralExpressionContextualTyping.js +++ b/tests/baselines/reference/arrayLiteralExpressionContextualTyping.js @@ -29,6 +29,9 @@ var array1 = [true, 2, 3]; // Contextual type by the numeric index type of the c var tup = [1, 2, 3, 4]; var tup1 = [1, 2, 3, "string"]; var tup2 = [1, 2, 3, "string"]; // Error + + + // In a contextually typed array literal expression containing one or more spread elements, // an element expression at index N is contextually typed by the numeric index type of the contextual type, if any. var spr = __spreadArray([1, 2, 3], array); diff --git a/tests/baselines/reference/arrayLiteralInNonVarArgParameter.js b/tests/baselines/reference/arrayLiteralInNonVarArgParameter.js index 57cba07d6bf16..0842976d7a951 100644 --- a/tests/baselines/reference/arrayLiteralInNonVarArgParameter.js +++ b/tests/baselines/reference/arrayLiteralInNonVarArgParameter.js @@ -5,8 +5,7 @@ panic([], 'one', 'two'); //// [arrayLiteralInNonVarArgParameter.js] -function panic(val) { - var opt = []; +function panic(val) {var opt = []; for (var _i = 1; _i < arguments.length; _i++) { opt[_i - 1] = arguments[_i]; } diff --git a/tests/baselines/reference/arrayLiteralInference.js b/tests/baselines/reference/arrayLiteralInference.js index 6b98b22394ac2..90a40cdc03ff3 100644 --- a/tests/baselines/reference/arrayLiteralInference.js +++ b/tests/baselines/reference/arrayLiteralInference.js @@ -61,5 +61,6 @@ const appTypeStylesWithError = new Map([ [AppType.Relationship, [AppStyle.Standard, AppStyle.Tree, AppStyle.TreeEntity]], [AppType.AdvancedList, [AppStyle.Standard, AppStyle.MiniApp]] ]); + let b1 = foo({ x: true }, { x: false }); let b2 = foo([true], [false]); diff --git a/tests/baselines/reference/arrayLiteralSpread.js b/tests/baselines/reference/arrayLiteralSpread.js index d1923445eac63..cd2e1699900fd 100644 --- a/tests/baselines/reference/arrayLiteralSpread.js +++ b/tests/baselines/reference/arrayLiteralSpread.js @@ -28,8 +28,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) { for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) to[j] = from[i]; return to; -}; -function f0() { +};function f0() { var a = [1, 2, 3]; var a1 = __spreadArray([], a); var a2 = __spreadArray([1], a); @@ -40,11 +39,13 @@ function f0() { var a7 = __spreadArray(__spreadArray(__spreadArray([1], a), [2]), a); var a8 = __spreadArray(__spreadArray(__spreadArray([], a), a), a); } + function f1() { var a = [1, 2, 3]; var b = __spreadArray(__spreadArray(["hello"], a), [true]); var b; } + function f2() { var a = []; var b = [5]; diff --git a/tests/baselines/reference/arrayLiteralSpreadES5iterable.js b/tests/baselines/reference/arrayLiteralSpreadES5iterable.js index 9545e3fdb61a6..6df08f5dbbd4a 100644 --- a/tests/baselines/reference/arrayLiteralSpreadES5iterable.js +++ b/tests/baselines/reference/arrayLiteralSpreadES5iterable.js @@ -44,8 +44,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) { for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) to[j] = from[i]; return to; -}; -function f0() { +};function f0() { var a = [1, 2, 3]; var a1 = __spreadArray([], __read(a)); var a2 = __spreadArray([1], __read(a)); @@ -56,11 +55,13 @@ function f0() { var a7 = __spreadArray(__spreadArray(__spreadArray([1], __read(a)), [2]), __read(a)); var a8 = __spreadArray(__spreadArray(__spreadArray([], __read(a)), __read(a)), __read(a)); } + function f1() { var a = [1, 2, 3]; var b = __spreadArray(__spreadArray(["hello"], __read(a)), [true]); var b; } + function f2() { var a = []; var b = [5]; diff --git a/tests/baselines/reference/arrayLiteralTypeInference.js b/tests/baselines/reference/arrayLiteralTypeInference.js index 54b98a664ada1..0720eaa330432 100644 --- a/tests/baselines/reference/arrayLiteralTypeInference.js +++ b/tests/baselines/reference/arrayLiteralTypeInference.js @@ -66,8 +66,7 @@ var __extends = (this && this.__extends) || (function () { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -})(); -var Action = /** @class */ (function () { +})();var Action = /** @class */ (function () { function Action() { } return Action; @@ -90,25 +89,34 @@ var x1 = [ { id: 2, trueness: false }, { id: 3, name: "three" } ]; + var x2 = [ new ActionA(), new ActionB() ]; + var x3 = [ new Action(), new ActionA(), new ActionB() ]; + var z1 = [ { id: 2, trueness: false }, { id: 3, name: "three" } ]; + var z2 = [ new ActionA(), new ActionB() ]; + var z3 = [ new Action(), new ActionA(), new ActionB() ]; + + + + diff --git a/tests/baselines/reference/arrayLiteralWidened.js b/tests/baselines/reference/arrayLiteralWidened.js index 5b7346b87381b..f732b1f5a99a8 100644 --- a/tests/baselines/reference/arrayLiteralWidened.js +++ b/tests/baselines/reference/arrayLiteralWidened.js @@ -25,13 +25,17 @@ var d = [undefined, x]; //// [arrayLiteralWidened.js] // array literals are widened upon assignment according to their element type + var a = []; // any[] var a = [, ,]; + var a = [null, null]; var a = [undefined, undefined]; + var b = [[], [null, null]]; // any[][] var b = [[], []]; var b = [[undefined, undefined]]; + var c = [[[]]]; // any[][][] var c = [[[null]], [undefined]]; // no widening when one or more elements are non-widening diff --git a/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.js b/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.js index b4f869d499eae..df363572c9e1b 100644 --- a/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.js +++ b/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.js @@ -17,6 +17,7 @@ var gs = [(b: { x: number; z?: number }) => 2, (a: { x: number; y?: number }) => //// [arrayLiteralWithMultipleBestCommonTypes.js] // when multiple best common types exist we will choose the first candidate + var a; var b; var c; diff --git a/tests/baselines/reference/arrayLiterals.js b/tests/baselines/reference/arrayLiterals.js index 3dd1cae6fb93c..506870dd6f10f 100644 --- a/tests/baselines/reference/arrayLiterals.js +++ b/tests/baselines/reference/arrayLiterals.js @@ -53,28 +53,36 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + var arr1 = [[], [1], ['']]; + var arr2 = [[null], [1], ['']]; + + // Array literal with elements of only EveryType E has type E[] var stringArrArr = [[''], [""]]; + var stringArr = ['', ""]; + var numberArr = [0, 0.0, 0x00, 1e1]; + var boolArr = [false, true, false, true]; var C = /** @class */ (function () { - function C() { - } + function C() {} return C; }()); var classArr = [new C(), new C()]; + var classTypeArray = [C, C, C]; var classTypeArray; // Should OK, not be a parse error + + // Contextual type C with numeric index signature makes array literal of EveryType E of type BCT(E,C)[] var context1 = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }]; var context2 = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }]; // Contextual type C with numeric index signature of type Base makes array literal of Derived have type Base[] var Base = /** @class */ (function () { - function Base() { - } + function Base() {} return Base; }()); var Derived1 = /** @class */ (function (_super) { @@ -94,5 +102,7 @@ var Derived2 = /** @class */ (function (_super) { }(Base)); ; var context3 = [new Derived1(), new Derived2()]; + // Contextual type C with numeric index signature of type Base makes array literal of Derived1 and Derived2 have type Base[] var context4 = [new Derived1(), new Derived1()]; + diff --git a/tests/baselines/reference/arrayLiterals2ES5.js b/tests/baselines/reference/arrayLiterals2ES5.js index e3574b8c45240..db7c3c4fbb49d 100644 --- a/tests/baselines/reference/arrayLiterals2ES5.js +++ b/tests/baselines/reference/arrayLiterals2ES5.js @@ -67,6 +67,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) { to[j] = from[i]; return to; }; + // SpreadElement: // ... AssignmentExpression var a0 = [, , 2, 3, 4]; @@ -75,6 +76,7 @@ var a2 = __spreadArray(__spreadArray([, , ], a0), ["hello"]); var a3 = __spreadArray([, ], a0); var a4 = [function () { return 1; },]; var a5 = __spreadArray(__spreadArray([], a0), [,]); + // Each element expression in a non-empty array literal is processed as follows: // - If the array literal contains no spread elements, and if the array literal is contextually typed (section 4.19) // by a type T and T has a property with the numeric name N, where N is the index of the element expression in the array literal, @@ -84,6 +86,7 @@ var a5 = __spreadArray(__spreadArray([], a0), [,]); // the resulting type is a tuple type constructed from the types of the element expressions. var b0 = [undefined, null, undefined]; var b1 = [[1, 2, 3], ["hello", "string"]]; + // The resulting type an array literal expression is determined as follows: // - If the array literal contains no spread elements and is an array assignment pattern in a destructuring assignment (section 4.17.1), // the resulting type is a tuple type constructed from the types of the element expressions. diff --git a/tests/baselines/reference/arrayLiterals2ES6.js b/tests/baselines/reference/arrayLiterals2ES6.js index cb6bf2684e858..f7ff64a53245c 100644 --- a/tests/baselines/reference/arrayLiterals2ES6.js +++ b/tests/baselines/reference/arrayLiterals2ES6.js @@ -60,6 +60,7 @@ var d9 = [[...temp1], ...["hello"]]; // Elisionopt SpreadElement // ElementList, Elisionopt AssignmentExpression // ElementList, Elisionopt SpreadElement + // SpreadElement: // ... AssignmentExpression var a0 = [, , 2, 3, 4]; @@ -82,12 +83,17 @@ var b1 = [[1, 2, 3], ["hello", "string"]]; // the resulting type is a tuple type constructed from the types of the element expressions. var [c0, c1] = [1, 2]; // tuple type [number, number] var [c2, c3] = [1, 2, true]; // tuple type [number, number, boolean] + + + + // The resulting type an array literal expression is determined as follows: // - the resulting type is an array type with an element type that is the union of the types of the // non - spread element expressions and the numeric index signature types of the spread element expressions var temp = ["s", "t", "r"]; var temp1 = [1, 2, 3]; var temp2 = [[1, 2, 3], ["hello", "string"]]; + var d0 = [1, true, ...temp,]; // has type (string|number|boolean)[] var d1 = [...temp]; // has type string[] var d2 = [...temp1]; diff --git a/tests/baselines/reference/arrayLiterals3.js b/tests/baselines/reference/arrayLiterals3.js index ad3dc247ac74a..7f57b2cb634df 100644 --- a/tests/baselines/reference/arrayLiterals3.js +++ b/tests/baselines/reference/arrayLiterals3.js @@ -45,11 +45,17 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) { to[j] = from[i]; return to; }; + // The resulting type an array literal expression is determined as follows: // - If the array literal contains no spread elements and is contextually typed by a tuple-like type, // the resulting type is a tuple type constructed from the types of the element expressions. var a0 = []; // Error var a1 = ["string", 1, true]; // Error + + + + + // The resulting type an array literal expression is determined as follows: // - If the array literal contains no spread elements and is an array assignment pattern in a destructuring assignment (section 4.17.1), // the resulting type is a tuple type constructed from the types of the element expressions. @@ -60,6 +66,7 @@ var _a = [1, 2, "string", true], b1 = _a[0], b2 = _a[1]; var temp = ["s", "t", "r"]; var temp1 = [1, 2, 3]; var temp2 = [[1, 2, 3], ["hello", "string"]]; + var c0 = __spreadArray([], temp2); // Error var c1 = __spreadArray([], temp1); // Error cannot assign number[] to [number, number, number] var c2 = __spreadArray(__spreadArray([], temp1), temp); // Error cannot assign (number|string)[] to number[] diff --git a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js index eababb4f69b72..0d41c84fb8777 100644 --- a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js +++ b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js @@ -40,8 +40,7 @@ var __extends = (this && this.__extends) || (function () { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -})(); -var List = /** @class */ (function () { +})();var List = /** @class */ (function () { function List() { } return List; diff --git a/tests/baselines/reference/arrayOfExportedClass.js b/tests/baselines/reference/arrayOfExportedClass.js index 2a41475c1cd33..e614aeb6904dc 100644 --- a/tests/baselines/reference/arrayOfExportedClass.js +++ b/tests/baselines/reference/arrayOfExportedClass.js @@ -38,6 +38,7 @@ var Road = /** @class */ (function () { function Road() { } Road.prototype.AddCars = function (cars) { + this.cars = cars; }; return Road; diff --git a/tests/baselines/reference/arrayOfFunctionTypes3.js b/tests/baselines/reference/arrayOfFunctionTypes3.js index 758e11f6f1fc5..7badcca54a4d0 100644 --- a/tests/baselines/reference/arrayOfFunctionTypes3.js +++ b/tests/baselines/reference/arrayOfFunctionTypes3.js @@ -28,6 +28,7 @@ var r7 = r6(''); // any not string //// [arrayOfFunctionTypes3.js] // valid uses of arrays of function types + var x = [function () { return 1; }, function () { }]; var r2 = x[0](); var C = /** @class */ (function () { diff --git a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js index 6659f2820396d..6646eb691ddcb 100644 --- a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js +++ b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js @@ -34,10 +34,8 @@ var __extends = (this && this.__extends) || (function () { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -})(); -var A = /** @class */ (function () { - function A() { - } +})();var A = /** @class */ (function () { + function A() {} return A; }()); var B = /** @class */ (function (_super) { @@ -58,6 +56,7 @@ rra = ara; rrb = arb; // OK, Array is assignable to ReadonlyArray rra = arb; rrb = ara; // error: 'A' is not assignable to 'B' + rra = cra; rra = crb; // OK, C is assignable to ReadonlyArray rrb = crb; diff --git a/tests/baselines/reference/arraySigChecking.js b/tests/baselines/reference/arraySigChecking.js index 16189305eaddb..29ab7bea8de43 100644 --- a/tests/baselines/reference/arraySigChecking.js +++ b/tests/baselines/reference/arraySigChecking.js @@ -33,8 +33,11 @@ isEmpty(['a']); //// [arraySigChecking.js] + var myVar; var strArray = [myVar.voidFn()]; + + var myArray; myArray = [[1, 2]]; function isEmpty(l) { diff --git a/tests/baselines/reference/arrayTypeOfFunctionTypes.js b/tests/baselines/reference/arrayTypeOfFunctionTypes.js index 9a7a4516cb585..c7b74c5813425 100644 --- a/tests/baselines/reference/arrayTypeOfFunctionTypes.js +++ b/tests/baselines/reference/arrayTypeOfFunctionTypes.js @@ -18,6 +18,7 @@ var r6b = new r5(); // error //// [arrayTypeOfFunctionTypes.js] // valid uses of arrays of function types + var x; var r = x[1]; var r2 = r(); diff --git a/tests/baselines/reference/arrayTypeOfFunctionTypes2.js b/tests/baselines/reference/arrayTypeOfFunctionTypes2.js index f9baa9871e183..edf611a79ca09 100644 --- a/tests/baselines/reference/arrayTypeOfFunctionTypes2.js +++ b/tests/baselines/reference/arrayTypeOfFunctionTypes2.js @@ -18,6 +18,7 @@ var r6b = r5(); //// [arrayTypeOfFunctionTypes2.js] // valid uses of arrays of function types + var x; var r = x[1]; var r2 = new r(); diff --git a/tests/baselines/reference/arrayTypeOfTypeOf.js b/tests/baselines/reference/arrayTypeOfTypeOf.js index ced62a73a0772..503627dcd5be7 100644 --- a/tests/baselines/reference/arrayTypeOfTypeOf.js +++ b/tests/baselines/reference/arrayTypeOfTypeOf.js @@ -9,10 +9,9 @@ var xs4: typeof Array; //// [arrayTypeOfTypeOf.js] // array type cannot use typeof. + var x = 1; var xs; // Not an error. This is equivalent to Array var xs2; -var xs3; -; -var xs4; -; +var xs3;; +var xs4;; diff --git a/tests/baselines/reference/arrayconcat.js b/tests/baselines/reference/arrayconcat.js index 8730fff8c41ee..82654025141f8 100644 --- a/tests/baselines/reference/arrayconcat.js +++ b/tests/baselines/reference/arrayconcat.js @@ -29,6 +29,7 @@ class parser { } //// [arrayconcat.js] + var parser = /** @class */ (function () { function parser() { } @@ -36,13 +37,12 @@ var parser = /** @class */ (function () { this.options = this.options.sort(function (a, b) { var aName = a.name.toLowerCase(); var bName = b.name.toLowerCase(); + if (aName > bName) { return 1; - } - else if (aName < bName) { + } else if (aName < bName) { return -1; - } - else { + } else { return 0; } }); diff --git a/tests/baselines/reference/arrowFunctionContexts.js b/tests/baselines/reference/arrowFunctionContexts.js index c5dc6e4053672..d0b9d52f747cf 100644 --- a/tests/baselines/reference/arrowFunctionContexts.js +++ b/tests/baselines/reference/arrowFunctionContexts.js @@ -116,10 +116,10 @@ var _this = this; with (window) { var p = function () { return _this; }; } + // Arrow function as argument to super call var Base = /** @class */ (function () { - function Base(n) { - } + function Base(n) {} return Base; }()); var Derived = /** @class */ (function (_super) { @@ -132,15 +132,16 @@ var Derived = /** @class */ (function (_super) { }(Base)); // Arrow function as function argument window.setTimeout(function () { return null; }, 100); + // Arrow function as value in array literal var obj = function (n) { return ''; }; var obj; // OK + var arr = [function (n) { return ''; }]; var arr; // Incorrect error here (bug 829597) // Arrow function as enum value var E; -(function (E) { - var _this = this; +(function (E) {var _this = this; E[E["x"] = function () { return 4; }] = "x"; E[E["y"] = (function () { return _this; }).length] = "y"; // error, can't use this in enum })(E || (E = {})); @@ -152,16 +153,15 @@ var M; })(M || (M = {})); // Repeat above for module members that are functions? (necessary to redo all of them?) var M2; -(function (M2) { - var _this = this; +(function (M2) {var _this = this; // Arrow function used in with statement with (window) { var p = function () { return _this; }; } + // Arrow function as argument to super call var Base = /** @class */ (function () { - function Base(n) { - } + function Base(n) {} return Base; }()); var Derived = /** @class */ (function (_super) { @@ -174,15 +174,16 @@ var M2; }(Base)); // Arrow function as function argument window.setTimeout(function () { return null; }, 100); + // Arrow function as value in array literal var obj = function (n) { return ''; }; var obj; // OK + var arr = [function (n) { return ''; }]; var arr; // Incorrect error here (bug 829597) // Arrow function as enum value var E; - (function (E) { - var _this = this; + (function (E) {var _this = this; E[E["x"] = function () { return 4; }] = "x"; E[E["y"] = (function () { return _this; }).length] = "y"; })(E || (E = {})); @@ -198,8 +199,10 @@ var generic1 = function (n) { return [n]; }; var generic1; // Incorrect error, Bug 829597 var generic2 = function (n) { return [n]; }; var generic2; + // ((ParamList) => { ... } ) is a type assertion to an arrow function var asserted1 = (function (n) { return [n]; }); var asserted1; var asserted2 = (function (n) { return n; }); var asserted2; + diff --git a/tests/baselines/reference/arrowFunctionErrorSpan.js b/tests/baselines/reference/arrowFunctionErrorSpan.js index ca1f966f5178b..c641497b82c60 100644 --- a/tests/baselines/reference/arrowFunctionErrorSpan.js +++ b/tests/baselines/reference/arrowFunctionErrorSpan.js @@ -56,36 +56,49 @@ f(_ => 1 + //// [arrowFunctionErrorSpan.js] function f(a) { } + // oneliner f(function () { }); + // multiline, body f(function () { }); + // multiline 2, body f(function () { }); + // multiline 3, arrow on a new line f(function () { }); + // multiline 4, arguments -f(function (a, b, c, d) { }); +f(function (a, + b, + c, + d) { }); + // single line with a comment f(/* */ function () { }); + // multi line with a comment f(/* */ function () { }); + // multi line with a comment 2 f(/* */ function () { }); + // multi line with a comment 3 -f(// comment 1 +f( // comment 2 function () { // comment 4 } // comment 5 ); + // body is not a block f(function (_) { return 1 + 2; }); diff --git a/tests/baselines/reference/arrowFunctionExpressions.js b/tests/baselines/reference/arrowFunctionExpressions.js index 4872c904f01d4..8dd24f3bf9561 100644 --- a/tests/baselines/reference/arrowFunctionExpressions.js +++ b/tests/baselines/reference/arrowFunctionExpressions.js @@ -103,14 +103,17 @@ function tryCatchFn() { // ArrowFormalParameters => AssignmentExpression is equivalent to ArrowFormalParameters => { return AssignmentExpression; } var a = function (p) { return p.length; }; var a = function (p) { return p.length; }; + // Identifier => Block is equivalent to(Identifier) => Block var b = function (j) { return 0; }; var b = function (j) { return 0; }; + // Identifier => AssignmentExpression is equivalent to(Identifier) => AssignmentExpression var c; var d = function (n) { return c = n; }; var d = function (n) { return c = n; }; var d; + // Binding patterns in arrow functions var p1 = function (_a) { var a = _a[0]; @@ -142,6 +145,7 @@ var p9 = function (_a) { var p10 = function (_a) { var _b = _a[0], value = _b.value, done = _b.done; }; + // Arrow function used in class member initializer // Arrow function used in class member function var MyClass = /** @class */ (function () { @@ -161,16 +165,19 @@ var MyClass = /** @class */ (function () { var arrrr = function () { return function (m) { return function () { return function (n) { return m + n; }; }; }; }; var e = arrrr()(3)()(4); var e; + // Arrow function used in arrow function used in function function someFn() { var arr = function (n) { return function (p) { return p * n; }; }; arr(3)(4).toExponential(); } + // Arrow function used in function function someOtherFn() { var arr = function (n) { return '' + n; }; arr(4).charAt(0); } + // Arrow function used in nested function in function function outerFn() { function innerFn() { @@ -179,6 +186,7 @@ function outerFn() { var p; } } + // Arrow function used in nested function in arrow function var f = function (n) { function fn(x) { @@ -188,6 +196,8 @@ var f = function (n) { }; var g = f('')(); var g; + + // Arrow function used in nested function in arrow function in nested function function someOuterFn() { var arr = function (n) { @@ -205,11 +215,9 @@ function tryCatchFn() { var _this = this; try { var x = function () { return _this; }; - } - catch (e) { + } catch (e) { var t = function () { return e + _this; }; - } - finally { + } finally { var m = function () { return _this + ''; }; } } diff --git a/tests/baselines/reference/arrowFunctionInConstructorArgument1.js b/tests/baselines/reference/arrowFunctionInConstructorArgument1.js index f80b870692958..5ea8a5312db72 100644 --- a/tests/baselines/reference/arrowFunctionInConstructorArgument1.js +++ b/tests/baselines/reference/arrowFunctionInConstructorArgument1.js @@ -7,8 +7,7 @@ var c = new C(() => { return asdf; } ) // should error //// [arrowFunctionInConstructorArgument1.js] var C = /** @class */ (function () { - function C(x) { - } + function C(x) {} return C; }()); var c = new C(function () { return asdf; }); // should error diff --git a/tests/baselines/reference/arrowFunctionWithObjectLiteralBody5.js b/tests/baselines/reference/arrowFunctionWithObjectLiteralBody5.js index c097ccf0d50e7..cfc5ebf165bd1 100644 --- a/tests/baselines/reference/arrowFunctionWithObjectLiteralBody5.js +++ b/tests/baselines/reference/arrowFunctionWithObjectLiteralBody5.js @@ -9,6 +9,9 @@ var d = () => ((({ name: "foo", message: "bar" }))); //// [arrowFunctionWithObjectLiteralBody5.js] var a = function () { return ({ name: "foo", message: "bar" }); }; + var b = function () { return ({ name: "foo", message: "bar" }); }; + var c = function () { return ({ name: "foo", message: "bar" }); }; + var d = function () { return ({ name: "foo", message: "bar" }); }; diff --git a/tests/baselines/reference/arrowFunctionWithObjectLiteralBody6.js b/tests/baselines/reference/arrowFunctionWithObjectLiteralBody6.js index 270a9927835a9..231643dd3f1e0 100644 --- a/tests/baselines/reference/arrowFunctionWithObjectLiteralBody6.js +++ b/tests/baselines/reference/arrowFunctionWithObjectLiteralBody6.js @@ -9,6 +9,7 @@ var d = () => ((({ name: "foo", message: "bar" }))); //// [arrowFunctionWithObjectLiteralBody6.js] var a = () => ({ name: "foo", message: "bar" }); + var b = () => ({ name: "foo", message: "bar" }); var c = () => ({ name: "foo", message: "bar" }); var d = () => ({ name: "foo", message: "bar" }); diff --git a/tests/baselines/reference/arrowFunctionsMissingTokens.js b/tests/baselines/reference/arrowFunctionsMissingTokens.js index d0a8bde2a5365..eb5f59a1616eb 100644 --- a/tests/baselines/reference/arrowFunctionsMissingTokens.js +++ b/tests/baselines/reference/arrowFunctionsMissingTokens.js @@ -69,29 +69,35 @@ module okay { var missingArrowsWithCurly; (function (missingArrowsWithCurly) { var a = function () { }; + var b = function () { }; + var c = function (x) { }; + var d = function (x, y) { }; + var e = function (x, y) { }; })(missingArrowsWithCurly || (missingArrowsWithCurly = {})); var missingCurliesWithArrow; -(function (missingCurliesWithArrow) { - var withStatement; +(function (missingCurliesWithArrow) {var withStatement; (function (withStatement) { var a = function () { var k = 10; }; + var b = function () { var k = 10; }; + var c = function (x) { var k = 10; }; + var d = function (x, y) { var k = 10; }; + var e = function (x, y) { var k = 10; }; + var f = function () { var k = 10; }; })(withStatement || (withStatement = {})); var withoutStatement; (function (withoutStatement) { - var a = function () { return ; }; - })(withoutStatement || (withoutStatement = {})); + var a = function () { return ; };})(withoutStatement || (withoutStatement = {})); ; - var b = function () { return ; }; -})(missingCurliesWithArrow || (missingCurliesWithArrow = {})); + var b = function () { return ; };})(missingCurliesWithArrow || (missingCurliesWithArrow = {})); var c = function (x) { return ; }; ; var d = function (x, y) { return ; }; @@ -105,13 +111,18 @@ var ce_nEst_pas_une_arrow_function; var b = function () { return ; }; var c = (x); var d = function (x, y) { return ; }; + var e = function (x, y) { return ; }; })(ce_nEst_pas_une_arrow_function || (ce_nEst_pas_une_arrow_function = {})); var okay; (function (okay) { var a = function () { }; + var b = function () { }; + var c = function (x) { }; + var d = function (x, y) { }; + var e = function (x, y) { }; })(okay || (okay = {})); diff --git a/tests/baselines/reference/asOpEmitParens.js b/tests/baselines/reference/asOpEmitParens.js index dee8d263eaef2..3b33a0a45689d 100644 --- a/tests/baselines/reference/asOpEmitParens.js +++ b/tests/baselines/reference/asOpEmitParens.js @@ -13,7 +13,9 @@ new (x() as any); //// [asOpEmitParens.js] // Must emit as (x + 1) * 3 (x + 1) * 3; + // Should still emit as x.y x.y; + // Emit as new (x()) new (x()); diff --git a/tests/baselines/reference/asOperator1.js b/tests/baselines/reference/asOperator1.js index 1b23d0a86f7c9..04a4645808c87 100644 --- a/tests/baselines/reference/asOperator1.js +++ b/tests/baselines/reference/asOperator1.js @@ -14,6 +14,7 @@ var as = 43; var x = undefined; var y = null.length; var z = Date; + // Should parse as a union type, not a bitwise 'or' of (32 as number) and 'string' var j = 32; j = ''; diff --git a/tests/baselines/reference/asOperator3.js b/tests/baselines/reference/asOperator3.js index 7cbb277bb0339..4f3d20a7f1efc 100644 --- a/tests/baselines/reference/asOperator3.js +++ b/tests/baselines/reference/asOperator3.js @@ -15,6 +15,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; + var a = "" + (123 + 456); var b = "leading " + (123 + 456); var c = 123 + 456 + " trailing"; diff --git a/tests/baselines/reference/asOperator4.js b/tests/baselines/reference/asOperator4.js index 15f15d0f02717..3301809bafb35 100644 --- a/tests/baselines/reference/asOperator4.js +++ b/tests/baselines/reference/asOperator4.js @@ -21,6 +21,7 @@ exports.foo = foo; "use strict"; exports.__esModule = true; var foo_1 = require("./foo"); + // These should emit identically foo_1.foo; foo_1.foo; diff --git a/tests/baselines/reference/asOperatorASI.js b/tests/baselines/reference/asOperatorASI.js index 4a78b022c4fe7..5dc6eab1d5451 100644 --- a/tests/baselines/reference/asOperatorASI.js +++ b/tests/baselines/reference/asOperatorASI.js @@ -15,10 +15,8 @@ as(Foo); // should emit var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; -}; -var Foo = /** @class */ (function () { - function Foo() { - } +};var Foo = /** @class */ (function () { + function Foo() {} return Foo; }()); // Example 1 diff --git a/tests/baselines/reference/asOperatorAmbiguity.js b/tests/baselines/reference/asOperatorAmbiguity.js index 6c336970b65fe..7b87cc27a539b 100644 --- a/tests/baselines/reference/asOperatorAmbiguity.js +++ b/tests/baselines/reference/asOperatorAmbiguity.js @@ -10,6 +10,7 @@ var z = y[0].m; // z should be string //// [asOperatorAmbiguity.js] + // Make sure this is a type assertion to an array type, and not nested comparison operators. var x; var y = x; diff --git a/tests/baselines/reference/asiArith.js b/tests/baselines/reference/asiArith.js index d552fd5ee77c4..cbfd04b7662ce 100644 --- a/tests/baselines/reference/asiArith.js +++ b/tests/baselines/reference/asiArith.js @@ -36,12 +36,22 @@ y //// [asiArith.js] var x = 1; + var y = 1; + var z = x + + + + +y; + + var a = 1; + var b = 1; + var c = x + - + - -y; diff --git a/tests/baselines/reference/asiInES6Classes.js b/tests/baselines/reference/asiInES6Classes.js index 375f0e4bc65da..cc453d4f273f1 100644 --- a/tests/baselines/reference/asiInES6Classes.js +++ b/tests/baselines/reference/asiInES6Classes.js @@ -30,7 +30,9 @@ var Foo = /** @class */ (function () { }; } Foo.prototype.bar = function () { + return 3; + }; return Foo; }()); diff --git a/tests/baselines/reference/asiPreventsParsingAsNamespace05.js b/tests/baselines/reference/asiPreventsParsingAsNamespace05.js index d7cab5ae28336..a31228d67f912 100644 --- a/tests/baselines/reference/asiPreventsParsingAsNamespace05.js +++ b/tests/baselines/reference/asiPreventsParsingAsNamespace05.js @@ -12,8 +12,7 @@ a.b.c //// [asiPreventsParsingAsNamespace05.js] var namespace = 10; var a; -(function (a) { - var b; +(function (a) {var b; (function (b) { b.c = 20; })(b = a.b || (a.b = {})); diff --git a/tests/baselines/reference/asiPreventsParsingAsTypeAlias01.js b/tests/baselines/reference/asiPreventsParsingAsTypeAlias01.js index 7a7ec322eead8..4bd48526b1e7c 100644 --- a/tests/baselines/reference/asiPreventsParsingAsTypeAlias01.js +++ b/tests/baselines/reference/asiPreventsParsingAsTypeAlias01.js @@ -10,5 +10,6 @@ Foo = string; var type; var string; var Foo; + type; Foo = string; diff --git a/tests/baselines/reference/assertionFunctionsCanNarrowByDiscriminant.js b/tests/baselines/reference/assertionFunctionsCanNarrowByDiscriminant.js index 8857b7dd16013..4da921d73ab13 100644 --- a/tests/baselines/reference/assertionFunctionsCanNarrowByDiscriminant.js +++ b/tests/baselines/reference/assertionFunctionsCanNarrowByDiscriminant.js @@ -26,6 +26,11 @@ animalOrUndef.canMeow; // since is cat, should not be an error //// [assertionFunctionsCanNarrowByDiscriminant.js] "use strict"; + + + + + var animal = { type: 'cat', canMeow: true }; assertEqual(animal.type, 'cat'); animal.canMeow; // since is cat, should not be an error diff --git a/tests/baselines/reference/assertionTypePredicates1.js b/tests/baselines/reference/assertionTypePredicates1.js index 94342d03fa00a..e6ded643a40fb 100644 --- a/tests/baselines/reference/assertionTypePredicates1.js +++ b/tests/baselines/reference/assertionTypePredicates1.js @@ -213,7 +213,10 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + var assert = function (value) { }; + + function f01(x) { if (!!true) { assert(typeof x === "string"); @@ -254,6 +257,7 @@ function f01(x) { x; // Unreachable } } + function f02(x) { if (!!true) { assert(x); @@ -268,6 +272,7 @@ function f02(x) { x.length; } } + function f03(x, assert) { assert(x); x.length; @@ -293,6 +298,7 @@ function f10(x) { x; // Unreachable } } + var Test = /** @class */ (function () { function Test() { } @@ -367,6 +373,9 @@ function f11(items) { item.z; } } + + + function f20(x) { var assert = function (value) { }; assert(typeof x === "string"); // Error @@ -377,6 +386,9 @@ function f20(x) { var t2 = new Test(); t2.assert(typeof x === "string"); } + + + function example1(things) { for (var _i = 0, things_1 = things; _i < things_1.length; _i++) { var thing = things_1[_i]; diff --git a/tests/baselines/reference/assign1.js b/tests/baselines/reference/assign1.js index fa18c8f287bb7..8a2f2e87fef31 100644 --- a/tests/baselines/reference/assign1.js +++ b/tests/baselines/reference/assign1.js @@ -12,5 +12,6 @@ module M { //// [assign1.js] var M; (function (M) { + var x = { salt: 2, pepper: 0 }; })(M || (M = {})); diff --git a/tests/baselines/reference/assignAnyToEveryType.js b/tests/baselines/reference/assignAnyToEveryType.js index 351c041523fc9..47f57939aa3c1 100644 --- a/tests/baselines/reference/assignAnyToEveryType.js +++ b/tests/baselines/reference/assignAnyToEveryType.js @@ -47,7 +47,9 @@ function k(a: T) { //// [assignAnyToEveryType.js] // all of these are valid + var x; + var a = x; var b = x; var c = x; @@ -69,7 +71,10 @@ var C = /** @class */ (function () { return C; }()); var h = x; + + var i = x; + var j = x; var j2 = x; var M; diff --git a/tests/baselines/reference/assignEveryTypeToAny.js b/tests/baselines/reference/assignEveryTypeToAny.js index 07bfbaddebc11..9ed8269bf0f19 100644 --- a/tests/baselines/reference/assignEveryTypeToAny.js +++ b/tests/baselines/reference/assignEveryTypeToAny.js @@ -57,18 +57,22 @@ function j(a: T) { //// [assignEveryTypeToAny.js] // all of these are valid + var x; x = 1; var a = 2; x = a; + x = true; var b = true; x = b; + x = ""; var c = ""; x = c; var d; x = d; + var e = undefined; x = e; var e2; @@ -80,6 +84,7 @@ var E; x = E.A; var f = E.A; x = f; + var g; x = g; var C = /** @class */ (function () { @@ -93,6 +98,7 @@ var i; x = i; x = { f: function () { return 1; } }; x = { f: function (x) { return x; } }; + function j(a) { x = a; } diff --git a/tests/baselines/reference/assignFromBooleanInterface2.js b/tests/baselines/reference/assignFromBooleanInterface2.js index be376b293c0f5..d233de5ec4002 100644 --- a/tests/baselines/reference/assignFromBooleanInterface2.js +++ b/tests/baselines/reference/assignFromBooleanInterface2.js @@ -23,12 +23,15 @@ x = b; // expected error //// [assignFromBooleanInterface2.js] + var x = true; var a; var b; a = x; a = b; + b = a; b = x; + x = a; // expected error x = b; // expected error diff --git a/tests/baselines/reference/assignFromNumberInterface2.js b/tests/baselines/reference/assignFromNumberInterface2.js index 25262bf27f074..ff48449ce6521 100644 --- a/tests/baselines/reference/assignFromNumberInterface2.js +++ b/tests/baselines/reference/assignFromNumberInterface2.js @@ -28,12 +28,15 @@ x = b; // expected error //// [assignFromNumberInterface2.js] + var x = 1; var a; var b; a = x; a = b; + b = a; b = x; + x = a; // expected error x = b; // expected error diff --git a/tests/baselines/reference/assignFromStringInterface2.js b/tests/baselines/reference/assignFromStringInterface2.js index 5636a4806cc9e..6dfe3b7709390 100644 --- a/tests/baselines/reference/assignFromStringInterface2.js +++ b/tests/baselines/reference/assignFromStringInterface2.js @@ -51,12 +51,15 @@ x = b; // expected error //// [assignFromStringInterface2.js] + var x = ''; var a; var b; a = x; a = b; + b = a; b = x; + x = a; // expected error x = b; // expected error diff --git a/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.js b/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.js index fe6142cafe088..5099569c1b8cd 100644 --- a/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.js +++ b/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.js @@ -10,6 +10,8 @@ fn(function (a, b) { return true; }) //// [assignLambdaToNominalSubtypeOfFunction.js] + function fn(cb) { } + fn(function (a, b) { return true; }); fn(function (a, b) { return true; }); diff --git a/tests/baselines/reference/assignToFn.js b/tests/baselines/reference/assignToFn.js index 2ff8ceedfa67c..f3f9f7014d14c 100644 --- a/tests/baselines/reference/assignToFn.js +++ b/tests/baselines/reference/assignToFn.js @@ -13,6 +13,7 @@ module M { //// [assignToFn.js] var M; (function (M) { + var x = { f: function (n) { return true; } }; x.f = "hello"; })(M || (M = {})); diff --git a/tests/baselines/reference/assignToObjectTypeWithPrototypeProperty.js b/tests/baselines/reference/assignToObjectTypeWithPrototypeProperty.js index ac2b7368361f8..84be67d5158b2 100644 --- a/tests/baselines/reference/assignToObjectTypeWithPrototypeProperty.js +++ b/tests/baselines/reference/assignToObjectTypeWithPrototypeProperty.js @@ -5,8 +5,7 @@ var x: {prototype: XEvent} = XEvent; //// [assignToObjectTypeWithPrototypeProperty.js] var XEvent = /** @class */ (function () { - function XEvent() { - } + function XEvent() {} return XEvent; }()); var p = XEvent.prototype; diff --git a/tests/baselines/reference/assigningFromObjectToAnythingElse.js b/tests/baselines/reference/assigningFromObjectToAnythingElse.js index 61c4a6ede22f8..f3639b14cd5d9 100644 --- a/tests/baselines/reference/assigningFromObjectToAnythingElse.js +++ b/tests/baselines/reference/assigningFromObjectToAnythingElse.js @@ -15,4 +15,5 @@ var y; y = x; var a = Object.create(""); var c = Object.create(1); + var w = new Object(); diff --git a/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.js b/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.js index fd3ac1d46f144..0e7a5aba97c69 100644 --- a/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.js +++ b/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.js @@ -24,6 +24,7 @@ var numStrTuple; var numNumTuple; var numEmptyObjTuple; var emptyObjTuple; + var numArray; var emptyObjArray; // no error @@ -32,6 +33,7 @@ emptyObjArray = emptyObjTuple; emptyObjArray = numStrTuple; emptyObjArray = numNumTuple; emptyObjArray = numEmptyObjTuple; + // error numArray = numStrTuple; emptyObjTuple = emptyObjArray; diff --git a/tests/baselines/reference/assignmentCompatBug2.js b/tests/baselines/reference/assignmentCompatBug2.js index 5545cc7d19c65..ed7be8244b2f0 100644 --- a/tests/baselines/reference/assignmentCompatBug2.js +++ b/tests/baselines/reference/assignmentCompatBug2.js @@ -41,21 +41,26 @@ b3 = { //// [assignmentCompatBug2.js] var b2 = { a: 0 }; // error b2 = { a: 0 }; // error + b2 = { b: 0, a: 0 }; var b3; + b3 = { f: function (n) { return 0; }, g: function (s) { return 0; }, m: 0 }; // ok + b3 = { f: function (n) { return 0; }, g: function (s) { return 0; } }; // error + b3 = { f: function (n) { return 0; }, m: 0 }; // error + b3 = { f: function (n) { return 0; }, g: function (s) { return 0; }, @@ -63,6 +68,7 @@ b3 = { n: 0, k: function (a) { return null; } }; // ok + b3 = { f: function (n) { return 0; }, g: function (s) { return 0; }, diff --git a/tests/baselines/reference/assignmentCompatBug3.js b/tests/baselines/reference/assignmentCompatBug3.js index ac79938f9364a..b5eb958324044 100644 --- a/tests/baselines/reference/assignmentCompatBug3.js +++ b/tests/baselines/reference/assignmentCompatBug3.js @@ -30,6 +30,8 @@ function makePoint(x, y) { return { get x() { return x; }, get y() { return y; }, + + //x: "yo", //y: "boo", dist: function () { @@ -37,6 +39,7 @@ function makePoint(x, y) { } }; } + var C = /** @class */ (function () { function C() { } @@ -50,6 +53,7 @@ var C = /** @class */ (function () { return C; }()); function foo(test) { } + var x; var y; foo(x); diff --git a/tests/baselines/reference/assignmentCompatBug5.js b/tests/baselines/reference/assignmentCompatBug5.js index ae444c3dad6eb..533fe6197c9b7 100644 --- a/tests/baselines/reference/assignmentCompatBug5.js +++ b/tests/baselines/reference/assignmentCompatBug5.js @@ -20,3 +20,4 @@ function foo3(x) { } ; foo3(function (s) { }); foo3(function (n) { return; }); + diff --git a/tests/baselines/reference/assignmentCompatForEnums.js b/tests/baselines/reference/assignmentCompatForEnums.js index 8db85399fa830..3b79fe03527af 100644 --- a/tests/baselines/reference/assignmentCompatForEnums.js +++ b/tests/baselines/reference/assignmentCompatForEnums.js @@ -21,9 +21,12 @@ var TokenType; TokenType[TokenType["Two"] = 1] = "Two"; })(TokenType || (TokenType = {})); ; + var list = {}; function returnType() { return null; } + function foo() { var x = returnType(); var x = list['one']; } + diff --git a/tests/baselines/reference/assignmentCompatInterfaceWithStringIndexSignature.js b/tests/baselines/reference/assignmentCompatInterfaceWithStringIndexSignature.js index 13448bc57a460..a33150f208285 100644 --- a/tests/baselines/reference/assignmentCompatInterfaceWithStringIndexSignature.js +++ b/tests/baselines/reference/assignmentCompatInterfaceWithStringIndexSignature.js @@ -17,6 +17,8 @@ Biz(new Foo()); //// [assignmentCompatInterfaceWithStringIndexSignature.js] + + var Foo = /** @class */ (function () { function Foo() { } diff --git a/tests/baselines/reference/assignmentCompatOnNew.js b/tests/baselines/reference/assignmentCompatOnNew.js index 14d9fb5071ee2..79057252f7c0d 100644 --- a/tests/baselines/reference/assignmentCompatOnNew.js +++ b/tests/baselines/reference/assignmentCompatOnNew.js @@ -8,8 +8,7 @@ bar(Foo); // Error, but should be allowed //// [assignmentCompatOnNew.js] var Foo = /** @class */ (function () { - function Foo() { - } + function Foo() {} return Foo; }()); ; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures.js b/tests/baselines/reference/assignmentCompatWithCallSignatures.js index 12fc6159fac13..d21def67a7bb1 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures.js @@ -45,6 +45,7 @@ a = function (x: string) { return ''; } //// [assignmentCompatWithCallSignatures.js] // void returning call signatures can be assigned a non-void returning call signature that otherwise matches + var t; var a; t = a; @@ -61,6 +62,7 @@ t = function (x) { return ''; }; a = function (x) { return 1; }; a = function () { return 1; }; a = function (x) { return ''; }; + var s2; var a3; // these are errors diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures2.js b/tests/baselines/reference/assignmentCompatWithCallSignatures2.js index 6bfc1b6c0d64d..217a1f1fe7f30 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures2.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures2.js @@ -52,6 +52,7 @@ a = function (x: string) { return ''; } //// [assignmentCompatWithCallSignatures2.js] // void returning call signatures can be assigned a non-void returning call signature that otherwise matches + var t; var a; t = a; @@ -69,11 +70,13 @@ t = { f: function (x) { return ''; } }; a = { f: function () { return 1; } }; a = { f: function (x) { return 1; } }; a = { f: function (x) { return ''; } }; + // errors t = function () { return 1; }; t = function (x) { return ''; }; a = function () { return 1; }; a = function (x) { return ''; }; + var s2; var a3; // these are errors diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures3.js b/tests/baselines/reference/assignmentCompatWithCallSignatures3.js index 0d6d31486414f..428374da00a28 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures3.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures3.js @@ -116,9 +116,9 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + var Base = /** @class */ (function () { - function Base() { - } + function Base() {} return Base; }()); var Derived = /** @class */ (function (_super) { @@ -160,6 +160,7 @@ var a15; var a16; var a17; var a18; + var b; a = b; // ok b = a; // ok diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures4.js b/tests/baselines/reference/assignmentCompatWithCallSignatures4.js index 5b61596e2a577..84cb8fe0972bb 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures4.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures4.js @@ -118,8 +118,7 @@ var __extends = (this && this.__extends) || (function () { var Errors; (function (Errors) { var Base = /** @class */ (function () { - function Base() { - } + function Base() {} return Base; }()); var Derived = /** @class */ (function (_super) { @@ -156,6 +155,7 @@ var Errors; var a15; var a16; var a17; + var b2; a2 = b2; b2 = a2; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures5.js b/tests/baselines/reference/assignmentCompatWithCallSignatures5.js index abef6b1be0c32..54a958cd34fb2 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures5.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures5.js @@ -82,9 +82,9 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + var Base = /** @class */ (function () { - function Base() { - } + function Base() {} return Base; }()); var Derived = /** @class */ (function (_super) { @@ -119,6 +119,7 @@ var a15; var a16; var a17; var a18; + var b; a = b; // ok b = a; // ok diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures6.js b/tests/baselines/reference/assignmentCompatWithCallSignatures6.js index 4ba96ed8cbd32..46d6bf80bba8e 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures6.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures6.js @@ -59,9 +59,9 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + var Base = /** @class */ (function () { - function Base() { - } + function Base() {} return Base; }()); var Derived = /** @class */ (function (_super) { @@ -85,7 +85,9 @@ var OtherDerived = /** @class */ (function (_super) { } return OtherDerived; }(Base)); + var x; + var b; x.a = b; b = x.a; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignaturesWithOptionalParameters.js b/tests/baselines/reference/assignmentCompatWithCallSignaturesWithOptionalParameters.js index e12a741cd0f13..b12e92b038029 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignaturesWithOptionalParameters.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignaturesWithOptionalParameters.js @@ -71,7 +71,9 @@ var a5: (x?: number, y?: number) => number; //// [assignmentCompatWithCallSignaturesWithOptionalParameters.js] // call signatures in derived types must have the same or fewer optional parameters as the base type + var b; + var a; a = function () { return 1; }; // ok, same number of required params a = function (x) { return 1; }; // ok, same number of required params diff --git a/tests/baselines/reference/assignmentCompatWithCallSignaturesWithRestParameters.js b/tests/baselines/reference/assignmentCompatWithCallSignaturesWithRestParameters.js index ec86f218ac0f9..08c9ff4f0336b 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignaturesWithRestParameters.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignaturesWithRestParameters.js @@ -47,77 +47,69 @@ var a4: (x?: number, y?: string, ...z: number[]) => number; //// [assignmentCompatWithCallSignaturesWithRestParameters.js] // call signatures in derived types must have the same or fewer optional parameters as the target for assignment + + var a; // ok, same number of required params a = function () { return 1; }; // ok, same number of required params -a = function () { - var args = []; +a = function () {var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } - return 1; -}; // ok, same number of required params -a = function () { - var args = []; + return 1;}; // ok, same number of required params +a = function () {var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } - return 1; -}; // error, type mismatch + return 1;}; // error, type mismatch a = function (x) { return 1; }; // ok, same number of required params a = function (x, y, z) { return 1; }; // ok, same number of required params a = function (x) { return 1; }; // ok, rest param corresponds to infinite number of params a = function (x) { return 1; }; // error, incompatible type + + var a2; a2 = function () { return 1; }; // ok, fewer required params -a2 = function () { - var args = []; +a2 = function () {var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } - return 1; -}; // ok, fewer required params + return 1;}; // ok, fewer required params a2 = function (x) { return 1; }; // ok, fewer required params a2 = function (x) { return 1; }; // ok, same number of required params -a2 = function (x) { - var args = []; +a2 = function (x) {var args = []; for (var _i = 1; _i < arguments.length; _i++) { args[_i - 1] = arguments[_i]; } - return 1; -}; // ok, same number of required params -a2 = function (x) { - var args = []; + return 1;}; // ok, same number of required params +a2 = function (x) {var args = []; for (var _i = 1; _i < arguments.length; _i++) { args[_i - 1] = arguments[_i]; } - return 1; -}; // should be type mismatch error + return 1;}; // should be type mismatch error a2 = function (x, y) { return 1; }; // ok, rest param corresponds to infinite number of params a2 = function (x, y) { return 1; }; // ok, same number of required params + var a3; a3 = function () { return 1; }; // ok, fewer required params a3 = function (x) { return 1; }; // ok, fewer required params a3 = function (x) { return 1; }; // ok, same number of required params a3 = function (x, y) { return 1; }; // ok, all present params match a3 = function (x, y, z) { return 1; }; // error -a3 = function (x) { - var z = []; +a3 = function (x) {var z = []; for (var _i = 1; _i < arguments.length; _i++) { z[_i - 1] = arguments[_i]; } - return 1; -}; // error + return 1;}; // error a3 = function (x, y, z) { return 1; }; // error + var a4; a4 = function () { return 1; }; // ok, fewer required params a4 = function (x, y) { return 1; }; // error, type mismatch a4 = function (x) { return 1; }; // ok, all present params match a4 = function (x, y) { return 1; }; // error, second param has type mismatch a4 = function (x, y) { return 1; }; // ok, same number of required params with matching types -a4 = function (x) { - var args = []; +a4 = function (x) {var args = []; for (var _i = 1; _i < arguments.length; _i++) { args[_i - 1] = arguments[_i]; } - return 1; -}; // error, rest params have type mismatch + return 1;}; // error, rest params have type mismatch diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures.js index c00aa121712ef..c63217184c9b5 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures.js @@ -38,6 +38,7 @@ a = function (x: string) { return ''; } //// [assignmentCompatWithConstructSignatures.js] // void returning call signatures can be assigned a non-void returning call signature that otherwise matches + var t; var a; t = a; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures2.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures2.js index d00762aa1c5b7..af5b1e599cfc7 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures2.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures2.js @@ -44,6 +44,7 @@ a = function (x: string) { return ''; } //// [assignmentCompatWithConstructSignatures2.js] // void returning call signatures can be assigned a non-void returning call signature that otherwise matches + var t; var a; t = a; @@ -59,6 +60,7 @@ t = function () { return 1; }; t = function (x) { return ''; }; a = function () { return 1; }; a = function (x) { return ''; }; + var s2; var a3; // these are errors diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js index 1814f6defc345..f432b9835b57f 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js @@ -116,9 +116,9 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + var Base = /** @class */ (function () { - function Base() { - } + function Base() {} return Base; }()); var Derived = /** @class */ (function (_super) { @@ -160,6 +160,7 @@ var a15; var a16; var a17; var a18; + var b; a = b; // ok b = a; // ok diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js index 82f9ebff3d2fd..7bcf58d632935 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js @@ -118,8 +118,7 @@ var __extends = (this && this.__extends) || (function () { var Errors; (function (Errors) { var Base = /** @class */ (function () { - function Base() { - } + function Base() {} return Base; }()); var Derived = /** @class */ (function (_super) { @@ -156,6 +155,7 @@ var Errors; var a15; var a16; var a17; + var b2; a2 = b2; // ok b2 = a2; // ok diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js index 79cfd8d5ef50a..be4ae2d14f19c 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js @@ -82,9 +82,9 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + var Base = /** @class */ (function () { - function Base() { - } + function Base() {} return Base; }()); var Derived = /** @class */ (function (_super) { @@ -119,6 +119,7 @@ var a15; var a16; var a17; var a18; + var b; a = b; // ok b = a; // ok diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js index dcfb70a5ba52e..2bf3f1ceae1cd 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js @@ -59,9 +59,9 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + var Base = /** @class */ (function () { - function Base() { - } + function Base() {} return Base; }()); var Derived = /** @class */ (function (_super) { @@ -85,7 +85,9 @@ var OtherDerived = /** @class */ (function (_super) { } return OtherDerived; }(Base)); + var x; + var b; x.a = b; b = x.a; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignaturesWithOptionalParameters.js b/tests/baselines/reference/assignmentCompatWithConstructSignaturesWithOptionalParameters.js index e41011021d216..e780d5d8fd368 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignaturesWithOptionalParameters.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignaturesWithOptionalParameters.js @@ -54,7 +54,9 @@ var a5: new (x?: number, y?: number) => number; //// [assignmentCompatWithConstructSignaturesWithOptionalParameters.js] // call signatures in derived types must have the same or fewer optional parameters as the base type + var b; + var a; a = b.a; // ok a = b.a2; // ok diff --git a/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.js b/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.js index d05e3036937d7..a62be7ba70fd2 100644 --- a/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.js +++ b/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.js @@ -207,6 +207,7 @@ namespace GH39357 { // IteratorResult var Example1; (function (Example1) { + // S is assignable to T0 when S["done"] is true // S is assignable to T1 when S["done"] is false t = s; @@ -243,6 +244,7 @@ var Example5; // https://github.com/Microsoft/TypeScript/issues/14865 var GH14865; (function (GH14865) { + var a = { type: "A", data: "whatevs" }; var b; a.type; // "A" | "B" @@ -253,6 +255,7 @@ var GH14865; var GH30170; (function (GH30170) { function draw(val) { } + function drawWithColor(currentColor) { return draw({ color: currentColor }); } @@ -260,14 +263,19 @@ var GH30170; // https://github.com/Microsoft/TypeScript/issues/12052 var GH12052; (function (GH12052) { + + + + + function getAxisType() { if (1 == 1) { return "categorical"; - } - else { + } else { return "linear"; } } + var bad = { type: getAxisType() }; var good = { type: undefined }; good.type = getAxisType(); @@ -275,6 +283,12 @@ var GH12052; // https://github.com/Microsoft/TypeScript/issues/18421 var GH18421; (function (GH18421) { + + + + + + function makeNewThing(thingType) { return { type: thingType @@ -284,14 +298,18 @@ var GH18421; // https://github.com/Microsoft/TypeScript/issues/15907 var GH15907; (function (GH15907) { + function dispatchAction(action) { } + var active = true; dispatchAction({ type: (active ? 'disactivate' : 'activate') }); })(GH15907 || (GH15907 = {})); // https://github.com/Microsoft/TypeScript/issues/20889 var GH20889; (function (GH20889) { + + function foo(obj1) { var obj2 = { type: obj1.type diff --git a/tests/baselines/reference/assignmentCompatWithGenericCallSignatures.js b/tests/baselines/reference/assignmentCompatWithGenericCallSignatures.js index ba4093f523df8..89ed3ad86b087 100644 --- a/tests/baselines/reference/assignmentCompatWithGenericCallSignatures.js +++ b/tests/baselines/reference/assignmentCompatWithGenericCallSignatures.js @@ -9,6 +9,7 @@ g = f; // ok //// [assignmentCompatWithGenericCallSignatures.js] // some complex cases of assignment compat of generic signatures that stress contextual signature instantiation + var f; var g; f = g; // ok diff --git a/tests/baselines/reference/assignmentCompatWithGenericCallSignatures2.js b/tests/baselines/reference/assignmentCompatWithGenericCallSignatures2.js index 057cbebb3828c..1a3441438ed77 100644 --- a/tests/baselines/reference/assignmentCompatWithGenericCallSignatures2.js +++ b/tests/baselines/reference/assignmentCompatWithGenericCallSignatures2.js @@ -19,6 +19,9 @@ b = a; //// [assignmentCompatWithGenericCallSignatures2.js] // some complex cases of assignment compat of generic signatures. No contextual signature instantiation + + + var a; var b; // Both errors diff --git a/tests/baselines/reference/assignmentCompatWithGenericCallSignatures3.js b/tests/baselines/reference/assignmentCompatWithGenericCallSignatures3.js index ae83c39f2a02a..2c06926d28531 100644 --- a/tests/baselines/reference/assignmentCompatWithGenericCallSignatures3.js +++ b/tests/baselines/reference/assignmentCompatWithGenericCallSignatures3.js @@ -12,6 +12,8 @@ g = h // ok //// [assignmentCompatWithGenericCallSignatures3.js] // some complex cases of assignment compat of generic signatures that stress contextual signature instantiation + + var g; var h; g = h; // ok diff --git a/tests/baselines/reference/assignmentCompatWithGenericCallSignatures4.js b/tests/baselines/reference/assignmentCompatWithGenericCallSignatures4.js index 6114e6fdb5419..8d37126fd508f 100644 --- a/tests/baselines/reference/assignmentCompatWithGenericCallSignatures4.js +++ b/tests/baselines/reference/assignmentCompatWithGenericCallSignatures4.js @@ -15,6 +15,8 @@ y = x //// [assignmentCompatWithGenericCallSignatures4.js] // some complex cases of assignment compat of generic signatures. + + var x; var y; // These both do not make sense as we would eventually be comparing I2 to I2>, and they are self referencing anyway diff --git a/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.js b/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.js index 78e657f5cb003..1e46d7d083d09 100644 --- a/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.js +++ b/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.js @@ -141,17 +141,22 @@ var ClassTypeParam; _this.a = function () { return null; }; // ok, same T of required params _this.a = function (x) { return null; }; // ok, same T of required params _this.a = function (x) { return null; }; // error, too many required params + _this.a2 = function () { return null; }; // ok, same T of required params _this.a2 = function (x) { return null; }; // ok, same T of required params _this.a2 = function (x) { return null; }; // ok, same number of params + _this.a3 = function () { return null; }; // ok, fewer required params _this.a3 = function (x) { return null; }; // ok, fewer required params _this.a3 = function (x) { return null; }; // ok, same T of required params _this.a3 = function (x, y) { return null; }; // error, too many required params + _this.a4 = function () { return null; }; // ok, fewer required params _this.a4 = function (x, y) { return null; }; // ok, fewer required params _this.a4 = function (x) { return null; }; // ok, same T of required params _this.a4 = function (x, y) { return null; }; // ok, same number of params + + _this.a5 = function () { return null; }; // ok, fewer required params _this.a5 = function (x, y) { return null; }; // ok, fewer required params _this.a5 = function (x) { return null; }; // ok, all present params match @@ -163,6 +168,7 @@ var ClassTypeParam; })(ClassTypeParam || (ClassTypeParam = {})); var GenericSignaturesInvalid; (function (GenericSignaturesInvalid) { + var Base2 = /** @class */ (function () { function Base2() { } @@ -182,21 +188,25 @@ var GenericSignaturesInvalid; b.a = t.a3; b.a = t.a4; b.a = t.a5; + b.a2 = t.a; b.a2 = t.a2; b.a2 = t.a3; b.a2 = t.a4; b.a2 = t.a5; + b.a3 = t.a; b.a3 = t.a2; b.a3 = t.a3; b.a3 = t.a4; b.a3 = t.a5; + b.a4 = t.a; b.a4 = t.a2; b.a4 = t.a3; b.a4 = t.a4; b.a4 = t.a5; + b.a5 = t.a; b.a5 = t.a2; b.a5 = t.a3; @@ -206,6 +216,7 @@ var GenericSignaturesInvalid; })(GenericSignaturesInvalid || (GenericSignaturesInvalid = {})); var GenericSignaturesValid; (function (GenericSignaturesValid) { + var Base2 = /** @class */ (function () { function Base2() { var _this = this; @@ -213,17 +224,22 @@ var GenericSignaturesValid; _this.a = function () { return null; }; // ok, same T of required params _this.a = function (x) { return null; }; // ok, same T of required params _this.a = function (x) { return null; }; // error, too many required params + _this.a2 = function () { return null; }; // ok, same T of required params _this.a2 = function (x) { return null; }; // ok, same T of required params _this.a2 = function (x) { return null; }; // ok, same number of params + _this.a3 = function () { return null; }; // ok, fewer required params _this.a3 = function (x) { return null; }; // ok, fewer required params _this.a3 = function (x) { return null; }; // ok, same T of required params _this.a3 = function (x, y) { return null; }; // error, too many required params + _this.a4 = function () { return null; }; // ok, fewer required params _this.a4 = function (x, y) { return null; }; // ok, fewer required params _this.a4 = function (x) { return null; }; // ok, same T of required params _this.a4 = function (x, y) { return null; }; // ok, same number of params + + _this.a5 = function () { return null; }; // ok, fewer required params _this.a5 = function (x, y) { return null; }; // ok, fewer required params _this.a5 = function (x) { return null; }; // ok, all present params match diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer.js b/tests/baselines/reference/assignmentCompatWithNumericIndexer.js index 0cb37a80555de..8f576a86ba1a5 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer.js +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer.js @@ -60,6 +60,8 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + + var A = /** @class */ (function () { function A() { } diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer2.js b/tests/baselines/reference/assignmentCompatWithNumericIndexer2.js index 8af454eaf8d2e..298f437849c63 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer2.js +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer2.js @@ -45,6 +45,9 @@ module Generics { //// [assignmentCompatWithNumericIndexer2.js] // Derived type indexer must be subtype of base type indexer + + + var a; var b; a = b; @@ -54,6 +57,8 @@ a = b2; b2 = a; // error var Generics; (function (Generics) { + + function foo() { var a; var b; diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js index 74f35977d68e6..b2d169a9ad5f6 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js @@ -57,6 +57,8 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + + var A = /** @class */ (function () { function A() { } diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers.js b/tests/baselines/reference/assignmentCompatWithObjectMembers.js index 2589f464c5315..7ccf57d7122be 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers.js @@ -91,37 +91,41 @@ module ObjectTypes { var SimpleTypes; (function (SimpleTypes) { var S = /** @class */ (function () { - function S() { - } + function S() {} return S; }()); var T = /** @class */ (function () { - function T() { - } + function T() {} return T; }()); var s; var t; + var s2; var t2; + var a; var b; var a2 = { foo: '' }; var b2 = { foo: '' }; + s = t; t = s; s = s2; s = a2; + s2 = t2; t2 = s2; s2 = t; s2 = b; s2 = a2; + a = b; b = a; a = s; a = s2; a = a2; + a2 = b2; b2 = a2; a2 = b; @@ -131,37 +135,41 @@ var SimpleTypes; var ObjectTypes; (function (ObjectTypes) { var S = /** @class */ (function () { - function S() { - } + function S() {} return S; }()); var T = /** @class */ (function () { - function T() { - } + function T() {} return T; }()); var s; var t; + var s2; var t2; + var a; var b; var a2 = { foo: a2 }; var b2 = { foo: b2 }; + s = t; t = s; s = s2; s = a2; + s2 = t2; t2 = s2; s2 = t; s2 = b; s2 = a2; + a = b; b = a; a = s; a = s2; a = a2; + a2 = b2; b2 = a2; a2 = b; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers2.js b/tests/baselines/reference/assignmentCompatWithObjectMembers2.js index 08452e3d210c9..e7f7871bfded7 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers2.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers2.js @@ -45,38 +45,43 @@ a2 = t; //// [assignmentCompatWithObjectMembers2.js] // members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M // additional optional properties do not cause errors + var S = /** @class */ (function () { - function S() { - } + function S() {} return S; }()); var T = /** @class */ (function () { - function T() { - } + function T() {} return T; }()); var s; var t; + var s2; var t2; + var a; var b; var a2 = { foo: '' }; var b2 = { foo: '' }; + s = t; t = s; s = s2; s = a2; + s2 = t2; t2 = s2; s2 = t; s2 = b; s2 = a2; + a = b; b = a; a = s; a = s2; a = a2; + a2 = b2; b2 = a2; a2 = b; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers3.js b/tests/baselines/reference/assignmentCompatWithObjectMembers3.js index 58c6321faa620..d8c1261dcd829 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers3.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers3.js @@ -45,38 +45,43 @@ a2 = t; //// [assignmentCompatWithObjectMembers3.js] // members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M // additional optional properties do not cause errors + var S = /** @class */ (function () { - function S() { - } + function S() {} return S; }()); var T = /** @class */ (function () { - function T() { - } + function T() {} return T; }()); var s; var t; + var s2; var t2; + var a; var b; + var a2 = { foo: '' }; var b2 = { foo: '' }; s = t; t = s; s = s2; s = a2; + s2 = t2; t2 = s2; s2 = t; s2 = b; s2 = a2; + a = b; b = a; a = s; a = s2; a = a2; + a2 = b2; b2 = a2; a2 = b; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers4.js b/tests/baselines/reference/assignmentCompatWithObjectMembers4.js index 0144f8f75c66d..a488502d7905f 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers4.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers4.js @@ -111,8 +111,7 @@ var __extends = (this && this.__extends) || (function () { var OnlyDerived; (function (OnlyDerived) { var Base = /** @class */ (function () { - function Base() { - } + function Base() {} return Base; }()); var Derived = /** @class */ (function (_super) { @@ -130,37 +129,41 @@ var OnlyDerived; return Derived2; }(Base)); var S = /** @class */ (function () { - function S() { - } + function S() {} return S; }()); var T = /** @class */ (function () { - function T() { - } + function T() {} return T; }()); var s; var t; + var s2; var t2; + var a; var b; var a2 = { foo: new Derived() }; var b2 = { foo: new Derived2() }; + s = t; // error t = s; // error s = s2; // ok s = a2; // ok + s2 = t2; // error t2 = s2; // error s2 = t; // error s2 = b; // error s2 = a2; // ok + a = b; // error b = a; // error a = s; // ok a = s2; // ok a = a2; // ok + a2 = b2; // error b2 = a2; // error a2 = b; // error @@ -170,8 +173,7 @@ var OnlyDerived; var WithBase; (function (WithBase) { var Base = /** @class */ (function () { - function Base() { - } + function Base() {} return Base; }()); var Derived = /** @class */ (function (_super) { @@ -189,37 +191,41 @@ var WithBase; return Derived2; }(Base)); var S = /** @class */ (function () { - function S() { - } + function S() {} return S; }()); var T = /** @class */ (function () { - function T() { - } + function T() {} return T; }()); var s; var t; + var s2; var t2; + var a; var b; var a2 = { foo: new Base() }; var b2 = { foo: new Derived2() }; + s = t; // ok t = s; // error s = s2; // ok s = a2; // ok + s2 = t2; // ok t2 = s2; // error s2 = t; // ok s2 = b; // ok s2 = a2; // ok + a = b; // ok b = a; // error a = s; // ok a = s2; // ok a = a2; // ok + a2 = b2; // ok b2 = a2; // error a2 = b; // ok diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers5.js b/tests/baselines/reference/assignmentCompatWithObjectMembers5.js index 86302977ecbab..c0ffd8e6a52ae 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers5.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers5.js @@ -21,6 +21,8 @@ var C = /** @class */ (function () { return C; }()); var c; + + var i; c = i; // error i = c; // error diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.js b/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.js index efe6857f933a7..2aca862ab87b2 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.js @@ -119,9 +119,11 @@ var TargetIsPublic; } return Base; }()); + var a; var b; var i; + // sources var D = /** @class */ (function () { function D() { @@ -139,18 +141,22 @@ var TargetIsPublic; a = i; a = d; a = e; // error + b = a; b = i; b = d; b = e; // error + i = a; i = b; i = d; i = e; // error + d = a; d = b; d = i; d = e; // error + e = a; // errror e = b; // errror e = i; // errror @@ -164,9 +170,11 @@ var TargetIsPublic; } return Base; }()); + var a; var b; var i; + // sources var D = /** @class */ (function () { function D() { @@ -184,20 +192,24 @@ var TargetIsPublic; a = i; // error a = d; a = e; // error + b = a; // error b = i; b = d; // error b = e; // error b = b; + i = a; // error i = b; i = d; // error i = e; // error i = i; + d = a; d = b; // error d = i; // error d = e; // error + e = a; // errror e = b; // errror e = i; // errror diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersNumericNames.js b/tests/baselines/reference/assignmentCompatWithObjectMembersNumericNames.js index e021f3e22e62e..85ae07d9d487c 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersNumericNames.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersNumericNames.js @@ -45,38 +45,43 @@ a2 = t; //// [assignmentCompatWithObjectMembersNumericNames.js] // members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M // numeric named properties work correctly, no errors expected + var S = /** @class */ (function () { - function S() { - } + function S() {} return S; }()); var T = /** @class */ (function () { - function T() { - } + function T() {} return T; }()); var s; var t; + var s2; var t2; + var a; var b; var a2 = { 1.0: '' }; var b2 = { 1: '' }; + s = t; t = s; s = s2; s = a2; + s2 = t2; t2 = s2; s2 = t; s2 = b; s2 = a2; + a = b; b = a; a = s; a = s2; a = a2; + a2 = b2; b2 = a2; a2 = b; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js index 8b7df99a6da06..7d4233798c0e7 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js @@ -105,9 +105,9 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + var Base = /** @class */ (function () { - function Base() { - } + function Base() {} return Base; }()); var Derived = /** @class */ (function (_super) { @@ -127,8 +127,10 @@ var Derived2 = /** @class */ (function (_super) { var TargetHasOptional; (function (TargetHasOptional) { var c; + var a; var b = { opt: new Base() }; + var d; var e; var f; @@ -137,10 +139,12 @@ var TargetHasOptional; c = e; c = f; c = a; + a = d; a = e; a = f; a = c; + b = d; b = e; b = f; @@ -150,6 +154,7 @@ var TargetHasOptional; var SourceHasOptional; (function (SourceHasOptional) { var c; + var a; var b = { opt: new Base() }; var d; @@ -159,10 +164,12 @@ var SourceHasOptional; c = e; // error c = f; // ok c = a; // ok + a = d; // error a = e; // error a = f; // ok a = c; // ok + b = d; // error b = e; // error b = f; // ok diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js index 37208dc26cb40..ce5f8bc1c47cd 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js @@ -108,9 +108,9 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + var Base = /** @class */ (function () { - function Base() { - } + function Base() {} return Base; }()); var Derived = /** @class */ (function (_super) { @@ -130,8 +130,10 @@ var Derived2 = /** @class */ (function (_super) { var TargetHasOptional; (function (TargetHasOptional) { var c; + var a; var b = { opt: new Base() }; + var d; var e; var f; @@ -145,6 +147,7 @@ var TargetHasOptional; b = d; b = e; b = f; + // ok c = a; a = c; @@ -154,6 +157,7 @@ var TargetHasOptional; var SourceHasOptional; (function (SourceHasOptional) { var c; + var a; var b = { opt: new Base() }; var d; @@ -163,10 +167,12 @@ var SourceHasOptional; c = e; // error c = f; // error c = a; // ok + a = d; // error a = e; // error a = f; // error a = c; // ok + b = d; // error b = e; // error b = f; // error diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersStringNumericNames.js b/tests/baselines/reference/assignmentCompatWithObjectMembersStringNumericNames.js index 30e81f3f19f08..cf8b9d2e46044 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersStringNumericNames.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersStringNumericNames.js @@ -91,37 +91,41 @@ module NumbersAndStrings { var JustStrings; (function (JustStrings) { var S = /** @class */ (function () { - function S() { - } + function S() {} return S; }()); var T = /** @class */ (function () { - function T() { - } + function T() {} return T; }()); var s; var t; + var s2; var t2; + var a; var b; var a2 = { '1.0': '' }; var b2 = { '1': '' }; + s = t; t = s; s = s2; // ok s = a2; + s2 = t2; t2 = s2; s2 = t; s2 = b; s2 = a2; + a = b; b = a; a = s; a = s2; a = a2; + a2 = b2; b2 = a2; a2 = b; // ok @@ -131,38 +135,42 @@ var JustStrings; var NumbersAndStrings; (function (NumbersAndStrings) { var S = /** @class */ (function () { - function S() { - } + function S() {} return S; }()); var T = /** @class */ (function () { - function T() { - } + function T() {} return T; }()); var s; var t; + var s2; var t2; + var a; var b; var a2 = { '1.0': '' }; var b2 = { 1.: '' }; + s = t; // ok t = s; // ok s = s2; // ok s = a2; // error + s2 = t2; // ok t2 = s2; // ok s2 = t; // ok s2 = b; // ok s2 = a2; // error + a = b; // error b = a; // error a = s; // error a = s2; // error a = a2; // error a = b2; // error + a2 = b2; // error b2 = a2; // error a2 = b; // error diff --git a/tests/baselines/reference/assignmentCompatWithOverloads.js b/tests/baselines/reference/assignmentCompatWithOverloads.js index 8955dd409755a..b1149f1d6ef3b 100644 --- a/tests/baselines/reference/assignmentCompatWithOverloads.js +++ b/tests/baselines/reference/assignmentCompatWithOverloads.js @@ -32,17 +32,25 @@ d = C; // Error //// [assignmentCompatWithOverloads.js] function f1(x) { return null; } + function f2(x) { return null; } + function f3(x) { return null; } + + + function f4(x) { return undefined; } + var g; g = f1; // OK + g = f2; // Error + g = f3; // Error + g = f4; // Error var C = /** @class */ (function () { - function C(x) { - } + function C(x) {} return C; }()); var d; diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer.js b/tests/baselines/reference/assignmentCompatWithStringIndexer.js index fbff31831dc20..b73b5c0b46b70 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer.js +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer.js @@ -70,12 +70,15 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + + var A = /** @class */ (function () { function A() { } return A; }()); var a; + var b; a = b; // ok b = a; // error diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer2.js b/tests/baselines/reference/assignmentCompatWithStringIndexer2.js index 50fe7b3f8b9be..444ea853b7a6b 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer2.js +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer2.js @@ -55,7 +55,11 @@ module Generics { //// [assignmentCompatWithStringIndexer2.js] // index signatures must be compatible in assignments + + + var a; + var b; a = b; // ok b = a; // error @@ -64,10 +68,13 @@ a = b2; // ok b2 = a; // error var Generics; (function (Generics) { + + var b1; var a1; a1 = b1; // ok b1 = a1; // error + var b2; a1 = b2; // ok b2 = a1; // error diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer3.js b/tests/baselines/reference/assignmentCompatWithStringIndexer3.js index d3306949906e2..f0400afaaccbc 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer3.js +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer3.js @@ -25,6 +25,8 @@ module Generics { //// [assignmentCompatWithStringIndexer3.js] // Derived type indexer must be subtype of base type indexer + + var a; var b1; a = b1; // error diff --git a/tests/baselines/reference/assignmentCompatability39.js b/tests/baselines/reference/assignmentCompatability39.js index 6a2c4e88e30b8..9037de786823d 100644 --- a/tests/baselines/reference/assignmentCompatability39.js +++ b/tests/baselines/reference/assignmentCompatability39.js @@ -27,8 +27,7 @@ var __test2__; return classWithTwoPublic; }()); __test2__.classWithTwoPublic = classWithTwoPublic; - var x2 = new classWithTwoPublic(1, "a"); - ; + var x2 = new classWithTwoPublic(1, "a");; __test2__.__val__x2 = x2; })(__test2__ || (__test2__ = {})); __test2__.__val__x2 = __test1__.__val__obj4; diff --git a/tests/baselines/reference/assignmentCompatability40.js b/tests/baselines/reference/assignmentCompatability40.js index ecfd29d6213dc..8abeea73a4a2e 100644 --- a/tests/baselines/reference/assignmentCompatability40.js +++ b/tests/baselines/reference/assignmentCompatability40.js @@ -26,8 +26,7 @@ var __test2__; return classWithPrivate; }()); __test2__.classWithPrivate = classWithPrivate; - var x5 = new classWithPrivate(1); - ; + var x5 = new classWithPrivate(1);; __test2__.__val__x5 = x5; })(__test2__ || (__test2__ = {})); __test2__.__val__x5 = __test1__.__val__obj4; diff --git a/tests/baselines/reference/assignmentCompatability41.js b/tests/baselines/reference/assignmentCompatability41.js index dbba1e012621a..72dc21961cb22 100644 --- a/tests/baselines/reference/assignmentCompatability41.js +++ b/tests/baselines/reference/assignmentCompatability41.js @@ -27,8 +27,7 @@ var __test2__; return classWithTwoPrivate; }()); __test2__.classWithTwoPrivate = classWithTwoPrivate; - var x6 = new classWithTwoPrivate(1, "a"); - ; + var x6 = new classWithTwoPrivate(1, "a");; __test2__.__val__x6 = x6; })(__test2__ || (__test2__ = {})); __test2__.__val__x6 = __test1__.__val__obj4; diff --git a/tests/baselines/reference/assignmentCompatability42.js b/tests/baselines/reference/assignmentCompatability42.js index 98ddf0bd4ec38..54bdb45b16eb9 100644 --- a/tests/baselines/reference/assignmentCompatability42.js +++ b/tests/baselines/reference/assignmentCompatability42.js @@ -27,8 +27,7 @@ var __test2__; return classWithPublicPrivate; }()); __test2__.classWithPublicPrivate = classWithPublicPrivate; - var x7 = new classWithPublicPrivate(1, "a"); - ; + var x7 = new classWithPublicPrivate(1, "a");; __test2__.__val__x7 = x7; })(__test2__ || (__test2__ = {})); __test2__.__val__x7 = __test1__.__val__obj4; diff --git a/tests/baselines/reference/assignmentCompatability44.js b/tests/baselines/reference/assignmentCompatability44.js index ccdbf0827c353..60116973cd024 100644 --- a/tests/baselines/reference/assignmentCompatability44.js +++ b/tests/baselines/reference/assignmentCompatability44.js @@ -8,8 +8,7 @@ const foo: { new(): Foo } = Foo; //// [assignmentCompatability44.js] var Foo = /** @class */ (function () { - function Foo(x) { - } + function Foo(x) {} return Foo; }()); var foo = Foo; diff --git a/tests/baselines/reference/assignmentCompatability45.js b/tests/baselines/reference/assignmentCompatability45.js index f5ac5b1f4ce2f..cedfd7dc662a2 100644 --- a/tests/baselines/reference/assignmentCompatability45.js +++ b/tests/baselines/reference/assignmentCompatability45.js @@ -23,10 +23,8 @@ var __extends = (this && this.__extends) || (function () { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -})(); -var A = /** @class */ (function () { - function A() { - } +})();var A = /** @class */ (function () { + function A() {} return A; }()); var B = /** @class */ (function (_super) { diff --git a/tests/baselines/reference/assignmentCompatability8.js b/tests/baselines/reference/assignmentCompatability8.js index b0aa9b4374f33..afd3188248b56 100644 --- a/tests/baselines/reference/assignmentCompatability8.js +++ b/tests/baselines/reference/assignmentCompatability8.js @@ -26,8 +26,7 @@ var __test2__; return classWithPublic; }()); __test2__.classWithPublic = classWithPublic; - var x1 = new classWithPublic(1); - ; + var x1 = new classWithPublic(1);; __test2__.__val__x1 = x1; })(__test2__ || (__test2__ = {})); __test2__.__val__x1 = __test1__.__val__obj4; diff --git a/tests/baselines/reference/assignmentCompatability_checking-apply-member-off-of-function-interface.js b/tests/baselines/reference/assignmentCompatability_checking-apply-member-off-of-function-interface.js index 760631ffbb5f5..5c37619a70085 100644 --- a/tests/baselines/reference/assignmentCompatability_checking-apply-member-off-of-function-interface.js +++ b/tests/baselines/reference/assignmentCompatability_checking-apply-member-off-of-function-interface.js @@ -32,15 +32,17 @@ fn(a => { }); //// [assignmentCompatability_checking-apply-member-off-of-function-interface.js] // 3.8.4 Assignment Compatibility + + var x; // Should fail x = ''; x = ['']; x = 4; x = {}; + // Should work -function f() { } -; +function f() { }; x = f; function fn(c) { } // Should Fail diff --git a/tests/baselines/reference/assignmentCompatability_checking-call-member-off-of-function-interface.js b/tests/baselines/reference/assignmentCompatability_checking-call-member-off-of-function-interface.js index 2e61521eefb84..a493262c580f1 100644 --- a/tests/baselines/reference/assignmentCompatability_checking-call-member-off-of-function-interface.js +++ b/tests/baselines/reference/assignmentCompatability_checking-call-member-off-of-function-interface.js @@ -32,15 +32,17 @@ fn(a => { }); //// [assignmentCompatability_checking-call-member-off-of-function-interface.js] // 3.8.4 Assignment Compatibility + + var x; // Should fail x = ''; x = ['']; x = 4; x = {}; + // Should work -function f() { } -; +function f() { }; x = f; function fn(c) { } // Should Fail diff --git a/tests/baselines/reference/assignmentGenericLookupTypeNarrowing.js b/tests/baselines/reference/assignmentGenericLookupTypeNarrowing.js index 7f757ef24c3c7..0bb3942f23ae5 100644 --- a/tests/baselines/reference/assignmentGenericLookupTypeNarrowing.js +++ b/tests/baselines/reference/assignmentGenericLookupTypeNarrowing.js @@ -14,7 +14,9 @@ function bar(key: K) { //// [assignmentGenericLookupTypeNarrowing.js] // Repro from #26130 + var mappedObject = { foo: { x: "hello" } }; + function bar(key) { var element = foo(mappedObject[key]); if (element == null) diff --git a/tests/baselines/reference/assignmentIndexedToPrimitives.js b/tests/baselines/reference/assignmentIndexedToPrimitives.js index 363d41fc14de9..dbb3747b73228 100644 --- a/tests/baselines/reference/assignmentIndexedToPrimitives.js +++ b/tests/baselines/reference/assignmentIndexedToPrimitives.js @@ -21,11 +21,14 @@ var n1 = [0]; var n2 = ["0"]; var n3 = [0, "1"]; var n4 = [0]; + var s1 = [0]; var s2 = ["0"]; var s3 = [0, "1"]; var s4 = ["0", "1"]; + var no1 = { 0: 1 }; + var so1 = { 0: 1 }; var so2 = { "0": 1 }; var so3 = { 0: "1" }; diff --git a/tests/baselines/reference/assignmentLHSIsReference.js b/tests/baselines/reference/assignmentLHSIsReference.js index 85d2aab2c46d3..b291fbe305d18 100644 --- a/tests/baselines/reference/assignmentLHSIsReference.js +++ b/tests/baselines/reference/assignmentLHSIsReference.js @@ -26,16 +26,19 @@ function fn2(x4: number) { //// [assignmentLHSIsReference.js] var value; + // identifiers: variable and parameter var x1; x1 = value; function fn1(x2) { x2 = value; } + // property accesses var x3; x3.a = value; x3['a'] = value; + // parentheses, the contained expression is reference (x1) = value; function fn2(x4) { diff --git a/tests/baselines/reference/assignmentLHSIsValue.js b/tests/baselines/reference/assignmentLHSIsValue.js index bd6a4277393c4..1f6e390793b71 100644 --- a/tests/baselines/reference/assignmentLHSIsValue.js +++ b/tests/baselines/reference/assignmentLHSIsValue.js @@ -88,6 +88,7 @@ var __extends = (this && this.__extends) || (function () { })(); // expected error for all the LHS of assignments var value; + // this var C = /** @class */ (function () { function C() { @@ -98,18 +99,20 @@ var C = /** @class */ (function () { return C; }()); function foo() { this = value; } + this = value; // identifiers: module, class, enum, function var M; -(function (M) { -})(M || (M = {})); +(function (M) {})(M || (M = {})); M = value; + C = value; var E; -(function (E) { -})(E || (E = {})); +(function (E) {})(E || (E = {})); E = value; + foo = value; + // literals null = value; true = value; @@ -117,13 +120,12 @@ false = value; 0 = value; '' = value; /d+/ = value; + // object literals -{ - a: 0; -} -value; +{a: 0;}value; // array literals '' = value[0], '' = value[1]; + // super var Derived = /** @class */ (function (_super) { __extends(Derived, _super); @@ -133,16 +135,18 @@ var Derived = /** @class */ (function (_super) { return _this; } Derived.prototype.foo = function () { _super.prototype. = value; }; + Derived.sfoo = function () { _super. = value; }; return Derived; }(C)); // function expression -function bar() { } -value; +function bar() { }value; (function () { }); value; + // function calls foo() = value; + // parentheses, the containted expression is value (this) = value; (M) = value; diff --git a/tests/baselines/reference/assignmentNestedInLiterals.js b/tests/baselines/reference/assignmentNestedInLiterals.js index 8a048082565d4..fe3bd3d1518e6 100644 --- a/tests/baselines/reference/assignmentNestedInLiterals.js +++ b/tests/baselines/reference/assignmentNestedInLiterals.js @@ -13,8 +13,10 @@ for (kowloona of [c = 1, d = c]) { //// [assignmentNestedInLiterals.js] var target, x, y; target = [x = 1, y = x]; + var aegis, a, b; aegis = { x: a = 1, y: b = a }; + var kowloona, c, d; for (var _i = 0, _a = [c = 1, d = c]; _i < _a.length; _i++) { kowloona = _a[_i]; diff --git a/tests/baselines/reference/assignmentNonObjectTypeConstraints.js b/tests/baselines/reference/assignmentNonObjectTypeConstraints.js index 35d6d7c1ff327..6b5e265d94908 100644 --- a/tests/baselines/reference/assignmentNonObjectTypeConstraints.js +++ b/tests/baselines/reference/assignmentNonObjectTypeConstraints.js @@ -20,19 +20,18 @@ bar(new B); //// [assignmentNonObjectTypeConstraints.js] + function foo(x) { var y = x; // Ok } foo(5); foo(0 /* A */); var A = /** @class */ (function () { - function A() { - } + function A() {} return A; }()); var B = /** @class */ (function () { - function B() { - } + function B() {} return B; }()); function bar(x) { diff --git a/tests/baselines/reference/assignmentStricterConstraints.js b/tests/baselines/reference/assignmentStricterConstraints.js index a7f554ade7d45..11ef09d74004f 100644 --- a/tests/baselines/reference/assignmentStricterConstraints.js +++ b/tests/baselines/reference/assignmentStricterConstraints.js @@ -13,6 +13,7 @@ g(1, "") var f = function (x, y) { x = y; }; + var g = function (x, y) { }; g = f; g(1, ""); diff --git a/tests/baselines/reference/assignmentToObjectAndFunction.js b/tests/baselines/reference/assignmentToObjectAndFunction.js index d60e2de4a5a78..a8e01f3927782 100644 --- a/tests/baselines/reference/assignmentToObjectAndFunction.js +++ b/tests/baselines/reference/assignmentToObjectAndFunction.js @@ -36,6 +36,7 @@ var goodObj = { return ""; } }; // Ok, because toString is a subtype of Object's toString + var errFun = {}; // Error for no call signature function foo() { } (function (foo) { diff --git a/tests/baselines/reference/assignmentToParenthesizedIdentifiers.js b/tests/baselines/reference/assignmentToParenthesizedIdentifiers.js index 543a54ca10e94..90e1a245cab77 100644 --- a/tests/baselines/reference/assignmentToParenthesizedIdentifiers.js +++ b/tests/baselines/reference/assignmentToParenthesizedIdentifiers.js @@ -86,11 +86,11 @@ M.y = 3; // OK M.y = ''; // Error (M).y = ''; // Error (M.y) = ''; // Error + M = { y: 3 }; // Error (M) = { y: 3 }; // Error var M2; -(function (M2) { - var M3; +(function (M2) {var M3; (function (M3) { })(M3 = M2.M3 || (M2.M3 = {})); M3 = { x: 3 }; // Error @@ -98,21 +98,27 @@ var M2; M2.M3 = { x: 3 }; // OK (M2).M3 = { x: 3 }; // OK (M2.M3) = { x: 3 }; // OK + M2.M3 = { x: '' }; // Error (M2).M3 = { x: '' }; // Error (M2.M3) = { x: '' }; // Error + + function fn() { } fn = function () { return 3; }; // Bug 823548: Should be error (fn is not a reference) (fn) = function () { return 3; }; // Should be error + function fn2(x, y) { x = 3; (x) = 3; // OK x = ''; // Error (x) = ''; // Error + (y).t = 3; // OK (y.t) = 3; // OK (y).t = ''; // Error (y.t) = ''; // Error + y['t'] = 3; // OK (y)['t'] = 3; // OK (y['t']) = 3; // OK diff --git a/tests/baselines/reference/assignmentToReferenceTypes.js b/tests/baselines/reference/assignmentToReferenceTypes.js index b593240aec35d..f9c477ac60d7e 100644 --- a/tests/baselines/reference/assignmentToReferenceTypes.js +++ b/tests/baselines/reference/assignmentToReferenceTypes.js @@ -25,6 +25,7 @@ function g(x) { //// [assignmentToReferenceTypes.js] // Should all be allowed + M = null; var C = /** @class */ (function () { function C() { @@ -33,13 +34,15 @@ var C = /** @class */ (function () { }()); C = null; var E; -(function (E) { -})(E || (E = {})); +(function (E) {})(E || (E = {})); E = null; + function f() { } f = null; + var x = 1; x = null; + function g(x) { x = null; } diff --git a/tests/baselines/reference/assignmentToVoidZero2.js b/tests/baselines/reference/assignmentToVoidZero2.js index c8b658474d2b8..df0fe7254a539 100644 --- a/tests/baselines/reference/assignmentToVoidZero2.js +++ b/tests/baselines/reference/assignmentToVoidZero2.js @@ -27,6 +27,7 @@ var o = {}; o.x = 1; o.y = void 0; o.x + o.y; + function C() { this.p = 1; this.q = void 0; diff --git a/tests/baselines/reference/assignments.js b/tests/baselines/reference/assignments.js index 8143490083424..ca869ea491cf4 100644 --- a/tests/baselines/reference/assignments.js +++ b/tests/baselines/reference/assignments.js @@ -40,10 +40,10 @@ I = null; // Error // Assign to a variable // Assign to a parameter // Assign to an interface + M = null; // Error var C = /** @class */ (function () { - function C() { - } + function C() {} return C; }()); C = null; // Error @@ -53,10 +53,13 @@ var E; })(E || (E = {})); E = null; // Error E.A = null; // OK per spec, Error per implementation (509581) + function fn() { } fn = null; // Should be error + var v; v = null; // OK + function fn2(p) { p = null; // OK } diff --git a/tests/baselines/reference/asyncAliasReturnType_es5.js b/tests/baselines/reference/asyncAliasReturnType_es5.js index 7684b413405f4..dd7ef8ff1cba9 100644 --- a/tests/baselines/reference/asyncAliasReturnType_es5.js +++ b/tests/baselines/reference/asyncAliasReturnType_es5.js @@ -5,10 +5,9 @@ async function f(): PromiseAlias { } //// [asyncAliasReturnType_es5.js] + function f() { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () {return __generator(this, function (_a) {return [2 /*return*/]; }); }); } diff --git a/tests/baselines/reference/asyncAliasReturnType_es6.js b/tests/baselines/reference/asyncAliasReturnType_es6.js index 45fe3228f6ebd..aa4cf8a38caed 100644 --- a/tests/baselines/reference/asyncAliasReturnType_es6.js +++ b/tests/baselines/reference/asyncAliasReturnType_es6.js @@ -5,6 +5,7 @@ async function f(): PromiseAlias { } //// [asyncAliasReturnType_es6.js] + function f() { return __awaiter(this, void 0, void 0, function* () { }); diff --git a/tests/baselines/reference/asyncArrowFunction10_es5.js b/tests/baselines/reference/asyncArrowFunction10_es5.js index 5fc37de5f1873..014b7ff96743e 100644 --- a/tests/baselines/reference/asyncArrowFunction10_es5.js +++ b/tests/baselines/reference/asyncArrowFunction10_es5.js @@ -7,9 +7,7 @@ var foo = async (): Promise => { //// [asyncArrowFunction10_es5.js] var _this = this; -var foo = function () { return __awaiter(_this, void 0, void 0, function () { - var v; - return __generator(this, function (_a) { - return [2 /*return*/]; +var foo = function () { return __awaiter(_this, void 0, void 0, function () {var v; + return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; diff --git a/tests/baselines/reference/asyncArrowFunction11_es5.js b/tests/baselines/reference/asyncArrowFunction11_es5.js index a16ce36e84072..bb40559859660 100644 --- a/tests/baselines/reference/asyncArrowFunction11_es5.js +++ b/tests/baselines/reference/asyncArrowFunction11_es5.js @@ -53,13 +53,10 @@ var A = /** @class */ (function () { for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } - return __awaiter(_this, void 0, void 0, function () { - var obj; + return __awaiter(_this, void 0, void 0, function () {var obj; var _a; var _this = this; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: return [4 /*yield*/, Promise.resolve()]; + return __generator(this, function (_b) {switch (_b.label) {case 0: return [4 /*yield*/, Promise.resolve()]; case 1: _b.sent(); obj = (_a = {}, _a["a"] = function () { return _this; }, _a); diff --git a/tests/baselines/reference/asyncArrowFunction1_es5.js b/tests/baselines/reference/asyncArrowFunction1_es5.js index e26770d8fe9b2..67d1e03d8f9da 100644 --- a/tests/baselines/reference/asyncArrowFunction1_es5.js +++ b/tests/baselines/reference/asyncArrowFunction1_es5.js @@ -4,8 +4,6 @@ var foo = async (): Promise => { //// [asyncArrowFunction1_es5.js] var _this = this; -var foo = function () { return __awaiter(_this, void 0, void 0, function () { - return __generator(this, function (_a) { - return [2 /*return*/]; +var foo = function () { return __awaiter(_this, void 0, void 0, function () {return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; diff --git a/tests/baselines/reference/asyncArrowFunction3_es5.js b/tests/baselines/reference/asyncArrowFunction3_es5.js index 3c73e6f9f58f9..f0edf1fc0b647 100644 --- a/tests/baselines/reference/asyncArrowFunction3_es5.js +++ b/tests/baselines/reference/asyncArrowFunction3_es5.js @@ -3,6 +3,5 @@ function f(await = await) { } //// [asyncArrowFunction3_es5.js] -function f(await) { - if (await === void 0) { await = await; } +function f(await) {if (await === void 0) { await = await; } } diff --git a/tests/baselines/reference/asyncArrowFunction5_es5.js b/tests/baselines/reference/asyncArrowFunction5_es5.js index 073331f4bbc0e..4d715d1fcb5b1 100644 --- a/tests/baselines/reference/asyncArrowFunction5_es5.js +++ b/tests/baselines/reference/asyncArrowFunction5_es5.js @@ -4,8 +4,6 @@ var foo = async (await): Promise => { //// [asyncArrowFunction5_es5.js] var _this = this; -var foo = function (await) { return __awaiter(_this, void 0, void 0, function () { - return __generator(this, function (_a) { - return [2 /*return*/]; +var foo = function (await) { return __awaiter(_this, void 0, void 0, function () {return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; diff --git a/tests/baselines/reference/asyncArrowFunction6_es5.js b/tests/baselines/reference/asyncArrowFunction6_es5.js index fe91930a1566c..6053881ae7a70 100644 --- a/tests/baselines/reference/asyncArrowFunction6_es5.js +++ b/tests/baselines/reference/asyncArrowFunction6_es5.js @@ -4,11 +4,8 @@ var foo = async (a = await): Promise => { //// [asyncArrowFunction6_es5.js] var _this = this; -var foo = function (a) { - if (a === void 0) { a = yield ; } - return __awaiter(_this, void 0, void 0, function () { - return __generator(this, function (_a) { - return [2 /*return*/]; +var foo = function (a) {if (a === void 0) { a = yield ; } + return __awaiter(_this, void 0, void 0, function () {return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; diff --git a/tests/baselines/reference/asyncArrowFunction7_es5.js b/tests/baselines/reference/asyncArrowFunction7_es5.js index 6988d1d019a60..86701479175de 100644 --- a/tests/baselines/reference/asyncArrowFunction7_es5.js +++ b/tests/baselines/reference/asyncArrowFunction7_es5.js @@ -7,15 +7,10 @@ var bar = async (): Promise => { //// [asyncArrowFunction7_es5.js] var _this = this; -var bar = function () { return __awaiter(_this, void 0, void 0, function () { - var foo; +var bar = function () { return __awaiter(_this, void 0, void 0, function () {var foo; var _this = this; - return __generator(this, function (_a) { - foo = function (a) { - if (a === void 0) { a = yield ; } - return __awaiter(_this, void 0, void 0, function () { - return __generator(this, function (_a) { - return [2 /*return*/]; + return __generator(this, function (_a) {foo = function (a) {if (a === void 0) { a = yield ; } + return __awaiter(_this, void 0, void 0, function () {return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; diff --git a/tests/baselines/reference/asyncArrowFunction8_es5.js b/tests/baselines/reference/asyncArrowFunction8_es5.js index aae263255b3d2..a15b2d7b38da0 100644 --- a/tests/baselines/reference/asyncArrowFunction8_es5.js +++ b/tests/baselines/reference/asyncArrowFunction8_es5.js @@ -5,16 +5,11 @@ var foo = async (): Promise => { //// [asyncArrowFunction8_es5.js] var _this = this; -var foo = function () { return __awaiter(_this, void 0, void 0, function () { - var v; +var foo = function () { return __awaiter(_this, void 0, void 0, function () {var v; var _a; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - _a = {}; + return __generator(this, function (_b) {switch (_b.label) {case 0:_a = {}; return [4 /*yield*/, ]; - case 1: - v = (_a[_b.sent()] = foo, _a); + case 1:v = (_a[_b.sent()] = foo, _a); return [2 /*return*/]; } }); diff --git a/tests/baselines/reference/asyncArrowFunction9_es5.js b/tests/baselines/reference/asyncArrowFunction9_es5.js index 457d5ddc4c4d7..24883a512d5b2 100644 --- a/tests/baselines/reference/asyncArrowFunction9_es5.js +++ b/tests/baselines/reference/asyncArrowFunction9_es5.js @@ -3,7 +3,6 @@ var foo = async (a = await => await): Promise => { } //// [asyncArrowFunction9_es5.js] -var foo = async(a = function (await) { return await; }), Promise; -; +var foo = async(a = function (await) { return await; }), Promise;; { } diff --git a/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5.js b/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5.js index f9937c0dd6336..028f95a1a081e 100644 --- a/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5.js +++ b/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5.js @@ -14,9 +14,7 @@ var C = /** @class */ (function () { C.prototype.method = function () { var _this = this; function other() { } - var fn = function () { return __awaiter(_this, arguments, void 0, function () { return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, other.apply(this, arguments)]; + var fn = function () { return __awaiter(_this, arguments, void 0, function () { return __generator(this, function (_a) {switch (_a.label) {case 0: return [4 /*yield*/, other.apply(this, arguments)]; case 1: return [2 /*return*/, _a.sent()]; } }); }); }; diff --git a/tests/baselines/reference/asyncArrowFunctionCapturesThis_es5.js b/tests/baselines/reference/asyncArrowFunctionCapturesThis_es5.js index e475cbb1e3aaa..1b47291a40b49 100644 --- a/tests/baselines/reference/asyncArrowFunctionCapturesThis_es5.js +++ b/tests/baselines/reference/asyncArrowFunctionCapturesThis_es5.js @@ -12,9 +12,7 @@ var C = /** @class */ (function () { } C.prototype.method = function () { var _this = this; - var fn = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, this]; + var fn = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {switch (_a.label) {case 0: return [4 /*yield*/, this]; case 1: return [2 /*return*/, _a.sent()]; } }); }); }; diff --git a/tests/baselines/reference/asyncArrowInClassES5.js b/tests/baselines/reference/asyncArrowInClassES5.js index f0204f7319bda..96b803b132001 100644 --- a/tests/baselines/reference/asyncArrowInClassES5.js +++ b/tests/baselines/reference/asyncArrowInClassES5.js @@ -14,8 +14,7 @@ var _this = this; var Test = /** @class */ (function () { function Test() { } - Test.member = function (x) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + Test.member = function (x) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; return Test; }()); diff --git a/tests/baselines/reference/asyncAwaitIsolatedModules_es2017.js b/tests/baselines/reference/asyncAwaitIsolatedModules_es2017.js index 520d659c3f740..324e4fd293d7e 100644 --- a/tests/baselines/reference/asyncAwaitIsolatedModules_es2017.js +++ b/tests/baselines/reference/asyncAwaitIsolatedModules_es2017.js @@ -40,6 +40,7 @@ module M { } //// [asyncAwaitIsolatedModules_es2017.js] + async function f0() { } async function f1() { } async function f3() { } @@ -53,11 +54,13 @@ let f10 = async () => p; let f11 = async () => mp; let f12 = async () => mp; let f13 = async () => p; + let o = { async m1() { }, async m2() { }, async m3() { } }; + class C { async m1() { } async m2() { } diff --git a/tests/baselines/reference/asyncAwaitIsolatedModules_es5.js b/tests/baselines/reference/asyncAwaitIsolatedModules_es5.js index ec3837911ded0..dc0e3ca61676a 100644 --- a/tests/baselines/reference/asyncAwaitIsolatedModules_es5.js +++ b/tests/baselines/reference/asyncAwaitIsolatedModules_es5.js @@ -79,44 +79,39 @@ var __generator = (this && this.__generator) || function (thisArg, body) { }; Object.defineProperty(exports, "__esModule", { value: true }); var missing_1 = require("missing"); + + function f0() { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); } function f1() { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); } function f3() { - return __awaiter(this, void 0, missing_1.MyPromise, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, missing_1.MyPromise, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); } + var f4 = function () { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; var f5 = function () { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; var f6 = function () { - return __awaiter(this, void 0, missing_1.MyPromise, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, missing_1.MyPromise, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; -var f7 = function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + +var f7 = function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; -var f8 = function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; +var f8 = function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; -var f9 = function () { return __awaiter(void 0, void 0, missing_1.MyPromise, function () { return __generator(this, function (_a) { - return [2 /*return*/]; +var f9 = function () { return __awaiter(void 0, void 0, missing_1.MyPromise, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; var f10 = function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, p]; @@ -130,54 +125,47 @@ var f12 = function () { return __awaiter(void 0, void 0, void 0, function () { r var f13 = function () { return __awaiter(void 0, void 0, missing_1.MyPromise, function () { return __generator(this, function (_a) { return [2 /*return*/, p]; }); }); }; + var o = { m1: function () { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }, m2: function () { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }, m3: function () { - return __awaiter(this, void 0, missing_1.MyPromise, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, missing_1.MyPromise, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); } }; + var C = /** @class */ (function () { function C() { } C.prototype.m1 = function () { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; C.prototype.m2 = function () { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; C.prototype.m3 = function () { - return __awaiter(this, void 0, missing_1.MyPromise, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, missing_1.MyPromise, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; C.m4 = function () { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; C.m5 = function () { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; C.m6 = function () { - return __awaiter(this, void 0, missing_1.MyPromise, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, missing_1.MyPromise, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; return C; @@ -185,8 +173,7 @@ var C = /** @class */ (function () { var M; (function (M) { function f1() { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); } M.f1 = f1; diff --git a/tests/baselines/reference/asyncAwaitIsolatedModules_es6.js b/tests/baselines/reference/asyncAwaitIsolatedModules_es6.js index 81eb137f28bae..759f7cb427082 100644 --- a/tests/baselines/reference/asyncAwaitIsolatedModules_es6.js +++ b/tests/baselines/reference/asyncAwaitIsolatedModules_es6.js @@ -49,6 +49,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; + + function f0() { return __awaiter(this, void 0, void 0, function* () { }); } @@ -58,6 +60,7 @@ function f1() { function f3() { return __awaiter(this, void 0, void 0, function* () { }); } + let f4 = function () { return __awaiter(this, void 0, void 0, function* () { }); }; @@ -67,6 +70,7 @@ let f5 = function () { let f6 = function () { return __awaiter(this, void 0, void 0, function* () { }); }; + let f7 = () => __awaiter(void 0, void 0, void 0, function* () { }); let f8 = () => __awaiter(void 0, void 0, void 0, function* () { }); let f9 = () => __awaiter(void 0, void 0, void 0, function* () { }); @@ -74,6 +78,7 @@ let f10 = () => __awaiter(void 0, void 0, void 0, function* () { return p; }); let f11 = () => __awaiter(void 0, void 0, void 0, function* () { return mp; }); let f12 = () => __awaiter(void 0, void 0, void 0, function* () { return mp; }); let f13 = () => __awaiter(void 0, void 0, void 0, function* () { return p; }); + let o = { m1() { return __awaiter(this, void 0, void 0, function* () { }); @@ -85,6 +90,7 @@ let o = { return __awaiter(this, void 0, void 0, function* () { }); } }; + class C { m1() { return __awaiter(this, void 0, void 0, function* () { }); diff --git a/tests/baselines/reference/asyncAwaitNestedClasses_es5.js b/tests/baselines/reference/asyncAwaitNestedClasses_es5.js index f72dda7bec2af..dd87ffa6a2bc6 100644 --- a/tests/baselines/reference/asyncAwaitNestedClasses_es5.js +++ b/tests/baselines/reference/asyncAwaitNestedClasses_es5.js @@ -33,10 +33,7 @@ var A = /** @class */ (function () { function C() { } C.func = function () { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_b) { - switch (_b.label) { - case 0: return [4 /*yield*/, _a.func2()]; + return __awaiter(this, void 0, void 0, function () {return __generator(this, function (_b) {switch (_b.label) {case 0: return [4 /*yield*/, _a.func2()]; case 1: _b.sent(); return [2 /*return*/]; diff --git a/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.js b/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.js index 259e6309449e1..2d8fa0f5fcdb4 100644 --- a/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.js +++ b/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.js @@ -37,16 +37,9 @@ async function fn4(): Promise { //// [asyncAwaitWithCapturedBlockScopeVar.js] function fn1() { - return __awaiter(this, void 0, void 0, function () { - var ar, _loop_1, i; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - ar = []; - _loop_1 = function (i) { - return __generator(this, function (_b) { - switch (_b.label) { - case 0: return [4 /*yield*/, 1]; + return __awaiter(this, void 0, void 0, function () {var ar, _loop_1, i; + return __generator(this, function (_a) {switch (_a.label) {case 0:ar = []; + _loop_1 = function (i) {return __generator(this, function (_b) {switch (_b.label) {case 0: return [4 /*yield*/, 1]; case 1: _b.sent(); ar.push(function () { return i; }); @@ -56,11 +49,9 @@ function fn1() { }; i = 0; _a.label = 1; - case 1: - if (!(i < 1)) return [3 /*break*/, 4]; + case 1:if (!(i < 1)) return [3 /*break*/, 4]; return [5 /*yield**/, _loop_1(i)]; - case 2: - _a.sent(); + case 2:_a.sent(); _a.label = 3; case 3: i++; @@ -70,17 +61,11 @@ function fn1() { }); }); } + function fn2() { - return __awaiter(this, void 0, void 0, function () { - var ar, _loop_2, i, state_1; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - ar = []; - _loop_2 = function (i) { - return __generator(this, function (_b) { - switch (_b.label) { - case 0: return [4 /*yield*/, 1]; + return __awaiter(this, void 0, void 0, function () {var ar, _loop_2, i, state_1; + return __generator(this, function (_a) {switch (_a.label) {case 0:ar = []; + _loop_2 = function (i) {return __generator(this, function (_b) {switch (_b.label) {case 0: return [4 /*yield*/, 1]; case 1: _b.sent(); ar.push(function () { return i; }); @@ -90,11 +75,9 @@ function fn2() { }; i = 0; _a.label = 1; - case 1: - if (!(i < 1)) return [3 /*break*/, 4]; + case 1:if (!(i < 1)) return [3 /*break*/, 4]; return [5 /*yield**/, _loop_2(i)]; - case 2: - state_1 = _a.sent(); + case 2:state_1 = _a.sent(); if (state_1 === "break") return [3 /*break*/, 4]; _a.label = 3; @@ -106,17 +89,11 @@ function fn2() { }); }); } + function fn3() { - return __awaiter(this, void 0, void 0, function () { - var ar, _loop_3, i; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - ar = []; - _loop_3 = function (i) { - return __generator(this, function (_b) { - switch (_b.label) { - case 0: return [4 /*yield*/, 1]; + return __awaiter(this, void 0, void 0, function () {var ar, _loop_3, i; + return __generator(this, function (_a) {switch (_a.label) {case 0:ar = []; + _loop_3 = function (i) {return __generator(this, function (_b) {switch (_b.label) {case 0: return [4 /*yield*/, 1]; case 1: _b.sent(); ar.push(function () { return i; }); @@ -126,11 +103,9 @@ function fn3() { }; i = 0; _a.label = 1; - case 1: - if (!(i < 1)) return [3 /*break*/, 4]; + case 1:if (!(i < 1)) return [3 /*break*/, 4]; return [5 /*yield**/, _loop_3(i)]; - case 2: - _a.sent(); + case 2:_a.sent(); _a.label = 3; case 3: i++; @@ -140,17 +115,11 @@ function fn3() { }); }); } + function fn4() { - return __awaiter(this, void 0, void 0, function () { - var ar, _loop_4, i, state_2; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - ar = []; - _loop_4 = function (i) { - return __generator(this, function (_b) { - switch (_b.label) { - case 0: return [4 /*yield*/, 1]; + return __awaiter(this, void 0, void 0, function () {var ar, _loop_4, i, state_2; + return __generator(this, function (_a) {switch (_a.label) {case 0:ar = []; + _loop_4 = function (i) {return __generator(this, function (_b) {switch (_b.label) {case 0: return [4 /*yield*/, 1]; case 1: _b.sent(); ar.push(function () { return i; }); @@ -160,11 +129,9 @@ function fn4() { }; i = 0; _a.label = 1; - case 1: - if (!(i < 1)) return [3 /*break*/, 4]; + case 1:if (!(i < 1)) return [3 /*break*/, 4]; return [5 /*yield**/, _loop_4(i)]; - case 2: - state_2 = _a.sent(); + case 2:state_2 = _a.sent(); if (typeof state_2 === "object") return [2 /*return*/, state_2.value]; _a.label = 3; diff --git a/tests/baselines/reference/asyncAwait_es2017.js b/tests/baselines/reference/asyncAwait_es2017.js index 70a4c63be2e12..26f0fd4958e49 100644 --- a/tests/baselines/reference/asyncAwait_es2017.js +++ b/tests/baselines/reference/asyncAwait_es2017.js @@ -60,11 +60,13 @@ let f10 = async () => p; let f11 = async () => mp; let f12 = async () => mp; let f13 = async () => p; + let o = { async m1() { }, async m2() { }, async m3() { } }; + class C { async m1() { } async m2() { } diff --git a/tests/baselines/reference/asyncAwait_es5.js b/tests/baselines/reference/asyncAwait_es5.js index 6a6433e85c6fe..e90e1555ced04 100644 --- a/tests/baselines/reference/asyncAwait_es5.js +++ b/tests/baselines/reference/asyncAwait_es5.js @@ -84,44 +84,38 @@ var __generator = (this && this.__generator) || function (thisArg, body) { } }; var _this = this; + function f0() { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); } function f1() { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); } function f3() { - return __awaiter(this, void 0, MyPromise, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, MyPromise, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); } + var f4 = function () { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; var f5 = function () { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; var f6 = function () { - return __awaiter(this, void 0, MyPromise, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, MyPromise, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; -var f7 = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + +var f7 = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; -var f8 = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; +var f8 = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; -var f9 = function () { return __awaiter(_this, void 0, MyPromise, function () { return __generator(this, function (_a) { - return [2 /*return*/]; +var f9 = function () { return __awaiter(_this, void 0, MyPromise, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; var f10 = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, p]; @@ -135,54 +129,47 @@ var f12 = function () { return __awaiter(_this, void 0, void 0, function () { re var f13 = function () { return __awaiter(_this, void 0, MyPromise, function () { return __generator(this, function (_a) { return [2 /*return*/, p]; }); }); }; + var o = { m1: function () { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }, m2: function () { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }, m3: function () { - return __awaiter(this, void 0, MyPromise, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, MyPromise, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); } }; + var C = /** @class */ (function () { function C() { } C.prototype.m1 = function () { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; C.prototype.m2 = function () { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; C.prototype.m3 = function () { - return __awaiter(this, void 0, MyPromise, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, MyPromise, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; C.m4 = function () { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; C.m5 = function () { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; C.m6 = function () { - return __awaiter(this, void 0, MyPromise, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, MyPromise, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; return C; @@ -190,17 +177,13 @@ var C = /** @class */ (function () { var M; (function (M) { function f1() { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); } M.f1 = f1; })(M || (M = {})); function f14() { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, 1]; + return __awaiter(this, void 0, void 0, function () {return __generator(this, function (_a) {switch (_a.label) {case 0: return [4 /*yield*/, 1]; case 1: _a.sent(); return [3 /*break*/, 2]; diff --git a/tests/baselines/reference/asyncAwait_es6.js b/tests/baselines/reference/asyncAwait_es6.js index caab72bad9a99..da54251a16455 100644 --- a/tests/baselines/reference/asyncAwait_es6.js +++ b/tests/baselines/reference/asyncAwait_es6.js @@ -56,6 +56,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; + function f0() { return __awaiter(this, void 0, void 0, function* () { }); } @@ -65,6 +66,7 @@ function f1() { function f3() { return __awaiter(this, void 0, void 0, function* () { }); } + let f4 = function () { return __awaiter(this, void 0, void 0, function* () { }); }; @@ -74,6 +76,7 @@ let f5 = function () { let f6 = function () { return __awaiter(this, void 0, void 0, function* () { }); }; + let f7 = () => __awaiter(this, void 0, void 0, function* () { }); let f8 = () => __awaiter(this, void 0, void 0, function* () { }); let f9 = () => __awaiter(this, void 0, void 0, function* () { }); @@ -81,6 +84,7 @@ let f10 = () => __awaiter(this, void 0, void 0, function* () { return p; }); let f11 = () => __awaiter(this, void 0, void 0, function* () { return mp; }); let f12 = () => __awaiter(this, void 0, void 0, function* () { return mp; }); let f13 = () => __awaiter(this, void 0, void 0, function* () { return p; }); + let o = { m1() { return __awaiter(this, void 0, void 0, function* () { }); @@ -92,6 +96,7 @@ let o = { return __awaiter(this, void 0, void 0, function* () { }); } }; + class C { m1() { return __awaiter(this, void 0, void 0, function* () { }); diff --git a/tests/baselines/reference/asyncFunctionContextuallyTypedReturns.js b/tests/baselines/reference/asyncFunctionContextuallyTypedReturns.js index e06a4bde5e493..e0617bc81e180 100644 --- a/tests/baselines/reference/asyncFunctionContextuallyTypedReturns.js +++ b/tests/baselines/reference/asyncFunctionContextuallyTypedReturns.js @@ -26,7 +26,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; f(v => v ? [0] : Promise.reject()); f((v) => __awaiter(void 0, void 0, void 0, function* () { return v ? [0] : Promise.reject(); })); + g(v => v ? "contextuallyTypable" : Promise.reject()); g((v) => __awaiter(void 0, void 0, void 0, function* () { return v ? "contextuallyTypable" : Promise.reject(); })); + + h(v => v ? (abc) => { } : Promise.reject()); h((v) => __awaiter(void 0, void 0, void 0, function* () { return v ? (def) => { } : Promise.reject(); })); diff --git a/tests/baselines/reference/asyncFunctionDeclaration10_es5.js b/tests/baselines/reference/asyncFunctionDeclaration10_es5.js index e42e761c6984e..ced401c945e19 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration10_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration10_es5.js @@ -3,11 +3,8 @@ async function foo(a = await => await): Promise { } //// [asyncFunctionDeclaration10_es5.js] -function foo(a, await) { - if (a === void 0) { a = yield ; } - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - return [2 /*return*/]; +function foo(a, await) {if (a === void 0) { a = yield ; } + return __awaiter(this, void 0, void 0, function () {return __generator(this, function (_a) {return [2 /*return*/]; }); }); } diff --git a/tests/baselines/reference/asyncFunctionDeclaration11_es5.js b/tests/baselines/reference/asyncFunctionDeclaration11_es5.js index 27d16ebb0c1f3..a9dd2c97a7bfa 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration11_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration11_es5.js @@ -4,9 +4,7 @@ async function await(): Promise { //// [asyncFunctionDeclaration11_es5.js] function await() { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () {return __generator(this, function (_a) {return [2 /*return*/]; }); }); } diff --git a/tests/baselines/reference/asyncFunctionDeclaration12_es5.js b/tests/baselines/reference/asyncFunctionDeclaration12_es5.js index d74aa370bfbb9..c982d1a09288a 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration12_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration12_es5.js @@ -3,7 +3,6 @@ var v = async function await(): Promise { } //// [asyncFunctionDeclaration12_es5.js] var v = function await() { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); }; diff --git a/tests/baselines/reference/asyncFunctionDeclaration13_es5.js b/tests/baselines/reference/asyncFunctionDeclaration13_es5.js index e097192fbbf65..0e95712da2b7c 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration13_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration13_es5.js @@ -7,10 +7,8 @@ async function foo(): Promise { //// [asyncFunctionDeclaration13_es5.js] function foo() { - return __awaiter(this, void 0, void 0, function () { - var v; - return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () {var v; + return __generator(this, function (_a) {return [2 /*return*/]; }); }); } diff --git a/tests/baselines/reference/asyncFunctionDeclaration14_es5.js b/tests/baselines/reference/asyncFunctionDeclaration14_es5.js index 5ef6ce610843c..dfa5b2cd2221c 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration14_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration14_es5.js @@ -5,8 +5,7 @@ async function foo(): Promise { //// [asyncFunctionDeclaration14_es5.js] function foo() { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { + return __awaiter(this, void 0, void 0, function () {return __generator(this, function (_a) { return [2 /*return*/]; }); }); diff --git a/tests/baselines/reference/asyncFunctionDeclaration15_es5.js b/tests/baselines/reference/asyncFunctionDeclaration15_es5.js index 5ca93d3eca85e..4cabb9666d6a6 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration15_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration15_es5.js @@ -26,33 +26,27 @@ async function fn19() { await thenable; } // error //// [asyncFunctionDeclaration15_es5.js] function fn1() { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); } // valid: Promise function fn2() { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); } // error function fn3() { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); } // error function fn4() { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); } // error function fn5() { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); } // error function fn6() { - return __awaiter(this, void 0, Thenable, function () { return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, Thenable, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); } // error function fn7() { @@ -91,9 +85,7 @@ function fn13() { }); }); } // error function fn14() { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, 1]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {switch (_a.label) {case 0: return [4 /*yield*/, 1]; case 1: _a.sent(); return [2 /*return*/]; @@ -101,9 +93,7 @@ function fn14() { }); }); } // valid: Promise function fn15() { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, null]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {switch (_a.label) {case 0: return [4 /*yield*/, null]; case 1: _a.sent(); return [2 /*return*/]; @@ -111,9 +101,7 @@ function fn15() { }); }); } // valid: Promise function fn16() { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, undefined]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {switch (_a.label) {case 0: return [4 /*yield*/, undefined]; case 1: _a.sent(); return [2 /*return*/]; @@ -121,9 +109,7 @@ function fn16() { }); }); } // valid: Promise function fn17() { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, a]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {switch (_a.label) {case 0: return [4 /*yield*/, a]; case 1: _a.sent(); return [2 /*return*/]; @@ -131,9 +117,7 @@ function fn17() { }); }); } // valid: Promise function fn18() { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, obj]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {switch (_a.label) {case 0: return [4 /*yield*/, obj]; case 1: _a.sent(); return [2 /*return*/]; @@ -141,9 +125,7 @@ function fn18() { }); }); } // valid: Promise function fn19() { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, thenable]; + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {switch (_a.label) {case 0: return [4 /*yield*/, thenable]; case 1: _a.sent(); return [2 /*return*/]; diff --git a/tests/baselines/reference/asyncFunctionDeclaration1_es5.js b/tests/baselines/reference/asyncFunctionDeclaration1_es5.js index 913a0b3c4e21f..56671a621d665 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration1_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration1_es5.js @@ -4,9 +4,7 @@ async function foo(): Promise { //// [asyncFunctionDeclaration1_es5.js] function foo() { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () {return __generator(this, function (_a) {return [2 /*return*/]; }); }); } diff --git a/tests/baselines/reference/asyncFunctionDeclaration3_es5.js b/tests/baselines/reference/asyncFunctionDeclaration3_es5.js index 0bcc99b6bc7b2..3e9e90afb3cd1 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration3_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration3_es5.js @@ -3,6 +3,5 @@ function f(await = await) { } //// [asyncFunctionDeclaration3_es5.js] -function f(await) { - if (await === void 0) { await = await; } +function f(await) {if (await === void 0) { await = await; } } diff --git a/tests/baselines/reference/asyncFunctionDeclaration5_es5.js b/tests/baselines/reference/asyncFunctionDeclaration5_es5.js index 7ebe3a54f54cf..826d32fe1943a 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration5_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration5_es5.js @@ -4,9 +4,7 @@ async function foo(await): Promise { //// [asyncFunctionDeclaration5_es5.js] function foo(await) { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, void 0, function () {return __generator(this, function (_a) {return [2 /*return*/]; }); }); } diff --git a/tests/baselines/reference/asyncFunctionDeclaration6_es5.js b/tests/baselines/reference/asyncFunctionDeclaration6_es5.js index 282036f97def1..c937fde64b5c8 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration6_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration6_es5.js @@ -3,11 +3,8 @@ async function foo(a = await): Promise { } //// [asyncFunctionDeclaration6_es5.js] -function foo(a) { - if (a === void 0) { a = yield ; } - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - return [2 /*return*/]; +function foo(a) {if (a === void 0) { a = yield ; } + return __awaiter(this, void 0, void 0, function () {return __generator(this, function (_a) {return [2 /*return*/]; }); }); } diff --git a/tests/baselines/reference/asyncFunctionDeclaration7_es5.js b/tests/baselines/reference/asyncFunctionDeclaration7_es5.js index 60dd0d6e3bf32..b5ed40d361695 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration7_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration7_es5.js @@ -9,16 +9,12 @@ async function bar(): Promise { function bar() { return __awaiter(this, void 0, void 0, function () { // 'await' here is an identifier, and not a yield expression. - function foo(a) { - if (a === void 0) { a = yield ; } - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - return [2 /*return*/]; + function foo(a) {if (a === void 0) { a = yield ; } + return __awaiter(this, void 0, void 0, function () {return __generator(this, function (_a) {return [2 /*return*/]; }); }); } - return __generator(this, function (_a) { - return [2 /*return*/]; + return __generator(this, function (_a) {return [2 /*return*/]; }); }); } diff --git a/tests/baselines/reference/asyncFunctionDeclaration9_es5.js b/tests/baselines/reference/asyncFunctionDeclaration9_es5.js index 505ed08d840f1..6a7060502622e 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration9_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration9_es5.js @@ -5,16 +5,11 @@ async function foo(): Promise { //// [asyncFunctionDeclaration9_es5.js] function foo() { - return __awaiter(this, void 0, void 0, function () { - var v; + return __awaiter(this, void 0, void 0, function () {var v; var _a; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - _a = {}; + return __generator(this, function (_b) {switch (_b.label) {case 0:_a = {}; return [4 /*yield*/, ]; - case 1: - v = (_a[_b.sent()] = foo, _a); + case 1:v = (_a[_b.sent()] = foo, _a); return [2 /*return*/]; } }); diff --git a/tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5.js b/tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5.js index aa642819add4c..0c4c22e99deec 100644 --- a/tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5.js @@ -16,10 +16,7 @@ var C = /** @class */ (function () { C.prototype.method = function () { function other() { } function fn() { - return __awaiter(this, arguments, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, other.apply(this, arguments)]; + return __awaiter(this, arguments, void 0, function () {return __generator(this, function (_a) {switch (_a.label) {case 0: return [4 /*yield*/, other.apply(this, arguments)]; case 1: _a.sent(); return [2 /*return*/]; diff --git a/tests/baselines/reference/asyncFunctionNoReturnType.js b/tests/baselines/reference/asyncFunctionNoReturnType.js index 430210cbdbc14..138010371884d 100644 --- a/tests/baselines/reference/asyncFunctionNoReturnType.js +++ b/tests/baselines/reference/asyncFunctionNoReturnType.js @@ -43,8 +43,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) { } }; var _this = this; -(function () { return __awaiter(_this, void 0, void 0, function () { - return __generator(this, function (_a) { +(function () { return __awaiter(_this, void 0, void 0, function () {return __generator(this, function (_a) { if (window) return [2 /*return*/]; return [2 /*return*/]; diff --git a/tests/baselines/reference/asyncFunctionReturnExpressionErrorSpans.js b/tests/baselines/reference/asyncFunctionReturnExpressionErrorSpans.js index 887484e933a2a..39cd666e47ebb 100644 --- a/tests/baselines/reference/asyncFunctionReturnExpressionErrorSpans.js +++ b/tests/baselines/reference/asyncFunctionReturnExpressionErrorSpans.js @@ -58,9 +58,9 @@ var __generator = (this && this.__generator) || function (thisArg, body) { if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; + function asyncFoo() { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { + return __awaiter(this, void 0, void 0, function () {return __generator(this, function (_a) { return [2 /*return*/, { bar: { baz: { diff --git a/tests/baselines/reference/asyncFunctionReturnType.js b/tests/baselines/reference/asyncFunctionReturnType.js index 04b3a04a036d3..b82eb80947c74 100644 --- a/tests/baselines/reference/asyncFunctionReturnType.js +++ b/tests/baselines/reference/asyncFunctionReturnType.js @@ -84,89 +84,105 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); -}; -function fAsync() { +};function fAsync() { return __awaiter(this, void 0, void 0, function* () { // Without explicit type annotation, this is just an array. return [1, true]; }); } + function fAsyncExplicit() { return __awaiter(this, void 0, void 0, function* () { // This is contextually typed as a tuple. return [1, true]; }); } + + function fIndexedTypeForStringProp(obj) { return __awaiter(this, void 0, void 0, function* () { return obj.stringProp; }); } + function fIndexedTypeForPromiseOfStringProp(obj) { return __awaiter(this, void 0, void 0, function* () { return Promise.resolve(obj.stringProp); }); } + function fIndexedTypeForExplicitPromiseOfStringProp(obj) { return __awaiter(this, void 0, void 0, function* () { return Promise.resolve(obj.stringProp); }); } + function fIndexedTypeForAnyProp(obj) { return __awaiter(this, void 0, void 0, function* () { return obj.anyProp; }); } + function fIndexedTypeForPromiseOfAnyProp(obj) { return __awaiter(this, void 0, void 0, function* () { return Promise.resolve(obj.anyProp); }); } + function fIndexedTypeForExplicitPromiseOfAnyProp(obj) { return __awaiter(this, void 0, void 0, function* () { return Promise.resolve(obj.anyProp); }); } + function fGenericIndexedTypeForStringProp(obj) { return __awaiter(this, void 0, void 0, function* () { return obj.stringProp; }); } + function fGenericIndexedTypeForPromiseOfStringProp(obj) { return __awaiter(this, void 0, void 0, function* () { return Promise.resolve(obj.stringProp); }); } + function fGenericIndexedTypeForExplicitPromiseOfStringProp(obj) { return __awaiter(this, void 0, void 0, function* () { return Promise.resolve(obj.stringProp); }); } + function fGenericIndexedTypeForAnyProp(obj) { return __awaiter(this, void 0, void 0, function* () { return obj.anyProp; }); } + function fGenericIndexedTypeForPromiseOfAnyProp(obj) { return __awaiter(this, void 0, void 0, function* () { return Promise.resolve(obj.anyProp); }); } + function fGenericIndexedTypeForExplicitPromiseOfAnyProp(obj) { return __awaiter(this, void 0, void 0, function* () { return Promise.resolve(obj.anyProp); }); } + function fGenericIndexedTypeForKProp(obj, key) { return __awaiter(this, void 0, void 0, function* () { return obj[key]; }); } + function fGenericIndexedTypeForPromiseOfKProp(obj, key) { return __awaiter(this, void 0, void 0, function* () { return Promise.resolve(obj[key]); }); } + function fGenericIndexedTypeForExplicitPromiseOfKProp(obj, key) { return __awaiter(this, void 0, void 0, function* () { return Promise.resolve(obj[key]); diff --git a/tests/baselines/reference/asyncFunctionTempVariableScoping.js b/tests/baselines/reference/asyncFunctionTempVariableScoping.js index 3a6da56c993f8..89631da425e1b 100644 --- a/tests/baselines/reference/asyncFunctionTempVariableScoping.js +++ b/tests/baselines/reference/asyncFunctionTempVariableScoping.js @@ -53,12 +53,9 @@ var __rest = (this && this.__rest) || function (s, e) { return t; }; var _this = this; -(function (_a) { return __awaiter(_this, void 0, void 0, function () { - var _b; +(function (_a) { return __awaiter(_this, void 0, void 0, function () {var _b; var foo = _a.foo, bar = _a.bar, rest = __rest(_a, ["foo", "bar"]); - return __generator(this, function (_c) { - switch (_c.label) { - case 0: + return __generator(this, function (_c) {switch (_c.label) {case 0: _b = bar; return [4 /*yield*/, foo]; case 1: return [2 /*return*/, _b.apply(void 0, [_c.sent()])]; diff --git a/tests/baselines/reference/asyncFunctionWithForStatementNoInitializer.js b/tests/baselines/reference/asyncFunctionWithForStatementNoInitializer.js index 055a751f523d1..8fd9f34091a9b 100644 --- a/tests/baselines/reference/asyncFunctionWithForStatementNoInitializer.js +++ b/tests/baselines/reference/asyncFunctionWithForStatementNoInitializer.js @@ -60,12 +60,9 @@ var __generator = (this && this.__generator) || function (thisArg, body) { } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } -}; -function test1() { - return __awaiter(this, void 0, void 0, function () { - var i, limit; - return __generator(this, function (_a) { - i = 0; +};function test1() { + return __awaiter(this, void 0, void 0, function () {var i, limit; + return __generator(this, function (_a) {i = 0; limit = 10; for (; i < limit; ++i) { } @@ -73,11 +70,10 @@ function test1() { }); }); } + function test2() { - return __awaiter(this, void 0, void 0, function () { - var i, limit; - return __generator(this, function (_a) { - i = 0; + return __awaiter(this, void 0, void 0, function () {var i, limit; + return __generator(this, function (_a) {i = 0; limit = 10; for (i = 1; i < limit; ++i) { } @@ -85,20 +81,19 @@ function test2() { }); }); } + function test3() { - return __awaiter(this, void 0, void 0, function () { - var i; - return __generator(this, function (_a) { - i = 0; + return __awaiter(this, void 0, void 0, function () {var i; + return __generator(this, function (_a) {i = 0; for (;; ++i) { } return [2 /*return*/]; }); }); } + function test4() { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { + return __awaiter(this, void 0, void 0, function () {return __generator(this, function (_a) { for (;;) { } return [2 /*return*/]; diff --git a/tests/baselines/reference/asyncFunctionsAcrossFiles.js b/tests/baselines/reference/asyncFunctionsAcrossFiles.js index 642558c7206b7..91240512f76d8 100644 --- a/tests/baselines/reference/asyncFunctionsAcrossFiles.js +++ b/tests/baselines/reference/asyncFunctionsAcrossFiles.js @@ -24,8 +24,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); -}; -import { a } from './a'; +};import { a } from './a'; export const b = { f: () => __awaiter(void 0, void 0, void 0, function* () { yield a.f(); @@ -40,8 +39,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); -}; -import { b } from './b'; +};import { b } from './b'; export const a = { f: () => __awaiter(void 0, void 0, void 0, function* () { yield b.f(); diff --git a/tests/baselines/reference/asyncFunctionsAndStrictNullChecks.js b/tests/baselines/reference/asyncFunctionsAndStrictNullChecks.js index a13f2f8b2195a..dd274280c9343 100644 --- a/tests/baselines/reference/asyncFunctionsAndStrictNullChecks.js +++ b/tests/baselines/reference/asyncFunctionsAndStrictNullChecks.js @@ -35,11 +35,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; + function sample(promise) { return __awaiter(this, void 0, void 0, function* () { var number = yield promise; }); } + + + function sample2(x) { return __awaiter(this, void 0, void 0, function* () { let x1 = yield resolve1(x); diff --git a/tests/baselines/reference/asyncIIFE.js b/tests/baselines/reference/asyncIIFE.js index e2096b4c6dea1..7acc44f55f4bd 100644 --- a/tests/baselines/reference/asyncIIFE.js +++ b/tests/baselines/reference/asyncIIFE.js @@ -18,8 +18,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); -}; -function f1() { +};function f1() { (() => __awaiter(this, void 0, void 0, function* () { yield 10; throw new Error(); diff --git a/tests/baselines/reference/asyncImportNestedYield.js b/tests/baselines/reference/asyncImportNestedYield.js index b92065950fbf3..41cdfc1346d00 100644 --- a/tests/baselines/reference/asyncImportNestedYield.js +++ b/tests/baselines/reference/asyncImportNestedYield.js @@ -42,12 +42,8 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } -}; -function foo() { - return __asyncGenerator(this, arguments, function foo_1() { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, __await("foo")]; +};function foo() { + return __asyncGenerator(this, arguments, function foo_1() {return __generator(this, function (_a) {switch (_a.label) {case 0: return [4 /*yield*/, __await("foo")]; case 1: return [4 /*yield*/, _a.sent()]; case 2: return [4 /*yield*/, __await.apply(void 0, [Promise.resolve().then(function () { return require(_a.sent()); })])]; case 3: diff --git a/tests/baselines/reference/asyncImportedPromise_es6.js b/tests/baselines/reference/asyncImportedPromise_es6.js index 3ba87df293912..380d23dce68b7 100644 --- a/tests/baselines/reference/asyncImportedPromise_es6.js +++ b/tests/baselines/reference/asyncImportedPromise_es6.js @@ -13,8 +13,7 @@ class Test { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Task = void 0; -class Task extends Promise { -} +class Task extends Promise {} exports.Task = Task; //// [test.js] "use strict"; diff --git a/tests/baselines/reference/asyncMethodWithSuperConflict_es6.js b/tests/baselines/reference/asyncMethodWithSuperConflict_es6.js index 5e2a152b9e003..9ab7588a1e572 100644 --- a/tests/baselines/reference/asyncMethodWithSuperConflict_es6.js +++ b/tests/baselines/reference/asyncMethodWithSuperConflict_es6.js @@ -68,8 +68,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); -}; -class A { +};class A { x() { } y() { @@ -90,14 +89,18 @@ class B extends A { _super_1.x.call(this); // call additional property. _super_1.y.call(this); + // call with element access _superIndex_1("x").call(this); + // property access (read) const a = _super_1.x; + // element access (read) const b = _superIndex_1("x"); }); } + // async method with assignment/destructuring on 'super' requires a binding advanced() { const _superIndex_1 = (function (geti, seti) { @@ -111,20 +114,28 @@ class B extends A { const _super = null; const _superIndex = null; const f = () => { }; + // call with property access _super_1.x.call(this); + // call with element access _superIndex_1("x").value.call(this); + // property access (read) const a = _super_1.x; + // element access (read) const b = _superIndex_1("x").value; + // property access (assign) _super_1.x = f; + // element access (assign) _superIndex_1("x").value = f; + // destructuring assign with property access ({ f: _super_1.x } = { f }); + // destructuring assign with element access ({ f: _superIndex_1("x").value } = { f }); }); diff --git a/tests/baselines/reference/asyncMethodWithSuper_es2017.js b/tests/baselines/reference/asyncMethodWithSuper_es2017.js index 4c5a7aa9866fc..5603f80bf9af4 100644 --- a/tests/baselines/reference/asyncMethodWithSuper_es2017.js +++ b/tests/baselines/reference/asyncMethodWithSuper_es2017.js @@ -62,6 +62,7 @@ class A { y() { } } + class B extends A { // async method with only call/get on 'super' does not require a binding async simple() { @@ -69,30 +70,42 @@ class B extends A { super.x(); // call additional property. super.y(); + // call with element access super["x"](); + // property access (read) const a = super.x; + // element access (read) const b = super["x"]; } + // async method with assignment/destructuring on 'super' requires a binding async advanced() { const f = () => { }; + // call with property access super.x(); + // call with element access super["x"](); + // property access (read) const a = super.x; + // element access (read) const b = super["x"]; + // property access (assign) super.x = f; + // element access (assign) super["x"] = f; + // destructuring assign with property access ({ f: super.x } = { f }); + // destructuring assign with element access ({ f: super["x"] } = { f }); } diff --git a/tests/baselines/reference/asyncMethodWithSuper_es5.js b/tests/baselines/reference/asyncMethodWithSuper_es5.js index 441ad8875c412..f3908ffbf5e52 100644 --- a/tests/baselines/reference/asyncMethodWithSuper_es5.js +++ b/tests/baselines/reference/asyncMethodWithSuper_es5.js @@ -72,13 +72,13 @@ var B = /** @class */ (function (_super) { } // async method with only call/get on 'super' does not require a binding B.prototype.simple = function () { - return __awaiter(this, void 0, void 0, function () { - var a, b; + return __awaiter(this, void 0, void 0, function () {var a, b; return __generator(this, function (_a) { // call with property access _super.prototype.x.call(this); // call additional property. _super.prototype.y.call(this); + // call with element access _super.prototype["x"].call(this); a = _super.prototype.x; @@ -87,24 +87,27 @@ var B = /** @class */ (function (_super) { }); }); }; + // async method with assignment/destructuring on 'super' requires a binding B.prototype.advanced = function () { - return __awaiter(this, void 0, void 0, function () { - var f, a, b; - return __generator(this, function (_a) { - f = function () { }; + return __awaiter(this, void 0, void 0, function () {var f, a, b; + return __generator(this, function (_a) {f = function () { }; // call with property access _super.prototype.x.call(this); + // call with element access _super.prototype["x"].call(this); a = _super.prototype.x; b = _super.prototype["x"]; // property access (assign) _super.prototype.x = f; + // element access (assign) _super.prototype["x"] = f; + // destructuring assign with property access (_super.prototype.x = { f: f }.f); + // destructuring assign with element access (_super.prototype["x"] = { f: f }.f); return [2 /*return*/]; diff --git a/tests/baselines/reference/asyncMethodWithSuper_es6.js b/tests/baselines/reference/asyncMethodWithSuper_es6.js index a5f216d221a7d..392f69f3726cf 100644 --- a/tests/baselines/reference/asyncMethodWithSuper_es6.js +++ b/tests/baselines/reference/asyncMethodWithSuper_es6.js @@ -207,14 +207,18 @@ class B extends A { _super.x.call(this); // call additional property. _super.y.call(this); + // call with element access _superIndex("x").call(this); + // property access (read) const a = _super.x; + // element access (read) const b = _superIndex("x"); }); } + // async method with assignment/destructuring on 'super' requires a binding advanced() { const _superIndex = (function (geti, seti) { @@ -226,32 +230,44 @@ class B extends A { }); return __awaiter(this, void 0, void 0, function* () { const f = () => { }; + // call with property access _super.x.call(this); + // call with element access _superIndex("x").value.call(this); + // property access (read) const a = _super.x; + // element access (read) const b = _superIndex("x").value; + // property access (assign) _super.x = f; + // element access (assign) _superIndex("x").value = f; + // destructuring assign with property access ({ f: _super.x } = { f }); + // destructuring assign with element access ({ f: _superIndex("x").value } = { f }); + // property access in arrow (() => _super.x.call(this)); + // element access in arrow (() => _superIndex("x").value.call(this)); // property access in async arrow (() => __awaiter(this, void 0, void 0, function* () { return _super.x.call(this); })); + // element access in async arrow (() => __awaiter(this, void 0, void 0, function* () { return _superIndex("x").value.call(this); })); }); } + property_access_only_read_only() { const _super = Object.create(null, { x: { get: () => super.x } @@ -259,43 +275,53 @@ class B extends A { return __awaiter(this, void 0, void 0, function* () { // call with property access _super.x.call(this); + // property access (read) const a = _super.x; + // property access in arrow (() => _super.x.call(this)); // property access in async arrow (() => __awaiter(this, void 0, void 0, function* () { return _super.x.call(this); })); }); } + property_access_only_write_only() { const _super = Object.create(null, { x: { get: () => super.x, set: v => super.x = v } }); return __awaiter(this, void 0, void 0, function* () { const f = () => { }; + // property access (assign) _super.x = f; + // destructuring assign with property access ({ f: _super.x } = { f }); + // property access (assign) in arrow (() => _super.x = f); // property access (assign) in async arrow (() => __awaiter(this, void 0, void 0, function* () { return _super.x = f; })); }); } + element_access_only_read_only() { const _superIndex = name => super[name]; return __awaiter(this, void 0, void 0, function* () { // call with element access _superIndex("x").call(this); + // element access (read) const a = _superIndex("x"); + // element access in arrow (() => _superIndex("x").call(this)); // element access in async arrow (() => __awaiter(this, void 0, void 0, function* () { return _superIndex("x").call(this); })); }); } + element_access_only_write_only() { const _superIndex = (function (geti, seti) { const cache = Object.create(null); @@ -303,16 +329,20 @@ class B extends A { })(name => super[name], (name, value) => super[name] = value); return __awaiter(this, void 0, void 0, function* () { const f = () => { }; + // element access (assign) _superIndex("x").value = f; + // destructuring assign with element access ({ f: _superIndex("x").value } = { f }); + // element access (assign) in arrow (() => _superIndex("x").value = f); // element access (assign) in async arrow (() => __awaiter(this, void 0, void 0, function* () { return _superIndex("x").value = f; })); }); } + property_access_only_read_only_in_generator() { const _super = Object.create(null, { x: { get: () => super.x } @@ -320,44 +350,54 @@ class B extends A { return __asyncGenerator(this, arguments, function* property_access_only_read_only_in_generator_1() { // call with property access _super.x.call(this); + // property access (read) const a = _super.x; + // property access in arrow (() => _super.x.call(this)); // property access in async arrow (() => __awaiter(this, void 0, void 0, function* () { return _super.x.call(this); })); }); } + property_access_only_write_only_in_generator() { const _super = Object.create(null, { x: { get: () => super.x, set: v => super.x = v } }); return __asyncGenerator(this, arguments, function* property_access_only_write_only_in_generator_1() { const f = () => { }; + // property access (assign) _super.x = f; + // destructuring assign with property access ({ f: _super.x } = { f }); + // property access (assign) in arrow (() => _super.x = f); // property access (assign) in async arrow (() => __awaiter(this, void 0, void 0, function* () { return _super.x = f; })); }); } + element_access_only_read_only_in_generator() { const _superIndex = name => super[name]; const _super = Object.create(null, {}); return __asyncGenerator(this, arguments, function* element_access_only_read_only_in_generator_1() { // call with element access _superIndex("x").call(this); + // element access (read) const a = _superIndex("x"); + // element access in arrow (() => _superIndex("x").call(this)); // element access in async arrow (() => __awaiter(this, void 0, void 0, function* () { return _superIndex("x").call(this); })); }); } + element_access_only_write_only_in_generator() { const _superIndex = (function (geti, seti) { const cache = Object.create(null); @@ -366,10 +406,13 @@ class B extends A { const _super = Object.create(null, {}); return __asyncGenerator(this, arguments, function* element_access_only_write_only_in_generator_1() { const f = () => { }; + // element access (assign) _superIndex("x").value = f; + // destructuring assign with element access ({ f: _superIndex("x").value } = { f }); + // element access (assign) in arrow (() => _superIndex("x").value = f); // element access (assign) in async arrow diff --git a/tests/baselines/reference/asyncMultiFile_es5.js b/tests/baselines/reference/asyncMultiFile_es5.js index 392a4456cc296..809cf71a96da3 100644 --- a/tests/baselines/reference/asyncMultiFile_es5.js +++ b/tests/baselines/reference/asyncMultiFile_es5.js @@ -41,10 +41,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) { } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } -}; -function f() { - return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - return [2 /*return*/]; +};function f() { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {return [2 /*return*/]; }); }); } //// [b.js] diff --git a/tests/baselines/reference/asyncMultiFile_es6.js b/tests/baselines/reference/asyncMultiFile_es6.js index 7fbb00063c7aa..7bbd6b63aa3b9 100644 --- a/tests/baselines/reference/asyncMultiFile_es6.js +++ b/tests/baselines/reference/asyncMultiFile_es6.js @@ -14,8 +14,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); -}; -function f() { +};function f() { return __awaiter(this, void 0, void 0, function* () { }); } //// [b.js] diff --git a/tests/baselines/reference/asyncQualifiedReturnType_es5.js b/tests/baselines/reference/asyncQualifiedReturnType_es5.js index 601dc8b3c476e..2a9a22de4c34b 100644 --- a/tests/baselines/reference/asyncQualifiedReturnType_es5.js +++ b/tests/baselines/reference/asyncQualifiedReturnType_es5.js @@ -20,9 +20,7 @@ var X; X.MyPromise = MyPromise; })(X || (X = {})); function f() { - return __awaiter(this, void 0, X.MyPromise, function () { - return __generator(this, function (_a) { - return [2 /*return*/]; + return __awaiter(this, void 0, X.MyPromise, function () {return __generator(this, function (_a) {return [2 /*return*/]; }); }); } diff --git a/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5.js b/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5.js index 93062b6feee11..96841946f770d 100644 --- a/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5.js +++ b/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5.js @@ -5,15 +5,11 @@ const x1 = async (i) => await someOtherFunction(i); //// [asyncUnParenthesizedArrowFunction_es5.js] var _this = this; -var x = function (i) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, someOtherFunction(i)]; +var x = function (i) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {switch (_a.label) {case 0: return [4 /*yield*/, someOtherFunction(i)]; case 1: return [2 /*return*/, _a.sent()]; } }); }); }; -var x1 = function (i) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, someOtherFunction(i)]; +var x1 = function (i) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {switch (_a.label) {case 0: return [4 /*yield*/, someOtherFunction(i)]; case 1: return [2 /*return*/, _a.sent()]; } }); }); }; diff --git a/tests/baselines/reference/asyncUseStrict_es5.js b/tests/baselines/reference/asyncUseStrict_es5.js index 0a1b61b96d8aa..e806e87d7359c 100644 --- a/tests/baselines/reference/asyncUseStrict_es5.js +++ b/tests/baselines/reference/asyncUseStrict_es5.js @@ -9,13 +9,9 @@ async function func(): Promise { //// [asyncUseStrict_es5.js] function func() { "use strict"; - return __awaiter(this, void 0, void 0, function () { - var b; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, p]; - case 1: - b = (_a.sent()) || a; + return __awaiter(this, void 0, void 0, function () {var b; + return __generator(this, function (_a) {switch (_a.label) {case 0: return [4 /*yield*/, p]; + case 1:b = (_a.sent()) || a; return [2 /*return*/]; } }); diff --git a/tests/baselines/reference/asyncWithVarShadowing_es6.js b/tests/baselines/reference/asyncWithVarShadowing_es6.js index ecdffcd25a588..5d30aa7b0c242 100644 --- a/tests/baselines/reference/asyncWithVarShadowing_es6.js +++ b/tests/baselines/reference/asyncWithVarShadowing_es6.js @@ -223,115 +223,121 @@ async function fn40(x) { //// [asyncWithVarShadowing_es6.js] + function fn1(x) { var x; return __awaiter(this, void 0, void 0, function* () { }); } + function fn2(x) { var x, z; return __awaiter(this, void 0, void 0, function* () { }); } + function fn3(x) { return __awaiter(this, void 0, void 0, function* () { var z; }); } + function fn4(x) { var x; - return __awaiter(this, void 0, void 0, function* () { - x = y; + return __awaiter(this, void 0, void 0, function* () {x = y; }); } + function fn5(x) { var x; - return __awaiter(this, void 0, void 0, function* () { - ({ x } = y); + return __awaiter(this, void 0, void 0, function* () {({ x } = y); }); } + function fn6(x) { var x, z; - return __awaiter(this, void 0, void 0, function* () { - ({ x, z } = y); + return __awaiter(this, void 0, void 0, function* () {({ x, z } = y); }); } + function fn7(x) { var x; - return __awaiter(this, void 0, void 0, function* () { - ({ x = y } = y); + return __awaiter(this, void 0, void 0, function* () {({ x = y } = y); }); } + function fn8(x) { var x; - return __awaiter(this, void 0, void 0, function* () { - ({ z: x } = y); + return __awaiter(this, void 0, void 0, function* () {({ z: x } = y); }); } + function fn9(x) { var x; - return __awaiter(this, void 0, void 0, function* () { - ({ z: { x } } = y); + return __awaiter(this, void 0, void 0, function* () {({ z: { x } } = y); }); } + function fn10(x) { var x; - return __awaiter(this, void 0, void 0, function* () { - ({ z: { x } = y } = y); + return __awaiter(this, void 0, void 0, function* () {({ z: { x } = y } = y); }); } + function fn11(x) { var x; - return __awaiter(this, void 0, void 0, function* () { - x = __rest(y, []); + return __awaiter(this, void 0, void 0, function* () {x = __rest(y, []); }); } + function fn12(x) { var x; - return __awaiter(this, void 0, void 0, function* () { - [x] = y; + return __awaiter(this, void 0, void 0, function* () {[x] = y; }); } + function fn13(x) { var x; - return __awaiter(this, void 0, void 0, function* () { - [x = y] = y; + return __awaiter(this, void 0, void 0, function* () {[x = y] = y; }); } + function fn14(x) { var x; - return __awaiter(this, void 0, void 0, function* () { - [, x] = y; + return __awaiter(this, void 0, void 0, function* () {[, x] = y; }); } + function fn15(x) { var x; - return __awaiter(this, void 0, void 0, function* () { - [...x] = y; + return __awaiter(this, void 0, void 0, function* () {[...x] = y; }); } + function fn16(x) { var x; - return __awaiter(this, void 0, void 0, function* () { - [[x]] = y; + return __awaiter(this, void 0, void 0, function* () {[[x]] = y; }); } + function fn17(x) { var x; - return __awaiter(this, void 0, void 0, function* () { - [[x] = y] = y; + return __awaiter(this, void 0, void 0, function* () {[[x] = y] = y; }); } + function fn18({ x }) { var x; return __awaiter(this, void 0, void 0, function* () { }); } + function fn19([x]) { var x; return __awaiter(this, void 0, void 0, function* () { }); } + function fn20(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -339,6 +345,7 @@ function fn20(x) { } }); } + function fn21(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -346,6 +353,7 @@ function fn21(x) { } }); } + function fn22(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -355,6 +363,7 @@ function fn22(x) { } }); } + function fn23(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -364,6 +373,7 @@ function fn23(x) { } }); } + function fn24(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -373,6 +383,7 @@ function fn24(x) { } }); } + function fn25(x) { return __awaiter(this, void 0, void 0, function* () { try { @@ -382,6 +393,7 @@ function fn25(x) { } }); } + function fn26(x) { return __awaiter(this, void 0, void 0, function* () { try { @@ -391,6 +403,7 @@ function fn26(x) { } }); } + function fn27(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -400,6 +413,7 @@ function fn27(x) { } }); } + function fn28(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -407,13 +421,16 @@ function fn28(x) { } }); } + function fn29(x) { var x; return __awaiter(this, void 0, void 0, function* () { do { - } while (y); + } + while (y); }); } + function fn30(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -421,6 +438,7 @@ function fn30(x) { } }); } + function fn31(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -428,6 +446,7 @@ function fn31(x) { } }); } + function fn32(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -435,6 +454,7 @@ function fn32(x) { } }); } + function fn33(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -442,6 +462,7 @@ function fn33(x) { } }); } + function fn34(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -449,6 +470,7 @@ function fn34(x) { } }); } + function fn35(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -456,6 +478,7 @@ function fn35(x) { } }); } + function fn36(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -463,6 +486,7 @@ function fn36(x) { } }); } + function fn37(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -470,6 +494,7 @@ function fn37(x) { } }); } + function fn38(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -478,6 +503,7 @@ function fn38(x) { } }); } + function fn39(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -486,6 +512,7 @@ function fn39(x) { } }); } + function fn40(x) { var x; return __awaiter(this, void 0, void 0, function* () { diff --git a/tests/baselines/reference/augmentExportEquals1.js b/tests/baselines/reference/augmentExportEquals1.js index 99a6e2e4bb00d..b836e82141555 100644 --- a/tests/baselines/reference/augmentExportEquals1.js +++ b/tests/baselines/reference/augmentExportEquals1.js @@ -20,18 +20,15 @@ let a: x.A; // should not work //// [file1.js] define(["require", "exports"], function (require, exports) { - "use strict"; - var x = 1; + "use strict";var x = 1; return x; }); //// [file2.js] define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; }); //// [file3.js] define(["require", "exports", "./file2"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; var a; // should not work }); diff --git a/tests/baselines/reference/augmentExportEquals1_1.js b/tests/baselines/reference/augmentExportEquals1_1.js index 780043c81ca17..3e77a08b49ddc 100644 --- a/tests/baselines/reference/augmentExportEquals1_1.js +++ b/tests/baselines/reference/augmentExportEquals1_1.js @@ -23,12 +23,10 @@ let a: x.A; // should not work //// [file2.js] define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; }); //// [file3.js] define(["require", "exports", "file2"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; var a; // should not work }); diff --git a/tests/baselines/reference/augmentExportEquals2.js b/tests/baselines/reference/augmentExportEquals2.js index 8ce1bb9010157..4c0320de073a1 100644 --- a/tests/baselines/reference/augmentExportEquals2.js +++ b/tests/baselines/reference/augmentExportEquals2.js @@ -19,18 +19,15 @@ let a: x.A; // should not work //// [file1.js] define(["require", "exports"], function (require, exports) { - "use strict"; - function foo() { } + "use strict";function foo() { } return foo; }); //// [file2.js] define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; }); //// [file3.js] define(["require", "exports", "./file2"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; var a; // should not work }); diff --git a/tests/baselines/reference/augmentExportEquals2_1.js b/tests/baselines/reference/augmentExportEquals2_1.js index 93b76c0259c80..5d383770f2778 100644 --- a/tests/baselines/reference/augmentExportEquals2_1.js +++ b/tests/baselines/reference/augmentExportEquals2_1.js @@ -22,12 +22,10 @@ let a: x.A; // should not work //// [file2.js] define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; }); //// [file3.js] define(["require", "exports", "file2"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; var a; // should not work }); diff --git a/tests/baselines/reference/augmentExportEquals3.js b/tests/baselines/reference/augmentExportEquals3.js index 3ff5f574488e4..4b7cdcb6f3130 100644 --- a/tests/baselines/reference/augmentExportEquals3.js +++ b/tests/baselines/reference/augmentExportEquals3.js @@ -25,8 +25,7 @@ let b = x.b; //// [file1.js] define(["require", "exports"], function (require, exports) { - "use strict"; - function foo() { } + "use strict";function foo() { } (function (foo) { foo.v = 1; })(foo || (foo = {})); @@ -34,14 +33,12 @@ define(["require", "exports"], function (require, exports) { }); //// [file2.js] define(["require", "exports", "./file1"], function (require, exports, x) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; x.b = 1; }); //// [file3.js] define(["require", "exports", "./file1", "./file2"], function (require, exports, x) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; var a; var b = x.b; }); diff --git a/tests/baselines/reference/augmentExportEquals3_1.js b/tests/baselines/reference/augmentExportEquals3_1.js index e91ca4498dd86..7de3effc70e5d 100644 --- a/tests/baselines/reference/augmentExportEquals3_1.js +++ b/tests/baselines/reference/augmentExportEquals3_1.js @@ -29,14 +29,12 @@ let b = x.b; //// [file2.js] define(["require", "exports", "file1"], function (require, exports, x) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; x.b = 1; }); //// [file3.js] define(["require", "exports", "file1", "file2"], function (require, exports, x) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; var a; var b = x.b; }); diff --git a/tests/baselines/reference/augmentExportEquals4.js b/tests/baselines/reference/augmentExportEquals4.js index be6c6859ba76e..b280bd28f3ba6 100644 --- a/tests/baselines/reference/augmentExportEquals4.js +++ b/tests/baselines/reference/augmentExportEquals4.js @@ -25,10 +25,8 @@ let b = x.b; //// [file1.js] define(["require", "exports"], function (require, exports) { - "use strict"; - var foo = /** @class */ (function () { - function foo() { - } + "use strict";var foo = /** @class */ (function () { + function foo() {} return foo; }()); (function (foo) { @@ -38,14 +36,12 @@ define(["require", "exports"], function (require, exports) { }); //// [file2.js] define(["require", "exports", "./file1"], function (require, exports, x) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; x.b = 1; }); //// [file3.js] define(["require", "exports", "./file1", "./file2"], function (require, exports, x) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; var a; var b = x.b; }); diff --git a/tests/baselines/reference/augmentExportEquals4_1.js b/tests/baselines/reference/augmentExportEquals4_1.js index cd2f54599699e..c9024db08769b 100644 --- a/tests/baselines/reference/augmentExportEquals4_1.js +++ b/tests/baselines/reference/augmentExportEquals4_1.js @@ -29,14 +29,12 @@ let b = x.b; //// [file2.js] define(["require", "exports", "file1"], function (require, exports, x) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; x.b = 1; }); //// [file3.js] define(["require", "exports", "file1", "file2"], function (require, exports, x) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; var a; var b = x.b; }); diff --git a/tests/baselines/reference/augmentExportEquals5.js b/tests/baselines/reference/augmentExportEquals5.js index e028b2331daf5..61ebedcb2ce2a 100644 --- a/tests/baselines/reference/augmentExportEquals5.js +++ b/tests/baselines/reference/augmentExportEquals5.js @@ -82,13 +82,11 @@ const y = x.id; //// [augmentation.js] define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; }); //// [consumer.js] define(["require", "exports", "./augmentation"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; var x; var y = x.id; }); diff --git a/tests/baselines/reference/augmentExportEquals6.js b/tests/baselines/reference/augmentExportEquals6.js index 99c6c1602bd76..a2f642669d961 100644 --- a/tests/baselines/reference/augmentExportEquals6.js +++ b/tests/baselines/reference/augmentExportEquals6.js @@ -29,35 +29,29 @@ let c = x.B.b; //// [file1.js] define(["require", "exports"], function (require, exports) { - "use strict"; - var foo = /** @class */ (function () { - function foo() { - } + "use strict";var foo = /** @class */ (function () { + function foo() {} return foo; }()); (function (foo) { var A = /** @class */ (function () { - function A() { - } + function A() {} return A; }()); foo.A = A; var B; - (function (B) { - })(B = foo.B || (foo.B = {})); + (function (B) {})(B = foo.B || (foo.B = {})); })(foo || (foo = {})); return foo; }); //// [file2.js] define(["require", "exports", "./file1"], function (require, exports, x) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; x.B.b = 1; }); //// [file3.js] define(["require", "exports", "./file1", "./file2"], function (require, exports, x) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; var a; var b = a.a; var c = x.B.b; diff --git a/tests/baselines/reference/augmentExportEquals6_1.js b/tests/baselines/reference/augmentExportEquals6_1.js index d1c7170993b9e..c41fd9b69829c 100644 --- a/tests/baselines/reference/augmentExportEquals6_1.js +++ b/tests/baselines/reference/augmentExportEquals6_1.js @@ -27,13 +27,11 @@ let b = a.a; //// [file2.js] define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; }); //// [file3.js] define(["require", "exports", "file2"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; var a; var b = a.a; }); diff --git a/tests/baselines/reference/augmentedTypeAssignmentCompatIndexSignature.js b/tests/baselines/reference/augmentedTypeAssignmentCompatIndexSignature.js index 32fed237a2ea0..0a07710b4a7d7 100644 --- a/tests/baselines/reference/augmentedTypeAssignmentCompatIndexSignature.js +++ b/tests/baselines/reference/augmentedTypeAssignmentCompatIndexSignature.js @@ -22,7 +22,11 @@ var v2: { } = f; // Should be allowed //// [augmentedTypeAssignmentCompatIndexSignature.js] + + var o = {}; var f = function () { }; + var v1 = o; // Should be allowed + var v2 = f; // Should be allowed diff --git a/tests/baselines/reference/augmentedTypeBracketAccessIndexSignature.js b/tests/baselines/reference/augmentedTypeBracketAccessIndexSignature.js index 8d2c94899dce7..4d846838f193a 100644 --- a/tests/baselines/reference/augmentedTypeBracketAccessIndexSignature.js +++ b/tests/baselines/reference/augmentedTypeBracketAccessIndexSignature.js @@ -14,5 +14,7 @@ var a = {}[0]; // Should be Foo var b = (() => { })[0]; // Should be Bar //// [augmentedTypeBracketAccessIndexSignature.js] + + var a = {}[0]; // Should be Foo var b = (function () { })[0]; // Should be Bar diff --git a/tests/baselines/reference/augmentedTypeBracketNamedPropertyAccess.js b/tests/baselines/reference/augmentedTypeBracketNamedPropertyAccess.js index 6ec653c69b598..cb5ce1642f1c4 100644 --- a/tests/baselines/reference/augmentedTypeBracketNamedPropertyAccess.js +++ b/tests/baselines/reference/augmentedTypeBracketNamedPropertyAccess.js @@ -16,6 +16,7 @@ var r4 = f['data']; // Should be number //// [augmentedTypeBracketNamedPropertyAccess.js] var o = {}; var f = function () { }; + var r1 = o['data']; // Should be number var r2 = o['functionData']; // Should be any (no property found) var r3 = f['functionData']; // Should be string diff --git a/tests/baselines/reference/augmentedTypesClass.js b/tests/baselines/reference/augmentedTypesClass.js index 01c39c98a1a49..346c148d5f965 100644 --- a/tests/baselines/reference/augmentedTypesClass.js +++ b/tests/baselines/reference/augmentedTypesClass.js @@ -10,16 +10,14 @@ enum c4 { One } // error //// [augmentedTypesClass.js] //// class then var var c1 = /** @class */ (function () { - function c1() { - } + function c1() {} c1.prototype.foo = function () { }; return c1; }()); var c1 = 1; // error //// class then enum var c4 = /** @class */ (function () { - function c4() { - } + function c4() {} c4.prototype.foo = function () { }; return c4; }()); diff --git a/tests/baselines/reference/augmentedTypesClass2.js b/tests/baselines/reference/augmentedTypesClass2.js index a289446e53fdb..066e6ae7e24a6 100644 --- a/tests/baselines/reference/augmentedTypesClass2.js +++ b/tests/baselines/reference/augmentedTypesClass2.js @@ -41,6 +41,7 @@ var c11 = /** @class */ (function () { }; return c11; }()); + // class then class - covered // class then enum var c33 = /** @class */ (function () { diff --git a/tests/baselines/reference/augmentedTypesClass2a.js b/tests/baselines/reference/augmentedTypesClass2a.js index cbda0bb256536..f3e70c5c01b54 100644 --- a/tests/baselines/reference/augmentedTypesClass2a.js +++ b/tests/baselines/reference/augmentedTypesClass2a.js @@ -7,8 +7,7 @@ var c2 = () => { } //// [augmentedTypesClass2a.js] //// class then function var c2 = /** @class */ (function () { - function c2() { - } + function c2() {} c2.prototype.foo = function () { }; return c2; }()); // error diff --git a/tests/baselines/reference/augmentedTypesClass3.js b/tests/baselines/reference/augmentedTypesClass3.js index 045109f858777..448adca54cefd 100644 --- a/tests/baselines/reference/augmentedTypesClass3.js +++ b/tests/baselines/reference/augmentedTypesClass3.js @@ -16,14 +16,13 @@ class c5c { public foo() { } } //// [augmentedTypesClass3.js] // class then module var c5 = /** @class */ (function () { - function c5() { - } + function c5() {} c5.prototype.foo = function () { }; return c5; }()); + var c5a = /** @class */ (function () { - function c5a() { - } + function c5a() {} c5a.prototype.foo = function () { }; return c5a; }()); @@ -31,18 +30,14 @@ var c5a = /** @class */ (function () { var y = 2; })(c5a || (c5a = {})); // should be ok var c5b = /** @class */ (function () { - function c5b() { - } + function c5b() {} c5b.prototype.foo = function () { }; return c5b; }()); -(function (c5b) { - c5b.y = 2; -})(c5b || (c5b = {})); // should be ok +(function (c5b) {c5b.y = 2;})(c5b || (c5b = {})); // should be ok //// class then import var c5c = /** @class */ (function () { - function c5c() { - } + function c5c() {} c5c.prototype.foo = function () { }; return c5c; }()); diff --git a/tests/baselines/reference/augmentedTypesClass4.js b/tests/baselines/reference/augmentedTypesClass4.js index 086748bad61c0..4d826a364b052 100644 --- a/tests/baselines/reference/augmentedTypesClass4.js +++ b/tests/baselines/reference/augmentedTypesClass4.js @@ -7,14 +7,12 @@ class c3 { public bar() { } } // error //// [augmentedTypesClass4.js] //// class then class var c3 = /** @class */ (function () { - function c3() { - } + function c3() {} c3.prototype.foo = function () { }; return c3; }()); // error var c3 = /** @class */ (function () { - function c3() { - } + function c3() {} c3.prototype.bar = function () { }; return c3; }()); // error diff --git a/tests/baselines/reference/augmentedTypesEnum.js b/tests/baselines/reference/augmentedTypesEnum.js index edd4a92d76706..ee80013d5c8c0 100644 --- a/tests/baselines/reference/augmentedTypesEnum.js +++ b/tests/baselines/reference/augmentedTypesEnum.js @@ -59,8 +59,7 @@ var e4; e4[e4["One"] = 0] = "One"; })(e4 || (e4 = {})); // error var e4 = /** @class */ (function () { - function e4() { - } + function e4() {} e4.prototype.foo = function () { }; return e4; }()); // error @@ -95,9 +94,7 @@ var e6b; (function (e6b) { e6b[e6b["One"] = 0] = "One"; })(e6b || (e6b = {})); -(function (e6b) { - e6b.y = 2; -})(e6b || (e6b = {})); // should be error +(function (e6b) {e6b.y = 2;})(e6b || (e6b = {})); // should be error // enum then import, messes with error reporting //enum e7 { One } //import e7 = require(''); // should be error diff --git a/tests/baselines/reference/augmentedTypesEnum3.js b/tests/baselines/reference/augmentedTypesEnum3.js index 4df9dada5305e..6efcfaca45842 100644 --- a/tests/baselines/reference/augmentedTypesEnum3.js +++ b/tests/baselines/reference/augmentedTypesEnum3.js @@ -25,11 +25,9 @@ var E; (function (E) { var t; })(E || (E = {})); -(function (E) { -})(E || (E = {})); +(function (E) {})(E || (E = {})); var F; -(function (F) { -})(F || (F = {})); +(function (F) {})(F || (F = {})); (function (F) { var t; })(F || (F = {})); diff --git a/tests/baselines/reference/augmentedTypesExternalModule1.js b/tests/baselines/reference/augmentedTypesExternalModule1.js index 4f4e90029a6cf..f3cbcd3b93bcf 100644 --- a/tests/baselines/reference/augmentedTypesExternalModule1.js +++ b/tests/baselines/reference/augmentedTypesExternalModule1.js @@ -5,13 +5,11 @@ module c5 { } // should be ok everywhere //// [augmentedTypesExternalModule1.js] define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; exports.a = void 0; exports.a = 1; var c5 = /** @class */ (function () { - function c5() { - } + function c5() {} c5.prototype.foo = function () { }; return c5; }()); diff --git a/tests/baselines/reference/augmentedTypesFunction.js b/tests/baselines/reference/augmentedTypesFunction.js index a2dd4a664a3a7..d8d371d5925df 100644 --- a/tests/baselines/reference/augmentedTypesFunction.js +++ b/tests/baselines/reference/augmentedTypesFunction.js @@ -42,22 +42,23 @@ module y5c { export interface I { foo(): void } } // should be an error // function then var function y1() { } // error var y1 = 1; // error + + // function then function function y2() { } // error function y2() { } // error + function y2a() { } // error var y2a = function () { }; // error // function then class function y3() { } // error var y3 = /** @class */ (function () { - function y3() { - } + function y3() {} return y3; }()); // error function y3a() { } // error var y3a = /** @class */ (function () { - function y3a() { - } + function y3a() {} y3a.prototype.foo = function () { }; return y3a; }()); // error @@ -73,10 +74,11 @@ function y5a() { } var y = 2; })(y5a || (y5a = {})); // should be an error function y5b() { } -(function (y5b) { - y5b.y = 3; -})(y5b || (y5b = {})); // should be an error +(function (y5b) {y5b.y = 3;})(y5b || (y5b = {})); // should be an error function y5c() { } + + + // function then import, messes with other errors //function y6() { } //import y6 = require(''); diff --git a/tests/baselines/reference/augmentedTypesInterface.js b/tests/baselines/reference/augmentedTypesInterface.js index 0409e157584a3..5a0e5e6ae632d 100644 --- a/tests/baselines/reference/augmentedTypesInterface.js +++ b/tests/baselines/reference/augmentedTypesInterface.js @@ -35,6 +35,10 @@ interface i4 { //// [augmentedTypesInterface.js] // interface then interface + + + + var i2 = /** @class */ (function () { function i2() { } @@ -48,4 +52,5 @@ var i3; i3[i3["One"] = 0] = "One"; })(i3 || (i3 = {})); ; // error + //import i4 = require(''); // error diff --git a/tests/baselines/reference/augmentedTypesModules.js b/tests/baselines/reference/augmentedTypesModules.js index c0bb1747e6dc6..cf16c89f507a5 100644 --- a/tests/baselines/reference/augmentedTypesModules.js +++ b/tests/baselines/reference/augmentedTypesModules.js @@ -105,58 +105,45 @@ var m1a; })(m1a || (m1a = {})); // error var m1a = 1; // error var m1b; -(function (m1b) { - m1b.y = 2; -})(m1b || (m1b = {})); // error +(function (m1b) {m1b.y = 2;})(m1b || (m1b = {})); // error var m1b = 1; // error var m1c = 1; // Should be allowed var m1d; (function (m1d) { var I = /** @class */ (function () { - function I() { - } + function I() {} I.prototype.foo = function () { }; return I; }()); m1d.I = I; })(m1d || (m1d = {})); var m1d = 1; // error -function m2() { } -; // ok since the module is not instantiated +function m2() { }; // ok since the module is not instantiated var m2a; (function (m2a) { var y = 2; })(m2a || (m2a = {})); -function m2a() { } -; // error since the module is instantiated +function m2a() { }; // error since the module is instantiated var m2b; -(function (m2b) { - m2b.y = 2; -})(m2b || (m2b = {})); -function m2b() { } -; // error since the module is instantiated +(function (m2b) {m2b.y = 2;})(m2b || (m2b = {})); +function m2b() { }; // error since the module is instantiated + + // should be errors to have function first -function m2c() { } -; -(function (m2c) { - m2c.y = 2; -})(m2c || (m2c = {})); -function m2f() { } -; -function m2g() { } -; -(function (m2g) { - var C = /** @class */ (function () { - function C() { - } +function m2c() { }; +(function (m2c) {m2c.y = 2;})(m2c || (m2c = {})); + +function m2f() { }; +function m2g() { }; +(function (m2g) {var C = /** @class */ (function () { + function C() {} C.prototype.foo = function () { }; return C; }()); m2g.C = C; })(m2g || (m2g = {})); var m3 = /** @class */ (function () { - function m3() { - } + function m3() {} return m3; }()); // ok since the module is not instantiated var m3a; @@ -164,14 +151,12 @@ var m3a; var y = 2; })(m3a || (m3a = {})); var m3a = /** @class */ (function () { - function m3a() { - } + function m3a() {} m3a.prototype.foo = function () { }; return m3a; }()); // error, class isn't ambient or declared before the module var m3b = /** @class */ (function () { - function m3b() { - } + function m3b() {} m3b.prototype.foo = function () { }; return m3b; }()); @@ -179,35 +164,27 @@ var m3b = /** @class */ (function () { var y = 2; })(m3b || (m3b = {})); var m3c = /** @class */ (function () { - function m3c() { - } + function m3c() {} m3c.prototype.foo = function () { }; return m3c; }()); -(function (m3c) { - m3c.y = 2; -})(m3c || (m3c = {})); +(function (m3c) {m3c.y = 2;})(m3c || (m3c = {})); var m3d; -(function (m3d) { - m3d.y = 2; -})(m3d || (m3d = {})); +(function (m3d) {m3d.y = 2;})(m3d || (m3d = {})); var m3e; -(function (m3e) { - m3e.y = 2; -})(m3e || (m3e = {})); +(function (m3e) {m3e.y = 2;})(m3e || (m3e = {})); + + var m3g; -(function (m3g) { - var C = /** @class */ (function () { - function C() { - } +(function (m3g) {var C = /** @class */ (function () { + function C() {} C.prototype.foo = function () { }; return C; }()); m3g.C = C; })(m3g || (m3g = {})); var m4; -(function (m4) { -})(m4 || (m4 = {})); +(function (m4) {})(m4 || (m4 = {})); var m4a; (function (m4a) { var y = 2; @@ -216,9 +193,7 @@ var m4a; m4a[m4a["One"] = 0] = "One"; })(m4a || (m4a = {})); var m4b; -(function (m4b) { - m4b.y = 2; -})(m4b || (m4b = {})); +(function (m4b) {m4b.y = 2;})(m4b || (m4b = {})); (function (m4b) { m4b[m4b["One"] = 0] = "One"; })(m4b || (m4b = {})); @@ -227,10 +202,8 @@ var m4c; m4c[m4c["One"] = 0] = "One"; })(m4c || (m4c = {})); var m4d; -(function (m4d) { - var C = /** @class */ (function () { - function C() { - } +(function (m4d) {var C = /** @class */ (function () { + function C() {} C.prototype.foo = function () { }; return C; }()); @@ -240,12 +213,8 @@ var m4d; })(m4d || (m4d = {})); //// module then module var m5; -(function (m5) { - m5.y = 2; -})(m5 || (m5 = {})); +(function (m5) {m5.y = 2;})(m5 || (m5 = {})); // module then import var m6; -(function (m6) { - m6.y = 2; -})(m6 || (m6 = {})); +(function (m6) {m6.y = 2;})(m6 || (m6 = {})); //import m6 = require(''); diff --git a/tests/baselines/reference/augmentedTypesModules2.js b/tests/baselines/reference/augmentedTypesModules2.js index 995a85f39600d..65e167e7e6f9d 100644 --- a/tests/baselines/reference/augmentedTypesModules2.js +++ b/tests/baselines/reference/augmentedTypesModules2.js @@ -29,39 +29,26 @@ module m2g { export class C { foo() { } } } //// [augmentedTypesModules2.js] -function m2() { } -; // ok since the module is not instantiated +function m2() { }; // ok since the module is not instantiated var m2a; (function (m2a) { var y = 2; })(m2a || (m2a = {})); -function m2a() { } -; // error since the module is instantiated +function m2a() { }; // error since the module is instantiated var m2b; -(function (m2b) { - m2b.y = 2; -})(m2b || (m2b = {})); -function m2b() { } -; // error since the module is instantiated -function m2c() { } -; -(function (m2c) { - m2c.y = 2; -})(m2c || (m2c = {})); +(function (m2b) {m2b.y = 2;})(m2b || (m2b = {})); +function m2b() { }; // error since the module is instantiated + +function m2c() { }; +(function (m2c) {m2c.y = 2;})(m2c || (m2c = {})); var m2cc; -(function (m2cc) { - m2cc.y = 2; -})(m2cc || (m2cc = {})); -function m2cc() { } -; // error to have module first -function m2f() { } -; -function m2g() { } -; -(function (m2g) { - var C = /** @class */ (function () { - function C() { - } +(function (m2cc) {m2cc.y = 2;})(m2cc || (m2cc = {})); +function m2cc() { }; // error to have module first + +function m2f() { }; +function m2g() { }; +(function (m2g) {var C = /** @class */ (function () { + function C() {} C.prototype.foo = function () { }; return C; }()); diff --git a/tests/baselines/reference/augmentedTypesModules3.js b/tests/baselines/reference/augmentedTypesModules3.js index 0537bd092b012..3fe98481d554b 100644 --- a/tests/baselines/reference/augmentedTypesModules3.js +++ b/tests/baselines/reference/augmentedTypesModules3.js @@ -8,8 +8,7 @@ class m3a { foo() { } } // error, class isn't ambient or declared before the mod //// [augmentedTypesModules3.js] var m3 = /** @class */ (function () { - function m3() { - } + function m3() {} return m3; }()); // ok since the module is not instantiated var m3a; @@ -17,8 +16,7 @@ var m3a; var y = 2; })(m3a || (m3a = {})); var m3a = /** @class */ (function () { - function m3a() { - } + function m3a() {} m3a.prototype.foo = function () { }; return m3a; }()); // error, class isn't ambient or declared before the module diff --git a/tests/baselines/reference/augmentedTypesModules3b.js b/tests/baselines/reference/augmentedTypesModules3b.js index 57957c13b8082..5fa8825acd4e4 100644 --- a/tests/baselines/reference/augmentedTypesModules3b.js +++ b/tests/baselines/reference/augmentedTypesModules3b.js @@ -20,8 +20,7 @@ module m3g { export class C { foo() { } } } //// [augmentedTypesModules3b.js] var m3b = /** @class */ (function () { - function m3b() { - } + function m3b() {} m3b.prototype.foo = function () { }; return m3b; }()); @@ -29,27 +28,20 @@ var m3b = /** @class */ (function () { var y = 2; })(m3b || (m3b = {})); var m3c = /** @class */ (function () { - function m3c() { - } + function m3c() {} m3c.prototype.foo = function () { }; return m3c; }()); -(function (m3c) { - m3c.y = 2; -})(m3c || (m3c = {})); +(function (m3c) {m3c.y = 2;})(m3c || (m3c = {})); var m3d; -(function (m3d) { - m3d.y = 2; -})(m3d || (m3d = {})); +(function (m3d) {m3d.y = 2;})(m3d || (m3d = {})); var m3e; -(function (m3e) { - m3e.y = 2; -})(m3e || (m3e = {})); +(function (m3e) {m3e.y = 2;})(m3e || (m3e = {})); + + var m3g; -(function (m3g) { - var C = /** @class */ (function () { - function C() { - } +(function (m3g) {var C = /** @class */ (function () { + function C() {} C.prototype.foo = function () { }; return C; }()); diff --git a/tests/baselines/reference/augmentedTypesModules4.js b/tests/baselines/reference/augmentedTypesModules4.js index b7a776ca16435..d55e140e05275 100644 --- a/tests/baselines/reference/augmentedTypesModules4.js +++ b/tests/baselines/reference/augmentedTypesModules4.js @@ -24,8 +24,7 @@ module m5 { export interface I { foo(): void } } // should already be reasonably //// [augmentedTypesModules4.js] var m4; -(function (m4) { -})(m4 || (m4 = {})); +(function (m4) {})(m4 || (m4 = {})); var m4a; (function (m4a) { var y = 2; @@ -34,9 +33,7 @@ var m4a; m4a[m4a["One"] = 0] = "One"; })(m4a || (m4a = {})); var m4b; -(function (m4b) { - m4b.y = 2; -})(m4b || (m4b = {})); +(function (m4b) {m4b.y = 2;})(m4b || (m4b = {})); (function (m4b) { m4b[m4b["One"] = 0] = "One"; })(m4b || (m4b = {})); @@ -45,10 +42,8 @@ var m4c; m4c[m4c["One"] = 0] = "One"; })(m4c || (m4c = {})); var m4d; -(function (m4d) { - var C = /** @class */ (function () { - function C() { - } +(function (m4d) {var C = /** @class */ (function () { + function C() {} C.prototype.foo = function () { }; return C; }()); @@ -58,6 +53,4 @@ var m4d; })(m4d || (m4d = {})); //// module then module var m5; -(function (m5) { - m5.y = 2; -})(m5 || (m5 = {})); +(function (m5) {m5.y = 2;})(m5 || (m5 = {})); diff --git a/tests/baselines/reference/augmentedTypesVar.js b/tests/baselines/reference/augmentedTypesVar.js index 9945737410d3a..083e9fdcc504f 100644 --- a/tests/baselines/reference/augmentedTypesVar.js +++ b/tests/baselines/reference/augmentedTypesVar.js @@ -40,22 +40,22 @@ module x6b { export var y = 2; } // error // var then var var x1 = 1; var x1 = 2; + // var then function var x2 = 1; // error function x2() { } // error + var x3 = 1; var x3 = function () { }; // error // var then class var x4 = 1; // error var x4 = /** @class */ (function () { - function x4() { - } + function x4() {} return x4; }()); // error var x4a = 1; // error var x4a = /** @class */ (function () { - function x4a() { - } + function x4a() {} x4a.prototype.foo = function () { }; return x4a; }()); // error @@ -74,9 +74,7 @@ var x6a; })(x6a || (x6a = {})); // error since instantiated var x6b = 1; // error var x6b; -(function (x6b) { - x6b.y = 2; -})(x6b || (x6b = {})); // error +(function (x6b) {x6b.y = 2;})(x6b || (x6b = {})); // error // var then import, messes with other error reporting //var x7 = 1; //import x7 = require(''); diff --git a/tests/baselines/reference/autoLift2.js b/tests/baselines/reference/autoLift2.js index 002e320e85377..555e9e7edae95 100644 --- a/tests/baselines/reference/autoLift2.js +++ b/tests/baselines/reference/autoLift2.js @@ -42,11 +42,15 @@ var A = /** @class */ (function () { A.prototype.baz = function () { var _this = this; this.foo = "foo"; + this.bar = "bar"; [1, 2].forEach(function (p) { return _this.foo; }); + [1, 2].forEach(function (p) { return _this.bar; }); + }; return A; }()); var a = new A(); + a.baz(); diff --git a/tests/baselines/reference/autolift3.js b/tests/baselines/reference/autolift3.js index b7355aaef0e77..84a3ed65924b5 100644 --- a/tests/baselines/reference/autolift3.js +++ b/tests/baselines/reference/autolift3.js @@ -34,7 +34,9 @@ b.foo(); var B = /** @class */ (function () { function B() { function foo() { } + foo(); + var a = 0; var inner = (function () { var CScriptIO = (function () { @@ -51,4 +53,5 @@ var B = /** @class */ (function () { return B; }()); var b = new B(); + b.foo(); diff --git a/tests/baselines/reference/avoid.js b/tests/baselines/reference/avoid.js index 5882fe6c3cc24..f6578420f30f7 100644 --- a/tests/baselines/reference/avoid.js +++ b/tests/baselines/reference/avoid.js @@ -23,6 +23,7 @@ var N=new f(); // ok with void fn function f() { var x = 1; } + var y = f(); // error void fn var why = f(); // error void fn var w; diff --git a/tests/baselines/reference/awaitAndYieldInProperty.js b/tests/baselines/reference/awaitAndYieldInProperty.js index 73c04a612c2d0..a1b74da63e4e5 100644 --- a/tests/baselines/reference/awaitAndYieldInProperty.js +++ b/tests/baselines/reference/awaitAndYieldInProperty.js @@ -20,8 +20,7 @@ async function* test(x: Promise) { //// [awaitAndYieldInProperty.js] async function* test(x) { var _a, _b, _c, _d, _e, _f, _g, _h, _j; - class C { - constructor() { + class C {constructor() { this[_a] = await x; this[_c] = yield 2; } @@ -29,8 +28,7 @@ async function* test(x) { _a = await x, _b = await x, _c = yield 1, _d = yield 3; C[_b] = await x; C[_d] = yield 4; - return _j = class { - constructor() { + return _j = class {constructor() { this[_e] = await x; this[_g] = yield 2; } diff --git a/tests/baselines/reference/awaitBinaryExpression1_es5.js b/tests/baselines/reference/awaitBinaryExpression1_es5.js index 41b090d2c4636..a953de3643674 100644 --- a/tests/baselines/reference/awaitBinaryExpression1_es5.js +++ b/tests/baselines/reference/awaitBinaryExpression1_es5.js @@ -11,15 +11,11 @@ async function func(): Promise { //// [awaitBinaryExpression1_es5.js] function func() { - return __awaiter(this, void 0, void 0, function () { - var b; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: + return __awaiter(this, void 0, void 0, function () {var b; + return __generator(this, function (_a) {switch (_a.label) {case 0: before(); return [4 /*yield*/, p]; - case 1: - b = (_a.sent()) || a; + case 1:b = (_a.sent()) || a; after(); return [2 /*return*/]; } diff --git a/tests/baselines/reference/awaitBinaryExpression2_es5.js b/tests/baselines/reference/awaitBinaryExpression2_es5.js index dd84d069c27f8..9cb3ccb05fe67 100644 --- a/tests/baselines/reference/awaitBinaryExpression2_es5.js +++ b/tests/baselines/reference/awaitBinaryExpression2_es5.js @@ -11,15 +11,11 @@ async function func(): Promise { //// [awaitBinaryExpression2_es5.js] function func() { - return __awaiter(this, void 0, void 0, function () { - var b; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: + return __awaiter(this, void 0, void 0, function () {var b; + return __generator(this, function (_a) {switch (_a.label) {case 0: before(); return [4 /*yield*/, p]; - case 1: - b = (_a.sent()) && a; + case 1:b = (_a.sent()) && a; after(); return [2 /*return*/]; } diff --git a/tests/baselines/reference/awaitBinaryExpression3_es5.js b/tests/baselines/reference/awaitBinaryExpression3_es5.js index 0c301dec2c8ca..3e6b5c0cf3f7f 100644 --- a/tests/baselines/reference/awaitBinaryExpression3_es5.js +++ b/tests/baselines/reference/awaitBinaryExpression3_es5.js @@ -11,15 +11,11 @@ async function func(): Promise { //// [awaitBinaryExpression3_es5.js] function func() { - return __awaiter(this, void 0, void 0, function () { - var b; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: + return __awaiter(this, void 0, void 0, function () {var b; + return __generator(this, function (_a) {switch (_a.label) {case 0: before(); return [4 /*yield*/, p]; - case 1: - b = (_a.sent()) + a; + case 1:b = (_a.sent()) + a; after(); return [2 /*return*/]; } diff --git a/tests/baselines/reference/awaitBinaryExpression4_es5.js b/tests/baselines/reference/awaitBinaryExpression4_es5.js index 26c0e5de5f1fa..f59327f2119b3 100644 --- a/tests/baselines/reference/awaitBinaryExpression4_es5.js +++ b/tests/baselines/reference/awaitBinaryExpression4_es5.js @@ -11,15 +11,11 @@ async function func(): Promise { //// [awaitBinaryExpression4_es5.js] function func() { - return __awaiter(this, void 0, void 0, function () { - var b; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: + return __awaiter(this, void 0, void 0, function () {var b; + return __generator(this, function (_a) {switch (_a.label) {case 0: before(); return [4 /*yield*/, p]; - case 1: - b = (_a.sent(), a); + case 1:b = (_a.sent(), a); after(); return [2 /*return*/]; } diff --git a/tests/baselines/reference/awaitBinaryExpression5_es5.js b/tests/baselines/reference/awaitBinaryExpression5_es5.js index 4e07e40a174f4..3e8c0a8592951 100644 --- a/tests/baselines/reference/awaitBinaryExpression5_es5.js +++ b/tests/baselines/reference/awaitBinaryExpression5_es5.js @@ -12,11 +12,8 @@ async function func(): Promise { //// [awaitBinaryExpression5_es5.js] function func() { - return __awaiter(this, void 0, void 0, function () { - var o, _a; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: + return __awaiter(this, void 0, void 0, function () {var o, _a; + return __generator(this, function (_b) {switch (_b.label) {case 0: before(); _a = o; return [4 /*yield*/, p]; diff --git a/tests/baselines/reference/awaitCallExpression1_es5.js b/tests/baselines/reference/awaitCallExpression1_es5.js index dfc0e2cbd8494..cddd397834525 100644 --- a/tests/baselines/reference/awaitCallExpression1_es5.js +++ b/tests/baselines/reference/awaitCallExpression1_es5.js @@ -15,8 +15,7 @@ async function func(): Promise { //// [awaitCallExpression1_es5.js] function func() { - return __awaiter(this, void 0, void 0, function () { - var b; + return __awaiter(this, void 0, void 0, function () {var b; return __generator(this, function (_a) { before(); b = fn(a, a, a); diff --git a/tests/baselines/reference/awaitCallExpression2_es5.js b/tests/baselines/reference/awaitCallExpression2_es5.js index d9c51e84822d0..b002f975b70ae 100644 --- a/tests/baselines/reference/awaitCallExpression2_es5.js +++ b/tests/baselines/reference/awaitCallExpression2_es5.js @@ -15,16 +15,12 @@ async function func(): Promise { //// [awaitCallExpression2_es5.js] function func() { - return __awaiter(this, void 0, void 0, function () { - var b, _a; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: + return __awaiter(this, void 0, void 0, function () {var b, _a; + return __generator(this, function (_b) {switch (_b.label) {case 0: before(); _a = fn; return [4 /*yield*/, p]; - case 1: - b = _a.apply(void 0, [_b.sent(), a, a]); + case 1:b = _a.apply(void 0, [_b.sent(), a, a]); after(); return [2 /*return*/]; } diff --git a/tests/baselines/reference/awaitCallExpression3_es5.js b/tests/baselines/reference/awaitCallExpression3_es5.js index 685616b23dd1b..59053fef9e108 100644 --- a/tests/baselines/reference/awaitCallExpression3_es5.js +++ b/tests/baselines/reference/awaitCallExpression3_es5.js @@ -15,17 +15,13 @@ async function func(): Promise { //// [awaitCallExpression3_es5.js] function func() { - return __awaiter(this, void 0, void 0, function () { - var b, _a, _b; - return __generator(this, function (_c) { - switch (_c.label) { - case 0: + return __awaiter(this, void 0, void 0, function () {var b, _a, _b; + return __generator(this, function (_c) {switch (_c.label) {case 0: before(); _a = fn; _b = [a]; return [4 /*yield*/, p]; - case 1: - b = _a.apply(void 0, _b.concat([_c.sent(), a])); + case 1:b = _a.apply(void 0, _b.concat([_c.sent(), a])); after(); return [2 /*return*/]; } diff --git a/tests/baselines/reference/awaitCallExpression4_es5.js b/tests/baselines/reference/awaitCallExpression4_es5.js index 88c3cea35bd0d..fb5da8a1a9f67 100644 --- a/tests/baselines/reference/awaitCallExpression4_es5.js +++ b/tests/baselines/reference/awaitCallExpression4_es5.js @@ -15,15 +15,11 @@ async function func(): Promise { //// [awaitCallExpression4_es5.js] function func() { - return __awaiter(this, void 0, void 0, function () { - var b; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: + return __awaiter(this, void 0, void 0, function () {var b; + return __generator(this, function (_a) {switch (_a.label) {case 0: before(); return [4 /*yield*/, pfn]; - case 1: - b = (_a.sent())(a, a, a); + case 1:b = (_a.sent())(a, a, a); after(); return [2 /*return*/]; } diff --git a/tests/baselines/reference/awaitCallExpression5_es5.js b/tests/baselines/reference/awaitCallExpression5_es5.js index 72c0e200c8d1f..4a4c9540c5bd2 100644 --- a/tests/baselines/reference/awaitCallExpression5_es5.js +++ b/tests/baselines/reference/awaitCallExpression5_es5.js @@ -15,8 +15,7 @@ async function func(): Promise { //// [awaitCallExpression5_es5.js] function func() { - return __awaiter(this, void 0, void 0, function () { - var b; + return __awaiter(this, void 0, void 0, function () {var b; return __generator(this, function (_a) { before(); b = o.fn(a, a, a); diff --git a/tests/baselines/reference/awaitCallExpression6_es5.js b/tests/baselines/reference/awaitCallExpression6_es5.js index 23def82fee72a..d53d798b90ac9 100644 --- a/tests/baselines/reference/awaitCallExpression6_es5.js +++ b/tests/baselines/reference/awaitCallExpression6_es5.js @@ -15,16 +15,12 @@ async function func(): Promise { //// [awaitCallExpression6_es5.js] function func() { - return __awaiter(this, void 0, void 0, function () { - var b, _a, _b; - return __generator(this, function (_c) { - switch (_c.label) { - case 0: + return __awaiter(this, void 0, void 0, function () {var b, _a, _b; + return __generator(this, function (_c) {switch (_c.label) {case 0: before(); _b = (_a = o).fn; return [4 /*yield*/, p]; - case 1: - b = _b.apply(_a, [_c.sent(), a, a]); + case 1:b = _b.apply(_a, [_c.sent(), a, a]); after(); return [2 /*return*/]; } diff --git a/tests/baselines/reference/awaitCallExpression7_es5.js b/tests/baselines/reference/awaitCallExpression7_es5.js index dd69abc051417..d55978cd3adab 100644 --- a/tests/baselines/reference/awaitCallExpression7_es5.js +++ b/tests/baselines/reference/awaitCallExpression7_es5.js @@ -15,17 +15,13 @@ async function func(): Promise { //// [awaitCallExpression7_es5.js] function func() { - return __awaiter(this, void 0, void 0, function () { - var b, _a, _b, _c; - return __generator(this, function (_d) { - switch (_d.label) { - case 0: + return __awaiter(this, void 0, void 0, function () {var b, _a, _b, _c; + return __generator(this, function (_d) {switch (_d.label) {case 0: before(); _b = (_a = o).fn; _c = [a]; return [4 /*yield*/, p]; - case 1: - b = _b.apply(_a, _c.concat([_d.sent(), a])); + case 1:b = _b.apply(_a, _c.concat([_d.sent(), a])); after(); return [2 /*return*/]; } diff --git a/tests/baselines/reference/awaitCallExpression8_es5.js b/tests/baselines/reference/awaitCallExpression8_es5.js index 6d7d5dceba96d..f9b4fbc73dfe2 100644 --- a/tests/baselines/reference/awaitCallExpression8_es5.js +++ b/tests/baselines/reference/awaitCallExpression8_es5.js @@ -15,15 +15,11 @@ async function func(): Promise { //// [awaitCallExpression8_es5.js] function func() { - return __awaiter(this, void 0, void 0, function () { - var b; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: + return __awaiter(this, void 0, void 0, function () {var b; + return __generator(this, function (_a) {switch (_a.label) {case 0: before(); return [4 /*yield*/, po]; - case 1: - b = (_a.sent()).fn(a, a, a); + case 1:b = (_a.sent()).fn(a, a, a); after(); return [2 /*return*/]; } diff --git a/tests/baselines/reference/awaitClassExpression_es2017.js b/tests/baselines/reference/awaitClassExpression_es2017.js index d84f01f61cfa4..b28cf8d6c4593 100644 --- a/tests/baselines/reference/awaitClassExpression_es2017.js +++ b/tests/baselines/reference/awaitClassExpression_es2017.js @@ -8,6 +8,7 @@ async function func(): Promise { } //// [awaitClassExpression_es2017.js] + async function func() { class D extends (await p) { } diff --git a/tests/baselines/reference/awaitClassExpression_es5.js b/tests/baselines/reference/awaitClassExpression_es5.js index ecd98628c15b0..8ed3697bd391e 100644 --- a/tests/baselines/reference/awaitClassExpression_es5.js +++ b/tests/baselines/reference/awaitClassExpression_es5.js @@ -8,13 +8,10 @@ async function func(): Promise { } //// [awaitClassExpression_es5.js] + function func() { - return __awaiter(this, void 0, void 0, function () { - var D, _a; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - _a = function (_super) { + return __awaiter(this, void 0, void 0, function () {var D, _a; + return __generator(this, function (_b) {switch (_b.label) {case 0:_a = function (_super) { __extends(D, _super); function D() { return _super !== null && _super.apply(this, arguments) || this; @@ -22,8 +19,7 @@ function func() { return D; }; return [4 /*yield*/, p]; - case 1: - D = /** @class */ (_a.apply(void 0, [(_b.sent())])); + case 1:D = /** @class */ (_a.apply(void 0, [(_b.sent())])); return [2 /*return*/]; } }); diff --git a/tests/baselines/reference/awaitClassExpression_es6.js b/tests/baselines/reference/awaitClassExpression_es6.js index 26740b9de6daf..540f0988aa859 100644 --- a/tests/baselines/reference/awaitClassExpression_es6.js +++ b/tests/baselines/reference/awaitClassExpression_es6.js @@ -8,6 +8,7 @@ async function func(): Promise { } //// [awaitClassExpression_es6.js] + function func() { return __awaiter(this, void 0, void 0, function* () { class D extends (yield p) { diff --git a/tests/baselines/reference/awaitInClassInAsyncFunction.js b/tests/baselines/reference/awaitInClassInAsyncFunction.js index a9d3c38f5c640..cfd6fb9278a81 100644 --- a/tests/baselines/reference/awaitInClassInAsyncFunction.js +++ b/tests/baselines/reference/awaitInClassInAsyncFunction.js @@ -14,12 +14,12 @@ async function foo() { //// [awaitInClassInAsyncFunction.js] // https://github.com/microsoft/TypeScript/issues/34887 + async function bar() { return 2; } async function foo() { - return new class { - constructor() { + return new class {constructor() { this.baz = await bar(); } }; diff --git a/tests/baselines/reference/awaitInNonAsyncFunction.js b/tests/baselines/reference/awaitInNonAsyncFunction.js index 83f75aa5633eb..12a226fbd7634 100644 --- a/tests/baselines/reference/awaitInNonAsyncFunction.js +++ b/tests/baselines/reference/awaitInNonAsyncFunction.js @@ -42,31 +42,37 @@ await null; //// [awaitInNonAsyncFunction.js] // https://github.com/Microsoft/TypeScript/issues/26586 + function normalFunc(p) { for await (const _ of []) ; return await p; } + export function exportedFunc(p) { for await (const _ of []) ; return await p; } + const functionExpression = function (p) { for await (const _ of []) ; await p; }; + const arrowFunc = (p) => { for await (const _ of []) ; return await p; }; + function* generatorFunc(p) { for await (const _ of []) ; yield await p; } + class clazz { constructor(p) { for await (const _ of []) diff --git a/tests/baselines/reference/awaitLiteralValues.js b/tests/baselines/reference/awaitLiteralValues.js index cc5a06a0c1909..9a53b0ee2f76f 100644 --- a/tests/baselines/reference/awaitLiteralValues.js +++ b/tests/baselines/reference/awaitLiteralValues.js @@ -28,18 +28,23 @@ function awaitUndefined() { function awaitString() { yield 'literal'; } + function awaitNumber() { yield 1; } + function awaitTrue() { yield true; } + function awaitFalse() { yield false; } + function awaitNull() { yield null; } + function awaitUndefined() { yield undefined; } diff --git a/tests/baselines/reference/awaitUnionPromise.js b/tests/baselines/reference/awaitUnionPromise.js index 0698d66238e48..8d7e3b47489af 100644 --- a/tests/baselines/reference/awaitUnionPromise.js +++ b/tests/baselines/reference/awaitUnionPromise.js @@ -30,9 +30,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -class AsyncEnumeratorDone { -} -; + +class AsyncEnumeratorDone {}; + function main() { return __awaiter(this, void 0, void 0, function* () { const x = null; diff --git a/tests/baselines/reference/awaitUnion_es5.js b/tests/baselines/reference/awaitUnion_es5.js index e4ebaa4f62ec4..7cdd3fb6458de 100644 --- a/tests/baselines/reference/awaitUnion_es5.js +++ b/tests/baselines/reference/awaitUnion_es5.js @@ -14,25 +14,17 @@ async function f() { //// [awaitUnion_es5.js] function f() { - return __awaiter(this, void 0, void 0, function () { - var await_a, await_b, await_c, await_d, await_e; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, a]; - case 1: - await_a = _a.sent(); + return __awaiter(this, void 0, void 0, function () {var await_a, await_b, await_c, await_d, await_e; + return __generator(this, function (_a) {switch (_a.label) {case 0: return [4 /*yield*/, a]; + case 1:await_a = _a.sent(); return [4 /*yield*/, b]; - case 2: - await_b = _a.sent(); + case 2:await_b = _a.sent(); return [4 /*yield*/, c]; - case 3: - await_c = _a.sent(); + case 3:await_c = _a.sent(); return [4 /*yield*/, d]; - case 4: - await_d = _a.sent(); + case 4:await_d = _a.sent(); return [4 /*yield*/, e]; - case 5: - await_e = _a.sent(); + case 5:await_e = _a.sent(); return [2 /*return*/]; } }); diff --git a/tests/baselines/reference/await_unaryExpression_es2017.js b/tests/baselines/reference/await_unaryExpression_es2017.js index f05bda125fc11..e50cf6dd86de3 100644 --- a/tests/baselines/reference/await_unaryExpression_es2017.js +++ b/tests/baselines/reference/await_unaryExpression_es2017.js @@ -19,12 +19,15 @@ async function bar4() { async function bar() { !await 42; // OK } + async function bar1() { +await 42; // OK } + async function bar3() { -await 42; // OK } + async function bar4() { ~await 42; // OK } diff --git a/tests/baselines/reference/await_unaryExpression_es2017_1.js b/tests/baselines/reference/await_unaryExpression_es2017_1.js index 49a3b34b172e4..ff40c6d84358c 100644 --- a/tests/baselines/reference/await_unaryExpression_es2017_1.js +++ b/tests/baselines/reference/await_unaryExpression_es2017_1.js @@ -23,15 +23,19 @@ async function bar4() { async function bar() { !await 42; // OK } + async function bar1() { delete await 42; // OK } + async function bar2() { delete await 42; // OK } + async function bar3() { void await 42; } + async function bar4() { +await 42; } diff --git a/tests/baselines/reference/await_unaryExpression_es2017_2.js b/tests/baselines/reference/await_unaryExpression_es2017_2.js index 8978e460e7df9..54df9d904e95c 100644 --- a/tests/baselines/reference/await_unaryExpression_es2017_2.js +++ b/tests/baselines/reference/await_unaryExpression_es2017_2.js @@ -15,9 +15,11 @@ async function bar3() { async function bar1() { delete await 42; } + async function bar2() { delete await 42; } + async function bar3() { void await 42; } diff --git a/tests/baselines/reference/await_unaryExpression_es2017_3.js b/tests/baselines/reference/await_unaryExpression_es2017_3.js index b2a1593a9d0bd..e37f5887a347c 100644 --- a/tests/baselines/reference/await_unaryExpression_es2017_3.js +++ b/tests/baselines/reference/await_unaryExpression_es2017_3.js @@ -19,17 +19,18 @@ async function bar4() { //// [await_unaryExpression_es2017_3.js] async function bar1() { - ++; - await 42; // Error + ++;await 42; // Error } + async function bar2() { - --; - await 42; // Error + --;await 42; // Error } + async function bar3() { var x = 42; await x++; // OK but shouldn't need parenthesis } + async function bar4() { var x = 42; await x--; // OK but shouldn't need parenthesis diff --git a/tests/baselines/reference/await_unaryExpression_es6.js b/tests/baselines/reference/await_unaryExpression_es6.js index 69eef17361396..8efa2bed3be62 100644 --- a/tests/baselines/reference/await_unaryExpression_es6.js +++ b/tests/baselines/reference/await_unaryExpression_es6.js @@ -24,22 +24,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); -}; -function bar() { +};function bar() { return __awaiter(this, void 0, void 0, function* () { !(yield 42); // OK }); } + function bar1() { return __awaiter(this, void 0, void 0, function* () { +(yield 42); // OK }); } + function bar3() { return __awaiter(this, void 0, void 0, function* () { -(yield 42); // OK }); } + function bar4() { return __awaiter(this, void 0, void 0, function* () { ~(yield 42); // OK diff --git a/tests/baselines/reference/await_unaryExpression_es6_1.js b/tests/baselines/reference/await_unaryExpression_es6_1.js index 3a205f05ea9b1..d1c92934141ed 100644 --- a/tests/baselines/reference/await_unaryExpression_es6_1.js +++ b/tests/baselines/reference/await_unaryExpression_es6_1.js @@ -28,27 +28,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); -}; -function bar() { +};function bar() { return __awaiter(this, void 0, void 0, function* () { !(yield 42); // OK }); } + function bar1() { return __awaiter(this, void 0, void 0, function* () { delete (yield 42); // OK }); } + function bar2() { return __awaiter(this, void 0, void 0, function* () { delete (yield 42); // OK }); } + function bar3() { return __awaiter(this, void 0, void 0, function* () { void (yield 42); }); } + function bar4() { return __awaiter(this, void 0, void 0, function* () { +(yield 42); diff --git a/tests/baselines/reference/await_unaryExpression_es6_2.js b/tests/baselines/reference/await_unaryExpression_es6_2.js index ee59f5825ae43..d0af905222a3b 100644 --- a/tests/baselines/reference/await_unaryExpression_es6_2.js +++ b/tests/baselines/reference/await_unaryExpression_es6_2.js @@ -20,17 +20,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); -}; -function bar1() { +};function bar1() { return __awaiter(this, void 0, void 0, function* () { delete (yield 42); }); } + function bar2() { return __awaiter(this, void 0, void 0, function* () { delete (yield 42); }); } + function bar3() { return __awaiter(this, void 0, void 0, function* () { void (yield 42); diff --git a/tests/baselines/reference/await_unaryExpression_es6_3.js b/tests/baselines/reference/await_unaryExpression_es6_3.js index 42643caa262ae..9a79fe384c93e 100644 --- a/tests/baselines/reference/await_unaryExpression_es6_3.js +++ b/tests/baselines/reference/await_unaryExpression_es6_3.js @@ -26,25 +26,27 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); -}; -function bar1() { +};function bar1() { return __awaiter(this, void 0, void 0, function* () { ++; yield 42; // Error }); } + function bar2() { return __awaiter(this, void 0, void 0, function* () { --; yield 42; // Error }); } + function bar3() { return __awaiter(this, void 0, void 0, function* () { var x = 42; yield x++; // OK but shouldn't need parenthesis }); } + function bar4() { return __awaiter(this, void 0, void 0, function* () { var x = 42; diff --git a/tests/baselines/reference/badExternalModuleReference.js b/tests/baselines/reference/badExternalModuleReference.js index c1608b4c57e20..c4d650a047299 100644 --- a/tests/baselines/reference/badExternalModuleReference.js +++ b/tests/baselines/reference/badExternalModuleReference.js @@ -8,6 +8,5 @@ export declare var a: { //// [badExternalModuleReference.js] define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; }); diff --git a/tests/baselines/reference/badInferenceLowerPriorityThanGoodInference.js b/tests/baselines/reference/badInferenceLowerPriorityThanGoodInference.js index a089d4eb93549..802212d3e7bff 100644 --- a/tests/baselines/reference/badInferenceLowerPriorityThanGoodInference.js +++ b/tests/baselines/reference/badInferenceLowerPriorityThanGoodInference.js @@ -25,6 +25,9 @@ goofus((a: string) => ({ dog: function() { return a; } })); //// [badInferenceLowerPriorityThanGoodInference.js] // Repro from #13118 + + + var result = canYouInferThis(function () { return ({ a: { BLAH: 33 }, b: function (x) { } @@ -32,5 +35,6 @@ var result = canYouInferThis(function () { return ({ result.BLAH; // Repro from #26629 function goofus(f) { } + goofus(function (a) { return ({ dog: function () { return a; } }); }); goofus(function (a) { return ({ dog: function () { return a; } }); }); diff --git a/tests/baselines/reference/badThisBinding.js b/tests/baselines/reference/badThisBinding.js index d4ffc6731d148..39de3d69f2aef 100644 --- a/tests/baselines/reference/badThisBinding.js +++ b/tests/baselines/reference/badThisBinding.js @@ -14,6 +14,7 @@ class Greeter { } //// [badThisBinding.js] + var Greeter = /** @class */ (function () { function Greeter() { var _this = this; diff --git a/tests/baselines/reference/bangInModuleName.js b/tests/baselines/reference/bangInModuleName.js index 1a6961f59da5c..abab6d10288dd 100644 --- a/tests/baselines/reference/bangInModuleName.js +++ b/tests/baselines/reference/bangInModuleName.js @@ -17,6 +17,5 @@ import * as http from 'intern/dojo/node!http'; //// [a.js] /// define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; }); diff --git a/tests/baselines/reference/baseCheck.js b/tests/baselines/reference/baseCheck.js index 9071dd0f11065..36572b358ae4f 100644 --- a/tests/baselines/reference/baseCheck.js +++ b/tests/baselines/reference/baseCheck.js @@ -44,10 +44,8 @@ var __extends = (this && this.__extends) || (function () { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -})(); -var C = /** @class */ (function () { - function C(x, y) { - } +})();var C = /** @class */ (function () { + function C(x, y) {} return C; }()); var ELoc = /** @class */ (function (_super) { diff --git a/tests/baselines/reference/baseClassImprovedMismatchErrors.js b/tests/baselines/reference/baseClassImprovedMismatchErrors.js index 150fe523894c9..53384e5959082 100644 --- a/tests/baselines/reference/baseClassImprovedMismatchErrors.js +++ b/tests/baselines/reference/baseClassImprovedMismatchErrors.js @@ -33,8 +33,7 @@ var __extends = (this && this.__extends) || (function () { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -})(); -var Base = /** @class */ (function () { +})();var Base = /** @class */ (function () { function Base() { } Base.prototype.fn = function () { diff --git a/tests/baselines/reference/baseConstraintOfDecorator.js b/tests/baselines/reference/baseConstraintOfDecorator.js index ccef3f8eb114c..c23279cdf9ec8 100644 --- a/tests/baselines/reference/baseConstraintOfDecorator.js +++ b/tests/baselines/reference/baseConstraintOfDecorator.js @@ -41,8 +41,7 @@ exports.classExtender2 = exports.classExtender = void 0; function classExtender(superClass, _instanceModifier) { return /** @class */ (function (_super) { __extends(decoratorFunc, _super); - function decoratorFunc() { - var args = []; + function decoratorFunc() {var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } @@ -55,15 +54,13 @@ function classExtender(superClass, _instanceModifier) { } exports.classExtender = classExtender; var MyClass = /** @class */ (function () { - function MyClass() { - } + function MyClass() {} return MyClass; }()); function classExtender2(superClass, _instanceModifier) { return /** @class */ (function (_super) { __extends(decoratorFunc, _super); - function decoratorFunc() { - var args = []; + function decoratorFunc() {var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } diff --git a/tests/baselines/reference/baseExpressionTypeParameters.js b/tests/baselines/reference/baseExpressionTypeParameters.js index 05a0a66ee0133..e87ee42b7f2e9 100644 --- a/tests/baselines/reference/baseExpressionTypeParameters.js +++ b/tests/baselines/reference/baseExpressionTypeParameters.js @@ -30,6 +30,7 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + function base() { var Base = /** @class */ (function () { function Base() { @@ -38,6 +39,7 @@ function base() { }()); return Base; } + var Gen = /** @class */ (function (_super) { __extends(Gen, _super); function Gen() { diff --git a/tests/baselines/reference/baseIndexSignatureResolution.js b/tests/baselines/reference/baseIndexSignatureResolution.js index c84d8fbdd9dd7..53b9a8335c9e4 100644 --- a/tests/baselines/reference/baseIndexSignatureResolution.js +++ b/tests/baselines/reference/baseIndexSignatureResolution.js @@ -39,10 +39,8 @@ var __extends = (this && this.__extends) || (function () { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -})(); -var Base = /** @class */ (function () { - function Base() { - } +})();var Base = /** @class */ (function () { + function Base() {} return Base; }()); var Derived = /** @class */ (function (_super) { @@ -54,6 +52,7 @@ var Derived = /** @class */ (function (_super) { }(Base)); var x = null; var y = x[0]; + /* // Note - the equivalent for normal interface methods works fine: interface A { diff --git a/tests/baselines/reference/baseTypeAfterDerivedType.js b/tests/baselines/reference/baseTypeAfterDerivedType.js index c7cd84283c32e..00edfaf7371c7 100644 --- a/tests/baselines/reference/baseTypeAfterDerivedType.js +++ b/tests/baselines/reference/baseTypeAfterDerivedType.js @@ -17,11 +17,12 @@ interface Base2 { //// [baseTypeAfterDerivedType.js] + + var Derived2 = /** @class */ (function () { function Derived2() { } - Derived2.prototype.method = function () { - var args = []; + Derived2.prototype.method = function () {var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } diff --git a/tests/baselines/reference/baseTypeOrderChecking.js b/tests/baselines/reference/baseTypeOrderChecking.js index bff2425c0e62e..2baa2b0e6c61f 100644 --- a/tests/baselines/reference/baseTypeOrderChecking.js +++ b/tests/baselines/reference/baseTypeOrderChecking.js @@ -51,8 +51,10 @@ var __extends = (this && this.__extends) || (function () { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -})(); -var someVariable; +})();var someVariable; + + + var Class1 = /** @class */ (function () { function Class1() { } diff --git a/tests/baselines/reference/baseTypeWrappingInstantiationChain.js b/tests/baselines/reference/baseTypeWrappingInstantiationChain.js index 7ad2c839fb0b9..6243f41ab389a 100644 --- a/tests/baselines/reference/baseTypeWrappingInstantiationChain.js +++ b/tests/baselines/reference/baseTypeWrappingInstantiationChain.js @@ -42,10 +42,8 @@ var __extends = (this && this.__extends) || (function () { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -})(); -var CBaseBase = /** @class */ (function () { - function CBaseBase(x) { - } +})();var CBaseBase = /** @class */ (function () { + function CBaseBase(x) {} return CBaseBase; }()); var CBase = /** @class */ (function (_super) { @@ -77,6 +75,7 @@ var C = /** @class */ (function (_super) { C.prototype.alsoWorks = function () { new CBase(this); // Should not error, parameter is of type Parameter> }; + C.prototype.method = function (t) { }; return C; }(CBase)); diff --git a/tests/baselines/reference/bases.js b/tests/baselines/reference/bases.js index 892e9ea51ccc6..b9f4628d6465c 100644 --- a/tests/baselines/reference/bases.js +++ b/tests/baselines/reference/bases.js @@ -36,6 +36,7 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + var B = /** @class */ (function () { function B() { this.y; diff --git a/tests/baselines/reference/bestChoiceType.js b/tests/baselines/reference/bestChoiceType.js index edd36f77be96c..7fea97c24555b 100644 --- a/tests/baselines/reference/bestChoiceType.js +++ b/tests/baselines/reference/bestChoiceType.js @@ -20,13 +20,16 @@ function f2() { //// [bestChoiceType.js] // Repro from #10041 + (''.match(/ /) || []).map(function (s) { return s.toLowerCase(); }); + // Similar cases function f1() { var x = ''.match(/ /); var y = x || []; var z = y.map(function (s) { return s.toLowerCase(); }); } + function f2() { var x = ''.match(/ /); var y = x ? x : []; diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js index a02fe1b325c29..5ae8e6c940244 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js @@ -44,11 +44,12 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + var a; var b; + var Base = /** @class */ (function () { - function Base() { - } + function Base() {} return Base; }()); var Derived = /** @class */ (function (_super) { diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js index 920b58ebf5d05..386020b9d7077 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js @@ -42,9 +42,9 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + var Base = /** @class */ (function () { - function Base() { - } + function Base() {} return Base; }()); var Derived = /** @class */ (function (_super) { @@ -69,9 +69,11 @@ var r9 = true ? derived : derived2; function foo(t, u) { return true ? t : u; } + function foo2(t, u) { return true ? t : u; // Ok because BCT(T, U) = U } + function foo3(t, u) { return true ? t : u; } diff --git a/tests/baselines/reference/bestCommonTypeOfTuple.js b/tests/baselines/reference/bestCommonTypeOfTuple.js index 81cfa752f5de5..523ddc78b9db0 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple.js +++ b/tests/baselines/reference/bestCommonTypeOfTuple.js @@ -27,7 +27,9 @@ var e4 = t4[3]; // number //// [bestCommonTypeOfTuple.js] function f1(x) { return "foo"; } + function f2(x) { return 10; } + function f3(x) { return true; } var E1; (function (E1) { diff --git a/tests/baselines/reference/bestCommonTypeOfTuple2.js b/tests/baselines/reference/bestCommonTypeOfTuple2.js index 9dbd3996640fd..dcf2489e55efd 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple2.js +++ b/tests/baselines/reference/bestCommonTypeOfTuple2.js @@ -39,18 +39,15 @@ var __extends = (this && this.__extends) || (function () { }; })(); var C = /** @class */ (function () { - function C() { - } + function C() {} return C; }()); var D = /** @class */ (function () { - function D() { - } + function D() {} return D; }()); var E = /** @class */ (function () { - function E() { - } + function E() {} return E; }()); var F = /** @class */ (function (_super) { diff --git a/tests/baselines/reference/bestCommonTypeWithContextualTyping.js b/tests/baselines/reference/bestCommonTypeWithContextualTyping.js index c45ae88458fd9..df47de2c7ae7e 100644 --- a/tests/baselines/reference/bestCommonTypeWithContextualTyping.js +++ b/tests/baselines/reference/bestCommonTypeWithContextualTyping.js @@ -21,11 +21,15 @@ var conditional: Contextual = null ? e : e; // Ellement var contextualOr: Contextual = e || e; // Ellement //// [bestCommonTypeWithContextualTyping.js] + + var e; + // All of these should pass. Neither type is a supertype of the other, but the RHS should // always use Ellement in these examples (not Contextual). Because Ellement is assignable // to Contextual, no errors. var arr = [e]; // Ellement[] var obj = { s: e }; // { s: Ellement; [s: string]: Ellement } + var conditional = null ? e : e; // Ellement var contextualOr = e || e; // Ellement diff --git a/tests/baselines/reference/bestCommonTypeWithOptionalProperties.js b/tests/baselines/reference/bestCommonTypeWithOptionalProperties.js index 25622c3d4f37a..00b6a3839aee7 100644 --- a/tests/baselines/reference/bestCommonTypeWithOptionalProperties.js +++ b/tests/baselines/reference/bestCommonTypeWithOptionalProperties.js @@ -16,6 +16,7 @@ var b5 = [z, x, y]; var b6 = [z, y, x]; //// [bestCommonTypeWithOptionalProperties.js] + var x; var y; var z; diff --git a/tests/baselines/reference/betterErrorForAccidentalCall.js b/tests/baselines/reference/betterErrorForAccidentalCall.js index deb2b22d2f608..9e9ae09f808ad 100644 --- a/tests/baselines/reference/betterErrorForAccidentalCall.js +++ b/tests/baselines/reference/betterErrorForAccidentalCall.js @@ -16,8 +16,11 @@ foo() //// [betterErrorForAccidentalCall.js] + foo()(1).toString(); + foo()(1).toString(); + foo()(1).toString(); foo()(1 + 2).toString(); foo()(1).toString(); diff --git a/tests/baselines/reference/bigIntWithTargetES2016.js b/tests/baselines/reference/bigIntWithTargetES2016.js index 81ffd1058df6b..2b534077237c2 100644 --- a/tests/baselines/reference/bigIntWithTargetES2016.js +++ b/tests/baselines/reference/bigIntWithTargetES2016.js @@ -7,5 +7,6 @@ num **= BigInt(2); // should not error //// [bigIntWithTargetES2016.js] BigInt(1) ** BigInt(1); // should not error + let num = BigInt(2); num **= BigInt(2); // should not error diff --git a/tests/baselines/reference/bigintIndex.js b/tests/baselines/reference/bigintIndex.js index e24aee68dcfb1..ce2d9f2a04974 100644 --- a/tests/baselines/reference/bigintIndex.js +++ b/tests/baselines/reference/bigintIndex.js @@ -33,6 +33,7 @@ const c = {[bigNum]: 789}; //// [a.js] + const arr = [1, 2, 3]; let num = arr[1]; num = arr["1"]; @@ -52,9 +53,6 @@ typedArray[2] = 0xCC; // {1n: 123} is a syntax error; must go in separate file so BigIntIndex error is shown //// [b.js] // BigInt cannot be used as an object literal property -const a = {}; -1n; -123; -; +const a = {};1n;123;; const b = { [1n]: 456 }; const c = { [bigNum]: 789 }; diff --git a/tests/baselines/reference/bigintMissingES2019.js b/tests/baselines/reference/bigintMissingES2019.js index 85c82e8da6768..57aee26ade41e 100644 --- a/tests/baselines/reference/bigintMissingES2019.js +++ b/tests/baselines/reference/bigintMissingES2019.js @@ -8,6 +8,8 @@ test<{t?: string}, bigint>(); //// [bigintMissingES2019.js] + test(); test(); + // no error when bigint is used even when ES2020 lib is not present diff --git a/tests/baselines/reference/bigintMissingES2020.js b/tests/baselines/reference/bigintMissingES2020.js index 83e2cde68e062..db02e80106f23 100644 --- a/tests/baselines/reference/bigintMissingES2020.js +++ b/tests/baselines/reference/bigintMissingES2020.js @@ -8,6 +8,8 @@ test<{t?: string}, bigint>(); //// [bigintMissingES2020.js] + test(); test(); + // should have global error when bigint is used but ES2020 lib is not present diff --git a/tests/baselines/reference/bigintMissingESNext.js b/tests/baselines/reference/bigintMissingESNext.js index 5029ca536c28a..e9d856f5f2b5a 100644 --- a/tests/baselines/reference/bigintMissingESNext.js +++ b/tests/baselines/reference/bigintMissingESNext.js @@ -8,6 +8,8 @@ test<{t?: string}, bigint>(); //// [bigintMissingESNext.js] + test(); test(); + // should have global error when bigint is used but ES2020 lib is not present diff --git a/tests/baselines/reference/bigintWithLib.js b/tests/baselines/reference/bigintWithLib.js index c76a0775725d1..571ca8983f46a 100644 --- a/tests/baselines/reference/bigintWithLib.js +++ b/tests/baselines/reference/bigintWithLib.js @@ -86,6 +86,7 @@ bigIntArray = new BigInt64Array(new ArrayBuffer(80), 8, 3); let len = bigIntArray.length; bigIntArray.length = 10; // should error let arrayBufferLike = bigIntArray; + // Test BigUint64Array let bigUintArray = new BigUint64Array(); bigUintArray = new BigUint64Array(10); @@ -97,6 +98,7 @@ bigUintArray = new BigUint64Array(new ArrayBuffer(80), 8, 3); len = bigIntArray.length; bigIntArray.length = 10; // should error arrayBufferLike = bigIntArray; + // Test added DataView methods const dataView = new DataView(new ArrayBuffer(80)); dataView.setBigInt64(1, -1n); @@ -109,11 +111,14 @@ bigintVal = dataView.getBigInt64(1); bigintVal = dataView.getBigInt64(1, true); bigintVal = dataView.getBigUint64(2); bigintVal = dataView.getBigUint64(2, true); + // Test emitted declarations files const w = 12n; // should emit as const w = 12n const x = -12n; // should emit as const x = -12n const y = 12n; // should emit type 12n let z = 12n; // should emit type bigint in declaration file + + // Test Intl methods with new parameter type new Intl.NumberFormat("fr").format(3000n); new Intl.NumberFormat("fr").format(bigintVal); diff --git a/tests/baselines/reference/bigintWithoutLib.js b/tests/baselines/reference/bigintWithoutLib.js index 2dd67284e033d..d802bcc7979f6 100644 --- a/tests/baselines/reference/bigintWithoutLib.js +++ b/tests/baselines/reference/bigintWithoutLib.js @@ -83,6 +83,7 @@ bigIntArray = new BigInt64Array(new ArrayBuffer(80), 8, 3); var len = bigIntArray.length; bigIntArray.length = 10; var arrayBufferLike = bigIntArray; + // Test BigUint64Array var bigUintArray = new BigUint64Array(); bigUintArray = new BigUint64Array(10); @@ -106,6 +107,7 @@ bigintVal = dataView.getBigInt64(1); bigintVal = dataView.getBigInt64(1, true); bigintVal = dataView.getBigUint64(2); bigintVal = dataView.getBigUint64(2, true); + // Test Intl methods with new parameter type new Intl.NumberFormat("fr").format(3000n); new Intl.NumberFormat("fr").format(bigintVal); diff --git a/tests/baselines/reference/binaryArithmeticControlFlowGraphNotTooLarge.js b/tests/baselines/reference/binaryArithmeticControlFlowGraphNotTooLarge.js index ab5cd46e5996c..5010a99fb2ac0 100644 --- a/tests/baselines/reference/binaryArithmeticControlFlowGraphNotTooLarge.js +++ b/tests/baselines/reference/binaryArithmeticControlFlowGraphNotTooLarge.js @@ -1301,6 +1301,7 @@ const foo = function (this: any) { // Repro from #29926 (expanded 10x for good measure) var foo = function () { var a, b, c, d, ab, bc, cd, da, blocks = this.blocks; + if (this.first) { a = blocks[0] - 1; a = (a << 3) | (a >>> 29); @@ -1310,8 +1311,7 @@ var foo = function () { c = (c << 11) | (c >>> 21); b = ((c & d) | (~c & a)) + blocks[3] - 271733879; b = (b << 19) | (b >>> 13); - } - else { + } else { a = this.h0; b = this.h1; c = this.h2; @@ -1325,6 +1325,7 @@ var foo = function () { b += ((c & d) | (~c & a)) + blocks[3]; b = (b << 19) | (b >>> 13); } + a += ((b & c) | (~b & d)) + blocks[4]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[5]; @@ -1349,6 +1350,7 @@ var foo = function () { c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[15]; b = (b << 19) | (b >>> 13); + bc = b & c; a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; a = (a << 3) | (a >>> 29); @@ -1396,6 +1398,7 @@ var foo = function () { c = (c << 9) | (c >>> 23); b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; b = (b << 13) | (b >>> 19); + bc = b ^ c; a += (bc ^ d) + blocks[0] + 1859775393; a = (a << 3) | (a >>> 29); @@ -1436,6 +1439,7 @@ var foo = function () { c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[15] + 1859775393; b = (b << 15) | (b >>> 17); + a += ((b & c) | (~b & d)) + blocks[4]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[5]; @@ -1460,6 +1464,7 @@ var foo = function () { c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[15]; b = (b << 19) | (b >>> 13); + bc = b & c; a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; a = (a << 3) | (a >>> 29); @@ -1507,6 +1512,7 @@ var foo = function () { c = (c << 9) | (c >>> 23); b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; b = (b << 13) | (b >>> 19); + bc = b ^ c; a += (bc ^ d) + blocks[0] + 1859775393; a = (a << 3) | (a >>> 29); @@ -1547,6 +1553,7 @@ var foo = function () { c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[15] + 1859775393; b = (b << 15) | (b >>> 17); + a += ((b & c) | (~b & d)) + blocks[4]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[5]; @@ -1571,6 +1578,7 @@ var foo = function () { c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[15]; b = (b << 19) | (b >>> 13); + bc = b & c; a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; a = (a << 3) | (a >>> 29); @@ -1618,6 +1626,7 @@ var foo = function () { c = (c << 9) | (c >>> 23); b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; b = (b << 13) | (b >>> 19); + bc = b ^ c; a += (bc ^ d) + blocks[0] + 1859775393; a = (a << 3) | (a >>> 29); @@ -1658,6 +1667,7 @@ var foo = function () { c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[15] + 1859775393; b = (b << 15) | (b >>> 17); + a += ((b & c) | (~b & d)) + blocks[4]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[5]; @@ -1682,6 +1692,7 @@ var foo = function () { c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[15]; b = (b << 19) | (b >>> 13); + bc = b & c; a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; a = (a << 3) | (a >>> 29); @@ -1729,6 +1740,7 @@ var foo = function () { c = (c << 9) | (c >>> 23); b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; b = (b << 13) | (b >>> 19); + bc = b ^ c; a += (bc ^ d) + blocks[0] + 1859775393; a = (a << 3) | (a >>> 29); @@ -1769,6 +1781,7 @@ var foo = function () { c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[15] + 1859775393; b = (b << 15) | (b >>> 17); + a += ((b & c) | (~b & d)) + blocks[4]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[5]; @@ -1793,6 +1806,7 @@ var foo = function () { c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[15]; b = (b << 19) | (b >>> 13); + bc = b & c; a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; a = (a << 3) | (a >>> 29); @@ -1840,6 +1854,7 @@ var foo = function () { c = (c << 9) | (c >>> 23); b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; b = (b << 13) | (b >>> 19); + bc = b ^ c; a += (bc ^ d) + blocks[0] + 1859775393; a = (a << 3) | (a >>> 29); @@ -1880,6 +1895,7 @@ var foo = function () { c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[15] + 1859775393; b = (b << 15) | (b >>> 17); + a += ((b & c) | (~b & d)) + blocks[4]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[5]; @@ -1904,6 +1920,7 @@ var foo = function () { c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[15]; b = (b << 19) | (b >>> 13); + bc = b & c; a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; a = (a << 3) | (a >>> 29); @@ -1951,6 +1968,7 @@ var foo = function () { c = (c << 9) | (c >>> 23); b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; b = (b << 13) | (b >>> 19); + bc = b ^ c; a += (bc ^ d) + blocks[0] + 1859775393; a = (a << 3) | (a >>> 29); @@ -1991,6 +2009,7 @@ var foo = function () { c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[15] + 1859775393; b = (b << 15) | (b >>> 17); + a += ((b & c) | (~b & d)) + blocks[4]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[5]; @@ -2015,6 +2034,7 @@ var foo = function () { c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[15]; b = (b << 19) | (b >>> 13); + bc = b & c; a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; a = (a << 3) | (a >>> 29); @@ -2062,6 +2082,7 @@ var foo = function () { c = (c << 9) | (c >>> 23); b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; b = (b << 13) | (b >>> 19); + bc = b ^ c; a += (bc ^ d) + blocks[0] + 1859775393; a = (a << 3) | (a >>> 29); @@ -2102,6 +2123,7 @@ var foo = function () { c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[15] + 1859775393; b = (b << 15) | (b >>> 17); + a += ((b & c) | (~b & d)) + blocks[4]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[5]; @@ -2126,6 +2148,7 @@ var foo = function () { c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[15]; b = (b << 19) | (b >>> 13); + bc = b & c; a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; a = (a << 3) | (a >>> 29); @@ -2173,6 +2196,7 @@ var foo = function () { c = (c << 9) | (c >>> 23); b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; b = (b << 13) | (b >>> 19); + bc = b ^ c; a += (bc ^ d) + blocks[0] + 1859775393; a = (a << 3) | (a >>> 29); @@ -2213,6 +2237,7 @@ var foo = function () { c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[15] + 1859775393; b = (b << 15) | (b >>> 17); + a += ((b & c) | (~b & d)) + blocks[4]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[5]; @@ -2237,6 +2262,7 @@ var foo = function () { c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[15]; b = (b << 19) | (b >>> 13); + bc = b & c; a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; a = (a << 3) | (a >>> 29); @@ -2284,6 +2310,7 @@ var foo = function () { c = (c << 9) | (c >>> 23); b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; b = (b << 13) | (b >>> 19); + bc = b ^ c; a += (bc ^ d) + blocks[0] + 1859775393; a = (a << 3) | (a >>> 29); @@ -2324,6 +2351,7 @@ var foo = function () { c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[15] + 1859775393; b = (b << 15) | (b >>> 17); + a += ((b & c) | (~b & d)) + blocks[4]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[5]; @@ -2348,6 +2376,7 @@ var foo = function () { c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[15]; b = (b << 19) | (b >>> 13); + bc = b & c; a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; a = (a << 3) | (a >>> 29); @@ -2395,6 +2424,7 @@ var foo = function () { c = (c << 9) | (c >>> 23); b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; b = (b << 13) | (b >>> 19); + bc = b ^ c; a += (bc ^ d) + blocks[0] + 1859775393; a = (a << 3) | (a >>> 29); @@ -2435,6 +2465,7 @@ var foo = function () { c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[15] + 1859775393; b = (b << 15) | (b >>> 17); + a += ((b & c) | (~b & d)) + blocks[4]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[5]; @@ -2459,6 +2490,7 @@ var foo = function () { c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[15]; b = (b << 19) | (b >>> 13); + bc = b & c; a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; a = (a << 3) | (a >>> 29); @@ -2506,6 +2538,7 @@ var foo = function () { c = (c << 9) | (c >>> 23); b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; b = (b << 13) | (b >>> 19); + bc = b ^ c; a += (bc ^ d) + blocks[0] + 1859775393; a = (a << 3) | (a >>> 29); @@ -2546,14 +2579,14 @@ var foo = function () { c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[15] + 1859775393; b = (b << 15) | (b >>> 17); + if (this.first) { this.h0 = a + 1732584193 << 0; this.h1 = b - 271733879 << 0; this.h2 = c - 1732584194 << 0; this.h3 = d + 271733878 << 0; this.first = false; - } - else { + } else { this.h0 = this.h0 + a << 0; this.h1 = this.h1 + b << 0; this.h2 = this.h2 + c << 0; diff --git a/tests/baselines/reference/binaryIntegerLiteral.js b/tests/baselines/reference/binaryIntegerLiteral.js index 6f4270cf2b826..9fc0301b07473 100644 --- a/tests/baselines/reference/binaryIntegerLiteral.js +++ b/tests/baselines/reference/binaryIntegerLiteral.js @@ -47,6 +47,7 @@ var bin1 = 26; var bin2 = 26; var bin3 = 9.671406556917009e+24; var bin4 = Infinity; + var obj1 = { 26: "Hello", a: bin1, @@ -54,6 +55,7 @@ var obj1 = { b: 26, Infinity: true, }; + var obj2 = { 26: "World", a: bin2, @@ -61,6 +63,7 @@ var obj2 = { b: 26, 9.671406556917009e+24: false, }; + obj1[26]; // string obj1[26]; // string obj1["26"]; // string diff --git a/tests/baselines/reference/binaryIntegerLiteralES6.js b/tests/baselines/reference/binaryIntegerLiteralES6.js index bfb85a241d354..21d0323e80293 100644 --- a/tests/baselines/reference/binaryIntegerLiteralES6.js +++ b/tests/baselines/reference/binaryIntegerLiteralES6.js @@ -48,6 +48,7 @@ var bin1 = 0b11010; var bin2 = 0B11010; var bin3 = 0B11111111111111111111111111111111111111111111111101001010100000010111110001111111111; var bin4 = 0B111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101001010100000010111110001111111111; + var obj1 = { 0b11010: "Hello", a: bin1, @@ -55,6 +56,7 @@ var obj1 = { b: 0b11010, 0B111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101001010100000010111110001111111111: true, }; + var obj2 = { 0B11010: "World", a: bin2, @@ -62,6 +64,7 @@ var obj2 = { b: 0B11010, 0B11111111111111111111111111111111111111111111111101001010100000010111110001111111111: false, }; + obj1[0b11010]; // string obj1[26]; // string obj1["26"]; // string @@ -70,6 +73,7 @@ obj1["a"]; // number obj1["b"]; // number obj1["bin1"]; // number obj1["Infinity"]; // boolean + obj2[0B11010]; // string obj2[26]; // string obj2["26"]; // string @@ -80,3 +84,5 @@ obj2["bin2"]; // number obj2[9.671406556917009e+24]; // boolean obj2["9.671406556917009e+24"]; // boolean obj2["Infinity"]; // any + + diff --git a/tests/baselines/reference/bind1.js b/tests/baselines/reference/bind1.js index de83d56ab8ef8..218332fb871c7 100644 --- a/tests/baselines/reference/bind1.js +++ b/tests/baselines/reference/bind1.js @@ -9,8 +9,7 @@ module M { var M; (function (M) { var C = /** @class */ (function () { - function C() { - } + function C() {} return C; }()); // this should be an unresolved symbol I error M.C = C; diff --git a/tests/baselines/reference/binderBinaryExpressionStress.js b/tests/baselines/reference/binderBinaryExpressionStress.js index 7f903e39cf05a..bb4b5dce03723 100644 --- a/tests/baselines/reference/binderBinaryExpressionStress.js +++ b/tests/baselines/reference/binderBinaryExpressionStress.js @@ -4971,6 +4971,7 @@ var caps = //// [binderBinaryExpressionStress.js] 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 33 + 34 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 + 50 + 51 + 52 + 53 + 54 + 55 + 56 + 57 + 58 + 59 + 60 + 61 + 62 + 63 + 64 + 65 + 66 + 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 87 + 88 + 89 + 90 + 91 + 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 + 100 + 101 + 102 + 103 + 104 + 105 + 106 + 107 + 108 + 109 + 110 + 111 + 112 + 113 + 114 + 115 + 116 + 117 + 118 + 119 + 120 + 121 + 122 + 123 + 124 + 125 + 126 + 127 + 128 + 129 + 130 + 131 + 132 + 133 + 134 + 135 + 136 + 137 + 138 + 139 + 140 + 141 + 142 + 143 + 144 + 145 + 146 + 147 + 148 + 149 + 150 + 151 + 152 + 153 + 154 + 155 + 156 + 157 + 158 + 159 + 160 + 161 + 162 + 163 + 164 + 165 + 166 + 167 + 168 + 169 + 170 + 171 + 172 + 173 + 174 + 175 + 176 + 177 + 178 + 179 + 180 + 181 + 182 + 183 + 184 + 185 + 186 + 187 + 188 + 189 + 190 + 191 + 192 + 193 + 194 + 195 + 196 + 197 + 198 + 199 + 200 + 201 + 202 + 203 + 204 + 205 + 206 + 207 + 208 + 209 + 210 + 211 + 212 + 213 + 214 + 215 + 216 + 217 + 218 + 219 + 220 + 221 + 222 + 223 + 224 + 225 + 226 + 227 + 228 + 229 + 230 + 231 + 232 + 233 + 234 + 235 + 236 + 237 + 238 + 239 + 240 + 241 + 242 + 243 + 244 + 245 + 246 + 247 + 248 + 249 + 250 + 251 + 252 + 253 + 254 + 255 + 256 + 257 + 258 + 259 + 260 + 261 + 262 + 263 + 264 + 265 + 266 + 267 + 268 + 269 + 270 + 271 + 272 + 273 + 274 + 275 + 276 + 277 + 278 + 279 + 280 + 281 + 282 + 283 + 284 + 285 + 286 + 287 + 288 + 289 + 290 + 291 + 292 + 293 + 294 + 295 + 296 + 297 + 298 + 299 + 300 + 301 + 302 + 303 + 304 + 305 + 306 + 307 + 308 + 309 + 310 + 311 + 312 + 313 + 314 + 315 + 316 + 317 + 318 + 319 + 320 + 321 + 322 + 323 + 324 + 325 + 326 + 327 + 328 + 329 + 330 + 331 + 332 + 333 + 334 + 335 + 336 + 337 + 338 + 339 + 340 + 341 + 342 + 343 + 344 + 345 + 346 + 347 + 348 + 349 + 350 + 351 + 352 + 353 + 354 + 355 + 356 + 357 + 358 + 359 + 360 + 361 + 362 + 363 + 364 + 365 + 366 + 367 + 368 + 369 + 370 + 371 + 372 + 373 + 374 + 375 + 376 + 377 + 378 + 379 + 380 + 381 + 382 + 383 + 384 + 385 + 386 + 387 + 388 + 389 + 390 + 391 + 392 + 393 + 394 + 395 + 396 + 397 + 398 + 399 + 400 + 401 + 402 + 403 + 404 + 405 + 406 + 407 + 408 + 409 + 410 + 411 + 412 + 413 + 414 + 415 + 416 + 417 + 418 + 419 + 420 + 421 + 422 + 423 + 424 + 425 + 426 + 427 + 428 + 429 + 430 + 431 + 432 + 433 + 434 + 435 + 436 + 437 + 438 + 439 + 440 + 441 + 442 + 443 + 444 + 445 + 446 + 447 + 448 + 449 + 450 + 451 + 452 + 453 + 454 + 455 + 456 + 457 + 458 + 459 + 460 + 461 + 462 + 463 + 464 + 465 + 466 + 467 + 468 + 469 + 470 + 471 + 472 + 473 + 474 + 475 + 476 + 477 + 478 + 479 + 480 + 481 + 482 + 483 + 484 + 485 + 486 + 487 + 488 + 489 + 490 + 491 + 492 + 493 + 494 + 495 + 496 + 497 + 498 + 499 + 500 + 501 + 502 + 503 + 504 + 505 + 506 + 507 + 508 + 509 + 510 + 511 + 512 + 513 + 514 + 515 + 516 + 517 + 518 + 519 + 520 + 521 + 522 + 523 + 524 + 525 + 526 + 527 + 528 + 529 + 530 + 531 + 532 + 533 + 534 + 535 + 536 + 537 + 538 + 539 + 540 + 541 + 542 + 543 + 544 + 545 + 546 + 547 + 548 + 549 + 550 + 551 + 552 + 553 + 554 + 555 + 556 + 557 + 558 + 559 + 560 + 561 + 562 + 563 + 564 + 565 + 566 + 567 + 568 + 569 + 570 + 571 + 572 + 573 + 574 + 575 + 576 + 577 + 578 + 579 + 580 + 581 + 582 + 583 + 584 + 585 + 586 + 587 + 588 + 589 + 590 + 591 + 592 + 593 + 594 + 595 + 596 + 597 + 598 + 599 + 600 + 601 + 602 + 603 + 604 + 605 + 606 + 607 + 608 + 609 + 610 + 611 + 612 + 613 + 614 + 615 + 616 + 617 + 618 + 619 + 620 + 621 + 622 + 623 + 624 + 625 + 626 + 627 + 628 + 629 + 630 + 631 + 632 + 633 + 634 + 635 + 636 + 637 + 638 + 639 + 640 + 641 + 642 + 643 + 644 + 645 + 646 + 647 + 648 + 649 + 650 + 651 + 652 + 653 + 654 + 655 + 656 + 657 + 658 + 659 + 660 + 661 + 662 + 663 + 664 + 665 + 666 + 667 + 668 + 669 + 670 + 671 + 672 + 673 + 674 + 675 + 676 + 677 + 678 + 679 + 680 + 681 + 682 + 683 + 684 + 685 + 686 + 687 + 688 + 689 + 690 + 691 + 692 + 693 + 694 + 695 + 696 + 697 + 698 + 699 + 700 + 701 + 702 + 703 + 704 + 705 + 706 + 707 + 708 + 709 + 710 + 711 + 712 + 713 + 714 + 715 + 716 + 717 + 718 + 719 + 720 + 721 + 722 + 723 + 724 + 725 + 726 + 727 + 728 + 729 + 730 + 731 + 732 + 733 + 734 + 735 + 736 + 737 + 738 + 739 + 740 + 741 + 742 + 743 + 744 + 745 + 746 + 747 + 748 + 749 + 750 + 751 + 752 + 753 + 754 + 755 + 756 + 757 + 758 + 759 + 760 + 761 + 762 + 763 + 764 + 765 + 766 + 767 + 768 + 769 + 770 + 771 + 772 + 773 + 774 + 775 + 776 + 777 + 778 + 779 + 780 + 781 + 782 + 783 + 784 + 785 + 786 + 787 + 788 + 789 + 790 + 791 + 792 + 793 + 794 + 795 + 796 + 797 + 798 + 799 + 800 + 801 + 802 + 803 + 804 + 805 + 806 + 807 + 808 + 809 + 810 + 811 + 812 + 813 + 814 + 815 + 816 + 817 + 818 + 819 + 820 + 821 + 822 + 823 + 824 + 825 + 826 + 827 + 828 + 829 + 830 + 831 + 832 + 833 + 834 + 835 + 836 + 837 + 838 + 839 + 840 + 841 + 842 + 843 + 844 + 845 + 846 + 847 + 848 + 849 + 850 + 851 + 852 + 853 + 854 + 855 + 856 + 857 + 858 + 859 + 860 + 861 + 862 + 863 + 864 + 865 + 866 + 867 + 868 + 869 + 870 + 871 + 872 + 873 + 874 + 875 + 876 + 877 + 878 + 879 + 880 + 881 + 882 + 883 + 884 + 885 + 886 + 887 + 888 + 889 + 890 + 891 + 892 + 893 + 894 + 895 + 896 + 897 + 898 + 899 + 900 + 901 + 902 + 903 + 904 + 905 + 906 + 907 + 908 + 909 + 910 + 911 + 912 + 913 + 914 + 915 + 916 + 917 + 918 + 919 + 920 + 921 + 922 + 923 + 924 + 925 + 926 + 927 + 928 + 929 + 930 + 931 + 932 + 933 + 934 + 935 + 936 + 937 + 938 + 939 + 940 + 941 + 942 + 943 + 944 + 945 + 946 + 947 + 948 + 949 + 950 + 951 + 952 + 953 + 954 + 955 + 956 + 957 + 958 + 959 + 960 + 961 + 962 + 963 + 964 + 965 + 966 + 967 + 968 + 969 + 970 + 971 + 972 + 973 + 974 + 975 + 976 + 977 + 978 + 979 + 980 + 981 + 982 + 983 + 984 + 985 + 986 + 987 + 988 + 989 + 990 + 991 + 992 + 993 + 994 + 995 + 996 + 997 + 998 + 999 + 1000 + 1001 + 1002 + 1003 + 1004 + 1005 + 1006 + 1007 + 1008 + 1009 + 1010 + 1011 + 1012 + 1013 + 1014 + 1015 + 1016 + 1017 + 1018 + 1019 + 1020 + 1021 + 1022 + 1023 + 1024 + 1025 + 1026 + 1027 + 1028 + 1029 + 1030 + 1031 + 1032 + 1033 + 1034 + 1035 + 1036 + 1037 + 1038 + 1039 + 1040 + 1041 + 1042 + 1043 + 1044 + 1045 + 1046 + 1047 + 1048 + 1049 + 1050 + 1051 + 1052 + 1053 + 1054 + 1055 + 1056 + 1057 + 1058 + 1059 + 1060 + 1061 + 1062 + 1063 + 1064 + 1065 + 1066 + 1067 + 1068 + 1069 + 1070 + 1071 + 1072 + 1073 + 1074 + 1075 + 1076 + 1077 + 1078 + 1079 + 1080 + 1081 + 1082 + 1083 + 1084 + 1085 + 1086 + 1087 + 1088 + 1089 + 1090 + 1091 + 1092 + 1093 + 1094 + 1095 + 1096 + 1097 + 1098 + 1099 + 1100 + 1101 + 1102 + 1103 + 1104 + 1105 + 1106 + 1107 + 1108 + 1109 + 1110 + 1111 + 1112 + 1113 + 1114 + 1115 + 1116 + 1117 + 1118 + 1119 + 1120 + 1121 + 1122 + 1123 + 1124 + 1125 + 1126 + 1127 + 1128 + 1129 + 1130 + 1131 + 1132 + 1133 + 1134 + 1135 + 1136 + 1137 + 1138 + 1139 + 1140 + 1141 + 1142 + 1143 + 1144 + 1145 + 1146 + 1147 + 1148 + 1149 + 1150 + 1151 + 1152 + 1153 + 1154 + 1155 + 1156 + 1157 + 1158 + 1159 + 1160 + 1161 + 1162 + 1163 + 1164 + 1165 + 1166 + 1167 + 1168 + 1169 + 1170 + 1171 + 1172 + 1173 + 1174 + 1175 + 1176 + 1177 + 1178 + 1179 + 1180 + 1181 + 1182 + 1183 + 1184 + 1185 + 1186 + 1187 + 1188 + 1189 + 1190 + 1191 + 1192 + 1193 + 1194 + 1195 + 1196 + 1197 + 1198 + 1199 + 1200 + 1201 + 1202 + 1203 + 1204 + 1205 + 1206 + 1207 + 1208 + 1209 + 1210 + 1211 + 1212 + 1213 + 1214 + 1215 + 1216 + 1217 + 1218 + 1219 + 1220 + 1221 + 1222 + 1223 + 1224 + 1225 + 1226 + 1227 + 1228 + 1229 + 1230 + 1231 + 1232 + 1233 + 1234 + 1235 + 1236 + 1237 + 1238 + 1239 + 1240 + 1241 + 1242 + 1243 + 1244 + 1245 + 1246 + 1247 + 1248 + 1249 + 1250 + 1251 + 1252 + 1253 + 1254 + 1255 + 1256 + 1257 + 1258 + 1259 + 1260 + 1261 + 1262 + 1263 + 1264 + 1265 + 1266 + 1267 + 1268 + 1269 + 1270 + 1271 + 1272 + 1273 + 1274 + 1275 + 1276 + 1277 + 1278 + 1279 + 1280 + 1281 + 1282 + 1283 + 1284 + 1285 + 1286 + 1287 + 1288 + 1289 + 1290 + 1291 + 1292 + 1293 + 1294 + 1295 + 1296 + 1297 + 1298 + 1299 + 1300 + 1301 + 1302 + 1303 + 1304 + 1305 + 1306 + 1307 + 1308 + 1309 + 1310 + 1311 + 1312 + 1313 + 1314 + 1315 + 1316 + 1317 + 1318 + 1319 + 1320 + 1321 + 1322 + 1323 + 1324 + 1325 + 1326 + 1327 + 1328 + 1329 + 1330 + 1331 + 1332 + 1333 + 1334 + 1335 + 1336 + 1337 + 1338 + 1339 + 1340 + 1341 + 1342 + 1343 + 1344 + 1345 + 1346 + 1347 + 1348 + 1349 + 1350 + 1351 + 1352 + 1353 + 1354 + 1355 + 1356 + 1357 + 1358 + 1359 + 1360 + 1361 + 1362 + 1363 + 1364 + 1365 + 1366 + 1367 + 1368 + 1369 + 1370 + 1371 + 1372 + 1373 + 1374 + 1375 + 1376 + 1377 + 1378 + 1379 + 1380 + 1381 + 1382 + 1383 + 1384 + 1385 + 1386 + 1387 + 1388 + 1389 + 1390 + 1391 + 1392 + 1393 + 1394 + 1395 + 1396 + 1397 + 1398 + 1399 + 1400 + 1401 + 1402 + 1403 + 1404 + 1405 + 1406 + 1407 + 1408 + 1409 + 1410 + 1411 + 1412 + 1413 + 1414 + 1415 + 1416 + 1417 + 1418 + 1419 + 1420 + 1421 + 1422 + 1423 + 1424 + 1425 + 1426 + 1427 + 1428 + 1429 + 1430 + 1431 + 1432 + 1433 + 1434 + 1435 + 1436 + 1437 + 1438 + 1439 + 1440 + 1441 + 1442 + 1443 + 1444 + 1445 + 1446 + 1447 + 1448 + 1449 + 1450 + 1451 + 1452 + 1453 + 1454 + 1455 + 1456 + 1457 + 1458 + 1459 + 1460 + 1461 + 1462 + 1463 + 1464 + 1465 + 1466 + 1467 + 1468 + 1469 + 1470 + 1471 + 1472 + 1473 + 1474 + 1475 + 1476 + 1477 + 1478 + 1479 + 1480 + 1481 + 1482 + 1483 + 1484 + 1485 + 1486 + 1487 + 1488 + 1489 + 1490 + 1491 + 1492 + 1493 + 1494 + 1495 + 1496 + 1497 + 1498 + 1499; + var caps = '' + '' + '' + diff --git a/tests/baselines/reference/bindingPatternInParameter01.js b/tests/baselines/reference/bindingPatternInParameter01.js index 27b3a59e81ed7..fc80a1ea5645d 100644 --- a/tests/baselines/reference/bindingPatternInParameter01.js +++ b/tests/baselines/reference/bindingPatternInParameter01.js @@ -8,6 +8,7 @@ nestedArray.forEach(([[a, b]]) => { //// [bindingPatternInParameter01.js] var nestedArray = [[[1, 2]], [[3, 4]]]; + nestedArray.forEach(function (_a) { var _b = _a[0], a = _b[0], b = _b[1]; console.log(a, b); diff --git a/tests/baselines/reference/bitwiseCompoundAssignmentOperators.js b/tests/baselines/reference/bitwiseCompoundAssignmentOperators.js index c148fc0142cb1..a88a49a015b7f 100644 --- a/tests/baselines/reference/bitwiseCompoundAssignmentOperators.js +++ b/tests/baselines/reference/bitwiseCompoundAssignmentOperators.js @@ -43,6 +43,7 @@ a ^= b; a = true; b ^= a; b = 1; + var c = false; var d = 2; c &= c; @@ -52,6 +53,7 @@ d = 2; c &= d; c = false; d &= c; + var e = true; var f = 0; e |= e; diff --git a/tests/baselines/reference/bitwiseNotOperatorInvalidOperations.js b/tests/baselines/reference/bitwiseNotOperatorInvalidOperations.js index 1b64091c048f5..2455ee7cdc2eb 100644 --- a/tests/baselines/reference/bitwiseNotOperatorInvalidOperations.js +++ b/tests/baselines/reference/bitwiseNotOperatorInvalidOperations.js @@ -14,11 +14,14 @@ var b =~; //// [bitwiseNotOperatorInvalidOperations.js] // Unary operator ~ var q; + // operand before ~ -var a = q; -~; //expect error +var a = q;~; //expect error + + // multiple operands after ~ -var mul = ~[1, 2, "abc"]; -""; //expect error +var mul = ~[1, 2, "abc"];""; //expect error + + // miss an operand var b = ~; diff --git a/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.js b/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.js index 8827aa2d57fa1..2db81c4b7c006 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.js @@ -64,11 +64,13 @@ var ResultIsNumber20 = ~~~(ANY + ANY1); //// [bitwiseNotOperatorWithAnyOtherType.js] // ~ operator on any type + var ANY; var ANY1; var ANY2 = ["", ""]; var obj; var obj1 = { x: "", y: function () { } }; + function foo() { var a; return a; @@ -86,6 +88,7 @@ var M; (function (M) { })(M || (M = {})); var objA = new A(); + // any other type var var ResultIsNumber = ~ANY1; var ResultIsNumber1 = ~ANY2; @@ -93,9 +96,11 @@ var ResultIsNumber2 = ~A; var ResultIsNumber3 = ~M; var ResultIsNumber4 = ~obj; var ResultIsNumber5 = ~obj1; + // any type literal var ResultIsNumber6 = ~undefined; var ResultIsNumber7 = ~null; + // any type expressions var ResultIsNumber8 = ~ANY2[0]; var ResultIsNumber9 = ~obj1.x; @@ -108,9 +113,11 @@ var ResultIsNumber15 = ~(ANY + ANY1); var ResultIsNumber16 = ~(null + undefined); var ResultIsNumber17 = ~(null + null); var ResultIsNumber18 = ~(undefined + undefined); + // multiple ~ operators var ResultIsNumber19 = ~~ANY; var ResultIsNumber20 = ~~~(ANY + ANY1); + //miss assignment operators ~ANY; ~ANY1; diff --git a/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js b/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js index 00766ee43033d..21817bd91184e 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js @@ -41,7 +41,9 @@ var ResultIsNumber8 = ~~BOOLEAN; //// [bitwiseNotOperatorWithBooleanType.js] // ~ operator on boolean type var BOOLEAN; + function foo() { return true; } + var A = /** @class */ (function () { function A() { } @@ -52,18 +54,23 @@ var M; (function (M) { })(M || (M = {})); var objA = new A(); + // boolean type var var ResultIsNumber1 = ~BOOLEAN; + // boolean type literal var ResultIsNumber2 = ~true; var ResultIsNumber3 = ~{ x: true, y: false }; + // boolean type expressions var ResultIsNumber4 = ~objA.a; var ResultIsNumber5 = ~M.n; var ResultIsNumber6 = ~foo(); var ResultIsNumber7 = ~A.foo(); + // multiple ~ operators var ResultIsNumber8 = ~~BOOLEAN; + // miss assignment operators ~true; ~BOOLEAN; diff --git a/tests/baselines/reference/bitwiseNotOperatorWithEnumType.js b/tests/baselines/reference/bitwiseNotOperatorWithEnumType.js index 0bcf2fa39569b..915bd6de1521c 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithEnumType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithEnumType.js @@ -27,13 +27,17 @@ var ENUM1; ENUM1[ENUM1[""] = 2] = ""; })(ENUM1 || (ENUM1 = {})); ; + // enum type var var ResultIsNumber1 = ~ENUM1; + // enum type expressions var ResultIsNumber2 = ~ENUM1["A"]; var ResultIsNumber3 = ~(ENUM1.A + ENUM1["B"]); + // multiple ~ operators var ResultIsNumber4 = ~~~(ENUM1["A"] + ENUM1.B); + // miss assignment operators ~ENUM1; ~ENUM1["A"]; diff --git a/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js b/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js index d446532caf88c..6dcc6e9ad0c06 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js @@ -48,7 +48,9 @@ var ResultIsNumber13 = ~~~(NUMBER + NUMBER); // ~ operator on number type var NUMBER; var NUMBER1 = [1, 2]; + function foo() { return 1; } + var A = /** @class */ (function () { function A() { } @@ -59,9 +61,11 @@ var M; (function (M) { })(M || (M = {})); var objA = new A(); + // number type var var ResultIsNumber1 = ~NUMBER; var ResultIsNumber2 = ~NUMBER1; + // number type literal var ResultIsNumber3 = ~1; var ResultIsNumber4 = ~{ x: 1, y: 2 }; @@ -73,9 +77,11 @@ var ResultIsNumber8 = ~NUMBER1[0]; var ResultIsNumber9 = ~foo(); var ResultIsNumber10 = ~A.foo(); var ResultIsNumber11 = ~(NUMBER + NUMBER); + // multiple ~ operators var ResultIsNumber12 = ~~NUMBER; var ResultIsNumber13 = ~~~(NUMBER + NUMBER); + // miss assignment operators ~NUMBER; ~NUMBER1; diff --git a/tests/baselines/reference/bitwiseNotOperatorWithStringType.js b/tests/baselines/reference/bitwiseNotOperatorWithStringType.js index 481e75e3378a2..0d19fec3f4c65 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithStringType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithStringType.js @@ -47,7 +47,9 @@ var ResultIsNumber14 = ~~~(STRING + STRING); // ~ operator on string type var STRING; var STRING1 = ["", "abc"]; + function foo() { return "abc"; } + var A = /** @class */ (function () { function A() { } @@ -58,9 +60,11 @@ var M; (function (M) { })(M || (M = {})); var objA = new A(); + // string type var var ResultIsNumber1 = ~STRING; var ResultIsNumber2 = ~STRING1; + // string type literal var ResultIsNumber3 = ~""; var ResultIsNumber4 = ~{ x: "", y: "" }; @@ -73,9 +77,11 @@ var ResultIsNumber9 = ~foo(); var ResultIsNumber10 = ~A.foo(); var ResultIsNumber11 = ~(STRING + STRING); var ResultIsNumber12 = ~STRING.charAt(0); + // multiple ~ operators var ResultIsNumber13 = ~~STRING; var ResultIsNumber14 = ~~~(STRING + STRING); + //miss assignment operators ~STRING; ~STRING1; diff --git a/tests/baselines/reference/bivariantInferences.js b/tests/baselines/reference/bivariantInferences.js index a910ca15e93bb..02e9487b936ac 100644 --- a/tests/baselines/reference/bivariantInferences.js +++ b/tests/baselines/reference/bivariantInferences.js @@ -14,4 +14,6 @@ let x = a.equalsShallow(b); //// [bivariantInferences.js] "use strict"; // Repro from #27337 + + var x = a.equalsShallow(b); diff --git a/tests/baselines/reference/blockScopedBindingUsedBeforeDef.js b/tests/baselines/reference/blockScopedBindingUsedBeforeDef.js index adbba8ee8ae6a..172b61f16e85e 100644 --- a/tests/baselines/reference/blockScopedBindingUsedBeforeDef.js +++ b/tests/baselines/reference/blockScopedBindingUsedBeforeDef.js @@ -17,5 +17,6 @@ for (var _i = 0, _a = [{}]; _i < _a.length; _i++) { // 2: for (var _c = {}, _d = a, a = _c[_d]; false;) continue; + // 3: var _e = {}, _f = b, b = _e[_f]; diff --git a/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.js b/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.js index eb59846f9e0b3..2e7a6aefd7207 100644 --- a/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.js +++ b/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.js @@ -44,17 +44,10 @@ var __values = (this && this.__values) || function(o) { } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -function a() { +};function a() { var _loop_1, _a, _b, i, e_1_1; var e_1, _c; - return __generator(this, function (_d) { - switch (_d.label) { - case 0: - _loop_1 = function (i) { - return __generator(this, function (_e) { - switch (_e.label) { - case 0: + return __generator(this, function (_d) {switch (_d.label) {case 0:_loop_1 = function (i) {return __generator(this, function (_e) {switch (_e.label) {case 0: (function () { return i; })(); return [4 /*yield*/, i]; case 1: @@ -64,30 +57,22 @@ function a() { }); }; _d.label = 1; - case 1: - _d.trys.push([1, 6, 7, 8]); + case 1:_d.trys.push([1, 6, 7, 8]); _a = __values([1, 2, 3]), _b = _a.next(); _d.label = 2; - case 2: - if (!!_b.done) return [3 /*break*/, 5]; + case 2:if (!!_b.done) return [3 /*break*/, 5]; i = _b.value; return [5 /*yield**/, _loop_1(i)]; - case 3: - _d.sent(); + case 3:_d.sent(); _d.label = 4; - case 4: - _b = _a.next(); + case 4:_b = _a.next(); return [3 /*break*/, 2]; case 5: return [3 /*break*/, 8]; - case 6: - e_1_1 = _d.sent(); + case 6:e_1_1 = _d.sent(); e_1 = { error: e_1_1 }; return [3 /*break*/, 8]; - case 7: - try { - if (_b && !_b.done && (_c = _a.return)) _c.call(_a); - } - finally { if (e_1) throw e_1.error; } + case 7:try {if (_b && !_b.done && (_c = _a.return)) _c.call(_a); + } finally { if (e_1) throw e_1.error; } return [7 /*endfinally*/]; case 8: return [2 /*return*/]; } diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop2.js b/tests/baselines/reference/blockScopedBindingsReassignedInLoop2.js index 08b869a4f99fb..d48e30c098f00 100644 --- a/tests/baselines/reference/blockScopedBindingsReassignedInLoop2.js +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop2.js @@ -94,8 +94,7 @@ loop: for (var x = 1, y = 2; x < y; ++x, --y) { var state_2 = _loop_3(x, y); x = out_x_3; y = out_y_3; - switch (state_2) { - case "break-loop": break loop; + switch (state_2) {case "break-loop": break loop; } } var _loop_4 = function (x, y) { @@ -114,7 +113,6 @@ loop: for (var x = 1, y = 2; x < y; ++x, --y) { var state_3 = _loop_4(x, y); x = out_x_4; y = out_y_4; - switch (state_3) { - case "continue-loop": continue loop; + switch (state_3) {case "continue-loop": continue loop; } } diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop3.js b/tests/baselines/reference/blockScopedBindingsReassignedInLoop3.js index bcc16e499a207..332336a87f409 100644 --- a/tests/baselines/reference/blockScopedBindingsReassignedInLoop3.js +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop3.js @@ -97,8 +97,7 @@ var _loop_1 = function (x, y) { if (x == 1) { return out_x_1 = x, out_y_1 = y, "break"; } - else { - var _loop_5 = function (a_1) { + else {var _loop_5 = function (a_1) { var f = function () { return a_1; }; if (a_1) { a_1 = x; @@ -134,8 +133,7 @@ var _loop_2 = function (x, y) { if (x == 1) { return out_x_2 = x, out_y_2 = y, "continue"; } - else { - var _loop_6 = function (a_2) { + else {var _loop_6 = function (a_2) { var f = function () { return a_2; }; if (a_2) { a_2 = x; @@ -167,8 +165,7 @@ var _loop_3 = function (x, y) { if (x == 1) { return out_x_3 = x, out_y_3 = y, "break-loop2"; } - else { - var _loop_7 = function (a_3) { + else {var _loop_7 = function (a_3) { var f = function () { return a_3; }; if (a_3) { a_3 = x; @@ -184,8 +181,7 @@ var _loop_3 = function (x, y) { loop1: for (var a_3 = 1; a_3 < 5; --a_3) { var state_5 = _loop_7(a_3); a_3 = out_a_3; - switch (state_5) { - case "break-loop1": break loop1; + switch (state_5) {case "break-loop1": break loop1; case "break-loop2": return state_5; } } @@ -199,8 +195,7 @@ loop2: for (var x = 1, y = 2; x < y; ++x, --y) { var state_2 = _loop_3(x, y); x = out_x_3; y = out_y_3; - switch (state_2) { - case "break-loop2": break loop2; + switch (state_2) {case "break-loop2": break loop2; } } var _loop_4 = function (x, y) { @@ -208,8 +203,7 @@ var _loop_4 = function (x, y) { if (x == 1) { return out_x_4 = x, out_y_4 = y, "continue-loop2"; } - else { - var _loop_8 = function (a_4) { + else {var _loop_8 = function (a_4) { var f = function () { return a_4; }; if (a_4) { a_4 = x; @@ -225,8 +219,7 @@ var _loop_4 = function (x, y) { loop1: for (var a_4 = 1; a_4 < 5; --a_4) { var state_6 = _loop_8(a_4); a_4 = out_a_4; - switch (state_6) { - case "continue-loop1": continue loop1; + switch (state_6) {case "continue-loop1": continue loop1; case "continue-loop2": return state_6; } } @@ -240,7 +233,6 @@ loop2: for (var x = 1, y = 2; x < y; ++x, --y) { var state_3 = _loop_4(x, y); x = out_x_4; y = out_y_4; - switch (state_3) { - case "continue-loop2": continue loop2; + switch (state_3) {case "continue-loop2": continue loop2; } } diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop5.js b/tests/baselines/reference/blockScopedBindingsReassignedInLoop5.js index 1ea3f23897ad3..46f74fc748e0c 100644 --- a/tests/baselines/reference/blockScopedBindingsReassignedInLoop5.js +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop5.js @@ -12,8 +12,7 @@ for (let x = 1, y = 2; x < y; ++x, --y) { var _loop_1 = function (x, y) { var a = function () { return x++ + y++; }; if (x == 1) - return out_x_1 = x, out_y_1 = y, "break"; - else + return out_x_1 = x, out_y_1 = y, "break"; else y = 5; out_x_1 = x; out_y_1 = y; diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop6.js b/tests/baselines/reference/blockScopedBindingsReassignedInLoop6.js index 584d8b21100fa..abecf3097bd99 100644 --- a/tests/baselines/reference/blockScopedBindingsReassignedInLoop6.js +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop6.js @@ -34,10 +34,8 @@ function f1() { var _loop_1 = function (x, y) { var a = function () { return x++ + y++; }; if (x == 1) - return out_x_1 = x, out_y_1 = y, "break"; - else if (y == 2) - y = 5; - else + return out_x_1 = x, out_y_1 = y, "break"; else if (y == 2) + y = 5; else return { value: void 0 }; out_x_1 = x; out_y_1 = y; @@ -53,14 +51,13 @@ function f1() { break; } } + function f2() { var _loop_2 = function (x, y) { var a = function () { return x++ + y++; }; if (x == 1) - return out_x_2 = x, out_y_2 = y, "break"; - else if (y == 2) - y = 5; - else + return out_x_2 = x, out_y_2 = y, "break"; else if (y == 2) + y = 5; else return { value: void 0 }; out_x_2 = x; out_y_2 = y; @@ -76,3 +73,8 @@ function f2() { break; } } + + + + + diff --git a/tests/baselines/reference/blockScopedClassDeclarationAcrossFiles.js b/tests/baselines/reference/blockScopedClassDeclarationAcrossFiles.js index 6559548ddff28..81a7733b7205a 100644 --- a/tests/baselines/reference/blockScopedClassDeclarationAcrossFiles.js +++ b/tests/baselines/reference/blockScopedClassDeclarationAcrossFiles.js @@ -9,7 +9,6 @@ class C { } //// [foo.js] var foo; var C = /** @class */ (function () { - function C() { - } + function C() {} return C; }()); diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef.js b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef.js index 552d099b07cf1..a8a84ccb77598 100644 --- a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef.js +++ b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef.js @@ -17,6 +17,7 @@ function foo1() { E[E["A"] = 0] = "A"; })(E || (E = {})); } + function foo2() { return 0 /* A */; } diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve.js b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve.js index 239a87f00426f..a6c74fe37727a 100644 --- a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve.js +++ b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve.js @@ -17,6 +17,7 @@ function foo1() { E[E["A"] = 0] = "A"; })(E || (E = {})); } + function foo2() { return 0 /* A */; var E; diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationInStrictModule.js b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictModule.js index d1a8091871c2e..ddde37aa167ba 100644 --- a/tests/baselines/reference/blockScopedFunctionDeclarationInStrictModule.js +++ b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictModule.js @@ -8,8 +8,7 @@ export = foo; // not ok //// [blockScopedFunctionDeclarationInStrictModule.js] define(["require", "exports"], function (require, exports) { - "use strict"; - if (true) { + "use strict";if (true) { function foo() { } foo(); // ok } diff --git a/tests/baselines/reference/blockScopedNamespaceDifferentFile.js b/tests/baselines/reference/blockScopedNamespaceDifferentFile.js index 1ddb284f55cc0..e16befc17a0dd 100644 --- a/tests/baselines/reference/blockScopedNamespaceDifferentFile.js +++ b/tests/baselines/reference/blockScopedNamespaceDifferentFile.js @@ -23,10 +23,8 @@ declare namespace A { //// [out.js] // #15734 failed when test.ts comes before typings.d.ts var C; -(function (C) { - var Name = /** @class */ (function () { - function Name(parameters) { - } +(function (C) {var Name = /** @class */ (function () { + function Name(parameters) {} Name.funcData = A.AA.func(); Name.someConst = A.AA.foo; return Name; diff --git a/tests/baselines/reference/blockScopedVariablesUseBeforeDef.js b/tests/baselines/reference/blockScopedVariablesUseBeforeDef.js index 9ca3f8998a2eb..9daf4114e2ecb 100644 --- a/tests/baselines/reference/blockScopedVariablesUseBeforeDef.js +++ b/tests/baselines/reference/blockScopedVariablesUseBeforeDef.js @@ -109,14 +109,17 @@ function foo0() { var a = x; var x; } + function foo1() { var a = function () { return x; }; var x; } + function foo2() { var a = function () { return x; }; var x; } + function foo3() { var X = /** @class */ (function () { function X() { @@ -126,6 +129,7 @@ function foo3() { }()); var x; } + function foo4() { var y = /** @class */ (function () { function y() { @@ -135,16 +139,19 @@ function foo4() { }()); var x; } + function foo5() { var x = function () { return y; }; var y = function () { return x; }; } + function foo6() { function f() { return x; } var x; } + function foo7() { var A = /** @class */ (function () { function A() { @@ -154,6 +161,7 @@ function foo7() { }()); var x; } + function foo8() { var y = /** @class */ (function () { function class_1() { @@ -163,6 +171,7 @@ function foo8() { }()); var x; } + function foo9() { var _a; var y = (_a = /** @class */ (function () { @@ -174,6 +183,7 @@ function foo9() { _a); var x; } + function foo10() { var A = /** @class */ (function () { function A() { @@ -183,6 +193,7 @@ function foo10() { }()); var x; } + function foo11() { function f() { var _a; @@ -196,6 +207,7 @@ function foo11() { } var x; } + function foo12() { function f() { var y = /** @class */ (function () { @@ -207,12 +219,14 @@ function foo12() { } var x; } + function foo13() { var a = { get a() { return x; } }; var x; } + function foo14() { var a = { a: x diff --git a/tests/baselines/reference/bluebirdStaticThis.js b/tests/baselines/reference/bluebirdStaticThis.js index 1d8d8f2ec43a2..fb6c70b27c922 100644 --- a/tests/baselines/reference/bluebirdStaticThis.js +++ b/tests/baselines/reference/bluebirdStaticThis.js @@ -141,10 +141,13 @@ fooProm = Promise.try(Promise, () => { //// [bluebirdStaticThis.js] "use strict"; exports.__esModule = true; + + var x; var arr; var foo; var fooProm; + fooProm = Promise["try"](Promise, function () { return foo; }); diff --git a/tests/baselines/reference/booleanAssignment.js b/tests/baselines/reference/booleanAssignment.js index 573367a429357..bd7372e558ff0 100644 --- a/tests/baselines/reference/booleanAssignment.js +++ b/tests/baselines/reference/booleanAssignment.js @@ -17,8 +17,10 @@ var b = new Boolean(); b = 1; // Error b = "a"; // Error b = {}; // Error + var o = {}; o = b; // OK + b = true; // OK var b2; b = b2; // OK diff --git a/tests/baselines/reference/booleanFilterAnyArray.js b/tests/baselines/reference/booleanFilterAnyArray.js index 2cd319ca440ad..c0ce049f69ec3 100644 --- a/tests/baselines/reference/booleanFilterAnyArray.js +++ b/tests/baselines/reference/booleanFilterAnyArray.js @@ -26,10 +26,12 @@ var foos = [true, true, false, null].filter((thing): thing is boolean => thing ! //// [booleanFilterAnyArray.js] + var xs; var xs = anys.filter(Bullean); var ys; var ys = realanys.filter(Boolean); + var foo = [{ name: 'x' }]; var foor; var foor = foo.filter(function (x) { return x.name; }); diff --git a/tests/baselines/reference/booleanLiteralTypes1.js b/tests/baselines/reference/booleanLiteralTypes1.js index 6fb0244ac687d..a4b70ae992663 100644 --- a/tests/baselines/reference/booleanLiteralTypes1.js +++ b/tests/baselines/reference/booleanLiteralTypes1.js @@ -96,21 +96,25 @@ function f21(x: Item) { } //// [booleanLiteralTypes1.js] + function f1() { var a; var a; var a; var a; } + function f2(a, b) { a = b; b = a; } + function f3(a, b) { var x = a || b; var x = a && b; var x = !a; } + function f4(t, f) { var x1 = t && f; var x2 = f && t; @@ -119,20 +123,25 @@ function f4(t, f) { var x5 = !t; var x6 = !f; } + + function f5(b) { var z1 = g(true); var z2 = g(false); var z3 = g(b); } + function assertNever(x) { throw new Error("Unexpected value"); } + function f10(x) { switch (x) { case true: return "true"; case false: return "false"; } } + function f11(x) { switch (x) { case true: return "true"; @@ -140,6 +149,7 @@ function f11(x) { } return assertNever(x); } + function f12(x) { if (x) { x; @@ -148,6 +158,7 @@ function f12(x) { x; } } + function f13(x) { if (x === true) { x; @@ -156,12 +167,18 @@ function f13(x) { x; } } + + + + + function f20(x) { switch (x.kind) { case true: return x.a; case false: return x.b; } } + function f21(x) { switch (x.kind) { case true: return x.a; diff --git a/tests/baselines/reference/booleanLiteralTypes2.js b/tests/baselines/reference/booleanLiteralTypes2.js index 19bac7c362c5b..b99de6431ca38 100644 --- a/tests/baselines/reference/booleanLiteralTypes2.js +++ b/tests/baselines/reference/booleanLiteralTypes2.js @@ -96,21 +96,25 @@ function f21(x: Item) { } //// [booleanLiteralTypes2.js] + function f1() { var a; var a; var a; var a; } + function f2(a, b) { a = b; b = a; } + function f3(a, b) { var x = a || b; var x = a && b; var x = !a; } + function f4(t, f) { var x1 = t && f; var x2 = f && t; @@ -119,20 +123,25 @@ function f4(t, f) { var x5 = !t; var x6 = !f; } + + function f5(b) { var z1 = g(true); var z2 = g(false); var z3 = g(b); } + function assertNever(x) { throw new Error("Unexpected value"); } + function f10(x) { switch (x) { case true: return "true"; case false: return "false"; } } + function f11(x) { switch (x) { case true: return "true"; @@ -140,6 +149,7 @@ function f11(x) { } return assertNever(x); } + function f12(x) { if (x) { x; @@ -148,6 +158,7 @@ function f12(x) { x; } } + function f13(x) { if (x === true) { x; @@ -156,12 +167,18 @@ function f13(x) { x; } } + + + + + function f20(x) { switch (x.kind) { case true: return x.a; case false: return x.b; } } + function f21(x) { switch (x.kind) { case true: return x.a; diff --git a/tests/baselines/reference/booleanLiteralsContextuallyTypedFromUnion.js b/tests/baselines/reference/booleanLiteralsContextuallyTypedFromUnion.js index cf590eeaaaf62..b1fa2ce52828b 100644 --- a/tests/baselines/reference/booleanLiteralsContextuallyTypedFromUnion.js +++ b/tests/baselines/reference/booleanLiteralsContextuallyTypedFromUnion.js @@ -26,10 +26,22 @@ let Success = () => //// [booleanLiteralsContextuallyTypedFromUnion.jsx] "use strict"; + var isIt = Math.random() > 0.5; var c = isIt ? { isIt: isIt, text: 'hey' } : { isIt: isIt, value: 123 }; var cc = isIt ? { isIt: isIt, text: 'hey' } : { isIt: isIt, value: 123 }; + + + + + + + + + + var Funk = function (_props) { return
Hello
; }; + var Fail1 = function () { return ; }; var Fail2 = function () { return ; }; var True = true; diff --git a/tests/baselines/reference/booleanPropertyAccess.js b/tests/baselines/reference/booleanPropertyAccess.js index 5d816253c37eb..b65e428e99550 100644 --- a/tests/baselines/reference/booleanPropertyAccess.js +++ b/tests/baselines/reference/booleanPropertyAccess.js @@ -6,5 +6,6 @@ var b = x['toString'](); //// [booleanPropertyAccess.js] var x = true; + var a = x.toString(); var b = x['toString'](); diff --git a/tests/baselines/reference/breakInIterationOrSwitchStatement2.js b/tests/baselines/reference/breakInIterationOrSwitchStatement2.js index 903bed733db13..ce0a2a8655827 100644 --- a/tests/baselines/reference/breakInIterationOrSwitchStatement2.js +++ b/tests/baselines/reference/breakInIterationOrSwitchStatement2.js @@ -7,4 +7,5 @@ while (true); //// [breakInIterationOrSwitchStatement2.js] do { break; -} while (true); +} +while (true); diff --git a/tests/baselines/reference/cacheResolutions.js b/tests/baselines/reference/cacheResolutions.js index 39982790e8aac..a4a2656d996a2 100644 --- a/tests/baselines/reference/cacheResolutions.js +++ b/tests/baselines/reference/cacheResolutions.js @@ -11,22 +11,19 @@ export let x = 1; //// [app.js] define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; exports.x = void 0; exports.x = 1; }); //// [lib1.js] define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; exports.x = void 0; exports.x = 1; }); //// [lib2.js] define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; + "use strict";exports.__esModule = true; exports.x = void 0; exports.x = 1; }); diff --git a/tests/baselines/reference/callChain.2.js b/tests/baselines/reference/callChain.2.js index 89070f410033e..541412b9997f5 100644 --- a/tests/baselines/reference/callChain.2.js +++ b/tests/baselines/reference/callChain.2.js @@ -12,5 +12,7 @@ o3.b?.().c; //// [callChain.2.js] var _a; o1 === null || o1 === void 0 ? void 0 : o1(); + o2 === null || o2 === void 0 ? void 0 : o2.b(); + (_a = o3.b) === null || _a === void 0 ? void 0 : _a.call(o3).c; diff --git a/tests/baselines/reference/callChain.3.js b/tests/baselines/reference/callChain.3.js index b34458a26e755..b59fab8ca9ee2 100644 --- a/tests/baselines/reference/callChain.3.js +++ b/tests/baselines/reference/callChain.3.js @@ -17,6 +17,8 @@ var n1 = (_a = a === null || a === void 0 ? void 0 : a.m) === null || _a === voi var n2 = (_b = a === null || a === void 0 ? void 0 : a.m) === null || _b === void 0 ? void 0 : _b.call(a, { x: absorb() }); // likewise var n3 = (_c = a === null || a === void 0 ? void 0 : a.m) === null || _c === void 0 ? void 0 : _c.call(a, { x: 12 }); // should be ok var n4 = (_d = a === null || a === void 0 ? void 0 : a.m) === null || _d === void 0 ? void 0 : _d.call(a, { x: absorb() }); // likewise + + // Also a test showing `!` vs `?` for good measure var t1 = (_e = a === null || a === void 0 ? void 0 : a.m) === null || _e === void 0 ? void 0 : _e.call(a, { x: 12 }); t1 = a.m({ x: 12 }); diff --git a/tests/baselines/reference/callChain.js b/tests/baselines/reference/callChain.js index 754097db2d03e..4dc7e38b28c3b 100644 --- a/tests/baselines/reference/callChain.js +++ b/tests/baselines/reference/callChain.js @@ -53,6 +53,7 @@ o1 === null || o1 === void 0 ? void 0 : o1(); o1 === null || o1 === void 0 ? void 0 : o1(1); o1 === null || o1 === void 0 ? void 0 : o1.apply(void 0, [1, 2]); o1 === null || o1 === void 0 ? void 0 : o1.apply(void 0, __spreadArray(__spreadArray([1], [2, 3]), [4])); + o2 === null || o2 === void 0 ? void 0 : o2.b(); o2 === null || o2 === void 0 ? void 0 : o2.b(1); o2 === null || o2 === void 0 ? void 0 : o2.b.apply(o2, [1, 2]); @@ -61,6 +62,7 @@ o2 === null || o2 === void 0 ? void 0 : o2["b"](); o2 === null || o2 === void 0 ? void 0 : o2["b"](1); o2 === null || o2 === void 0 ? void 0 : o2["b"].apply(o2, [1, 2]); o2 === null || o2 === void 0 ? void 0 : o2["b"].apply(o2, __spreadArray(__spreadArray([1], [2, 3]), [4])); + (_a = o3.b) === null || _a === void 0 ? void 0 : _a.call(o3).c; (_b = o3.b) === null || _b === void 0 ? void 0 : _b.call(o3, 1).c; (_c = o3.b) === null || _c === void 0 ? void 0 : _c.call.apply(_c, __spreadArray([o3], [1, 2])).c; @@ -73,8 +75,11 @@ o2 === null || o2 === void 0 ? void 0 : o2["b"].apply(o2, __spreadArray(__spread (_k = o3["b"]) === null || _k === void 0 ? void 0 : _k.call(o3, 1).c; (_l = o3["b"]) === null || _l === void 0 ? void 0 : _l.call.apply(_l, __spreadArray([o3], [1, 2])).c; (_m = o3["b"]) === null || _m === void 0 ? void 0 : _m.call.apply(_m, __spreadArray(__spreadArray([o3, 1], [2, 3]), [4])).c; + var v = o4 === null || o4 === void 0 ? void 0 : o4(incr); + (_o = o5()) === null || _o === void 0 ? void 0 : _o(); + // GH#36031 o2 === null || o2 === void 0 ? void 0 : o2.b().toString; o2 === null || o2 === void 0 ? void 0 : o2.b().toString; diff --git a/tests/baselines/reference/callChainWithSuper(target=es2016).js b/tests/baselines/reference/callChainWithSuper(target=es2016).js index fcfbb5db553f4..dd997e762c6b7 100644 --- a/tests/baselines/reference/callChainWithSuper(target=es2016).js +++ b/tests/baselines/reference/callChainWithSuper(target=es2016).js @@ -9,9 +9,7 @@ class Derived extends Base { //// [callChainWithSuper.js] "use strict"; // GH#34952 -class Base { - method() { } -} +class Base {method() { }} class Derived extends Base { method1() { var _a; return (_a = super.method) === null || _a === void 0 ? void 0 : _a.call(this); } method2() { var _a; return (_a = super["method"]) === null || _a === void 0 ? void 0 : _a.call(this); } diff --git a/tests/baselines/reference/callChainWithSuper(target=es2017).js b/tests/baselines/reference/callChainWithSuper(target=es2017).js index fcfbb5db553f4..dd997e762c6b7 100644 --- a/tests/baselines/reference/callChainWithSuper(target=es2017).js +++ b/tests/baselines/reference/callChainWithSuper(target=es2017).js @@ -9,9 +9,7 @@ class Derived extends Base { //// [callChainWithSuper.js] "use strict"; // GH#34952 -class Base { - method() { } -} +class Base {method() { }} class Derived extends Base { method1() { var _a; return (_a = super.method) === null || _a === void 0 ? void 0 : _a.call(this); } method2() { var _a; return (_a = super["method"]) === null || _a === void 0 ? void 0 : _a.call(this); } diff --git a/tests/baselines/reference/callChainWithSuper(target=es2018).js b/tests/baselines/reference/callChainWithSuper(target=es2018).js index fcfbb5db553f4..dd997e762c6b7 100644 --- a/tests/baselines/reference/callChainWithSuper(target=es2018).js +++ b/tests/baselines/reference/callChainWithSuper(target=es2018).js @@ -9,9 +9,7 @@ class Derived extends Base { //// [callChainWithSuper.js] "use strict"; // GH#34952 -class Base { - method() { } -} +class Base {method() { }} class Derived extends Base { method1() { var _a; return (_a = super.method) === null || _a === void 0 ? void 0 : _a.call(this); } method2() { var _a; return (_a = super["method"]) === null || _a === void 0 ? void 0 : _a.call(this); } diff --git a/tests/baselines/reference/callChainWithSuper(target=es2019).js b/tests/baselines/reference/callChainWithSuper(target=es2019).js index fcfbb5db553f4..dd997e762c6b7 100644 --- a/tests/baselines/reference/callChainWithSuper(target=es2019).js +++ b/tests/baselines/reference/callChainWithSuper(target=es2019).js @@ -9,9 +9,7 @@ class Derived extends Base { //// [callChainWithSuper.js] "use strict"; // GH#34952 -class Base { - method() { } -} +class Base {method() { }} class Derived extends Base { method1() { var _a; return (_a = super.method) === null || _a === void 0 ? void 0 : _a.call(this); } method2() { var _a; return (_a = super["method"]) === null || _a === void 0 ? void 0 : _a.call(this); } diff --git a/tests/baselines/reference/callChainWithSuper(target=es2020).js b/tests/baselines/reference/callChainWithSuper(target=es2020).js index 30e1ad3886dc5..d1913608f87b8 100644 --- a/tests/baselines/reference/callChainWithSuper(target=es2020).js +++ b/tests/baselines/reference/callChainWithSuper(target=es2020).js @@ -9,9 +9,7 @@ class Derived extends Base { //// [callChainWithSuper.js] "use strict"; // GH#34952 -class Base { - method() { } -} +class Base {method() { }} class Derived extends Base { method1() { return super.method?.(); } method2() { return super["method"]?.(); } diff --git a/tests/baselines/reference/callChainWithSuper(target=es5).js b/tests/baselines/reference/callChainWithSuper(target=es5).js index e609c2a5258a4..740873d357961 100644 --- a/tests/baselines/reference/callChainWithSuper(target=es5).js +++ b/tests/baselines/reference/callChainWithSuper(target=es5).js @@ -25,8 +25,7 @@ var __extends = (this && this.__extends) || (function () { })(); // GH#34952 var Base = /** @class */ (function () { - function Base() { - } + function Base() {} Base.prototype.method = function () { }; return Base; }()); diff --git a/tests/baselines/reference/callChainWithSuper(target=es6).js b/tests/baselines/reference/callChainWithSuper(target=es6).js index fcfbb5db553f4..dd997e762c6b7 100644 --- a/tests/baselines/reference/callChainWithSuper(target=es6).js +++ b/tests/baselines/reference/callChainWithSuper(target=es6).js @@ -9,9 +9,7 @@ class Derived extends Base { //// [callChainWithSuper.js] "use strict"; // GH#34952 -class Base { - method() { } -} +class Base {method() { }} class Derived extends Base { method1() { var _a; return (_a = super.method) === null || _a === void 0 ? void 0 : _a.call(this); } method2() { var _a; return (_a = super["method"]) === null || _a === void 0 ? void 0 : _a.call(this); } diff --git a/tests/baselines/reference/callChainWithSuper(target=esnext).js b/tests/baselines/reference/callChainWithSuper(target=esnext).js index 30e1ad3886dc5..d1913608f87b8 100644 --- a/tests/baselines/reference/callChainWithSuper(target=esnext).js +++ b/tests/baselines/reference/callChainWithSuper(target=esnext).js @@ -9,9 +9,7 @@ class Derived extends Base { //// [callChainWithSuper.js] "use strict"; // GH#34952 -class Base { - method() { } -} +class Base {method() { }} class Derived extends Base { method1() { return super.method?.(); } method2() { return super["method"]?.(); } diff --git a/tests/baselines/reference/callConstructAssignment.js b/tests/baselines/reference/callConstructAssignment.js index 3266df5314b6b..5da23bc1542b5 100644 --- a/tests/baselines/reference/callConstructAssignment.js +++ b/tests/baselines/reference/callConstructAssignment.js @@ -8,6 +8,7 @@ bar = foo; // error //// [callConstructAssignment.js] var foo; + var bar; foo = bar; // error bar = foo; // error diff --git a/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.js b/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.js index 3f5fb14b1a953..4613216b181bf 100644 --- a/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.js +++ b/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.js @@ -47,15 +47,19 @@ var r7b = i2.f(1, ''); //// [callGenericFunctionWithIncorrectNumberOfTypeArguments.js] // type parameter lists must exactly match type argument lists // all of these invocations are errors + function f(x, y) { return null; } var r1 = f(1, ''); var r1b = f(1, ''); + var f2 = function (x, y) { return null; }; var r2 = f2(1, ''); var r2b = f2(1, ''); + var f3; var r3 = f3(1, ''); var r3b = f3(1, ''); + var C = /** @class */ (function () { function C() { } @@ -66,9 +70,11 @@ var C = /** @class */ (function () { }()); var r4 = (new C()).f(1, ''); var r4b = (new C()).f(1, ''); + var i; var r5 = i.f(1, ''); var r5b = i.f(1, ''); + var C2 = /** @class */ (function () { function C2() { } @@ -79,6 +85,7 @@ var C2 = /** @class */ (function () { }()); var r6 = (new C2()).f(1, ''); var r6b = (new C2()).f(1, ''); + var i2; var r7 = i2.f(1, ''); var r7b = i2.f(1, ''); diff --git a/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.js b/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.js index fd46b841a0284..4f77fad160f25 100644 --- a/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.js +++ b/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.js @@ -38,6 +38,7 @@ var r7 = i2.f(1); //// [callGenericFunctionWithZeroTypeArguments.js] // valid invocations of generic functions with no explicit type arguments provided + function f(x) { return null; } var r = f(1); var f2 = function (x) { return null; }; diff --git a/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.js b/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.js index b94a3208c5c86..dd65d3ffca1dc 100644 --- a/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.js +++ b/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.js @@ -46,12 +46,16 @@ var r8 = a2(); //// [callNonGenericFunctionWithTypeArguments.js] // it is always illegal to provide type arguments to a non-generic function // all invocations here are illegal + function f(x) { return null; } var r = f(1); + var f2 = function (x) { return null; }; var r2 = f2(1); + var f3; var r3 = f3(1); + var C = /** @class */ (function () { function C() { } @@ -61,8 +65,10 @@ var C = /** @class */ (function () { return C; }()); var r4 = (new C()).f(1); + var i; var r5 = i.f(1); + var C2 = /** @class */ (function () { function C2() { } @@ -72,9 +78,11 @@ var C2 = /** @class */ (function () { return C2; }()); var r6 = (new C2()).f(1); + var i2; var r7 = i2.f(1); var a; var r8 = a(); + var a2; var r8 = a2(); diff --git a/tests/baselines/reference/callOnClass.js b/tests/baselines/reference/callOnClass.js index 1a6333945b759..46d6bead3ea7a 100644 --- a/tests/baselines/reference/callOnClass.js +++ b/tests/baselines/reference/callOnClass.js @@ -6,8 +6,7 @@ var c = C(); //// [callOnClass.js] var C = /** @class */ (function () { - function C() { - } + function C() {} return C; }()); var c = C(); diff --git a/tests/baselines/reference/callOnInstance.js b/tests/baselines/reference/callOnInstance.js index 3b07d0affc8e9..30a5efc2a28de 100644 --- a/tests/baselines/reference/callOnInstance.js +++ b/tests/baselines/reference/callOnInstance.js @@ -11,6 +11,10 @@ declare class C { constructor(value: number); } (new C(1))(); // Error for calling an instance //// [callOnInstance.js] + + var s1 = D(); // OK + var s2 = (new D(1))(); + (new C(1))(); // Error for calling an instance diff --git a/tests/baselines/reference/callOverloads1.js b/tests/baselines/reference/callOverloads1.js index ac5a15d953c9d..39a5782ac20ce 100644 --- a/tests/baselines/reference/callOverloads1.js +++ b/tests/baselines/reference/callOverloads1.js @@ -27,5 +27,7 @@ var Foo = /** @class */ (function () { }()); function F1(a) { return a; } var f1 = new Foo("hey"); + + f1.bar1(); Foo(); diff --git a/tests/baselines/reference/callOverloads2.js b/tests/baselines/reference/callOverloads2.js index ee1300ee5dedb..2f1ef0292df53 100644 --- a/tests/baselines/reference/callOverloads2.js +++ b/tests/baselines/reference/callOverloads2.js @@ -31,8 +31,13 @@ var Foo = /** @class */ (function () { Foo.prototype.bar1 = function () { }; return Foo; }()); + function F1(s) { return s; } // error function F1(a) { return a; } // error + + var f1 = new Foo("hey"); + + f1.bar1(); Foo(); diff --git a/tests/baselines/reference/callOverloads3.js b/tests/baselines/reference/callOverloads3.js index f2f3498c83189..e21f1aec99903 100644 --- a/tests/baselines/reference/callOverloads3.js +++ b/tests/baselines/reference/callOverloads3.js @@ -27,6 +27,8 @@ var Foo = /** @class */ (function () { }()); //class Foo(s: String); var f1 = new Foo("hey"); + + f1.bar1(); Foo(); Foo("s"); diff --git a/tests/baselines/reference/callOverloads4.js b/tests/baselines/reference/callOverloads4.js index 60757da34bd78..4682cbc07f9ba 100644 --- a/tests/baselines/reference/callOverloads4.js +++ b/tests/baselines/reference/callOverloads4.js @@ -26,6 +26,8 @@ var Foo = /** @class */ (function () { return Foo; }()); var f1 = new Foo("hey"); + + f1.bar1(); Foo(); Foo("s"); diff --git a/tests/baselines/reference/callOverloads5.js b/tests/baselines/reference/callOverloads5.js index 4ccc1f5ea2699..b0e0c2a176b93 100644 --- a/tests/baselines/reference/callOverloads5.js +++ b/tests/baselines/reference/callOverloads5.js @@ -29,6 +29,8 @@ var Foo = /** @class */ (function () { }()); //class Foo(s: String); var f1 = new Foo("hey"); + + f1.bar1("a"); Foo(); Foo("s"); diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance.js index 3b540397d556a..96d007bb4b769 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance.js @@ -68,3 +68,4 @@ module MemberWithCallSignature { } //// [callSignatureAssignabilityInInheritance.js] + diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js index 9b34bf876d9aa..bf63d87ef1486 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js @@ -86,9 +86,9 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + var Base = /** @class */ (function () { - function Base() { - } + function Base() {} return Base; }()); var Derived = /** @class */ (function (_super) { @@ -112,3 +112,4 @@ var OtherDerived = /** @class */ (function (_super) { } return OtherDerived; }(Base)); + diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js index 5f2236525ca8e..817dfed4c4736 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js @@ -134,8 +134,7 @@ var __extends = (this && this.__extends) || (function () { var Errors; (function (Errors) { var Base = /** @class */ (function () { - function Base() { - } + function Base() {} return Base; }()); var Derived = /** @class */ (function (_super) { @@ -159,4 +158,5 @@ var Errors; } return OtherDerived; }(Base)); + })(Errors || (Errors = {})); diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js index 7623aecc041b5..d673d1f2effb2 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js @@ -66,9 +66,9 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + var Base = /** @class */ (function () { - function Base() { - } + function Base() {} return Base; }()); var Derived = /** @class */ (function (_super) { @@ -92,3 +92,4 @@ var OtherDerived = /** @class */ (function (_super) { } return OtherDerived; }(Base)); + diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js index 91bea2770900a..019a609085b3f 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js @@ -66,9 +66,9 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + var Base = /** @class */ (function () { - function Base() { - } + function Base() {} return Base; }()); var Derived = /** @class */ (function (_super) { @@ -92,3 +92,5 @@ var OtherDerived = /** @class */ (function (_super) { } return OtherDerived; }(Base)); + + diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js index 3cff80c2eaf64..8a2028809f5f4 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js @@ -69,9 +69,9 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + var Base = /** @class */ (function () { - function Base() { - } + function Base() {} return Base; }()); var Derived = /** @class */ (function (_super) { @@ -95,3 +95,10 @@ var OtherDerived = /** @class */ (function (_super) { } return OtherDerived; }(Base)); + + + + + + + diff --git a/tests/baselines/reference/callSignatureFunctionOverload.js b/tests/baselines/reference/callSignatureFunctionOverload.js index 6da28693bced3..de66be6460d1b 100644 --- a/tests/baselines/reference/callSignatureFunctionOverload.js +++ b/tests/baselines/reference/callSignatureFunctionOverload.js @@ -16,4 +16,5 @@ var foo2: { //// [callSignatureFunctionOverload.js] var foo; + var foo2; diff --git a/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.js b/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.js index 4ff809379193b..85e49a7675e33 100644 --- a/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.js +++ b/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.js @@ -57,15 +57,10 @@ b.b(1); //// [callSignatureWithOptionalParameterAndInitializer.js] // Optional parameters cannot also have initializer expressions, these are all errors -function foo(x) { - if (x === void 0) { x = 1; } -} -var f = function foo(x) { - if (x === void 0) { x = 1; } -}; -var f2 = function (x, y) { - if (y === void 0) { y = 1; } -}; + +function foo(x) {if (x === void 0) { x = 1; }} +var f = function foo(x) {if (x === void 0) { x = 1; }}; +var f2 = function (x, y) {if (y === void 0) { y = 1; }}; foo(1); foo(); f(1); @@ -75,14 +70,13 @@ f2(1, 2); var C = /** @class */ (function () { function C() { } - C.prototype.foo = function (x) { - if (x === void 0) { x = 1; } - }; + C.prototype.foo = function (x) {if (x === void 0) { x = 1; }}; return C; }()); var c; c.foo(); c.foo(1); + var i; i(); i(1); @@ -94,15 +88,9 @@ a(1); a.foo(); a.foo(1); var b = { - foo: function (x) { - if (x === void 0) { x = 1; } - }, - a: function foo(x, y) { - if (y === void 0) { y = ''; } - }, - b: function (x) { - if (x === void 0) { x = ''; } - } + foo: function (x) {if (x === void 0) { x = 1; }}, + a: function foo(x, y) {if (y === void 0) { y = ''; }}, + b: function (x) {if (x === void 0) { x = ''; }} }; b.foo(); b.foo(1); diff --git a/tests/baselines/reference/callSignatureWithoutAnnotationsOrBody.js b/tests/baselines/reference/callSignatureWithoutAnnotationsOrBody.js index 24c71c985057c..5380eba7ebc35 100644 --- a/tests/baselines/reference/callSignatureWithoutAnnotationsOrBody.js +++ b/tests/baselines/reference/callSignatureWithoutAnnotationsOrBody.js @@ -21,6 +21,7 @@ var r5 = a.f(); //// [callSignatureWithoutAnnotationsOrBody.js] // Call signatures without a return type annotation and function body return 'any' + function foo(x) { } var r = foo(1); // void since there's a body var i; diff --git a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js index 9ecceb3ff4fa1..d4c290208fc77 100644 --- a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js +++ b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js @@ -127,10 +127,12 @@ function foo(x) { return 1; } var r = foo(1); + function foo2(x) { return foo(x); } var r2 = foo2(1); + function foo3() { return foo3(); } @@ -139,15 +141,16 @@ function foo4(x) { return x; } var r4 = foo4(1); + function foo5(x) { if (true) { return 1; - } - else { + } else { return 2; } } var r5 = foo5(1); + function foo6(x) { try { } @@ -159,6 +162,7 @@ function foo6(x) { } } var r6 = foo6(1); + function foo7(x) { return typeof x; } @@ -187,8 +191,7 @@ var M; (function (M) { M.x = 1; var C = /** @class */ (function () { - function C() { - } + function C() {} return C; }()); M.C = C; @@ -202,17 +205,15 @@ function foo12() { return i2; } var r12 = foo12(); + function m1() { return 1; } -(function (m1) { - m1.y = 2; -})(m1 || (m1 = {})); +(function (m1) {m1.y = 2;})(m1 || (m1 = {})); function foo13() { return m1; } var r13 = foo13(); var c1 = /** @class */ (function () { - function c1(x) { - } + function c1(x) {} return c1; }()); (function (c1) { @@ -226,9 +227,7 @@ var e1; (function (e1) { e1[e1["A"] = 0] = "A"; })(e1 || (e1 = {})); -(function (e1) { - e1.y = 1; -})(e1 || (e1 = {})); +(function (e1) {e1.y = 1;})(e1 || (e1 = {})); function foo15() { return e1; } diff --git a/tests/baselines/reference/callSignaturesShouldBeResolvedBeforeSpecialization.js b/tests/baselines/reference/callSignaturesShouldBeResolvedBeforeSpecialization.js index b2cf7d5f5c517..d6124c21f17d8 100644 --- a/tests/baselines/reference/callSignaturesShouldBeResolvedBeforeSpecialization.js +++ b/tests/baselines/reference/callSignaturesShouldBeResolvedBeforeSpecialization.js @@ -11,6 +11,7 @@ function foo() { } //// [callSignaturesShouldBeResolvedBeforeSpecialization.js] + function foo() { var test; test("expects boolean instead of string"); // should not error - "test" should not expect a boolean diff --git a/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType.js b/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType.js index 8d5b59f84d125..2212fa28bf42d 100644 --- a/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType.js +++ b/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType.js @@ -29,5 +29,9 @@ var a2: { } //// [callSignaturesThatDifferOnlyByReturnType.js] + + + var a; + var a2; diff --git a/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.js b/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.js index ae6f4db7e38ba..011ce2512a5e5 100644 --- a/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.js +++ b/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.js @@ -17,6 +17,9 @@ var r2 = x.foo(''); // error //// [callSignaturesThatDifferOnlyByReturnType2.js] // Normally it is an error to have multiple overloads which differ only by return type in a single type declaration. // Here the multiple overloads come from multiple bases. + + + var x; // BUG 822524 var r = x.foo(1); // no error diff --git a/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType3.js b/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType3.js index b67b619d7390b..a3b36513e6e3c 100644 --- a/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType3.js +++ b/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType3.js @@ -21,3 +21,7 @@ interface I2 { //// [callSignaturesThatDifferOnlyByReturnType3.js] // Normally it is an error to have multiple overloads with identical signatures in a single type declaration. // Here the multiple overloads come from multiple merged declarations. + + + + diff --git a/tests/baselines/reference/callSignaturesWithAccessibilityModifiersOnParameters.js b/tests/baselines/reference/callSignaturesWithAccessibilityModifiersOnParameters.js index e2a3599f0daa7..4c098731fbcaf 100644 --- a/tests/baselines/reference/callSignaturesWithAccessibilityModifiersOnParameters.js +++ b/tests/baselines/reference/callSignaturesWithAccessibilityModifiersOnParameters.js @@ -40,16 +40,19 @@ var b = { //// [callSignaturesWithAccessibilityModifiersOnParameters.js] // Call signature parameters do not allow accessibility modifiers + function foo(x, y) { } var f = function foo(x, y) { }; var f2 = function (x, y) { }; var f3 = function (x, y) { }; var f4 = function (x, y) { }; + function foo2(x, y) { } var f5 = function foo(x, y) { }; var f6 = function (x, y) { }; var f7 = function (x, y) { }; var f8 = function (x, y) { }; + var C = /** @class */ (function () { function C() { } @@ -58,7 +61,9 @@ var C = /** @class */ (function () { C.prototype.foo3 = function (x, y) { }; return C; }()); + var a; + var b = { foo: function (x, y) { }, a: function foo(x, y) { }, diff --git a/tests/baselines/reference/callSignaturesWithDuplicateParameters.js b/tests/baselines/reference/callSignaturesWithDuplicateParameters.js index ed9d2cb3e3573..a402d625035e8 100644 --- a/tests/baselines/reference/callSignaturesWithDuplicateParameters.js +++ b/tests/baselines/reference/callSignaturesWithDuplicateParameters.js @@ -40,16 +40,19 @@ var b = { //// [callSignaturesWithDuplicateParameters.js] // Duplicate parameter names are always an error + function foo(x, x) { } var f = function foo(x, x) { }; var f2 = function (x, x) { }; var f3 = function (x, x) { }; var f4 = function (x, x) { }; + function foo2(x, x) { } var f5 = function foo(x, x) { }; var f6 = function (x, x) { }; var f7 = function (x, x) { }; var f8 = function (x, y) { }; + var C = /** @class */ (function () { function C() { } @@ -58,7 +61,9 @@ var C = /** @class */ (function () { C.prototype.foo3 = function (x, x) { }; return C; }()); + var a; + var b = { foo: function (x, x) { }, a: function foo(x, x) { }, diff --git a/tests/baselines/reference/callSignaturesWithOptionalParameters.js b/tests/baselines/reference/callSignaturesWithOptionalParameters.js index 1a5aad8c0e19e..a94d4567283dd 100644 --- a/tests/baselines/reference/callSignaturesWithOptionalParameters.js +++ b/tests/baselines/reference/callSignaturesWithOptionalParameters.js @@ -57,6 +57,7 @@ b.b(1); //// [callSignaturesWithOptionalParameters.js] // Optional parameters should be valid in all the below casts + function foo(x) { } var f = function foo(x) { }; var f2 = function (x, y) { }; @@ -75,6 +76,7 @@ var C = /** @class */ (function () { var c; c.foo(); c.foo(1); + var i; i(); i(1); diff --git a/tests/baselines/reference/callSignaturesWithOptionalParameters2.js b/tests/baselines/reference/callSignaturesWithOptionalParameters2.js index dbd8ad1f424e1..05f42ab884907 100644 --- a/tests/baselines/reference/callSignaturesWithOptionalParameters2.js +++ b/tests/baselines/reference/callSignaturesWithOptionalParameters2.js @@ -61,6 +61,7 @@ a.foo(1, 2, 3); //// [callSignaturesWithOptionalParameters2.js] // Optional parameters should be valid in all the below casts + function foo(x) { } foo(1); foo(); @@ -71,14 +72,19 @@ var C = /** @class */ (function () { function C() { } C.prototype.foo = function (x) { }; + + + C.prototype.foo2 = function (x, y) { }; return C; }()); var c; c.foo(); c.foo(1); + c.foo2(1); c.foo2(1, 2); + var i; i(); i(1); diff --git a/tests/baselines/reference/callSignaturesWithParameterInitializers.js b/tests/baselines/reference/callSignaturesWithParameterInitializers.js index 528b2a3d00e3d..b36911ca883ab 100644 --- a/tests/baselines/reference/callSignaturesWithParameterInitializers.js +++ b/tests/baselines/reference/callSignaturesWithParameterInitializers.js @@ -59,15 +59,10 @@ b.b(1); //// [callSignaturesWithParameterInitializers.js] // Optional parameters allow initializers only in implementation signatures -function foo(x) { - if (x === void 0) { x = 1; } -} -var f = function foo(x) { - if (x === void 0) { x = 1; } -}; -var f2 = function (x, y) { - if (y === void 0) { y = 1; } -}; + +function foo(x) {if (x === void 0) { x = 1; }} +var f = function foo(x) {if (x === void 0) { x = 1; }}; +var f2 = function (x, y) {if (y === void 0) { y = 1; }}; foo(1); foo(); f(1); @@ -77,14 +72,13 @@ f2(1, 2); var C = /** @class */ (function () { function C() { } - C.prototype.foo = function (x) { - if (x === void 0) { x = 1; } - }; + C.prototype.foo = function (x) {if (x === void 0) { x = 1; }}; return C; }()); var c; c.foo(); c.foo(1); + var i; i(); i(1); @@ -97,15 +91,9 @@ a(1); a.foo(); a.foo(1); var b = { - foo: function (x) { - if (x === void 0) { x = 1; } - }, - a: function foo(x, y) { - if (y === void 0) { y = 1; } - }, - b: function (x) { - if (x === void 0) { x = 1; } - } + foo: function (x) {if (x === void 0) { x = 1; }}, + a: function foo(x, y) {if (y === void 0) { y = 1; }}, + b: function (x) {if (x === void 0) { x = 1; }} }; b.foo(); b.foo(1); diff --git a/tests/baselines/reference/callSignaturesWithParameterInitializers2.js b/tests/baselines/reference/callSignaturesWithParameterInitializers2.js index 10aaaf44b6ec2..ec548b81aad63 100644 --- a/tests/baselines/reference/callSignaturesWithParameterInitializers2.js +++ b/tests/baselines/reference/callSignaturesWithParameterInitializers2.js @@ -28,29 +28,22 @@ b.foo(1); //// [callSignaturesWithParameterInitializers2.js] // Optional parameters allow initializers only in implementation signatures // All the below declarations are errors -function foo(x) { - if (x === void 0) { x = 1; } -} + +function foo(x) {if (x === void 0) { x = 1; }} foo(1); foo(); var C = /** @class */ (function () { function C() { } - C.prototype.foo = function (x) { - if (x === void 0) { x = 1; } - }; + C.prototype.foo = function (x) {if (x === void 0) { x = 1; }}; return C; }()); var c; c.foo(); c.foo(1); var b = { - foo: function (x) { - if (x === void 0) { x = 1; } - }, - foo: function (x) { - if (x === void 0) { x = 1; } - } + foo: function (x) {if (x === void 0) { x = 1; }}, + foo: function (x) {if (x === void 0) { x = 1; }} }; b.foo(); b.foo(1); diff --git a/tests/baselines/reference/callWithMissingVoid.js b/tests/baselines/reference/callWithMissingVoid.js index 50282931fa68f..c73c2b2df9e72 100644 --- a/tests/baselines/reference/callWithMissingVoid.js +++ b/tests/baselines/reference/callWithMissingVoid.js @@ -112,6 +112,10 @@ new MyPromise(function (resolve) { return resolve(); }); // no error new MyPromise(function (resolve) { return resolve(); }); // error, `any` arguments cannot be omitted new MyPromise(function (resolve) { return resolve(); }); // error, `unknown` arguments cannot be omitted new MyPromise(function (resolve) { return resolve(); }); // error, `never` arguments cannot be omitted + + + + // Multiple parameters function a(x, y, z) { } @@ -130,8 +134,10 @@ c(3, void 0, void 0); // ok c(3, void 0); // ok c(3); // ok c(); // ok + call(function (x, y) { return x + y; }); // error call(function (x, y) { return x + y; }, 4, 2); // ok + call(function (x, y) { return x; }, 4, void 0); // ok call(function (x, y) { return x; }, 4); // ok call(function (x, y) { return 42; }); // ok diff --git a/tests/baselines/reference/callWithSpread.js b/tests/baselines/reference/callWithSpread.js index 99b869e7a9885..758e20ec9f452 100644 --- a/tests/baselines/reference/callWithSpread.js +++ b/tests/baselines/reference/callWithSpread.js @@ -80,12 +80,13 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) { return to; }; var _a, _b, _c, _d, _e, _f, _g; -function foo(x, y) { - var z = []; + +function foo(x, y) {var z = []; for (var _i = 2; _i < arguments.length; _i++) { z[_i - 2] = arguments[_i]; } } + var a; var z; var obj; @@ -96,30 +97,32 @@ foo.apply(void 0, __spreadArray(__spreadArray([1, 2], a), ["abc"])); obj.foo(1, 2, "abc"); obj.foo.apply(obj, __spreadArray([1, 2], a)); obj.foo.apply(obj, __spreadArray(__spreadArray([1, 2], a), ["abc"])); + obj.foo.apply(obj, __spreadArray([1, 2], a)).foo(1, 2, "abc"); (_a = obj.foo.apply(obj, __spreadArray([1, 2], a))).foo.apply(_a, __spreadArray([1, 2], a)); (_b = obj.foo.apply(obj, __spreadArray([1, 2], a))).foo.apply(_b, __spreadArray(__spreadArray([1, 2], a), ["abc"])); (obj.foo)(1, 2, "abc"); obj.foo.apply(obj, __spreadArray([1, 2], a)); obj.foo.apply(obj, __spreadArray(__spreadArray([1, 2], a), ["abc"])); + (obj.foo.apply(obj, __spreadArray([1, 2], a)).foo)(1, 2, "abc"); (_c = obj.foo.apply(obj, __spreadArray([1, 2], a))).foo.apply(_c, __spreadArray([1, 2], a)); (_d = obj.foo.apply(obj, __spreadArray([1, 2], a))).foo.apply(_d, __spreadArray(__spreadArray([1, 2], a), ["abc"])); xa[1].foo(1, 2, "abc"); (_e = xa[1]).foo.apply(_e, __spreadArray([1, 2], a)); (_f = xa[1]).foo.apply(_f, __spreadArray(__spreadArray([1, 2], a), ["abc"])); + (_g = xa[1]).foo.apply(_g, [1, 2, "abc"]); + var C = /** @class */ (function () { - function C(x, y) { - var z = []; + function C(x, y) {var z = []; for (var _i = 2; _i < arguments.length; _i++) { z[_i - 2] = arguments[_i]; } this.foo(x, y); this.foo.apply(this, __spreadArray([x, y], z)); } - C.prototype.foo = function (x, y) { - var z = []; + C.prototype.foo = function (x, y) {var z = []; for (var _i = 2; _i < arguments.length; _i++) { z[_i - 2] = arguments[_i]; } diff --git a/tests/baselines/reference/callWithSpread2.js b/tests/baselines/reference/callWithSpread2.js index a511921e3e5fe..723fc49ac81f6 100644 --- a/tests/baselines/reference/callWithSpread2.js +++ b/tests/baselines/reference/callWithSpread2.js @@ -43,6 +43,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) { to[j] = from[i]; return to; }; + + // good all.apply(void 0, ns); weird.apply(void 0, ns); @@ -50,9 +52,12 @@ weird.apply(void 0, mixed); weird.apply(void 0, tuple); prefix.apply(void 0, __spreadArray(["a"], ns)); rest.apply(void 0, __spreadArray(["d"], ns)); + + // extra arguments normal.apply(void 0, __spreadArray(["g"], ns)); thunk.apply(void 0, ns); + // bad all.apply(void 0, mixed); all.apply(void 0, tuple); diff --git a/tests/baselines/reference/callWithSpread3.js b/tests/baselines/reference/callWithSpread3.js index f94e74b1dd434..5e3dc66805766 100644 --- a/tests/baselines/reference/callWithSpread3.js +++ b/tests/baselines/reference/callWithSpread3.js @@ -42,6 +42,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) { to[j] = from[i]; return to; }; + + // error fs2.apply(void 0, __spreadArray(['a'], s2)); // error on ...s2 fs2.apply(void 0, __spreadArray(['a', 'b', 'c'], s2)); // error on 'c' and ...s2 @@ -53,8 +55,11 @@ fs2_.apply(void 0, s_); // error on ...s_ fs2_.apply(void 0, s2n_); // error on ...s2n_ fs2_.apply(void 0, __spreadArray(__spreadArray([], s_), s_)); // error FIXME: bad error message fs2_.apply(void 0, __spreadArray(__spreadArray(__spreadArray([], s_), s_), s_)); // error FIXME: worse error message + // fs2n_(...s2, ...s_); // FIXME: should be a type error fs2n_.apply(void 0, s2_); // error on ...s2_ + + // ok fs2_.apply(void 0, s2_); fs2_.apply(void 0, __spreadArray(__spreadArray([], s2_), s_)); diff --git a/tests/baselines/reference/callWithSpreadES6.js b/tests/baselines/reference/callWithSpreadES6.js index 9e7f244d41a5e..9e5b3bcc01ff4 100644 --- a/tests/baselines/reference/callWithSpreadES6.js +++ b/tests/baselines/reference/callWithSpreadES6.js @@ -51,8 +51,10 @@ class D extends C { //// [callWithSpreadES6.js] + function foo(x, y, ...z) { } + var a; var z; var obj; @@ -60,16 +62,20 @@ var xa; foo(1, 2, "abc"); foo(1, 2, ...a); foo(1, 2, ...a, "abc"); + obj.foo(1, 2, "abc"); obj.foo(1, 2, ...a); obj.foo(1, 2, ...a, "abc"); + (obj.foo)(1, 2, "abc"); (obj.foo)(1, 2, ...a); (obj.foo)(1, 2, ...a, "abc"); + xa[1].foo(1, 2, "abc"); xa[1].foo(1, 2, ...a); xa[1].foo(1, 2, ...a, "abc"); xa[1].foo(...[1, 2, "abc"]); + class C { constructor(x, y, ...z) { this.foo(x, y); diff --git a/tests/baselines/reference/callWithWrongNumberOfTypeArguments.js b/tests/baselines/reference/callWithWrongNumberOfTypeArguments.js index 74ea401ae3bce..7cec17f370b3f 100644 --- a/tests/baselines/reference/callWithWrongNumberOfTypeArguments.js +++ b/tests/baselines/reference/callWithWrongNumberOfTypeArguments.js @@ -7,6 +7,7 @@ f(); //// [callWithWrongNumberOfTypeArguments.js] function f() { } + f(); f(); f(); diff --git a/tests/baselines/reference/callbacksDontShareTypes.js b/tests/baselines/reference/callbacksDontShareTypes.js index e6483638058ea..7941300f1ba4d 100644 --- a/tests/baselines/reference/callbacksDontShareTypes.js +++ b/tests/baselines/reference/callbacksDontShareTypes.js @@ -19,8 +19,10 @@ var r5a = _.map(c2, (x) => { return x.toFixed() }); var r5b = _.map(c2, rf1); //// [callbacksDontShareTypes.js] + var _; var c2; + var rf1 = function (x) { return x.toFixed(); }; var r1a = _.map(c2, function (x) { return x.toFixed(); }); var r1b = _.map(c2, rf1); // this line should not cause the following 2 to have errors diff --git a/tests/baselines/reference/callsOnComplexSignatures.js b/tests/baselines/reference/callsOnComplexSignatures.js index f631f674269cf..0eb78aa0d0cd2 100644 --- a/tests/baselines/reference/callsOnComplexSignatures.js +++ b/tests/baselines/reference/callsOnComplexSignatures.js @@ -112,43 +112,64 @@ var __importDefault = (this && this.__importDefault) || function (mod) { exports.__esModule = true; /// var react_1 = __importDefault(require("react")); + // Simple calls from real usecases function test1() { + + + function test(t) { var z = t.getValue("bar"); // Should be fine } } + function test2() { + var messages = { foo: function (options) { return "Foo"; }, bar: function (options) { return "Bar"; } }; + var test1 = function (type) { - return messages[type]({ a: "A", b: 0 }); - }; + return messages[type]({ a: "A", b: 0 });}; } + function test3(items) { items.forEach(function (item) { return console.log(item); }); } -function test4(arg1, arg2, arg3, arg4, arg5, arg6) { + +function test4( +arg1, + arg2, + arg3, + arg4, + arg5, + arg6 +) { arg1(); arg1({ x: 0, y: 0 }); arg1({ x: 0, y: 0 }, { x: 1, y: 1 }); + arg2({ x: 0 }, { x: 0 }); + arg3({ x: 0 }); arg3({ x: 0 }, { x: 0, y: 0 }); arg3({ x: 0 }, { x: 0, y: 0 }, { x: 0, y: 0 }); + arg4(); arg4({ x: 0, y: 0 }); arg4({ x: 0, y: 0 }, { x: 0 }); + arg5(); arg5({ x: 0, y: 0 }); arg5({ x: 0, y: 0 }, { x: 0 }); + arg6(); arg6({ x: 0, y: 0 }); arg6({ x: 0, y: 0 }, { x: 0, y: 0 }); arg6({ x: 0, y: 0 }, { x: 0, y: 0 }, { y: 0 }); } + // JSX Tag names function test5() { // Pair of non-like intrinsics @@ -156,14 +177,18 @@ function test5() { var Tag = url ? 'a' : 'button'; return react_1["default"].createElement(Tag, null, "test"); } + // Union of all intrinsics and components of `any` function App(props) { var Comp = props.component; return (react_1["default"].createElement(Comp, null)); } + // custom components with non-subset props function render2() { + var C = null; + var a = react_1["default"].createElement(C, { p: true }); } } diff --git a/tests/baselines/reference/cannotInvokeNewOnErrorExpression.js b/tests/baselines/reference/cannotInvokeNewOnErrorExpression.js index 129b17acdc64d..5602d3c637cc9 100644 --- a/tests/baselines/reference/cannotInvokeNewOnErrorExpression.js +++ b/tests/baselines/reference/cannotInvokeNewOnErrorExpression.js @@ -9,8 +9,7 @@ var t = new M.ClassA[]; var M; (function (M) { var ClassA = /** @class */ (function () { - function ClassA() { - } + function ClassA() {} return ClassA; }()); })(M || (M = {})); diff --git a/tests/baselines/reference/captureSuperPropertyAccessInSuperCall01.js b/tests/baselines/reference/captureSuperPropertyAccessInSuperCall01.js index d6769feee3bc7..cf379a6d8b10f 100644 --- a/tests/baselines/reference/captureSuperPropertyAccessInSuperCall01.js +++ b/tests/baselines/reference/captureSuperPropertyAccessInSuperCall01.js @@ -26,8 +26,7 @@ var __extends = (this && this.__extends) || (function () { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -})(); -var A = /** @class */ (function () { +})();var A = /** @class */ (function () { function A(f) { } A.prototype.blah = function () { return ""; }; diff --git a/tests/baselines/reference/captureThisInSuperCall.js b/tests/baselines/reference/captureThisInSuperCall.js index 0a9219eeb0de3..356380f38bf5d 100644 --- a/tests/baselines/reference/captureThisInSuperCall.js +++ b/tests/baselines/reference/captureThisInSuperCall.js @@ -23,10 +23,8 @@ var __extends = (this && this.__extends) || (function () { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -})(); -var A = /** @class */ (function () { - function A(p) { - } +})();var A = /** @class */ (function () { + function A(p) {} return A; }()); var B = /** @class */ (function (_super) { diff --git a/tests/baselines/reference/capturedLetConstInLoop1.js b/tests/baselines/reference/capturedLetConstInLoop1.js index 7acaf851cc214..3b881008b8587 100644 --- a/tests/baselines/reference/capturedLetConstInLoop1.js +++ b/tests/baselines/reference/capturedLetConstInLoop1.js @@ -217,18 +217,15 @@ var _loop_10 = function (y) { for (var y = 0; y < 1; ++y) { _loop_10(y); } -var _loop_init_1 = function () { - var y = (use(function () { return y; }), 0); +var _loop_init_1 = function () {var y = (use(function () { return y; }), 0); out_y_1 = y; }; var out_y_1; _loop_init_1(); for (var y = out_y_1; y < 1; ++y) { } -var _loop_11 = function (y) { - if (inc_1) - ++y; - else +var _loop_11 = function (y) {if (inc_1) + ++y; else inc_1 = true; if (!(use(function () { return y; }), y < 1)) return "break"; @@ -239,24 +236,19 @@ for (var y = 0;;) { if (state_1 === "break") break; } -var _loop_12 = function (y) { - if (inc_2) - use(function () { return y; }), ++y; - else +var _loop_12 = function (y) {if (inc_2) + use(function () { return y; }), ++y; else inc_2 = true; }; var inc_2 = false; for (var y = 0; y < 1;) { _loop_12(y); } -var _loop_init_2 = function () { - var y = (use(function () { return y; }), 0); +var _loop_init_2 = function () {var y = (use(function () { return y; }), 0); out_y_2 = y; }; -var _loop_13 = function (y) { - if (inc_3) - use(function () { return y; }), ++y; - else +var _loop_13 = function (y) {if (inc_3) + use(function () { return y; }), ++y; else inc_3 = true; if (!(use(function () { return y; }), y < 1)) return out_y_2 = y, "break"; @@ -264,8 +256,7 @@ var _loop_13 = function (y) { }; var out_y_2, inc_3 = false; _loop_init_2(); -for (var y = out_y_2;;) { - var state_2 = _loop_13(y); +for (var y = out_y_2;;) {var state_2 = _loop_13(y); if (state_2 === "break") break; } @@ -347,6 +338,7 @@ var _loop_23 = function (y) { for (var y = 0; y < 1;) { _loop_23(y); } + var _loop_24 = function (sx) { (function () { return sobj[sx]; }); }; diff --git a/tests/baselines/reference/capturedLetConstInLoop10.js b/tests/baselines/reference/capturedLetConstInLoop10.js index d59d32f7d14f3..f1eced28c15c0 100644 --- a/tests/baselines/reference/capturedLetConstInLoop10.js +++ b/tests/baselines/reference/capturedLetConstInLoop10.js @@ -62,6 +62,7 @@ var A = /** @class */ (function () { }; A.prototype.bar = function (a) { }; + A.prototype.baz = function () { var _loop_2 = function (x) { var a = function () { return x; }; diff --git a/tests/baselines/reference/capturedLetConstInLoop10_ES6.js b/tests/baselines/reference/capturedLetConstInLoop10_ES6.js index 705a5e6ba9f63..bfcb0d99734a8 100644 --- a/tests/baselines/reference/capturedLetConstInLoop10_ES6.js +++ b/tests/baselines/reference/capturedLetConstInLoop10_ES6.js @@ -76,6 +76,7 @@ class A { } } } + class B { foo() { let a = () => { diff --git a/tests/baselines/reference/capturedLetConstInLoop11.js b/tests/baselines/reference/capturedLetConstInLoop11.js index 8e9ca71580e6c..18f6de8469b29 100644 --- a/tests/baselines/reference/capturedLetConstInLoop11.js +++ b/tests/baselines/reference/capturedLetConstInLoop11.js @@ -21,6 +21,7 @@ var _loop_1 = function () { for (;;) { _loop_1(); } + function foo() { var _loop_2 = function () { var a = 0; diff --git a/tests/baselines/reference/capturedLetConstInLoop11_ES6.js b/tests/baselines/reference/capturedLetConstInLoop11_ES6.js index df288953f1e94..8e61c6ad05c8a 100644 --- a/tests/baselines/reference/capturedLetConstInLoop11_ES6.js +++ b/tests/baselines/reference/capturedLetConstInLoop11_ES6.js @@ -18,6 +18,7 @@ for (;;) { let x = 1; () => x; } + function foo() { for (;;) { const a = 0; diff --git a/tests/baselines/reference/capturedLetConstInLoop12.js b/tests/baselines/reference/capturedLetConstInLoop12.js index 3625556c89a90..738ffbc496c56 100644 --- a/tests/baselines/reference/capturedLetConstInLoop12.js +++ b/tests/baselines/reference/capturedLetConstInLoop12.js @@ -21,8 +21,7 @@ var _loop_1 = function (i) { (function () { var _a; - return _a = [i + 1], i = _a[0], _a; - })(); + return _a = [i + 1], i = _a[0], _a;})(); out_i_1 = i; }; var out_i_1; @@ -31,13 +30,13 @@ i = out_i_1; } })(); + (function () { "use strict"; var _loop_2 = function (i) { (function () { var _a; - return (_a = { a: i + 1 }, i = _a.a, _a); - })(); + return (_a = { a: i + 1 }, i = _a.a, _a);})(); out_i_2 = i; }; var out_i_2; diff --git a/tests/baselines/reference/capturedLetConstInLoop13.js b/tests/baselines/reference/capturedLetConstInLoop13.js index d0723c1f0f908..e9b1ea21e37bf 100644 --- a/tests/baselines/reference/capturedLetConstInLoop13.js +++ b/tests/baselines/reference/capturedLetConstInLoop13.js @@ -33,8 +33,7 @@ var Main = /** @class */ (function () { for (var _i = 0; _i < arguments.length; _i++) { names[_i] = arguments[_i]; } - var _loop_1 = function (name_1) { - var _b; + var _loop_1 = function (name_1) {var _b; this_1.bar((_b = {}, _b[name_1 + ".a"] = function () { _this.foo(name_1); }, _b)); @@ -45,7 +44,9 @@ var Main = /** @class */ (function () { _loop_1(name_1); } }; + Main.prototype.bar = function (a) { }; + Main.prototype.foo = function (name) { }; return Main; }()); diff --git a/tests/baselines/reference/capturedLetConstInLoop1_ES6.js b/tests/baselines/reference/capturedLetConstInLoop1_ES6.js index 0a68f8e1cf63b..199c1b94e38ac 100644 --- a/tests/baselines/reference/capturedLetConstInLoop1_ES6.js +++ b/tests/baselines/reference/capturedLetConstInLoop1_ES6.js @@ -119,90 +119,109 @@ for (let x in {}) { (function () { return x; }); (() => x); } + for (let x of []) { (function () { return x; }); (() => x); } + for (let x = 0; x < 1; ++x) { (function () { return x; }); (() => x); } + while (1 === 1) { let x; (function () { return x; }); (() => x); } + do { let x; (function () { return x; }); (() => x); } while (1 === 1); + for (let y = 0; y < 1; ++y) { let x = 1; (function () { return x; }); (() => x); } + for (let x = 0, y = 1; x < 1; ++x) { (function () { return x + y; }); (() => x + y); } + while (1 === 1) { let x, y; (function () { return x + y; }); (() => x + y); } + do { let x, y; (function () { return x + y; }); (() => x + y); } while (1 === 1); + for (let y = 0; y < 1; ++y) { let x = 1; (function () { return x + y; }); (() => x + y); } + //=========const for (const x in {}) { (function () { return x; }); (() => x); } + for (const x of []) { (function () { return x; }); (() => x); } + for (const x = 0; x < 1;) { (function () { return x; }); (() => x); } + while (1 === 1) { const x = 1; (function () { return x; }); (() => x); } + do { const x = 1; (function () { return x; }); (() => x); } while (1 === 1); + for (const y = 0; y < 1;) { const x = 1; (function () { return x; }); (() => x); } + for (const x = 0, y = 1; x < 1;) { (function () { return x + y; }); (() => x + y); } + while (1 === 1) { const x = 1, y = 1; (function () { return x + y; }); (() => x + y); } + do { const x = 1, y = 1; (function () { return x + y; }); (() => x + y); } while (1 === 1); + for (const y = 0; y < 1;) { const x = 1; (function () { return x + y; }); diff --git a/tests/baselines/reference/capturedLetConstInLoop2.js b/tests/baselines/reference/capturedLetConstInLoop2.js index 94bc8669cf593..47e7885d135a2 100644 --- a/tests/baselines/reference/capturedLetConstInLoop2.js +++ b/tests/baselines/reference/capturedLetConstInLoop2.js @@ -188,6 +188,7 @@ function foo0(x) { _loop_1(x_1); } } + function foo0_1(x) { var _loop_2 = function (x_2) { var a = arguments_2.length; @@ -199,6 +200,7 @@ function foo0_1(x) { _loop_2(x_2); } } + function foo1(x) { var _loop_3 = function (x_3) { var a = arguments_3.length; @@ -210,6 +212,7 @@ function foo1(x) { _loop_3(x_3); } } + function foo2(x) { var _loop_4 = function () { var a = arguments_4.length; @@ -221,6 +224,7 @@ function foo2(x) { _loop_4(); } } + function foo3(x) { var _loop_5 = function () { var x_4; @@ -233,6 +237,7 @@ function foo3(x) { _loop_5(); } while (1 === 1); } + function foo4(x) { var _loop_6 = function (y) { var a = arguments_6.length; @@ -245,6 +250,7 @@ function foo4(x) { _loop_6(y); } } + function foo5(x) { var _loop_7 = function (x_6, y) { var a = arguments_7.length; @@ -256,6 +262,8 @@ function foo5(x) { _loop_7(x_6, y); } } + + function foo6(x) { var _loop_8 = function () { var x_7, y; @@ -268,6 +276,7 @@ function foo6(x) { _loop_8(); } } + function foo7(x) { var _loop_9 = function () { var x_8, y; @@ -280,6 +289,8 @@ function foo7(x) { _loop_9(); } while (1 === 1); } + + function foo8(x) { var _loop_10 = function (y) { var x_9 = 1; @@ -305,6 +316,7 @@ function foo0_c(x) { _loop_11(x_10); } } + function foo0_1_c(x) { var _loop_12 = function (x_11) { var a = arguments_12.length; @@ -316,6 +328,7 @@ function foo0_1_c(x) { _loop_12(x_11); } } + function foo1_c(x) { var _loop_13 = function (x_12) { var a = arguments_13.length; @@ -327,6 +340,7 @@ function foo1_c(x) { _loop_13(x_12); } } + function foo2_c(x) { var _loop_14 = function () { var a = arguments_14.length; @@ -338,6 +352,7 @@ function foo2_c(x) { _loop_14(); } } + function foo3_c(x) { var _loop_15 = function () { var x_13 = 1; @@ -350,6 +365,7 @@ function foo3_c(x) { _loop_15(); } while (1 === 1); } + function foo4_c(x) { var _loop_16 = function (y) { var a = arguments_16.length; @@ -362,6 +378,7 @@ function foo4_c(x) { _loop_16(y); } } + function foo5_c(x) { var _loop_17 = function (x_15, y) { var a = arguments_17.length; @@ -373,6 +390,8 @@ function foo5_c(x) { _loop_17(x_15, y); } } + + function foo6_c(x) { var _loop_18 = function () { var x_16 = 1, y = 1; @@ -385,6 +404,7 @@ function foo6_c(x) { _loop_18(); } } + function foo7_c(x) { var _loop_19 = function () { var x_17 = 1, y = 1; @@ -397,6 +417,8 @@ function foo7_c(x) { _loop_19(); } while (1 === 1); } + + function foo8_c(x) { var _loop_20 = function (y) { var x_18 = 1; diff --git a/tests/baselines/reference/capturedLetConstInLoop2_ES6.js b/tests/baselines/reference/capturedLetConstInLoop2_ES6.js index 59bd81b5a4de7..2794e693ae69b 100644 --- a/tests/baselines/reference/capturedLetConstInLoop2_ES6.js +++ b/tests/baselines/reference/capturedLetConstInLoop2_ES6.js @@ -183,6 +183,7 @@ function foo0(x) { (() => x + a); } } + function foo0_1(x) { for (let x in []) { let a = arguments.length; @@ -190,6 +191,7 @@ function foo0_1(x) { (() => x + a); } } + function foo1(x) { for (let x = 0; x < 1; ++x) { let a = arguments.length; @@ -197,6 +199,7 @@ function foo1(x) { (() => x + a); } } + function foo2(x) { while (1 === 1) { let a = arguments.length; @@ -204,6 +207,7 @@ function foo2(x) { (() => x + a); } } + function foo3(x) { do { let x; @@ -212,6 +216,7 @@ function foo3(x) { (() => x + a); } while (1 === 1); } + function foo4(x) { for (let y = 0; y < 1; ++y) { let a = arguments.length; @@ -220,6 +225,7 @@ function foo4(x) { (() => x + a); } } + function foo5(x) { for (let x = 0, y = 1; x < 1; ++x) { let a = arguments.length; @@ -227,6 +233,8 @@ function foo5(x) { (() => x + y + a); } } + + function foo6(x) { while (1 === 1) { let x, y; @@ -235,6 +243,7 @@ function foo6(x) { (() => x + y + a); } } + function foo7(x) { do { let x, y; @@ -243,6 +252,8 @@ function foo7(x) { (() => x + y + a); } while (1 === 1); } + + function foo8(x) { for (let y = 0; y < 1; ++y) { let x = 1; @@ -259,6 +270,7 @@ function foo0_c(x) { (() => x + a); } } + function foo0_1_c(x) { for (const x in []) { const a = arguments.length; @@ -266,6 +278,7 @@ function foo0_1_c(x) { (() => x + a); } } + function foo1_c(x) { for (const x = 0; x < 1;) { const a = arguments.length; @@ -273,6 +286,7 @@ function foo1_c(x) { (() => x + a); } } + function foo2_c(x) { while (1 === 1) { const a = arguments.length; @@ -280,6 +294,7 @@ function foo2_c(x) { (() => x + a); } } + function foo3_c(x) { do { const x = 1; @@ -288,6 +303,7 @@ function foo3_c(x) { (() => x + a); } while (1 === 1); } + function foo4_c(x) { for (const y = 0; y < 1;) { const a = arguments.length; @@ -296,6 +312,7 @@ function foo4_c(x) { (() => x + a); } } + function foo5_c(x) { for (const x = 0, y = 1; x < 1;) { const a = arguments.length; @@ -303,6 +320,8 @@ function foo5_c(x) { (() => x + y + a); } } + + function foo6_c(x) { while (1 === 1) { const x = 1, y = 1; @@ -311,6 +330,7 @@ function foo6_c(x) { (() => x + y + a); } } + function foo7_c(x) { do { const x = 1, y = 1; @@ -319,6 +339,8 @@ function foo7_c(x) { (() => x + y + a); } while (1 === 1); } + + function foo8_c(x) { for (const y = 0; y < 1;) { const x = 1; diff --git a/tests/baselines/reference/capturedLetConstInLoop3.js b/tests/baselines/reference/capturedLetConstInLoop3.js index f3bae712c5b2c..7a89a9a77d331 100644 --- a/tests/baselines/reference/capturedLetConstInLoop3.js +++ b/tests/baselines/reference/capturedLetConstInLoop3.js @@ -231,6 +231,7 @@ function foo0(x) { } use(v); } + function foo0_1(x) { var _loop_2 = function (x_2) { v = x_2; @@ -243,6 +244,7 @@ function foo0_1(x) { } use(v); } + function foo1(x) { var _loop_3 = function (x_3) { v = x_3; @@ -255,6 +257,7 @@ function foo1(x) { } use(v); } + function foo2(x) { var _loop_4 = function () { var x_4 = 1; @@ -268,6 +271,7 @@ function foo2(x) { } use(v); } + function foo3(x) { var _loop_5 = function () { var x_5; @@ -280,6 +284,7 @@ function foo3(x) { } while (1 === 1); use(v); } + function foo4(x) { var _loop_6 = function (y) { v = y; @@ -293,6 +298,7 @@ function foo4(x) { } use(v); } + function foo5(x) { var _loop_7 = function (x_7, y) { v = x_7; @@ -305,6 +311,8 @@ function foo5(x) { } use(v); } + + function foo6(x) { var _loop_8 = function () { var x_8, y; @@ -318,6 +326,7 @@ function foo6(x) { } use(v); } + function foo7(x) { var _loop_9 = function () { var x_9, y; @@ -331,6 +340,8 @@ function foo7(x) { } while (1 === 1); use(v); } + + function foo8(x) { var _loop_10 = function (y) { var x_10 = 1; @@ -358,6 +369,7 @@ function foo0_c(x) { } use(v); } + function foo0_1_c(x) { var _loop_12 = function (x_12) { v = x_12; @@ -370,6 +382,7 @@ function foo0_1_c(x) { } use(v); } + function foo1_c(x) { var _loop_13 = function (x_13) { v = x_13; @@ -382,6 +395,7 @@ function foo1_c(x) { } use(v); } + function foo2_c(x) { var _loop_14 = function () { var x_14 = 1; @@ -395,6 +409,7 @@ function foo2_c(x) { } use(v); } + function foo3_c(x) { var _loop_15 = function () { var x_15 = 1; @@ -407,6 +422,7 @@ function foo3_c(x) { } while (1 === 1); use(v); } + function foo4_c(x) { var _loop_16 = function (y) { v = y; @@ -420,6 +436,7 @@ function foo4_c(x) { } use(v); } + function foo5_c(x) { var _loop_17 = function (x_17, y) { v = x_17; @@ -432,6 +449,8 @@ function foo5_c(x) { } use(v); } + + function foo6_c(x) { var _loop_18 = function () { var x_18 = 1, y = 1; @@ -445,6 +464,7 @@ function foo6_c(x) { } use(v); } + function foo7_c(x) { var _loop_19 = function () { var x_19 = 1, y = 1; @@ -458,6 +478,8 @@ function foo7_c(x) { } while (1 === 1); use(v); } + + function foo8_c(x) { var _loop_20 = function (y) { var x_20 = 1; diff --git a/tests/baselines/reference/capturedLetConstInLoop3_ES6.js b/tests/baselines/reference/capturedLetConstInLoop3_ES6.js index 367db066edd43..a14d3ac3d37bd 100644 --- a/tests/baselines/reference/capturedLetConstInLoop3_ES6.js +++ b/tests/baselines/reference/capturedLetConstInLoop3_ES6.js @@ -224,24 +224,30 @@ function foo0(x) { (function () { return x + v; }); (() => x + v); } + use(v); } + function foo0_1(x) { for (let x in []) { var v = x; (function () { return x + v; }); (() => x + v); } + use(v); } + function foo1(x) { for (let x = 0; x < 1; ++x) { var v = x; (function () { return x + v; }); (() => x + v); } + use(v); } + function foo2(x) { while (1 === 1) { let x = 1; @@ -249,8 +255,10 @@ function foo2(x) { (function () { return x + v; }); (() => x + v); } + use(v); } + function foo3(x) { do { let x; @@ -258,8 +266,10 @@ function foo3(x) { (function () { return x + v; }); (() => x + v); } while (1 === 1); + use(v); } + function foo4(x) { for (let y = 0; y < 1; ++y) { var v = y; @@ -267,16 +277,21 @@ function foo4(x) { (function () { return x + v; }); (() => x + v); } + use(v); } + function foo5(x) { for (let x = 0, y = 1; x < 1; ++x) { var v = x; (function () { return x + y + v; }); (() => x + y + v); } + use(v); } + + function foo6(x) { while (1 === 1) { let x, y; @@ -284,8 +299,10 @@ function foo6(x) { (function () { return x + y + v; }); (() => x + y + v); } + use(v); } + function foo7(x) { do { let x, y; @@ -293,8 +310,11 @@ function foo7(x) { (function () { return x + y + v; }); (() => x + y + v); } while (1 === 1); + use(v); } + + function foo8(x) { for (let y = 0; y < 1; ++y) { let x = 1; @@ -302,6 +322,7 @@ function foo8(x) { (function () { return x + y + v; }); (() => x + y + v); } + use(v); } //===const @@ -311,24 +332,30 @@ function foo0_c(x) { (function () { return x + v; }); (() => x + v); } + use(v); } + function foo0_1_c(x) { for (const x in []) { var v = x; (function () { return x + v; }); (() => x + v); } + use(v); } + function foo1_c(x) { for (const x = 0; x < 1;) { var v = x; (function () { return x + v; }); (() => x + v); } + use(v); } + function foo2_c(x) { while (1 === 1) { const x = 1; @@ -336,8 +363,10 @@ function foo2_c(x) { (function () { return x + v; }); (() => x + v); } + use(v); } + function foo3_c(x) { do { const x = 1; @@ -345,8 +374,10 @@ function foo3_c(x) { (function () { return x + v; }); (() => x + v); } while (1 === 1); + use(v); } + function foo4_c(x) { for (const y = 0; y < 1;) { var v = y; @@ -354,16 +385,21 @@ function foo4_c(x) { (function () { return x + v; }); (() => x + v); } + use(v); } + function foo5_c(x) { for (const x = 0, y = 1; x < 1;) { var v = x; (function () { return x + y + v; }); (() => x + y + v); } + use(v); } + + function foo6_c(x) { while (1 === 1) { const x = 1, y = 1; @@ -371,8 +407,10 @@ function foo6_c(x) { (function () { return x + y + v; }); (() => x + y + v); } + use(v); } + function foo7_c(x) { do { const x = 1, y = 1; @@ -380,8 +418,11 @@ function foo7_c(x) { (function () { return x + y + v; }); (() => x + y + v); } while (1 === 1); + use(v); } + + function foo8_c(x) { for (const y = 0; y < 1;) { const x = 1; @@ -389,5 +430,6 @@ function foo8_c(x) { (function () { return x + y + v; }); (() => x + y + v); } + use(v); } diff --git a/tests/baselines/reference/capturedLetConstInLoop4.js b/tests/baselines/reference/capturedLetConstInLoop4.js index ff6d32563a932..6d19fe4c64759 100644 --- a/tests/baselines/reference/capturedLetConstInLoop4.js +++ b/tests/baselines/reference/capturedLetConstInLoop4.js @@ -144,8 +144,7 @@ for (const y = 0; y < 1;) { //// [capturedLetConstInLoop4.js] System.register([], function (exports_1, context_1) { - "use strict"; - var v0, v00, v1, v2, v3, v4, v5, v6, v7, v8, v0_c, v00_c, v1_c, v2_c, v3_c, v4_c, v5_c, v6_c, v7_c, v8_c; + "use strict";var v0, v00, v1, v2, v3, v4, v5, v6, v7, v8, v0_c, v00_c, v1_c, v2_c, v3_c, v4_c, v5_c, v6_c, v7_c, v8_c; var __moduleName = context_1 && context_1.id; //======let function exportedFoo() { @@ -159,8 +158,7 @@ System.register([], function (exports_1, context_1) { exports_1("exportedFoo2", exportedFoo2); return { setters: [], - execute: function () { - var _loop_1 = function (x) { + execute: function () {var _loop_1 = function (x) { v0 = x; (function () { return x + v0; }); (function () { return x; }); diff --git a/tests/baselines/reference/capturedLetConstInLoop4_ES6.js b/tests/baselines/reference/capturedLetConstInLoop4_ES6.js index e7a16aa01c67d..fc8b2ba7c3c9b 100644 --- a/tests/baselines/reference/capturedLetConstInLoop4_ES6.js +++ b/tests/baselines/reference/capturedLetConstInLoop4_ES6.js @@ -147,116 +147,137 @@ for (const y = 0; y < 1;) { export function exportedFoo() { return v0 + v00 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8; } + for (let x of []) { var v0 = x; (function () { return x + v0; }); (() => x); } + for (let x in []) { var v00 = x; (function () { return x + v00; }); (() => x); } + for (let x = 0; x < 1; ++x) { var v1 = x; (function () { return x + v1; }); (() => x); } + while (1 === 1) { let x; var v2 = x; (function () { return x + v2; }); (() => x); } + do { let x; var v3 = x; (function () { return x + v3; }); (() => x); } while (1 === 1); + for (let y = 0; y < 1; ++y) { let x = 1; var v4 = x; (function () { return x + v4; }); (() => x); } + for (let x = 0, y = 1; x < 1; ++x) { var v5 = x; (function () { return x + y + v5; }); (() => x + y); } + while (1 === 1) { let x, y; var v6 = x; (function () { return x + y + v6; }); (() => x + y); } + do { let x, y; var v7 = x; (function () { return x + y + v7; }); (() => x + y); } while (1 === 1); + for (let y = 0; y < 1; ++y) { let x = 1; var v8 = x; (function () { return x + y + v8; }); (() => x + y); } + //======const export function exportedFoo2() { return v0_c + v00_c + v1_c + v2_c + v3_c + v4_c + v5_c + v6_c + v7_c + v8_c; } + for (const x of []) { var v0_c = x; (function () { return x + v0_c; }); (() => x); } + for (const x in []) { var v00_c = x; (function () { return x + v00; }); (() => x); } + for (const x = 0; x < 1;) { var v1_c = x; (function () { return x + v1_c; }); (() => x); } + while (1 === 1) { const x = 1; var v2_c = x; (function () { return x + v2_c; }); (() => x); } + do { const x = 1; var v3_c = x; (function () { return x + v3_c; }); (() => x); } while (1 === 1); + for (const y = 0; y < 1;) { const x = 1; var v4_c = x; (function () { return x + v4_c; }); (() => x); } + for (const x = 0, y = 1; x < 1;) { var v5_c = x; (function () { return x + y + v5_c; }); (() => x + y); } + while (1 === 1) { const x = 1, y = 1; var v6_c = x; (function () { return x + y + v6_c; }); (() => x + y); } + do { const x = 1, y = 1; var v7_c = x; (function () { return x + y + v7_c; }); (() => x + y); } while (1 === 1); + for (const y = 0; y < 1;) { const x = 1; var v8_c = x; diff --git a/tests/baselines/reference/capturedLetConstInLoop5.js b/tests/baselines/reference/capturedLetConstInLoop5.js index 4ea4c85c0d74a..e3d81b15b5753 100644 --- a/tests/baselines/reference/capturedLetConstInLoop5.js +++ b/tests/baselines/reference/capturedLetConstInLoop5.js @@ -280,6 +280,7 @@ function foo8_c(x) { } //// [capturedLetConstInLoop5.js] + //====let function foo0(x) { var _loop_1 = function (x_1) { @@ -299,6 +300,7 @@ function foo0(x) { } use(v); } + function foo00(x) { var _loop_2 = function (x_2) { v = x_2; @@ -316,6 +318,7 @@ function foo00(x) { } use(v); } + function foo1(x) { var _loop_3 = function (x_3) { v = x_3; @@ -333,6 +336,7 @@ function foo1(x) { } use(v); } + function foo2(x) { var _loop_4 = function () { var x_4 = 1; @@ -351,6 +355,7 @@ function foo2(x) { } use(v); } + function foo3(x) { var _loop_5 = function () { var x_5; @@ -368,6 +373,7 @@ function foo3(x) { } while (1 === 1); use(v); } + function foo4(x) { var _loop_6 = function (y) { v = y; @@ -386,6 +392,7 @@ function foo4(x) { } use(v); } + function foo5(x) { var _loop_7 = function (x_7, y) { v = x_7; @@ -403,6 +410,8 @@ function foo5(x) { } use(v); } + + function foo6(x) { var _loop_8 = function () { var x_8, y; @@ -420,8 +429,10 @@ function foo6(x) { return state_8.value; } ; + use(v); } + function foo7(x) { var _loop_9 = function () { var x_9, y; @@ -440,6 +451,8 @@ function foo7(x) { } while (1 === 1); use(v); } + + function foo8(x) { var _loop_10 = function (y) { var x_10 = 1; @@ -458,6 +471,7 @@ function foo8(x) { } use(v); } + //====const function foo0_c(x) { var _loop_11 = function (x_11) { @@ -477,6 +491,7 @@ function foo0_c(x) { } use(v); } + function foo00_c(x) { var _loop_12 = function (x_12) { v = x_12; @@ -494,6 +509,7 @@ function foo00_c(x) { } use(v); } + function foo1_c(x) { var _loop_13 = function (x_13) { v = x_13; @@ -511,6 +527,7 @@ function foo1_c(x) { } use(v); } + function foo2_c(x) { var _loop_14 = function () { var x_14 = 1; @@ -529,6 +546,7 @@ function foo2_c(x) { } use(v); } + function foo3_c(x) { var _loop_15 = function () { var x_15 = 1; @@ -546,6 +564,7 @@ function foo3_c(x) { } while (1 === 1); use(v); } + function foo4_c(x) { var _loop_16 = function (y) { v = y; @@ -564,6 +583,7 @@ function foo4_c(x) { } use(v); } + function foo5_c(x) { var _loop_17 = function (x_17, y) { v = x_17; @@ -581,6 +601,8 @@ function foo5_c(x) { } use(v); } + + function foo6_c(x) { var _loop_18 = function () { var x_18 = 1, y = 1; @@ -599,6 +621,7 @@ function foo6_c(x) { } use(v); } + function foo7_c(x) { var _loop_19 = function () { var x_19 = 1, y = 1; @@ -617,6 +640,8 @@ function foo7_c(x) { } while (1 === 1); use(v); } + + function foo8_c(x) { var _loop_20 = function (y) { var x_20 = 1; diff --git a/tests/baselines/reference/capturedLetConstInLoop5_ES6.js b/tests/baselines/reference/capturedLetConstInLoop5_ES6.js index da48929c959e8..1205bc8e6307e 100644 --- a/tests/baselines/reference/capturedLetConstInLoop5_ES6.js +++ b/tests/baselines/reference/capturedLetConstInLoop5_ES6.js @@ -290,8 +290,10 @@ function foo0(x) { return; } } + use(v); } + function foo00(x) { for (let x in []) { var v = x; @@ -301,8 +303,10 @@ function foo00(x) { return; } } + use(v); } + function foo1(x) { for (let x = 0; x < 1; ++x) { var v = x; @@ -312,8 +316,10 @@ function foo1(x) { return; } } + use(v); } + function foo2(x) { while (1 === 1) { let x = 1; @@ -324,8 +330,10 @@ function foo2(x) { return; } } + use(v); } + function foo3(x) { do { let x; @@ -336,8 +344,10 @@ function foo3(x) { return; } } while (1 === 1); + use(v); } + function foo4(x) { for (let y = 0; y < 1; ++y) { var v = y; @@ -348,8 +358,10 @@ function foo4(x) { return; } } + use(v); } + function foo5(x) { for (let x = 0, y = 1; x < 1; ++x) { var v = x; @@ -359,8 +371,11 @@ function foo5(x) { return; } } + use(v); } + + function foo6(x) { while (1 === 1) { let x, y; @@ -370,10 +385,11 @@ function foo6(x) { if (x == 1) { return; } - } - ; + }; + use(v); } + function foo7(x) { do { let x, y; @@ -384,8 +400,11 @@ function foo7(x) { return; } } while (1 === 1); + use(v); } + + function foo8(x) { for (let y = 0; y < 1; ++y) { let x = 1; @@ -396,8 +415,10 @@ function foo8(x) { return; } } + use(v); } + //====const function foo0_c(x) { for (const x of []) { @@ -408,8 +429,10 @@ function foo0_c(x) { return; } } + use(v); } + function foo00_c(x) { for (const x in []) { var v = x; @@ -419,8 +442,10 @@ function foo00_c(x) { return; } } + use(v); } + function foo1_c(x) { for (const x = 0; x < 1;) { var v = x; @@ -430,8 +455,10 @@ function foo1_c(x) { return; } } + use(v); } + function foo2_c(x) { while (1 === 1) { const x = 1; @@ -442,8 +469,10 @@ function foo2_c(x) { return; } } + use(v); } + function foo3_c(x) { do { const x = 1; @@ -454,8 +483,10 @@ function foo3_c(x) { return; } } while (1 === 1); + use(v); } + function foo4_c(x) { for (const y = 0; y < 1;) { var v = y; @@ -466,8 +497,10 @@ function foo4_c(x) { return; } } + use(v); } + function foo5_c(x) { for (const x = 0, y = 1; x < 1;) { var v = x; @@ -477,8 +510,11 @@ function foo5_c(x) { return; } } + use(v); } + + function foo6_c(x) { while (1 === 1) { const x = 1, y = 1; @@ -489,8 +525,10 @@ function foo6_c(x) { return; } } + use(v); } + function foo7_c(x) { do { const x = 1, y = 1; @@ -501,8 +539,11 @@ function foo7_c(x) { return; } } while (1 === 1); + use(v); } + + function foo8_c(x) { for (const y = 0; y < 1;) { const x = 1; @@ -513,5 +554,6 @@ function foo8_c(x) { return; } } + use(v); } diff --git a/tests/baselines/reference/capturedLetConstInLoop6.js b/tests/baselines/reference/capturedLetConstInLoop6.js index cf813da44e14e..318c733a776ef 100644 --- a/tests/baselines/reference/capturedLetConstInLoop6.js +++ b/tests/baselines/reference/capturedLetConstInLoop6.js @@ -555,3 +555,4 @@ for (var y = 0; y < 1;) { if (state_20 === "break") break; } + diff --git a/tests/baselines/reference/capturedLetConstInLoop6_ES6.js b/tests/baselines/reference/capturedLetConstInLoop6_ES6.js index 33d64e889276a..f789c30ccdefb 100644 --- a/tests/baselines/reference/capturedLetConstInLoop6_ES6.js +++ b/tests/baselines/reference/capturedLetConstInLoop6_ES6.js @@ -250,6 +250,7 @@ for (let x of []) { continue; } } + for (let x in []) { (function () { return x; }); (() => x); @@ -260,6 +261,8 @@ for (let x in []) { continue; } } + + for (let x = 0; x < 1; ++x) { (function () { return x; }); (() => x); @@ -270,6 +273,7 @@ for (let x = 0; x < 1; ++x) { continue; } } + while (1 === 1) { let x; (function () { return x; }); @@ -281,6 +285,7 @@ while (1 === 1) { continue; } } + do { let x; (function () { return x; }); @@ -292,6 +297,7 @@ do { continue; } } while (1 === 1); + for (let y = 0; y < 1; ++y) { let x = 1; (function () { return x; }); @@ -303,6 +309,7 @@ for (let y = 0; y < 1; ++y) { continue; } } + for (let x = 0, y = 1; x < 1; ++x) { (function () { return x + y; }); (() => x + y); @@ -313,6 +320,7 @@ for (let x = 0, y = 1; x < 1; ++x) { continue; } } + while (1 === 1) { let x, y; (function () { return x + y; }); @@ -324,6 +332,7 @@ while (1 === 1) { continue; } } + do { let x, y; (function () { return x + y; }); @@ -335,6 +344,7 @@ do { continue; } } while (1 === 1); + for (let y = 0; y < 1; ++y) { let x = 1; (function () { return x + y; }); @@ -346,6 +356,7 @@ for (let y = 0; y < 1; ++y) { continue; } } + // ====const for (const x of []) { (function () { return x; }); @@ -357,6 +368,7 @@ for (const x of []) { continue; } } + for (const x in []) { (function () { return x; }); (() => x); @@ -367,6 +379,8 @@ for (const x in []) { continue; } } + + for (const x = 0; x < 1;) { (function () { return x; }); (() => x); @@ -377,6 +391,7 @@ for (const x = 0; x < 1;) { continue; } } + while (1 === 1) { const x = 1; (function () { return x; }); @@ -388,6 +403,7 @@ while (1 === 1) { continue; } } + do { const x = 1; (function () { return x; }); @@ -399,6 +415,7 @@ do { continue; } } while (1 === 1); + for (const y = 0; y < 1;) { const x = 1; (function () { return x; }); @@ -410,6 +427,7 @@ for (const y = 0; y < 1;) { continue; } } + for (const x = 0, y = 1; x < 1;) { (function () { return x + y; }); (() => x + y); @@ -420,6 +438,7 @@ for (const x = 0, y = 1; x < 1;) { continue; } } + while (1 === 1) { const x = 1, y = 1; (function () { return x + y; }); @@ -431,6 +450,7 @@ while (1 === 1) { continue; } } + do { const x = 1, y = 1; (function () { return x + y; }); @@ -442,6 +462,7 @@ do { continue; } } while (1 === 1); + for (const y = 0; y < 1;) { const x = 1; (function () { return x + y; }); @@ -453,3 +474,4 @@ for (const y = 0; y < 1;) { continue; } } + diff --git a/tests/baselines/reference/capturedLetConstInLoop7.js b/tests/baselines/reference/capturedLetConstInLoop7.js index c4bd9b2d2b989..72685e0169f12 100644 --- a/tests/baselines/reference/capturedLetConstInLoop7.js +++ b/tests/baselines/reference/capturedLetConstInLoop7.js @@ -398,8 +398,7 @@ l0: for (var _i = 0, _a = []; _i < _a.length; _i++) { var state_1 = _loop_1(x); if (state_1 === "break") break; - switch (state_1) { - case "break-l0": break l0; + switch (state_1) {case "break-l0": break l0; case "continue-l0": continue l0; } } @@ -423,8 +422,7 @@ l00: for (var x in []) { var state_2 = _loop_2(x); if (state_2 === "break") break; - switch (state_2) { - case "break-l00": break l00; + switch (state_2) {case "break-l00": break l00; case "continue-l00": continue l00; } } @@ -448,8 +446,7 @@ l1: for (var x = 0; x < 1; ++x) { var state_3 = _loop_3(x); if (state_3 === "break") break; - switch (state_3) { - case "break-l1": break l1; + switch (state_3) {case "break-l1": break l1; case "continue-l1": continue l1; } } @@ -474,8 +471,7 @@ l2: while (1 === 1) { var state_4 = _loop_4(); if (state_4 === "break") break; - switch (state_4) { - case "break-l2": break l2; + switch (state_4) {case "break-l2": break l2; case "continue-l2": continue l2; } } @@ -500,8 +496,7 @@ l3: do { var state_5 = _loop_5(); if (state_5 === "break") break; - switch (state_5) { - case "break-l3": break l3; + switch (state_5) {case "break-l3": break l3; case "continue-l3": continue l3; } } while (1 === 1); @@ -526,8 +521,7 @@ l4: for (var y = 0; y < 1; ++y) { var state_6 = _loop_6(y); if (state_6 === "break") break; - switch (state_6) { - case "break-l4": break l4; + switch (state_6) {case "break-l4": break l4; case "continue-l4": continue l4; } } @@ -551,8 +545,7 @@ l5: for (var x = 0, y = 1; x < 1; ++x) { var state_7 = _loop_7(x, y); if (state_7 === "break") break; - switch (state_7) { - case "break-l5": break l5; + switch (state_7) {case "break-l5": break l5; case "continue-l5": continue l5; } } @@ -577,8 +570,7 @@ l6: while (1 === 1) { var state_8 = _loop_8(); if (state_8 === "break") break; - switch (state_8) { - case "break-l6": break l6; + switch (state_8) {case "break-l6": break l6; case "continue-l6": continue l6; } } @@ -603,8 +595,7 @@ l7: do { var state_9 = _loop_9(); if (state_9 === "break") break; - switch (state_9) { - case "break-l7": break l7; + switch (state_9) {case "break-l7": break l7; case "continue-l7": continue l7; } } while (1 === 1); @@ -629,8 +620,7 @@ l8: for (var y = 0; y < 1; ++y) { var state_10 = _loop_10(y); if (state_10 === "break") break; - switch (state_10) { - case "break-l8": break l8; + switch (state_10) {case "break-l8": break l8; case "continue-l8": continue l8; } } @@ -656,8 +646,7 @@ l0_c: for (var _b = 0, _c = []; _b < _c.length; _b++) { var state_11 = _loop_11(x); if (state_11 === "break") break; - switch (state_11) { - case "break-l0_c": break l0_c; + switch (state_11) {case "break-l0_c": break l0_c; case "continue-l0_c": continue l0_c; } } @@ -681,8 +670,7 @@ l00_c: for (var x in []) { var state_12 = _loop_12(x); if (state_12 === "break") break; - switch (state_12) { - case "break-l00_c": break l00_c; + switch (state_12) {case "break-l00_c": break l00_c; case "continue-l00_c": continue l00_c; } } @@ -706,8 +694,7 @@ l1_c: for (var x = 0; x < 1;) { var state_13 = _loop_13(x); if (state_13 === "break") break; - switch (state_13) { - case "break-l1_c": break l1_c; + switch (state_13) {case "break-l1_c": break l1_c; case "continue-l1_c": continue l1_c; } } @@ -732,8 +719,7 @@ l2_c: while (1 === 1) { var state_14 = _loop_14(); if (state_14 === "break") break; - switch (state_14) { - case "break-l2_c": break l2_c; + switch (state_14) {case "break-l2_c": break l2_c; case "continue-l2_c": continue l2_c; } } @@ -758,8 +744,7 @@ l3_c: do { var state_15 = _loop_15(); if (state_15 === "break") break; - switch (state_15) { - case "break-l3_c": break l3_c; + switch (state_15) {case "break-l3_c": break l3_c; case "continue-l3_c": continue l3_c; } } while (1 === 1); @@ -784,8 +769,7 @@ l4_c: for (var y = 0; y < 1;) { var state_16 = _loop_16(y); if (state_16 === "break") break; - switch (state_16) { - case "break-l4_c": break l4_c; + switch (state_16) {case "break-l4_c": break l4_c; case "continue-l4_c": continue l4_c; } } @@ -809,8 +793,7 @@ l5_c: for (var x = 0, y = 1; x < 1;) { var state_17 = _loop_17(x, y); if (state_17 === "break") break; - switch (state_17) { - case "break-l5_c": break l5_c; + switch (state_17) {case "break-l5_c": break l5_c; case "continue-l5_c": continue l5_c; } } @@ -835,8 +818,7 @@ l6_c: while (1 === 1) { var state_18 = _loop_18(); if (state_18 === "break") break; - switch (state_18) { - case "break-l6_c": break l6_c; + switch (state_18) {case "break-l6_c": break l6_c; case "continue-l6_c": continue l6_c; } } @@ -861,8 +843,7 @@ l7_c: do { var state_19 = _loop_19(); if (state_19 === "break") break; - switch (state_19) { - case "break-l7_c": break l7_c; + switch (state_19) {case "break-l7_c": break l7_c; case "continue-l7_c": continue l7_c; } } while (1 === 1); @@ -887,8 +868,7 @@ l8_c: for (var y = 0; y < 1;) { var state_20 = _loop_20(y); if (state_20 === "break") break; - switch (state_20) { - case "break-l8_c": break l8_c; + switch (state_20) {case "break-l8_c": break l8_c; case "continue-l8_c": continue l8_c; } } diff --git a/tests/baselines/reference/capturedLetConstInLoop7_ES6.js b/tests/baselines/reference/capturedLetConstInLoop7_ES6.js index 13c69a883921f..9368194c602ae 100644 --- a/tests/baselines/reference/capturedLetConstInLoop7_ES6.js +++ b/tests/baselines/reference/capturedLetConstInLoop7_ES6.js @@ -393,6 +393,7 @@ l0: for (let x of []) { continue l0; } } + l00: for (let x in []) { (function () { return x; }); (() => x); @@ -409,6 +410,7 @@ l00: for (let x in []) { continue l00; } } + l1: for (let x = 0; x < 1; ++x) { (function () { return x; }); (() => x); @@ -425,6 +427,7 @@ l1: for (let x = 0; x < 1; ++x) { continue l1; } } + l2: while (1 === 1) { let x; (function () { return x; }); @@ -442,6 +445,7 @@ l2: while (1 === 1) { continue l2; } } + l3: do { let x; (function () { return x; }); @@ -459,6 +463,7 @@ l3: do { continue l3; } } while (1 === 1); + l4: for (let y = 0; y < 1; ++y) { let x = 1; (function () { return x; }); @@ -476,6 +481,7 @@ l4: for (let y = 0; y < 1; ++y) { continue l4; } } + l5: for (let x = 0, y = 1; x < 1; ++x) { (function () { return x + y; }); (() => x + y); @@ -492,6 +498,7 @@ l5: for (let x = 0, y = 1; x < 1; ++x) { continue l5; } } + l6: while (1 === 1) { let x, y; (function () { return x + y; }); @@ -508,7 +515,9 @@ l6: while (1 === 1) { if (x == 2) { continue l6; } + } + l7: do { let x, y; (function () { return x + y; }); @@ -526,6 +535,7 @@ l7: do { continue l7; } } while (1 === 1); + l8: for (let y = 0; y < 1; ++y) { let x = 1; (function () { return x + y; }); @@ -543,6 +553,7 @@ l8: for (let y = 0; y < 1; ++y) { continue l8; } } + //===const l0_c: for (const x of []) { (function () { return x; }); @@ -560,6 +571,7 @@ l0_c: for (const x of []) { continue l0_c; } } + l00_c: for (const x in []) { (function () { return x; }); (() => x); @@ -576,6 +588,7 @@ l00_c: for (const x in []) { continue l00_c; } } + l1_c: for (const x = 0; x < 1;) { (function () { return x; }); (() => x); @@ -592,6 +605,7 @@ l1_c: for (const x = 0; x < 1;) { continue l1_c; } } + l2_c: while (1 === 1) { const x = 1; (function () { return x; }); @@ -609,6 +623,7 @@ l2_c: while (1 === 1) { continue l2_c; } } + l3_c: do { const x = 1; (function () { return x; }); @@ -626,6 +641,7 @@ l3_c: do { continue l3_c; } } while (1 === 1); + l4_c: for (const y = 0; y < 1;) { const x = 1; (function () { return x; }); @@ -643,6 +659,7 @@ l4_c: for (const y = 0; y < 1;) { continue l4_c; } } + l5_c: for (const x = 0, y = 1; x < 1;) { (function () { return x + y; }); (() => x + y); @@ -659,6 +676,7 @@ l5_c: for (const x = 0, y = 1; x < 1;) { continue l5_c; } } + l6_c: while (1 === 1) { const x = 1, y = 1; (function () { return x + y; }); @@ -675,7 +693,9 @@ l6_c: while (1 === 1) { if (x == 2) { continue l6_c; } + } + l7_c: do { const x = 1, y = 1; (function () { return x + y; }); @@ -693,6 +713,7 @@ l7_c: do { continue l7_c; } } while (1 === 1); + l8_c: for (const y = 0; y < 1;) { const x = 1; (function () { return x + y; }); diff --git a/tests/baselines/reference/capturedLetConstInLoop8.js b/tests/baselines/reference/capturedLetConstInLoop8.js index cb13f76ac6160..6aafe20b653f7 100644 --- a/tests/baselines/reference/capturedLetConstInLoop8.js +++ b/tests/baselines/reference/capturedLetConstInLoop8.js @@ -129,8 +129,7 @@ function foo_c() { //// [capturedLetConstInLoop8.js] function foo() { l0: for (var z = 0; z < 1; ++z) { - var _loop_1 = function (x) { - var _loop_2 = function (y) { + var _loop_1 = function (x) {var _loop_2 = function (y) { (function () { return x + y; }); (function () { return x + y; }); if (y == 1) { @@ -145,6 +144,7 @@ function foo() { if (y == 1) { return "continue-l0"; } + if (x == 2) { return "continue"; } @@ -167,8 +167,7 @@ function foo() { return state_2; if (state_2 === "break") break; - switch (state_2) { - case "break-l1": return state_2; + switch (state_2) {case "break-l1": return state_2; case "break-ll1": break ll1; case "continue-l0": return state_2; case "continue-l1": return state_2; @@ -203,18 +202,17 @@ function foo() { return state_1.value; if (state_1 === "break") break; - switch (state_1) { - case "break-l1": break l1; + switch (state_1) {case "break-l1": break l1; case "continue-l0": continue l0; case "continue-l1": continue l1; } } } } + function foo_c() { l0: for (var z = 0; z < 1;) { - var _loop_3 = function (x) { - var _loop_4 = function (y) { + var _loop_3 = function (x) {var _loop_4 = function (y) { (function () { return x + y; }); (function () { return x + y; }); if (y == 1) { @@ -229,6 +227,7 @@ function foo_c() { if (y == 1) { return "continue-l0"; } + if (x == 2) { return "continue"; } @@ -251,8 +250,7 @@ function foo_c() { return state_4; if (state_4 === "break") break; - switch (state_4) { - case "break-l1": return state_4; + switch (state_4) {case "break-l1": return state_4; case "break-ll1": break ll1; case "continue-l0": return state_4; case "continue-l1": return state_4; @@ -287,8 +285,7 @@ function foo_c() { return state_3.value; if (state_3 === "break") break; - switch (state_3) { - case "break-l1": break l1; + switch (state_3) {case "break-l1": break l1; case "continue-l0": continue l0; case "continue-l1": continue l1; } diff --git a/tests/baselines/reference/capturedLetConstInLoop8_ES6.js b/tests/baselines/reference/capturedLetConstInLoop8_ES6.js index 71d0ecd4c4c7f..f0967e135134e 100644 --- a/tests/baselines/reference/capturedLetConstInLoop8_ES6.js +++ b/tests/baselines/reference/capturedLetConstInLoop8_ES6.js @@ -145,6 +145,7 @@ function foo() { if (y == 1) { continue l0; } + if (x == 2) { continue; } @@ -185,6 +186,7 @@ function foo() { } } } + function foo_c() { l0: for (const z = 0; z < 1;) { l1: for (const x = 0; x < 1;) { @@ -203,6 +205,7 @@ function foo_c() { if (y == 1) { continue l0; } + if (x == 2) { continue; } diff --git a/tests/baselines/reference/capturedLetConstInLoop9.js b/tests/baselines/reference/capturedLetConstInLoop9.js index 4f858a91a9c6b..51ab7954d566e 100644 --- a/tests/baselines/reference/capturedLetConstInLoop9.js +++ b/tests/baselines/reference/capturedLetConstInLoop9.js @@ -146,11 +146,13 @@ var _loop_1 = function (x) { var x_2; (function () { return x_2; }); } + try { } catch (e) { var x_3; (function () { return x_3; }); } + switch (x_1) { case 1: var x_4; @@ -164,6 +166,7 @@ var _loop_1 = function (x) { while (1 == 1) { _loop_2(); } + var A = /** @class */ (function () { function A() { } @@ -176,12 +179,14 @@ var _loop_1 = function (x) { for (var x = 0; x < 1; ++x) { _loop_1(x); } + + function foo() { - var _loop_3 = function (a) { - var _b; + var _loop_3 = function (a) {var _b; if (a === 1) { return "break"; } + if (a === 2) { return "break-l0"; } @@ -199,15 +204,16 @@ function foo() { } return { value: 50 }; } - var _loop_4 = function (b) { - var _g; + var _loop_4 = function (b) {var _g; _g = [{ x1: 1, y: arguments_1.length }][0], x1 = _g.x1, z1 = _g.y; if (b === 1) { return "break"; } + if (b === 2) { return "break-l0"; } + (function () { return b; }); return { value: 100 }; }; @@ -218,8 +224,7 @@ function foo() { return state_2; if (state_2 === "break") break; - switch (state_2) { - case "break-l0": return state_2; + switch (state_2) {case "break-l0": return state_2; } } (function () { return a; }); @@ -232,8 +237,7 @@ function foo() { return state_1.value; if (state_1 === "break") break; - switch (state_1) { - case "break-l0": break l0; + switch (state_1) {case "break-l0": break l0; } } use(x); @@ -241,6 +245,7 @@ function foo() { use(x1); use(z1); } + function foo2() { for (var _i = 0, _a = []; _i < _a.length; _i++) { var x = _a[_i]; @@ -250,6 +255,7 @@ function foo2() { else if (x === 2) { continue; } + while (1 === 1) { if (x) { break; @@ -258,6 +264,7 @@ function foo2() { continue; } } + switch (x) { case 1: break; case 2: continue; @@ -271,6 +278,7 @@ function foo2() { } } } + var C = /** @class */ (function () { function C(N) { this.N = N; diff --git a/tests/baselines/reference/capturedLetConstInLoop9_ES6.js b/tests/baselines/reference/capturedLetConstInLoop9_ES6.js index 783140426d267..d16018e369dc0 100644 --- a/tests/baselines/reference/capturedLetConstInLoop9_ES6.js +++ b/tests/baselines/reference/capturedLetConstInLoop9_ES6.js @@ -145,21 +145,25 @@ for (let x = 0; x < 1; ++x) { let x; (function () { return x; }); } + try { } catch (e) { let x; (function () { return x; }); } + switch (x) { case 1: let x; (function () { return x; }); break; } + while (1 == 1) { let x; (function () { return x; }); } + class A { m() { return x + 1; @@ -168,43 +172,56 @@ for (let x = 0; x < 1; ++x) { } function foo() { l0: for (let a of []) { + if (a === 1) { break; } + if (a === 2) { break l0; } + for (let b of []) { var [{ x, y: z }] = [{ x: 1, y: 2 }]; if (b === 1) { break; } + + if (b === 2) { break l0; } + l1: if (b === 3) { break l1; } + return 50; } + for (let b of []) { var [{ x1, y: z1 }] = [{ x1: 1, y: arguments.length }]; if (b === 1) { break; } + if (b === 2) { break l0; } () => b; return 100; } + + () => a; } + use(x); use(z); use(x1); use(z1); } + function foo2() { for (let x of []) { if (x === 1) { @@ -213,6 +230,7 @@ function foo2() { else if (x === 2) { continue; } + while (1 === 1) { if (x) { break; @@ -221,10 +239,12 @@ function foo2() { continue; } } + switch (x) { case 1: break; case 2: continue; } + for (let y of []) { switch (y) { case 1: break; diff --git a/tests/baselines/reference/capturedParametersInInitializers1.js b/tests/baselines/reference/capturedParametersInInitializers1.js index ec5ff77d84b92..41578d51a4808 100644 --- a/tests/baselines/reference/capturedParametersInInitializers1.js +++ b/tests/baselines/reference/capturedParametersInInitializers1.js @@ -51,13 +51,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; // ok - usage is deferred -function foo1(y = class { - constructor() { +function foo1(y = class {constructor() { this.c = x; - } -}, x = 1) { + }}, x = 1) { new y().c; } + // ok - used in file function foo2(y = function (x) { }, z = 1) { } @@ -68,12 +67,15 @@ function foo3(y = { x: a }, z = 1) { // error - used before declaration function foo4(y = { z }, z = 1) { } + // error - used before declaration, IIFEs are inlined function foo5(y = (() => z)(), z = 1) { } + // ok - IIFE inside another function function foo6(y = () => (() => z)(), z = 1) { } + // ok - used inside immediately invoked generator function function foo7(y = (function* () { yield z; })(), z = 1) { } diff --git a/tests/baselines/reference/capturedParametersInInitializers2.js b/tests/baselines/reference/capturedParametersInInitializers2.js index da1f63b58e622..6ec3cce7dbf4a 100644 --- a/tests/baselines/reference/capturedParametersInInitializers2.js +++ b/tests/baselines/reference/capturedParametersInInitializers2.js @@ -15,7 +15,11 @@ function foo2(y = class {[x] = x}, x = 1) { } //// [capturedParametersInInitializers2.js] -function foo(y, x, z) { +function foo( +y, + x, + z +) { var _a; if (y === void 0) { y = (_a = /** @class */ (function () { function class_1() { diff --git a/tests/baselines/reference/castExpressionParentheses.js b/tests/baselines/reference/castExpressionParentheses.js index b1f4507f98292..349982e9e8f87 100644 --- a/tests/baselines/reference/castExpressionParentheses.js +++ b/tests/baselines/reference/castExpressionParentheses.js @@ -51,6 +51,7 @@ new (A()); //// [castExpressionParentheses.js] + // parentheses should be omitted // literals ({ a: 0 }); @@ -79,6 +80,8 @@ a().x; 1.0.foo; 12e+34.foo; 0xff.foo; + + // should keep the parentheses in emit (1.0); (new A).foo; @@ -88,7 +91,10 @@ new (A()); (function () { })(); (function foo() { })(); (-A).x; + // nested cast, should keep one pair of parenthese (-A).x; + // nested parenthesized expression, should keep one pair of parenthese (A); + diff --git a/tests/baselines/reference/castOfAwait.js b/tests/baselines/reference/castOfAwait.js index c00c1b028f4bf..9ac03a91f2556 100644 --- a/tests/baselines/reference/castOfAwait.js +++ b/tests/baselines/reference/castOfAwait.js @@ -17,8 +17,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); -}; -function f() { +};function f() { return __awaiter(this, void 0, void 0, function* () { yield 0; typeof (yield 0); diff --git a/tests/baselines/reference/castOfYield.js b/tests/baselines/reference/castOfYield.js index 86d35bedad434..ae9e343d08625 100644 --- a/tests/baselines/reference/castOfYield.js +++ b/tests/baselines/reference/castOfYield.js @@ -33,11 +33,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) { } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } -}; -function f() { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, 0]; +};function f() { + return __generator(this, function (_a) {switch (_a.label) {case 0: return [4 /*yield*/, 0]; case 1: (_a.sent()); // Unlike await, yield is not allowed to appear in a simple unary expression. diff --git a/tests/baselines/reference/castTest.js b/tests/baselines/reference/castTest.js index 930086bdd9464..455c7db572353 100644 --- a/tests/baselines/reference/castTest.js +++ b/tests/baselines/reference/castTest.js @@ -38,8 +38,12 @@ var y = x + z; var a = 0; var b = true; var s = ""; + var ar = null; + var f = null; + + var p_cast = ({ x: 0, y: 0, @@ -48,3 +52,4 @@ var p_cast = ({ }, mult: function (p) { return p; } }); + diff --git a/tests/baselines/reference/castingTuple.js b/tests/baselines/reference/castingTuple.js index 85ed6ff3757a8..f488e92fe5557 100644 --- a/tests/baselines/reference/castingTuple.js +++ b/tests/baselines/reference/castingTuple.js @@ -57,14 +57,12 @@ var A = /** @class */ (function () { return A; }()); var C = /** @class */ (function () { - function C() { - } + function C() {} return C; }()); ; var D = /** @class */ (function () { - function D() { - } + function D() {} return D; }()); ; @@ -110,6 +108,7 @@ var unionTuple = [new C(), "foo"]; var unionTuple2 = [new C(), "foo", new D()]; var unionTuple3 = [10, "foo"]; var unionTuple4 = unionTuple3; + // error var t3 = numStrTuple; var t9 = classCDTuple; diff --git a/tests/baselines/reference/catch.js b/tests/baselines/reference/catch.js index d3babf1f31d0e..ce4f659095796 100644 --- a/tests/baselines/reference/catch.js +++ b/tests/baselines/reference/catch.js @@ -7,8 +7,6 @@ function f() { //// [catch.js] function f() { - try { } - catch (e) { } - try { } - catch (e) { } + try { } catch (e) { } + try { } catch (e) { } } diff --git a/tests/baselines/reference/catchClauseWithTypeAnnotation.js b/tests/baselines/reference/catchClauseWithTypeAnnotation.js index 0337d65b43713..27ce427ab0a7f 100644 --- a/tests/baselines/reference/catchClauseWithTypeAnnotation.js +++ b/tests/baselines/reference/catchClauseWithTypeAnnotation.js @@ -42,100 +42,59 @@ function fn(x: boolean) { //// [catchClauseWithTypeAnnotation.js] + function fn(x) { + // no type annotation allowed other than `any` and `unknown` - try { } - catch (x) { } // should be OK - try { } - catch (x) { } // should be OK - try { } - catch (x) { } // should be OK - try { } - catch (x) { } // should be OK - try { } - catch (x) { } // should be OK - try { } - catch (x) { - x.foo; - } // should be OK - try { } - catch (x) { - x.foo; - } // should be OK - try { } - catch (x) { - x.foo; - } // should be OK - try { } - catch (x) { - console.log(x); - } // should be OK - try { } - catch (x) { - console.log(x); - } // should be OK - try { } - catch (x) { - x.foo; - } // error in the body - try { } - catch (x) { - x.foo; - } // error in the body - try { } - catch (x) { } // error in the type - try { } - catch (x) { } // error in the type - try { - console.log(); - } + try { } catch (x) { } // should be OK + try { } catch (x) { } // should be OK + try { } catch (x) { } // should be OK + try { } catch (x) { } // should be OK + try { } catch (x) { } // should be OK + try { } catch (x) {x.foo;} // should be OK + try { } catch (x) {x.foo;} // should be OK + try { } catch (x) {x.foo;} // should be OK + try { } catch (x) {console.log(x);} // should be OK + try { } catch (x) {console.log(x);} // should be OK + try { } catch (x) {x.foo;} // error in the body + try { } catch (x) {x.foo;} // error in the body + try { } catch (x) { } // error in the type + try { } catch (x) { } // error in the type + + try {console.log();} // @ts-ignore catch (e) { // e should not be a `number` console.log(e.toLowerCase()); } + // minor bug: shows that the `catch` argument is skipped when checking scope - try { } - catch (x) { - var x_1; - } - try { } - catch (x) { - var x; - } - try { } - catch (x) { - var x; - } - try { } - catch (_a) { + try { } catch (x) {var x_1;} + try { } catch (x) {var x;} + try { } catch (x) {var x;} + + try { } catch (_a) { var x_2 = _a.x; } // should be OK - try { } - catch (_b) { + try { } catch (_b) { var x_3 = _b.x; x_3.foo; } // should be OK - try { } - catch (_c) { + try { } catch (_c) { var x_4 = _c.x; x_4.foo; } // should be OK - try { } - catch (_d) { + try { } catch (_d) { var x_5 = _d.x; console.log(x_5); } // should be OK - try { } - catch (_e) { + try { } catch (_e) { var x_6 = _e.x; console.log(x_6); } // should be OK - try { } - catch (_f) { + try { } catch (_f) { var x_7 = _f.x; } // error in the type - try { } - catch (_g) { + try { } catch (_g) { var x_8 = _g.x; } // error in the type } diff --git a/tests/baselines/reference/cf.js b/tests/baselines/reference/cf.js index 7e95dca1944cc..0b4de1938779b 100644 --- a/tests/baselines/reference/cf.js +++ b/tests/baselines/reference/cf.js @@ -62,6 +62,7 @@ function f() { var z; var x = 10; var y = 3; + L1: for (var i = 0; i < 19; i++) { if (y == 7) { continue L1; diff --git a/tests/baselines/reference/chained.js b/tests/baselines/reference/chained.js index e37d6361b2441..0f65c5d53f63d 100644 --- a/tests/baselines/reference/chained.js +++ b/tests/baselines/reference/chained.js @@ -23,8 +23,7 @@ const d: D = {}; "use strict"; exports.__esModule = true; var A = /** @class */ (function () { - function A() { - } + function A() {} return A; }()); //// [b.js] diff --git a/tests/baselines/reference/chained2.js b/tests/baselines/reference/chained2.js index 9604b64e63341..355737cc5351a 100644 --- a/tests/baselines/reference/chained2.js +++ b/tests/baselines/reference/chained2.js @@ -25,8 +25,7 @@ const b: types.B = {}; "use strict"; exports.__esModule = true; var A = /** @class */ (function () { - function A() { - } + function A() {} return A; }()); //// [b.js] diff --git a/tests/baselines/reference/chainedAssignment3.js b/tests/baselines/reference/chainedAssignment3.js index 5b642013c6143..406698485921b 100644 --- a/tests/baselines/reference/chainedAssignment3.js +++ b/tests/baselines/reference/chainedAssignment3.js @@ -37,8 +37,7 @@ var __extends = (this && this.__extends) || (function () { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -})(); -var A = /** @class */ (function () { +})();var A = /** @class */ (function () { function A() { } return A; @@ -55,7 +54,9 @@ var b; a = b = null; a = b = new B(); b = a = new B(); + a.id = b.value = null; + // error cases b = a = new A(); a = b = new A(); diff --git a/tests/baselines/reference/chainedAssignmentChecking.js b/tests/baselines/reference/chainedAssignmentChecking.js index 9ea4020199017..73de88b6dfd44 100644 --- a/tests/baselines/reference/chainedAssignmentChecking.js +++ b/tests/baselines/reference/chainedAssignmentChecking.js @@ -43,4 +43,5 @@ var Z = /** @class */ (function () { var c1 = new X(3); var c2 = new Y(5); var c3 = new Z(); + c1 = c2 = c3; // Should be error diff --git a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js index cf4c12582054d..8c7b8babd15c2 100644 --- a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js +++ b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js @@ -34,8 +34,7 @@ var __extends = (this && this.__extends) || (function () { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -})(); -var Chain = /** @class */ (function () { +})();var Chain = /** @class */ (function () { function Chain(value) { this.value = value; } diff --git a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.js b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.js index 15c723524807a..67b6b9d2310ae 100644 --- a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.js +++ b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.js @@ -51,8 +51,10 @@ var Chain = /** @class */ (function () { var s; // Ok to go down the chain, but error to climb up the chain (new Chain(t)).then(function (tt) { return s; }).then(function (ss) { return t; }); + // But error to try to climb up the chain (new Chain(s)).then(function (ss) { return t; }); + // Staying at T or S should be fine (new Chain(t)).then(function (tt) { return t; }).then(function (tt) { return t; }).then(function (tt) { return t; }); (new Chain(s)).then(function (ss) { return s; }).then(function (ss) { return s; }).then(function (ss) { return s; }); @@ -71,6 +73,7 @@ var Chain2 = /** @class */ (function () { // Ok to go down the chain, check the constraint at the end. // Should get an error that we are assigning a string to a number (new Chain2(i)).then(function (ii) { return t; }).then(function (tt) { return s; }).value.x = ""; + // Staying at T or S should keep the constraint. // Get an error when we assign a string to a number in both cases (new Chain2(i)).then(function (ii) { return t; }).then(function (tt) { return t; }).then(function (tt) { return t; }).then(function (tt) { return t; }).value.x = ""; diff --git a/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.js b/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.js index 1884967aa9ecc..564fed96df951 100644 --- a/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.js +++ b/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.js @@ -12,6 +12,7 @@ var s3 = s2.each(x => { x.key /* Type is K, should be number */ }); //// [chainedSpecializationToObjectTypeLiteral.js] + var s; var s2 = s.groupBy(function (s) { return s.length; }); var s3 = s2.each(function (x) { x.key; /* Type is K, should be number */ }); diff --git a/tests/baselines/reference/checkForObjectTooStrict.js b/tests/baselines/reference/checkForObjectTooStrict.js index 3410b421a7825..c0186d5e778c7 100644 --- a/tests/baselines/reference/checkForObjectTooStrict.js +++ b/tests/baselines/reference/checkForObjectTooStrict.js @@ -49,6 +49,7 @@ var __extends = (this && this.__extends) || (function () { })(); var Foo; (function (Foo) { + var Object = /** @class */ (function () { function Object() { } diff --git a/tests/baselines/reference/checkInfiniteExpansionTermination.js b/tests/baselines/reference/checkInfiniteExpansionTermination.js index ed52ea6b4190c..34670394e9456 100644 --- a/tests/baselines/reference/checkInfiniteExpansionTermination.js +++ b/tests/baselines/reference/checkInfiniteExpansionTermination.js @@ -20,6 +20,10 @@ values = values2; //// [checkInfiniteExpansionTermination.js] // Regression test for #1002 // Before fix this code would cause infinite loop + + + + var values; var values2; values = values2; diff --git a/tests/baselines/reference/checkInfiniteExpansionTermination2.js b/tests/baselines/reference/checkInfiniteExpansionTermination2.js index 6175b34e52216..84dccd007428c 100644 --- a/tests/baselines/reference/checkInfiniteExpansionTermination2.js +++ b/tests/baselines/reference/checkInfiniteExpansionTermination2.js @@ -20,6 +20,9 @@ function fn() { //// [checkInfiniteExpansionTermination2.js] // Regression test for #1002 // Before fix this code would cause infinite loop + + + function fn() { var values = []; // Hang when using , but not diff --git a/tests/baselines/reference/checkJsObjectLiteralHasCheckedKeyof.js b/tests/baselines/reference/checkJsObjectLiteralHasCheckedKeyof.js index 66c46c9214d77..14830eeca342a 100644 --- a/tests/baselines/reference/checkJsObjectLiteralHasCheckedKeyof.js +++ b/tests/baselines/reference/checkJsObjectLiteralHasCheckedKeyof.js @@ -18,6 +18,7 @@ var obj = { x: 1, y: 2 }; + /** * @type {keyof typeof obj} */ diff --git a/tests/baselines/reference/checkJsObjectLiteralIndexSignatures.js b/tests/baselines/reference/checkJsObjectLiteralIndexSignatures.js index bc9c08b552477..d762a8f7549f0 100644 --- a/tests/baselines/reference/checkJsObjectLiteralIndexSignatures.js +++ b/tests/baselines/reference/checkJsObjectLiteralIndexSignatures.js @@ -17,6 +17,7 @@ stringIndex[s].toFixed(); var _a, _b; var n = Math.random(); var s = "" + n; + var numericIndex = (_a = {}, _a[n] = 1, _a); numericIndex[n].toFixed(); var stringIndex = (_b = {}, _b[s] = 1, _b); diff --git a/tests/baselines/reference/checkJsdocParamOnVariableDeclaredFunctionExpression.js b/tests/baselines/reference/checkJsdocParamOnVariableDeclaredFunctionExpression.js index 59d2fe5b14b96..1472194088938 100644 --- a/tests/baselines/reference/checkJsdocParamOnVariableDeclaredFunctionExpression.js +++ b/tests/baselines/reference/checkJsdocParamOnVariableDeclaredFunctionExpression.js @@ -29,6 +29,7 @@ var y; * @param {boolean!} b */ y = function bar(b) { }; + /** * @param {string} s */ diff --git a/tests/baselines/reference/checkJsdocParamTag1.js b/tests/baselines/reference/checkJsdocParamTag1.js index 577460626a18f..3246f00f4c843 100644 --- a/tests/baselines/reference/checkJsdocParamTag1.js +++ b/tests/baselines/reference/checkJsdocParamTag1.js @@ -17,6 +17,7 @@ foo(1, "hi"); * @param {string} [s] */ function foo(n, s) { } + foo(); foo(1); foo(1, "hi"); diff --git a/tests/baselines/reference/checkJsdocReturnTag1.js b/tests/baselines/reference/checkJsdocReturnTag1.js index 31c30e54dfc40..e6ef822de1eb4 100644 --- a/tests/baselines/reference/checkJsdocReturnTag1.js +++ b/tests/baselines/reference/checkJsdocReturnTag1.js @@ -29,12 +29,14 @@ function f2() { function f() { return "hello"; } + /** * @returns {string=} This comment is not currently exposed */ function f1() { return "hello world"; } + /** * @returns {string|number} This comment is not currently exposed */ diff --git a/tests/baselines/reference/checkJsdocReturnTag2.js b/tests/baselines/reference/checkJsdocReturnTag2.js index 4a68e5d85b7fd..d14d7a581ba54 100644 --- a/tests/baselines/reference/checkJsdocReturnTag2.js +++ b/tests/baselines/reference/checkJsdocReturnTag2.js @@ -22,6 +22,7 @@ function f1() { function f() { return 5; } + /** * @returns {string | number} This comment is not currently exposed */ diff --git a/tests/baselines/reference/checkJsdocTypeTag1.js b/tests/baselines/reference/checkJsdocTypeTag1.js index 0613a237d7bd2..a5a69cc1c1ef3 100644 --- a/tests/baselines/reference/checkJsdocTypeTag1.js +++ b/tests/baselines/reference/checkJsdocTypeTag1.js @@ -45,11 +45,14 @@ var props = {}; // @ts-check /** @type {String} */ var S = "hello world"; + /** @type {number} */ var n = 10; + /** @type {*} */ var anyT = 2; anyT = "hello"; + /** @type {?} */ var anyT1 = 2; anyT1 = "hi"; @@ -65,10 +68,12 @@ x1(0); /** @type {function (number): number} */ var x2 = function (a) { return a + 1; }; x2(0); + /** * @type {object} */ var props = {}; + /** * @type {Object} */ diff --git a/tests/baselines/reference/checkJsdocTypeTag2.js b/tests/baselines/reference/checkJsdocTypeTag2.js index 0e550d3ba333f..92e116096a8e9 100644 --- a/tests/baselines/reference/checkJsdocTypeTag2.js +++ b/tests/baselines/reference/checkJsdocTypeTag2.js @@ -29,6 +29,7 @@ x4(0); // @ts-check /** @type {String} */ var S = true; + /** @type {number} */ var n = "hello"; /** @type {function (number)} */ diff --git a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.js b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.js index ab574fddcedbf..a154378ede132 100644 --- a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.js +++ b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.js @@ -35,15 +35,14 @@ var obj = { /** @type {function(number): number} */ method2: function (n1) { return "lol"; }, /** @type {function(number): number} */ - arrowFunc: function (num) { - if (num === void 0) { num = "0"; } - return num + 42; - }, + arrowFunc: function (num) {if (num === void 0) { num = "0"; } + return num + 42;}, /** @type {string} */ lol: lol }; lol = "string"; /** @type {string} */ var s = obj.method1(0); + /** @type {string} */ var s1 = obj.method2("0"); diff --git a/tests/baselines/reference/checkJsdocTypedefInParamTag1.js b/tests/baselines/reference/checkJsdocTypedefInParamTag1.js index d50f126c54e1d..395988aed8ef5 100644 --- a/tests/baselines/reference/checkJsdocTypedefInParamTag1.js +++ b/tests/baselines/reference/checkJsdocTypedefInParamTag1.js @@ -57,7 +57,9 @@ foo2({x: 'abc'}); function foo(opts) { opts.x; } + foo({ x: 'abc' }); + /** * @typedef {Object} AnotherOpts * @property anotherX {string} @@ -68,7 +70,9 @@ foo({ x: 'abc' }); function foo1(opts) { opts.anotherX; } + foo1({ anotherX: "world" }); + /** * @typedef {object} Opts1 * @property {string} x diff --git a/tests/baselines/reference/checkJsdocTypedefOnlySourceFile.js b/tests/baselines/reference/checkJsdocTypedefOnlySourceFile.js index 7f4d7f4bcfd59..7040ec5d596d6 100644 --- a/tests/baselines/reference/checkJsdocTypedefOnlySourceFile.js +++ b/tests/baselines/reference/checkJsdocTypedefOnlySourceFile.js @@ -14,7 +14,9 @@ const myString = 'str'; //// [0.js] // @ts-check + var exports = {}; + /** * @typedef {string} */ diff --git a/tests/baselines/reference/checkJsxChildrenCanBeTupleType.js b/tests/baselines/reference/checkJsxChildrenCanBeTupleType.js index daa40116061c1..1752903f7c4e1 100644 --- a/tests/baselines/reference/checkJsxChildrenCanBeTupleType.js +++ b/tests/baselines/reference/checkJsxChildrenCanBeTupleType.js @@ -44,6 +44,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; exports.__esModule = true; var react_1 = __importDefault(require("react")); + + var ResizablePanel = /** @class */ (function (_super) { __extends(ResizablePanel, _super); function ResizablePanel() { @@ -51,10 +53,8 @@ var ResizablePanel = /** @class */ (function (_super) { } return ResizablePanel; }(react_1["default"].Component)); -var test = react_1["default"].createElement(ResizablePanel, null, - react_1["default"].createElement("div", null), - react_1["default"].createElement("div", null)); -var testErr = react_1["default"].createElement(ResizablePanel, null, - react_1["default"].createElement("div", null), - react_1["default"].createElement("div", null), - react_1["default"].createElement("div", null)); +var test = react_1["default"].createElement(ResizablePanel, null, react_1["default"].createElement("div", null), react_1["default"].createElement("div", null) +); + +var testErr = react_1["default"].createElement(ResizablePanel, null, react_1["default"].createElement("div", null), react_1["default"].createElement("div", null), react_1["default"].createElement("div", null) +); diff --git a/tests/baselines/reference/checkJsxChildrenProperty1.js b/tests/baselines/reference/checkJsxChildrenProperty1.js index 44c1ca8a72945..7a37fb7646ebc 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty1.js +++ b/tests/baselines/reference/checkJsxChildrenProperty1.js @@ -26,9 +26,12 @@ let k2 = "use strict"; exports.__esModule = true; var React = require("react"); + + function Comp(p) { return
{p.b}
; } + // OK var k = ; var k1 = diff --git a/tests/baselines/reference/checkJsxChildrenProperty10.js b/tests/baselines/reference/checkJsxChildrenProperty10.js index 18d1f3affa33e..632f6145955f5 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty10.js +++ b/tests/baselines/reference/checkJsxChildrenProperty10.js @@ -23,6 +23,7 @@ let k3 =
{1} {"That is a number"}
; let k4 = ; //// [file.jsx] + var Button = /** @class */ (function () { function Button() { } diff --git a/tests/baselines/reference/checkJsxChildrenProperty11.js b/tests/baselines/reference/checkJsxChildrenProperty11.js index 18d1f3affa33e..632f6145955f5 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty11.js +++ b/tests/baselines/reference/checkJsxChildrenProperty11.js @@ -23,6 +23,7 @@ let k3 =
{1} {"That is a number"}
; let k4 = ; //// [file.jsx] + var Button = /** @class */ (function () { function Button() { } diff --git a/tests/baselines/reference/checkJsxChildrenProperty12.js b/tests/baselines/reference/checkJsxChildrenProperty12.js index 1de09112a055d..e2b4013ae8a03 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty12.js +++ b/tests/baselines/reference/checkJsxChildrenProperty12.js @@ -51,6 +51,8 @@ var __extends = (this && this.__extends) || (function () { })(); exports.__esModule = true; var React = require("react"); + + var Button = /** @class */ (function (_super) { __extends(Button, _super); function Button() { @@ -69,6 +71,7 @@ var Button = /** @class */ (function (_super) { }; return Button; }(React.Component)); + var InnerButton = /** @class */ (function (_super) { __extends(InnerButton, _super); function InnerButton() { diff --git a/tests/baselines/reference/checkJsxChildrenProperty13.js b/tests/baselines/reference/checkJsxChildrenProperty13.js index 713821e6488aa..4e380b941bf1a 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty13.js +++ b/tests/baselines/reference/checkJsxChildrenProperty13.js @@ -46,6 +46,8 @@ var __extends = (this && this.__extends) || (function () { })(); exports.__esModule = true; var React = require("react"); + + var Button = /** @class */ (function (_super) { __extends(Button, _super); function Button() { @@ -59,6 +61,7 @@ var Button = /** @class */ (function (_super) { }; return Button; }(React.Component)); + var InnerButton = /** @class */ (function (_super) { __extends(InnerButton, _super); function InnerButton() { diff --git a/tests/baselines/reference/checkJsxChildrenProperty14.js b/tests/baselines/reference/checkJsxChildrenProperty14.js index bd28c6beddecc..5807732bfb099 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty14.js +++ b/tests/baselines/reference/checkJsxChildrenProperty14.js @@ -61,6 +61,8 @@ var __extends = (this && this.__extends) || (function () { })(); exports.__esModule = true; var React = require("react"); + + var Button = /** @class */ (function (_super) { __extends(Button, _super); function Button() { @@ -74,17 +76,23 @@ var Button = /** @class */ (function (_super) { function AnotherButton(p) { return

Just Another Button

; } + function Comp(p) { return
{p.b}
; } + // OK var k1 = <>