diff --git a/tests/baselines/reference/1.0lib-noErrors.js b/tests/baselines/reference/1.0lib-noErrors.js index 3dac98d9e56..bc21f205bef 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/2dArrays.js b/tests/baselines/reference/2dArrays.js index cb98b231e88..b19ec0a3eef 100644 --- a/tests/baselines/reference/2dArrays.js +++ b/tests/baselines/reference/2dArrays.js @@ -28,8 +28,7 @@ var Ship = /** @class */ (function () { }()); var Board = /** @class */ (function () { function Board() { - } - Board.prototype.allShipsSunk = function () { + }Board.prototype.allShipsSunk = function () { return this.ships.every(function (val) { return val.isSunk; }); }; return Board; diff --git a/tests/baselines/reference/APISample_Watch.js b/tests/baselines/reference/APISample_Watch.js index e675f2ec4eb..b7239512fce 100644 --- a/tests/baselines/reference/APISample_Watch.js +++ b/tests/baselines/reference/APISample_Watch.js @@ -90,12 +90,17 @@ 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 +116,11 @@ 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 +129,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 +137,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 63bfa4965e5..c9a88678c8c 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 75444a614f9..f496d7ddefc 100644 --- a/tests/baselines/reference/APISample_WatchWithOwnWatchHost.js +++ b/tests/baselines/reference/APISample_WatchWithOwnWatchHost.js @@ -69,14 +69,18 @@ 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, + useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, getNewLine: function () { return ts.sys.newLine; }, getCurrentDirectory: ts.sys.getCurrentDirectory, @@ -91,6 +95,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 +104,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 673dc047fa1..9fd6170d490 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -54,11 +54,15 @@ 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'); if (!diagnostic.file) { @@ -68,11 +72,11 @@ function compile(fileNames, options) { var _a = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start), line = _a.line, character = _a.character; console.log(diagnostic.file.fileName + " (" + (line + 1) + "," + (character + 1) + "): " + message); }); + var exitCode = emitResult.emitSkipped ? 1 : 0; console.log("Process exiting with code '" + exitCode + "'."); process.exit(exitCode); -} -exports.compile = compile; +}exports.compile = compile; compile(process.argv.slice(2), { noEmitOnError: true, noImplicitAny: true, target: ts.ScriptTarget.ES5, module: ts.ModuleKind.CommonJS diff --git a/tests/baselines/reference/APISample_jsdoc.js b/tests/baselines/reference/APISample_jsdoc.js index 9c1dd5f824f..024c67ec506 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) { @@ -156,6 +163,8 @@ function parseCommentsIntoDefinition(symbol, definition, otherAnnotations) { } }); } + + function getAnnotations(node) { var _this = this; var symbol = node.symbol; @@ -171,10 +180,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 +204,7 @@ function parseSpecificTags(node) { } } } + function getReturnTypeFromJSDoc(node) { if (node.kind === ts.SyntaxKind.FunctionDeclaration) { return ts.getJSDocReturnType(node); @@ -202,9 +214,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 a51c9cde268..8281f1e6927 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,12 +116,13 @@ 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); } -} -exports.delint = delint; +}exports.delint = delint; + var fileNames = process.argv.slice(2); fileNames.forEach(function (fileName) { // Parse a file diff --git a/tests/baselines/reference/APISample_parseConfig.js b/tests/baselines/reference/APISample_parseConfig.js index ffd27fdbabb..4487c50e93e 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) { @@ -74,5 +77,4 @@ function createProgram(rootFiles, compilerOptionsJson) { return undefined; } return ts.createProgram(rootFiles, settings.options); -} -exports.createProgram = createProgram; +}exports.createProgram = createProgram; diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index db25c1bd1dd..965132ff1b1 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 e93856a3165..c3d48c4d84b 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/AmbientModuleAndAmbientFunctionWithTheSameNameAndCommonRoot.js b/tests/baselines/reference/AmbientModuleAndAmbientFunctionWithTheSameNameAndCommonRoot.js index fe910c120b7..a5e0e0f7d18 100644 --- a/tests/baselines/reference/AmbientModuleAndAmbientFunctionWithTheSameNameAndCommonRoot.js +++ b/tests/baselines/reference/AmbientModuleAndAmbientFunctionWithTheSameNameAndCommonRoot.js @@ -14,6 +14,7 @@ var cl = Point(); var cl = Point.Origin; //// [test.js] -var cl; +var cl +; var cl = Point(); var cl = Point.Origin; diff --git a/tests/baselines/reference/AmbientModuleAndAmbientWithSameNameAndCommonRoot.js b/tests/baselines/reference/AmbientModuleAndAmbientWithSameNameAndCommonRoot.js index fd57d75d9b8..4ec24c5cb8e 100644 --- a/tests/baselines/reference/AmbientModuleAndAmbientWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/AmbientModuleAndAmbientWithSameNameAndCommonRoot.js @@ -26,6 +26,7 @@ var p = new A.Point(0, 0); // unexpected error here, bug 840000 //// [test.js] -var p; +var p +; var p = A.Point.Origin; var p = new A.Point(0, 0); // unexpected error here, bug 840000 diff --git a/tests/baselines/reference/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.js b/tests/baselines/reference/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.js index b9338ff0ab5..315d4cd3548 100644 --- a/tests/baselines/reference/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.js @@ -35,6 +35,7 @@ var A; A.Point = Point; })(A || (A = {})); //// [test.js] -var p; +var p +; var p = A.Point.Origin; var p = new A.Point(0, 0); // unexpected error here, bug 840000 diff --git a/tests/baselines/reference/AmbientModuleAndNonAmbientFunctionWithTheSameNameAndCommonRoot.js b/tests/baselines/reference/AmbientModuleAndNonAmbientFunctionWithTheSameNameAndCommonRoot.js index 90bed5cfd91..5edaca97641 100644 --- a/tests/baselines/reference/AmbientModuleAndNonAmbientFunctionWithTheSameNameAndCommonRoot.js +++ b/tests/baselines/reference/AmbientModuleAndNonAmbientFunctionWithTheSameNameAndCommonRoot.js @@ -20,6 +20,7 @@ function Point() { return { x: 0, y: 0 }; } //// [test.js] -var cl; +var cl +; var cl = Point(); var cl = Point.Origin; diff --git a/tests/baselines/reference/ArrowFunction3.js b/tests/baselines/reference/ArrowFunction3.js index 41182da2eed..bc09834a396 100644 --- a/tests/baselines/reference/ArrowFunction3.js +++ b/tests/baselines/reference/ArrowFunction3.js @@ -6,5 +6,4 @@ var v = (a): => { //// [ArrowFunction3.js] var v = (a); { -} -; +}; diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js b/tests/baselines/reference/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js index f266c117dff..28ffb1b9b59 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/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.js index abe399154dd..bc9397558b1 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.js @@ -18,8 +18,7 @@ module clodule { //// [ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.js] var clodule = /** @class */ (function () { function clodule() { - } - clodule.fn = function (id) { }; + }clodule.fn = function (id) { }; return clodule; }()); (function (clodule) { diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.js index 4bd5f9c7d37..9aa95f21439 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.js @@ -18,8 +18,7 @@ module clodule { //// [ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.js] var clodule = /** @class */ (function () { function clodule() { - } - clodule.fn = function (id) { }; + }clodule.fn = function (id) { }; return clodule; }()); (function (clodule) { diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js index 6620c4fabf8..504a06f4915 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js @@ -18,8 +18,7 @@ module clodule { //// [ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js] var clodule = /** @class */ (function () { function clodule() { - } - clodule.sfn = function (id) { return 42; }; + }clodule.sfn = function (id) { return 42; }; return clodule; }()); (function (clodule) { diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js index de0bb3cd400..3292c156106 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js @@ -28,6 +28,7 @@ var Point = /** @class */ (function () { this.x = x; this.y = y; } + Point.Origin = function () { return { x: 0, y: 0 }; }; // unexpected error here bug 840246 return Point; }()); @@ -42,6 +43,7 @@ var A; this.x = x; this.y = y; } + Point.Origin = function () { return { x: 0, y: 0 }; }; // unexpected error here bug 840246 return Point; }()); diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js index 50acdf1b9da..4360e2b8b73 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js @@ -28,6 +28,7 @@ var Point = /** @class */ (function () { this.x = x; this.y = y; } + Point.Origin = function () { return { x: 0, y: 0 }; }; return Point; }()); @@ -41,6 +42,7 @@ var A; this.x = x; this.y = y; } + Point.Origin = function () { return { x: 0, y: 0 }; }; return Point; }()); diff --git a/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.js b/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.js index a6ca39648ae..d6d0f634a72 100644 --- a/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.js @@ -70,6 +70,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] var A = /** @class */ (function () { function A() { diff --git a/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRootES6.js b/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRootES6.js index 9187c99c840..935f216a5fe 100644 --- a/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRootES6.js +++ b/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRootES6.js @@ -69,6 +69,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/ClassDeclaration11.js b/tests/baselines/reference/ClassDeclaration11.js index 908956b4eb6..ab45d41090e 100644 --- a/tests/baselines/reference/ClassDeclaration11.js +++ b/tests/baselines/reference/ClassDeclaration11.js @@ -7,7 +7,6 @@ class C { //// [ClassDeclaration11.js] var C = /** @class */ (function () { function C() { - } - C.prototype.foo = function () { }; + }C.prototype.foo = function () { }; return C; }()); diff --git a/tests/baselines/reference/ClassDeclaration13.js b/tests/baselines/reference/ClassDeclaration13.js index 1f72cf9de34..520fda89017 100644 --- a/tests/baselines/reference/ClassDeclaration13.js +++ b/tests/baselines/reference/ClassDeclaration13.js @@ -7,7 +7,6 @@ class C { //// [ClassDeclaration13.js] var C = /** @class */ (function () { function C() { - } - C.prototype.bar = function () { }; + }C.prototype.bar = function () { }; return C; }()); diff --git a/tests/baselines/reference/ClassDeclaration15.js b/tests/baselines/reference/ClassDeclaration15.js index f5040f9c63b..728be72d0fc 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/ClassDeclaration21.js b/tests/baselines/reference/ClassDeclaration21.js index 9b26af46b7c..762cd593f70 100644 --- a/tests/baselines/reference/ClassDeclaration21.js +++ b/tests/baselines/reference/ClassDeclaration21.js @@ -7,7 +7,6 @@ class C { //// [ClassDeclaration21.js] var C = /** @class */ (function () { function C() { - } - C.prototype[1] = function () { }; + }C.prototype[1] = function () { }; return C; }()); diff --git a/tests/baselines/reference/ClassDeclaration22.js b/tests/baselines/reference/ClassDeclaration22.js index 35c13c8bb0f..2f064e93e3b 100644 --- a/tests/baselines/reference/ClassDeclaration22.js +++ b/tests/baselines/reference/ClassDeclaration22.js @@ -7,7 +7,6 @@ class C { //// [ClassDeclaration22.js] var C = /** @class */ (function () { function C() { - } - C.prototype["bar"] = function () { }; + }C.prototype["bar"] = function () { }; return C; }()); diff --git a/tests/baselines/reference/ClassDeclaration26.js b/tests/baselines/reference/ClassDeclaration26.js index 8a240f696a4..2f304d01537 100644 --- a/tests/baselines/reference/ClassDeclaration26.js +++ b/tests/baselines/reference/ClassDeclaration26.js @@ -12,5 +12,5 @@ var C = /** @class */ (function () { } return C; }()); -var constructor; -(function () { }); +var constructor;(function () { } +); diff --git a/tests/baselines/reference/ES5For-of31.js b/tests/baselines/reference/ES5For-of31.js index 23cee8bff42..a963d52c2de 100644 --- a/tests/baselines/reference/ES5For-of31.js +++ b/tests/baselines/reference/ES5For-of31.js @@ -9,6 +9,7 @@ for ({ a: b = 1, b: a = ""} of []) { //// [ES5For-of31.js] var _a, _b, _c; var a, b; + for (var _i = 0, _d = []; _i < _d.length; _i++) { _a = _d[_i], _b = _a.a, b = _b === void 0 ? 1 : _b, _c = _a.b, a = _c === void 0 ? "" : _c; a; diff --git a/tests/baselines/reference/ES5For-of7.js b/tests/baselines/reference/ES5For-of7.js index ad2302cdc5c..46c547ef584 100644 --- a/tests/baselines/reference/ES5For-of7.js +++ b/tests/baselines/reference/ES5For-of7.js @@ -12,6 +12,7 @@ for (var _i = 0, _a = []; _i < _a.length; _i++) { var w = _a[_i]; var x = w; } + for (var _b = 0, _c = []; _b < _c.length; _b++) { var v = _c[_b]; var x = [w, v]; diff --git a/tests/baselines/reference/ES5For-ofTypeCheck10.js b/tests/baselines/reference/ES5For-ofTypeCheck10.js index 85d44ca2550..e7a1e59ce16 100644 --- a/tests/baselines/reference/ES5For-ofTypeCheck10.js +++ b/tests/baselines/reference/ES5For-ofTypeCheck10.js @@ -18,8 +18,7 @@ for (var v of new StringIterator) { } // In ES3/5, you cannot for...of over an arbitrary iterable. var StringIterator = /** @class */ (function () { function StringIterator() { - } - StringIterator.prototype.next = function () { + }StringIterator.prototype.next = function () { return { done: true, value: "" diff --git a/tests/baselines/reference/ES5For-ofTypeCheck13.js b/tests/baselines/reference/ES5For-ofTypeCheck13.js index 216aa57f97c..d96f8c9bc04 100644 --- a/tests/baselines/reference/ES5For-ofTypeCheck13.js +++ b/tests/baselines/reference/ES5For-ofTypeCheck13.js @@ -5,7 +5,8 @@ strSet.add('World') for (const str of strSet) { } //// [ES5For-ofTypeCheck13.js] -var strSet = new Set(); +var strSet = new Set() +; strSet.add('Hello'); strSet.add('World'); for (var _i = 0, strSet_1 = strSet; _i < strSet_1.length; _i++) { diff --git a/tests/baselines/reference/ES5For-ofTypeCheck14.js b/tests/baselines/reference/ES5For-ofTypeCheck14.js index 87e55c41a0e..b439b0ac836 100644 --- a/tests/baselines/reference/ES5For-ofTypeCheck14.js +++ b/tests/baselines/reference/ES5For-ofTypeCheck14.js @@ -3,7 +3,8 @@ var union: string | Set for (const e of union) { } //// [ES5For-ofTypeCheck14.js] -var union; +var union +; for (var _i = 0, union_1 = union; _i < union_1.length; _i++) { var e = union_1[_i]; } diff --git a/tests/baselines/reference/ES5SymbolProperty1.js b/tests/baselines/reference/ES5SymbolProperty1.js index 4300218c626..efe6603c356 100644 --- a/tests/baselines/reference/ES5SymbolProperty1.js +++ b/tests/baselines/reference/ES5SymbolProperty1.js @@ -13,7 +13,10 @@ obj[Symbol.foo]; //// [ES5SymbolProperty1.js] var _a; var Symbol; + var obj = (_a = {}, _a[Symbol.foo] = 0, - _a); + _a) + +; obj[Symbol.foo]; diff --git a/tests/baselines/reference/ES5SymbolProperty2.js b/tests/baselines/reference/ES5SymbolProperty2.js index 3de8541a6c9..f053b3c48b4 100644 --- a/tests/baselines/reference/ES5SymbolProperty2.js +++ b/tests/baselines/reference/ES5SymbolProperty2.js @@ -14,10 +14,10 @@ module M { var M; (function (M) { var Symbol; + var C = /** @class */ (function () { function C() { - } - C.prototype[Symbol.iterator] = function () { }; + }C.prototype[Symbol.iterator] = function () { }; return C; }()); M.C = C; diff --git a/tests/baselines/reference/ES5SymbolProperty3.js b/tests/baselines/reference/ES5SymbolProperty3.js index 362fcfc7375..ba41aad90e8 100644 --- a/tests/baselines/reference/ES5SymbolProperty3.js +++ b/tests/baselines/reference/ES5SymbolProperty3.js @@ -9,10 +9,10 @@ class C { //// [ES5SymbolProperty3.js] var Symbol; + var C = /** @class */ (function () { function C() { - } - C.prototype[Symbol.iterator] = function () { }; + }C.prototype[Symbol.iterator] = function () { }; return C; }()); (new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolProperty4.js b/tests/baselines/reference/ES5SymbolProperty4.js index f756a730d52..77cba84b8da 100644 --- a/tests/baselines/reference/ES5SymbolProperty4.js +++ b/tests/baselines/reference/ES5SymbolProperty4.js @@ -9,10 +9,10 @@ class C { //// [ES5SymbolProperty4.js] var Symbol; + var C = /** @class */ (function () { function C() { - } - C.prototype[Symbol.iterator] = function () { }; + }C.prototype[Symbol.iterator] = function () { }; return C; }()); (new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolProperty5.js b/tests/baselines/reference/ES5SymbolProperty5.js index c146b8dd5f1..4fda2356359 100644 --- a/tests/baselines/reference/ES5SymbolProperty5.js +++ b/tests/baselines/reference/ES5SymbolProperty5.js @@ -9,10 +9,10 @@ class C { //// [ES5SymbolProperty5.js] var Symbol; + var C = /** @class */ (function () { function C() { - } - C.prototype[Symbol.iterator] = function () { }; + }C.prototype[Symbol.iterator] = function () { }; return C; }()); (new C)[Symbol.iterator](0); // Should error diff --git a/tests/baselines/reference/ES5SymbolProperty6.js b/tests/baselines/reference/ES5SymbolProperty6.js index f9a5adec815..4430ef2935b 100644 --- a/tests/baselines/reference/ES5SymbolProperty6.js +++ b/tests/baselines/reference/ES5SymbolProperty6.js @@ -8,8 +8,7 @@ class C { //// [ES5SymbolProperty6.js] var C = /** @class */ (function () { function C() { - } - C.prototype[Symbol.iterator] = function () { }; + }C.prototype[Symbol.iterator] = function () { }; return C; }()); (new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolProperty7.js b/tests/baselines/reference/ES5SymbolProperty7.js index f874c4c77cd..1a9ef8e7814 100644 --- a/tests/baselines/reference/ES5SymbolProperty7.js +++ b/tests/baselines/reference/ES5SymbolProperty7.js @@ -9,10 +9,10 @@ class C { //// [ES5SymbolProperty7.js] var Symbol; + var C = /** @class */ (function () { function C() { - } - C.prototype[Symbol.iterator] = function () { }; + }C.prototype[Symbol.iterator] = function () { }; return C; }()); (new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5for-of32.js b/tests/baselines/reference/ES5for-of32.js index 747f9524062..8993f23b7f0 100644 --- a/tests/baselines/reference/ES5for-of32.js +++ b/tests/baselines/reference/ES5for-of32.js @@ -13,10 +13,12 @@ for (let num of array) { //// [ES5for-of32.js] var array = [1, 2, 3]; var sum = 0; + for (var _i = 0, array_1 = array; _i < array_1.length; _i++) { var num = array_1[_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 40075310eb1..e84f7b1c0bf 100644 --- a/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.js @@ -19,10 +19,10 @@ var y = new enumdule.Point(0, 0); //// [EnumAndModuleWithSameNameAndCommonRoot.js] var enumdule; (function (enumdule) { - enumdule[enumdule["Red"] = 0] = "Red"; - enumdule[enumdule["Blue"] = 1] = "Blue"; + enumdule[enumdule["Red"] = 0] = "Red";enumdule[enumdule["Blue"] = 1] = "Blue"; })(enumdule || (enumdule = {})); (function (enumdule) { + var Point = /** @class */ (function () { function Point(x, y) { this.x = x; @@ -34,5 +34,6 @@ var enumdule; })(enumdule || (enumdule = {})); var x; var x = enumdule.Red; + var y; var y = new enumdule.Point(0, 0); diff --git a/tests/baselines/reference/ExportAssignment8.js b/tests/baselines/reference/ExportAssignment8.js index 5ef706afbd5..14fe0944099 100644 --- a/tests/baselines/reference/ExportAssignment8.js +++ b/tests/baselines/reference/ExportAssignment8.js @@ -13,3 +13,4 @@ var C = /** @class */ (function () { return C; }()); module.exports = B; + diff --git a/tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.js b/tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.js index 94faa0dd4b3..1a6856f0eef 100644 --- a/tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.js +++ b/tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.js @@ -22,11 +22,14 @@ module A { //// [ExportClassWhichExtendsInterfaceWithInaccessibleType.js] var A; (function (A) { + + var Point2d = /** @class */ (function () { function Point2d(x, y) { this.x = x; this.y = y; } + Point2d.prototype.fromOrigin = function (p) { return 1; }; diff --git a/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js index 9074e2ad4c8..3eb8c753487 100644 --- a/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js +++ b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js @@ -36,6 +36,7 @@ var __extends = (this && this.__extends) || (function () { })(); var A; (function (A) { + var Point = /** @class */ (function () { function Point() { } @@ -43,15 +44,16 @@ var A; }()); A.Point = Point; A.Origin = { x: 0, y: 0 }; + var Point3d = /** @class */ (function (_super) { - __extends(Point3d, _super); - function Point3d() { + __extends(Point3d, _super);function Point3d() { return _super !== null && _super.apply(this, arguments) || this; } return Point3d; }(Point)); A.Point3d = Point3d; A.Origin3d = { x: 0, y: 0, z: 0 }; + var Line = /** @class */ (function () { function Line(start, end) { this.start = start; diff --git a/tests/baselines/reference/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.js b/tests/baselines/reference/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.js index 7642a6cbe87..db7d84739d5 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 7ffab769794..cdf675deb04 100644 --- a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js +++ b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js @@ -40,26 +40,29 @@ var __extends = (this && this.__extends) || (function () { })(); var A; (function (A) { + var Point = /** @class */ (function () { function Point() { } return Point; }()); A.Origin = { x: 0, y: 0 }; + var Point3d = /** @class */ (function (_super) { - __extends(Point3d, _super); - function Point3d() { + __extends(Point3d, _super);function Point3d() { return _super !== null && _super.apply(this, arguments) || this; } return Point3d; }(Point)); A.Point3d = Point3d; A.Origin3d = { x: 0, y: 0, z: 0 }; + var Line = /** @class */ (function () { function Line(start, end) { this.start = start; this.end = end; } + Line.fromorigin2d = function (p) { return null; }; diff --git a/tests/baselines/reference/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.js b/tests/baselines/reference/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.js index 2d7e408d81b..351730b7a9a 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 ac8e36d4222..1779aee9772 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 b2abc1a4d31..192f39d0610 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 e2b32a3bca4..ab01ff69b35 100644 --- a/tests/baselines/reference/ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js +++ b/tests/baselines/reference/ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js @@ -25,6 +25,11 @@ 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 8f5df1d3fce..2b8fd1d2cd7 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 7625500a1d0..30faef49e20 100644 --- a/tests/baselines/reference/ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.js +++ b/tests/baselines/reference/ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.js @@ -26,6 +26,11 @@ 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 401962dd261..8adea78468c 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; @@ -34,9 +35,11 @@ var A; var B; (function (B) { B.Origin = new Point(0, 0); + var Line = /** @class */ (function () { function Line(start, end) { } + Line.fromOrigin = function (p) { return new Line({ x: 0, y: 0 }, p); }; diff --git a/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.js b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.js index 0990c9bf2bd..b72c9dbc41c 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; @@ -22,5 +23,6 @@ var A; return Point; }()); A.Origin = { x: 0, y: 0 }; + A.Unity = { start: new Point(0, 0), end: new Point(1, 0) }; })(A || (A = {})); diff --git a/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.js b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.js index b454d785e9c..f546142945e 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 591845b627e..06c336b3b69 100644 --- a/tests/baselines/reference/ExportVariableWithAccessibleTypeInTypeAnnotation.js +++ b/tests/baselines/reference/ExportVariableWithAccessibleTypeInTypeAnnotation.js @@ -14,6 +14,8 @@ 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 d63edb65569..45c70ff4d6c 100644 --- a/tests/baselines/reference/ExportVariableWithInaccessibleTypeInTypeAnnotation.js +++ b/tests/baselines/reference/ExportVariableWithInaccessibleTypeInTypeAnnotation.js @@ -21,8 +21,12 @@ module A { //// [ExportVariableWithInaccessibleTypeInTypeAnnotation.js] var A; (function (A) { + + // valid since Point is exported A.Origin = { x: 0, y: 0 }; + + // invalid Point3d is not exported A.Origin3d = { x: 0, y: 0, z: 0 }; })(A || (A = {})); diff --git a/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.js b/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.js index daa56620014..b2981cc1e92 100644 --- a/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.js @@ -62,12 +62,16 @@ var A; //// [test.js] var fn; var fn = A.Point; -var cl; + +var cl +; var cl = A.Point(); var cl = A.Point.Origin; // not expected to be an error. + //// [simple.js] var B; (function (B) { + function Point() { return { x: 0, y: 0 }; } @@ -78,6 +82,8 @@ var B; })(B || (B = {})); var fn; var fn = B.Point; // not expected to be an error. bug 840000: [corelang] Function of fundule not assignalbe as expected -var cl; + +var cl +; var cl = B.Point(); var cl = B.Point.Origin; diff --git a/tests/baselines/reference/FunctionAndModuleWithSameNameAndDifferentCommonRoot.js b/tests/baselines/reference/FunctionAndModuleWithSameNameAndDifferentCommonRoot.js index 13302ea391a..426810236e3 100644 --- a/tests/baselines/reference/FunctionAndModuleWithSameNameAndDifferentCommonRoot.js +++ b/tests/baselines/reference/FunctionAndModuleWithSameNameAndDifferentCommonRoot.js @@ -41,5 +41,7 @@ var B; //// [test.js] var fn; var fn = A.Point; -var cl; + +var cl +; var cl = B.Point.Origin; diff --git a/tests/baselines/reference/FunctionDeclaration10_es6.js b/tests/baselines/reference/FunctionDeclaration10_es6.js index aca7c00e58c..e9b8beff45b 100644 --- a/tests/baselines/reference/FunctionDeclaration10_es6.js +++ b/tests/baselines/reference/FunctionDeclaration10_es6.js @@ -3,7 +3,5 @@ function * foo(a = yield => yield) { } //// [FunctionDeclaration10_es6.js] -function* foo(a = yield) { } -yield; -{ +function* foo(a = yield) { }yield;{ } diff --git a/tests/baselines/reference/FunctionDeclaration12_es6.js b/tests/baselines/reference/FunctionDeclaration12_es6.js index d2f490ef5e8..d9047af7f66 100644 --- a/tests/baselines/reference/FunctionDeclaration12_es6.js +++ b/tests/baselines/reference/FunctionDeclaration12_es6.js @@ -2,5 +2,4 @@ var v = function * yield() { } //// [FunctionDeclaration12_es6.js] -var v = function* () { }, yield; -() => { }; +var v = function* () { }, yield;() => { }; diff --git a/tests/baselines/reference/FunctionDeclaration5_es6.js b/tests/baselines/reference/FunctionDeclaration5_es6.js index 645ee976ecd..e5f853552bc 100644 --- a/tests/baselines/reference/FunctionDeclaration5_es6.js +++ b/tests/baselines/reference/FunctionDeclaration5_es6.js @@ -3,7 +3,5 @@ function*foo(yield) { } //// [FunctionDeclaration5_es6.js] -function* foo() { } -yield; -{ +function* foo() { }yield;{ } diff --git a/tests/baselines/reference/FunctionDeclaration9_es6.js b/tests/baselines/reference/FunctionDeclaration9_es6.js index b5be11778ac..23dca985b6f 100644 --- a/tests/baselines/reference/FunctionDeclaration9_es6.js +++ b/tests/baselines/reference/FunctionDeclaration9_es6.js @@ -5,5 +5,6 @@ function * foo() { //// [FunctionDeclaration9_es6.js] function* foo() { - var v = { [yield]: foo }; + var v = { [yield]: foo } + ; } diff --git a/tests/baselines/reference/InvalidNonInstantiatedModule.js b/tests/baselines/reference/InvalidNonInstantiatedModule.js index 54c0f7a42ab..6d642d63b65 100644 --- a/tests/baselines/reference/InvalidNonInstantiatedModule.js +++ b/tests/baselines/reference/InvalidNonInstantiatedModule.js @@ -9,5 +9,7 @@ var x: typeof M; // Error only a namespace //// [InvalidNonInstantiatedModule.js] + var m = M; // Error, not instantiated can not be used as var + var x; // Error only a namespace diff --git a/tests/baselines/reference/MemberFunctionDeclaration8_es6.js b/tests/baselines/reference/MemberFunctionDeclaration8_es6.js index a44ff273fa0..39d702b5cd4 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/ModuleAndEnumWithSameNameAndCommonRoot.js b/tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.js index 740d02edd17..17d563237f3 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; @@ -29,10 +30,10 @@ var enumdule; enumdule.Point = Point; })(enumdule || (enumdule = {})); (function (enumdule) { - enumdule[enumdule["Red"] = 0] = "Red"; - enumdule[enumdule["Blue"] = 1] = "Blue"; + enumdule[enumdule["Red"] = 0] = "Red";enumdule[enumdule["Blue"] = 1] = "Blue"; })(enumdule || (enumdule = {})); var x; var x = enumdule.Red; + var y; var y = new enumdule.Point(0, 0); diff --git a/tests/baselines/reference/ModuleWithExportedAndNonExportedClasses.js b/tests/baselines/reference/ModuleWithExportedAndNonExportedClasses.js index 26d014f16c2..78e74d2b9c0 100644 --- a/tests/baselines/reference/ModuleWithExportedAndNonExportedClasses.js +++ b/tests/baselines/reference/ModuleWithExportedAndNonExportedClasses.js @@ -62,7 +62,12 @@ var A; // no errors expected, these are all exported var a; var a = new A.A(); -var AG = new A.AG(); + +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 713d2ac7f18..e9b1d2bb649 100644 --- a/tests/baselines/reference/ModuleWithExportedAndNonExportedEnums.js +++ b/tests/baselines/reference/ModuleWithExportedAndNonExportedEnums.js @@ -16,16 +16,15 @@ var A; (function (A) { var Color; (function (Color) { - Color[Color["Red"] = 0] = "Red"; - Color[Color["Blue"] = 1] = "Blue"; + Color[Color["Red"] = 0] = "Red";Color[Color["Blue"] = 1] = "Blue"; })(Color = A.Color || (A.Color = {})); var Day; (function (Day) { - Day[Day["Monday"] = 0] = "Monday"; - Day[Day["Tuesday"] = 1] = "Tuesday"; + Day[Day["Monday"] = 0] = "Monday";Day[Day["Tuesday"] = 1] = "Tuesday"; })(Day || (Day = {})); })(A || (A = {})); // not an error since exported var a = A.Color.Red; + // error not exported var b = A.Day.Monday; diff --git a/tests/baselines/reference/ModuleWithExportedAndNonExportedFunctions.js b/tests/baselines/reference/ModuleWithExportedAndNonExportedFunctions.js index ed0e1f90bf3..c73e5342b2c 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; } @@ -50,8 +52,11 @@ var A; // these should not be errors since the functions are exported 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 e1c36200005..5be0aa0d441 100644 --- a/tests/baselines/reference/ModuleWithExportedAndNonExportedImportAlias.js +++ b/tests/baselines/reference/ModuleWithExportedAndNonExportedImportAlias.js @@ -54,7 +54,9 @@ var B; var Geometry; (function (Geometry) { var Lines = B; + Geometry.Origin = { x: 0, y: 0 }; + // this is valid since B.Line _is_ visible outside Geometry Geometry.Unit = new Lines.Line(Geometry.Origin, { x: 1, y: 0 }); })(Geometry || (Geometry = {})); @@ -62,7 +64,10 @@ var Geometry; var p; 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 0a2c63342c6..be6459b95d0 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 e1df1d41f54..0dbb970754c 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 29b1f96effe..bfb44dc226c 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/Protected4.js b/tests/baselines/reference/Protected4.js index 35bce025cb8..f9d65877d36 100644 --- a/tests/baselines/reference/Protected4.js +++ b/tests/baselines/reference/Protected4.js @@ -6,7 +6,6 @@ class C { //// [Protected4.js] var C = /** @class */ (function () { function C() { - } - C.prototype.m = function () { }; + }C.prototype.m = function () { }; return C; }()); diff --git a/tests/baselines/reference/Protected5.js b/tests/baselines/reference/Protected5.js index 24356999d61..cca33f53777 100644 --- a/tests/baselines/reference/Protected5.js +++ b/tests/baselines/reference/Protected5.js @@ -6,7 +6,6 @@ class C { //// [Protected5.js] var C = /** @class */ (function () { function C() { - } - C.m = function () { }; + }C.m = function () { }; return C; }()); diff --git a/tests/baselines/reference/Protected6.js b/tests/baselines/reference/Protected6.js index 654543a2df7..27c67341c61 100644 --- a/tests/baselines/reference/Protected6.js +++ b/tests/baselines/reference/Protected6.js @@ -6,7 +6,6 @@ class C { //// [Protected6.js] var C = /** @class */ (function () { function C() { - } - C.m = function () { }; + }C.m = function () { }; return C; }()); diff --git a/tests/baselines/reference/Protected7.js b/tests/baselines/reference/Protected7.js index 41211f13b3b..d6d99bb8c3f 100644 --- a/tests/baselines/reference/Protected7.js +++ b/tests/baselines/reference/Protected7.js @@ -6,7 +6,6 @@ class C { //// [Protected7.js] var C = /** @class */ (function () { function C() { - } - C.prototype.m = function () { }; + }C.prototype.m = function () { }; return C; }()); diff --git a/tests/baselines/reference/SystemModuleForStatementNoInitializer.js b/tests/baselines/reference/SystemModuleForStatementNoInitializer.js index ff31b3c73e2..0f6e49c6c79 100644 --- a/tests/baselines/reference/SystemModuleForStatementNoInitializer.js +++ b/tests/baselines/reference/SystemModuleForStatementNoInitializer.js @@ -30,9 +30,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 134c14e3a8e..b4ac218e1bd 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.js +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.js @@ -53,8 +53,7 @@ var A; (function (A) { var Point = /** @class */ (function () { function Point() { - } - Point.prototype.fromCarthesian = function (p) { + }Point.prototype.fromCarthesian = function (p) { return { x: p.x, y: p.y }; }; return Point; @@ -92,5 +91,7 @@ var X; })(Y = X.Y || (X.Y = {})); })(X || (X = {})); // ensure merges as expected +var l +; var l; -var l; + diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.js b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.js index b9218ea1a55..69959e1b409 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.js +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.js @@ -38,9 +38,15 @@ var l: X.Y.Z.Line; //// [TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.js] + + // ensure merges as expected var p; var p; + + + // ensure merges as expected -var l; +var l +; var l; diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.js b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.js index 16c37108d3f..c0c037ec483 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.js +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.js @@ -72,10 +72,13 @@ var A; })(A || (A = {})); //// [part3.js] // test the merging actually worked + var o; var o; var o = A.Origin; var o = A.Utils.mirror(o); + var p; var p; var p = new A.Utils.Plane(o, { x: 1, y: 1 }); + diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.js b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.js index b54a0938a32..bf041b1ade8 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.js +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.js @@ -38,9 +38,15 @@ var l: X.Y.Z.Line; //// [TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.js] + + // ensure merges as expected var p; var p; + + + // ensure merges as expected -var l; +var l +; var l; diff --git a/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndSameCommonRoot.js b/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndSameCommonRoot.js index d221274edd8..0da77f47681 100644 --- a/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndSameCommonRoot.js +++ b/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndSameCommonRoot.js @@ -68,10 +68,13 @@ var A; })(A || (A = {})); //// [part3.js] // test the merging actually worked + var o; var o; var o = A.Origin; var o = A.Utils.mirror(o); + var p; var p; var p = new A.Utils.Plane(o, { x: 1, y: 1 }); + diff --git a/tests/baselines/reference/TypeArgumentList1.js b/tests/baselines/reference/TypeArgumentList1.js index f6f5412ce16..b76ec2b036b 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 f582c70857a..fa4fd5302c2 100644 --- a/tests/baselines/reference/TypeGuardWithEnumUnion.js +++ b/tests/baselines/reference/TypeGuardWithEnumUnion.js @@ -39,9 +39,7 @@ function f2(x: Color | string | string[]) { //// [TypeGuardWithEnumUnion.js] var Color; (function (Color) { - Color[Color["R"] = 0] = "R"; - Color[Color["G"] = 1] = "G"; - Color[Color["B"] = 2] = "B"; + Color[Color["R"] = 0] = "R";Color[Color["G"] = 1] = "G";Color[Color["B"] = 2] = "B"; })(Color || (Color = {})); function f1(x) { if (typeof x === "number") { @@ -53,6 +51,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 da0748d2191..e0567d1345e 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 152ca6a26d6..66ffa72d16b 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/YieldExpression10_es6.js b/tests/baselines/reference/YieldExpression10_es6.js index f32dd1decf7..e589fcc58b0 100644 --- a/tests/baselines/reference/YieldExpression10_es6.js +++ b/tests/baselines/reference/YieldExpression10_es6.js @@ -9,4 +9,5 @@ var v = { * foo() { var v = { *foo() { yield (foo); } -}; +} +; diff --git a/tests/baselines/reference/abstractClassInLocalScope.js b/tests/baselines/reference/abstractClassInLocalScope.js index 4e7b9f87095..f016ffb5a0f 100644 --- a/tests/baselines/reference/abstractClassInLocalScope.js +++ b/tests/baselines/reference/abstractClassInLocalScope.js @@ -20,16 +20,13 @@ 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) { - __extends(B, _super); - function B() { + __extends(B, _super);function B() { return _super !== null && _super.apply(this, arguments) || this; } return B; diff --git a/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js b/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js index 60af14e625b..71b6e295942 100644 --- a/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js +++ b/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js @@ -20,16 +20,13 @@ 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) { - __extends(B, _super); - function B() { + __extends(B, _super);function B() { return _super !== null && _super.apply(this, arguments) || this; } return B; diff --git a/tests/baselines/reference/abstractIdentifierNameStrict.js b/tests/baselines/reference/abstractIdentifierNameStrict.js index 92d159766d7..949159cb8b1 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.js b/tests/baselines/reference/abstractProperty.js index 5fc7f19d7c6..77848750a11 100644 --- a/tests/baselines/reference/abstractProperty.js +++ b/tests/baselines/reference/abstractProperty.js @@ -41,8 +41,7 @@ var B = /** @class */ (function () { return B; }()); var C = /** @class */ (function (_super) { - __extends(C, _super); - function C() { + __extends(C, _super);function C() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.raw = "edge"; _this.ro = "readonly please"; diff --git a/tests/baselines/reference/abstractPropertyInConstructor.js b/tests/baselines/reference/abstractPropertyInConstructor.js index ab830664d51..6d634ea9755 100644 --- a/tests/baselines/reference/abstractPropertyInConstructor.js +++ b/tests/baselines/reference/abstractPropertyInConstructor.js @@ -84,8 +84,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; @@ -99,10 +98,21 @@ var AbstractClass = /** @class */ (function () { // OK, reference is inside function var innerFunction = function () { return _this.prop; - }; + } + + ; // OK, references are to another instance other.cb(other.prop); } + + + + + + + + + AbstractClass.prototype.method2 = function () { this.prop = this.prop + "!"; }; @@ -110,12 +120,16 @@ var AbstractClass = /** @class */ (function () { }()); var DerivedAbstractClass = /** @class */ (function (_super) { __extends(DerivedAbstractClass, _super); + + function DerivedAbstractClass(str, other, yetAnother) { var _this = _super.call(this, str, other) || this; _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); @@ -125,6 +139,9 @@ var DerivedAbstractClass = /** @class */ (function (_super) { }(AbstractClass)); var Implementation = /** @class */ (function (_super) { __extends(Implementation, _super); + + + function Implementation(str, other, yetAnother) { var _this = _super.call(this, str, other, yetAnother) || this; _this.prop = ""; @@ -132,6 +149,7 @@ var Implementation = /** @class */ (function (_super) { _this.cb(_this.prop); return _this; } + Implementation.prototype.method = function (n) { this.cb(this.prop + n); }; diff --git a/tests/baselines/reference/abstractPropertyNegative.js b/tests/baselines/reference/abstractPropertyNegative.js index a26369108ab..8ef046ff642 100644 --- a/tests/baselines/reference/abstractPropertyNegative.js +++ b/tests/baselines/reference/abstractPropertyNegative.js @@ -63,8 +63,7 @@ var B = /** @class */ (function () { return B; }()); var C = /** @class */ (function (_super) { - __extends(C, _super); - function C() { + __extends(C, _super);function C() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.ro = "readonly please"; return _this; @@ -84,8 +83,7 @@ var WrongTypeProperty = /** @class */ (function () { return WrongTypeProperty; }()); var WrongTypePropertyImpl = /** @class */ (function (_super) { - __extends(WrongTypePropertyImpl, _super); - function WrongTypePropertyImpl() { + __extends(WrongTypePropertyImpl, _super);function WrongTypePropertyImpl() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.num = "nope, wrong"; return _this; @@ -98,8 +96,7 @@ var WrongTypeAccessor = /** @class */ (function () { return WrongTypeAccessor; }()); var WrongTypeAccessorImpl = /** @class */ (function (_super) { - __extends(WrongTypeAccessorImpl, _super); - function WrongTypeAccessorImpl() { + __extends(WrongTypeAccessorImpl, _super);function WrongTypeAccessorImpl() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(WrongTypeAccessorImpl.prototype, "num", { @@ -110,8 +107,7 @@ var WrongTypeAccessorImpl = /** @class */ (function (_super) { return WrongTypeAccessorImpl; }(WrongTypeAccessor)); var WrongTypeAccessorImpl2 = /** @class */ (function (_super) { - __extends(WrongTypeAccessorImpl2, _super); - function WrongTypeAccessorImpl2() { + __extends(WrongTypeAccessorImpl2, _super);function WrongTypeAccessorImpl2() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.num = "nope, wrong"; return _this; diff --git a/tests/baselines/reference/accessInstanceMemberFromStaticMethod01.js b/tests/baselines/reference/accessInstanceMemberFromStaticMethod01.js index 58999225820..b85a95b022a 100644 --- a/tests/baselines/reference/accessInstanceMemberFromStaticMethod01.js +++ b/tests/baselines/reference/accessInstanceMemberFromStaticMethod01.js @@ -10,8 +10,7 @@ class C { //// [accessInstanceMemberFromStaticMethod01.js] var C = /** @class */ (function () { function C() { - } - C.prototype.bar = function () { + }C.prototype.bar = function () { var k = foo; }; return C; diff --git a/tests/baselines/reference/accessOverriddenBaseClassMember1.js b/tests/baselines/reference/accessOverriddenBaseClassMember1.js index 6512ba01d67..7d11d0ae787 100644 --- a/tests/baselines/reference/accessOverriddenBaseClassMember1.js +++ b/tests/baselines/reference/accessOverriddenBaseClassMember1.js @@ -28,8 +28,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/accessStaticMemberFromInstanceMethod01.js b/tests/baselines/reference/accessStaticMemberFromInstanceMethod01.js index 342067c9e12..fd3398fc2e3 100644 --- a/tests/baselines/reference/accessStaticMemberFromInstanceMethod01.js +++ b/tests/baselines/reference/accessStaticMemberFromInstanceMethod01.js @@ -10,8 +10,7 @@ class C { //// [accessStaticMemberFromInstanceMethod01.js] var C = /** @class */ (function () { function C() { - } - C.bar = function () { + }C.bar = function () { var k = foo; }; return C; diff --git a/tests/baselines/reference/accessibilityModifiers.js b/tests/baselines/reference/accessibilityModifiers.js index 6adbc15f7e4..41f6237f2d3 100644 --- a/tests/baselines/reference/accessibilityModifiers.js +++ b/tests/baselines/reference/accessibilityModifiers.js @@ -48,8 +48,7 @@ class E { // No errors var C = /** @class */ (function () { function C() { - } - C.privateMethod = function () { }; + }C.privateMethod = function () { }; Object.defineProperty(C, "privateGetter", { get: function () { return 0; }, enumerable: false, @@ -87,8 +86,7 @@ var C = /** @class */ (function () { // Errors, accessibility modifiers must precede static var D = /** @class */ (function () { function D() { - } - D.privateMethod = function () { }; + }D.privateMethod = function () { }; Object.defineProperty(D, "privateGetter", { get: function () { return 0; }, enumerable: false, @@ -126,8 +124,7 @@ var D = /** @class */ (function () { // Errors, multiple accessibility modifier var E = /** @class */ (function () { function E() { - } - E.prototype.method = function () { }; + }E.prototype.method = function () { }; Object.defineProperty(E.prototype, "getter", { get: function () { return 0; }, enumerable: false, diff --git a/tests/baselines/reference/accessorWithES3.js b/tests/baselines/reference/accessorWithES3.js index 5137754c845..e9a264b775a 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 0f75d614de3..cdb4d597ab8 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 9fa2908855c..823c7b7bc35 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 c9afc192f50..f9457fa6e74 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 171fce799b9..097628aee7f 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 46c35a643d5..6947390ac73 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 8e608edae1a..7c1afd7377d 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 e16ae60363e..3a15aef291a 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 fb7cee0630b..c909c993789 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 3cd61062c86..9173a7c6019 100644 --- a/tests/baselines/reference/accessorsOverrideProperty6.js +++ b/tests/baselines/reference/accessorsOverrideProperty6.js @@ -16,8 +16,7 @@ class D extends C { //// [accessorsOverrideProperty6.js] -class A { - constructor() { +class A {constructor() { this.p = 'yep'; } } diff --git a/tests/baselines/reference/accessorsOverrideProperty7.js b/tests/baselines/reference/accessorsOverrideProperty7.js index 938bae03374..56fe628f083 100644 --- a/tests/baselines/reference/accessorsOverrideProperty7.js +++ b/tests/baselines/reference/accessorsOverrideProperty7.js @@ -20,8 +20,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() { Object.defineProperty(this, "p", { enumerable: true, @@ -33,8 +32,7 @@ var A = /** @class */ (function () { return A; }()); var B = /** @class */ (function (_super) { - __extends(B, _super); - function B() { + __extends(B, _super);function B() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(B.prototype, "p", { 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 9d0a9689e05..34ec5f3c771 100644 --- a/tests/baselines/reference/accessors_spec_section-4.5_inference.js +++ b/tests/baselines/reference/accessors_spec_section-4.5_inference.js @@ -37,15 +37,12 @@ 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) { - __extends(B, _super); - function B() { + __extends(B, _super);function B() { return _super !== null && _super.apply(this, arguments) || this; } return B; diff --git a/tests/baselines/reference/addMoreCallSignaturesToBaseSignature.js b/tests/baselines/reference/addMoreCallSignaturesToBaseSignature.js index a08a0f4ba75..ea17dbdbca7 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 73f7316dedc..cd54d07cfd1 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 3a821da7382..9b8f8886168 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 82559b521dd..be51e8d610e 100644 --- a/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js +++ b/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js @@ -43,35 +43,34 @@ var r20 = a + ((a: string) => { return a }); function foo() { } var C = /** @class */ (function () { function C() { - } - C.foo = function () { }; + }C.foo = function () { }; return C; }()); var E; (function (E) { - E[E["a"] = 0] = "a"; - E[E["b"] = 1] = "b"; - E[E["c"] = 2] = "c"; + E[E["a"] = 0] = "a";E[E["b"] = 1] = "b";E[E["c"] = 2] = "c"; })(E || (E = {})); var M; -(function (M) { -})(M || (M = {})); +(function (M) {})(M || (M = {})); var a; var b; var c; var d; var e; + // any as left operand, result is type Any except plusing string var r1 = a + a; 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 fe7a332b5ee..5cb7011782b 100644 --- a/tests/baselines/reference/additionOperatorWithInvalidOperands.js +++ b/tests/baselines/reference/additionOperatorWithInvalidOperands.js @@ -44,35 +44,35 @@ var r20 = E.a + M; function foo() { } var C = /** @class */ (function () { function C() { - } - C.foo = function () { }; + }C.foo = function () { }; return C; }()); var E; (function (E) { - E[E["a"] = 0] = "a"; - E[E["b"] = 1] = "b"; - E[E["c"] = 2] = "c"; + E[E["a"] = 0] = "a";E[E["b"] = 1] = "b";E[E["c"] = 2] = "c"; })(E || (E = {})); var M; -(function (M) { -})(M || (M = {})); +(function (M) {})(M || (M = {})); var a; var b; var c; var d; + // boolean + every type except any and string 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 79d3c0b9b8d..c0962ce1f75 100644 --- a/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js +++ b/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js @@ -25,11 +25,14 @@ 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; var d; + // null + boolean/Object var r1 = null + a; var r2 = null + b; @@ -37,6 +40,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 1b5cb877d21..5d395836a31 100644 --- a/tests/baselines/reference/additionOperatorWithNullValueAndValidOperator.js +++ b/tests/baselines/reference/additionOperatorWithNullValueAndValidOperator.js @@ -34,17 +34,17 @@ var r16 = '' + null; // If one operand is the null or undefined value, it is treated as having the type of the other operand. var E; (function (E) { - E[E["a"] = 0] = "a"; - E[E["b"] = 1] = "b"; - E[E["c"] = 2] = "c"; + E[E["a"] = 0] = "a";E[E["b"] = 1] = "b";E[E["c"] = 2] = "c"; })(E || (E = {})); var a; var b; var c; var d; + // null + any var r1 = null + a; var r2 = a + null; + // null + number/enum var r3 = null + b; var r4 = null + 1; @@ -56,6 +56,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 d559e98dc3e..8aed29f5ad1 100644 --- a/tests/baselines/reference/additionOperatorWithNumberAndEnum.js +++ b/tests/baselines/reference/additionOperatorWithNumberAndEnum.js @@ -27,26 +27,27 @@ var r14 = c + c; //// [additionOperatorWithNumberAndEnum.js] var E; (function (E) { - E[E["a"] = 0] = "a"; - E[E["b"] = 1] = "b"; + E[E["a"] = 0] = "a";E[E["b"] = 1] = "b"; })(E || (E = {})); var F; (function (F) { - F[F["c"] = 0] = "c"; - F[F["d"] = 1] = "d"; + F[F["c"] = 0] = "c";F[F["d"] = 1] = "d"; })(F || (F = {})); var a; var b; var c; + 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 03456020c80..513488b5163 100644 --- a/tests/baselines/reference/additionOperatorWithStringAndEveryType.js +++ b/tests/baselines/reference/additionOperatorWithStringAndEveryType.js @@ -41,9 +41,7 @@ var r20 = x + []; //// [additionOperatorWithStringAndEveryType.js] var E; (function (E) { - E[E["a"] = 0] = "a"; - E[E["b"] = 1] = "b"; - E[E["c"] = 2] = "c"; + E[E["a"] = 0] = "a";E[E["b"] = 1] = "b";E[E["c"] = 2] = "c"; })(E || (E = {})); var a; var b; @@ -52,7 +50,9 @@ 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 var r1 = x + a; @@ -62,6 +62,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 +71,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 a568f420a32..6b674eb63e2 100644 --- a/tests/baselines/reference/additionOperatorWithTypeParameter.js +++ b/tests/baselines/reference/additionOperatorWithTypeParameter.js @@ -42,8 +42,7 @@ function foo(t: T, u: U) { // type parameter type is not a valid operand of addition operator var E; (function (E) { - E[E["a"] = 0] = "a"; - E[E["b"] = 1] = "b"; + E[E["a"] = 0] = "a";E[E["b"] = 1] = "b"; })(E || (E = {})); function foo(t, u) { var a; @@ -53,6 +52,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 +61,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 +70,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 98935db2b86..d8c8329c5c2 100644 --- a/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js +++ b/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js @@ -25,11 +25,14 @@ 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; var d; + // undefined + boolean/Object var r1 = undefined + a; var r2 = undefined + b; @@ -37,6 +40,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 68804694449..be8e0917560 100644 --- a/tests/baselines/reference/additionOperatorWithUndefinedValueAndValidOperator.js +++ b/tests/baselines/reference/additionOperatorWithUndefinedValueAndValidOperator.js @@ -34,17 +34,17 @@ var r16 = '' + undefined; // If one operand is the null or undefined value, it is treated as having the type of the other operand. var E; (function (E) { - E[E["a"] = 0] = "a"; - E[E["b"] = 1] = "b"; - E[E["c"] = 2] = "c"; + E[E["a"] = 0] = "a";E[E["b"] = 1] = "b";E[E["c"] = 2] = "c"; })(E || (E = {})); var a; var b; var c; var d; + // undefined + any var r1 = undefined + a; var r2 = a + undefined; + // undefined + number/enum var r3 = undefined + b; var r4 = undefined + 1; @@ -56,6 +56,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/aliasAssignments.js b/tests/baselines/reference/aliasAssignments.js index 7fd14bc8a4b..8c37ae81da8 100644 --- a/tests/baselines/reference/aliasAssignments.js +++ b/tests/baselines/reference/aliasAssignments.js @@ -21,8 +21,7 @@ var someClass = /** @class */ (function () { function someClass() { } return someClass; -}()); -exports.someClass = someClass; +}());exports.someClass = someClass; //// [aliasAssignments_1.js] "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/aliasBug.js b/tests/baselines/reference/aliasBug.js index 502bc9e11a7..17584b55522 100644 --- a/tests/baselines/reference/aliasBug.js +++ b/tests/baselines/reference/aliasBug.js @@ -31,10 +31,8 @@ var foo; var bar; (function (bar) { var baz; - (function (baz) { - var boo = /** @class */ (function () { - function boo() { - } + (function (baz) {var boo = /** @class */ (function () { + function boo() {} return boo; }()); baz.boo = boo; @@ -43,7 +41,9 @@ var foo; })(foo || (foo = {})); var provide = foo; var booz = foo.bar.baz; + var p = new provide.Provide(); + function use() { var p1; // error here, but should be okay var p2; diff --git a/tests/baselines/reference/aliasErrors.js b/tests/baselines/reference/aliasErrors.js index 54edb24fff3..2565cc07eb6 100644 --- a/tests/baselines/reference/aliasErrors.js +++ b/tests/baselines/reference/aliasErrors.js @@ -42,10 +42,8 @@ var foo; var bar; (function (bar) { var baz; - (function (baz) { - var boo = /** @class */ (function () { - function boo() { - } + (function (baz) {var boo = /** @class */ (function () { + function boo() {} return boo; }()); baz.boo = boo; @@ -55,13 +53,17 @@ var foo; var provide = foo; var booz = foo.bar.baz; var beez = foo.bar; + var m = no; var m2 = no.mod; 5; "s"; null; var r = undefined; + + var p = new provide.Provide(); + function use() { beez.baz.boo; var p1; @@ -69,3 +71,4 @@ function use() { var p3; var p22 = new provide.Provide(); } + diff --git a/tests/baselines/reference/aliasOfGenericFunctionWithRestBehavedSameAsUnaliased.js b/tests/baselines/reference/aliasOfGenericFunctionWithRestBehavedSameAsUnaliased.js index 567b75e8502..9fbad672a51 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/aliasUsageInAccessorsOfClass.js b/tests/baselines/reference/aliasUsageInAccessorsOfClass.js index 8f9b50367df..c1504f3c821 100644 --- a/tests/baselines/reference/aliasUsageInAccessorsOfClass.js +++ b/tests/baselines/reference/aliasUsageInAccessorsOfClass.js @@ -35,8 +35,7 @@ var Model = /** @class */ (function () { function Model() { } return Model; -}()); -exports.Model = Model; +}());exports.Model = Model; //// [aliasUsage1_moduleA.js] "use strict"; var __extends = (this && this.__extends) || (function () { @@ -56,13 +55,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.VisualizationModel = void 0; var Backbone = require("./aliasUsage1_backbone"); var VisualizationModel = /** @class */ (function (_super) { - __extends(VisualizationModel, _super); - function VisualizationModel() { + __extends(VisualizationModel, _super);function VisualizationModel() { return _super !== null && _super.apply(this, arguments) || this; } return VisualizationModel; -}(Backbone.Model)); -exports.VisualizationModel = VisualizationModel; +}(Backbone.Model));exports.VisualizationModel = VisualizationModel; //// [aliasUsage1_main.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/tests/baselines/reference/aliasUsageInArray.js b/tests/baselines/reference/aliasUsageInArray.js index 5c695af5101..99c4fc6ec68 100644 --- a/tests/baselines/reference/aliasUsageInArray.js +++ b/tests/baselines/reference/aliasUsageInArray.js @@ -29,8 +29,7 @@ var Model = /** @class */ (function () { function Model() { } return Model; -}()); -exports.Model = Model; +}());exports.Model = Model; //// [aliasUsageInArray_moduleA.js] "use strict"; var __extends = (this && this.__extends) || (function () { @@ -50,16 +49,15 @@ exports.__esModule = true; exports.VisualizationModel = void 0; var Backbone = require("./aliasUsageInArray_backbone"); var VisualizationModel = /** @class */ (function (_super) { - __extends(VisualizationModel, _super); - function VisualizationModel() { + __extends(VisualizationModel, _super);function VisualizationModel() { return _super !== null && _super.apply(this, arguments) || this; } return VisualizationModel; -}(Backbone.Model)); -exports.VisualizationModel = VisualizationModel; +}(Backbone.Model));exports.VisualizationModel = VisualizationModel; //// [aliasUsageInArray_main.js] "use strict"; exports.__esModule = true; var moduleA = require("./aliasUsageInArray_moduleA"); + var xs = [moduleA]; var xs2 = [moduleA]; diff --git a/tests/baselines/reference/aliasUsageInFunctionExpression.js b/tests/baselines/reference/aliasUsageInFunctionExpression.js index d47b38d7122..b396366d26c 100644 --- a/tests/baselines/reference/aliasUsageInFunctionExpression.js +++ b/tests/baselines/reference/aliasUsageInFunctionExpression.js @@ -28,8 +28,7 @@ var Model = /** @class */ (function () { function Model() { } return Model; -}()); -exports.Model = Model; +}());exports.Model = Model; //// [aliasUsageInFunctionExpression_moduleA.js] "use strict"; var __extends = (this && this.__extends) || (function () { @@ -49,13 +48,11 @@ exports.__esModule = true; exports.VisualizationModel = void 0; var Backbone = require("./aliasUsageInFunctionExpression_backbone"); var VisualizationModel = /** @class */ (function (_super) { - __extends(VisualizationModel, _super); - function VisualizationModel() { + __extends(VisualizationModel, _super);function VisualizationModel() { return _super !== null && _super.apply(this, arguments) || this; } return VisualizationModel; -}(Backbone.Model)); -exports.VisualizationModel = VisualizationModel; +}(Backbone.Model));exports.VisualizationModel = VisualizationModel; //// [aliasUsageInFunctionExpression_main.js] "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/aliasUsageInGenericFunction.js b/tests/baselines/reference/aliasUsageInGenericFunction.js index 27e4106b46e..b255f93efb0 100644 --- a/tests/baselines/reference/aliasUsageInGenericFunction.js +++ b/tests/baselines/reference/aliasUsageInGenericFunction.js @@ -32,8 +32,7 @@ var Model = /** @class */ (function () { function Model() { } return Model; -}()); -exports.Model = Model; +}());exports.Model = Model; //// [aliasUsageInGenericFunction_moduleA.js] "use strict"; var __extends = (this && this.__extends) || (function () { @@ -53,13 +52,11 @@ exports.__esModule = true; exports.VisualizationModel = void 0; var Backbone = require("./aliasUsageInGenericFunction_backbone"); var VisualizationModel = /** @class */ (function (_super) { - __extends(VisualizationModel, _super); - function VisualizationModel() { + __extends(VisualizationModel, _super);function VisualizationModel() { return _super !== null && _super.apply(this, arguments) || this; } return VisualizationModel; -}(Backbone.Model)); -exports.VisualizationModel = VisualizationModel; +}(Backbone.Model));exports.VisualizationModel = VisualizationModel; //// [aliasUsageInGenericFunction_main.js] "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/aliasUsageInIndexerOfClass.js b/tests/baselines/reference/aliasUsageInIndexerOfClass.js index 847bc0fcb0a..034d8b7f768 100644 --- a/tests/baselines/reference/aliasUsageInIndexerOfClass.js +++ b/tests/baselines/reference/aliasUsageInIndexerOfClass.js @@ -34,8 +34,7 @@ var Model = /** @class */ (function () { function Model() { } return Model; -}()); -exports.Model = Model; +}());exports.Model = Model; //// [aliasUsageInIndexerOfClass_moduleA.js] "use strict"; var __extends = (this && this.__extends) || (function () { @@ -55,13 +54,11 @@ exports.__esModule = true; exports.VisualizationModel = void 0; var Backbone = require("./aliasUsageInIndexerOfClass_backbone"); var VisualizationModel = /** @class */ (function (_super) { - __extends(VisualizationModel, _super); - function VisualizationModel() { + __extends(VisualizationModel, _super);function VisualizationModel() { return _super !== null && _super.apply(this, arguments) || this; } return VisualizationModel; -}(Backbone.Model)); -exports.VisualizationModel = VisualizationModel; +}(Backbone.Model));exports.VisualizationModel = VisualizationModel; //// [aliasUsageInIndexerOfClass_main.js] "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/aliasUsageInObjectLiteral.js b/tests/baselines/reference/aliasUsageInObjectLiteral.js index b2a06fc061a..cb66e65564f 100644 --- a/tests/baselines/reference/aliasUsageInObjectLiteral.js +++ b/tests/baselines/reference/aliasUsageInObjectLiteral.js @@ -29,8 +29,7 @@ var Model = /** @class */ (function () { function Model() { } return Model; -}()); -exports.Model = Model; +}());exports.Model = Model; //// [aliasUsageInObjectLiteral_moduleA.js] "use strict"; var __extends = (this && this.__extends) || (function () { @@ -50,13 +49,11 @@ exports.__esModule = true; exports.VisualizationModel = void 0; var Backbone = require("./aliasUsageInObjectLiteral_backbone"); var VisualizationModel = /** @class */ (function (_super) { - __extends(VisualizationModel, _super); - function VisualizationModel() { + __extends(VisualizationModel, _super);function VisualizationModel() { return _super !== null && _super.apply(this, arguments) || this; } return VisualizationModel; -}(Backbone.Model)); -exports.VisualizationModel = VisualizationModel; +}(Backbone.Model));exports.VisualizationModel = VisualizationModel; //// [aliasUsageInObjectLiteral_main.js] "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/aliasUsageInOrExpression.js b/tests/baselines/reference/aliasUsageInOrExpression.js index d65977dd09e..1c27ac425cb 100644 --- a/tests/baselines/reference/aliasUsageInOrExpression.js +++ b/tests/baselines/reference/aliasUsageInOrExpression.js @@ -32,8 +32,7 @@ var Model = /** @class */ (function () { function Model() { } return Model; -}()); -exports.Model = Model; +}());exports.Model = Model; //// [aliasUsageInOrExpression_moduleA.js] "use strict"; var __extends = (this && this.__extends) || (function () { @@ -53,13 +52,11 @@ exports.__esModule = true; exports.VisualizationModel = void 0; var Backbone = require("./aliasUsageInOrExpression_backbone"); var VisualizationModel = /** @class */ (function (_super) { - __extends(VisualizationModel, _super); - function VisualizationModel() { + __extends(VisualizationModel, _super);function VisualizationModel() { return _super !== null && _super.apply(this, arguments) || this; } return VisualizationModel; -}(Backbone.Model)); -exports.VisualizationModel = VisualizationModel; +}(Backbone.Model));exports.VisualizationModel = VisualizationModel; //// [aliasUsageInOrExpression_main.js] "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js index fa5fa26384d..2cfcccb5050 100644 --- a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js +++ b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js @@ -32,8 +32,7 @@ var Model = /** @class */ (function () { function Model() { } return Model; -}()); -exports.Model = Model; +}());exports.Model = Model; //// [aliasUsageInTypeArgumentOfExtendsClause_moduleA.js] "use strict"; var __extends = (this && this.__extends) || (function () { @@ -53,13 +52,11 @@ exports.__esModule = true; exports.VisualizationModel = void 0; var Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone"); var VisualizationModel = /** @class */ (function (_super) { - __extends(VisualizationModel, _super); - function VisualizationModel() { + __extends(VisualizationModel, _super);function VisualizationModel() { return _super !== null && _super.apply(this, arguments) || this; } return VisualizationModel; -}(Backbone.Model)); -exports.VisualizationModel = VisualizationModel; +}(Backbone.Model));exports.VisualizationModel = VisualizationModel; //// [aliasUsageInTypeArgumentOfExtendsClause_main.js] "use strict"; var __extends = (this && this.__extends) || (function () { @@ -83,8 +80,7 @@ var C = /** @class */ (function () { return C; }()); var D = /** @class */ (function (_super) { - __extends(D, _super); - function D() { + __extends(D, _super);function D() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.x = moduleA; return _this; diff --git a/tests/baselines/reference/aliasUsageInVarAssignment.js b/tests/baselines/reference/aliasUsageInVarAssignment.js index 2d570d3cccc..d835ed8c8e5 100644 --- a/tests/baselines/reference/aliasUsageInVarAssignment.js +++ b/tests/baselines/reference/aliasUsageInVarAssignment.js @@ -28,8 +28,7 @@ var Model = /** @class */ (function () { function Model() { } return Model; -}()); -exports.Model = Model; +}());exports.Model = Model; //// [aliasUsageInVarAssignment_moduleA.js] "use strict"; var __extends = (this && this.__extends) || (function () { @@ -49,13 +48,11 @@ exports.__esModule = true; exports.VisualizationModel = void 0; var Backbone = require("./aliasUsageInVarAssignment_backbone"); var VisualizationModel = /** @class */ (function (_super) { - __extends(VisualizationModel, _super); - function VisualizationModel() { + __extends(VisualizationModel, _super);function VisualizationModel() { return _super !== null && _super.apply(this, arguments) || this; } return VisualizationModel; -}(Backbone.Model)); -exports.VisualizationModel = VisualizationModel; +}(Backbone.Model));exports.VisualizationModel = VisualizationModel; //// [aliasUsageInVarAssignment_main.js] "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/aliasUsedAsNameValue.js b/tests/baselines/reference/aliasUsedAsNameValue.js index 84489f6eff3..76d4a0c35e9 100644 --- a/tests/baselines/reference/aliasUsedAsNameValue.js +++ b/tests/baselines/reference/aliasUsedAsNameValue.js @@ -26,8 +26,7 @@ exports.id = void 0; "use strict"; exports.__esModule = true; exports.b = void 0; -function b(a) { return null; } -exports.b = b; +function b(a) { return null; }exports.b = b; //// [aliasUsedAsNameValue_2.js] "use strict"; exports.__esModule = true; @@ -36,6 +35,7 @@ exports.a = void 0; /// var mod = require("./aliasUsedAsNameValue_0"); var b = require("./aliasUsedAsNameValue_1"); + exports.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 468ff805b2d..3f4b3421821 100644 --- a/tests/baselines/reference/aliasesInSystemModule1.js +++ b/tests/baselines/reference/aliasesInSystemModule1.js @@ -29,9 +29,11 @@ System.register(["foo"], function (exports_1, context_1) { execute: function () { cls = alias.Class; exports_1("cls2", cls2 = alias.Class); + x = new alias.Class(); y = new cls(); z = new cls2(); + (function (M) { M.cls = alias.Class; var x = new alias.Class(); diff --git a/tests/baselines/reference/aliasesInSystemModule2.js b/tests/baselines/reference/aliasesInSystemModule2.js index af7208d5c99..cf45456b8a0 100644 --- a/tests/baselines/reference/aliasesInSystemModule2.js +++ b/tests/baselines/reference/aliasesInSystemModule2.js @@ -28,9 +28,11 @@ System.register(["foo"], function (exports_1, context_1) { execute: function () { cls = foo_1.alias.Class; exports_1("cls2", cls2 = foo_1.alias.Class); + x = new foo_1.alias.Class(); y = new cls(); z = new cls2(); + (function (M) { M.cls = foo_1.alias.Class; var x = new foo_1.alias.Class(); diff --git a/tests/baselines/reference/allowImportClausesToMergeWithTypes.js b/tests/baselines/reference/allowImportClausesToMergeWithTypes.js index 9c50acdfb1a..4beb0a6cd1b 100644 --- a/tests/baselines/reference/allowImportClausesToMergeWithTypes.js +++ b/tests/baselines/reference/allowImportClausesToMergeWithTypes.js @@ -37,9 +37,13 @@ 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: "" }; + + + + +exports["default"] = b_1["default"];var x = { x: "" }; b_1["default"]; //// [index.js] "use strict"; diff --git a/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.js b/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.js index 43fdb9f639a..6d71d3520d1 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/ambient.js b/tests/baselines/reference/ambient.js index 6d4190bf34c..cb7062ea105 100644 --- a/tests/baselines/reference/ambient.js +++ b/tests/baselines/reference/ambient.js @@ -16,11 +16,9 @@ declare namespace ns { exports.__esModule = true; exports.A = void 0; var A = /** @class */ (function () { - function A() { - } + function A() {} return A; -}()); -exports.A = A; +}());exports.A = A; //// [b.js] "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/ambientClassDeclarationWithExtends.js b/tests/baselines/reference/ambientClassDeclarationWithExtends.js index 1b7bcf88b20..fab3941d1cc 100644 --- a/tests/baselines/reference/ambientClassDeclarationWithExtends.js +++ b/tests/baselines/reference/ambientClassDeclarationWithExtends.js @@ -24,15 +24,13 @@ var f: E = new F(); //// [ambientClassDeclarationExtends_singleFile.js] + var D; -(function (D) { - var x; -})(D || (D = {})); +(function (D) {var x;})(D || (D = {})); + var d = new D(); //// [ambientClassDeclarationExtends_file1.js] var F; -(function (F) { - var y; -})(F || (F = {})); +(function (F) {var y;})(F || (F = {})); //// [ambientClassDeclarationExtends_file2.js] var f = new F(); diff --git a/tests/baselines/reference/ambientConstLiterals.js b/tests/baselines/reference/ambientConstLiterals.js index c5c0fbaafbc..25bd492e2dd 100644 --- a/tests/baselines/reference/ambientConstLiterals.js +++ b/tests/baselines/reference/ambientConstLiterals.js @@ -27,10 +27,7 @@ function f(x) { } var E; (function (E) { - E[E["A"] = 0] = "A"; - E[E["B"] = 1] = "B"; - E[E["C"] = 2] = "C"; - E[E["non identifier"] = 3] = "non identifier"; + E[E["A"] = 0] = "A";E[E["B"] = 1] = "B";E[E["C"] = 2] = "C";E[E["non identifier"] = 3] = "non identifier"; })(E || (E = {})); var c1 = "abc"; var c2 = 123; diff --git a/tests/baselines/reference/ambientDeclarations.js b/tests/baselines/reference/ambientDeclarations.js index 729ecf7d45e..671e553ebee 100644 --- a/tests/baselines/reference/ambientDeclarations.js +++ b/tests/baselines/reference/ambientDeclarations.js @@ -77,7 +77,20 @@ 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 ed413fb0d8e..eac515ebb70 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 56abd8298cd..b947d0f6b7a 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 65726bba722..8f1ee0800c4 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 763f0e94bdb..a03c4a7d785 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 8a477ab99fa..b768b25faf8 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 dcdb100e906..d6d4e5aa3e3 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 8ef6facfe6d..4796b275013 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 c524a6cfe72..80d346399e6 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 d6db77b6050..a14e27c383b 100644 --- a/tests/baselines/reference/ambientExternalModuleInAnotherExternalModule.js +++ b/tests/baselines/reference/ambientExternalModuleInAnotherExternalModule.js @@ -14,10 +14,11 @@ var x = ext; define(["require", "exports", "ext"], function (require, exports, ext) { "use strict"; var D = /** @class */ (function () { - function D() { - } + function D() {} return D; }()); - var x = ext; - return D; + + + + var x = ext;return D; }); diff --git a/tests/baselines/reference/ambientExternalModuleMerging.js b/tests/baselines/reference/ambientExternalModuleMerging.js index 6c2de62c90a..bec7ab9e4fc 100644 --- a/tests/baselines/reference/ambientExternalModuleMerging.js +++ b/tests/baselines/reference/ambientExternalModuleMerging.js @@ -25,3 +25,4 @@ define(["require", "exports", "M"], function (require, exports, M) { var y = M.y; }); //// [ambientExternalModuleMerging_declare.js] + diff --git a/tests/baselines/reference/ambientExternalModuleWithRelativeModuleName.js b/tests/baselines/reference/ambientExternalModuleWithRelativeModuleName.js index 9a4622a1b7e..c00140e9315 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/ambientGetters.js b/tests/baselines/reference/ambientGetters.js index db2310646af..ef8fe50b95c 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/ambientModuleExports.js b/tests/baselines/reference/ambientModuleExports.js index 59c608a7174..ca3c49988fc 100644 --- a/tests/baselines/reference/ambientModuleExports.js +++ b/tests/baselines/reference/ambientModuleExports.js @@ -23,6 +23,7 @@ var c2 = new Foo2.C(); Foo.a(); Foo.b; var c = new Foo.C(); + Foo2.a(); Foo2.b; var c2 = new Foo2.C(); diff --git a/tests/baselines/reference/ambientRequireFunction.js b/tests/baselines/reference/ambientRequireFunction.js index 348ee0a1443..81a28cebc47 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/ambientShorthand_reExport.js b/tests/baselines/reference/ambientShorthand_reExport.js index a9fef57c1c6..c3f608f7373 100644 --- a/tests/baselines/reference/ambientShorthand_reExport.js +++ b/tests/baselines/reference/ambientShorthand_reExport.js @@ -26,8 +26,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi o[k2] = m[k]; })); exports.__esModule = true; -var jquery_1 = require("jquery"); -__createBinding(exports, jquery_1, "x"); +var jquery_1 = require("jquery");__createBinding(exports, jquery_1, "x"); //// [reExportAll.js] "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { diff --git a/tests/baselines/reference/ambiguousCallsWhereReturnTypesAgree.js b/tests/baselines/reference/ambiguousCallsWhereReturnTypesAgree.js index 6937384136d..e12651e6f05 100644 --- a/tests/baselines/reference/ambiguousCallsWhereReturnTypesAgree.js +++ b/tests/baselines/reference/ambiguousCallsWhereReturnTypesAgree.js @@ -31,9 +31,11 @@ class TestClass2 { //// [ambiguousCallsWhereReturnTypesAgree.js] var TestClass = /** @class */ (function () { function TestClass() { - } - TestClass.prototype.bar = function (x) { + }TestClass.prototype.bar = function (x) { }; + + + TestClass.prototype.foo = function (x) { this.bar(x); // should not error }; @@ -41,10 +43,12 @@ var TestClass = /** @class */ (function () { }()); var TestClass2 = /** @class */ (function () { function TestClass2() { - } - TestClass2.prototype.bar = function (x) { + }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/ambiguousOverload.js b/tests/baselines/reference/ambiguousOverload.js index 642f09dca16..cfbe62e7c2c 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 56bef268fb4..4c1041a6361 100644 --- a/tests/baselines/reference/ambiguousOverloadResolution.js +++ b/tests/baselines/reference/ambiguousOverloadResolution.js @@ -21,18 +21,16 @@ 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) { - __extends(B, _super); - function B() { + __extends(B, _super);function B() { return _super !== null && _super.apply(this, arguments) || this; } 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 f8f25a4e1aa..a9a75ee1e66 100644 --- a/tests/baselines/reference/amdDeclarationEmitNoExtraDeclare.js +++ b/tests/baselines/reference/amdDeclarationEmitNoExtraDeclare.js @@ -42,8 +42,8 @@ define("Configurable", ["require", "exports"], function (require, exports) { 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]; } @@ -51,27 +51,22 @@ define("Configurable", ["require", "exports"], function (require, exports) { } return class_1; }(base)); - } - exports.Configurable = Configurable; + }exports.Configurable = Configurable; }); define("Class", ["require", "exports", "Configurable"], function (require, exports, Configurable_1) { "use strict"; exports.__esModule = true; exports.ActualClass = exports.HiddenClass = void 0; var HiddenClass = /** @class */ (function () { - function HiddenClass() { - } + function HiddenClass() {} return HiddenClass; - }()); - exports.HiddenClass = HiddenClass; + }());exports.HiddenClass = HiddenClass; var ActualClass = /** @class */ (function (_super) { - __extends(ActualClass, _super); - function ActualClass() { + __extends(ActualClass, _super);function ActualClass() { return _super !== null && _super.apply(this, arguments) || this; } return ActualClass; - }(Configurable_1.Configurable(HiddenClass))); - exports.ActualClass = ActualClass; + }(Configurable_1.Configurable(HiddenClass)));exports.ActualClass = ActualClass; }); diff --git a/tests/baselines/reference/amdDependencyCommentName4.js b/tests/baselines/reference/amdDependencyCommentName4.js index 6542aa14fa2..741d006c191 100644 --- a/tests/baselines/reference/amdDependencyCommentName4.js +++ b/tests/baselines/reference/amdDependencyCommentName4.js @@ -29,7 +29,13 @@ define(["require", "exports", "aliasedModule5", "aliasedModule6", "aliasedModule "use strict"; exports.__esModule = true; r1; + + aliasedModule2_1.p1; + + aliasedModule3_1["default"]; + + ns; }); diff --git a/tests/baselines/reference/amdImportAsPrimaryExpression.js b/tests/baselines/reference/amdImportAsPrimaryExpression.js index e056952ca4d..d5a189f4c68 100644 --- a/tests/baselines/reference/amdImportAsPrimaryExpression.js +++ b/tests/baselines/reference/amdImportAsPrimaryExpression.js @@ -19,9 +19,7 @@ define(["require", "exports"], function (require, exports) { exports.E1 = void 0; var E1; (function (E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; - E1[E1["C"] = 2] = "C"; + E1[E1["A"] = 0] = "A";E1[E1["B"] = 1] = "B";E1[E1["C"] = 2] = "C"; })(E1 = exports.E1 || (exports.E1 = {})); }); //// [foo_1.js] diff --git a/tests/baselines/reference/amdImportNotAsPrimaryExpression.js b/tests/baselines/reference/amdImportNotAsPrimaryExpression.js index 6020113e64b..ef84bb45a1b 100644 --- a/tests/baselines/reference/amdImportNotAsPrimaryExpression.js +++ b/tests/baselines/reference/amdImportNotAsPrimaryExpression.js @@ -44,11 +44,10 @@ define(["require", "exports"], function (require, exports) { return C1; }()); exports.C1 = C1; + var E1; (function (E1) { - E1[E1["A"] = 0] = "A"; - E1[E1["B"] = 1] = "B"; - E1[E1["C"] = 2] = "C"; + E1[E1["A"] = 0] = "A";E1[E1["B"] = 1] = "B";E1[E1["C"] = 2] = "C"; })(E1 = exports.E1 || (exports.E1 = {})); }); //// [foo_1.js] diff --git a/tests/baselines/reference/amdModuleBundleNoDuplicateDeclarationEmitComments.js b/tests/baselines/reference/amdModuleBundleNoDuplicateDeclarationEmitComments.js index ab9cd979407..3c643a322cc 100644 --- a/tests/baselines/reference/amdModuleBundleNoDuplicateDeclarationEmitComments.js +++ b/tests/baselines/reference/amdModuleBundleNoDuplicateDeclarationEmitComments.js @@ -14,11 +14,9 @@ define("mynamespace::SomeModuleA", ["require", "exports"], function (require, ex exports.Foo = void 0; /// var Foo = /** @class */ (function () { - function Foo() { - } + function Foo() {} return Foo; - }()); - exports.Foo = Foo; + }());exports.Foo = Foo; }); define("mynamespace::SomeModuleB", ["require", "exports"], function (require, exports) { "use strict"; @@ -26,11 +24,9 @@ define("mynamespace::SomeModuleB", ["require", "exports"], function (require, ex exports.Bar = void 0; /// var Bar = /** @class */ (function () { - function Bar() { - } + function Bar() {} return Bar; - }()); - exports.Bar = Bar; + }());exports.Bar = Bar; }); diff --git a/tests/baselines/reference/amdModuleConstEnumUsage.js b/tests/baselines/reference/amdModuleConstEnumUsage.js index 76670fe871f..3619e000aa3 100644 --- a/tests/baselines/reference/amdModuleConstEnumUsage.js +++ b/tests/baselines/reference/amdModuleConstEnumUsage.js @@ -32,11 +32,9 @@ define(["require", "exports"], function (require, exports) { exports.User = void 0; var User = /** @class */ (function () { function User() { - } - User.prototype.method = function (input) { + }User.prototype.method = function (input) { if (0 /* A */ === input) { } }; return User; - }()); - exports.User = User; + }());exports.User = User; }); diff --git a/tests/baselines/reference/anonClassDeclarationEmitIsAnon.js b/tests/baselines/reference/anonClassDeclarationEmitIsAnon.js index 50090286ffa..a8778040313 100644 --- a/tests/baselines/reference/anonClassDeclarationEmitIsAnon.js +++ b/tests/baselines/reference/anonClassDeclarationEmitIsAnon.js @@ -54,26 +54,25 @@ exports.Timestamped = exports.wrapClass = void 0; function wrapClass(param) { return /** @class */ (function () { function Wrapped() { - } - Wrapped.prototype.foo = function () { + }Wrapped.prototype.foo = function () { return param; }; return Wrapped; }()); -} -exports.wrapClass = wrapClass; +}exports.wrapClass = wrapClass; + + + function Timestamped(Base) { return /** @class */ (function (_super) { - __extends(class_1, _super); - function class_1() { + __extends(class_1, _super);function class_1() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.timestamp = Date.now(); return _this; } return class_1; }(Base)); -} -exports.Timestamped = Timestamped; +}exports.Timestamped = Timestamped; //// [index.js] "use strict"; var __extends = (this && this.__extends) || (function () { @@ -92,15 +91,16 @@ var __extends = (this && this.__extends) || (function () { exports.__esModule = true; exports.TimestampedUser = exports.User = void 0; var wrapClass_1 = require("./wrapClass"); + exports["default"] = wrapClass_1.wrapClass(0); + // Simple class var User = /** @class */ (function () { function User() { this.name = ''; } return User; -}()); -exports.User = User; +}());exports.User = User; // User that is Timestamped var TimestampedUser = /** @class */ (function (_super) { __extends(TimestampedUser, _super); @@ -108,8 +108,7 @@ var TimestampedUser = /** @class */ (function (_super) { return _super.call(this) || this; } return TimestampedUser; -}(wrapClass_1.Timestamped(User))); -exports.TimestampedUser = TimestampedUser; +}(wrapClass_1.Timestamped(User)));exports.TimestampedUser = TimestampedUser; //// [wrapClass.d.ts] diff --git a/tests/baselines/reference/anonterface.js b/tests/baselines/reference/anonterface.js index 3c4e04cd23c..c5d33f33dc6 100644 --- a/tests/baselines/reference/anonterface.js +++ b/tests/baselines/reference/anonterface.js @@ -19,8 +19,7 @@ var M; (function (M) { var C = /** @class */ (function () { function C() { - } - C.prototype.m = function (fn, n2) { + }C.prototype.m = function (fn, n2) { return fn(n2); }; return C; diff --git a/tests/baselines/reference/anonymousClassDeclarationDoesntPrintWithReadonly.js b/tests/baselines/reference/anonymousClassDeclarationDoesntPrintWithReadonly.js index 606f33724d0..ec42a41c923 100644 --- a/tests/baselines/reference/anonymousClassDeclarationDoesntPrintWithReadonly.js +++ b/tests/baselines/reference/anonymousClassDeclarationDoesntPrintWithReadonly.js @@ -29,18 +29,15 @@ var X = /** @class */ (function () { this.a = a; } return X; -}()); -exports.X = X; +}());exports.X = X; function y() { return /** @class */ (function (_super) { - __extends(class_1, _super); - function class_1() { + __extends(class_1, _super);function class_1() { return _super !== null && _super.apply(this, arguments) || this; } return class_1; }(X)); -} -exports.y = y; +}exports.y = y; //// [anonymousClassDeclarationDoesntPrintWithReadonly.d.ts] diff --git a/tests/baselines/reference/anonymousClassExpression1.js b/tests/baselines/reference/anonymousClassExpression1.js index 7223b816b90..9ef4aa5bfa4 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/anonymousClassExpression2.js b/tests/baselines/reference/anonymousClassExpression2.js index 275ce0bd527..4142659ee2f 100644 --- a/tests/baselines/reference/anonymousClassExpression2.js +++ b/tests/baselines/reference/anonymousClassExpression2.js @@ -25,16 +25,14 @@ while (0) { while (0) { var A = /** @class */ (function () { function A() { - } - A.prototype.methodA = function () { + }A.prototype.methodA = function () { this; //note: a this reference of some kind is required to trigger the bug }; return A; }()); var B = /** @class */ (function () { function B() { - } - B.prototype.methodB = function () { + }B.prototype.methodB = function () { this.methodA; // error this.methodB; // ok }; diff --git a/tests/baselines/reference/anonymousDefaultExportsAmd.js b/tests/baselines/reference/anonymousDefaultExportsAmd.js index 24e833b7542..cee806d79d4 100644 --- a/tests/baselines/reference/anonymousDefaultExportsAmd.js +++ b/tests/baselines/reference/anonymousDefaultExportsAmd.js @@ -10,14 +10,11 @@ export default function() {} define(["require", "exports"], function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); - class default_1 { - } - exports.default = default_1; + class default_1 {}exports.default = default_1; }); //// [b.js] define(["require", "exports"], function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); - function default_1() { } - exports.default = default_1; + function default_1() { }exports.default = default_1; }); diff --git a/tests/baselines/reference/anonymousDefaultExportsCommonjs.js b/tests/baselines/reference/anonymousDefaultExportsCommonjs.js index e22000856d6..7065c48c0b0 100644 --- a/tests/baselines/reference/anonymousDefaultExportsCommonjs.js +++ b/tests/baselines/reference/anonymousDefaultExportsCommonjs.js @@ -9,11 +9,8 @@ export default function() {} //// [a.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -class default_1 { -} -exports.default = default_1; +class default_1 {}exports.default = default_1; //// [b.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -function default_1() { } -exports.default = default_1; +function default_1() { }exports.default = default_1; diff --git a/tests/baselines/reference/anonymousDefaultExportsSystem.js b/tests/baselines/reference/anonymousDefaultExportsSystem.js index 48071da9e9b..d7ba682a0ab 100644 --- a/tests/baselines/reference/anonymousDefaultExportsSystem.js +++ b/tests/baselines/reference/anonymousDefaultExportsSystem.js @@ -14,8 +14,7 @@ System.register([], function (exports_1, context_1) { return { setters: [], execute: function () { - default_1 = class { - }; + default_1 = class {}; exports_1("default", default_1); } }; @@ -28,7 +27,6 @@ System.register([], function (exports_1, context_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 484238b8722..c83794f255f 100644 --- a/tests/baselines/reference/anonymousDefaultExportsUmd.js +++ b/tests/baselines/reference/anonymousDefaultExportsUmd.js @@ -18,9 +18,7 @@ export default function() {} })(function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); - class default_1 { - } - exports.default = default_1; + class default_1 {}exports.default = default_1; }); //// [b.js] (function (factory) { @@ -34,6 +32,5 @@ export default function() {} })(function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); - function default_1() { } - exports.default = default_1; + function default_1() { }exports.default = default_1; }); diff --git a/tests/baselines/reference/anonymousModules.js b/tests/baselines/reference/anonymousModules.js index 5270594e8ee..16c148c6871 100644 --- a/tests/baselines/reference/anonymousModules.js +++ b/tests/baselines/reference/anonymousModules.js @@ -21,6 +21,7 @@ module; { export var bar = 1; } + var bar = 2; module; { diff --git a/tests/baselines/reference/anyAsConstructor.js b/tests/baselines/reference/anyAsConstructor.js index 2dfa9a5398b..d706d1d6a6a 100644 --- a/tests/baselines/reference/anyAsConstructor.js +++ b/tests/baselines/reference/anyAsConstructor.js @@ -13,9 +13,11 @@ 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'); var c = new x(x); + // grammar allows this for constructors var d = new x(x); // no error diff --git a/tests/baselines/reference/anyAsFunctionCall.js b/tests/baselines/reference/anyAsFunctionCall.js index 9b1e0852de9..340d7444f56 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 085e1065a07..a6f497a862d 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 a6b26d3890e..d260fbc69ce 100644 --- a/tests/baselines/reference/anyAsReturnTypeForNewOnCall.js +++ b/tests/baselines/reference/anyAsReturnTypeForNewOnCall.js @@ -16,8 +16,14 @@ 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 6871d6738ac..2e65961c5a9 100644 --- a/tests/baselines/reference/anyAssignabilityInInheritance.js +++ b/tests/baselines/reference/anyAssignabilityInInheritance.js @@ -90,28 +90,40 @@ 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 + var r3 = foo3(a); // any + var r3 = foo3(a); // any + 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 + var r3 = foo3(a); // any + var r3 = foo3(a); // any var E; (function (E) { @@ -123,14 +135,16 @@ function f() { } f.bar = 1; })(f || (f = {})); var r3 = foo3(a); // any + var CC = /** @class */ (function () { - function CC() { - } + function CC() {} return CC; }()); (function (CC) { CC.bar = 1; })(CC || (CC = {})); var r3 = foo3(a); // any + var r3 = foo3(a); // any + var r3 = foo3(a); // any diff --git a/tests/baselines/reference/anyAssignableToEveryType.js b/tests/baselines/reference/anyAssignableToEveryType.js index eff97905e4f..b5ad284ed69 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 28b4ab7148d..1250002ba7f 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 6ec3d0d43e6..f162234934d 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 df921965994..86c8a9e1646 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 fc333cb15e0..b15cec3fc6e 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 75e6e979ac3..f427136ede3 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 2e9987f1e0d..400fb1783f0 100644 --- a/tests/baselines/reference/apparentTypeSubtyping.js +++ b/tests/baselines/reference/apparentTypeSubtyping.js @@ -37,6 +37,7 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + var Base = /** @class */ (function () { function Base() { } @@ -44,8 +45,7 @@ var Base = /** @class */ (function () { }()); // is String (S) a subtype of U extends String (T)? Would only be true if we used the apparent type of U (T) var Derived = /** @class */ (function (_super) { - __extends(Derived, _super); - function Derived() { + __extends(Derived, _super);function Derived() { return _super !== null && _super.apply(this, arguments) || this; } return Derived; @@ -57,8 +57,7 @@ var Base2 = /** @class */ (function () { }()); // is U extends String (S) a subtype of String (T)? Apparent type of U is String so it succeeds var Derived2 = /** @class */ (function (_super) { - __extends(Derived2, _super); - function Derived2() { + __extends(Derived2, _super);function Derived2() { return _super !== null && _super.apply(this, arguments) || this; } return Derived2; diff --git a/tests/baselines/reference/apparentTypeSupertype.js b/tests/baselines/reference/apparentTypeSupertype.js index 82443d22197..622d5eb218f 100644 --- a/tests/baselines/reference/apparentTypeSupertype.js +++ b/tests/baselines/reference/apparentTypeSupertype.js @@ -27,6 +27,7 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + var Base = /** @class */ (function () { function Base() { } @@ -34,8 +35,7 @@ var Base = /** @class */ (function () { }()); // is String (S) a subtype of U extends String (T)? Would only be true if we used the apparent type of U (T) var Derived = /** @class */ (function (_super) { - __extends(Derived, _super); - function Derived() { + __extends(Derived, _super);function Derived() { return _super !== null && _super.apply(this, arguments) || this; } return Derived; diff --git a/tests/baselines/reference/argsInScope.js b/tests/baselines/reference/argsInScope.js index 4ddfe09f13a..0594b82a469 100644 --- a/tests/baselines/reference/argsInScope.js +++ b/tests/baselines/reference/argsInScope.js @@ -14,8 +14,7 @@ c.P(1,2,3); //// [argsInScope.js] var C = /** @class */ (function () { function C() { - } - C.prototype.P = function (ii, j, k) { + }C.prototype.P = function (ii, j, k) { for (var i = 0; i < arguments.length; i++) { // WScript.Echo("param: " + arguments[i]); } diff --git a/tests/baselines/reference/argumentExpressionContextualTyping.js b/tests/baselines/reference/argumentExpressionContextualTyping.js index 14efadcab75..b038cc8f636 100644 --- a/tests/baselines/reference/argumentExpressionContextualTyping.js +++ b/tests/baselines/reference/argumentExpressionContextualTyping.js @@ -34,6 +34,7 @@ function bar(_a) { var _b = _a.x, a = _b[0], _c = _b[1], b = _c === void 0 ? 10 : _c, _d = _a.y, c = _d.c, d = _d.d, _e = _d.e, e = _e === void 0 ? { f: 1 } : _e; } function baz(x) { } + 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] @@ -42,6 +43,7 @@ var array = ["string", 1, true]; var tuple = ["string", 1, true]; baz(tuple); baz(["string", 1, true]); + baz(array); // Error baz(__spreadArrays(["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 3dd362506c6..d159a09c296 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 a4197c0a1d2..c619e51ac34 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/argumentsObjectIterator02_ES5.js b/tests/baselines/reference/argumentsObjectIterator02_ES5.js index ae8675d9745..4f076083809 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 1155ab929ea..63d3e0d2829 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 837808a6d92..1788e1210af 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 789bcc9390d..53af8d4ea97 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/argumentsUsedInObjectLiteralProperty.js b/tests/baselines/reference/argumentsUsedInObjectLiteralProperty.js index 23c534a8c53..c318f2499cf 100644 --- a/tests/baselines/reference/argumentsUsedInObjectLiteralProperty.js +++ b/tests/baselines/reference/argumentsUsedInObjectLiteralProperty.js @@ -10,8 +10,7 @@ class A { //// [argumentsUsedInObjectLiteralProperty.js] var A = /** @class */ (function () { function A() { - } - A.createSelectableViewModel = function (initialState, selectedValue) { + }A.createSelectableViewModel = function (initialState, selectedValue) { return { selectedValue: arguments.length }; diff --git a/tests/baselines/reference/arithAssignTyping.js b/tests/baselines/reference/arithAssignTyping.js index 7bb31b28045..4d59d53d302 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 7cb45f63230..dde8b9c4522 100644 --- a/tests/baselines/reference/arithmeticOperatorWithAnyAndNumber.js +++ b/tests/baselines/reference/arithmeticOperatorWithAnyAndNumber.js @@ -105,6 +105,7 @@ var rj8 = b | b; //// [arithmeticOperatorWithAnyAndNumber.js] var a; var b; + // operator * var ra1 = a * a; var ra2 = a * b; @@ -114,6 +115,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 +125,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 +135,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 +145,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 +155,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 +165,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 +175,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 +185,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 +195,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 3572f3ecc41..a5fc9c7e8d9 100644 --- a/tests/baselines/reference/arithmeticOperatorWithEnum.js +++ b/tests/baselines/reference/arithmeticOperatorWithEnum.js @@ -160,6 +160,7 @@ var E; var a; var b; var c; + // operator * var ra1 = c * a; var ra2 = c * b; @@ -173,6 +174,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 +188,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 +202,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 +216,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 +230,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 +244,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 +258,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 +272,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 +286,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 95bc0b866c9..a9953962501 100644 --- a/tests/baselines/reference/arithmeticOperatorWithEnumUnion.js +++ b/tests/baselines/reference/arithmeticOperatorWithEnumUnion.js @@ -169,6 +169,7 @@ var F; var a; var b; var c; + // operator * var ra1 = c * a; var ra2 = c * b; @@ -182,6 +183,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 +197,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 +211,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 +225,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 +239,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 +253,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 +267,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 +281,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 +295,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 974e9930103..764650ee50e 100644 --- a/tests/baselines/reference/arithmeticOperatorWithInvalidOperands.js +++ b/tests/baselines/reference/arithmeticOperatorWithInvalidOperands.js @@ -586,9 +586,7 @@ var r10h6 = f | E.b; // an enum type var E; (function (E) { - E[E["a"] = 0] = "a"; - E[E["b"] = 1] = "b"; - E[E["c"] = 2] = "c"; + E[E["a"] = 0] = "a";E[E["b"] = 1] = "b";E[E["c"] = 2] = "c"; })(E || (E = {})); var a; var b; @@ -596,6 +594,7 @@ var c; var d; var e; var f; + // All of the below should be an error unless otherwise noted // operator * var r1a1 = a * a; //ok @@ -604,48 +603,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 +660,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 +717,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 +774,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 +831,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 +888,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 +945,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 +1002,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 +1059,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 +1116,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 b277abb668d..a46b8f3af3c 100644 --- a/tests/baselines/reference/arithmeticOperatorWithNullValueAndInvalidOperands.js +++ b/tests/baselines/reference/arithmeticOperatorWithNullValueAndInvalidOperands.js @@ -179,136 +179,177 @@ 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; + // operator * 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 0c30e8d0484..189ea74239c 100644 --- a/tests/baselines/reference/arithmeticOperatorWithNullValueAndValidOperands.js +++ b/tests/baselines/reference/arithmeticOperatorWithNullValueAndValidOperands.js @@ -120,6 +120,7 @@ var E; })(E || (E = {})); var a; var b; + // operator * var ra1 = null * a; var ra2 = null * b; @@ -129,6 +130,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 +140,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 +150,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 +160,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 +170,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 +180,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 +190,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 +200,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 +210,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 f1421a6b5c9..82e1428b5c3 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 94475b88fd8..2eab1642247 100644 --- a/tests/baselines/reference/arithmeticOperatorWithTypeParameter.js +++ b/tests/baselines/reference/arithmeticOperatorWithTypeParameter.js @@ -137,6 +137,7 @@ function foo(t) { var c; var d; var e; + var r1a1 = a * t; var r1a2 = a / t; var r1a3 = a % t; @@ -147,6 +148,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 +159,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 +170,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 +181,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 +192,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 +203,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 +214,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 +225,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 +236,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 +247,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 b64c2d9dc09..079fa71013e 100644 --- a/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndInvalidOperands.js +++ b/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndInvalidOperands.js @@ -179,136 +179,177 @@ 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; + // operator * 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 60ea9af32c2..bf297e7bddd 100644 --- a/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndValidOperands.js +++ b/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndValidOperands.js @@ -120,6 +120,7 @@ var E; })(E || (E = {})); var a; var b; + // operator * var ra1 = undefined * a; var ra2 = undefined * b; @@ -129,6 +130,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 +140,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 +150,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 +160,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 +170,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 +180,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 +190,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 +200,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 +210,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 bf7736a80c9..6e9cefa9a48 100644 --- a/tests/baselines/reference/arityAndOrderCompatibility01.js +++ b/tests/baselines/reference/arityAndOrderCompatibility01.js @@ -37,9 +37,14 @@ var o3: [string, number] = y; //// [arityAndOrderCompatibility01.js] + var x; -var y; -var z; +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 66f9316457d..76ee0a680ef 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 baf1e8bfa3a..daa20ec2f22 100644 --- a/tests/baselines/reference/arrayAssignmentTest1.js +++ b/tests/baselines/reference/arrayAssignmentTest1.js @@ -99,25 +99,22 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + var C1 = /** @class */ (function () { function C1() { - } - C1.prototype.IM1 = function () { return null; }; + }C1.prototype.IM1 = function () { return null; }; C1.prototype.C1M1 = function () { return null; }; return C1; }()); var C2 = /** @class */ (function (_super) { - __extends(C2, _super); - function C2() { + __extends(C2, _super);function C2() { return _super !== null && _super.apply(this, arguments) || this; - } - C2.prototype.C2M1 = function () { return null; }; + }C2.prototype.C2M1 = function () { return null; }; return C2; }(C1)); var C3 = /** @class */ (function () { function C3() { - } - C3.prototype.CM3M1 = function () { return 3; }; + }C3.prototype.CM3M1 = function () { return 3; }; return C3; }()); /* @@ -138,6 +135,7 @@ var c2 = new C2(); var c3 = new C3(); var o1 = { one: 1 }; var f1 = function () { return new C1(); }; + var arr_any = []; var arr_i1 = []; var arr_c1 = []; @@ -146,6 +144,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 @@ -154,24 +153,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 5b1a655d781..68c48e796c7 100644 --- a/tests/baselines/reference/arrayAssignmentTest2.js +++ b/tests/baselines/reference/arrayAssignmentTest2.js @@ -73,25 +73,22 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + var C1 = /** @class */ (function () { function C1() { - } - C1.prototype.IM1 = function () { return null; }; + }C1.prototype.IM1 = function () { return null; }; C1.prototype.C1M1 = function () { return null; }; return C1; }()); var C2 = /** @class */ (function (_super) { - __extends(C2, _super); - function C2() { + __extends(C2, _super);function C2() { return _super !== null && _super.apply(this, arguments) || this; - } - C2.prototype.C2M1 = function () { return null; }; + }C2.prototype.C2M1 = function () { return null; }; return C2; }(C1)); var C3 = /** @class */ (function () { function C3() { - } - C3.prototype.CM3M1 = function () { return 3; }; + }C3.prototype.CM3M1 = function () { return 3; }; return C3; }()); /* @@ -112,6 +109,7 @@ var c2 = new C2(); var c3 = new C3(); var o1 = { one: 1 }; var f1 = function () { return new C1(); }; + var arr_any = []; var arr_i1 = []; var arr_c1 = []; @@ -124,6 +122,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 965da445a2b..8565f37fa11 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 () { @@ -31,3 +30,4 @@ var a = /** @class */ (function () { return a; }()); var xx = new a(null, 7, new B()); + diff --git a/tests/baselines/reference/arrayAssignmentTest4.js b/tests/baselines/reference/arrayAssignmentTest4.js index da900089c9d..ee518947e0d 100644 --- a/tests/baselines/reference/arrayAssignmentTest4.js +++ b/tests/baselines/reference/arrayAssignmentTest4.js @@ -27,8 +27,7 @@ arr_any = c3; // should be an error - is //// [arrayAssignmentTest4.js] var C3 = /** @class */ (function () { function C3() { - } - C3.prototype.CM3M1 = function () { return 3; }; + }C3.prototype.CM3M1 = function () { return 3; }; return C3; }()); /* @@ -44,6 +43,7 @@ Type 1 of any[]: */ var c3 = new C3(); var o1 = { one: 1 }; + var arr_any = []; arr_any = function () { return null; }; // should be an error - is arr_any = c3; // should be an error - is diff --git a/tests/baselines/reference/arrayAssignmentTest5.js b/tests/baselines/reference/arrayAssignmentTest5.js index 71c84f374ee..92537af9230 100644 --- a/tests/baselines/reference/arrayAssignmentTest5.js +++ b/tests/baselines/reference/arrayAssignmentTest5.js @@ -38,8 +38,7 @@ var Test; (function (Test) { var Bug = /** @class */ (function () { function Bug() { - } - Bug.prototype.onEnter = function (line, state, offset) { + }Bug.prototype.onEnter = function (line, state, offset) { var lineTokens = this.tokenize(line, state, true); var tokens = lineTokens.tokens; if (tokens.length === 0) { diff --git a/tests/baselines/reference/arrayAssignmentTest6.js b/tests/baselines/reference/arrayAssignmentTest6.js index 8ed75d26b19..4b9b90f1bfd 100644 --- a/tests/baselines/reference/arrayAssignmentTest6.js +++ b/tests/baselines/reference/arrayAssignmentTest6.js @@ -25,8 +25,7 @@ var Test; (function (Test) { var Bug = /** @class */ (function () { function Bug() { - } - Bug.prototype.tokenize = function (line, tokens, includeStates) { + }Bug.prototype.tokenize = function (line, tokens, includeStates) { return null; }; return Bug; diff --git a/tests/baselines/reference/arrayAugment.js b/tests/baselines/reference/arrayAugment.js index 20cf510712a..67834d8a426 100644 --- a/tests/baselines/reference/arrayAugment.js +++ b/tests/baselines/reference/arrayAugment.js @@ -9,6 +9,7 @@ var y: string[][]; // Expect no error here //// [arrayAugment.js] + var x = ['']; var y = x.split(4); var y; // Expect no error here diff --git a/tests/baselines/reference/arrayBestCommonTypes.js b/tests/baselines/reference/arrayBestCommonTypes.js index 7b8da4f7970..5e962a0480e 100644 --- a/tests/baselines/reference/arrayBestCommonTypes.js +++ b/tests/baselines/reference/arrayBestCommonTypes.js @@ -124,29 +124,25 @@ 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) { - __extends(derived, _super); - function derived() { + __extends(derived, _super);function derived() { return _super !== null && _super.apply(this, arguments) || this; } return derived; }(base)); 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])); @@ -154,24 +150,31 @@ 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' }]; var a2 = [{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }]; var a3 = [{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }]; + 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]; @@ -183,29 +186,25 @@ 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) { - __extends(derived, _super); - function derived() { + __extends(derived, _super);function derived() { return _super !== null && _super.apply(this, arguments) || this; } return derived; }(base)); 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])); @@ -213,24 +212,31 @@ 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' }]; var a2 = [{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }]; var a3 = [{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }]; + 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 916eee62183..4df9ffdaa25 100644 --- a/tests/baselines/reference/arrayBindingPatternOmittedExpressions.js +++ b/tests/baselines/reference/arrayBindingPatternOmittedExpressions.js @@ -22,8 +22,11 @@ var results; let x = { a, 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 214bf642250..784eaeede25 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 8db2d62e1d3..9a0d8ca3332 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 488cf49a316..ae92444f33f 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/arrayFilter.js b/tests/baselines/reference/arrayFilter.js index dd3b321b19c..ca00fcd7aae 100644 --- a/tests/baselines/reference/arrayFilter.js +++ b/tests/baselines/reference/arrayFilter.js @@ -13,4 +13,5 @@ var foo = [ { name: null }, { name: 'baz' } ]; + foo.filter(function (x) { return x.name; }); //should accepted all possible types not only boolean! diff --git a/tests/baselines/reference/arrayFind.js b/tests/baselines/reference/arrayFind.js index 1926c3a8dcc..d62e8ed6270 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 ea6fcf8fcf0..300d408fd2b 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 ae210aabd42..a1e96dbdc9f 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 0b9f543e382..3f46477eed2 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 2d48085c80f..5bde4951b97 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"; diff --git a/tests/baselines/reference/arrayLiteralExpressionContextualTyping.js b/tests/baselines/reference/arrayLiteralExpressionContextualTyping.js index 9061b1a9d4e..dd0337c655d 100644 --- a/tests/baselines/reference/arrayLiteralExpressionContextualTyping.js +++ b/tests/baselines/reference/arrayLiteralExpressionContextualTyping.js @@ -31,6 +31,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 = __spreadArrays([1, 2, 3], array); diff --git a/tests/baselines/reference/arrayLiteralInNonVarArgParameter.js b/tests/baselines/reference/arrayLiteralInNonVarArgParameter.js index 57cba07d6bf..0842976d7a9 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 6b98b22394a..90a40cdc03f 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 bf86204156a..0a1d8540fef 100644 --- a/tests/baselines/reference/arrayLiteralSpread.js +++ b/tests/baselines/reference/arrayLiteralSpread.js @@ -30,8 +30,7 @@ var __spreadArrays = (this && this.__spreadArrays) || function () { for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; -}; -function f0() { +};function f0() { var a = [1, 2, 3]; var a1 = __spreadArrays(a); var a2 = __spreadArrays([1], a); @@ -42,11 +41,13 @@ function f0() { var a7 = __spreadArrays([1], a, [2], a); var a8 = __spreadArrays(a, a, a); } + function f1() { var a = [1, 2, 3]; var b = __spreadArrays(["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 d71f49242dd..36a1415d4fe 100644 --- a/tests/baselines/reference/arrayLiteralSpreadES5iterable.js +++ b/tests/baselines/reference/arrayLiteralSpreadES5iterable.js @@ -43,8 +43,7 @@ var __read = (this && this.__read) || function (o, n) { var __spread = (this && this.__spread) || function () { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; -}; -function f0() { +};function f0() { var a = [1, 2, 3]; var a1 = __spread(a); var a2 = __spread([1], a); @@ -55,11 +54,13 @@ function f0() { var a7 = __spread([1], a, [2], a); var a8 = __spread(a, a, a); } + function f1() { var a = [1, 2, 3]; var b = __spread(["hello"], a, [true]); var b; } + function f2() { var a = __spread([]); var b = __spread([5]); diff --git a/tests/baselines/reference/arrayLiteralTypeInference.js b/tests/baselines/reference/arrayLiteralTypeInference.js index fcd8a62ce0b..c38f065037c 100644 --- a/tests/baselines/reference/arrayLiteralTypeInference.js +++ b/tests/baselines/reference/arrayLiteralTypeInference.js @@ -64,22 +64,19 @@ 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; }()); var ActionA = /** @class */ (function (_super) { - __extends(ActionA, _super); - function ActionA() { + __extends(ActionA, _super);function ActionA() { return _super !== null && _super.apply(this, arguments) || this; } return ActionA; }(Action)); var ActionB = /** @class */ (function (_super) { - __extends(ActionB, _super); - function ActionB() { + __extends(ActionB, _super);function ActionB() { return _super !== null && _super.apply(this, arguments) || this; } return ActionB; @@ -87,26 +84,50 @@ var ActionB = /** @class */ (function (_super) { 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 5b7346b8738..52214565537 100644 --- a/tests/baselines/reference/arrayLiteralWidened.js +++ b/tests/baselines/reference/arrayLiteralWidened.js @@ -25,17 +25,23 @@ 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 var x = undefined; + var d = [x]; var d = [, x]; var d = [undefined, x]; diff --git a/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.js b/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.js index b4f869d499e..0743b19e613 100644 --- a/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.js +++ b/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.js @@ -17,12 +17,15 @@ 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; + var as = [a, b]; // { x: number; y?: number };[] var bs = [b, a]; // { x: number; z?: number };[] var cs = [a, b, c]; // { x: number; y?: number };[] + var ds = [function (x) { return 1; }, function (x) { return 2; }]; // { (x:Object) => number }[] var es = [function (x) { return 2; }, function (x) { return 1; }]; // { (x:string) => number }[] var fs = [function (a) { return 1; }, function (b) { return 2; }]; // (a: { x: number; y?: number }) => number[] diff --git a/tests/baselines/reference/arrayLiterals.js b/tests/baselines/reference/arrayLiterals.js index c4d257dd546..aec46c39f19 100644 --- a/tests/baselines/reference/arrayLiterals.js +++ b/tests/baselines/reference/arrayLiterals.js @@ -51,46 +51,56 @@ 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) { - __extends(Derived1, _super); - function Derived1() { + __extends(Derived1, _super);function Derived1() { return _super !== null && _super.apply(this, arguments) || this; } return Derived1; }(Base)); ; var Derived2 = /** @class */ (function (_super) { - __extends(Derived2, _super); - function Derived2() { + __extends(Derived2, _super);function Derived2() { return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(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 2626be08343..ef0e172ec18 100644 --- a/tests/baselines/reference/arrayLiterals2ES5.js +++ b/tests/baselines/reference/arrayLiterals2ES5.js @@ -69,14 +69,19 @@ var __spreadArrays = (this && this.__spreadArrays) || function () { r[k] = a[j]; return r; }; + // SpreadElement: // ... AssignmentExpression var a0 = [, , 2, 3, 4]; var a1 = ["hello", "world"]; var a2 = __spreadArrays([, , ], a0, ["hello"]); -var a3 = __spreadArrays([, ], a0); +var a3 = __spreadArrays([, ], a0) +; var a4 = [function () { return 1; },]; -var a5 = __spreadArrays(a0, [,]); +var a5 = __spreadArrays(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, @@ -86,11 +91,16 @@ var a5 = __spreadArrays(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. var _a = [1, 2], c0 = _a[0], c1 = _a[1]; // tuple type [number, number] var _b = [1, 2, true], c2 = _b[0], c3 = _b[1]; // 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 @@ -99,6 +109,7 @@ var temp1 = [1, 2, 3]; var temp2 = [[1, 2, 3], ["hello", "string"]]; var temp3 = [undefined, null, undefined]; var temp4 = []; + var d0 = __spreadArrays([1, true], temp); // has type (string|number|boolean)[] var d1 = __spreadArrays(temp); // has type string[] var d2 = __spreadArrays(temp1); @@ -107,5 +118,6 @@ var d4 = __spreadArrays(temp, temp1); var d5 = __spreadArrays(temp3); var d6 = __spreadArrays(temp4); var d7 = __spreadArrays(temp1); -var d8 = [__spreadArrays(temp1)]; +var d8 = [__spreadArrays(temp1)] +; var d9 = __spreadArrays([__spreadArrays(temp1)], ["hello"]); diff --git a/tests/baselines/reference/arrayLiterals2ES6.js b/tests/baselines/reference/arrayLiterals2ES6.js index cb6bf2684e8..7e11ed21376 100644 --- a/tests/baselines/reference/arrayLiterals2ES6.js +++ b/tests/baselines/reference/arrayLiterals2ES6.js @@ -62,12 +62,17 @@ var d9 = [[...temp1], ...["hello"]]; // ElementList, Elisionopt SpreadElement // SpreadElement: // ... AssignmentExpression -var a0 = [, , 2, 3, 4]; -var a1 = ["hello", "world"]; +var a0 = [, , 2, 3, 4] +; +var a1 = ["hello", "world"] +; var a2 = [, , , ...a0, "hello"]; -var a3 = [, , ...a0]; +var a3 = [, , ...a0] +; var a4 = [() => 1,]; -var a5 = [...a0, ,]; +var a5 = [...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, @@ -82,12 +87,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]; @@ -96,5 +106,6 @@ var d4 = [...temp, ...temp1]; var d5 = [...a2]; var d6 = [...a3]; var d7 = [...a4]; -var d8 = [[...temp1]]; +var d8 = [[...temp1]] +; var d9 = [[...temp1], ...["hello"]]; diff --git a/tests/baselines/reference/arrayLiterals3.js b/tests/baselines/reference/arrayLiterals3.js index 754bd1fba1e..ff8beb5e97a 100644 --- a/tests/baselines/reference/arrayLiterals3.js +++ b/tests/baselines/reference/arrayLiterals3.js @@ -47,21 +47,29 @@ var __spreadArrays = (this && this.__spreadArrays) || function () { r[k] = a[j]; return r; }; + // 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. var _a = [1, 2, "string", true], b1 = _a[0], b2 = _a[1]; + // 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 c0 = __spreadArrays(temp2); // Error var c1 = __spreadArrays(temp1); // Error cannot assign number[] to [number, number, number] var c2 = __spreadArrays(temp1, temp); // Error cannot assign (number|string)[] to number[] diff --git a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js index 25a76bec5c7..de6d459ff4c 100644 --- a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js +++ b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js @@ -38,15 +38,13 @@ 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; }()); var DerivedList = /** @class */ (function (_super) { - __extends(DerivedList, _super); - function DerivedList() { + __extends(DerivedList, _super);function DerivedList() { return _super !== null && _super.apply(this, arguments) || this; } return DerivedList; @@ -59,8 +57,10 @@ var MyList = /** @class */ (function () { var list; var list2; var myList; + var xs = [list, myList]; // {}[] var ys = [list, list2]; // {}[] var zs = [list, null]; // List[] + var myDerivedList; var as = [list, myDerivedList]; // List[] diff --git a/tests/baselines/reference/arrayOfExportedClass.js b/tests/baselines/reference/arrayOfExportedClass.js index 2a41475c1cd..6332d988cde 100644 --- a/tests/baselines/reference/arrayOfExportedClass.js +++ b/tests/baselines/reference/arrayOfExportedClass.js @@ -36,8 +36,8 @@ module.exports = Car; "use strict"; var Road = /** @class */ (function () { function Road() { - } - Road.prototype.AddCars = function (cars) { + }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 758e11f6f1f..826ff1d4684 100644 --- a/tests/baselines/reference/arrayOfFunctionTypes3.js +++ b/tests/baselines/reference/arrayOfFunctionTypes3.js @@ -28,8 +28,10 @@ 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 () { function C() { } @@ -37,6 +39,7 @@ var C = /** @class */ (function () { }()); var y = [C, C]; var r3 = new y[0](); + var a; var b; var c; @@ -44,9 +47,11 @@ var z = [a, b, c]; var r4 = z[0]; var r5 = r4(''); // any not string var r5b = r4(1); + var a2; var b2; var c2; + var z2 = [a2, b2, c2]; var r6 = z2[0]; var r7 = r6(''); // any not string diff --git a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js index 45b587c0e62..5b4a515423f 100644 --- a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js +++ b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js @@ -32,22 +32,18 @@ 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) { - __extends(B, _super); - function B() { + __extends(B, _super);function B() { return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var C = /** @class */ (function (_super) { - __extends(C, _super); - function C() { + __extends(C, _super);function C() { return _super !== null && _super.apply(this, arguments) || this; } return C; @@ -56,6 +52,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/arrayReferenceWithoutTypeArgs.js b/tests/baselines/reference/arrayReferenceWithoutTypeArgs.js index 867395c44cf..a13c63cda8d 100644 --- a/tests/baselines/reference/arrayReferenceWithoutTypeArgs.js +++ b/tests/baselines/reference/arrayReferenceWithoutTypeArgs.js @@ -6,7 +6,6 @@ class X { //// [arrayReferenceWithoutTypeArgs.js] var X = /** @class */ (function () { function X() { - } - X.prototype.f = function (a) { }; + }X.prototype.f = function (a) { }; return X; }()); diff --git a/tests/baselines/reference/arraySigChecking.js b/tests/baselines/reference/arraySigChecking.js index 16189305ead..29ab7bea8de 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 9a7a4516cb5..a4e75475db9 100644 --- a/tests/baselines/reference/arrayTypeOfFunctionTypes.js +++ b/tests/baselines/reference/arrayTypeOfFunctionTypes.js @@ -18,14 +18,17 @@ var r6b = new r5(); // error //// [arrayTypeOfFunctionTypes.js] // valid uses of arrays of function types + var x; var r = x[1]; var r2 = r(); var r2b = new r(); + var x2; var r3 = x2[1]; var r4 = r3(); var r4b = new r3(); // error + var x3; var r5 = x2[1]; var r6 = r5(); diff --git a/tests/baselines/reference/arrayTypeOfFunctionTypes2.js b/tests/baselines/reference/arrayTypeOfFunctionTypes2.js index f9baa9871e1..a196ddab1ac 100644 --- a/tests/baselines/reference/arrayTypeOfFunctionTypes2.js +++ b/tests/baselines/reference/arrayTypeOfFunctionTypes2.js @@ -18,14 +18,17 @@ var r6b = r5(); //// [arrayTypeOfFunctionTypes2.js] // valid uses of arrays of function types + var x; var r = x[1]; var r2 = new r(); var r2b = r(); + var x2; var r3 = x[1]; var r4 = new r3(); var r4b = new r3(); + var x3; var r5 = x2[1]; var r6 = new r5(); diff --git a/tests/baselines/reference/arrayTypeOfTypeOf.js b/tests/baselines/reference/arrayTypeOfTypeOf.js index ced62a73a07..503627dcd5b 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 8730fff8c41..64054539f53 100644 --- a/tests/baselines/reference/arrayconcat.js +++ b/tests/baselines/reference/arrayconcat.js @@ -29,10 +29,10 @@ class parser { } //// [arrayconcat.js] + var parser = /** @class */ (function () { function parser() { - } - parser.prototype.m = function () { + }parser.prototype.m = function () { this.options = this.options.sort(function (a, b) { var aName = a.name.toLowerCase(); var bName = b.name.toLowerCase(); diff --git a/tests/baselines/reference/arrowFunctionContexts.js b/tests/baselines/reference/arrowFunctionContexts.js index 466131ea206..a314ef1b671 100644 --- a/tests/baselines/reference/arrowFunctionContexts.js +++ b/tests/baselines/reference/arrowFunctionContexts.js @@ -114,10 +114,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) { @@ -130,9 +130,11 @@ 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 @@ -156,10 +158,10 @@ var M2; 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) { @@ -172,9 +174,11 @@ 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 @@ -196,8 +200,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 ca1f966f517..c641497b82c 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 19b7651b1e7..645e263f93b 100644 --- a/tests/baselines/reference/arrowFunctionExpressions.js +++ b/tests/baselines/reference/arrowFunctionExpressions.js @@ -102,15 +102,23 @@ function tryCatchFn() { //// [arrowFunctionExpressions.js] // ArrowFormalParameters => AssignmentExpression is equivalent to ArrowFormalParameters => { return AssignmentExpression; } var a = function (p) { return p.length; }; -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; }; +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 +150,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 () { @@ -149,8 +158,7 @@ var MyClass = /** @class */ (function () { var _this = this; this.m = function (n) { return n + 1; }; this.p = function (n) { return n && _this; }; - } - MyClass.prototype.fn = function () { + }MyClass.prototype.fn = function () { var _this = this; var m = function (n) { return n + 1; }; var p = function (n) { return n && _this; }; @@ -161,16 +169,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,15 +190,19 @@ function outerFn() { var p; } } + // Arrow function used in nested function in arrow function var f = function (n) { function fn(x) { return function () { return n + x; }; } return fn(4); -}; +} +; var g = f('')(); var g; + + // Arrow function used in nested function in arrow function in nested function function someOuterFn() { var arr = function (n) { @@ -195,7 +210,8 @@ function someOuterFn() { return function () { return n.length; }; } return innerFn; - }; + } + ; return arr; } var h = someOuterFn()('')()(); diff --git a/tests/baselines/reference/arrowFunctionInConstructorArgument1.js b/tests/baselines/reference/arrowFunctionInConstructorArgument1.js index f80b8706929..7ab009f272d 100644 --- a/tests/baselines/reference/arrowFunctionInConstructorArgument1.js +++ b/tests/baselines/reference/arrowFunctionInConstructorArgument1.js @@ -7,8 +7,8 @@ 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 +var c = new C(function () { return asdf; }) +; // should error diff --git a/tests/baselines/reference/arrowFunctionInExpressionStatement2.js b/tests/baselines/reference/arrowFunctionInExpressionStatement2.js index 2cc6aca998e..5b3a1b4602c 100644 --- a/tests/baselines/reference/arrowFunctionInExpressionStatement2.js +++ b/tests/baselines/reference/arrowFunctionInExpressionStatement2.js @@ -6,5 +6,6 @@ module M { //// [arrowFunctionInExpressionStatement2.js] var M; (function (M) { - (function () { return 0; }); + ( + function () { return 0; }); })(M || (M = {})); diff --git a/tests/baselines/reference/arrowFunctionWithObjectLiteralBody5.js b/tests/baselines/reference/arrowFunctionWithObjectLiteralBody5.js index c097ccf0d50..cfc5ebf165b 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 270a9927835..231643dd3f1 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 d0a8bde2a53..0e3175fe3df 100644 --- a/tests/baselines/reference/arrowFunctionsMissingTokens.js +++ b/tests/baselines/reference/arrowFunctionsMissingTokens.js @@ -69,9 +69,15 @@ module okay { var missingArrowsWithCurly; (function (missingArrowsWithCurly) { var a = function () { }; - var b = function () { }; + + var b = function () { } + + ; + var c = function (x) { }; + var d = function (x, y) { }; + var e = function (x, y) { }; })(missingArrowsWithCurly || (missingArrowsWithCurly = {})); var missingCurliesWithArrow; @@ -79,19 +85,25 @@ var missingCurliesWithArrow; var withStatement; (function (withStatement) { var a = function () { var k = 10; }; - var b = 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; }; + + 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 ; }; @@ -102,16 +114,26 @@ var f = function () { return ; }; var ce_nEst_pas_une_arrow_function; (function (ce_nEst_pas_une_arrow_function) { var a = (); + 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 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 dee8d263eae..3b33a0a4568 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 1b23d0a86f7..04a4645808c 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 7cbb277bb03..4f3d20a7f1e 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 15f15d0f027..1e9bb3a4671 100644 --- a/tests/baselines/reference/asOperator4.js +++ b/tests/baselines/reference/asOperator4.js @@ -15,12 +15,12 @@ import { foo } from './foo'; "use strict"; exports.__esModule = true; exports.foo = void 0; -function foo() { } -exports.foo = foo; +function foo() { }exports.foo = foo; //// [bar.js] "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 4a78b022c4f..fa832c2b11c 100644 --- a/tests/baselines/reference/asOperatorASI.js +++ b/tests/baselines/reference/asOperatorASI.js @@ -15,15 +15,16 @@ 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 var x = 10; as(__makeTemplateObject(["Hello world"], ["Hello world"])); // should not error + + // Example 2 var y = 20; as(Foo); // should emit diff --git a/tests/baselines/reference/asOperatorAmbiguity.js b/tests/baselines/reference/asOperatorAmbiguity.js index 6c336970b65..c4dad80a761 100644 --- a/tests/baselines/reference/asOperatorAmbiguity.js +++ b/tests/baselines/reference/asOperatorAmbiguity.js @@ -10,7 +10,9 @@ 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; var z = y[0].m; // z should be string + diff --git a/tests/baselines/reference/asiAbstract.js b/tests/baselines/reference/asiAbstract.js index 27ae841ac42..0b1c7461b62 100644 --- a/tests/baselines/reference/asiAbstract.js +++ b/tests/baselines/reference/asiAbstract.js @@ -24,8 +24,7 @@ var NonAbstractClass = /** @class */ (function () { }()); var C2 = /** @class */ (function () { function C2() { - } - C2.prototype.nonAbstractFunction = function () { + }C2.prototype.nonAbstractFunction = function () { }; return C2; }()); diff --git a/tests/baselines/reference/asiArith.js b/tests/baselines/reference/asiArith.js index d552fd5ee77..d999339b265 100644 --- a/tests/baselines/reference/asiArith.js +++ b/tests/baselines/reference/asiArith.js @@ -36,12 +36,23 @@ 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 375f0e4bc65..830b01399ee 100644 --- a/tests/baselines/reference/asiInES6Classes.js +++ b/tests/baselines/reference/asiInES6Classes.js @@ -28,9 +28,10 @@ var Foo = /** @class */ (function () { this.defaults = { done: false }; - } - Foo.prototype.bar = function () { + }Foo.prototype.bar = function () { + return 3; + }; return Foo; }()); diff --git a/tests/baselines/reference/asiPublicPrivateProtected.js b/tests/baselines/reference/asiPublicPrivateProtected.js index 7c9b9d7eb72..5a4f84ca36d 100644 --- a/tests/baselines/reference/asiPublicPrivateProtected.js +++ b/tests/baselines/reference/asiPublicPrivateProtected.js @@ -44,45 +44,39 @@ class ClassWithThreeMembers { public; var NonPublicClass = /** @class */ (function () { function NonPublicClass() { - } - NonPublicClass.prototype.s = function () { + }NonPublicClass.prototype.s = function () { }; return NonPublicClass; }()); var NonPublicClass2 = /** @class */ (function () { function NonPublicClass2() { - } - NonPublicClass2.prototype.nonPublicFunction = function () { + }NonPublicClass2.prototype.nonPublicFunction = function () { }; return NonPublicClass2; }()); private; var NonPrivateClass = /** @class */ (function () { function NonPrivateClass() { - } - NonPrivateClass.prototype.s = function () { + }NonPrivateClass.prototype.s = function () { }; return NonPrivateClass; }()); var NonPrivateClass2 = /** @class */ (function () { function NonPrivateClass2() { - } - NonPrivateClass2.prototype.nonPrivateFunction = function () { + }NonPrivateClass2.prototype.nonPrivateFunction = function () { }; return NonPrivateClass2; }()); protected; var NonProtectedClass = /** @class */ (function () { function NonProtectedClass() { - } - NonProtectedClass.prototype.s = function () { + }NonProtectedClass.prototype.s = function () { }; return NonProtectedClass; }()); var NonProtectedClass2 = /** @class */ (function () { function NonProtectedClass2() { - } - NonProtectedClass2.prototype.nonProtectedFunction = function () { + }NonProtectedClass2.prototype.nonProtectedFunction = function () { }; return NonProtectedClass2; }()); diff --git a/tests/baselines/reference/assertInWrapSomeTypeParameter.js b/tests/baselines/reference/assertInWrapSomeTypeParameter.js index da31d191072..8a35231f8f6 100644 --- a/tests/baselines/reference/assertInWrapSomeTypeParameter.js +++ b/tests/baselines/reference/assertInWrapSomeTypeParameter.js @@ -8,8 +8,7 @@ class C> { //// [assertInWrapSomeTypeParameter.js] var C = /** @class */ (function () { function C() { - } - C.prototype.foo = function (x) { + }C.prototype.foo = function (x) { return null; }; return C; diff --git a/tests/baselines/reference/assertionFunctionsCanNarrowByDiscriminant.js b/tests/baselines/reference/assertionFunctionsCanNarrowByDiscriminant.js index 8857b7dd160..4da921d73ab 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 a9128475c52..692ccfd2b4d 100644 --- a/tests/baselines/reference/assertionTypePredicates1.js +++ b/tests/baselines/reference/assertionTypePredicates1.js @@ -207,7 +207,12 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); -var assert = function (value) { }; + +var assert = function (value) { } + +; + + function f01(x) { if (!!true) { assert(typeof x === "string"); @@ -244,6 +249,7 @@ function f01(x) { x; // Unreachable } } + function f02(x) { if (!!true) { assert(x); @@ -258,6 +264,7 @@ function f02(x) { x.length; } } + function f03(x, assert) { assert(x); x.length; @@ -283,10 +290,10 @@ function f10(x) { x; // Unreachable } } + var Test = /** @class */ (function () { function Test() { - } - Test.prototype.assert = function (value) { + }Test.prototype.assert = function (value) { if (value) return; throw new Error(); @@ -324,8 +331,7 @@ var Test = /** @class */ (function () { return Test; }()); var Test2 = /** @class */ (function (_super) { - __extends(Test2, _super); - function Test2() { + __extends(Test2, _super);function Test2() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.z = 0; return _this; @@ -333,11 +339,9 @@ var Test2 = /** @class */ (function (_super) { return Test2; }(Test)); var Derived = /** @class */ (function (_super) { - __extends(Derived, _super); - function Derived() { + __extends(Derived, _super);function Derived() { return _super !== null && _super.apply(this, arguments) || this; - } - Derived.prototype.foo = function (x) { + }Derived.prototype.foo = function (x) { _super.prototype.assert.call(this, typeof x === "string"); x.length; }; @@ -357,8 +361,12 @@ function f11(items) { item.z; } } + + + function f20(x) { - var assert = function (value) { }; + var assert = function (value) { } + ; assert(typeof x === "string"); // Error var a = [assert]; a[0](typeof x === "string"); // Error @@ -367,6 +375,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 fa18c8f287b..8a2f2e87fef 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 351c041523f..47f57939aa3 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 07bfbaddebc..420fbb8d132 100644 --- a/tests/baselines/reference/assignEveryTypeToAny.js +++ b/tests/baselines/reference/assignEveryTypeToAny.js @@ -57,13 +57,16 @@ 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; @@ -80,6 +83,7 @@ var E; x = E.A; var f = E.A; x = f; + var g; x = g; var C = /** @class */ (function () { @@ -93,6 +97,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 be376b293c0..c35d512fdc7 100644 --- a/tests/baselines/reference/assignFromBooleanInterface2.js +++ b/tests/baselines/reference/assignFromBooleanInterface2.js @@ -23,12 +23,16 @@ 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 25262bf27f0..2e04615c825 100644 --- a/tests/baselines/reference/assignFromNumberInterface2.js +++ b/tests/baselines/reference/assignFromNumberInterface2.js @@ -28,12 +28,16 @@ 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 5636a4806cc..abd9a23db91 100644 --- a/tests/baselines/reference/assignFromStringInterface2.js +++ b/tests/baselines/reference/assignFromStringInterface2.js @@ -51,12 +51,16 @@ 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 fe6142cafe0..5099569c1b8 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/assignToEnum.js b/tests/baselines/reference/assignToEnum.js index 5f7048894fa..05522a6bf15 100644 --- a/tests/baselines/reference/assignToEnum.js +++ b/tests/baselines/reference/assignToEnum.js @@ -10,8 +10,7 @@ A.foo = A.bar; // invalid LHS //// [assignToEnum.js] var A; (function (A) { - A[A["foo"] = 0] = "foo"; - A[A["bar"] = 1] = "bar"; + A[A["foo"] = 0] = "foo";A[A["bar"] = 1] = "bar"; })(A || (A = {})); A = undefined; // invalid LHS A = A.bar; // invalid LHS diff --git a/tests/baselines/reference/assignToExistingClass.js b/tests/baselines/reference/assignToExistingClass.js index baa7dc3cc73..03ec169f886 100644 --- a/tests/baselines/reference/assignToExistingClass.js +++ b/tests/baselines/reference/assignToExistingClass.js @@ -25,8 +25,7 @@ var Test; }()); var Tester = /** @class */ (function () { function Tester() { - } - Tester.prototype.willThrowError = function () { + }Tester.prototype.willThrowError = function () { Mocked = Mocked || function () { return { myProp: "test" }; }; diff --git a/tests/baselines/reference/assignToFn.js b/tests/baselines/reference/assignToFn.js index 2ff8ceedfa6..f3f9f7014d1 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/assignToInvalidLHS.js b/tests/baselines/reference/assignToInvalidLHS.js index 13906d28fdf..c162aa9e3a2 100644 --- a/tests/baselines/reference/assignToInvalidLHS.js +++ b/tests/baselines/reference/assignToInvalidLHS.js @@ -5,5 +5,6 @@ declare var y:any; var x = new y = 5; //// [assignToInvalidLHS.js] + // Below is actually valid JavaScript (see http://es5.github.com/#x8.7 ), even though will always fail at runtime with 'invalid left-hand side' var x = new y = 5; diff --git a/tests/baselines/reference/assignToObjectTypeWithPrototypeProperty.js b/tests/baselines/reference/assignToObjectTypeWithPrototypeProperty.js index ac2b7368361..84be67d5158 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 61c4a6ede22..f3639b14cd5 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 fd3ac1d46f1..0e7a5aba97c 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 5545cc7d19c..ed7be8244b2 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 ac79938f936..b5eb9583240 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 ae444c3dad6..533fe6197c9 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 8db85399fa8..a3760855bec 100644 --- a/tests/baselines/reference/assignmentCompatForEnums.js +++ b/tests/baselines/reference/assignmentCompatForEnums.js @@ -17,13 +17,17 @@ function foo() { //// [assignmentCompatForEnums.js] var TokenType; (function (TokenType) { - TokenType[TokenType["One"] = 0] = "One"; - TokenType[TokenType["Two"] = 1] = "Two"; + TokenType[TokenType["One"] = 0] = "One";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 13448bc57a4..31068074817 100644 --- a/tests/baselines/reference/assignmentCompatInterfaceWithStringIndexSignature.js +++ b/tests/baselines/reference/assignmentCompatInterfaceWithStringIndexSignature.js @@ -17,10 +17,11 @@ Biz(new Foo()); //// [assignmentCompatInterfaceWithStringIndexSignature.js] + + var Foo = /** @class */ (function () { function Foo() { - } - Foo.prototype.Boz = function () { }; + }Foo.prototype.Boz = function () { }; return Foo; }()); function Biz(map) { } diff --git a/tests/baselines/reference/assignmentCompatOnNew.js b/tests/baselines/reference/assignmentCompatOnNew.js index 14d9fb5071e..79057252f7c 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 12fc6159fac..d21def67a7b 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 6bfc1b6c0d6..217a1f1fe7f 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 a051b4e5194..ae0c9459a5c 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures3.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures3.js @@ -114,28 +114,25 @@ 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) { - __extends(Derived, _super); - function Derived() { + __extends(Derived, _super);function Derived() { return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = /** @class */ (function (_super) { - __extends(Derived2, _super); - function Derived2() { + __extends(Derived2, _super);function Derived2() { return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = /** @class */ (function (_super) { - __extends(OtherDerived, _super); - function OtherDerived() { + __extends(OtherDerived, _super);function OtherDerived() { return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; @@ -154,10 +151,15 @@ var a11; var a12; var a13; var a14; -var a15; -var a16; +var a15 +; +var a16 +; var a17; -var a18; +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 fc83877023b..cc6182046ef 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures4.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures4.js @@ -116,27 +116,23 @@ 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) { - __extends(Derived, _super); - function Derived() { + __extends(Derived, _super);function Derived() { return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = /** @class */ (function (_super) { - __extends(Derived2, _super); - function Derived2() { + __extends(Derived2, _super);function Derived2() { return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = /** @class */ (function (_super) { - __extends(OtherDerived, _super); - function OtherDerived() { + __extends(OtherDerived, _super);function OtherDerived() { return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; @@ -154,6 +150,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 fb6d0be1be1..0f11ac1fab1 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures5.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures5.js @@ -80,28 +80,25 @@ 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) { - __extends(Derived, _super); - function Derived() { + __extends(Derived, _super);function Derived() { return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = /** @class */ (function (_super) { - __extends(Derived2, _super); - function Derived2() { + __extends(Derived2, _super);function Derived2() { return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = /** @class */ (function (_super) { - __extends(OtherDerived, _super); - function OtherDerived() { + __extends(OtherDerived, _super);function OtherDerived() { return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; @@ -117,6 +114,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 9e752a43a17..0aee586be33 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures6.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures6.js @@ -57,33 +57,32 @@ 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) { - __extends(Derived, _super); - function Derived() { + __extends(Derived, _super);function Derived() { return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = /** @class */ (function (_super) { - __extends(Derived2, _super); - function Derived2() { + __extends(Derived2, _super);function Derived2() { return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = /** @class */ (function (_super) { - __extends(OtherDerived, _super); - function OtherDerived() { + __extends(OtherDerived, _super);function OtherDerived() { return _super !== null && _super.apply(this, arguments) || this; } 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 e12a741cd0f..ad51dd63e75 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignaturesWithOptionalParameters.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignaturesWithOptionalParameters.js @@ -71,9 +71,12 @@ 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 () { return 1; +}; // ok, same number of required params a = function (x) { return 1; }; // ok, same number of required params a = function (x) { return 1; }; // error, too many required params a = b.a; // ok diff --git a/tests/baselines/reference/assignmentCompatWithCallSignaturesWithRestParameters.js b/tests/baselines/reference/assignmentCompatWithCallSignaturesWithRestParameters.js index ec86f218ac0..08c9ff4f033 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 c00aa121712..c63217184c9 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 d00762aa1c5..af5b1e599cf 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 932f9bb5d66..e9cd4a49de2 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js @@ -114,28 +114,25 @@ 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) { - __extends(Derived, _super); - function Derived() { + __extends(Derived, _super);function Derived() { return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = /** @class */ (function (_super) { - __extends(Derived2, _super); - function Derived2() { + __extends(Derived2, _super);function Derived2() { return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = /** @class */ (function (_super) { - __extends(OtherDerived, _super); - function OtherDerived() { + __extends(OtherDerived, _super);function OtherDerived() { return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; @@ -154,10 +151,15 @@ var a11; var a12; var a13; var a14; -var a15; -var a16; +var a15 +; +var a16 +; var a17; -var a18; +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 4dad18cea8f..924c1c2adae 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js @@ -116,27 +116,23 @@ 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) { - __extends(Derived, _super); - function Derived() { + __extends(Derived, _super);function Derived() { return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = /** @class */ (function (_super) { - __extends(Derived2, _super); - function Derived2() { + __extends(Derived2, _super);function Derived2() { return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = /** @class */ (function (_super) { - __extends(OtherDerived, _super); - function OtherDerived() { + __extends(OtherDerived, _super);function OtherDerived() { return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; @@ -154,6 +150,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 5f16895caf2..c37d4aef75c 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js @@ -80,28 +80,25 @@ 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) { - __extends(Derived, _super); - function Derived() { + __extends(Derived, _super);function Derived() { return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = /** @class */ (function (_super) { - __extends(Derived2, _super); - function Derived2() { + __extends(Derived2, _super);function Derived2() { return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = /** @class */ (function (_super) { - __extends(OtherDerived, _super); - function OtherDerived() { + __extends(OtherDerived, _super);function OtherDerived() { return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; @@ -117,6 +114,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 dfce487fff1..e71460c55d1 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js @@ -57,33 +57,32 @@ 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) { - __extends(Derived, _super); - function Derived() { + __extends(Derived, _super);function Derived() { return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = /** @class */ (function (_super) { - __extends(Derived2, _super); - function Derived2() { + __extends(Derived2, _super);function Derived2() { return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = /** @class */ (function (_super) { - __extends(OtherDerived, _super); - function OtherDerived() { + __extends(OtherDerived, _super);function OtherDerived() { return _super !== null && _super.apply(this, arguments) || this; } 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 e41011021d2..e780d5d8fd3 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 2719a525ba7..bc44f41ac4b 100644 --- a/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.js +++ b/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.js @@ -198,6 +198,7 @@ namespace GH20889 { // 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; @@ -234,6 +235,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" @@ -244,6 +246,7 @@ var GH14865; var GH30170; (function (GH30170) { function draw(val) { } + function drawWithColor(currentColor) { return draw({ color: currentColor }); } @@ -251,6 +254,11 @@ var GH30170; // https://github.com/Microsoft/TypeScript/issues/12052 var GH12052; (function (GH12052) { + + + + + function getAxisType() { if (1 == 1) { return "categorical"; @@ -259,6 +267,7 @@ var GH12052; return "linear"; } } + var bad = { type: getAxisType() }; var good = { type: undefined }; good.type = getAxisType(); @@ -266,6 +275,12 @@ var GH12052; // https://github.com/Microsoft/TypeScript/issues/18421 var GH18421; (function (GH18421) { + + + + + + function makeNewThing(thingType) { return { type: thingType @@ -275,14 +290,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 ba4093f523d..82199eb9453 100644 --- a/tests/baselines/reference/assignmentCompatWithGenericCallSignatures.js +++ b/tests/baselines/reference/assignmentCompatWithGenericCallSignatures.js @@ -9,7 +9,11 @@ g = f; // ok //// [assignmentCompatWithGenericCallSignatures.js] // some complex cases of assignment compat of generic signatures that stress contextual signature instantiation -var f; -var g; + +var f +; +var g + +; f = g; // ok g = f; // ok diff --git a/tests/baselines/reference/assignmentCompatWithGenericCallSignatures2.js b/tests/baselines/reference/assignmentCompatWithGenericCallSignatures2.js index 057cbebb382..1a3441438ed 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 ae83c39f2a0..91cbce6694c 100644 --- a/tests/baselines/reference/assignmentCompatWithGenericCallSignatures3.js +++ b/tests/baselines/reference/assignmentCompatWithGenericCallSignatures3.js @@ -12,6 +12,11 @@ g = h // ok //// [assignmentCompatWithGenericCallSignatures3.js] // some complex cases of assignment compat of generic signatures that stress contextual signature instantiation -var g; -var h; + + +var g +; +var h + +; g = h; // ok diff --git a/tests/baselines/reference/assignmentCompatWithGenericCallSignatures4.js b/tests/baselines/reference/assignmentCompatWithGenericCallSignatures4.js index 6114e6fdb54..c27bb244ce0 100644 --- a/tests/baselines/reference/assignmentCompatWithGenericCallSignatures4.js +++ b/tests/baselines/reference/assignmentCompatWithGenericCallSignatures4.js @@ -15,8 +15,13 @@ y = x //// [assignmentCompatWithGenericCallSignatures4.js] // some complex cases of assignment compat of generic signatures. -var x; -var y; + + +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 x = y; y = x; diff --git a/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.js b/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.js index 78e657f5cb0..1e46d7d083d 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 6cdab6f3bed..0cff101c358 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer.js +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer.js @@ -58,16 +58,20 @@ 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; +var b +; a = b; b = a; // error -var b2; +var b2 +; a = b2; b2 = a; // error var Generics; @@ -78,21 +82,23 @@ var Generics; return A; }()); var B = /** @class */ (function (_super) { - __extends(B, _super); - function B() { + __extends(B, _super);function B() { return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); function foo() { var a; - var b; + var b + ; a = b; // error b = a; // error - var b2; + var b2 + ; a = b2; // error b2 = a; // error - var b3; + var b3 + ; a = b3; // ok b3 = a; // ok } diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer2.js b/tests/baselines/reference/assignmentCompatWithNumericIndexer2.js index 8af454eaf8d..4bfb7b8fb2c 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer2.js +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer2.js @@ -45,24 +45,34 @@ module Generics { //// [assignmentCompatWithNumericIndexer2.js] // Derived type indexer must be subtype of base type indexer + + + var a; -var b; +var b +; a = b; b = a; // error -var b2; +var b2 +; a = b2; b2 = a; // error var Generics; (function (Generics) { + + function foo() { var a; - var b; + var b + ; a = b; // error b = a; // error - var b2; + var b2 + ; a = b2; // error b2 = a; // error - var b3; + var b3 + ; a = b3; // ok b3 = a; // ok } diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js index 54eb5e3ac9b..d5610c4bfbe 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js @@ -55,6 +55,8 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); + + var A = /** @class */ (function () { function A() { } @@ -65,7 +67,7 @@ var b; a = b; // error b = a; // ok var B2 = /** @class */ (function (_super) { - __extends(B2, _super); + __extends(B2, _super);// ok function B2() { return _super !== null && _super.apply(this, arguments) || this; } diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers.js b/tests/baselines/reference/assignmentCompatWithObjectMembers.js index 2589f464c53..543ebc3b2da 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers.js @@ -91,37 +91,44 @@ 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 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 +138,44 @@ 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 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 08452e3d210..d758b674d0c 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers2.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers2.js @@ -45,38 +45,46 @@ 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 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 58c6321faa6..bfb017f2426 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers3.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers3.js @@ -45,38 +45,46 @@ 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 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 dd8d9d1bf46..d7f240af20a 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers4.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers4.js @@ -109,56 +109,60 @@ 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) { - __extends(Derived, _super); - function Derived() { + __extends(Derived, _super);function Derived() { return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = /** @class */ (function (_super) { - __extends(Derived2, _super); - function Derived2() { + __extends(Derived2, _super);function Derived2() { return _super !== null && _super.apply(this, arguments) || this; } 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 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 @@ -168,56 +172,60 @@ var OnlyDerived; var WithBase; (function (WithBase) { var Base = /** @class */ (function () { - function Base() { - } + function Base() {} return Base; }()); var Derived = /** @class */ (function (_super) { - __extends(Derived, _super); - function Derived() { + __extends(Derived, _super);function Derived() { return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = /** @class */ (function (_super) { - __extends(Derived2, _super); - function Derived2() { + __extends(Derived2, _super);function Derived2() { return _super !== null && _super.apply(this, arguments) || this; } 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 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 86302977ecb..c0ffd8e6a52 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 efe6857f933..c142c3048dd 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.js @@ -119,9 +119,12 @@ var TargetIsPublic; } return Base; }()); - var a; + + var a + ; var b; var i; + // sources var D = /** @class */ (function () { function D() { @@ -139,18 +142,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 +171,12 @@ var TargetIsPublic; } return Base; }()); - var a; + + var a + ; var b; var i; + // sources var D = /** @class */ (function () { function D() { @@ -184,20 +194,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 e021f3e22e6..4608d931bab 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersNumericNames.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersNumericNames.js @@ -45,38 +45,46 @@ 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 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 fa8ca3f7ad8..84cf6cef118 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js @@ -103,21 +103,19 @@ 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) { - __extends(Derived, _super); - function Derived() { + __extends(Derived, _super);function Derived() { return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = /** @class */ (function (_super) { - __extends(Derived2, _super); - function Derived2() { + __extends(Derived2, _super);function Derived2() { return _super !== null && _super.apply(this, arguments) || this; } return Derived2; @@ -125,8 +123,13 @@ var Derived2 = /** @class */ (function (_super) { var TargetHasOptional; (function (TargetHasOptional) { var c; - var a; - var b = { opt: new Base() }; + + var a + ; + var b = { opt: new Base() } + + ; + var d; var e; var f; @@ -135,10 +138,12 @@ var TargetHasOptional; c = e; c = f; c = a; + a = d; a = e; a = f; a = c; + b = d; b = e; b = f; @@ -148,8 +153,11 @@ var TargetHasOptional; var SourceHasOptional; (function (SourceHasOptional) { var c; - var a; + + var a + ; var b = { opt: new Base() }; + var d; var e; var f; @@ -157,10 +165,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 918c2739ace..5fcb126b9e9 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js @@ -106,21 +106,19 @@ 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) { - __extends(Derived, _super); - function Derived() { + __extends(Derived, _super);function Derived() { return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = /** @class */ (function (_super) { - __extends(Derived2, _super); - function Derived2() { + __extends(Derived2, _super);function Derived2() { return _super !== null && _super.apply(this, arguments) || this; } return Derived2; @@ -128,8 +126,13 @@ var Derived2 = /** @class */ (function (_super) { var TargetHasOptional; (function (TargetHasOptional) { var c; - var a; - var b = { opt: new Base() }; + + var a + ; + var b = { opt: new Base() } + + ; + var d; var e; var f; @@ -143,6 +146,7 @@ var TargetHasOptional; b = d; b = e; b = f; + // ok c = a; a = c; @@ -152,8 +156,11 @@ var TargetHasOptional; var SourceHasOptional; (function (SourceHasOptional) { var c; - var a; + + var a + ; var b = { opt: new Base() }; + var d; var e; var f; @@ -161,10 +168,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 30e81f3f19f..a387a9c6458 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersStringNumericNames.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersStringNumericNames.js @@ -91,37 +91,44 @@ 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 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 +138,45 @@ 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 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 8955dd40975..b1149f1d6ef 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 9a67a00bac0..5ce3dfc78a3 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer.js +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer.js @@ -68,16 +68,21 @@ 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; + +var b +; a = b; // ok b = a; // error -var b2; +var b2 +; a = b2; // ok b2 = a; // error var Generics; @@ -88,8 +93,7 @@ var Generics; return A; }()); var B = /** @class */ (function (_super) { - __extends(B, _super); - function B() { + __extends(B, _super);function B() { return _super !== null && _super.apply(this, arguments) || this; } return B; @@ -99,7 +103,7 @@ var Generics; a1 = b1; // ok b1 = a1; // error var B2 = /** @class */ (function (_super) { - __extends(B2, _super); + __extends(B2, _super);// error function B2() { return _super !== null && _super.apply(this, arguments) || this; } diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer2.js b/tests/baselines/reference/assignmentCompatWithStringIndexer2.js index 50fe7b3f8b9..81ff414b120 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer2.js +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer2.js @@ -55,19 +55,28 @@ module Generics { //// [assignmentCompatWithStringIndexer2.js] // index signatures must be compatible in assignments + + + var a; -var b; + +var b +; a = b; // ok b = a; // error -var b2; +var b2 +; 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 d3306949906..86463d3eb56 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer3.js +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer3.js @@ -25,8 +25,11 @@ module Generics { //// [assignmentCompatWithStringIndexer3.js] // Derived type indexer must be subtype of base type indexer + + var a; -var b1; +var b1 +; a = b1; // error b1 = a; // error var Generics; @@ -38,7 +41,8 @@ var Generics; }()); function foo() { var a; - var b; + var b + ; a = b; // error b = a; // error } 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 760631ffbb5..5c37619a700 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 2e61521eefb..a493262c580 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 7f757ef24c3..0bb3942f23a 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 363d41fc14d..dbb3747b732 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 85d2aab2c46..b291fbe305d 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 dd7f28cb003..9d33eea702f 100644 --- a/tests/baselines/reference/assignmentLHSIsValue.js +++ b/tests/baselines/reference/assignmentLHSIsValue.js @@ -86,6 +86,7 @@ var __extends = (this && this.__extends) || (function () { })(); // expected error for all the LHS of assignments var value; + // this var C = /** @class */ (function () { function C() { @@ -96,18 +97,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; @@ -115,13 +118,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); @@ -130,17 +132,21 @@ var Derived = /** @class */ (function (_super) { _super.prototype. = value; return _this; } + Derived.prototype.foo = function () { _super.prototype. = value; }; + Derived.sfoo = function () { _super. = value; }; return Derived; }(C)); // function expression -function bar() { } -value; -(function () { }); +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/assignmentNonObjectTypeConstraints.js b/tests/baselines/reference/assignmentNonObjectTypeConstraints.js index 35d6d7c1ff3..6b5e265d949 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 a7f554ade7d..1d0c857c236 100644 --- a/tests/baselines/reference/assignmentStricterConstraints.js +++ b/tests/baselines/reference/assignmentStricterConstraints.js @@ -12,7 +12,12 @@ g(1, "") //// [assignmentStricterConstraints.js] var f = function (x, y) { x = y; -}; -var g = function (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 d60e2de4a5a..a8e01f39277 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 543a54ca10e..d01923fe278 100644 --- a/tests/baselines/reference/assignmentToParenthesizedIdentifiers.js +++ b/tests/baselines/reference/assignmentToParenthesizedIdentifiers.js @@ -86,6 +86,7 @@ M.y = 3; // OK M.y = ''; // Error (M).y = ''; // Error (M.y) = ''; // Error + M = { y: 3 }; // Error (M) = { y: 3 }; // Error var M2; @@ -98,21 +99,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 b593240aec3..21d1f9bfd87 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,14 @@ 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/assignmentTypeNarrowing.js b/tests/baselines/reference/assignmentTypeNarrowing.js index 24a08539eb7..25c63c54e84 100644 --- a/tests/baselines/reference/assignmentTypeNarrowing.js +++ b/tests/baselines/reference/assignmentTypeNarrowing.js @@ -53,9 +53,14 @@ x; // string | boolean (_c = { y: 1 }.y, x = _c === void 0 ? /a/ : _c); x; // number | RegExp var a; + for (var _i = 0, a_1 = a; _i < a_1.length; _i++) { x = a_1[_i]; x; // string } + + + + var arr = [{ x: "ok" }]; // weak type arr.push({ x: "ok" }); diff --git a/tests/baselines/reference/assignments.js b/tests/baselines/reference/assignments.js index 81434900834..c2c599599f1 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,12 @@ 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 7684b413405..2ec6a0af626 100644 --- a/tests/baselines/reference/asyncAliasReturnType_es5.js +++ b/tests/baselines/reference/asyncAliasReturnType_es5.js @@ -5,6 +5,7 @@ async function f(): PromiseAlias { } //// [asyncAliasReturnType_es5.js] + function f() { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { diff --git a/tests/baselines/reference/asyncAliasReturnType_es6.js b/tests/baselines/reference/asyncAliasReturnType_es6.js index 45fe3228f6e..aa4cf8a38ca 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_es2017.js b/tests/baselines/reference/asyncArrowFunction10_es2017.js index 3fd29302a36..2c978b4ebaa 100644 --- a/tests/baselines/reference/asyncArrowFunction10_es2017.js +++ b/tests/baselines/reference/asyncArrowFunction10_es2017.js @@ -9,4 +9,5 @@ var foo = async (): Promise => { var foo = async () => { // Legal to use 'await' in a type context. var v; -}; +} +; diff --git a/tests/baselines/reference/asyncArrowFunction10_es5.js b/tests/baselines/reference/asyncArrowFunction10_es5.js index 5fc37de5f18..d2802b5b539 100644 --- a/tests/baselines/reference/asyncArrowFunction10_es5.js +++ b/tests/baselines/reference/asyncArrowFunction10_es5.js @@ -12,4 +12,5 @@ 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/asyncArrowFunction10_es6.js b/tests/baselines/reference/asyncArrowFunction10_es6.js index 78c8b64327f..69f725fbd15 100644 --- a/tests/baselines/reference/asyncArrowFunction10_es6.js +++ b/tests/baselines/reference/asyncArrowFunction10_es6.js @@ -9,4 +9,5 @@ var foo = async (): Promise => { var foo = () => __awaiter(this, void 0, void 0, function* () { // Legal to use 'await' in a type context. var v; -}); +}) +; diff --git a/tests/baselines/reference/asyncArrowFunction3_es5.js b/tests/baselines/reference/asyncArrowFunction3_es5.js index 3c73e6f9f58..a641571c146 100644 --- a/tests/baselines/reference/asyncArrowFunction3_es5.js +++ b/tests/baselines/reference/asyncArrowFunction3_es5.js @@ -3,6 +3,4 @@ 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 ac1e8801551..04aee43eadb 100644 --- a/tests/baselines/reference/asyncArrowFunction5_es5.js +++ b/tests/baselines/reference/asyncArrowFunction5_es5.js @@ -3,7 +3,6 @@ var foo = async (await): Promise => { } //// [asyncArrowFunction5_es5.js] -var foo = async(await), Promise; -; +var foo = async(await), Promise;; { } diff --git a/tests/baselines/reference/asyncArrowFunction7_es2017.js b/tests/baselines/reference/asyncArrowFunction7_es2017.js index 05c78887561..08762330ac4 100644 --- a/tests/baselines/reference/asyncArrowFunction7_es2017.js +++ b/tests/baselines/reference/asyncArrowFunction7_es2017.js @@ -9,5 +9,6 @@ var bar = async (): Promise => { var bar = async () => { // 'await' here is an identifier, and not an await expression. var foo = async (a = await ) => { - }; + } + ; }; diff --git a/tests/baselines/reference/asyncArrowFunction7_es6.js b/tests/baselines/reference/asyncArrowFunction7_es6.js index 45d9cb3643a..9e450b21632 100644 --- a/tests/baselines/reference/asyncArrowFunction7_es6.js +++ b/tests/baselines/reference/asyncArrowFunction7_es6.js @@ -9,5 +9,6 @@ var bar = async (): Promise => { var bar = () => __awaiter(this, void 0, void 0, function* () { // 'await' here is an identifier, and not an await expression. var foo = (a = yield ) => __awaiter(this, void 0, void 0, function* () { - }); + }) + ; }); diff --git a/tests/baselines/reference/asyncArrowFunction8_es2017.js b/tests/baselines/reference/asyncArrowFunction8_es2017.js index d5253c8b689..f9ec2939785 100644 --- a/tests/baselines/reference/asyncArrowFunction8_es2017.js +++ b/tests/baselines/reference/asyncArrowFunction8_es2017.js @@ -5,5 +5,6 @@ var foo = async (): Promise => { //// [asyncArrowFunction8_es2017.js] var foo = async () => { - var v = { [await ]: foo }; + var v = { [await ]: foo } + ; }; diff --git a/tests/baselines/reference/asyncArrowFunction8_es6.js b/tests/baselines/reference/asyncArrowFunction8_es6.js index 51ec4318c0a..20078090808 100644 --- a/tests/baselines/reference/asyncArrowFunction8_es6.js +++ b/tests/baselines/reference/asyncArrowFunction8_es6.js @@ -5,5 +5,6 @@ var foo = async (): Promise => { //// [asyncArrowFunction8_es6.js] var foo = () => __awaiter(this, void 0, void 0, function* () { - var v = { [yield ]: foo }; + var v = { [yield ]: foo } + ; }); diff --git a/tests/baselines/reference/asyncArrowFunction9_es5.js b/tests/baselines/reference/asyncArrowFunction9_es5.js index 457d5ddc4c4..24883a512d5 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 f9937c0dd63..a4f3390c82e 100644 --- a/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5.js +++ b/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5.js @@ -10,8 +10,7 @@ class C { //// [asyncArrowFunctionCapturesArguments_es5.js] var C = /** @class */ (function () { function C() { - } - C.prototype.method = 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) { diff --git a/tests/baselines/reference/asyncArrowFunctionCapturesThis_es5.js b/tests/baselines/reference/asyncArrowFunctionCapturesThis_es5.js index e475cbb1e3a..2c146192e92 100644 --- a/tests/baselines/reference/asyncArrowFunctionCapturesThis_es5.js +++ b/tests/baselines/reference/asyncArrowFunctionCapturesThis_es5.js @@ -9,8 +9,7 @@ class C { //// [asyncArrowFunctionCapturesThis_es5.js] var C = /** @class */ (function () { function C() { - } - C.prototype.method = 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) { diff --git a/tests/baselines/reference/asyncAwaitIsolatedModules_es2017.js b/tests/baselines/reference/asyncAwaitIsolatedModules_es2017.js index 065aa675b6e..cdaabb4f497 100644 --- a/tests/baselines/reference/asyncAwaitIsolatedModules_es2017.js +++ b/tests/baselines/reference/asyncAwaitIsolatedModules_es2017.js @@ -40,12 +40,18 @@ module M { } //// [asyncAwaitIsolatedModules_es2017.js] + + async function f0() { } async function f1() { } async function f3() { } -let f4 = async function () { }; -let f5 = async function () { }; -let f6 = async function () { }; +let f4 = async function () { } +; +let f5 = async function () { } +; +let f6 = async function () { } + +; let f7 = async () => { }; let f8 = async () => { }; let f9 = async () => { }; @@ -53,11 +59,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 ec3837911de..00fa58d094a 100644 --- a/tests/baselines/reference/asyncAwaitIsolatedModules_es5.js +++ b/tests/baselines/reference/asyncAwaitIsolatedModules_es5.js @@ -79,6 +79,8 @@ 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*/]; @@ -94,21 +96,27 @@ function f3() { return [2 /*return*/]; }); }); } + var f4 = function () { 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*/]; }); }); -}; +} +; var f6 = function () { 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*/]; }); }); }; @@ -130,6 +138,7 @@ 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) { @@ -147,10 +156,10 @@ var o = { }); }); } }; + var C = /** @class */ (function () { function C() { - } - C.prototype.m1 = function () { + }C.prototype.m1 = function () { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/]; }); }); diff --git a/tests/baselines/reference/asyncAwaitIsolatedModules_es6.js b/tests/baselines/reference/asyncAwaitIsolatedModules_es6.js index 015992805bc..1a460b6ef0c 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,15 +60,21 @@ function f1() { function f3() { return __awaiter(this, void 0, void 0, function* () { }); } + let f4 = function () { return __awaiter(this, void 0, void 0, function* () { }); -}; +} +; let f5 = function () { return __awaiter(this, void 0, void 0, 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 +82,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 +94,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 f72dda7bec2..0977ae93f20 100644 --- a/tests/baselines/reference/asyncAwaitNestedClasses_es5.js +++ b/tests/baselines/reference/asyncAwaitNestedClasses_es5.js @@ -23,16 +23,14 @@ var A = /** @class */ (function () { var _a; A.B = (_a = /** @class */ (function () { function B() { - } - B.func2 = function () { + }B.func2 = function () { return new Promise(function (resolve) { resolve(null); }); }; return B; }()), _a.C = /** @class */ (function () { function C() { - } - C.func = function () { + }C.func = function () { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_b) { switch (_b.label) { diff --git a/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.js b/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.js index 6d167a00089..5cde97c259f 100644 --- a/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.js +++ b/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.js @@ -70,6 +70,7 @@ function fn1() { }); }); } + function fn2() { return __awaiter(this, void 0, void 0, function () { var ar, _loop_2, i, state_1; @@ -106,6 +107,7 @@ function fn2() { }); }); } + function fn3() { return __awaiter(this, void 0, void 0, function () { var ar, _loop_3, i; @@ -140,6 +142,7 @@ function fn3() { }); }); } + function fn4() { return __awaiter(this, void 0, void 0, function () { var ar, _loop_4, i, state_2; diff --git a/tests/baselines/reference/asyncAwait_es2017.js b/tests/baselines/reference/asyncAwait_es2017.js index 70a4c63be2e..c0f1865fbd8 100644 --- a/tests/baselines/reference/asyncAwait_es2017.js +++ b/tests/baselines/reference/asyncAwait_es2017.js @@ -47,12 +47,17 @@ async function f14() { } //// [asyncAwait_es2017.js] + async function f0() { } async function f1() { } async function f3() { } -let f4 = async function () { }; -let f5 = async function () { }; -let f6 = async function () { }; +let f4 = async function () { } +; +let f5 = async function () { } +; +let f6 = async function () { } + +; let f7 = async () => { }; let f8 = async () => { }; let f9 = async () => { }; @@ -60,11 +65,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() { } @@ -78,6 +85,7 @@ var M; async function f1() { } M.f1 = f1; })(M || (M = {})); + async function f14() { block: { await 1; diff --git a/tests/baselines/reference/asyncAwait_es5.js b/tests/baselines/reference/asyncAwait_es5.js index 6a6433e85c6..43b0b4047d8 100644 --- a/tests/baselines/reference/asyncAwait_es5.js +++ b/tests/baselines/reference/asyncAwait_es5.js @@ -84,6 +84,7 @@ 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*/]; @@ -99,21 +100,27 @@ function f3() { return [2 /*return*/]; }); }); } + var f4 = function () { 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*/]; }); }); -}; +} +; var f6 = function () { 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*/]; }); }); }; @@ -135,6 +142,7 @@ 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) { @@ -152,10 +160,10 @@ var o = { }); }); } }; + var C = /** @class */ (function () { function C() { - } - C.prototype.m1 = function () { + }C.prototype.m1 = function () { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/]; }); }); diff --git a/tests/baselines/reference/asyncAwait_es6.js b/tests/baselines/reference/asyncAwait_es6.js index caab72bad9a..72887caa2ae 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,15 +66,21 @@ function f1() { function f3() { return __awaiter(this, void 0, void 0, function* () { }); } + let f4 = function () { return __awaiter(this, void 0, void 0, function* () { }); -}; +} +; let f5 = function () { return __awaiter(this, void 0, void 0, 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 +88,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 +100,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 e06a4bde5e4..e0617bc81e1 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_es2017.js b/tests/baselines/reference/asyncFunctionDeclaration10_es2017.js index f8a22204311..866e1301aaf 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration10_es2017.js +++ b/tests/baselines/reference/asyncFunctionDeclaration10_es2017.js @@ -3,6 +3,4 @@ async function foo(a = await => await): Promise { } //// [asyncFunctionDeclaration10_es2017.js] -async function foo(a = await ) { } -await; -Promise < void > {}; +async function foo(a = await ) { }await;Promise < void > {}; diff --git a/tests/baselines/reference/asyncFunctionDeclaration10_es5.js b/tests/baselines/reference/asyncFunctionDeclaration10_es5.js index 758bdab5dc9..ddb0e93e210 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration10_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration10_es5.js @@ -3,11 +3,9 @@ async function foo(a = await => await): Promise { } //// [asyncFunctionDeclaration10_es5.js] -function foo(a) { - if (a === void 0) { a = yield ; } +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*/]; }); }); } -await; -Promise < void > {}; +await;Promise < void > {}; diff --git a/tests/baselines/reference/asyncFunctionDeclaration10_es6.js b/tests/baselines/reference/asyncFunctionDeclaration10_es6.js index 1f175035bf0..f884d277021 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration10_es6.js +++ b/tests/baselines/reference/asyncFunctionDeclaration10_es6.js @@ -6,5 +6,4 @@ async function foo(a = await => await): Promise { function foo(a = yield ) { return __awaiter(this, void 0, void 0, function* () { }); } -await; -Promise < void > {}; +await;Promise < void > {}; diff --git a/tests/baselines/reference/asyncFunctionDeclaration12_es5.js b/tests/baselines/reference/asyncFunctionDeclaration12_es5.js index 19bca54f524..8ab24b54f3f 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration12_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration12_es5.js @@ -6,5 +6,4 @@ var v = function () { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/]; }); }); -}, await; -(function () { }); +}, await;(function () { }); diff --git a/tests/baselines/reference/asyncFunctionDeclaration12_es6.js b/tests/baselines/reference/asyncFunctionDeclaration12_es6.js index 17829af6f20..f4dd6742208 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration12_es6.js +++ b/tests/baselines/reference/asyncFunctionDeclaration12_es6.js @@ -4,5 +4,4 @@ var v = async function await(): Promise { } //// [asyncFunctionDeclaration12_es6.js] var v = function () { return __awaiter(this, void 0, void 0, function* () { }); -}, await; -() => { }; +}, await;() => { }; diff --git a/tests/baselines/reference/asyncFunctionDeclaration3_es5.js b/tests/baselines/reference/asyncFunctionDeclaration3_es5.js index 0bcc99b6bc7..0e1d8caf530 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration3_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration3_es5.js @@ -3,6 +3,4 @@ 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_es2017.js b/tests/baselines/reference/asyncFunctionDeclaration5_es2017.js index 904bbe62f0b..dac4d1a5ab0 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration5_es2017.js +++ b/tests/baselines/reference/asyncFunctionDeclaration5_es2017.js @@ -3,6 +3,4 @@ async function foo(await): Promise { } //// [asyncFunctionDeclaration5_es2017.js] -async function foo() { } -await; -Promise < void > {}; +async function foo() { }await;Promise < void > {}; diff --git a/tests/baselines/reference/asyncFunctionDeclaration5_es5.js b/tests/baselines/reference/asyncFunctionDeclaration5_es5.js index 5f8f8f42735..a3302c5f30f 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration5_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration5_es5.js @@ -8,5 +8,4 @@ function foo() { return [2 /*return*/]; }); }); } -await; -Promise < void > {}; +await;Promise < void > {}; diff --git a/tests/baselines/reference/asyncFunctionDeclaration5_es6.js b/tests/baselines/reference/asyncFunctionDeclaration5_es6.js index 9521b760415..468fc215be5 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration5_es6.js +++ b/tests/baselines/reference/asyncFunctionDeclaration5_es6.js @@ -6,5 +6,4 @@ async function foo(await): Promise { function foo() { return __awaiter(this, void 0, void 0, function* () { }); } -await; -Promise < void > {}; +await;Promise < void > {}; diff --git a/tests/baselines/reference/asyncFunctionDeclaration6_es5.js b/tests/baselines/reference/asyncFunctionDeclaration6_es5.js index 282036f97de..982f9c0af37 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration6_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration6_es5.js @@ -3,8 +3,7 @@ async function foo(a = await): Promise { } //// [asyncFunctionDeclaration6_es5.js] -function foo(a) { - if (a === void 0) { a = yield ; } +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 60dd0d6e3bf..3f00d168ad2 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration7_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration7_es5.js @@ -9,8 +9,7 @@ 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 ; } + 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/asyncFunctionDeclaration9_es2017.js b/tests/baselines/reference/asyncFunctionDeclaration9_es2017.js index 08cb8e44ba0..81b303f5d6b 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration9_es2017.js +++ b/tests/baselines/reference/asyncFunctionDeclaration9_es2017.js @@ -5,5 +5,6 @@ async function foo(): Promise { //// [asyncFunctionDeclaration9_es2017.js] async function foo() { - var v = { [await ]: foo }; + var v = { [await ]: foo } + ; } diff --git a/tests/baselines/reference/asyncFunctionDeclaration9_es6.js b/tests/baselines/reference/asyncFunctionDeclaration9_es6.js index c57c0eb395a..698be23bafd 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration9_es6.js +++ b/tests/baselines/reference/asyncFunctionDeclaration9_es6.js @@ -6,6 +6,7 @@ async function foo(): Promise { //// [asyncFunctionDeclaration9_es6.js] function foo() { return __awaiter(this, void 0, void 0, function* () { - var v = { [yield ]: foo }; + var v = { [yield ]: foo } + ; }); } diff --git a/tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5.js b/tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5.js index aa642819add..38d6abb29a2 100644 --- a/tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5.js @@ -12,8 +12,7 @@ class C { //// [asyncFunctionDeclarationCapturesArguments_es5.js] var C = /** @class */ (function () { function C() { - } - C.prototype.method = function () { + }C.prototype.method = function () { function other() { } function fn() { return __awaiter(this, arguments, void 0, function () { diff --git a/tests/baselines/reference/asyncFunctionNoReturnType.js b/tests/baselines/reference/asyncFunctionNoReturnType.js index 430210cbdbc..9e9f566e610 100644 --- a/tests/baselines/reference/asyncFunctionNoReturnType.js +++ b/tests/baselines/reference/asyncFunctionNoReturnType.js @@ -49,4 +49,5 @@ var _this = this; return [2 /*return*/]; return [2 /*return*/]; }); -}); }); +}); } +); diff --git a/tests/baselines/reference/asyncFunctionReturnExpressionErrorSpans.js b/tests/baselines/reference/asyncFunctionReturnExpressionErrorSpans.js index 887484e933a..1e827c97ed4 100644 --- a/tests/baselines/reference/asyncFunctionReturnExpressionErrorSpans.js +++ b/tests/baselines/reference/asyncFunctionReturnExpressionErrorSpans.js @@ -58,6 +58,7 @@ 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) { diff --git a/tests/baselines/reference/asyncFunctionReturnType.js b/tests/baselines/reference/asyncFunctionReturnType.js index 04b3a04a036..b82eb80947c 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 3a6da56c993..de3b921841e 100644 --- a/tests/baselines/reference/asyncFunctionTempVariableScoping.js +++ b/tests/baselines/reference/asyncFunctionTempVariableScoping.js @@ -53,15 +53,16 @@ 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; - var foo = _a.foo, bar = _a.bar, rest = __rest(_a, ["foo", "bar"]); - 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()])]; - } - }); -}); }); +( + + 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: + _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 055a751f523..52d34e6a0e8 100644 --- a/tests/baselines/reference/asyncFunctionWithForStatementNoInitializer.js +++ b/tests/baselines/reference/asyncFunctionWithForStatementNoInitializer.js @@ -60,8 +60,7 @@ 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() { +};function test1() { return __awaiter(this, void 0, void 0, function () { var i, limit; return __generator(this, function (_a) { @@ -73,6 +72,7 @@ function test1() { }); }); } + function test2() { return __awaiter(this, void 0, void 0, function () { var i, limit; @@ -85,6 +85,7 @@ function test2() { }); }); } + function test3() { return __awaiter(this, void 0, void 0, function () { var i; @@ -96,6 +97,7 @@ function test3() { }); }); } + function test4() { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { diff --git a/tests/baselines/reference/asyncFunctionsAndStrictNullChecks.js b/tests/baselines/reference/asyncFunctionsAndStrictNullChecks.js index a13f2f8b219..dd274280c93 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 e2096b4c6de..7acc44f55f4 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 b92065950fb..08e97bfbf42 100644 --- a/tests/baselines/reference/asyncImportNestedYield.js +++ b/tests/baselines/reference/asyncImportNestedYield.js @@ -42,8 +42,7 @@ 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() { +};function foo() { return __asyncGenerator(this, arguments, function foo_1() { return __generator(this, function (_a) { switch (_a.label) { diff --git a/tests/baselines/reference/asyncImportedPromise_es5.js b/tests/baselines/reference/asyncImportedPromise_es5.js index 7e8b5990238..debf8243002 100644 --- a/tests/baselines/reference/asyncImportedPromise_es5.js +++ b/tests/baselines/reference/asyncImportedPromise_es5.js @@ -27,13 +27,11 @@ var __extends = (this && this.__extends) || (function () { Object.defineProperty(exports, "__esModule", { value: true }); exports.Task = void 0; var Task = /** @class */ (function (_super) { - __extends(Task, _super); - function Task() { + __extends(Task, _super);function Task() { return _super !== null && _super.apply(this, arguments) || this; } return Task; -}(Promise)); -exports.Task = Task; +}(Promise));exports.Task = Task; //// [test.js] "use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { @@ -76,8 +74,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); var task_1 = require("./task"); var Test = /** @class */ (function () { function Test() { - } - Test.prototype.example = function () { + }Test.prototype.example = function () { return __awaiter(this, void 0, task_1.Task, function () { return __generator(this, function (_a) { return [2 /*return*/]; }); }); diff --git a/tests/baselines/reference/asyncImportedPromise_es6.js b/tests/baselines/reference/asyncImportedPromise_es6.js index 3ba87df2939..d59c181db23 100644 --- a/tests/baselines/reference/asyncImportedPromise_es6.js +++ b/tests/baselines/reference/asyncImportedPromise_es6.js @@ -13,9 +13,7 @@ class Test { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Task = void 0; -class Task extends Promise { -} -exports.Task = Task; +class Task extends Promise {}exports.Task = Task; //// [test.js] "use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { diff --git a/tests/baselines/reference/asyncMethodWithSuperConflict_es6.js b/tests/baselines/reference/asyncMethodWithSuperConflict_es6.js index 5e2a152b9e0..b1e52359209 100644 --- a/tests/baselines/reference/asyncMethodWithSuperConflict_es6.js +++ b/tests/baselines/reference/asyncMethodWithSuperConflict_es6.js @@ -90,14 +90,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 +115,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 4c5a7aa9866..832535ad75a 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,43 @@ 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 441ad8875c4..48492697823 100644 --- a/tests/baselines/reference/asyncMethodWithSuper_es5.js +++ b/tests/baselines/reference/asyncMethodWithSuper_es5.js @@ -58,16 +58,14 @@ class B extends A { //// [asyncMethodWithSuper_es5.js] var A = /** @class */ (function () { function A() { - } - A.prototype.x = function () { + }A.prototype.x = function () { }; A.prototype.y = function () { }; return A; }()); var B = /** @class */ (function (_super) { - __extends(B, _super); - function B() { + __extends(B, _super);function B() { return _super !== null && _super.apply(this, arguments) || this; } // async method with only call/get on 'super' does not require a binding @@ -79,6 +77,7 @@ var B = /** @class */ (function (_super) { _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,6 +86,7 @@ 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 () { @@ -95,16 +95,20 @@ var B = /** @class */ (function (_super) { 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 a5f216d221a..392f69f3726 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 392a4456cc2..0f2e5d97f12 100644 --- a/tests/baselines/reference/asyncMultiFile_es5.js +++ b/tests/baselines/reference/asyncMultiFile_es5.js @@ -41,8 +41,7 @@ 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() { +};function f() { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/]; }); }); diff --git a/tests/baselines/reference/asyncMultiFile_es6.js b/tests/baselines/reference/asyncMultiFile_es6.js index 7fbb00063c7..7bbd6b63aa3 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 601dc8b3c47..8f7b560c355 100644 --- a/tests/baselines/reference/asyncQualifiedReturnType_es5.js +++ b/tests/baselines/reference/asyncQualifiedReturnType_es5.js @@ -11,8 +11,7 @@ async function f(): X.MyPromise { var X; (function (X) { var MyPromise = /** @class */ (function (_super) { - __extends(MyPromise, _super); - function MyPromise() { + __extends(MyPromise, _super);function MyPromise() { return _super !== null && _super.apply(this, arguments) || this; } return MyPromise; diff --git a/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es2017.js b/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es2017.js index a3c73c5c1b5..8d8e02d49f7 100644 --- a/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es2017.js +++ b/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es2017.js @@ -4,5 +4,6 @@ const x = async i => await someOtherFunction(i) const x1 = async (i) => await someOtherFunction(i); //// [asyncUnParenthesizedArrowFunction_es2017.js] -const x = async (i) => await someOtherFunction(i); +const x = async (i) => await someOtherFunction(i) +; const x1 = async (i) => await someOtherFunction(i); diff --git a/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5.js b/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5.js index 93062b6feee..f5dde75d0a3 100644 --- a/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5.js +++ b/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5.js @@ -10,7 +10,8 @@ var x = function (i) { return __awaiter(_this, void 0, void 0, function () { ret 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)]; diff --git a/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es6.js b/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es6.js index dd5f793ae9d..7b60bc8612f 100644 --- a/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es6.js +++ b/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es6.js @@ -4,5 +4,7 @@ const x = async i => await someOtherFunction(i) const x1 = async (i) => await someOtherFunction(i); //// [asyncUnParenthesizedArrowFunction_es6.js] -const x = (i) => __awaiter(this, void 0, void 0, function* () { return yield someOtherFunction(i); }); +const x = (i) => __awaiter(this, void 0, void 0, function* () {return yield someOtherFunction(i); +}) +; const x1 = (i) => __awaiter(this, void 0, void 0, function* () { return yield someOtherFunction(i); }); diff --git a/tests/baselines/reference/asyncWithVarShadowing_es6.js b/tests/baselines/reference/asyncWithVarShadowing_es6.js index ecdffcd25a5..1165ceddb20 100644 --- a/tests/baselines/reference/asyncWithVarShadowing_es6.js +++ b/tests/baselines/reference/asyncWithVarShadowing_es6.js @@ -223,115 +223,135 @@ 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; }); } + function fn5(x) { var x; 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); }); } + function fn7(x) { var x; 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); }); } + function fn9(x) { var x; 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); }); } + function fn11(x) { var x; 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; }); } + function fn13(x) { var x; 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; }); } + function fn15(x) { var x; 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; }); } + function fn17(x) { var x; 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 +359,7 @@ function fn20(x) { } }); } + function fn21(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -346,6 +367,7 @@ function fn21(x) { } }); } + function fn22(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -355,6 +377,7 @@ function fn22(x) { } }); } + function fn23(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -364,6 +387,7 @@ function fn23(x) { } }); } + function fn24(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -373,6 +397,7 @@ function fn24(x) { } }); } + function fn25(x) { return __awaiter(this, void 0, void 0, function* () { try { @@ -382,6 +407,7 @@ function fn25(x) { } }); } + function fn26(x) { return __awaiter(this, void 0, void 0, function* () { try { @@ -391,6 +417,7 @@ function fn26(x) { } }); } + function fn27(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -400,6 +427,7 @@ function fn27(x) { } }); } + function fn28(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -407,6 +435,7 @@ function fn28(x) { } }); } + function fn29(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -414,6 +443,7 @@ function fn29(x) { } while (y); }); } + function fn30(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -421,6 +451,7 @@ function fn30(x) { } }); } + function fn31(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -428,6 +459,7 @@ function fn31(x) { } }); } + function fn32(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -435,6 +467,7 @@ function fn32(x) { } }); } + function fn33(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -442,6 +475,7 @@ function fn33(x) { } }); } + function fn34(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -449,6 +483,7 @@ function fn34(x) { } }); } + function fn35(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -456,6 +491,7 @@ function fn35(x) { } }); } + function fn36(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -463,6 +499,7 @@ function fn36(x) { } }); } + function fn37(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -470,6 +507,7 @@ function fn37(x) { } }); } + function fn38(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -478,6 +516,7 @@ function fn38(x) { } }); } + function fn39(x) { var x; return __awaiter(this, void 0, void 0, function* () { @@ -486,6 +525,7 @@ function fn39(x) { } }); } + function fn40(x) { var x; return __awaiter(this, void 0, void 0, function* () { diff --git a/tests/baselines/reference/augmentExportEquals4.js b/tests/baselines/reference/augmentExportEquals4.js index be6c6859ba7..ef373a2bde3 100644 --- a/tests/baselines/reference/augmentExportEquals4.js +++ b/tests/baselines/reference/augmentExportEquals4.js @@ -27,8 +27,7 @@ let b = x.b; define(["require", "exports"], function (require, exports) { "use strict"; var foo = /** @class */ (function () { - function foo() { - } + function foo() {} return foo; }()); (function (foo) { diff --git a/tests/baselines/reference/augmentExportEquals6.js b/tests/baselines/reference/augmentExportEquals6.js index 99c6c1602bd..6998b38eec4 100644 --- a/tests/baselines/reference/augmentExportEquals6.js +++ b/tests/baselines/reference/augmentExportEquals6.js @@ -31,20 +31,17 @@ let c = x.B.b; define(["require", "exports"], function (require, exports) { "use strict"; var foo = /** @class */ (function () { - function foo() { - } + 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; }); diff --git a/tests/baselines/reference/augmentedTypeAssignmentCompatIndexSignature.js b/tests/baselines/reference/augmentedTypeAssignmentCompatIndexSignature.js index 32fed237a2e..a6a836022d9 100644 --- a/tests/baselines/reference/augmentedTypeAssignmentCompatIndexSignature.js +++ b/tests/baselines/reference/augmentedTypeAssignmentCompatIndexSignature.js @@ -22,7 +22,12 @@ 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 8d2c94899dc..3ad88f8d947 100644 --- a/tests/baselines/reference/augmentedTypeBracketAccessIndexSignature.js +++ b/tests/baselines/reference/augmentedTypeBracketAccessIndexSignature.js @@ -14,5 +14,8 @@ 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 6ec653c69b5..cb5ce1642f1 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 01c39c98a1a..474ee027a72 100644 --- a/tests/baselines/reference/augmentedTypesClass.js +++ b/tests/baselines/reference/augmentedTypesClass.js @@ -10,17 +10,15 @@ enum c4 { One } // error //// [augmentedTypesClass.js] //// class then var var c1 = /** @class */ (function () { - function c1() { - } - c1.prototype.foo = function () { }; + function c1() {}c1.prototype.foo = function () { }; return c1; }()); var c1 = 1; // error + + //// class then enum var c4 = /** @class */ (function () { - function c4() { - } - c4.prototype.foo = function () { }; + function c4() {}c4.prototype.foo = function () { }; return c4; }()); (function (c4) { diff --git a/tests/baselines/reference/augmentedTypesClass2.js b/tests/baselines/reference/augmentedTypesClass2.js index a289446e53f..c8fba52103a 100644 --- a/tests/baselines/reference/augmentedTypesClass2.js +++ b/tests/baselines/reference/augmentedTypesClass2.js @@ -35,18 +35,17 @@ class c44 { // class then interface var c11 = /** @class */ (function () { function c11() { - } - c11.prototype.foo = function () { + }c11.prototype.foo = function () { return 1; }; return c11; }()); + // class then class - covered // class then enum var c33 = /** @class */ (function () { function c33() { - } - c33.prototype.foo = function () { + }c33.prototype.foo = function () { return 1; }; return c33; @@ -58,8 +57,7 @@ var c33 = /** @class */ (function () { // class then import var c44 = /** @class */ (function () { function c44() { - } - c44.prototype.foo = function () { + }c44.prototype.foo = function () { return 1; }; return c44; diff --git a/tests/baselines/reference/augmentedTypesClass2a.js b/tests/baselines/reference/augmentedTypesClass2a.js index cbda0bb2565..c9df612b9f8 100644 --- a/tests/baselines/reference/augmentedTypesClass2a.js +++ b/tests/baselines/reference/augmentedTypesClass2a.js @@ -7,9 +7,7 @@ var c2 = () => { } //// [augmentedTypesClass2a.js] //// class then function var c2 = /** @class */ (function () { - function c2() { - } - c2.prototype.foo = function () { }; + function c2() {}c2.prototype.foo = function () { }; return c2; }()); // error function c2() { } // error diff --git a/tests/baselines/reference/augmentedTypesClass3.js b/tests/baselines/reference/augmentedTypesClass3.js index 045109f8587..0ae0b73d0e2 100644 --- a/tests/baselines/reference/augmentedTypesClass3.js +++ b/tests/baselines/reference/augmentedTypesClass3.js @@ -16,34 +16,23 @@ class c5c { public foo() { } } //// [augmentedTypesClass3.js] // class then module var c5 = /** @class */ (function () { - function c5() { - } - c5.prototype.foo = function () { }; + function c5() {}c5.prototype.foo = function () { }; return c5; }()); + var c5a = /** @class */ (function () { - function c5a() { - } - c5a.prototype.foo = function () { }; + function c5a() {}c5a.prototype.foo = function () { }; return c5a; }()); -(function (c5a) { - var y = 2; -})(c5a || (c5a = {})); // should be ok +(function (c5a) {var y = 2;})(c5a || (c5a = {})); // should be ok var c5b = /** @class */ (function () { - function c5b() { - } - c5b.prototype.foo = function () { }; + 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() { - } - c5c.prototype.foo = function () { }; + function c5c() {}c5c.prototype.foo = function () { }; return c5c; }()); //import c5c = require(''); diff --git a/tests/baselines/reference/augmentedTypesClass4.js b/tests/baselines/reference/augmentedTypesClass4.js index 086748bad61..8fea3e499a5 100644 --- a/tests/baselines/reference/augmentedTypesClass4.js +++ b/tests/baselines/reference/augmentedTypesClass4.js @@ -7,14 +7,10 @@ class c3 { public bar() { } } // error //// [augmentedTypesClass4.js] //// class then class var c3 = /** @class */ (function () { - function c3() { - } - c3.prototype.foo = function () { }; + function c3() {}c3.prototype.foo = function () { }; return c3; }()); // error var c3 = /** @class */ (function () { - function c3() { - } - c3.prototype.bar = function () { }; + function c3() {}c3.prototype.bar = function () { }; return c3; }()); // error diff --git a/tests/baselines/reference/augmentedTypesEnum.js b/tests/baselines/reference/augmentedTypesEnum.js index edd4a92d767..dfec59e6465 100644 --- a/tests/baselines/reference/augmentedTypesEnum.js +++ b/tests/baselines/reference/augmentedTypesEnum.js @@ -52,16 +52,17 @@ var e3; (function (e3) { e3[e3["One"] = 0] = "One"; })(e3 || (e3 = {})); // error -var e3 = function () { }; // error +var e3 = function () { } + + +; // error // enum then class var e4; (function (e4) { e4[e4["One"] = 0] = "One"; })(e4 || (e4 = {})); // error var e4 = /** @class */ (function () { - function e4() { - } - e4.prototype.foo = function () { }; + function e4() {}e4.prototype.foo = function () { }; return e4; }()); // error // enum then enum @@ -88,16 +89,12 @@ var e6a; (function (e6a) { e6a[e6a["One"] = 0] = "One"; })(e6a || (e6a = {})); -(function (e6a) { - var y = 2; -})(e6a || (e6a = {})); // should be error +(function (e6a) {var y = 2;})(e6a || (e6a = {})); // should be error 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/augmentedTypesEnum2.js b/tests/baselines/reference/augmentedTypesEnum2.js index 0e6e70df263..68b0f0cdbba 100644 --- a/tests/baselines/reference/augmentedTypesEnum2.js +++ b/tests/baselines/reference/augmentedTypesEnum2.js @@ -34,7 +34,7 @@ var e2; ; // error var e2 = /** @class */ (function () { function e2() { - } + }// error e2.prototype.foo = function () { return 1; }; diff --git a/tests/baselines/reference/augmentedTypesEnum3.js b/tests/baselines/reference/augmentedTypesEnum3.js index 4df9dada530..503a02f9f5f 100644 --- a/tests/baselines/reference/augmentedTypesEnum3.js +++ b/tests/baselines/reference/augmentedTypesEnum3.js @@ -25,14 +25,10 @@ var E; (function (E) { var t; })(E || (E = {})); -(function (E) { -})(E || (E = {})); +(function (E) {})(E || (E = {})); var F; -(function (F) { -})(F || (F = {})); -(function (F) { - var t; -})(F || (F = {})); +(function (F) {})(F || (F = {})); +(function (F) {var t;})(F || (F = {})); var A; (function (A) { var o; diff --git a/tests/baselines/reference/augmentedTypesExternalModule1.js b/tests/baselines/reference/augmentedTypesExternalModule1.js index 4f4e90029a6..db1ffe2469f 100644 --- a/tests/baselines/reference/augmentedTypesExternalModule1.js +++ b/tests/baselines/reference/augmentedTypesExternalModule1.js @@ -10,9 +10,7 @@ define(["require", "exports"], function (require, exports) { exports.a = void 0; exports.a = 1; var c5 = /** @class */ (function () { - function c5() { - } - c5.prototype.foo = function () { }; + function c5() {}c5.prototype.foo = function () { }; return c5; }()); }); diff --git a/tests/baselines/reference/augmentedTypesFunction.js b/tests/baselines/reference/augmentedTypesFunction.js index a2dd4a664a3..ba12abffd3b 100644 --- a/tests/baselines/reference/augmentedTypesFunction.js +++ b/tests/baselines/reference/augmentedTypesFunction.js @@ -45,20 +45,21 @@ var y1 = 1; // error // function then function function y2() { } // error function y2() { } // error + function y2a() { } // error -var y2a = function () { }; // 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() { - } - y3a.prototype.foo = function () { }; + function y3a() {}y3a.prototype.foo = function () { }; return y3a; }()); // error // function then enum @@ -69,14 +70,13 @@ function y4() { } // error // function then internal module function y5() { } function y5a() { } -(function (y5a) { - var y = 2; -})(y5a || (y5a = {})); // should be an error +(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 0409e157584..5800835ef0b 100644 --- a/tests/baselines/reference/augmentedTypesInterface.js +++ b/tests/baselines/reference/augmentedTypesInterface.js @@ -35,10 +35,13 @@ interface i4 { //// [augmentedTypesInterface.js] // interface then interface + + + + var i2 = /** @class */ (function () { function i2() { - } - i2.prototype.bar = function () { + }i2.prototype.bar = function () { return 1; }; return i2; @@ -48,4 +51,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 c0bb1747e6d..7a79dc03e88 100644 --- a/tests/baselines/reference/augmentedTypesModules.js +++ b/tests/baselines/reference/augmentedTypesModules.js @@ -100,125 +100,87 @@ module m6 { export var y = 2; } //// [augmentedTypesModules.js] var m1 = 1; // Should be allowed var m1a; -(function (m1a) { - var y = 2; -})(m1a || (m1a = {})); // error +(function (m1a) {var y = 2;})(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() { - } - I.prototype.foo = function () { }; + 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) {var y = 2;})(m2a || (m2a = {})); +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() { - } - C.prototype.foo = function () { }; +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; -(function (m3a) { - var y = 2; -})(m3a || (m3a = {})); +(function (m3a) {var y = 2;})(m3a || (m3a = {})); var m3a = /** @class */ (function () { - function m3a() { - } - m3a.prototype.foo = function () { }; + function m3a() {}m3a.prototype.foo = function () { }; return m3a; }()); // error, class isn't ambient or declared before the module var m3b = /** @class */ (function () { - function m3b() { - } - m3b.prototype.foo = function () { }; + function m3b() {}m3b.prototype.foo = function () { }; return m3b; }()); -(function (m3b) { - var y = 2; -})(m3b || (m3b = {})); +(function (m3b) {var y = 2;})(m3b || (m3b = {})); var m3c = /** @class */ (function () { - function m3c() { - } - m3c.prototype.foo = function () { }; + 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() { - } - C.prototype.foo = function () { }; +(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; -})(m4a || (m4a = {})); +(function (m4a) {var y = 2;})(m4a || (m4a = {})); (function (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,11 +189,8 @@ var m4c; m4c[m4c["One"] = 0] = "One"; })(m4c || (m4c = {})); var m4d; -(function (m4d) { - var C = /** @class */ (function () { - function C() { - } - C.prototype.foo = function () { }; +(function (m4d) {var C = /** @class */ (function () { + function C() {}C.prototype.foo = function () { }; return C; }()); })(m4d || (m4d = {})); @@ -240,12 +199,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 995a85f3960..916e1c4de94 100644 --- a/tests/baselines/reference/augmentedTypesModules2.js +++ b/tests/baselines/reference/augmentedTypesModules2.js @@ -29,40 +29,24 @@ 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) {var y = 2;})(m2a || (m2a = {})); +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() { - } - C.prototype.foo = function () { }; +(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; }()); m2g.C = C; diff --git a/tests/baselines/reference/augmentedTypesModules3.js b/tests/baselines/reference/augmentedTypesModules3.js index 0537bd092b0..8bd5cb9508e 100644 --- a/tests/baselines/reference/augmentedTypesModules3.js +++ b/tests/baselines/reference/augmentedTypesModules3.js @@ -8,17 +8,12 @@ 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; -(function (m3a) { - var y = 2; -})(m3a || (m3a = {})); +(function (m3a) {var y = 2;})(m3a || (m3a = {})); var m3a = /** @class */ (function () { - function m3a() { - } - m3a.prototype.foo = function () { }; + 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 57957c13b80..fb752170faa 100644 --- a/tests/baselines/reference/augmentedTypesModules3b.js +++ b/tests/baselines/reference/augmentedTypesModules3b.js @@ -20,37 +20,24 @@ module m3g { export class C { foo() { } } } //// [augmentedTypesModules3b.js] var m3b = /** @class */ (function () { - function m3b() { - } - m3b.prototype.foo = function () { }; + function m3b() {}m3b.prototype.foo = function () { }; return m3b; }()); -(function (m3b) { - var y = 2; -})(m3b || (m3b = {})); +(function (m3b) {var y = 2;})(m3b || (m3b = {})); var m3c = /** @class */ (function () { - function m3c() { - } - m3c.prototype.foo = function () { }; + 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() { - } - C.prototype.foo = function () { }; +(function (m3g) {var C = /** @class */ (function () { + function C() {}C.prototype.foo = function () { }; return C; }()); m3g.C = C; diff --git a/tests/baselines/reference/augmentedTypesModules4.js b/tests/baselines/reference/augmentedTypesModules4.js index b7a776ca164..8510d7d5629 100644 --- a/tests/baselines/reference/augmentedTypesModules4.js +++ b/tests/baselines/reference/augmentedTypesModules4.js @@ -24,19 +24,14 @@ 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; -})(m4a || (m4a = {})); +(function (m4a) {var y = 2;})(m4a || (m4a = {})); (function (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,11 +40,8 @@ var m4c; m4c[m4c["One"] = 0] = "One"; })(m4c || (m4c = {})); var m4d; -(function (m4d) { - var C = /** @class */ (function () { - function C() { - } - C.prototype.foo = function () { }; +(function (m4d) {var C = /** @class */ (function () { + function C() {}C.prototype.foo = function () { }; return C; }()); })(m4d || (m4d = {})); @@ -58,6 +50,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 9945737410d..cd8161ec5f1 100644 --- a/tests/baselines/reference/augmentedTypesVar.js +++ b/tests/baselines/reference/augmentedTypesVar.js @@ -40,23 +40,26 @@ 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 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() { - } - x4a.prototype.foo = function () { }; + function x4a() {}x4a.prototype.foo = function () { }; return x4a; }()); // error // var then enum @@ -67,16 +70,13 @@ var x5; })(x5 || (x5 = {})); // error // var then module var x6 = 1; + var x6a = 1; // error var x6a; -(function (x6a) { - var y = 2; -})(x6a || (x6a = {})); // error since instantiated +(function (x6a) {var y = 2;})(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 002e320e853..83f933ca7b9 100644 --- a/tests/baselines/reference/autoLift2.js +++ b/tests/baselines/reference/autoLift2.js @@ -34,17 +34,20 @@ a.baz(); //// [autoLift2.js] var A = /** @class */ (function () { function A() { - this.foo; - any; - this.bar; - any; + this.foo;any; + this.bar;any; } + + 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; }()); diff --git a/tests/baselines/reference/autolift3.js b/tests/baselines/reference/autolift3.js index b7355aaef0e..6c51b1f2065 100644 --- a/tests/baselines/reference/autolift3.js +++ b/tests/baselines/reference/autolift3.js @@ -34,11 +34,13 @@ b.foo(); var B = /** @class */ (function () { function B() { function foo() { } + foo(); var a = 0; var inner = (function () { var CScriptIO = (function () { var fso = 0; + return { readFile: function (path) { return fso.toString(); diff --git a/tests/baselines/reference/autolift4.js b/tests/baselines/reference/autolift4.js index 53ce6dc9dc3..826e2c97783 100644 --- a/tests/baselines/reference/autolift4.js +++ b/tests/baselines/reference/autolift4.js @@ -50,11 +50,13 @@ var Point = /** @class */ (function () { }()); var Point3D = /** @class */ (function (_super) { __extends(Point3D, _super); + function Point3D(x, y, z, m) { var _this = _super.call(this, x, y) || this; _this.z = z; return _this; } + Point3D.prototype.getDist = function () { return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.m); }; diff --git a/tests/baselines/reference/avoid.js b/tests/baselines/reference/avoid.js index 5882fe6c3cc..95d13872426 100644 --- a/tests/baselines/reference/avoid.js +++ b/tests/baselines/reference/avoid.js @@ -23,16 +23,17 @@ 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; w = f(); // error void fn var C = /** @class */ (function () { function C() { - } - C.prototype.g = function () { + }C.prototype.g = function () { }; return C; }()); var z = new C().g(); // error void fn var N = new f(); // ok with void fn + diff --git a/tests/baselines/reference/awaitAndYieldInProperty.js b/tests/baselines/reference/awaitAndYieldInProperty.js index 238666278a8..e507c1cbbc8 100644 --- a/tests/baselines/reference/awaitAndYieldInProperty.js +++ b/tests/baselines/reference/awaitAndYieldInProperty.js @@ -27,14 +27,14 @@ async function* test(x) { this[_e] = await x; this[_g] = yield 2; } + } _e = await x, _f = await x, _g = yield 1, _h = yield 3; C[_f] = await x; C[_h] = yield 4; return C; })(); - return _e = class { - constructor() { + return _e = class {constructor() { this[_a] = await x; this[_c] = yield 2; } diff --git a/tests/baselines/reference/awaitBinaryExpression5_es5.js b/tests/baselines/reference/awaitBinaryExpression5_es5.js index 4e07e40a174..dc062664575 100644 --- a/tests/baselines/reference/awaitBinaryExpression5_es5.js +++ b/tests/baselines/reference/awaitBinaryExpression5_es5.js @@ -18,8 +18,7 @@ function func() { switch (_b.label) { case 0: before(); - _a = o; - return [4 /*yield*/, p]; + _a = o;return [4 /*yield*/, p]; case 1: _a.a = _b.sent(); after(); diff --git a/tests/baselines/reference/awaitCallExpression2_es5.js b/tests/baselines/reference/awaitCallExpression2_es5.js index d9c51e84822..915f4083434 100644 --- a/tests/baselines/reference/awaitCallExpression2_es5.js +++ b/tests/baselines/reference/awaitCallExpression2_es5.js @@ -21,8 +21,7 @@ function func() { switch (_b.label) { case 0: before(); - _a = fn; - return [4 /*yield*/, p]; + _a = fn;return [4 /*yield*/, p]; case 1: b = _a.apply(void 0, [_b.sent(), a, a]); after(); diff --git a/tests/baselines/reference/awaitCallExpression6_es5.js b/tests/baselines/reference/awaitCallExpression6_es5.js index 23def82fee7..4faa827c976 100644 --- a/tests/baselines/reference/awaitCallExpression6_es5.js +++ b/tests/baselines/reference/awaitCallExpression6_es5.js @@ -21,8 +21,7 @@ function func() { switch (_c.label) { case 0: before(); - _b = (_a = o).fn; - return [4 /*yield*/, p]; + _b = (_a = o).fn;return [4 /*yield*/, p]; case 1: b = _b.apply(_a, [_c.sent(), a, a]); after(); diff --git a/tests/baselines/reference/awaitClassExpression_es2017.js b/tests/baselines/reference/awaitClassExpression_es2017.js index d84f01f61cf..b28cf8d6c45 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 ecd98628c15..f89d75df7ab 100644 --- a/tests/baselines/reference/awaitClassExpression_es5.js +++ b/tests/baselines/reference/awaitClassExpression_es5.js @@ -8,6 +8,7 @@ async function func(): Promise { } //// [awaitClassExpression_es5.js] + function func() { return __awaiter(this, void 0, void 0, function () { var D, _a; @@ -15,8 +16,7 @@ function func() { switch (_b.label) { case 0: _a = function (_super) { - __extends(D, _super); - function D() { + __extends(D, _super);function D() { return _super !== null && _super.apply(this, arguments) || this; } return D; diff --git a/tests/baselines/reference/awaitClassExpression_es6.js b/tests/baselines/reference/awaitClassExpression_es6.js index 26740b9de6d..540f0988aa8 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 a9d3c38f5c6..1d4e01c6948 100644 --- a/tests/baselines/reference/awaitInClassInAsyncFunction.js +++ b/tests/baselines/reference/awaitInClassInAsyncFunction.js @@ -14,13 +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 83f75aa5633..4053d77f3fc 100644 --- a/tests/baselines/reference/awaitInNonAsyncFunction.js +++ b/tests/baselines/reference/awaitInNonAsyncFunction.js @@ -42,31 +42,39 @@ 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 cc5a06a0c19..9a53b0ee2f7 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 723339b9f71..af26907048f 100644 --- a/tests/baselines/reference/awaitUnionPromise.js +++ b/tests/baselines/reference/awaitUnionPromise.js @@ -58,12 +58,13 @@ 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 }; } }; + var AsyncEnumeratorDone = /** @class */ (function () { - function AsyncEnumeratorDone() { - } + function AsyncEnumeratorDone() {} return AsyncEnumeratorDone; }()); ; + function main() { return __awaiter(this, void 0, void 0, function () { var x, a, b, c, d; diff --git a/tests/baselines/reference/await_unaryExpression_es2017.js b/tests/baselines/reference/await_unaryExpression_es2017.js index f05bda125fc..a53e35bde6f 100644 --- a/tests/baselines/reference/await_unaryExpression_es2017.js +++ b/tests/baselines/reference/await_unaryExpression_es2017.js @@ -19,12 +19,18 @@ 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 49a3b34b172..7559b4463b9 100644 --- a/tests/baselines/reference/await_unaryExpression_es2017_1.js +++ b/tests/baselines/reference/await_unaryExpression_es2017_1.js @@ -23,15 +23,23 @@ 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 8978e460e7d..7b760ea7dd0 100644 --- a/tests/baselines/reference/await_unaryExpression_es2017_2.js +++ b/tests/baselines/reference/await_unaryExpression_es2017_2.js @@ -15,9 +15,13 @@ 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 b2a1593a9d0..906af06e40e 100644 --- a/tests/baselines/reference/await_unaryExpression_es2017_3.js +++ b/tests/baselines/reference/await_unaryExpression_es2017_3.js @@ -19,17 +19,21 @@ 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 69eef173613..8efa2bed3be 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 3a205f05ea9..d1c92934141 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 ee59f5825ae..d0af905222a 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 42643caa262..9a79fe384c9 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/badInferenceLowerPriorityThanGoodInference.js b/tests/baselines/reference/badInferenceLowerPriorityThanGoodInference.js index a089d4eb935..cccf89cf2af 100644 --- a/tests/baselines/reference/badInferenceLowerPriorityThanGoodInference.js +++ b/tests/baselines/reference/badInferenceLowerPriorityThanGoodInference.js @@ -25,12 +25,18 @@ goofus((a: string) => ({ dog: function() { return a; } })); //// [badInferenceLowerPriorityThanGoodInference.js] // Repro from #13118 + + + var result = canYouInferThis(function () { return ({ a: { BLAH: 33 }, b: function (x) { } -}); }); +}); }) + +; 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 d4ffc6731d1..39de3d69f2a 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/baseCheck.js b/tests/baselines/reference/baseCheck.js index 114bbf655e4..02b814b4281 100644 --- a/tests/baselines/reference/baseCheck.js +++ b/tests/baselines/reference/baseCheck.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 C = /** @class */ (function () { - function C(x, y) { - } +})();var C = /** @class */ (function () { + function C(x, y) {} return C; }()); var ELoc = /** @class */ (function (_super) { @@ -60,14 +58,14 @@ var ELocVar = /** @class */ (function (_super) { function ELocVar(x) { return _super.call(this, 0, loc) || this; } + ELocVar.prototype.m = function () { var loc = 10; }; return ELocVar; }(C)); var D = /** @class */ (function (_super) { - __extends(D, _super); - function D(z) { + __extends(D, _super);function D(z) { var _this = _super.call(this, _this.z) || this; _this.z = z; return _this; @@ -75,8 +73,7 @@ var D = /** @class */ (function (_super) { return D; }(C)); // too few params var E = /** @class */ (function (_super) { - __extends(E, _super); - function E(z) { + __extends(E, _super);function E(z) { var _this = _super.call(this, 0, _this.z) || this; _this.z = z; return _this; @@ -84,8 +81,7 @@ var E = /** @class */ (function (_super) { return E; }(C)); var F = /** @class */ (function (_super) { - __extends(F, _super); - function F(z) { + __extends(F, _super);function F(z) { var _this = _super.call(this, "hello", _this.z) || this; _this.z = z; return _this; diff --git a/tests/baselines/reference/baseClassImprovedMismatchErrors.js b/tests/baselines/reference/baseClassImprovedMismatchErrors.js index 2b864807570..0447afe4e21 100644 --- a/tests/baselines/reference/baseClassImprovedMismatchErrors.js +++ b/tests/baselines/reference/baseClassImprovedMismatchErrors.js @@ -31,29 +31,24 @@ 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 () { + }Base.prototype.fn = function () { return 10; }; return Base; }()); var Derived = /** @class */ (function (_super) { - __extends(Derived, _super); - function Derived() { + __extends(Derived, _super);function Derived() { return _super !== null && _super.apply(this, arguments) || this; - } - Derived.prototype.fn = function () { + }Derived.prototype.fn = function () { return 10; }; return Derived; }(Base)); var DerivedInterface = /** @class */ (function () { function DerivedInterface() { - } - DerivedInterface.prototype.fn = function () { + }DerivedInterface.prototype.fn = function () { return 10; }; return DerivedInterface; diff --git a/tests/baselines/reference/baseConstraintOfDecorator.js b/tests/baselines/reference/baseConstraintOfDecorator.js index 8b496c83a03..818d42d5270 100644 --- a/tests/baselines/reference/baseConstraintOfDecorator.js +++ b/tests/baselines/reference/baseConstraintOfDecorator.js @@ -39,8 +39,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]; } @@ -50,18 +49,16 @@ function classExtender(superClass, _instanceModifier) { } return decoratorFunc; }(superClass)); -} -exports.classExtender = classExtender; +}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]; } @@ -71,5 +68,4 @@ function classExtender2(superClass, _instanceModifier) { } return decoratorFunc; }(superClass)); -} -exports.classExtender2 = classExtender2; +}exports.classExtender2 = classExtender2; diff --git a/tests/baselines/reference/baseExpressionTypeParameters.js b/tests/baselines/reference/baseExpressionTypeParameters.js index aa16fcebf55..669dc5271ae 100644 --- a/tests/baselines/reference/baseExpressionTypeParameters.js +++ b/tests/baselines/reference/baseExpressionTypeParameters.js @@ -28,6 +28,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() { @@ -36,15 +37,15 @@ function base() { }()); return Base; } + var Gen = /** @class */ (function (_super) { - __extends(Gen, _super); - function Gen() { + __extends(Gen, _super);function Gen() { return _super !== null && _super.apply(this, arguments) || this; } return Gen; }(base())); // Error, T not in scope var Spec = /** @class */ (function (_super) { - __extends(Spec, _super); + __extends(Spec, _super);// Error, T not in scope function Spec() { return _super !== null && _super.apply(this, arguments) || this; } diff --git a/tests/baselines/reference/baseIndexSignatureResolution.js b/tests/baselines/reference/baseIndexSignatureResolution.js index 09aabe21ac4..2a555700149 100644 --- a/tests/baselines/reference/baseIndexSignatureResolution.js +++ b/tests/baselines/reference/baseIndexSignatureResolution.js @@ -37,21 +37,19 @@ 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) { - __extends(Derived, _super); - function Derived() { + __extends(Derived, _super);function Derived() { return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(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 c7cd84283c3..7095ffca584 100644 --- a/tests/baselines/reference/baseTypeAfterDerivedType.js +++ b/tests/baselines/reference/baseTypeAfterDerivedType.js @@ -17,11 +17,11 @@ 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 31fa3391af5..f0a17b155eb 100644 --- a/tests/baselines/reference/baseTypeOrderChecking.js +++ b/tests/baselines/reference/baseTypeOrderChecking.js @@ -49,16 +49,17 @@ 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() { } return Class1; }()); var Class2 = /** @class */ (function (_super) { - __extends(Class2, _super); - function Class2() { + __extends(Class2, _super);function Class2() { return _super !== null && _super.apply(this, arguments) || this; } return Class2; @@ -69,8 +70,7 @@ var Class3 = /** @class */ (function () { return Class3; }()); var Class4 = /** @class */ (function (_super) { - __extends(Class4, _super); - function Class4() { + __extends(Class4, _super);function Class4() { return _super !== null && _super.apply(this, arguments) || this; } return Class4; diff --git a/tests/baselines/reference/baseTypeWrappingInstantiationChain.js b/tests/baselines/reference/baseTypeWrappingInstantiationChain.js index de50a58205d..50f47b9c16e 100644 --- a/tests/baselines/reference/baseTypeWrappingInstantiationChain.js +++ b/tests/baselines/reference/baseTypeWrappingInstantiationChain.js @@ -40,23 +40,19 @@ 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) { - __extends(CBase, _super); - function CBase() { + __extends(CBase, _super);function CBase() { return _super !== null && _super.apply(this, arguments) || this; } return CBase; }(CBaseBase)); var Parameter = /** @class */ (function () { function Parameter() { - } - Parameter.prototype.method = function (t) { }; + }Parameter.prototype.method = function (t) { }; return Parameter; }()); var Wrapper = /** @class */ (function () { @@ -65,16 +61,15 @@ var Wrapper = /** @class */ (function () { return Wrapper; }()); var C = /** @class */ (function (_super) { - __extends(C, _super); - function C() { + __extends(C, _super);function C() { return _super !== null && _super.apply(this, arguments) || this; - } - C.prototype.works = function () { + }C.prototype.works = function () { new CBaseBase(this); }; 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 25cf4073d5c..3f5a80e10f2 100644 --- a/tests/baselines/reference/bases.js +++ b/tests/baselines/reference/bases.js @@ -34,10 +34,10 @@ 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; - any; + this.y;any; } return B; }()); @@ -45,8 +45,7 @@ var C = /** @class */ (function (_super) { __extends(C, _super); function C() { var _this = this; - _this.x; - any; + _this.x;any; return _this; } return C; diff --git a/tests/baselines/reference/bestChoiceType.js b/tests/baselines/reference/bestChoiceType.js index edd36f77be9..7fea97c2455 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 b755bf200a5..912e2c1a073 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js @@ -42,23 +42,22 @@ 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) { - __extends(Derived, _super); - function Derived() { + __extends(Derived, _super);function Derived() { return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = /** @class */ (function (_super) { - __extends(Derived2, _super); - function Derived2() { + __extends(Derived2, _super);function Derived2() { return _super !== null && _super.apply(this, arguments) || this; } return Derived2; @@ -66,6 +65,7 @@ var Derived2 = /** @class */ (function (_super) { var base; var derived; var derived2; + var r = true ? 1 : 2; var r3 = true ? 1 : {}; var r4 = true ? a : b; // typeof a @@ -75,6 +75,7 @@ var r7 = true ? function (x) { } : function (x) { }; var r8 = true ? function (x) { } : function (x) { }; // returns Object => void var r10 = true ? derived : derived2; // no error since we use the contextual type in BCT var r11 = true ? base : derived2; + function foo5(t, u) { return true ? t : u; // BCT is Object } diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js index b7afc3eee41..1943436cfec 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js @@ -40,21 +40,19 @@ 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) { - __extends(Derived, _super); - function Derived() { + __extends(Derived, _super);function Derived() { return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = /** @class */ (function (_super) { - __extends(Derived2, _super); - function Derived2() { + __extends(Derived2, _super);function Derived2() { return _super !== null && _super.apply(this, arguments) || this; } return Derived2; @@ -62,14 +60,18 @@ var Derived2 = /** @class */ (function (_super) { var base; var derived; var derived2; + var r2 = true ? 1 : ''; 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 81cfa752f5d..523ddc78b9d 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 a3672a76423..9d465691d1d 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple2.js +++ b/tests/baselines/reference/bestCommonTypeOfTuple2.js @@ -37,23 +37,19 @@ 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) { - __extends(F, _super); - function F() { + __extends(F, _super);function F() { return _super !== null && _super.apply(this, arguments) || this; } return F; @@ -65,8 +61,7 @@ var C1 = /** @class */ (function () { return C1; }()); var D1 = /** @class */ (function (_super) { - __extends(D1, _super); - function D1() { + __extends(D1, _super);function D1() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.i = "bar"; return _this; @@ -77,7 +72,10 @@ var t1; var t2; var t3; var t4; -var t5; +var t5 + +; + var e11 = t1[4]; // base var e21 = t2[4]; // {} var e31 = t3[4]; // C1 diff --git a/tests/baselines/reference/bestCommonTypeWithContextualTyping.js b/tests/baselines/reference/bestCommonTypeWithContextualTyping.js index c45ae88458f..df47de2c7ae 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 25622c3d4f3..dac306249e9 100644 --- a/tests/baselines/reference/bestCommonTypeWithOptionalProperties.js +++ b/tests/baselines/reference/bestCommonTypeWithOptionalProperties.js @@ -16,9 +16,11 @@ var b5 = [z, x, y]; var b6 = [z, y, x]; //// [bestCommonTypeWithOptionalProperties.js] + var x; var y; var z; + // All these arrays should be X[] var b1 = [x, y, z]; var b2 = [x, z, y]; diff --git a/tests/baselines/reference/betterErrorForAccidentalCall.js b/tests/baselines/reference/betterErrorForAccidentalCall.js index deb2b22d2f6..9e9ae09f808 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/bigintIndex.js b/tests/baselines/reference/bigintIndex.js index e24aee68dcf..ce2d9f2a049 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/bigintWithLib.js b/tests/baselines/reference/bigintWithLib.js index 13aeaa877e8..4bd936ddf9c 100644 --- a/tests/baselines/reference/bigintWithLib.js +++ b/tests/baselines/reference/bigintWithLib.js @@ -76,6 +76,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); @@ -87,6 +88,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); @@ -99,6 +101,7 @@ 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 diff --git a/tests/baselines/reference/bigintWithoutLib.js b/tests/baselines/reference/bigintWithoutLib.js index 31a59fcbaf0..65a878c6441 100644 --- a/tests/baselines/reference/bigintWithoutLib.js +++ b/tests/baselines/reference/bigintWithoutLib.js @@ -72,6 +72,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); diff --git a/tests/baselines/reference/binaryArithmeticControlFlowGraphNotTooLarge.js b/tests/baselines/reference/binaryArithmeticControlFlowGraphNotTooLarge.js index ab5cd46e599..805d96fad83 100644 --- a/tests/baselines/reference/binaryArithmeticControlFlowGraphNotTooLarge.js +++ b/tests/baselines/reference/binaryArithmeticControlFlowGraphNotTooLarge.js @@ -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,6 +2579,7 @@ 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; diff --git a/tests/baselines/reference/binaryIntegerLiteral.js b/tests/baselines/reference/binaryIntegerLiteral.js index 6f4270cf2b8..61a011ef51f 100644 --- a/tests/baselines/reference/binaryIntegerLiteral.js +++ b/tests/baselines/reference/binaryIntegerLiteral.js @@ -47,20 +47,27 @@ var bin1 = 26; var bin2 = 26; var bin3 = 9.671406556917009e+24; var bin4 = Infinity; + var obj1 = { 26: "Hello", a: bin1, bin1: bin1, b: 26, Infinity: true, -}; +} + +; + var obj2 = { 26: "World", a: bin2, bin2: bin2, 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 bfb85a241d3..dd27bc4d862 100644 --- a/tests/baselines/reference/binaryIntegerLiteralES6.js +++ b/tests/baselines/reference/binaryIntegerLiteralES6.js @@ -48,20 +48,27 @@ var bin1 = 0b11010; var bin2 = 0B11010; var bin3 = 0B11111111111111111111111111111111111111111111111101001010100000010111110001111111111; var bin4 = 0B111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101001010100000010111110001111111111; + var obj1 = { 0b11010: "Hello", a: bin1, bin1, b: 0b11010, 0B111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101001010100000010111110001111111111: true, -}; +} + +; + var obj2 = { 0B11010: "World", a: bin2, bin2, b: 0B11010, 0B11111111111111111111111111111111111111111111111101001010100000010111110001111111111: false, -}; +} + +; + obj1[0b11010]; // string obj1[26]; // string obj1["26"]; // string @@ -70,6 +77,7 @@ obj1["a"]; // number obj1["b"]; // number obj1["bin1"]; // number obj1["Infinity"]; // boolean + obj2[0B11010]; // string obj2[26]; // string obj2["26"]; // string @@ -80,3 +88,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 de83d56ab8e..218332fb871 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 7f903e39cf0..bb4b5dce037 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 27b3a59e81e..fc80a1ea564 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/binopAssignmentShouldHaveType.js b/tests/baselines/reference/binopAssignmentShouldHaveType.js index c5a0357c7ee..5de409a01fd 100644 --- a/tests/baselines/reference/binopAssignmentShouldHaveType.js +++ b/tests/baselines/reference/binopAssignmentShouldHaveType.js @@ -25,8 +25,7 @@ var Test; (function (Test) { var Bug = /** @class */ (function () { function Bug() { - } - Bug.prototype.getName = function () { + }Bug.prototype.getName = function () { return "name"; }; Bug.prototype.bug = function () { diff --git a/tests/baselines/reference/bitwiseNotOperatorInvalidOperations.js b/tests/baselines/reference/bitwiseNotOperatorInvalidOperations.js index 1b64091c048..81887778475 100644 --- a/tests/baselines/reference/bitwiseNotOperatorInvalidOperations.js +++ b/tests/baselines/reference/bitwiseNotOperatorInvalidOperations.js @@ -14,6 +14,7 @@ var b =~; //// [bitwiseNotOperatorInvalidOperations.js] // Unary operator ~ var q; + // operand before ~ var a = q; ~; //expect error diff --git a/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.js b/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.js index 8827aa2d57f..707c6acc9ee 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.js @@ -64,19 +64,21 @@ var ResultIsNumber20 = ~~~(ANY + ANY1); //// [bitwiseNotOperatorWithAnyOtherType.js] // ~ operator on any type + var ANY; var ANY1; var ANY2 = ["", ""]; -var obj; +var obj +; var obj1 = { x: "", y: function () { } }; + function foo() { var a; return a; } var A = /** @class */ (function () { function A() { - } - A.foo = function () { + }A.foo = function () { 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,6 +113,7 @@ 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); diff --git a/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js b/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js index 00766ee4303..c6fe7268f0a 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js @@ -41,27 +41,32 @@ var ResultIsNumber8 = ~~BOOLEAN; //// [bitwiseNotOperatorWithBooleanType.js] // ~ operator on boolean type var BOOLEAN; + function foo() { return true; } + var A = /** @class */ (function () { function A() { - } - A.foo = function () { return false; }; + }A.foo = function () { return false; }; return A; }()); 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 diff --git a/tests/baselines/reference/bitwiseNotOperatorWithEnumType.js b/tests/baselines/reference/bitwiseNotOperatorWithEnumType.js index 0bcf2fa3956..3541c1f9ce7 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithEnumType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithEnumType.js @@ -22,16 +22,16 @@ var ResultIsNumber4 = ~~~(ENUM1["A"] + ENUM1.B); // ~ operator on enum type var ENUM1; (function (ENUM1) { - ENUM1[ENUM1["A"] = 0] = "A"; - ENUM1[ENUM1["B"] = 1] = "B"; - ENUM1[ENUM1[""] = 2] = ""; + ENUM1[ENUM1["A"] = 0] = "A";ENUM1[ENUM1["B"] = 1] = "B";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 diff --git a/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js b/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js index d446532caf8..d6d1c911f8f 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js @@ -48,24 +48,28 @@ var ResultIsNumber13 = ~~~(NUMBER + NUMBER); // ~ operator on number type var NUMBER; var NUMBER1 = [1, 2]; + function foo() { return 1; } + var A = /** @class */ (function () { function A() { - } - A.foo = function () { return 1; }; + }A.foo = function () { return 1; }; return A; }()); 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 }; var ResultIsNumber5 = ~{ x: 1, y: function (n) { return n; } }; + // number type expressions var ResultIsNumber6 = ~objA.a; var ResultIsNumber7 = ~M.n; @@ -73,6 +77,7 @@ var ResultIsNumber8 = ~NUMBER1[0]; var ResultIsNumber9 = ~foo(); var ResultIsNumber10 = ~A.foo(); var ResultIsNumber11 = ~(NUMBER + NUMBER); + // multiple ~ operators var ResultIsNumber12 = ~~NUMBER; var ResultIsNumber13 = ~~~(NUMBER + NUMBER); diff --git a/tests/baselines/reference/bitwiseNotOperatorWithStringType.js b/tests/baselines/reference/bitwiseNotOperatorWithStringType.js index 481e75e3378..38a7aa69664 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithStringType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithStringType.js @@ -47,24 +47,28 @@ var ResultIsNumber14 = ~~~(STRING + STRING); // ~ operator on string type var STRING; var STRING1 = ["", "abc"]; + function foo() { return "abc"; } + var A = /** @class */ (function () { function A() { - } - A.foo = function () { return ""; }; + }A.foo = function () { return ""; }; return A; }()); 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: "" }; var ResultIsNumber5 = ~{ x: "", y: function (s) { return s; } }; + // string type expressions var ResultIsNumber6 = ~objA.a; var ResultIsNumber7 = ~M.n; @@ -73,6 +77,7 @@ 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); diff --git a/tests/baselines/reference/bivariantInferences.js b/tests/baselines/reference/bivariantInferences.js index a910ca15e93..02e9487b936 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/blockScopedBindingCaptureThisInFunction.js b/tests/baselines/reference/blockScopedBindingCaptureThisInFunction.js index 27568fd51ec..e3f9049ecf3 100644 --- a/tests/baselines/reference/blockScopedBindingCaptureThisInFunction.js +++ b/tests/baselines/reference/blockScopedBindingCaptureThisInFunction.js @@ -9,13 +9,15 @@ //// [blockScopedBindingCaptureThisInFunction.js] // https://github.com/Microsoft/TypeScript/issues/11038 -(function () { return function () { - var _loop_1 = function (someKey) { - this_1.helloWorld(); - (function () { return someKey; }); - }; - var this_1 = this; - for (var someKey in {}) { - _loop_1(someKey); - } -}; }); +( + function () { return function () { + var _loop_1 = function (someKey) { + this_1.helloWorld(); + ( + function () { return someKey; }); + }; + var this_1 = this; + for (var someKey in {}) { + _loop_1(someKey); + } + }; }); diff --git a/tests/baselines/reference/blockScopedBindingUsedBeforeDef.js b/tests/baselines/reference/blockScopedBindingUsedBeforeDef.js index adbba8ee8ae..33923e0a4d5 100644 --- a/tests/baselines/reference/blockScopedBindingUsedBeforeDef.js +++ b/tests/baselines/reference/blockScopedBindingUsedBeforeDef.js @@ -14,8 +14,10 @@ for (var _i = 0, _a = [{}]; _i < _a.length; _i++) { var _b = a, a = _a[_i][_b]; continue; } + // 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 21b47adf6c7..195bc8ab56e 100644 --- a/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.js +++ b/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.js @@ -44,8 +44,7 @@ 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) { diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop6.js b/tests/baselines/reference/blockScopedBindingsReassignedInLoop6.js index 584d8b21100..13c81885162 100644 --- a/tests/baselines/reference/blockScopedBindingsReassignedInLoop6.js +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop6.js @@ -53,6 +53,7 @@ function f1() { break; } } + function f2() { var _loop_2 = function (x, y) { var a = function () { return x++ + y++; }; @@ -76,3 +77,8 @@ function f2() { break; } } + + + + + diff --git a/tests/baselines/reference/blockScopedClassDeclarationAcrossFiles.js b/tests/baselines/reference/blockScopedClassDeclarationAcrossFiles.js index 6559548ddff..81a7733b720 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 552d099b07c..a8a84ccb775 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 239a87f0042..a6c74fe3772 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/blockScopedFunctionDeclarationInStrictClass.js b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass.js index e3a46770fd0..e0dd6fe52db 100644 --- a/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass.js +++ b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass.js @@ -12,8 +12,7 @@ class c { //// [blockScopedFunctionDeclarationInStrictClass.js] var c = /** @class */ (function () { function c() { - } - c.prototype.method = function () { + }c.prototype.method = function () { if (true) { function foo() { } foo(); // ok diff --git a/tests/baselines/reference/blockScopedNamespaceDifferentFile.js b/tests/baselines/reference/blockScopedNamespaceDifferentFile.js index 1ddb284f55c..488551e1b51 100644 --- a/tests/baselines/reference/blockScopedNamespaceDifferentFile.js +++ b/tests/baselines/reference/blockScopedNamespaceDifferentFile.js @@ -25,8 +25,7 @@ declare namespace A { var C; (function (C) { var Name = /** @class */ (function () { - function Name(parameters) { - } + 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 9ca3f8998a2..a1537f241f4 100644 --- a/tests/baselines/reference/blockScopedVariablesUseBeforeDef.js +++ b/tests/baselines/reference/blockScopedVariablesUseBeforeDef.js @@ -109,42 +109,47 @@ 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() { - } - X.prototype.m = function () { return x; }; + }X.prototype.m = function () { return x; }; return X; }()); var x; } + function foo4() { var y = /** @class */ (function () { function y() { - } - y.prototype.m = function () { return x; }; + }y.prototype.m = function () { return x; }; return y; }()); 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,15 +159,18 @@ function foo7() { }()); var x; } + function foo8() { var y = /** @class */ (function () { function class_1() { this.a = x; } return class_1; - }()); + }()) + ; var x; } + function foo9() { var _a; var y = (_a = /** @class */ (function () { @@ -171,9 +179,11 @@ function foo9() { return class_2; }()), _a.a = x, - _a); + _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; @@ -192,10 +203,12 @@ function foo11() { return class_3; }()), _a.a = x, - _a); + _a) + ; } var x; } + function foo12() { function f() { var y = /** @class */ (function () { @@ -203,16 +216,19 @@ function foo12() { this.a = x; } return class_4; - }()); + }()) + ; } 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 1d8d8f2ec43..fb6c70b27c9 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 573367a4293..daf77d119b1 100644 --- a/tests/baselines/reference/booleanAssignment.js +++ b/tests/baselines/reference/booleanAssignment.js @@ -19,6 +19,7 @@ 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 2cd319ca440..c24a0388c79 100644 --- a/tests/baselines/reference/booleanFilterAnyArray.js +++ b/tests/baselines/reference/booleanFilterAnyArray.js @@ -26,12 +26,19 @@ 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; }); -var foos; -var foos = [true, true, false, null].filter(function (thing) { return thing !== null; }); +var foor +; +var foor = foo.filter(function (x) { return x.name; }) +; +var foos +; +var foos = [true, true, false, null].filter(function (thing) { return thing !== null; }) +; diff --git a/tests/baselines/reference/booleanLiteralTypes1.js b/tests/baselines/reference/booleanLiteralTypes1.js index 6fb0244ac68..a4b70ae9926 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 19bac7c362c..b99de6431ca 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 cf590eeaaaf..c39964a9aa3 100644 --- a/tests/baselines/reference/booleanLiteralsContextuallyTypedFromUnion.js +++ b/tests/baselines/reference/booleanLiteralsContextuallyTypedFromUnion.js @@ -26,13 +26,32 @@ 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 Fail1 = function () { return ; +} +; +var Fail2 = function () { return ; +} +; var True = true; -var Fail3 = function () { return ; }; -var attrs2 = { optionalBool: true, mandatoryFn: function () { } }; +var Fail3 = function () { return ; +} +; +var attrs2 = { optionalBool: true, mandatoryFn: function () { } } +; var Success = function () { return ; }; diff --git a/tests/baselines/reference/booleanPropertyAccess.js b/tests/baselines/reference/booleanPropertyAccess.js index 5d816253c37..b65e428e995 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/callChain.2.js b/tests/baselines/reference/callChain.2.js index 89070f41003..541412b9997 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 b34458a26e7..b59fab8ca9e 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 13fb9c717a3..c32bb8c622c 100644 --- a/tests/baselines/reference/callChain.js +++ b/tests/baselines/reference/callChain.js @@ -55,6 +55,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, __spreadArrays([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]); @@ -63,6 +64,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, __spreadArrays([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, __spreadArrays([o3], [1, 2])).c; @@ -75,8 +77,11 @@ o2 === null || o2 === void 0 ? void 0 : o2["b"].apply(o2, __spreadArrays([1], [2 (_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, __spreadArrays([o3], [1, 2])).c; (_m = o3["b"]) === null || _m === void 0 ? void 0 : _m.call.apply(_m, __spreadArrays([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 fcfbb5db553..dd997e762c6 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 fcfbb5db553..dd997e762c6 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 fcfbb5db553..dd997e762c6 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 fcfbb5db553..dd997e762c6 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 30e1ad3886d..d1913608f87 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 5487991bc29..5d966f0e8c1 100644 --- a/tests/baselines/reference/callChainWithSuper(target=es5).js +++ b/tests/baselines/reference/callChainWithSuper(target=es5).js @@ -23,17 +23,13 @@ var __extends = (this && this.__extends) || (function () { })(); // GH#34952 var Base = /** @class */ (function () { - function Base() { - } - Base.prototype.method = function () { }; + function Base() {}Base.prototype.method = function () { }; return Base; }()); var Derived = /** @class */ (function (_super) { - __extends(Derived, _super); - function Derived() { + __extends(Derived, _super);function Derived() { return _super !== null && _super.apply(this, arguments) || this; - } - Derived.prototype.method1 = function () { var _a; return (_a = _super.prototype.method) === null || _a === void 0 ? void 0 : _a.call(this); }; + }Derived.prototype.method1 = function () { var _a; return (_a = _super.prototype.method) === null || _a === void 0 ? void 0 : _a.call(this); }; Derived.prototype.method2 = function () { var _a; return (_a = _super.prototype["method"]) === null || _a === void 0 ? void 0 : _a.call(this); }; return Derived; }(Base)); diff --git a/tests/baselines/reference/callChainWithSuper(target=es6).js b/tests/baselines/reference/callChainWithSuper(target=es6).js index fcfbb5db553..dd997e762c6 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 30e1ad3886d..d1913608f87 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 3266df5314b..4a17e4dcb0a 100644 --- a/tests/baselines/reference/callConstructAssignment.js +++ b/tests/baselines/reference/callConstructAssignment.js @@ -7,7 +7,12 @@ foo = bar; // error bar = foo; // error //// [callConstructAssignment.js] -var foo; -var bar; +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 3f5fb14b1a9..67b14a9fad1 100644 --- a/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.js +++ b/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.js @@ -47,38 +47,45 @@ 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 f2 = function (x, y) { return null; } +; var r2 = f2(1, ''); var r2b = f2(1, ''); -var f3; + +var f3 +; var r3 = f3(1, ''); var r3b = f3(1, ''); + var C = /** @class */ (function () { function C() { - } - C.prototype.f = function (x, y) { + }C.prototype.f = function (x, y) { return null; }; return C; }()); 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() { - } - C2.prototype.f = function (x, y) { + }C2.prototype.f = function (x, y) { return null; }; return C2; }()); 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 fd46b841a02..48973925995 100644 --- a/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.js +++ b/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.js @@ -38,31 +38,38 @@ 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; }; + +var f2 = function (x) { return null; } +; var r2 = f2(1); -var f3; + +var f3 +; var r3 = f3(1); + var C = /** @class */ (function () { function C() { - } - C.prototype.f = function (x) { + }C.prototype.f = function (x) { return null; }; return C; }()); var r4 = (new C()).f(1); + var i; var r5 = i.f(1); + var C2 = /** @class */ (function () { function C2() { - } - C2.prototype.f = function (x) { + }C2.prototype.f = function (x) { return null; }; return C2; }()); var r6 = (new C2()).f(1); + var i2; var r7 = i2.f(1); diff --git a/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.js b/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.js index b94a3208c5c..823c09ccc0a 100644 --- a/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.js +++ b/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.js @@ -46,35 +46,44 @@ 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 f2 = function (x) { return null; } +; var r2 = f2(1); -var f3; + +var f3 +; var r3 = f3(1); + var C = /** @class */ (function () { function C() { - } - C.prototype.f = function (x) { + }C.prototype.f = function (x) { return null; }; return C; }()); var r4 = (new C()).f(1); + var i; var r5 = i.f(1); + var C2 = /** @class */ (function () { function C2() { - } - C2.prototype.f = function (x) { + }C2.prototype.f = function (x) { return null; }; 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 1a6333945b7..59b636770f5 100644 --- a/tests/baselines/reference/callOnClass.js +++ b/tests/baselines/reference/callOnClass.js @@ -6,8 +6,8 @@ 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 3b07d0affc8..30a5efc2a28 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/callOverloadViaElementAccessExpression.js b/tests/baselines/reference/callOverloadViaElementAccessExpression.js index 9dc20656786..4787de1338b 100644 --- a/tests/baselines/reference/callOverloadViaElementAccessExpression.js +++ b/tests/baselines/reference/callOverloadViaElementAccessExpression.js @@ -14,8 +14,7 @@ var r2: number = c['foo'](''); //// [callOverloadViaElementAccessExpression.js] var C = /** @class */ (function () { function C() { - } - C.prototype.foo = function (x) { + }C.prototype.foo = function (x) { return null; }; return C; diff --git a/tests/baselines/reference/callOverloads1.js b/tests/baselines/reference/callOverloads1.js index ac5a15d953c..1d4322afc96 100644 --- a/tests/baselines/reference/callOverloads1.js +++ b/tests/baselines/reference/callOverloads1.js @@ -21,11 +21,12 @@ Foo(); var Foo = /** @class */ (function () { function Foo(x) { // WScript.Echo("Constructor function has executed"); - } + }// error Foo.prototype.bar1 = function () { }; return Foo; }()); 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 ee1300ee5de..dc30053e429 100644 --- a/tests/baselines/reference/callOverloads2.js +++ b/tests/baselines/reference/callOverloads2.js @@ -27,12 +27,16 @@ Foo(); var Foo = /** @class */ (function () { function Foo(x) { // WScript.Echo("Constructor function has executed"); - } + }// error 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 f2f3498c831..cae28b80dcd 100644 --- a/tests/baselines/reference/callOverloads3.js +++ b/tests/baselines/reference/callOverloads3.js @@ -21,7 +21,7 @@ Foo("s"); var Foo = /** @class */ (function () { function Foo(x) { // WScript.Echo("Constructor function has executed"); - } + }// error Foo.prototype.bar1 = function () { }; return Foo; }()); diff --git a/tests/baselines/reference/callOverloads4.js b/tests/baselines/reference/callOverloads4.js index 60757da34bd..6f644eabf56 100644 --- a/tests/baselines/reference/callOverloads4.js +++ b/tests/baselines/reference/callOverloads4.js @@ -21,7 +21,7 @@ Foo("s"); var Foo = /** @class */ (function () { function Foo(x) { // WScript.Echo("Constructor function has executed"); - } + }// error Foo.prototype.bar1 = function () { }; return Foo; }()); diff --git a/tests/baselines/reference/callOverloads5.js b/tests/baselines/reference/callOverloads5.js index 4ccc1f5ea26..eb067d9a393 100644 --- a/tests/baselines/reference/callOverloads5.js +++ b/tests/baselines/reference/callOverloads5.js @@ -23,8 +23,7 @@ Foo("s"); var Foo = /** @class */ (function () { function Foo(x) { // WScript.Echo("Constructor function has executed"); - } - Foo.prototype.bar1 = function (a) { }; + }Foo.prototype.bar1 = function (a) { }; return Foo; }()); //class Foo(s: String); diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance.js index 3b540397d55..96d007bb4b7 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 e139bcca598..ab3140dcee5 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js @@ -84,29 +84,27 @@ 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) { - __extends(Derived, _super); - function Derived() { + __extends(Derived, _super);function Derived() { return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = /** @class */ (function (_super) { - __extends(Derived2, _super); - function Derived2() { + __extends(Derived2, _super);function Derived2() { return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = /** @class */ (function (_super) { - __extends(OtherDerived, _super); - function OtherDerived() { + __extends(OtherDerived, _super);function OtherDerived() { return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); + diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js index b8a024a8a09..d73b261bea6 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js @@ -132,29 +132,26 @@ 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) { - __extends(Derived, _super); - function Derived() { + __extends(Derived, _super);function Derived() { return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = /** @class */ (function (_super) { - __extends(Derived2, _super); - function Derived2() { + __extends(Derived2, _super);function Derived2() { return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = /** @class */ (function (_super) { - __extends(OtherDerived, _super); - function OtherDerived() { + __extends(OtherDerived, _super);function OtherDerived() { return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); + })(Errors || (Errors = {})); diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js index a969d77fb03..f464b6ff799 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js @@ -64,29 +64,27 @@ 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) { - __extends(Derived, _super); - function Derived() { + __extends(Derived, _super);function Derived() { return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = /** @class */ (function (_super) { - __extends(Derived2, _super); - function Derived2() { + __extends(Derived2, _super);function Derived2() { return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = /** @class */ (function (_super) { - __extends(OtherDerived, _super); - function OtherDerived() { + __extends(OtherDerived, _super);function OtherDerived() { return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); + diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js index cf8889cbf27..45356892fc2 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js @@ -64,29 +64,28 @@ 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) { - __extends(Derived, _super); - function Derived() { + __extends(Derived, _super);function Derived() { return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = /** @class */ (function (_super) { - __extends(Derived2, _super); - function Derived2() { + __extends(Derived2, _super);function Derived2() { return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = /** @class */ (function (_super) { - __extends(OtherDerived, _super); - function OtherDerived() { + __extends(OtherDerived, _super);function OtherDerived() { return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); + + diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js index baa98cb72d5..df1c676bef3 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js @@ -67,29 +67,33 @@ 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) { - __extends(Derived, _super); - function Derived() { + __extends(Derived, _super);function Derived() { return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = /** @class */ (function (_super) { - __extends(Derived2, _super); - function Derived2() { + __extends(Derived2, _super);function Derived2() { return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = /** @class */ (function (_super) { - __extends(OtherDerived, _super); - function OtherDerived() { + __extends(OtherDerived, _super);function OtherDerived() { return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); + + + + + + + diff --git a/tests/baselines/reference/callSignatureFunctionOverload.js b/tests/baselines/reference/callSignatureFunctionOverload.js index 6da28693bce..35e5a87e282 100644 --- a/tests/baselines/reference/callSignatureFunctionOverload.js +++ b/tests/baselines/reference/callSignatureFunctionOverload.js @@ -15,5 +15,9 @@ var foo2: { //// [callSignatureFunctionOverload.js] -var foo; -var foo2; +var foo + +; + +var foo2 +; diff --git a/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.js b/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.js index 4ff80937919..407d7d1ec9a 100644 --- a/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.js +++ b/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.js @@ -57,15 +57,13 @@ 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); @@ -74,36 +72,32 @@ f2(1); 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); i.foo(1); i.foo(1, 2); -var a; +var a + +; a(); 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); b.a(1); diff --git a/tests/baselines/reference/callSignatureWithoutAnnotationsOrBody.js b/tests/baselines/reference/callSignatureWithoutAnnotationsOrBody.js index 24c71c98505..1f9c83270c7 100644 --- a/tests/baselines/reference/callSignatureWithoutAnnotationsOrBody.js +++ b/tests/baselines/reference/callSignatureWithoutAnnotationsOrBody.js @@ -23,9 +23,11 @@ var r5 = a.f(); // 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; var r2 = i(); var r3 = i.f(); + var a; var r4 = a(); var r5 = a.f(); diff --git a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js index 9ecceb3ff4f..ede76e62719 100644 --- a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js +++ b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js @@ -135,6 +135,7 @@ function foo3() { return foo3(); } var r3 = foo3(); + function foo4(x) { return x; } @@ -163,16 +164,19 @@ function foo7(x) { return typeof x; } var r7 = foo7(1); + // object types function foo8(x) { return { x: x }; } var r8 = foo8(1); + function foo9(x) { var i; return i; } var r9 = foo9(1); + var C = /** @class */ (function () { function C() { } @@ -187,8 +191,7 @@ var M; (function (M) { M.x = 1; var C = /** @class */ (function () { - function C() { - } + function C() {} return C; }()); M.C = C; @@ -197,22 +200,21 @@ function foo11() { return M; } var r11 = foo11(); + function foo12() { var i2; 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 +228,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 b2cf7d5f5c5..d6124c21f17 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 8d5b59f84d1..9f732c2e67e 100644 --- a/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType.js +++ b/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType.js @@ -29,5 +29,11 @@ var a2: { } //// [callSignaturesThatDifferOnlyByReturnType.js] -var a; + + + +var a + +; + var a2; diff --git a/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.js b/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.js index ae6f4db7e38..011ce2512a5 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 b67b619d739..a3b36513e6e 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 e2a3599f0da..fc79bc8d944 100644 --- a/tests/baselines/reference/callSignaturesWithAccessibilityModifiersOnParameters.js +++ b/tests/baselines/reference/callSignaturesWithAccessibilityModifiersOnParameters.js @@ -40,25 +40,39 @@ 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) { }; +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 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() { - } - C.prototype.foo = function (x, y) { }; + }C.prototype.foo = function (x, y) { }; C.prototype.foo2 = function (x, y) { }; 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 ed9d2cb3e35..31f87dc85dc 100644 --- a/tests/baselines/reference/callSignaturesWithDuplicateParameters.js +++ b/tests/baselines/reference/callSignaturesWithDuplicateParameters.js @@ -43,22 +43,33 @@ var b = { 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) { }; +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 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() { - } - C.prototype.foo = function (x, x) { }; + }C.prototype.foo = function (x, x) { }; C.prototype.foo2 = function (x, x) { }; 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 1a5aad8c0e1..f67d22cfd9c 100644 --- a/tests/baselines/reference/callSignaturesWithOptionalParameters.js +++ b/tests/baselines/reference/callSignaturesWithOptionalParameters.js @@ -57,9 +57,13 @@ 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) { }; +var f = function foo(x) { } +; +var f2 = function (x, y) { } + +; foo(1); foo(); f(1); @@ -68,19 +72,21 @@ f2(1); f2(1, 2); var C = /** @class */ (function () { function C() { - } - C.prototype.foo = function (x) { }; + }C.prototype.foo = function (x) { }; return C; }()); var c; c.foo(); c.foo(1); + var i; i(); i(1); i.foo(1); i.foo(1, 2); -var a; +var a + +; a(); a(1); a.foo(); @@ -89,7 +95,9 @@ var b = { foo: function (x) { }, a: function foo(x, y) { }, b: function (x) { } -}; +} + +; b.foo(); b.foo(1); b.a(1); diff --git a/tests/baselines/reference/callSignaturesWithOptionalParameters2.js b/tests/baselines/reference/callSignaturesWithOptionalParameters2.js index dbd8ad1f424..2442bd6500b 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(); @@ -69,16 +70,20 @@ foo2(1); foo2(1, 2); var C = /** @class */ (function () { function C() { - } - C.prototype.foo = function (x) { }; + }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); @@ -86,7 +91,9 @@ i(1, 2); i.foo(1); i.foo(1, 2); i.foo(1, 2, 3); -var a; +var a + +; a(); a(1); a(1, 2); diff --git a/tests/baselines/reference/callSignaturesWithParameterInitializers.js b/tests/baselines/reference/callSignaturesWithParameterInitializers.js index 528b2a3d00e..6eb339153cd 100644 --- a/tests/baselines/reference/callSignaturesWithParameterInitializers.js +++ b/tests/baselines/reference/callSignaturesWithParameterInitializers.js @@ -59,15 +59,13 @@ 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); @@ -76,37 +74,33 @@ f2(1); 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); i.foo(1); i.foo(1, 2); // these are errors -var a; +var a + +; a(); 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); b.a(1); diff --git a/tests/baselines/reference/callSignaturesWithParameterInitializers2.js b/tests/baselines/reference/callSignaturesWithParameterInitializers2.js index 10aaaf44b6e..32727d3cb89 100644 --- a/tests/baselines/reference/callSignaturesWithParameterInitializers2.js +++ b/tests/baselines/reference/callSignaturesWithParameterInitializers2.js @@ -28,29 +28,23 @@ 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 50282931fa6..162e3110d44 100644 --- a/tests/baselines/reference/callWithMissingVoid.js +++ b/tests/baselines/reference/callWithMissingVoid.js @@ -89,8 +89,7 @@ call((x: number | void, y: number | void) => 42, 4, 2) // ok // From #4260 var X = /** @class */ (function () { function X() { - } - X.prototype.f = function (t) { + }X.prototype.f = function (t) { return { a: t }; }; return X; @@ -112,6 +111,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 +133,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 ee0ab6fe8a7..ef355ee57bd 100644 --- a/tests/baselines/reference/callWithSpread.js +++ b/tests/baselines/reference/callWithSpread.js @@ -80,12 +80,13 @@ var __spreadArrays = (this && this.__spreadArrays) || function () { return r; }; 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,36 @@ foo.apply(void 0, __spreadArrays([1, 2], a, ["abc"])); obj.foo(1, 2, "abc"); obj.foo.apply(obj, __spreadArrays([1, 2], a)); obj.foo.apply(obj, __spreadArrays([1, 2], a, ["abc"])); + obj.foo.apply(obj, __spreadArrays([1, 2], a)).foo(1, 2, "abc"); -(_a = obj.foo.apply(obj, __spreadArrays([1, 2], a))).foo.apply(_a, __spreadArrays([1, 2], a)); -(_b = obj.foo.apply(obj, __spreadArrays([1, 2], a))).foo.apply(_b, __spreadArrays([1, 2], a, ["abc"])); +( + _a = obj.foo.apply(obj, __spreadArrays([1, 2], a))).foo.apply(_a, __spreadArrays([1, 2], a)); +( + _b = obj.foo.apply(obj, __spreadArrays([1, 2], a))).foo.apply(_b, __spreadArrays([1, 2], a, ["abc"])); (obj.foo)(1, 2, "abc"); obj.foo.apply(obj, __spreadArrays([1, 2], a)); obj.foo.apply(obj, __spreadArrays([1, 2], a, ["abc"])); + (obj.foo.apply(obj, __spreadArrays([1, 2], a)).foo)(1, 2, "abc"); (_c = obj.foo.apply(obj, __spreadArrays([1, 2], a))).foo.apply(_c, __spreadArrays([1, 2], a)); (_d = obj.foo.apply(obj, __spreadArrays([1, 2], a))).foo.apply(_d, __spreadArrays([1, 2], a, ["abc"])); xa[1].foo(1, 2, "abc"); -(_e = xa[1]).foo.apply(_e, __spreadArrays([1, 2], a)); -(_f = xa[1]).foo.apply(_f, __spreadArrays([1, 2], a, ["abc"])); +( + _e = xa[1]).foo.apply(_e, __spreadArrays([1, 2], a)); +( + _f = xa[1]).foo.apply(_f, __spreadArrays([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, __spreadArrays([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 bf5bd87b6c5..9893d4cc3e4 100644 --- a/tests/baselines/reference/callWithSpread2.js +++ b/tests/baselines/reference/callWithSpread2.js @@ -45,6 +45,8 @@ var __spreadArrays = (this && this.__spreadArrays) || function () { r[k] = a[j]; return r; }; + + // good all.apply(void 0, ns); weird.apply(void 0, ns); @@ -52,9 +54,12 @@ weird.apply(void 0, mixed); weird.apply(void 0, tuple); prefix.apply(void 0, __spreadArrays(["a"], ns)); rest.apply(void 0, __spreadArrays(["d"], ns)); + + // extra arguments normal.apply(void 0, __spreadArrays(["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 bcb30625f46..bbd14c60dd2 100644 --- a/tests/baselines/reference/callWithSpread3.js +++ b/tests/baselines/reference/callWithSpread3.js @@ -18,6 +18,7 @@ var __spreadArrays = (this && this.__spreadArrays) || function () { r[k] = a[j]; return r; }; + takeTwo.apply(void 0, __spreadArrays(['a'], t2)); // error on ...t2 takeTwo.apply(void 0, __spreadArrays(['a', 'b', 'c'], t2)); // error on 'c' and ...t2 takeTwo.apply(void 0, __spreadArrays(['a', 'b'], t2, ['c'])); // error on ...t2 and 'c' diff --git a/tests/baselines/reference/callWithSpreadES6.js b/tests/baselines/reference/callWithSpreadES6.js index 9e7f244d41a..9e5b3bcc01f 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 74ea401ae3b..7cec17f370b 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 e6483638058..7941300f1ba 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 f631f674269..126a492e29f 100644 --- a/tests/baselines/reference/callsOnComplexSignatures.js +++ b/tests/baselines/reference/callsOnComplexSignatures.js @@ -112,43 +112,63 @@ 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 +176,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 129b17acdc6..5602d3c637c 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 dd433fc1db7..e1a68f0f1bc 100644 --- a/tests/baselines/reference/captureSuperPropertyAccessInSuperCall01.js +++ b/tests/baselines/reference/captureSuperPropertyAccessInSuperCall01.js @@ -24,8 +24,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 919f8491114..bfa1a211a9b 100644 --- a/tests/baselines/reference/captureThisInSuperCall.js +++ b/tests/baselines/reference/captureThisInSuperCall.js @@ -21,10 +21,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 7acaf851cc2..4eac1a4687a 100644 --- a/tests/baselines/reference/capturedLetConstInLoop1.js +++ b/tests/baselines/reference/capturedLetConstInLoop1.js @@ -347,6 +347,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 304486e1724..1cdc046b48a 100644 --- a/tests/baselines/reference/capturedLetConstInLoop10.js +++ b/tests/baselines/reference/capturedLetConstInLoop10.js @@ -48,8 +48,7 @@ class B { //// [capturedLetConstInLoop10.js] var A = /** @class */ (function () { function A() { - } - A.prototype.foo = function () { + }A.prototype.foo = function () { var _loop_1 = function (x) { var f = function () { return x; }; this_1.bar(f()); @@ -62,6 +61,7 @@ var A = /** @class */ (function () { }; A.prototype.bar = function (a) { }; + A.prototype.baz = function () { var _loop_2 = function (x) { var a = function () { return x; }; @@ -104,8 +104,7 @@ var A = /** @class */ (function () { }()); var B = /** @class */ (function () { function B() { - } - B.prototype.foo = function () { + }B.prototype.foo = function () { var _this = this; var a = function () { var _loop_6 = function (x) { @@ -116,7 +115,8 @@ var B = /** @class */ (function () { var x = _a[_i]; _loop_6(x); } - }; + } + ; }; B.prototype.bar = function (a) { }; diff --git a/tests/baselines/reference/capturedLetConstInLoop10_ES6.js b/tests/baselines/reference/capturedLetConstInLoop10_ES6.js index 705a5e6ba9f..96c94b7aed6 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 = () => { @@ -83,7 +84,8 @@ class B { let f = () => x; this.bar(f()); } - }; + } + ; } bar(a) { } diff --git a/tests/baselines/reference/capturedLetConstInLoop11.js b/tests/baselines/reference/capturedLetConstInLoop11.js index 8e9ca71580e..9e6d0ab77e8 100644 --- a/tests/baselines/reference/capturedLetConstInLoop11.js +++ b/tests/baselines/reference/capturedLetConstInLoop11.js @@ -16,11 +16,13 @@ function foo() { //// [capturedLetConstInLoop11.js] var _loop_1 = function () { var x = 1; - (function () { return x; }); + ( + function () { return x; }); }; 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 df288953f1e..8e61c6ad05c 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 3625556c89a..738ffbc496c 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 628faa10485..526ea5a00c4 100644 --- a/tests/baselines/reference/capturedLetConstInLoop13.js +++ b/tests/baselines/reference/capturedLetConstInLoop13.js @@ -27,6 +27,7 @@ var Main = /** @class */ (function () { function Main() { this.register("a", "b", "c"); } + Main.prototype.register = function () { var _this = this; var names = []; @@ -45,7 +46,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 0a68f8e1cf6..199c1b94e38 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 94bc8669cf5..47e7885d135 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 59bd81b5a4d..2794e693ae6 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 f3bae712c5b..7a89a9a77d3 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 367db066edd..a14d3ac3d37 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_ES6.js b/tests/baselines/reference/capturedLetConstInLoop4_ES6.js index e7a16aa01c6..e49198152e3 100644 --- a/tests/baselines/reference/capturedLetConstInLoop4_ES6.js +++ b/tests/baselines/reference/capturedLetConstInLoop4_ES6.js @@ -147,116 +147,138 @@ 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 4ea4c85c0d7..e3d81b15b57 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 da48929c959..1205bc8e630 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 cf813da44e1..318c733a776 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 33d64e88927..f789c30ccde 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_ES6.js b/tests/baselines/reference/capturedLetConstInLoop7_ES6.js index 13c69a88392..9368194c602 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 cb13f76ac61..19cb90ef9bb 100644 --- a/tests/baselines/reference/capturedLetConstInLoop8.js +++ b/tests/baselines/reference/capturedLetConstInLoop8.js @@ -145,6 +145,7 @@ function foo() { if (y == 1) { return "continue-l0"; } + if (x == 2) { return "continue"; } @@ -211,6 +212,7 @@ function foo() { } } } + function foo_c() { l0: for (var z = 0; z < 1;) { var _loop_3 = function (x) { @@ -229,6 +231,7 @@ function foo_c() { if (y == 1) { return "continue-l0"; } + if (x == 2) { return "continue"; } diff --git a/tests/baselines/reference/capturedLetConstInLoop8_ES6.js b/tests/baselines/reference/capturedLetConstInLoop8_ES6.js index 71d0ecd4c4c..f0967e13513 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 0795d509f9b..9bc50825605 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,10 +166,10 @@ var _loop_1 = function (x) { while (1 == 1) { _loop_2(); } + var A = /** @class */ (function () { function A() { - } - A.prototype.m = function () { + }A.prototype.m = function () { return x_1 + 1; }; return A; @@ -176,15 +178,19 @@ var _loop_1 = function (x) { for (var x = 0; x < 1; ++x) { _loop_1(x); } + + function foo() { var _loop_3 = function (a) { var _a; if (a === 1) { return "break"; } + if (a === 2) { return "break-l0"; } + for (var _i = 0, _b = []; _i < _b.length; _i++) { var b = _b[_i]; _a = [{ x: 1, y: 2 }][0], x = _a.x, z = _a.y; @@ -205,10 +211,16 @@ function foo() { if (b === 1) { return "break"; } + if (b === 2) { return "break-l0"; } - (function () { return b; }); + + ( + + function () { return b; + } + ); return { value: 100 }; }; for (var _c = 0, _d = []; _c < _d.length; _c++) { @@ -222,7 +234,12 @@ function foo() { case "break-l0": return state_2; } } - (function () { return a; }); + + + ( + + + function () { return a; }); }; var arguments_1 = arguments, x, z, x1, z1; l0: for (var _i = 0, _a = []; _i < _a.length; _i++) { @@ -241,6 +258,7 @@ function foo() { use(x1); use(z1); } + function foo2() { for (var _i = 0, _a = []; _i < _a.length; _i++) { var x = _a[_i]; @@ -250,6 +268,7 @@ function foo2() { else if (x === 2) { continue; } + while (1 === 1) { if (x) { break; @@ -258,6 +277,7 @@ function foo2() { continue; } } + switch (x) { case 1: break; case 2: continue; @@ -271,6 +291,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 783140426d2..d16018e369d 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 ec5ff77d84b..41578d51a48 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 53d5da5d445..29daf680bea 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 +) { if (y === void 0) { y = (_a = /** @class */ (function () { function class_1() { x; @@ -35,15 +39,13 @@ function foo(y, x, z) { var _a; y.c; } -function foo2(y, x) { - if (y === void 0) { y = (_b = /** @class */ (function () { +function foo2(y, x) {if (y === void 0) { y = (_b = /** @class */ (function () { function class_2() { this[_a] = x; } return class_2; }()), _a = x, - _b); } - if (x === void 0) { x = 1; } + _b); }if (x === void 0) { x = 1; } var _a, _b; } diff --git a/tests/baselines/reference/caseInsensitiveFileSystemWithCapsImportTypeDeclarations.js b/tests/baselines/reference/caseInsensitiveFileSystemWithCapsImportTypeDeclarations.js index 2247ff56c89..bd09648d7bc 100644 --- a/tests/baselines/reference/caseInsensitiveFileSystemWithCapsImportTypeDeclarations.js +++ b/tests/baselines/reference/caseInsensitiveFileSystemWithCapsImportTypeDeclarations.js @@ -38,13 +38,11 @@ exports.__esModule = true; exports.Broken = void 0; var Broken = /** @class */ (function () { function Broken() { - } - Broken.prototype.method = function () { + }Broken.prototype.method = function () { return {}; }; return Broken; -}()); -exports.Broken = Broken; +}());exports.Broken = Broken; //// [types.d.ts] diff --git a/tests/baselines/reference/castExpressionParentheses.js b/tests/baselines/reference/castExpressionParentheses.js index b1f4507f982..703f77294ae 100644 --- a/tests/baselines/reference/castExpressionParentheses.js +++ b/tests/baselines/reference/castExpressionParentheses.js @@ -51,9 +51,12 @@ new (A()); //// [castExpressionParentheses.js] + // parentheses should be omitted // literals -({ a: 0 }); +( + + { a: 0 }); [1, 3,]; "string"; 23.0; @@ -79,16 +82,28 @@ a().x; 1.0.foo; 12e+34.foo; 0xff.foo; + + // should keep the parentheses in emit (1.0); -(new A).foo; -(typeof A).x; -(-A).x; +( + new A).foo; +( + typeof A).x; +( + -A).x; new (A()); (function () { })(); -(function foo() { })(); -(-A).x; +( + function foo() { })(); +( + -A).x; + // nested cast, should keep one pair of parenthese -(-A).x; +( + + -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 c00c1b028f4..9ac03a91f25 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 86d35bedad4..49a382ad780 100644 --- a/tests/baselines/reference/castOfYield.js +++ b/tests/baselines/reference/castOfYield.js @@ -33,16 +33,14 @@ 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() { +};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. - ; - return [4 /*yield*/, 0]; + ;return [4 /*yield*/, 0]; case 2: _a.sent(); return [2 /*return*/]; diff --git a/tests/baselines/reference/castTest.js b/tests/baselines/reference/castTest.js index 930086bdd94..a9ee2209ca4 100644 --- a/tests/baselines/reference/castTest.js +++ b/tests/baselines/reference/castTest.js @@ -35,11 +35,16 @@ var p_cast = ({ var x = 0; var z = x; 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, @@ -47,4 +52,7 @@ var p_cast = ({ return new Point(this.x + dx, this.y + dy); }, mult: function (p) { return p; } -}); +}) + +; + diff --git a/tests/baselines/reference/castingTuple.js b/tests/baselines/reference/castingTuple.js index ac21b229a3c..e2d5144bf6e 100644 --- a/tests/baselines/reference/castingTuple.js +++ b/tests/baselines/reference/castingTuple.js @@ -55,28 +55,24 @@ 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; }()); ; var E = /** @class */ (function (_super) { - __extends(E, _super); - function E() { + __extends(E, _super);function E() { return _super !== null && _super.apply(this, arguments) || this; } return E; }(A)); ; var F = /** @class */ (function (_super) { - __extends(F, _super); - function F() { + __extends(F, _super);function F() { return _super !== null && _super.apply(this, arguments) || this; } return F; @@ -94,8 +90,10 @@ var E2; var numStrTuple = [5, "foo"]; var emptyObjTuple = numStrTuple; var numStrBoolTuple = numStrTuple; -var shorter = numStrBoolTuple; -var longer = numStrTuple; +var shorter = numStrBoolTuple +; +var longer = numStrTuple +; var classCDTuple = [new C(), new D()]; var interfaceIITuple = classCDTuple; var classCDATuple = classCDTuple; @@ -108,6 +106,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/cf.js b/tests/baselines/reference/cf.js index 7e95dca1944..0b4de193877 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 e37d6361b24..0f65c5d53f6 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 9604b64e633..355737cc535 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 c3e73310188..496141f9b88 100644 --- a/tests/baselines/reference/chainedAssignment3.js +++ b/tests/baselines/reference/chainedAssignment3.js @@ -35,15 +35,13 @@ 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; }()); var B = /** @class */ (function (_super) { - __extends(B, _super); - function B() { + __extends(B, _super);function B() { return _super !== null && _super.apply(this, arguments) || this; } return B; @@ -53,7 +51,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/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js index 69ecf8cd52d..d308c42da5e 100644 --- a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js +++ b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js @@ -32,8 +32,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; } @@ -48,15 +47,13 @@ var A = /** @class */ (function () { return A; }()); var B = /** @class */ (function (_super) { - __extends(B, _super); - function B() { + __extends(B, _super);function B() { return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var C = /** @class */ (function (_super) { - __extends(C, _super); - function C() { + __extends(C, _super);function C() { return _super !== null && _super.apply(this, arguments) || this; } return C; diff --git a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.js b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.js index 15c72352480..67b6b9d2310 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 1884967aa9e..564fed96df9 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 d03127eaa7d..c95db27485e 100644 --- a/tests/baselines/reference/checkForObjectTooStrict.js +++ b/tests/baselines/reference/checkForObjectTooStrict.js @@ -47,6 +47,7 @@ var __extends = (this && this.__extends) || (function () { })(); var Foo; (function (Foo) { + var Object = /** @class */ (function () { function Object() { } @@ -56,6 +57,7 @@ var Foo; })(Foo || (Foo = {})); var Bar = /** @class */ (function (_super) { __extends(Bar, _super); + function Bar() { return _super.call(this) || this; } @@ -63,6 +65,7 @@ var Bar = /** @class */ (function (_super) { }(Foo.Object)); var Baz = /** @class */ (function (_super) { __extends(Baz, _super); + function Baz() { return _super.call(this) || this; } diff --git a/tests/baselines/reference/checkInfiniteExpansionTermination.js b/tests/baselines/reference/checkInfiniteExpansionTermination.js index ed52ea6b419..34670394e94 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 6175b34e522..84dccd00742 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 66c46c9214d..14830eeca34 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 bc9c08b5524..d762a8f7549 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/checkJsdocParamTag1.js b/tests/baselines/reference/checkJsdocParamTag1.js index 577460626a1..3246f00f4c8 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 31c30e54dfc..e6ef822de1e 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 4a68e5d85b7..d14d7a581ba 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 0613a237d7b..ad0ad2ec2d1 100644 --- a/tests/baselines/reference/checkJsdocTypeTag1.js +++ b/tests/baselines/reference/checkJsdocTypeTag1.js @@ -45,8 +45,10 @@ var props = {}; // @ts-check /** @type {String} */ var S = "hello world"; + /** @type {number} */ var n = 10; + /** @type {*} */ var anyT = 2; anyT = "hello"; @@ -69,6 +71,7 @@ x2(0); * @type {object} */ var props = {}; + /** * @type {Object} */ diff --git a/tests/baselines/reference/checkJsdocTypeTag2.js b/tests/baselines/reference/checkJsdocTypeTag2.js index 0e550d3ba33..8facda49033 100644 --- a/tests/baselines/reference/checkJsdocTypeTag2.js +++ b/tests/baselines/reference/checkJsdocTypeTag2.js @@ -29,13 +29,16 @@ x4(0); // @ts-check /** @type {String} */ var S = true; + /** @type {number} */ var n = "hello"; + /** @type {function (number)} */ var x1 = function (a) { return a + 1; }; x1("string"); /** @type {function (number): number} */ var x2 = function (a) { return a + 1; }; + /** @type {string} */ var a; a = x2(0); diff --git a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.js b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.js index 90f83b4ff99..4144891a5f5 100644 --- a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.js +++ b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.js @@ -43,8 +43,10 @@ var obj = (_a = { /** @type {number} */ _a['b' + 'ar1'] = 42, /** @type {function(number): number} */ - _a.arrowFunc = function (num) { return num + 42; }, - _a); + _a.arrowFunc = function (num) { return num + 42; + }, + _a) +; obj.foo = 'string'; obj.lol; obj.bar = undefined; diff --git a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.js b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.js index ab574fddced..68c003d5214 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 d50f126c54e..395988aed8e 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 7f4d7f4bcfd..32cfd306f0d 100644 --- a/tests/baselines/reference/checkJsdocTypedefOnlySourceFile.js +++ b/tests/baselines/reference/checkJsdocTypedefOnlySourceFile.js @@ -14,6 +14,7 @@ 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 30e59613eb9..f92acb49fb5 100644 --- a/tests/baselines/reference/checkJsxChildrenCanBeTupleType.js +++ b/tests/baselines/reference/checkJsxChildrenCanBeTupleType.js @@ -42,17 +42,21 @@ 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() { + __extends(ResizablePanel, _super);function ResizablePanel() { return _super !== null && _super.apply(this, arguments) || this; } return ResizablePanel; }(react_1["default"].Component)); -var test = react_1["default"].createElement(ResizablePanel, 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)); -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)); + react_1["default"].createElement("div", null) +); diff --git a/tests/baselines/reference/checkJsxChildrenProperty1.js b/tests/baselines/reference/checkJsxChildrenProperty1.js index 44c1ca8a729..7a37fb7646e 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 18d1f3affa3..eb358ce50a0 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty10.js +++ b/tests/baselines/reference/checkJsxChildrenProperty10.js @@ -23,10 +23,10 @@ let k3 =
{1} {"That is a number"}
; let k4 = ; //// [file.jsx] + var Button = /** @class */ (function () { function Button() { - } - Button.prototype.render = function () { + }Button.prototype.render = function () { return (
My Button
); }; return Button; diff --git a/tests/baselines/reference/checkJsxChildrenProperty11.js b/tests/baselines/reference/checkJsxChildrenProperty11.js index 18d1f3affa3..eb358ce50a0 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty11.js +++ b/tests/baselines/reference/checkJsxChildrenProperty11.js @@ -23,10 +23,10 @@ let k3 =
{1} {"That is a number"}
; let k4 = ; //// [file.jsx] + var Button = /** @class */ (function () { function Button() { - } - Button.prototype.render = function () { + }Button.prototype.render = function () { return (
My Button
); }; return Button; diff --git a/tests/baselines/reference/checkJsxChildrenProperty12.js b/tests/baselines/reference/checkJsxChildrenProperty12.js index 44fe4e1053d..32a3490f763 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty12.js +++ b/tests/baselines/reference/checkJsxChildrenProperty12.js @@ -49,12 +49,12 @@ var __extends = (this && this.__extends) || (function () { })(); exports.__esModule = true; var React = require("react"); + + var Button = /** @class */ (function (_super) { - __extends(Button, _super); - function Button() { + __extends(Button, _super);function Button() { return _super !== null && _super.apply(this, arguments) || this; - } - Button.prototype.render = function () { + }Button.prototype.render = function () { var condition; if (condition) { return ; @@ -67,12 +67,11 @@ var Button = /** @class */ (function (_super) { }; return Button; }(React.Component)); + var InnerButton = /** @class */ (function (_super) { - __extends(InnerButton, _super); - function InnerButton() { + __extends(InnerButton, _super);function InnerButton() { return _super !== null && _super.apply(this, arguments) || this; - } - InnerButton.prototype.render = function () { + }InnerButton.prototype.render = function () { return (); }; return InnerButton; diff --git a/tests/baselines/reference/checkJsxChildrenProperty13.js b/tests/baselines/reference/checkJsxChildrenProperty13.js index dcdf7ac1e88..ec51851b7ce 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty13.js +++ b/tests/baselines/reference/checkJsxChildrenProperty13.js @@ -44,12 +44,12 @@ var __extends = (this && this.__extends) || (function () { })(); exports.__esModule = true; var React = require("react"); + + var Button = /** @class */ (function (_super) { - __extends(Button, _super); - function Button() { + __extends(Button, _super);function Button() { return _super !== null && _super.apply(this, arguments) || this; - } - Button.prototype.render = function () { + }Button.prototype.render = function () { // Error children are specified twice return (
Hello World
@@ -57,12 +57,11 @@ var Button = /** @class */ (function (_super) { }; return Button; }(React.Component)); + var InnerButton = /** @class */ (function (_super) { - __extends(InnerButton, _super); - function InnerButton() { + __extends(InnerButton, _super);function InnerButton() { return _super !== null && _super.apply(this, arguments) || this; - } - InnerButton.prototype.render = function () { + }InnerButton.prototype.render = function () { return (); }; return InnerButton; diff --git a/tests/baselines/reference/checkJsxChildrenProperty14.js b/tests/baselines/reference/checkJsxChildrenProperty14.js index 12051095b6a..3f0866e35d8 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty14.js +++ b/tests/baselines/reference/checkJsxChildrenProperty14.js @@ -59,12 +59,12 @@ var __extends = (this && this.__extends) || (function () { })(); exports.__esModule = true; var React = require("react"); + + var Button = /** @class */ (function (_super) { - __extends(Button, _super); - function Button() { + __extends(Button, _super);function Button() { return _super !== null && _super.apply(this, arguments) || this; - } - Button.prototype.render = function () { + }Button.prototype.render = function () { return (
My Button
); }; return Button; @@ -72,17 +72,23 @@ var Button = /** @class */ (function (_super) { function AnotherButton(p) { return

Just Another Button

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