diff --git a/src/testRunner/unittests/tsserver/getEditsForFileRename.ts b/src/testRunner/unittests/tsserver/getEditsForFileRename.ts index 843cc1473fd4b..e1363baf1dd48 100644 --- a/src/testRunner/unittests/tsserver/getEditsForFileRename.ts +++ b/src/testRunner/unittests/tsserver/getEditsForFileRename.ts @@ -27,11 +27,11 @@ describe("unittests:: tsserver:: getEditsForFileRename::", () => { }; const tsconfig: File = { path: "/home/src/projects/project/tsconfig.json", - content: "{}", + content: `{ "compilerOptions": { "module": "commonjs" } }`, }; const host = TestServerHost.createServerHost([userTs, newTs, tsconfig]); - const options: ts.CompilerOptions = {}; + const options: ts.CompilerOptions = { module: ts.ModuleKind.CommonJS }; const moduleResolutionCache = ts.createModuleResolutionCache(host.getCurrentDirectory(), ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames), options); const lsHost: ts.LanguageServiceHost = { getCompilationSettings: () => options, diff --git a/src/testRunner/unittests/tsserver/typingsInstaller.ts b/src/testRunner/unittests/tsserver/typingsInstaller.ts index 9d8747a45f245..198b47c95f59f 100644 --- a/src/testRunner/unittests/tsserver/typingsInstaller.ts +++ b/src/testRunner/unittests/tsserver/typingsInstaller.ts @@ -2495,6 +2495,7 @@ describe("unittests:: tsserver:: typingsInstaller:: recomputing resolutions of u host, installAction: typingFiles, }); + setCompilerOptionsForInferredProjectsRequestForSession({ module: ts.ModuleKind.CommonJS }, session); openFilesForSession([app], session); const proj = session.getProjectService().inferredProjects[0]; diff --git a/tests/baselines/reference/2dArrays.js b/tests/baselines/reference/2dArrays.js index 3c12da4a25ef8..f05603ad21ff5 100644 --- a/tests/baselines/reference/2dArrays.js +++ b/tests/baselines/reference/2dArrays.js @@ -18,24 +18,19 @@ class Board { } //// [2dArrays.js] -var Cell = /** @class */ (function () { - function Cell() { - } - return Cell; -}()); -var Ship = /** @class */ (function () { - function Ship() { +class Cell { +} +class Ship { + constructor() { this.isSunk = false; } - return Ship; -}()); -var Board = /** @class */ (function () { - function Board() { +} +class Board { + constructor() { this.ships = []; this.cells = []; } - Board.prototype.allShipsSunk = function () { + allShipsSunk() { 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 608d0e00a1dda..fcf4215205224 100644 --- a/tests/baselines/reference/APISample_Watch.js +++ b/tests/baselines/reference/APISample_Watch.js @@ -91,14 +91,14 @@ watchMain(); * Please log a "breaking change" issue for any API breaking change affecting this issue */ Object.defineProperty(exports, "__esModule", { value: true }); -var ts = require("typescript"); -var formatHost = { - getCanonicalFileName: function (path) { return path; }, +const ts = require("typescript"); +const formatHost = { + getCanonicalFileName: path => path, getCurrentDirectory: ts.sys.getCurrentDirectory, - getNewLine: function () { return ts.sys.newLine; }, + getNewLine: () => ts.sys.newLine, }; function watchMain() { - var configPath = ts.findConfigFile(/*searchPath*/ "./", ts.sys.fileExists, "tsconfig.json"); + const configPath = ts.findConfigFile(/*searchPath*/ "./", ts.sys.fileExists, "tsconfig.json"); if (!configPath) { throw new Error("Could not find a valid 'tsconfig.json'."); } @@ -112,16 +112,16 @@ 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); + const 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; - host.createProgram = function (rootNames, options, host, oldProgram) { + const origCreateProgram = host.createProgram; + host.createProgram = (rootNames, options, host, oldProgram) => { console.log("** We're about to create the program! **"); return origCreateProgram(rootNames, options, host, oldProgram); }; - var origPostProgramCreate = host.afterProgramCreate; - host.afterProgramCreate = function (program) { + const origPostProgramCreate = host.afterProgramCreate; + host.afterProgramCreate = program => { console.log("** We finished making the program! **"); origPostProgramCreate(program); }; diff --git a/tests/baselines/reference/APISample_WatchWithDefaults.js b/tests/baselines/reference/APISample_WatchWithDefaults.js index 90e4ca2aa3a1e..eda1e3f02b960 100644 --- a/tests/baselines/reference/APISample_WatchWithDefaults.js +++ b/tests/baselines/reference/APISample_WatchWithDefaults.js @@ -63,9 +63,9 @@ watchMain(); * Please log a "breaking change" issue for any API breaking change affecting this issue */ Object.defineProperty(exports, "__esModule", { value: true }); -var ts = require("typescript"); +const ts = require("typescript"); function watchMain() { - var configPath = ts.findConfigFile(/*searchPath*/ "./", ts.sys.fileExists, "tsconfig.json"); + const configPath = ts.findConfigFile(/*searchPath*/ "./", ts.sys.fileExists, "tsconfig.json"); if (!configPath) { throw new Error("Could not find a valid 'tsconfig.json'."); } @@ -79,16 +79,16 @@ 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); + const 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; - host.createProgram = function (rootNames, options, host, oldProgram) { + const origCreateProgram = host.createProgram; + host.createProgram = (rootNames, options, host, oldProgram) => { console.log("** We're about to create the program! **"); return origCreateProgram(rootNames, options, host, oldProgram); }; - var origPostProgramCreate = host.afterProgramCreate; - host.afterProgramCreate = function (program) { + const origPostProgramCreate = host.afterProgramCreate; + host.afterProgramCreate = 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 2e010f62cd8b4..915dc80a8306e 100644 --- a/tests/baselines/reference/APISample_WatchWithOwnWatchHost.js +++ b/tests/baselines/reference/APISample_WatchWithOwnWatchHost.js @@ -70,18 +70,18 @@ watchMain(); * Please log a "breaking change" issue for any API breaking change affecting this issue */ Object.defineProperty(exports, "__esModule", { value: true }); -var ts = require("typescript"); +const ts = require("typescript"); function watchMain() { // get list of files and compiler options somehow - var files = []; - var options = {}; - var host = { + const files = []; + const options = {}; + const host = { rootFiles: files, - options: options, - useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, - getNewLine: function () { return ts.sys.newLine; }, + options, + useCaseSensitiveFileNames: () => ts.sys.useCaseSensitiveFileNames, + getNewLine: () => ts.sys.newLine, getCurrentDirectory: ts.sys.getCurrentDirectory, - getDefaultLibFileName: function (options) { return ts.getDefaultLibFilePath(options); }, + getDefaultLibFileName: options => ts.getDefaultLibFilePath(options), fileExists: ts.sys.fileExists, readFile: ts.sys.readFile, directoryExists: ts.sys.directoryExists, @@ -94,13 +94,13 @@ function watchMain() { }; // 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; - host.createProgram = function (rootNames, options, host, oldProgram) { + const origCreateProgram = host.createProgram; + host.createProgram = (rootNames, options, host, oldProgram) => { console.log("** We're about to create the program! **"); return origCreateProgram(rootNames, options, host, oldProgram); }; - var origPostProgramCreate = host.afterProgramCreate; - host.afterProgramCreate = function (program) { + const origPostProgramCreate = host.afterProgramCreate; + host.afterProgramCreate = 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 5cee7192e3ef6..fdf4166c68525 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -55,22 +55,22 @@ compile(process.argv.slice(2), { */ Object.defineProperty(exports, "__esModule", { value: true }); exports.compile = compile; -var ts = require("typescript"); +const 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) { + allDiagnostics.forEach(diagnostic => { var message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'); if (!diagnostic.file) { console.log(message); return; } - var _a = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start), line = _a.line, character = _a.character; - console.log("".concat(diagnostic.file.fileName, " (").concat(line + 1, ",").concat(character + 1, "): ").concat(message)); + var { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`); }); var exitCode = emitResult.emitSkipped ? 1 : 0; - console.log("Process exiting with code '".concat(exitCode, "'.")); + console.log(`Process exiting with code '${exitCode}'.`); process.exit(exitCode); } compile(process.argv.slice(2), { diff --git a/tests/baselines/reference/APISample_jsdoc.js b/tests/baselines/reference/APISample_jsdoc.js index 4454df333d826..a641c8825744e 100644 --- a/tests/baselines/reference/APISample_jsdoc.js +++ b/tests/baselines/reference/APISample_jsdoc.js @@ -163,26 +163,25 @@ var __importStar = (this && this.__importStar) || (function () { }; })(); Object.defineProperty(exports, "__esModule", { value: true }); -var ts = __importStar(require("typescript")); +const ts = __importStar(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) { - var _this = this; if (!symbol) { return; } // the comments for a symbol - var comments = symbol.getDocumentationComment(undefined); + let 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(""); + definition.description = comments.map(comment => comment.kind === "lineBreak" ? comment.text : comment.text.trim().replace(/\r\n/g, "\n")).join(""); } // jsdocs are separate from comments - var jsdocs = symbol.getJsDocTags(this.checker); - jsdocs.forEach(function (doc) { + const jsdocs = symbol.getJsDocTags(this.checker); + jsdocs.forEach(doc => { // if we have @TJS-... annotations, we have to parse them - var name = doc.name, text = doc.text; - if (_this.userValidationKeywords[name]) { - definition[name] = _this.parseValue(text); + const { name, text } = doc; + if (this.userValidationKeywords[name]) { + definition[name] = this.parseValue(text); } else { // special annotations @@ -191,17 +190,16 @@ function parseCommentsIntoDefinition(symbol, definition, otherAnnotations) { }); } function getAnnotations(node) { - var _this = this; - var symbol = node.symbol; + const symbol = node.symbol; if (!symbol) { return undefined; } - var jsDocTags = symbol.getJsDocTags(this.checker); + const jsDocTags = symbol.getJsDocTags(this.checker); if (!jsDocTags || !jsDocTags.length) { return undefined; } - var annotations = jsDocTags.reduce(function (result, jsDocTag) { - var value = _this.parseJsDocTag(jsDocTag); + const annotations = jsDocTags.reduce((result, jsDocTag) => { + const value = this.parseJsDocTag(jsDocTag); if (value !== undefined) { result[jsDocTag.name] = value; } @@ -215,13 +213,12 @@ function parseSpecificTags(node) { return ts.getJSDocParameterTags(node); } if (node.kind === ts.SyntaxKind.FunctionDeclaration) { - var func = node; + const func = node; if (ts.hasJSDocParameterTags(func)) { - var flat = []; - for (var _i = 0, _a = func.parameters.map(ts.getJSDocParameterTags); _i < _a.length; _i++) { - var tags = _a[_i]; + const flat = []; + for (const tags of func.parameters.map(ts.getJSDocParameterTags)) { if (tags) - flat.push.apply(flat, tags); + flat.push(...tags); } return flat; } @@ -231,7 +228,7 @@ function getReturnTypeFromJSDoc(node) { if (node.kind === ts.SyntaxKind.FunctionDeclaration) { return ts.getJSDocReturnType(node); } - var type = ts.getJSDocType(node); + let type = ts.getJSDocType(node); if (type && type.kind === ts.SyntaxKind.FunctionType) { return type.type; } @@ -240,11 +237,11 @@ function getAllTags(node) { ts.getJSDocTags(node); } function getSomeOtherTags(node) { - var tags = []; + const tags = []; tags.push(ts.getJSDocAugmentsTag(node)); tags.push(ts.getJSDocClassTag(node)); tags.push(ts.getJSDocReturnTag(node)); - var type = ts.getJSDocTypeTag(node); + const type = ts.getJSDocTypeTag(node); if (type) { tags.push(type); } diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index d51e23664055d..b0ed0df036d72 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -114,7 +114,7 @@ var __importStar = (this && this.__importStar) || (function () { })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.delint = delint; -var ts = __importStar(require("typescript")); +const ts = __importStar(require("typescript")); function delint(sourceFile) { delintNode(sourceFile); function delintNode(node) { @@ -128,7 +128,7 @@ function delint(sourceFile) { } break; case ts.SyntaxKind.IfStatement: - var ifStatement = node; + let ifStatement = node; if (ifStatement.thenStatement.kind !== ts.SyntaxKind.Block) { report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body."); } @@ -139,7 +139,7 @@ function delint(sourceFile) { } break; case ts.SyntaxKind.BinaryExpression: - var op = node.operatorToken.kind; + let op = node.operatorToken.kind; if (op === ts.SyntaxKind.EqualsEqualsToken || op == ts.SyntaxKind.ExclamationEqualsToken) { report(node, "Use '===' and '!=='."); } @@ -148,14 +148,14 @@ 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("".concat(sourceFile.fileName, " (").concat(line + 1, ",").concat(character + 1, "): ").concat(message)); + let { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart()); + console.log(`${sourceFile.fileName} (${line + 1},${character + 1}): ${message}`); } } -var fileNames = process.argv.slice(2); -fileNames.forEach(function (fileName) { +const fileNames = process.argv.slice(2); +fileNames.forEach(fileName => { // Parse a file - var sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), ts.ScriptTarget.ES2015, /*setParentNodes */ true); + let sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), ts.ScriptTarget.ES2015, /*setParentNodes */ true); // delint it delint(sourceFile); }); diff --git a/tests/baselines/reference/APISample_parseConfig.js b/tests/baselines/reference/APISample_parseConfig.js index ed8e2c3f2bb1c..4359a0c275792 100644 --- a/tests/baselines/reference/APISample_parseConfig.js +++ b/tests/baselines/reference/APISample_parseConfig.js @@ -53,24 +53,23 @@ export function createProgram(rootFiles: string[], compilerOptionsJson: string): */ Object.defineProperty(exports, "__esModule", { value: true }); exports.createProgram = createProgram; -var ts = require("typescript"); +const ts = require("typescript"); function printError(error) { if (!error) { return; } - console.log("".concat(error.file && error.file.fileName, ": ").concat(error.messageText)); + 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; + const { config, error } = ts.parseConfigFileTextToJson("tsconfig.json", compilerOptionsJson); if (error) { printError(error); return undefined; } - var basePath = process.cwd(); - var settings = ts.convertCompilerOptionsFromJson(config.config["compilerOptions"], basePath); + const basePath = process.cwd(); + const settings = ts.convertCompilerOptionsFromJson(config.config["compilerOptions"], basePath); if (!settings.options) { - for (var _i = 0, _b = settings.errors; _i < _b.length; _i++) { - var err = _b[_i]; + for (const err of settings.errors) { printError(err); } return undefined; diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 773de798d07bc..38b2ccd05a3d3 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -65,7 +65,7 @@ var __importStar = (this && this.__importStar) || (function () { }; })(); Object.defineProperty(exports, "__esModule", { value: true }); -var ts = __importStar(require("typescript")); -var source = "let x: string = 'string'"; -var result = ts.transpile(source, { module: ts.ModuleKind.CommonJS }); +const ts = __importStar(require("typescript")); +const source = "let x: string = 'string'"; +let 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 e944e0d47b077..cf3cef8653a0d 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -160,37 +160,37 @@ var __importStar = (this && this.__importStar) || (function () { }; })(); Object.defineProperty(exports, "__esModule", { value: true }); -var ts = __importStar(require("typescript")); +const ts = __importStar(require("typescript")); function watch(rootFileNames, options) { - var files = {}; + const files = {}; // initialize the list of files - rootFileNames.forEach(function (fileName) { + rootFileNames.forEach(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; }, - getScriptVersion: function (fileName) { return files[fileName] && files[fileName].version.toString(); }, - getScriptSnapshot: function (fileName) { + const servicesHost = { + getScriptFileNames: () => rootFileNames, + getScriptVersion: (fileName) => files[fileName] && files[fileName].version.toString(), + getScriptSnapshot: (fileName) => { 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); }, - fileExists: function (fileName) { return fs.existsSync(fileName); }, - readFile: function (fileName) { return fs.readFileSync(fileName); }, + getCurrentDirectory: () => process.cwd(), + getCompilationSettings: () => options, + getDefaultLibFileName: (options) => ts.getDefaultLibFilePath(options), + fileExists: fileName => fs.existsSync(fileName), + readFile: fileName => fs.readFileSync(fileName), }; // Create the language service files - var services = ts.createLanguageService(servicesHost, ts.createDocumentRegistry()); + const services = ts.createLanguageService(servicesHost, ts.createDocumentRegistry()); // Now let's watch the files - rootFileNames.forEach(function (fileName) { + rootFileNames.forEach(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 }, (curr, prev) => { // Check timestamp if (+curr.mtime <= +prev.mtime) { return; @@ -202,36 +202,36 @@ function watch(rootFileNames, options) { }); }); function emitFile(fileName) { - var output = services.getEmitOutput(fileName); + let output = services.getEmitOutput(fileName); if (!output.emitSkipped) { - console.log("Emitting ".concat(fileName)); + console.log(`Emitting ${fileName}`); } else { - console.log("Emitting ".concat(fileName, " failed")); + console.log(`Emitting ${fileName} failed`); logErrors(fileName); } - output.outputFiles.forEach(function (o) { + output.outputFiles.forEach(o => { fs.writeFileSync(o.name, o.text, "utf8"); }); } function logErrors(fileName) { - var allDiagnostics = services.getCompilerOptionsDiagnostics() + let allDiagnostics = services.getCompilerOptionsDiagnostics() .concat(services.getSyntacticDiagnostics(fileName)) .concat(services.getSemanticDiagnostics(fileName)); - allDiagnostics.forEach(function (diagnostic) { - var message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"); + allDiagnostics.forEach(diagnostic => { + let message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"); if (diagnostic.file) { - var _a = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start), line = _a.line, character = _a.character; - console.log(" Error ".concat(diagnostic.file.fileName, " (").concat(line + 1, ",").concat(character + 1, "): ").concat(message)); + let { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + console.log(` Error ${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`); } else { - console.log(" Error: ".concat(message)); + console.log(` Error: ${message}`); } }); } } // 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"; }); +const currentDirectoryFiles = fs.readdirSync(process.cwd()). + filter(fileName => fileName.length >= 3 && fileName.substr(fileName.length - 3, 3) === ".ts"); // Start the watcher watch(currentDirectoryFiles, { module: ts.ModuleKind.CommonJS }); diff --git a/tests/baselines/reference/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.js b/tests/baselines/reference/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.js index 5ae2a13fd7014..8c2439c14b9d5 100644 --- a/tests/baselines/reference/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.js @@ -25,13 +25,12 @@ var p = new A.Point(0, 0); // unexpected error here, bug 840000 //// [classPoint.js] var A; (function (A) { - var Point = /** @class */ (function () { - function Point(x, y) { + class Point { + constructor(x, y) { this.x = x; this.y = y; } - return Point; - }()); + } A.Point = Point; })(A || (A = {})); //// [test.js] diff --git a/tests/baselines/reference/ArrowFunction1.js b/tests/baselines/reference/ArrowFunction1.js index a29e21b1fb9c4..f234409cb52cf 100644 --- a/tests/baselines/reference/ArrowFunction1.js +++ b/tests/baselines/reference/ArrowFunction1.js @@ -6,5 +6,5 @@ var v = (a: ) => { }; //// [ArrowFunction1.js] -var v = function (a) { +var v = (a) => { }; diff --git a/tests/baselines/reference/ArrowFunction4.js b/tests/baselines/reference/ArrowFunction4.js index a60136f19c72f..309f54c2ef75f 100644 --- a/tests/baselines/reference/ArrowFunction4.js +++ b/tests/baselines/reference/ArrowFunction4.js @@ -6,5 +6,5 @@ var v = (a, b) => { }; //// [ArrowFunction4.js] -var v = function (a, b) { +var v = (a, b) => { }; diff --git a/tests/baselines/reference/ArrowFunctionExpression1.js b/tests/baselines/reference/ArrowFunctionExpression1.js index aa18c62926bd5..016e1dcf903cf 100644 --- a/tests/baselines/reference/ArrowFunctionExpression1.js +++ b/tests/baselines/reference/ArrowFunctionExpression1.js @@ -4,4 +4,4 @@ var v = (public x: string) => { }; //// [ArrowFunctionExpression1.js] -var v = function (x) { }; +var v = (x) => { }; diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js b/tests/baselines/reference/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js index c338dc64e2b55..cbf1a04111177 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js @@ -53,44 +53,26 @@ namespace clodule4 { //// [ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js] // all expected to be errors -var clodule1 = /** @class */ (function () { - function clodule1() { - } - return clodule1; -}()); +class clodule1 { +} (function (clodule1) { function f(x) { } })(clodule1 || (clodule1 = {})); -var clodule2 = /** @class */ (function () { - function clodule2() { - } - return clodule2; -}()); +class clodule2 { +} (function (clodule2) { var x; - var D = /** @class */ (function () { - function D() { - } - return D; - }()); -})(clodule2 || (clodule2 = {})); -var clodule3 = /** @class */ (function () { - function clodule3() { + class D { } - return clodule3; -}()); +})(clodule2 || (clodule2 = {})); +class clodule3 { +} (function (clodule3) { clodule3.y = { id: T }; })(clodule3 || (clodule3 = {})); -var clodule4 = /** @class */ (function () { - function clodule4() { - } - return clodule4; -}()); +class clodule4 { +} (function (clodule4) { - var D = /** @class */ (function () { - function D() { - } - return D; - }()); + class D { + } })(clodule4 || (clodule4 = {})); diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.js index e16c84c4342e5..1449486288f7f 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.js @@ -18,12 +18,9 @@ namespace clodule { //// [ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.js] -var clodule = /** @class */ (function () { - function clodule() { - } - clodule.fn = function (id) { }; - return clodule; -}()); +class clodule { + static fn(id) { } +} (function (clodule) { // error: duplicate identifier expected function fn(x, y) { diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.js index 892a7e4c1ed5c..5298599c30959 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.js @@ -18,12 +18,9 @@ namespace clodule { //// [ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.js] -var clodule = /** @class */ (function () { - function clodule() { - } - clodule.fn = function (id) { }; - return clodule; -}()); +class clodule { + static fn(id) { } +} (function (clodule) { // error: duplicate identifier expected function fn(x, y) { diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js index c624c170d13e6..7f11ed4be75de 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js @@ -18,12 +18,9 @@ namespace clodule { //// [ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js] -var clodule = /** @class */ (function () { - function clodule() { - } - clodule.sfn = function (id) { return 42; }; - return clodule; -}()); +class clodule { + static sfn(id) { return 42; } +} (function (clodule) { // error: duplicate identifier expected function fn(x, y) { diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js index 0affe190c890c..85b02b32043b2 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js @@ -25,28 +25,26 @@ namespace A { } //// [ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js] -var Point = /** @class */ (function () { - function Point(x, y) { +class Point { + constructor(x, y) { this.x = x; this.y = y; } - Point.Origin = function () { return { x: 0, y: 0 }; }; // unexpected error here bug 840246 - return Point; -}()); + static Origin() { return { x: 0, y: 0 }; } // unexpected error here bug 840246 +} (function (Point) { function Origin() { return null; } //expected duplicate identifier error Point.Origin = Origin; })(Point || (Point = {})); var A; (function (A) { - var Point = /** @class */ (function () { - function Point(x, y) { + class Point { + constructor(x, y) { this.x = x; this.y = y; } - Point.Origin = function () { return { x: 0, y: 0 }; }; // unexpected error here bug 840246 - return Point; - }()); + static Origin() { return { x: 0, y: 0 }; } // unexpected error here bug 840246 + } A.Point = Point; (function (Point) { function Origin() { return ""; } //expected duplicate identifier error diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js index 32359be4c4f0f..c414c47c7a8af 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js @@ -25,27 +25,25 @@ namespace A { } //// [ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js] -var Point = /** @class */ (function () { - function Point(x, y) { +class Point { + constructor(x, y) { this.x = x; this.y = y; } - Point.Origin = function () { return { x: 0, y: 0 }; }; - return Point; -}()); + static Origin() { return { x: 0, y: 0 }; } +} (function (Point) { function Origin() { return ""; } // not an error, since not exported })(Point || (Point = {})); var A; (function (A) { - var Point = /** @class */ (function () { - function Point(x, y) { + class Point { + constructor(x, y) { this.x = x; this.y = y; } - Point.Origin = function () { return { x: 0, y: 0 }; }; - return Point; - }()); + static Origin() { return { x: 0, y: 0 }; } + } A.Point = Point; (function (Point) { function Origin() { return ""; } // not an error since not exported diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js index 6c04a594c133f..84158d29be56c 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js @@ -25,27 +25,25 @@ namespace A { } //// [ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js] -var Point = /** @class */ (function () { - function Point(x, y) { +class Point { + constructor(x, y) { this.x = x; this.y = y; } - Point.Origin = { x: 0, y: 0 }; - return Point; -}()); +} +Point.Origin = { x: 0, y: 0 }; (function (Point) { Point.Origin = ""; //expected duplicate identifier error })(Point || (Point = {})); var A; (function (A) { - var Point = /** @class */ (function () { - function Point(x, y) { + class Point { + constructor(x, y) { this.x = x; this.y = y; } - Point.Origin = { x: 0, y: 0 }; - return Point; - }()); + } + Point.Origin = { x: 0, y: 0 }; A.Point = Point; (function (Point) { Point.Origin = ""; //expected duplicate identifier error diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.js index 62a5c6e1dacce..112ce1d162e11 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.js @@ -25,27 +25,25 @@ namespace A { } //// [ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.js] -var Point = /** @class */ (function () { - function Point(x, y) { +class Point { + constructor(x, y) { this.x = x; this.y = y; } - Point.Origin = { x: 0, y: 0 }; - return Point; -}()); +} +Point.Origin = { x: 0, y: 0 }; (function (Point) { var Origin = ""; // not an error, since not exported })(Point || (Point = {})); var A; (function (A) { - var Point = /** @class */ (function () { - function Point(x, y) { + class Point { + constructor(x, y) { this.x = x; this.y = y; } - Point.Origin = { x: 0, y: 0 }; - return Point; - }()); + } + Point.Origin = { x: 0, y: 0 }; A.Point = Point; (function (Point) { var Origin = ""; // not an error since not exported diff --git a/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.js b/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.js index 283e2936197d0..6acfa440e20b2 100644 --- a/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.js @@ -45,13 +45,12 @@ var X; (function (X) { var Y; (function (Y) { - var Point = /** @class */ (function () { - function Point(x, y) { + class Point { + constructor(x, y) { this.x = x; this.y = y; } - return Point; - }()); + } Y.Point = Point; })(Y = X.Y || (X.Y = {})); })(X || (X = {})); @@ -60,7 +59,7 @@ var X; (function (X) { var Y; (function (Y) { - var Point; + let Point; (function (Point) { Point.Origin = new Point(0, 0); })(Point = Y.Point || (Y.Point = {})); @@ -71,11 +70,8 @@ var X; 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() { - } - return A; -}()); +class A { +} (function (A) { A.Instance = new A(); })(A || (A = {})); diff --git a/tests/baselines/reference/ClassDeclaration10.js b/tests/baselines/reference/ClassDeclaration10.js index 5f73b8d33a788..3cb041d7a5b45 100644 --- a/tests/baselines/reference/ClassDeclaration10.js +++ b/tests/baselines/reference/ClassDeclaration10.js @@ -7,8 +7,5 @@ class C { } //// [ClassDeclaration10.js] -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { +} diff --git a/tests/baselines/reference/ClassDeclaration11.js b/tests/baselines/reference/ClassDeclaration11.js index e89e124dec1a2..2f42f600bf88b 100644 --- a/tests/baselines/reference/ClassDeclaration11.js +++ b/tests/baselines/reference/ClassDeclaration11.js @@ -7,9 +7,6 @@ class C { } //// [ClassDeclaration11.js] -var C = /** @class */ (function () { - function C() { - } - C.prototype.foo = function () { }; - return C; -}()); +class C { + foo() { } +} diff --git a/tests/baselines/reference/ClassDeclaration13.js b/tests/baselines/reference/ClassDeclaration13.js index f7d99956c17c3..371e91c0bc865 100644 --- a/tests/baselines/reference/ClassDeclaration13.js +++ b/tests/baselines/reference/ClassDeclaration13.js @@ -7,9 +7,6 @@ class C { } //// [ClassDeclaration13.js] -var C = /** @class */ (function () { - function C() { - } - C.prototype.bar = function () { }; - return C; -}()); +class C { + bar() { } +} diff --git a/tests/baselines/reference/ClassDeclaration14.js b/tests/baselines/reference/ClassDeclaration14.js index 151db74105a9b..3b62c34cf23fa 100644 --- a/tests/baselines/reference/ClassDeclaration14.js +++ b/tests/baselines/reference/ClassDeclaration14.js @@ -7,8 +7,5 @@ class C { } //// [ClassDeclaration14.js] -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { +} diff --git a/tests/baselines/reference/ClassDeclaration15.js b/tests/baselines/reference/ClassDeclaration15.js index e9b350b48b45f..f94caa3511ee2 100644 --- a/tests/baselines/reference/ClassDeclaration15.js +++ b/tests/baselines/reference/ClassDeclaration15.js @@ -7,8 +7,6 @@ class C { } //// [ClassDeclaration15.js] -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { + constructor() { } +} diff --git a/tests/baselines/reference/ClassDeclaration21.js b/tests/baselines/reference/ClassDeclaration21.js index 8dc2048f31532..3245fbc09db44 100644 --- a/tests/baselines/reference/ClassDeclaration21.js +++ b/tests/baselines/reference/ClassDeclaration21.js @@ -7,9 +7,6 @@ class C { } //// [ClassDeclaration21.js] -var C = /** @class */ (function () { - function C() { - } - C.prototype[1] = function () { }; - return C; -}()); +class C { + 1() { } +} diff --git a/tests/baselines/reference/ClassDeclaration22.js b/tests/baselines/reference/ClassDeclaration22.js index 4a03cf47b15f2..6fffe6f1ecb59 100644 --- a/tests/baselines/reference/ClassDeclaration22.js +++ b/tests/baselines/reference/ClassDeclaration22.js @@ -7,9 +7,6 @@ class C { } //// [ClassDeclaration22.js] -var C = /** @class */ (function () { - function C() { - } - C.prototype["bar"] = function () { }; - return C; -}()); +class C { + "bar"() { } +} diff --git a/tests/baselines/reference/ClassDeclaration24.js b/tests/baselines/reference/ClassDeclaration24.js index e248c088afd3f..52b44e71162a2 100644 --- a/tests/baselines/reference/ClassDeclaration24.js +++ b/tests/baselines/reference/ClassDeclaration24.js @@ -5,8 +5,5 @@ class any { } //// [ClassDeclaration24.js] -var any = /** @class */ (function () { - function any() { - } - return any; -}()); +class any { +} diff --git a/tests/baselines/reference/ClassDeclaration25.js b/tests/baselines/reference/ClassDeclaration25.js index 67283dc647c6e..3edb98403adb8 100644 --- a/tests/baselines/reference/ClassDeclaration25.js +++ b/tests/baselines/reference/ClassDeclaration25.js @@ -12,8 +12,5 @@ class List implements IList { //// [ClassDeclaration25.js] -var List = /** @class */ (function () { - function List() { - } - return List; -}()); +class List { +} diff --git a/tests/baselines/reference/ClassDeclaration26.js b/tests/baselines/reference/ClassDeclaration26.js index ff1c2fdd8ed52..ef0394713d52a 100644 --- a/tests/baselines/reference/ClassDeclaration26.js +++ b/tests/baselines/reference/ClassDeclaration26.js @@ -8,11 +8,10 @@ class C { } //// [ClassDeclaration26.js] -var C = /** @class */ (function () { - function C() { +class C { + constructor() { this.foo = 10; } - return C; -}()); +} var constructor; -(function () { }); +() => { }; diff --git a/tests/baselines/reference/ClassDeclaration8.js b/tests/baselines/reference/ClassDeclaration8.js index 3a288f769dac4..d8856c8acee9a 100644 --- a/tests/baselines/reference/ClassDeclaration8.js +++ b/tests/baselines/reference/ClassDeclaration8.js @@ -6,8 +6,5 @@ class C { } //// [ClassDeclaration8.js] -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { +} diff --git a/tests/baselines/reference/ClassDeclaration9.js b/tests/baselines/reference/ClassDeclaration9.js index 0fbf5c9ad7f6c..da185fe963361 100644 --- a/tests/baselines/reference/ClassDeclaration9.js +++ b/tests/baselines/reference/ClassDeclaration9.js @@ -6,8 +6,5 @@ class C { } //// [ClassDeclaration9.js] -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { +} diff --git a/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration.js b/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration.js index c359f9000369f..77788ce8d6f92 100644 --- a/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration.js +++ b/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration.js @@ -6,9 +6,6 @@ class AtomicNumbers { } //// [ClassDeclarationWithInvalidConstOnPropertyDeclaration.js] -var AtomicNumbers = /** @class */ (function () { - function AtomicNumbers() { - } - AtomicNumbers.H = 1; - return AtomicNumbers; -}()); +class AtomicNumbers { +} +AtomicNumbers.H = 1; diff --git a/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration2.js b/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration2.js index f4c93aafa39fa..40df79ce06b4e 100644 --- a/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration2.js +++ b/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration2.js @@ -7,9 +7,8 @@ class C { } //// [ClassDeclarationWithInvalidConstOnPropertyDeclaration2.js] -var C = /** @class */ (function () { - function C() { +class C { + constructor() { this.x = 10; } - return C; -}()); +} diff --git a/tests/baselines/reference/ES3For-ofTypeCheck1(target=es2015).js b/tests/baselines/reference/ES3For-ofTypeCheck1(target=es2015).js new file mode 100644 index 0000000000000..af8e5ba01d848 --- /dev/null +++ b/tests/baselines/reference/ES3For-ofTypeCheck1(target=es2015).js @@ -0,0 +1,7 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck1.ts] //// + +//// [ES3For-ofTypeCheck1.ts] +for (var v of "") { } + +//// [ES3For-ofTypeCheck1.js] +for (var v of "") { } diff --git a/tests/baselines/reference/ES3For-ofTypeCheck1.symbols b/tests/baselines/reference/ES3For-ofTypeCheck1(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES3For-ofTypeCheck1.symbols rename to tests/baselines/reference/ES3For-ofTypeCheck1(target=es2015).symbols diff --git a/tests/baselines/reference/ES3For-ofTypeCheck1.types b/tests/baselines/reference/ES3For-ofTypeCheck1(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES3For-ofTypeCheck1.types rename to tests/baselines/reference/ES3For-ofTypeCheck1(target=es2015).types diff --git a/tests/baselines/reference/ES3For-ofTypeCheck1.js b/tests/baselines/reference/ES3For-ofTypeCheck1(target=es5).js similarity index 100% rename from tests/baselines/reference/ES3For-ofTypeCheck1.js rename to tests/baselines/reference/ES3For-ofTypeCheck1(target=es5).js diff --git a/tests/baselines/reference/ES3For-ofTypeCheck1(target=es5).symbols b/tests/baselines/reference/ES3For-ofTypeCheck1(target=es5).symbols new file mode 100644 index 0000000000000..d8cc394ad2ab1 --- /dev/null +++ b/tests/baselines/reference/ES3For-ofTypeCheck1(target=es5).symbols @@ -0,0 +1,6 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck1.ts] //// + +=== ES3For-ofTypeCheck1.ts === +for (var v of "") { } +>v : Symbol(v, Decl(ES3For-ofTypeCheck1.ts, 0, 8)) + diff --git a/tests/baselines/reference/ES3For-ofTypeCheck1(target=es5).types b/tests/baselines/reference/ES3For-ofTypeCheck1(target=es5).types new file mode 100644 index 0000000000000..a96d6b3a27d63 --- /dev/null +++ b/tests/baselines/reference/ES3For-ofTypeCheck1(target=es5).types @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck1.ts] //// + +=== ES3For-ofTypeCheck1.ts === +for (var v of "") { } +>v : string +> : ^^^^^^ +>"" : "" +> : ^^ + diff --git a/tests/baselines/reference/ES3For-ofTypeCheck2(target=es2015).js b/tests/baselines/reference/ES3For-ofTypeCheck2(target=es2015).js new file mode 100644 index 0000000000000..abc5b98801ce6 --- /dev/null +++ b/tests/baselines/reference/ES3For-ofTypeCheck2(target=es2015).js @@ -0,0 +1,7 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck2.ts] //// + +//// [ES3For-ofTypeCheck2.ts] +for (var v of [true]) { } + +//// [ES3For-ofTypeCheck2.js] +for (var v of [true]) { } diff --git a/tests/baselines/reference/ES3For-ofTypeCheck2.symbols b/tests/baselines/reference/ES3For-ofTypeCheck2(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES3For-ofTypeCheck2.symbols rename to tests/baselines/reference/ES3For-ofTypeCheck2(target=es2015).symbols diff --git a/tests/baselines/reference/ES3For-ofTypeCheck2.types b/tests/baselines/reference/ES3For-ofTypeCheck2(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES3For-ofTypeCheck2.types rename to tests/baselines/reference/ES3For-ofTypeCheck2(target=es2015).types diff --git a/tests/baselines/reference/ES3For-ofTypeCheck2.js b/tests/baselines/reference/ES3For-ofTypeCheck2(target=es5).js similarity index 100% rename from tests/baselines/reference/ES3For-ofTypeCheck2.js rename to tests/baselines/reference/ES3For-ofTypeCheck2(target=es5).js diff --git a/tests/baselines/reference/ES3For-ofTypeCheck2(target=es5).symbols b/tests/baselines/reference/ES3For-ofTypeCheck2(target=es5).symbols new file mode 100644 index 0000000000000..5bb17f81215af --- /dev/null +++ b/tests/baselines/reference/ES3For-ofTypeCheck2(target=es5).symbols @@ -0,0 +1,6 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck2.ts] //// + +=== ES3For-ofTypeCheck2.ts === +for (var v of [true]) { } +>v : Symbol(v, Decl(ES3For-ofTypeCheck2.ts, 0, 8)) + diff --git a/tests/baselines/reference/ES3For-ofTypeCheck2(target=es5).types b/tests/baselines/reference/ES3For-ofTypeCheck2(target=es5).types new file mode 100644 index 0000000000000..f358728ef37c6 --- /dev/null +++ b/tests/baselines/reference/ES3For-ofTypeCheck2(target=es5).types @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck2.ts] //// + +=== ES3For-ofTypeCheck2.ts === +for (var v of [true]) { } +>v : boolean +> : ^^^^^^^ +>[true] : boolean[] +> : ^^^^^^^^^ +>true : true +> : ^^^^ + diff --git a/tests/baselines/reference/ES3For-ofTypeCheck4(target=es2015).js b/tests/baselines/reference/ES3For-ofTypeCheck4(target=es2015).js new file mode 100644 index 0000000000000..031efba7fe0f8 --- /dev/null +++ b/tests/baselines/reference/ES3For-ofTypeCheck4(target=es2015).js @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck4.ts] //// + +//// [ES3For-ofTypeCheck4.ts] +var union: string | string[]; +for (const v of union) { } + +//// [ES3For-ofTypeCheck4.js] +var union; +for (const v of union) { } diff --git a/tests/baselines/reference/ES3For-ofTypeCheck4.symbols b/tests/baselines/reference/ES3For-ofTypeCheck4(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES3For-ofTypeCheck4.symbols rename to tests/baselines/reference/ES3For-ofTypeCheck4(target=es2015).symbols diff --git a/tests/baselines/reference/ES3For-ofTypeCheck4.types b/tests/baselines/reference/ES3For-ofTypeCheck4(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES3For-ofTypeCheck4.types rename to tests/baselines/reference/ES3For-ofTypeCheck4(target=es2015).types diff --git a/tests/baselines/reference/ES3For-ofTypeCheck4.js b/tests/baselines/reference/ES3For-ofTypeCheck4(target=es5).js similarity index 100% rename from tests/baselines/reference/ES3For-ofTypeCheck4.js rename to tests/baselines/reference/ES3For-ofTypeCheck4(target=es5).js diff --git a/tests/baselines/reference/ES3For-ofTypeCheck4(target=es5).symbols b/tests/baselines/reference/ES3For-ofTypeCheck4(target=es5).symbols new file mode 100644 index 0000000000000..8b8eb511ac8aa --- /dev/null +++ b/tests/baselines/reference/ES3For-ofTypeCheck4(target=es5).symbols @@ -0,0 +1,10 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck4.ts] //// + +=== ES3For-ofTypeCheck4.ts === +var union: string | string[]; +>union : Symbol(union, Decl(ES3For-ofTypeCheck4.ts, 0, 3)) + +for (const v of union) { } +>v : Symbol(v, Decl(ES3For-ofTypeCheck4.ts, 1, 10)) +>union : Symbol(union, Decl(ES3For-ofTypeCheck4.ts, 0, 3)) + diff --git a/tests/baselines/reference/ES3For-ofTypeCheck4(target=es5).types b/tests/baselines/reference/ES3For-ofTypeCheck4(target=es5).types new file mode 100644 index 0000000000000..868987211278f --- /dev/null +++ b/tests/baselines/reference/ES3For-ofTypeCheck4(target=es5).types @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck4.ts] //// + +=== ES3For-ofTypeCheck4.ts === +var union: string | string[]; +>union : string | string[] +> : ^^^^^^^^^^^^^^^^^ + +for (const v of union) { } +>v : string +> : ^^^^^^ +>union : string | string[] +> : ^^^^^^^^^^^^^^^^^ + diff --git a/tests/baselines/reference/ES3For-ofTypeCheck6(target=es2015).js b/tests/baselines/reference/ES3For-ofTypeCheck6(target=es2015).js new file mode 100644 index 0000000000000..7ca31e97bae2e --- /dev/null +++ b/tests/baselines/reference/ES3For-ofTypeCheck6(target=es2015).js @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck6.ts] //// + +//// [ES3For-ofTypeCheck6.ts] +var union: string[] | number[]; +for (var v of union) { } + +//// [ES3For-ofTypeCheck6.js] +var union; +for (var v of union) { } diff --git a/tests/baselines/reference/ES3For-ofTypeCheck6.symbols b/tests/baselines/reference/ES3For-ofTypeCheck6(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES3For-ofTypeCheck6.symbols rename to tests/baselines/reference/ES3For-ofTypeCheck6(target=es2015).symbols diff --git a/tests/baselines/reference/ES3For-ofTypeCheck6.types b/tests/baselines/reference/ES3For-ofTypeCheck6(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES3For-ofTypeCheck6.types rename to tests/baselines/reference/ES3For-ofTypeCheck6(target=es2015).types diff --git a/tests/baselines/reference/ES3For-ofTypeCheck6.js b/tests/baselines/reference/ES3For-ofTypeCheck6(target=es5).js similarity index 100% rename from tests/baselines/reference/ES3For-ofTypeCheck6.js rename to tests/baselines/reference/ES3For-ofTypeCheck6(target=es5).js diff --git a/tests/baselines/reference/ES3For-ofTypeCheck6(target=es5).symbols b/tests/baselines/reference/ES3For-ofTypeCheck6(target=es5).symbols new file mode 100644 index 0000000000000..381139a99fff9 --- /dev/null +++ b/tests/baselines/reference/ES3For-ofTypeCheck6(target=es5).symbols @@ -0,0 +1,10 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck6.ts] //// + +=== ES3For-ofTypeCheck6.ts === +var union: string[] | number[]; +>union : Symbol(union, Decl(ES3For-ofTypeCheck6.ts, 0, 3)) + +for (var v of union) { } +>v : Symbol(v, Decl(ES3For-ofTypeCheck6.ts, 1, 8)) +>union : Symbol(union, Decl(ES3For-ofTypeCheck6.ts, 0, 3)) + diff --git a/tests/baselines/reference/ES3For-ofTypeCheck6(target=es5).types b/tests/baselines/reference/ES3For-ofTypeCheck6(target=es5).types new file mode 100644 index 0000000000000..40e3578bb437d --- /dev/null +++ b/tests/baselines/reference/ES3For-ofTypeCheck6(target=es5).types @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck6.ts] //// + +=== ES3For-ofTypeCheck6.ts === +var union: string[] | number[]; +>union : string[] | number[] +> : ^^^^^^^^^^^^^^^^^^^ + +for (var v of union) { } +>v : string | number +> : ^^^^^^^^^^^^^^^ +>union : string[] | number[] +> : ^^^^^^^^^^^^^^^^^^^ + diff --git a/tests/baselines/reference/ES5For-of1(target=es2015).js b/tests/baselines/reference/ES5For-of1(target=es2015).js new file mode 100644 index 0000000000000..3ee566049805d --- /dev/null +++ b/tests/baselines/reference/ES5For-of1(target=es2015).js @@ -0,0 +1,12 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of1.ts] //// + +//// [ES5For-of1.ts] +for (var v of ['a', 'b', 'c']) { + console.log(v); +} + +//// [ES5For-of1.js] +for (var v of ['a', 'b', 'c']) { + console.log(v); +} +//# sourceMappingURL=ES5For-of1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of1(target=es2015).js.map b/tests/baselines/reference/ES5For-of1(target=es2015).js.map new file mode 100644 index 0000000000000..e486811b4b7e9 --- /dev/null +++ b/tests/baselines/reference/ES5For-of1(target=es2015).js.map @@ -0,0 +1,3 @@ +//// [ES5For-of1.js.map] +{"version":3,"file":"ES5For-of1.js","sourceRoot":"","sources":["ES5For-of1.ts"],"names":[],"mappings":"AAAA,KAAK,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;IAC5B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC"} +//// https://sokra.github.io/source-map-visualization#base64,Zm9yICh2YXIgdiBvZiBbJ2EnLCAnYicsICdjJ10pIHsNCiAgICBjb25zb2xlLmxvZyh2KTsNCn0NCi8vIyBzb3VyY2VNYXBwaW5nVVJMPUVTNUZvci1vZjEuanMubWFw,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRVM1Rm9yLW9mMS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIkVTNUZvci1vZjEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsS0FBSyxJQUFJLENBQUMsSUFBSSxDQUFDLEdBQUcsRUFBRSxHQUFHLEVBQUUsR0FBRyxDQUFDLEVBQUUsQ0FBQztJQUM1QixPQUFPLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDO0FBQ25CLENBQUMifQ==,Zm9yICh2YXIgdiBvZiBbJ2EnLCAnYicsICdjJ10pIHsKICAgIGNvbnNvbGUubG9nKHYpOwp9 diff --git a/tests/baselines/reference/ES5For-of1(target=es2015).sourcemap.txt b/tests/baselines/reference/ES5For-of1(target=es2015).sourcemap.txt new file mode 100644 index 0000000000000..176f6b2207986 --- /dev/null +++ b/tests/baselines/reference/ES5For-of1(target=es2015).sourcemap.txt @@ -0,0 +1,92 @@ +=================================================================== +JsFile: ES5For-of1.js +mapUrl: ES5For-of1.js.map +sourceRoot: +sources: ES5For-of1.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:ES5For-of1.js +sourceFile:ES5For-of1.ts +------------------------------------------------------------------- +>>>for (var v of ['a', 'b', 'c']) { +1 > +2 >^^^^^ +3 > ^^^^ +4 > ^ +5 > ^^^^ +6 > ^ +7 > ^^^ +8 > ^^ +9 > ^^^ +10> ^^ +11> ^^^ +12> ^ +13> ^^ +14> ^ +1 > +2 >for ( +3 > var +4 > v +5 > of +6 > [ +7 > 'a' +8 > , +9 > 'b' +10> , +11> 'c' +12> ] +13> ) +14> { +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) +3 >Emitted(1, 10) Source(1, 10) + SourceIndex(0) +4 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) +5 >Emitted(1, 15) Source(1, 15) + SourceIndex(0) +6 >Emitted(1, 16) Source(1, 16) + SourceIndex(0) +7 >Emitted(1, 19) Source(1, 19) + SourceIndex(0) +8 >Emitted(1, 21) Source(1, 21) + SourceIndex(0) +9 >Emitted(1, 24) Source(1, 24) + SourceIndex(0) +10>Emitted(1, 26) Source(1, 26) + SourceIndex(0) +11>Emitted(1, 29) Source(1, 29) + SourceIndex(0) +12>Emitted(1, 30) Source(1, 30) + SourceIndex(0) +13>Emitted(1, 32) Source(1, 32) + SourceIndex(0) +14>Emitted(1, 33) Source(1, 33) + SourceIndex(0) +--- +>>> console.log(v); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > v +7 > ) +8 > ; +1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +3 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +4 >Emitted(2, 16) Source(2, 16) + SourceIndex(0) +5 >Emitted(2, 17) Source(2, 17) + SourceIndex(0) +6 >Emitted(2, 18) Source(2, 18) + SourceIndex(0) +7 >Emitted(2, 19) Source(2, 19) + SourceIndex(0) +8 >Emitted(2, 20) Source(2, 20) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 2) Source(3, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=ES5For-of1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of1.symbols b/tests/baselines/reference/ES5For-of1(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of1.symbols rename to tests/baselines/reference/ES5For-of1(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of1.types b/tests/baselines/reference/ES5For-of1(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of1.types rename to tests/baselines/reference/ES5For-of1(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of1.js b/tests/baselines/reference/ES5For-of1(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of1.js rename to tests/baselines/reference/ES5For-of1(target=es5).js diff --git a/tests/baselines/reference/ES5For-of1.js.map b/tests/baselines/reference/ES5For-of1(target=es5).js.map similarity index 100% rename from tests/baselines/reference/ES5For-of1.js.map rename to tests/baselines/reference/ES5For-of1(target=es5).js.map diff --git a/tests/baselines/reference/ES5For-of1.sourcemap.txt b/tests/baselines/reference/ES5For-of1(target=es5).sourcemap.txt similarity index 100% rename from tests/baselines/reference/ES5For-of1.sourcemap.txt rename to tests/baselines/reference/ES5For-of1(target=es5).sourcemap.txt diff --git a/tests/baselines/reference/ES5For-of1(target=es5).symbols b/tests/baselines/reference/ES5For-of1(target=es5).symbols new file mode 100644 index 0000000000000..c46185e48bf70 --- /dev/null +++ b/tests/baselines/reference/ES5For-of1(target=es5).symbols @@ -0,0 +1,12 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of1.ts] //// + +=== ES5For-of1.ts === +for (var v of ['a', 'b', 'c']) { +>v : Symbol(v, Decl(ES5For-of1.ts, 0, 8)) + + console.log(v); +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>v : Symbol(v, Decl(ES5For-of1.ts, 0, 8)) +} diff --git a/tests/baselines/reference/ES5For-of1(target=es5).types b/tests/baselines/reference/ES5For-of1(target=es5).types new file mode 100644 index 0000000000000..2e769b3684013 --- /dev/null +++ b/tests/baselines/reference/ES5For-of1(target=es5).types @@ -0,0 +1,27 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of1.ts] //// + +=== ES5For-of1.ts === +for (var v of ['a', 'b', 'c']) { +>v : string +> : ^^^^^^ +>['a', 'b', 'c'] : string[] +> : ^^^^^^^^ +>'a' : "a" +> : ^^^ +>'b' : "b" +> : ^^^ +>'c' : "c" +> : ^^^ + + console.log(v); +>console.log(v) : void +> : ^^^^ +>console.log : (...data: any[]) => void +> : ^^^^ ^^ ^^^^^ +>console : Console +> : ^^^^^^^ +>log : (...data: any[]) => void +> : ^^^^ ^^ ^^^^^ +>v : string +> : ^^^^^^ +} diff --git a/tests/baselines/reference/ES5For-of10(target=es2015).js b/tests/baselines/reference/ES5For-of10(target=es2015).js new file mode 100644 index 0000000000000..09bda2be87df8 --- /dev/null +++ b/tests/baselines/reference/ES5For-of10(target=es2015).js @@ -0,0 +1,19 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of10.ts] //// + +//// [ES5For-of10.ts] +function foo() { + return { x: 0 }; +} +for (foo().x of []) { + for (foo().x of []) + var p = foo().x; +} + +//// [ES5For-of10.js] +function foo() { + return { x: 0 }; +} +for (foo().x of []) { + for (foo().x of []) + var p = foo().x; +} diff --git a/tests/baselines/reference/ES5For-of10.symbols b/tests/baselines/reference/ES5For-of10(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of10.symbols rename to tests/baselines/reference/ES5For-of10(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of10.types b/tests/baselines/reference/ES5For-of10(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of10.types rename to tests/baselines/reference/ES5For-of10(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of10.js b/tests/baselines/reference/ES5For-of10(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of10.js rename to tests/baselines/reference/ES5For-of10(target=es5).js diff --git a/tests/baselines/reference/ES5For-of10(target=es5).symbols b/tests/baselines/reference/ES5For-of10(target=es5).symbols new file mode 100644 index 0000000000000..831e4d4bfe279 --- /dev/null +++ b/tests/baselines/reference/ES5For-of10(target=es5).symbols @@ -0,0 +1,25 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of10.ts] //// + +=== ES5For-of10.ts === +function foo() { +>foo : Symbol(foo, Decl(ES5For-of10.ts, 0, 0)) + + return { x: 0 }; +>x : Symbol(x, Decl(ES5For-of10.ts, 1, 12)) +} +for (foo().x of []) { +>foo().x : Symbol(x, Decl(ES5For-of10.ts, 1, 12)) +>foo : Symbol(foo, Decl(ES5For-of10.ts, 0, 0)) +>x : Symbol(x, Decl(ES5For-of10.ts, 1, 12)) + + for (foo().x of []) +>foo().x : Symbol(x, Decl(ES5For-of10.ts, 1, 12)) +>foo : Symbol(foo, Decl(ES5For-of10.ts, 0, 0)) +>x : Symbol(x, Decl(ES5For-of10.ts, 1, 12)) + + var p = foo().x; +>p : Symbol(p, Decl(ES5For-of10.ts, 5, 11)) +>foo().x : Symbol(x, Decl(ES5For-of10.ts, 1, 12)) +>foo : Symbol(foo, Decl(ES5For-of10.ts, 0, 0)) +>x : Symbol(x, Decl(ES5For-of10.ts, 1, 12)) +} diff --git a/tests/baselines/reference/ES5For-of10(target=es5).types b/tests/baselines/reference/ES5For-of10(target=es5).types new file mode 100644 index 0000000000000..01bbdea4126dd --- /dev/null +++ b/tests/baselines/reference/ES5For-of10(target=es5).types @@ -0,0 +1,51 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of10.ts] //// + +=== ES5For-of10.ts === +function foo() { +>foo : () => { x: number; } +> : ^^^^^^^^^^^^^^^^^^^^ + + return { x: 0 }; +>{ x: 0 } : { x: number; } +> : ^^^^^^^^^^^^^^ +>x : number +> : ^^^^^^ +>0 : 0 +> : ^ +} +for (foo().x of []) { +>foo().x : number +> : ^^^^^^ +>foo() : { x: number; } +> : ^^^^^^^^^^^^^^ +>foo : () => { x: number; } +> : ^^^^^^^^^^^^^^^^^^^^ +>x : number +> : ^^^^^^ +>[] : undefined[] +> : ^^^^^^^^^^^ + + for (foo().x of []) +>foo().x : number +> : ^^^^^^ +>foo() : { x: number; } +> : ^^^^^^^^^^^^^^ +>foo : () => { x: number; } +> : ^^^^^^^^^^^^^^^^^^^^ +>x : number +> : ^^^^^^ +>[] : undefined[] +> : ^^^^^^^^^^^ + + var p = foo().x; +>p : number +> : ^^^^^^ +>foo().x : number +> : ^^^^^^ +>foo() : { x: number; } +> : ^^^^^^^^^^^^^^ +>foo : () => { x: number; } +> : ^^^^^^^^^^^^^^^^^^^^ +>x : number +> : ^^^^^^ +} diff --git a/tests/baselines/reference/ES5For-of11(target=es2015).js b/tests/baselines/reference/ES5For-of11(target=es2015).js new file mode 100644 index 0000000000000..daa93fe417015 --- /dev/null +++ b/tests/baselines/reference/ES5For-of11(target=es2015).js @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of11.ts] //// + +//// [ES5For-of11.ts] +var v; +for (v of []) { } + +//// [ES5For-of11.js] +var v; +for (v of []) { } diff --git a/tests/baselines/reference/ES5For-of11.symbols b/tests/baselines/reference/ES5For-of11(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of11.symbols rename to tests/baselines/reference/ES5For-of11(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of11.types b/tests/baselines/reference/ES5For-of11(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of11.types rename to tests/baselines/reference/ES5For-of11(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of11.js b/tests/baselines/reference/ES5For-of11(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of11.js rename to tests/baselines/reference/ES5For-of11(target=es5).js diff --git a/tests/baselines/reference/ES5For-of11(target=es5).symbols b/tests/baselines/reference/ES5For-of11(target=es5).symbols new file mode 100644 index 0000000000000..e3f67e552847e --- /dev/null +++ b/tests/baselines/reference/ES5For-of11(target=es5).symbols @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of11.ts] //// + +=== ES5For-of11.ts === +var v; +>v : Symbol(v, Decl(ES5For-of11.ts, 0, 3)) + +for (v of []) { } +>v : Symbol(v, Decl(ES5For-of11.ts, 0, 3)) + diff --git a/tests/baselines/reference/ES5For-of11(target=es5).types b/tests/baselines/reference/ES5For-of11(target=es5).types new file mode 100644 index 0000000000000..47714be3636ca --- /dev/null +++ b/tests/baselines/reference/ES5For-of11(target=es5).types @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of11.ts] //// + +=== ES5For-of11.ts === +var v; +>v : any + +for (v of []) { } +>v : any +>[] : undefined[] +> : ^^^^^^^^^^^ + diff --git a/tests/baselines/reference/ES5For-of12.errors.txt b/tests/baselines/reference/ES5For-of12(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/ES5For-of12.errors.txt rename to tests/baselines/reference/ES5For-of12(target=es2015).errors.txt diff --git a/tests/baselines/reference/ES5For-of12(target=es2015).js b/tests/baselines/reference/ES5For-of12(target=es2015).js new file mode 100644 index 0000000000000..964a55195deef --- /dev/null +++ b/tests/baselines/reference/ES5For-of12(target=es2015).js @@ -0,0 +1,7 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of12.ts] //// + +//// [ES5For-of12.ts] +for ([""] of [[""]]) { } + +//// [ES5For-of12.js] +for ([""] of [[""]]) { } diff --git a/tests/baselines/reference/ES5For-of12.symbols b/tests/baselines/reference/ES5For-of12(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of12.symbols rename to tests/baselines/reference/ES5For-of12(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of12.types b/tests/baselines/reference/ES5For-of12(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of12.types rename to tests/baselines/reference/ES5For-of12(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of12(target=es5).errors.txt b/tests/baselines/reference/ES5For-of12(target=es5).errors.txt new file mode 100644 index 0000000000000..fe53e92b35951 --- /dev/null +++ b/tests/baselines/reference/ES5For-of12(target=es5).errors.txt @@ -0,0 +1,7 @@ +ES5For-of12.ts(1,7): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. + + +==== ES5For-of12.ts (1 errors) ==== + for ([""] of [[""]]) { } + ~~ +!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access. \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of12.js b/tests/baselines/reference/ES5For-of12(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of12.js rename to tests/baselines/reference/ES5For-of12(target=es5).js diff --git a/tests/baselines/reference/ES5For-of12(target=es5).symbols b/tests/baselines/reference/ES5For-of12(target=es5).symbols new file mode 100644 index 0000000000000..29851965a76ae --- /dev/null +++ b/tests/baselines/reference/ES5For-of12(target=es5).symbols @@ -0,0 +1,5 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of12.ts] //// + +=== ES5For-of12.ts === + +for ([""] of [[""]]) { } diff --git a/tests/baselines/reference/ES5For-of12(target=es5).types b/tests/baselines/reference/ES5For-of12(target=es5).types new file mode 100644 index 0000000000000..4d374a5e15b21 --- /dev/null +++ b/tests/baselines/reference/ES5For-of12(target=es5).types @@ -0,0 +1,15 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of12.ts] //// + +=== ES5For-of12.ts === +for ([""] of [[""]]) { } +>[""] : [string] +> : ^^^^^^^^ +>"" : "" +> : ^^ +>[[""]] : string[][] +> : ^^^^^^^^^^ +>[""] : string[] +> : ^^^^^^^^ +>"" : "" +> : ^^ + diff --git a/tests/baselines/reference/ES5For-of13(target=es2015).js b/tests/baselines/reference/ES5For-of13(target=es2015).js new file mode 100644 index 0000000000000..8a83fbe3810c2 --- /dev/null +++ b/tests/baselines/reference/ES5For-of13(target=es2015).js @@ -0,0 +1,12 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of13.ts] //// + +//// [ES5For-of13.ts] +for (let v of ['a', 'b', 'c']) { + var x = v; +} + +//// [ES5For-of13.js] +for (let v of ['a', 'b', 'c']) { + var x = v; +} +//# sourceMappingURL=ES5For-of13.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of13(target=es2015).js.map b/tests/baselines/reference/ES5For-of13(target=es2015).js.map new file mode 100644 index 0000000000000..8bc98cc2ca124 --- /dev/null +++ b/tests/baselines/reference/ES5For-of13(target=es2015).js.map @@ -0,0 +1,3 @@ +//// [ES5For-of13.js.map] +{"version":3,"file":"ES5For-of13.js","sourceRoot":"","sources":["ES5For-of13.ts"],"names":[],"mappings":"AAAA,KAAK,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;IAC5B,IAAI,CAAC,GAAG,CAAC,CAAC;AACd,CAAC"} +//// https://sokra.github.io/source-map-visualization#base64,Zm9yIChsZXQgdiBvZiBbJ2EnLCAnYicsICdjJ10pIHsNCiAgICB2YXIgeCA9IHY7DQp9DQovLyMgc291cmNlTWFwcGluZ1VSTD1FUzVGb3Itb2YxMy5qcy5tYXA=,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRVM1Rm9yLW9mMTMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJFUzVGb3Itb2YxMy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxLQUFLLElBQUksQ0FBQyxJQUFJLENBQUMsR0FBRyxFQUFFLEdBQUcsRUFBRSxHQUFHLENBQUMsRUFBRSxDQUFDO0lBQzVCLElBQUksQ0FBQyxHQUFHLENBQUMsQ0FBQztBQUNkLENBQUMifQ==,Zm9yIChsZXQgdiBvZiBbJ2EnLCAnYicsICdjJ10pIHsKICAgIHZhciB4ID0gdjsKfQ== diff --git a/tests/baselines/reference/ES5For-of13(target=es2015).sourcemap.txt b/tests/baselines/reference/ES5For-of13(target=es2015).sourcemap.txt new file mode 100644 index 0000000000000..497dd4ee6d519 --- /dev/null +++ b/tests/baselines/reference/ES5For-of13(target=es2015).sourcemap.txt @@ -0,0 +1,86 @@ +=================================================================== +JsFile: ES5For-of13.js +mapUrl: ES5For-of13.js.map +sourceRoot: +sources: ES5For-of13.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:ES5For-of13.js +sourceFile:ES5For-of13.ts +------------------------------------------------------------------- +>>>for (let v of ['a', 'b', 'c']) { +1 > +2 >^^^^^ +3 > ^^^^ +4 > ^ +5 > ^^^^ +6 > ^ +7 > ^^^ +8 > ^^ +9 > ^^^ +10> ^^ +11> ^^^ +12> ^ +13> ^^ +14> ^ +1 > +2 >for ( +3 > let +4 > v +5 > of +6 > [ +7 > 'a' +8 > , +9 > 'b' +10> , +11> 'c' +12> ] +13> ) +14> { +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) +3 >Emitted(1, 10) Source(1, 10) + SourceIndex(0) +4 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) +5 >Emitted(1, 15) Source(1, 15) + SourceIndex(0) +6 >Emitted(1, 16) Source(1, 16) + SourceIndex(0) +7 >Emitted(1, 19) Source(1, 19) + SourceIndex(0) +8 >Emitted(1, 21) Source(1, 21) + SourceIndex(0) +9 >Emitted(1, 24) Source(1, 24) + SourceIndex(0) +10>Emitted(1, 26) Source(1, 26) + SourceIndex(0) +11>Emitted(1, 29) Source(1, 29) + SourceIndex(0) +12>Emitted(1, 30) Source(1, 30) + SourceIndex(0) +13>Emitted(1, 32) Source(1, 32) + SourceIndex(0) +14>Emitted(1, 33) Source(1, 33) + SourceIndex(0) +--- +>>> var x = v; +1 >^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +1 > + > +2 > var +3 > x +4 > = +5 > v +6 > ; +1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(2, 9) Source(2, 9) + SourceIndex(0) +3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +4 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +5 >Emitted(2, 14) Source(2, 14) + SourceIndex(0) +6 >Emitted(2, 15) Source(2, 15) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 2) Source(3, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=ES5For-of13.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of13.symbols b/tests/baselines/reference/ES5For-of13(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of13.symbols rename to tests/baselines/reference/ES5For-of13(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of13.types b/tests/baselines/reference/ES5For-of13(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of13.types rename to tests/baselines/reference/ES5For-of13(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of13.js b/tests/baselines/reference/ES5For-of13(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of13.js rename to tests/baselines/reference/ES5For-of13(target=es5).js diff --git a/tests/baselines/reference/ES5For-of13.js.map b/tests/baselines/reference/ES5For-of13(target=es5).js.map similarity index 100% rename from tests/baselines/reference/ES5For-of13.js.map rename to tests/baselines/reference/ES5For-of13(target=es5).js.map diff --git a/tests/baselines/reference/ES5For-of13.sourcemap.txt b/tests/baselines/reference/ES5For-of13(target=es5).sourcemap.txt similarity index 100% rename from tests/baselines/reference/ES5For-of13.sourcemap.txt rename to tests/baselines/reference/ES5For-of13(target=es5).sourcemap.txt diff --git a/tests/baselines/reference/ES5For-of13(target=es5).symbols b/tests/baselines/reference/ES5For-of13(target=es5).symbols new file mode 100644 index 0000000000000..be7a964d3be51 --- /dev/null +++ b/tests/baselines/reference/ES5For-of13(target=es5).symbols @@ -0,0 +1,10 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of13.ts] //// + +=== ES5For-of13.ts === +for (let v of ['a', 'b', 'c']) { +>v : Symbol(v, Decl(ES5For-of13.ts, 0, 8)) + + var x = v; +>x : Symbol(x, Decl(ES5For-of13.ts, 1, 7)) +>v : Symbol(v, Decl(ES5For-of13.ts, 0, 8)) +} diff --git a/tests/baselines/reference/ES5For-of13(target=es5).types b/tests/baselines/reference/ES5For-of13(target=es5).types new file mode 100644 index 0000000000000..42c2dea375220 --- /dev/null +++ b/tests/baselines/reference/ES5For-of13(target=es5).types @@ -0,0 +1,21 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of13.ts] //// + +=== ES5For-of13.ts === +for (let v of ['a', 'b', 'c']) { +>v : string +> : ^^^^^^ +>['a', 'b', 'c'] : string[] +> : ^^^^^^^^ +>'a' : "a" +> : ^^^ +>'b' : "b" +> : ^^^ +>'c' : "c" +> : ^^^ + + var x = v; +>x : string +> : ^^^^^^ +>v : string +> : ^^^^^^ +} diff --git a/tests/baselines/reference/ES5For-of14(target=es2015).js b/tests/baselines/reference/ES5For-of14(target=es2015).js new file mode 100644 index 0000000000000..3e84ee916125a --- /dev/null +++ b/tests/baselines/reference/ES5For-of14(target=es2015).js @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of14.ts] //// + +//// [ES5For-of14.ts] +for (const v of []) { + var x = v; +} + +//// [ES5For-of14.js] +for (const v of []) { + var x = v; +} diff --git a/tests/baselines/reference/ES5For-of14.symbols b/tests/baselines/reference/ES5For-of14(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of14.symbols rename to tests/baselines/reference/ES5For-of14(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of14.types b/tests/baselines/reference/ES5For-of14(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of14.types rename to tests/baselines/reference/ES5For-of14(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of14.js b/tests/baselines/reference/ES5For-of14(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of14.js rename to tests/baselines/reference/ES5For-of14(target=es5).js diff --git a/tests/baselines/reference/ES5For-of14(target=es5).symbols b/tests/baselines/reference/ES5For-of14(target=es5).symbols new file mode 100644 index 0000000000000..58a736c3ecc2c --- /dev/null +++ b/tests/baselines/reference/ES5For-of14(target=es5).symbols @@ -0,0 +1,10 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of14.ts] //// + +=== ES5For-of14.ts === +for (const v of []) { +>v : Symbol(v, Decl(ES5For-of14.ts, 0, 10)) + + var x = v; +>x : Symbol(x, Decl(ES5For-of14.ts, 1, 7)) +>v : Symbol(v, Decl(ES5For-of14.ts, 0, 10)) +} diff --git a/tests/baselines/reference/ES5For-of14(target=es5).types b/tests/baselines/reference/ES5For-of14(target=es5).types new file mode 100644 index 0000000000000..447dfafa6609f --- /dev/null +++ b/tests/baselines/reference/ES5For-of14(target=es5).types @@ -0,0 +1,12 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of14.ts] //// + +=== ES5For-of14.ts === +for (const v of []) { +>v : any +>[] : undefined[] +> : ^^^^^^^^^^^ + + var x = v; +>x : any +>v : any +} diff --git a/tests/baselines/reference/ES5For-of15(target=es2015).js b/tests/baselines/reference/ES5For-of15(target=es2015).js new file mode 100644 index 0000000000000..58d1ffb0dab23 --- /dev/null +++ b/tests/baselines/reference/ES5For-of15(target=es2015).js @@ -0,0 +1,17 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of15.ts] //// + +//// [ES5For-of15.ts] +for (let v of []) { + v; + for (const v of []) { + var x = v; + } +} + +//// [ES5For-of15.js] +for (let v of []) { + v; + for (const v of []) { + var x = v; + } +} diff --git a/tests/baselines/reference/ES5For-of15.symbols b/tests/baselines/reference/ES5For-of15(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of15.symbols rename to tests/baselines/reference/ES5For-of15(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of15.types b/tests/baselines/reference/ES5For-of15(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of15.types rename to tests/baselines/reference/ES5For-of15(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of15.js b/tests/baselines/reference/ES5For-of15(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of15.js rename to tests/baselines/reference/ES5For-of15(target=es5).js diff --git a/tests/baselines/reference/ES5For-of15(target=es5).symbols b/tests/baselines/reference/ES5For-of15(target=es5).symbols new file mode 100644 index 0000000000000..02c9120b447a2 --- /dev/null +++ b/tests/baselines/reference/ES5For-of15(target=es5).symbols @@ -0,0 +1,17 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of15.ts] //// + +=== ES5For-of15.ts === +for (let v of []) { +>v : Symbol(v, Decl(ES5For-of15.ts, 0, 8)) + + v; +>v : Symbol(v, Decl(ES5For-of15.ts, 0, 8)) + + for (const v of []) { +>v : Symbol(v, Decl(ES5For-of15.ts, 2, 14)) + + var x = v; +>x : Symbol(x, Decl(ES5For-of15.ts, 3, 11)) +>v : Symbol(v, Decl(ES5For-of15.ts, 2, 14)) + } +} diff --git a/tests/baselines/reference/ES5For-of15(target=es5).types b/tests/baselines/reference/ES5For-of15(target=es5).types new file mode 100644 index 0000000000000..59dd8fbcb942e --- /dev/null +++ b/tests/baselines/reference/ES5For-of15(target=es5).types @@ -0,0 +1,21 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of15.ts] //// + +=== ES5For-of15.ts === +for (let v of []) { +>v : any +>[] : undefined[] +> : ^^^^^^^^^^^ + + v; +>v : any + + for (const v of []) { +>v : any +>[] : undefined[] +> : ^^^^^^^^^^^ + + var x = v; +>x : any +>v : any + } +} diff --git a/tests/baselines/reference/ES5For-of16(target=es2015).js b/tests/baselines/reference/ES5For-of16(target=es2015).js new file mode 100644 index 0000000000000..199e8a861ca35 --- /dev/null +++ b/tests/baselines/reference/ES5For-of16(target=es2015).js @@ -0,0 +1,19 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of16.ts] //// + +//// [ES5For-of16.ts] +for (let v of []) { + v; + for (let v of []) { + var x = v; + v++; + } +} + +//// [ES5For-of16.js] +for (let v of []) { + v; + for (let v of []) { + var x = v; + v++; + } +} diff --git a/tests/baselines/reference/ES5For-of16.symbols b/tests/baselines/reference/ES5For-of16(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of16.symbols rename to tests/baselines/reference/ES5For-of16(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of16.types b/tests/baselines/reference/ES5For-of16(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of16.types rename to tests/baselines/reference/ES5For-of16(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of16.js b/tests/baselines/reference/ES5For-of16(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of16.js rename to tests/baselines/reference/ES5For-of16(target=es5).js diff --git a/tests/baselines/reference/ES5For-of16(target=es5).symbols b/tests/baselines/reference/ES5For-of16(target=es5).symbols new file mode 100644 index 0000000000000..6218bd628f20f --- /dev/null +++ b/tests/baselines/reference/ES5For-of16(target=es5).symbols @@ -0,0 +1,20 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of16.ts] //// + +=== ES5For-of16.ts === +for (let v of []) { +>v : Symbol(v, Decl(ES5For-of16.ts, 0, 8)) + + v; +>v : Symbol(v, Decl(ES5For-of16.ts, 0, 8)) + + for (let v of []) { +>v : Symbol(v, Decl(ES5For-of16.ts, 2, 12)) + + var x = v; +>x : Symbol(x, Decl(ES5For-of16.ts, 3, 11)) +>v : Symbol(v, Decl(ES5For-of16.ts, 2, 12)) + + v++; +>v : Symbol(v, Decl(ES5For-of16.ts, 2, 12)) + } +} diff --git a/tests/baselines/reference/ES5For-of16(target=es5).types b/tests/baselines/reference/ES5For-of16(target=es5).types new file mode 100644 index 0000000000000..cbb8f86a4c0a6 --- /dev/null +++ b/tests/baselines/reference/ES5For-of16(target=es5).types @@ -0,0 +1,26 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of16.ts] //// + +=== ES5For-of16.ts === +for (let v of []) { +>v : any +>[] : undefined[] +> : ^^^^^^^^^^^ + + v; +>v : any + + for (let v of []) { +>v : any +>[] : undefined[] +> : ^^^^^^^^^^^ + + var x = v; +>x : any +>v : any + + v++; +>v++ : number +> : ^^^^^^ +>v : any + } +} diff --git a/tests/baselines/reference/ES5For-of17.errors.txt b/tests/baselines/reference/ES5For-of17(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/ES5For-of17.errors.txt rename to tests/baselines/reference/ES5For-of17(target=es2015).errors.txt diff --git a/tests/baselines/reference/ES5For-of17(target=es2015).js b/tests/baselines/reference/ES5For-of17(target=es2015).js new file mode 100644 index 0000000000000..71c348468a7ff --- /dev/null +++ b/tests/baselines/reference/ES5For-of17(target=es2015).js @@ -0,0 +1,19 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of17.ts] //// + +//// [ES5For-of17.ts] +for (let v of []) { + v; + for (let v of [v]) { + var x = v; + v++; + } +} + +//// [ES5For-of17.js] +for (let v of []) { + v; + for (let v of [v]) { + var x = v; + v++; + } +} diff --git a/tests/baselines/reference/ES5For-of17.symbols b/tests/baselines/reference/ES5For-of17(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of17.symbols rename to tests/baselines/reference/ES5For-of17(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of17.types b/tests/baselines/reference/ES5For-of17(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of17.types rename to tests/baselines/reference/ES5For-of17(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of17(target=es5).errors.txt b/tests/baselines/reference/ES5For-of17(target=es5).errors.txt new file mode 100644 index 0000000000000..8f20fb7f68a15 --- /dev/null +++ b/tests/baselines/reference/ES5For-of17(target=es5).errors.txt @@ -0,0 +1,14 @@ +ES5For-of17.ts(3,20): error TS2448: Block-scoped variable 'v' used before its declaration. + + +==== ES5For-of17.ts (1 errors) ==== + for (let v of []) { + v; + for (let v of [v]) { + ~ +!!! error TS2448: Block-scoped variable 'v' used before its declaration. +!!! related TS2728 ES5For-of17.ts:3:14: 'v' is declared here. + var x = v; + v++; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of17.js b/tests/baselines/reference/ES5For-of17(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of17.js rename to tests/baselines/reference/ES5For-of17(target=es5).js diff --git a/tests/baselines/reference/ES5For-of17(target=es5).symbols b/tests/baselines/reference/ES5For-of17(target=es5).symbols new file mode 100644 index 0000000000000..d0c784325743d --- /dev/null +++ b/tests/baselines/reference/ES5For-of17(target=es5).symbols @@ -0,0 +1,21 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of17.ts] //// + +=== ES5For-of17.ts === +for (let v of []) { +>v : Symbol(v, Decl(ES5For-of17.ts, 0, 8)) + + v; +>v : Symbol(v, Decl(ES5For-of17.ts, 0, 8)) + + for (let v of [v]) { +>v : Symbol(v, Decl(ES5For-of17.ts, 2, 12)) +>v : Symbol(v, Decl(ES5For-of17.ts, 2, 12)) + + var x = v; +>x : Symbol(x, Decl(ES5For-of17.ts, 3, 11)) +>v : Symbol(v, Decl(ES5For-of17.ts, 2, 12)) + + v++; +>v : Symbol(v, Decl(ES5For-of17.ts, 2, 12)) + } +} diff --git a/tests/baselines/reference/ES5For-of17(target=es5).types b/tests/baselines/reference/ES5For-of17(target=es5).types new file mode 100644 index 0000000000000..04cd108109cc6 --- /dev/null +++ b/tests/baselines/reference/ES5For-of17(target=es5).types @@ -0,0 +1,34 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of17.ts] //// + +=== ES5For-of17.ts === +for (let v of []) { +>v : any +> : ^^^ +>[] : undefined[] +> : ^^^^^^^^^^^ + + v; +>v : any +> : ^^^ + + for (let v of [v]) { +>v : any +> : ^^^ +>[v] : any[] +> : ^^^^^ +>v : any +> : ^^^ + + var x = v; +>x : any +> : ^^^ +>v : any +> : ^^^ + + v++; +>v++ : number +> : ^^^^^^ +>v : any +> : ^^^ + } +} diff --git a/tests/baselines/reference/ES5For-of18(target=es2015).js b/tests/baselines/reference/ES5For-of18(target=es2015).js new file mode 100644 index 0000000000000..d68fda7a14662 --- /dev/null +++ b/tests/baselines/reference/ES5For-of18(target=es2015).js @@ -0,0 +1,18 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of18.ts] //// + +//// [ES5For-of18.ts] +for (let v of []) { + v; +} +for (let v of []) { + v; +} + + +//// [ES5For-of18.js] +for (let v of []) { + v; +} +for (let v of []) { + v; +} diff --git a/tests/baselines/reference/ES5For-of18.symbols b/tests/baselines/reference/ES5For-of18(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of18.symbols rename to tests/baselines/reference/ES5For-of18(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of18.types b/tests/baselines/reference/ES5For-of18(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of18.types rename to tests/baselines/reference/ES5For-of18(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of18.js b/tests/baselines/reference/ES5For-of18(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of18.js rename to tests/baselines/reference/ES5For-of18(target=es5).js diff --git a/tests/baselines/reference/ES5For-of18(target=es5).symbols b/tests/baselines/reference/ES5For-of18(target=es5).symbols new file mode 100644 index 0000000000000..03f84868e8acb --- /dev/null +++ b/tests/baselines/reference/ES5For-of18(target=es5).symbols @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of18.ts] //// + +=== ES5For-of18.ts === +for (let v of []) { +>v : Symbol(v, Decl(ES5For-of18.ts, 0, 8)) + + v; +>v : Symbol(v, Decl(ES5For-of18.ts, 0, 8)) +} +for (let v of []) { +>v : Symbol(v, Decl(ES5For-of18.ts, 3, 8)) + + v; +>v : Symbol(v, Decl(ES5For-of18.ts, 3, 8)) +} + diff --git a/tests/baselines/reference/ES5For-of18(target=es5).types b/tests/baselines/reference/ES5For-of18(target=es5).types new file mode 100644 index 0000000000000..4d6d26f7c2245 --- /dev/null +++ b/tests/baselines/reference/ES5For-of18(target=es5).types @@ -0,0 +1,20 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of18.ts] //// + +=== ES5For-of18.ts === +for (let v of []) { +>v : any +>[] : undefined[] +> : ^^^^^^^^^^^ + + v; +>v : any +} +for (let v of []) { +>v : any +>[] : undefined[] +> : ^^^^^^^^^^^ + + v; +>v : any +} + diff --git a/tests/baselines/reference/ES5For-of19(target=es2015).js b/tests/baselines/reference/ES5For-of19(target=es2015).js new file mode 100644 index 0000000000000..5c3a9a9e90c3f --- /dev/null +++ b/tests/baselines/reference/ES5For-of19(target=es2015).js @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of19.ts] //// + +//// [ES5For-of19.ts] +for (let v of []) { + v; + function foo() { + for (const v of []) { + v; + } + } +} + + +//// [ES5For-of19.js] +for (let v of []) { + v; + function foo() { + for (const v of []) { + v; + } + } +} diff --git a/tests/baselines/reference/ES5For-of19.symbols b/tests/baselines/reference/ES5For-of19(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of19.symbols rename to tests/baselines/reference/ES5For-of19(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of19.types b/tests/baselines/reference/ES5For-of19(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of19.types rename to tests/baselines/reference/ES5For-of19(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of19.js b/tests/baselines/reference/ES5For-of19(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of19.js rename to tests/baselines/reference/ES5For-of19(target=es5).js diff --git a/tests/baselines/reference/ES5For-of19(target=es5).symbols b/tests/baselines/reference/ES5For-of19(target=es5).symbols new file mode 100644 index 0000000000000..646e312385af2 --- /dev/null +++ b/tests/baselines/reference/ES5For-of19(target=es5).symbols @@ -0,0 +1,21 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of19.ts] //// + +=== ES5For-of19.ts === +for (let v of []) { +>v : Symbol(v, Decl(ES5For-of19.ts, 0, 8)) + + v; +>v : Symbol(v, Decl(ES5For-of19.ts, 0, 8)) + + function foo() { +>foo : Symbol(foo, Decl(ES5For-of19.ts, 1, 6)) + + for (const v of []) { +>v : Symbol(v, Decl(ES5For-of19.ts, 3, 18)) + + v; +>v : Symbol(v, Decl(ES5For-of19.ts, 3, 18)) + } + } +} + diff --git a/tests/baselines/reference/ES5For-of19(target=es5).types b/tests/baselines/reference/ES5For-of19(target=es5).types new file mode 100644 index 0000000000000..30cb86bfdb2ef --- /dev/null +++ b/tests/baselines/reference/ES5For-of19(target=es5).types @@ -0,0 +1,26 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of19.ts] //// + +=== ES5For-of19.ts === +for (let v of []) { +>v : any +>[] : undefined[] +> : ^^^^^^^^^^^ + + v; +>v : any + + function foo() { +>foo : () => void +> : ^^^^^^^^^^ + + for (const v of []) { +>v : any +>[] : undefined[] +> : ^^^^^^^^^^^ + + v; +>v : any + } + } +} + diff --git a/tests/baselines/reference/ES5For-of2(target=es2015).js b/tests/baselines/reference/ES5For-of2(target=es2015).js new file mode 100644 index 0000000000000..4df827070fd14 --- /dev/null +++ b/tests/baselines/reference/ES5For-of2(target=es2015).js @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of2.ts] //// + +//// [ES5For-of2.ts] +for (var v of []) { + var x = v; +} + +//// [ES5For-of2.js] +for (var v of []) { + var x = v; +} diff --git a/tests/baselines/reference/ES5For-of2.symbols b/tests/baselines/reference/ES5For-of2(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of2.symbols rename to tests/baselines/reference/ES5For-of2(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of2.types b/tests/baselines/reference/ES5For-of2(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of2.types rename to tests/baselines/reference/ES5For-of2(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of2.js b/tests/baselines/reference/ES5For-of2(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of2.js rename to tests/baselines/reference/ES5For-of2(target=es5).js diff --git a/tests/baselines/reference/ES5For-of2(target=es5).symbols b/tests/baselines/reference/ES5For-of2(target=es5).symbols new file mode 100644 index 0000000000000..b39720c4c6809 --- /dev/null +++ b/tests/baselines/reference/ES5For-of2(target=es5).symbols @@ -0,0 +1,10 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of2.ts] //// + +=== ES5For-of2.ts === +for (var v of []) { +>v : Symbol(v, Decl(ES5For-of2.ts, 0, 8)) + + var x = v; +>x : Symbol(x, Decl(ES5For-of2.ts, 1, 7)) +>v : Symbol(v, Decl(ES5For-of2.ts, 0, 8)) +} diff --git a/tests/baselines/reference/ES5For-of2(target=es5).types b/tests/baselines/reference/ES5For-of2(target=es5).types new file mode 100644 index 0000000000000..789047457d6dc --- /dev/null +++ b/tests/baselines/reference/ES5For-of2(target=es5).types @@ -0,0 +1,12 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of2.ts] //// + +=== ES5For-of2.ts === +for (var v of []) { +>v : any +>[] : undefined[] +> : ^^^^^^^^^^^ + + var x = v; +>x : any +>v : any +} diff --git a/tests/baselines/reference/ES5For-of20.errors.txt b/tests/baselines/reference/ES5For-of20(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/ES5For-of20.errors.txt rename to tests/baselines/reference/ES5For-of20(target=es2015).errors.txt diff --git a/tests/baselines/reference/ES5For-of20(target=es2015).js b/tests/baselines/reference/ES5For-of20(target=es2015).js new file mode 100644 index 0000000000000..f8315134bee34 --- /dev/null +++ b/tests/baselines/reference/ES5For-of20(target=es2015).js @@ -0,0 +1,17 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts] //// + +//// [ES5For-of20.ts] +for (let v of []) { + let v; + for (let v of [v]) { + const v; + } +} + +//// [ES5For-of20.js] +for (let v of []) { + let v; + for (let v of [v]) { + const v; + } +} diff --git a/tests/baselines/reference/ES5For-of20.symbols b/tests/baselines/reference/ES5For-of20(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of20.symbols rename to tests/baselines/reference/ES5For-of20(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of20.types b/tests/baselines/reference/ES5For-of20(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of20.types rename to tests/baselines/reference/ES5For-of20(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of20(target=es5).errors.txt b/tests/baselines/reference/ES5For-of20(target=es5).errors.txt new file mode 100644 index 0000000000000..ff8cf77d27271 --- /dev/null +++ b/tests/baselines/reference/ES5For-of20(target=es5).errors.txt @@ -0,0 +1,16 @@ +ES5For-of20.ts(3,20): error TS2448: Block-scoped variable 'v' used before its declaration. +ES5For-of20.ts(4,15): error TS1155: 'const' declarations must be initialized. + + +==== ES5For-of20.ts (2 errors) ==== + for (let v of []) { + let v; + for (let v of [v]) { + ~ +!!! error TS2448: Block-scoped variable 'v' used before its declaration. +!!! related TS2728 ES5For-of20.ts:3:14: 'v' is declared here. + const v; + ~ +!!! error TS1155: 'const' declarations must be initialized. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of20.js b/tests/baselines/reference/ES5For-of20(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of20.js rename to tests/baselines/reference/ES5For-of20(target=es5).js diff --git a/tests/baselines/reference/ES5For-of20(target=es5).symbols b/tests/baselines/reference/ES5For-of20(target=es5).symbols new file mode 100644 index 0000000000000..508681e8dcb90 --- /dev/null +++ b/tests/baselines/reference/ES5For-of20(target=es5).symbols @@ -0,0 +1,17 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts] //// + +=== ES5For-of20.ts === +for (let v of []) { +>v : Symbol(v, Decl(ES5For-of20.ts, 0, 8)) + + let v; +>v : Symbol(v, Decl(ES5For-of20.ts, 1, 7)) + + for (let v of [v]) { +>v : Symbol(v, Decl(ES5For-of20.ts, 2, 12)) +>v : Symbol(v, Decl(ES5For-of20.ts, 2, 12)) + + const v; +>v : Symbol(v, Decl(ES5For-of20.ts, 3, 13)) + } +} diff --git a/tests/baselines/reference/ES5For-of20(target=es5).types b/tests/baselines/reference/ES5For-of20(target=es5).types new file mode 100644 index 0000000000000..8cc2073cc4ec5 --- /dev/null +++ b/tests/baselines/reference/ES5For-of20(target=es5).types @@ -0,0 +1,26 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts] //// + +=== ES5For-of20.ts === +for (let v of []) { +>v : any +> : ^^^ +>[] : undefined[] +> : ^^^^^^^^^^^ + + let v; +>v : any +> : ^^^ + + for (let v of [v]) { +>v : any +> : ^^^ +>[v] : any[] +> : ^^^^^ +>v : any +> : ^^^ + + const v; +>v : any +> : ^^^ + } +} diff --git a/tests/baselines/reference/ES5For-of21(target=es2015).js b/tests/baselines/reference/ES5For-of21(target=es2015).js new file mode 100644 index 0000000000000..53c46d7b35453 --- /dev/null +++ b/tests/baselines/reference/ES5For-of21(target=es2015).js @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of21.ts] //// + +//// [ES5For-of21.ts] +for (let v of []) { + for (let _i of []) { } +} + +//// [ES5For-of21.js] +for (let v of []) { + for (let _i of []) { } +} diff --git a/tests/baselines/reference/ES5For-of21.symbols b/tests/baselines/reference/ES5For-of21(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of21.symbols rename to tests/baselines/reference/ES5For-of21(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of21.types b/tests/baselines/reference/ES5For-of21(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of21.types rename to tests/baselines/reference/ES5For-of21(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of21.js b/tests/baselines/reference/ES5For-of21(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of21.js rename to tests/baselines/reference/ES5For-of21(target=es5).js diff --git a/tests/baselines/reference/ES5For-of21(target=es5).symbols b/tests/baselines/reference/ES5For-of21(target=es5).symbols new file mode 100644 index 0000000000000..ddc2aa569a239 --- /dev/null +++ b/tests/baselines/reference/ES5For-of21(target=es5).symbols @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of21.ts] //// + +=== ES5For-of21.ts === +for (let v of []) { +>v : Symbol(v, Decl(ES5For-of21.ts, 0, 8)) + + for (let _i of []) { } +>_i : Symbol(_i, Decl(ES5For-of21.ts, 1, 12)) +} diff --git a/tests/baselines/reference/ES5For-of21(target=es5).types b/tests/baselines/reference/ES5For-of21(target=es5).types new file mode 100644 index 0000000000000..df747d6a8da95 --- /dev/null +++ b/tests/baselines/reference/ES5For-of21(target=es5).types @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of21.ts] //// + +=== ES5For-of21.ts === +for (let v of []) { +>v : any +>[] : undefined[] +> : ^^^^^^^^^^^ + + for (let _i of []) { } +>_i : any +>[] : undefined[] +> : ^^^^^^^^^^^ +} diff --git a/tests/baselines/reference/ES5For-of22(target=es2015).js b/tests/baselines/reference/ES5For-of22(target=es2015).js new file mode 100644 index 0000000000000..3d522b59363b0 --- /dev/null +++ b/tests/baselines/reference/ES5For-of22(target=es2015).js @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of22.ts] //// + +//// [ES5For-of22.ts] +for (var x of [1, 2, 3]) { + let _a = 0; + console.log(x); +} + +//// [ES5For-of22.js] +for (var x of [1, 2, 3]) { + let _a = 0; + console.log(x); +} diff --git a/tests/baselines/reference/ES5For-of22.symbols b/tests/baselines/reference/ES5For-of22(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of22.symbols rename to tests/baselines/reference/ES5For-of22(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of22.types b/tests/baselines/reference/ES5For-of22(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of22.types rename to tests/baselines/reference/ES5For-of22(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of22.js b/tests/baselines/reference/ES5For-of22(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of22.js rename to tests/baselines/reference/ES5For-of22(target=es5).js diff --git a/tests/baselines/reference/ES5For-of22(target=es5).symbols b/tests/baselines/reference/ES5For-of22(target=es5).symbols new file mode 100644 index 0000000000000..7c7773ebcef86 --- /dev/null +++ b/tests/baselines/reference/ES5For-of22(target=es5).symbols @@ -0,0 +1,15 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of22.ts] //// + +=== ES5For-of22.ts === +for (var x of [1, 2, 3]) { +>x : Symbol(x, Decl(ES5For-of22.ts, 0, 8)) + + let _a = 0; +>_a : Symbol(_a, Decl(ES5For-of22.ts, 1, 7)) + + console.log(x); +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>x : Symbol(x, Decl(ES5For-of22.ts, 0, 8)) +} diff --git a/tests/baselines/reference/ES5For-of22(target=es5).types b/tests/baselines/reference/ES5For-of22(target=es5).types new file mode 100644 index 0000000000000..71e3820fee878 --- /dev/null +++ b/tests/baselines/reference/ES5For-of22(target=es5).types @@ -0,0 +1,33 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of22.ts] //// + +=== ES5For-of22.ts === +for (var x of [1, 2, 3]) { +>x : number +> : ^^^^^^ +>[1, 2, 3] : number[] +> : ^^^^^^^^ +>1 : 1 +> : ^ +>2 : 2 +> : ^ +>3 : 3 +> : ^ + + let _a = 0; +>_a : number +> : ^^^^^^ +>0 : 0 +> : ^ + + console.log(x); +>console.log(x) : void +> : ^^^^ +>console.log : (...data: any[]) => void +> : ^^^^ ^^ ^^^^^ +>console : Console +> : ^^^^^^^ +>log : (...data: any[]) => void +> : ^^^^ ^^ ^^^^^ +>x : number +> : ^^^^^^ +} diff --git a/tests/baselines/reference/ES5For-of23(target=es2015).js b/tests/baselines/reference/ES5For-of23(target=es2015).js new file mode 100644 index 0000000000000..e6a6acdcca266 --- /dev/null +++ b/tests/baselines/reference/ES5For-of23(target=es2015).js @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of23.ts] //// + +//// [ES5For-of23.ts] +for (var x of [1, 2, 3]) { + var _a = 0; + console.log(x); +} + +//// [ES5For-of23.js] +for (var x of [1, 2, 3]) { + var _a = 0; + console.log(x); +} diff --git a/tests/baselines/reference/ES5For-of23.symbols b/tests/baselines/reference/ES5For-of23(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of23.symbols rename to tests/baselines/reference/ES5For-of23(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of23.types b/tests/baselines/reference/ES5For-of23(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of23.types rename to tests/baselines/reference/ES5For-of23(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of23.js b/tests/baselines/reference/ES5For-of23(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of23.js rename to tests/baselines/reference/ES5For-of23(target=es5).js diff --git a/tests/baselines/reference/ES5For-of23(target=es5).symbols b/tests/baselines/reference/ES5For-of23(target=es5).symbols new file mode 100644 index 0000000000000..07606899a8174 --- /dev/null +++ b/tests/baselines/reference/ES5For-of23(target=es5).symbols @@ -0,0 +1,15 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of23.ts] //// + +=== ES5For-of23.ts === +for (var x of [1, 2, 3]) { +>x : Symbol(x, Decl(ES5For-of23.ts, 0, 8)) + + var _a = 0; +>_a : Symbol(_a, Decl(ES5For-of23.ts, 1, 7)) + + console.log(x); +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>x : Symbol(x, Decl(ES5For-of23.ts, 0, 8)) +} diff --git a/tests/baselines/reference/ES5For-of23(target=es5).types b/tests/baselines/reference/ES5For-of23(target=es5).types new file mode 100644 index 0000000000000..16e19d8fe6ff5 --- /dev/null +++ b/tests/baselines/reference/ES5For-of23(target=es5).types @@ -0,0 +1,33 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of23.ts] //// + +=== ES5For-of23.ts === +for (var x of [1, 2, 3]) { +>x : number +> : ^^^^^^ +>[1, 2, 3] : number[] +> : ^^^^^^^^ +>1 : 1 +> : ^ +>2 : 2 +> : ^ +>3 : 3 +> : ^ + + var _a = 0; +>_a : number +> : ^^^^^^ +>0 : 0 +> : ^ + + console.log(x); +>console.log(x) : void +> : ^^^^ +>console.log : (...data: any[]) => void +> : ^^^^ ^^ ^^^^^ +>console : Console +> : ^^^^^^^ +>log : (...data: any[]) => void +> : ^^^^ ^^ ^^^^^ +>x : number +> : ^^^^^^ +} diff --git a/tests/baselines/reference/ES5For-of24(target=es2015).js b/tests/baselines/reference/ES5For-of24(target=es2015).js new file mode 100644 index 0000000000000..aed1c5adbdf66 --- /dev/null +++ b/tests/baselines/reference/ES5For-of24(target=es2015).js @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of24.ts] //// + +//// [ES5For-of24.ts] +var a = [1, 2, 3]; +for (var v of a) { + let a = 0; +} + +//// [ES5For-of24.js] +var a = [1, 2, 3]; +for (var v of a) { + let a = 0; +} diff --git a/tests/baselines/reference/ES5For-of24.symbols b/tests/baselines/reference/ES5For-of24(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of24.symbols rename to tests/baselines/reference/ES5For-of24(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of24.types b/tests/baselines/reference/ES5For-of24(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of24.types rename to tests/baselines/reference/ES5For-of24(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of24.js b/tests/baselines/reference/ES5For-of24(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of24.js rename to tests/baselines/reference/ES5For-of24(target=es5).js diff --git a/tests/baselines/reference/ES5For-of24(target=es5).symbols b/tests/baselines/reference/ES5For-of24(target=es5).symbols new file mode 100644 index 0000000000000..8db2c7e36ddc0 --- /dev/null +++ b/tests/baselines/reference/ES5For-of24(target=es5).symbols @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of24.ts] //// + +=== ES5For-of24.ts === +var a = [1, 2, 3]; +>a : Symbol(a, Decl(ES5For-of24.ts, 0, 3)) + +for (var v of a) { +>v : Symbol(v, Decl(ES5For-of24.ts, 1, 8)) +>a : Symbol(a, Decl(ES5For-of24.ts, 0, 3)) + + let a = 0; +>a : Symbol(a, Decl(ES5For-of24.ts, 2, 7)) +} diff --git a/tests/baselines/reference/ES5For-of24(target=es5).types b/tests/baselines/reference/ES5For-of24(target=es5).types new file mode 100644 index 0000000000000..548cef41dcede --- /dev/null +++ b/tests/baselines/reference/ES5For-of24(target=es5).types @@ -0,0 +1,27 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of24.ts] //// + +=== ES5For-of24.ts === +var a = [1, 2, 3]; +>a : number[] +> : ^^^^^^^^ +>[1, 2, 3] : number[] +> : ^^^^^^^^ +>1 : 1 +> : ^ +>2 : 2 +> : ^ +>3 : 3 +> : ^ + +for (var v of a) { +>v : number +> : ^^^^^^ +>a : number[] +> : ^^^^^^^^ + + let a = 0; +>a : number +> : ^^^^^^ +>0 : 0 +> : ^ +} diff --git a/tests/baselines/reference/ES5For-of25(target=es2015).js b/tests/baselines/reference/ES5For-of25(target=es2015).js new file mode 100644 index 0000000000000..481e49092b250 --- /dev/null +++ b/tests/baselines/reference/ES5For-of25(target=es2015).js @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of25.ts] //// + +//// [ES5For-of25.ts] +var a = [1, 2, 3]; +for (var v of a) { + v; + a; +} + +//// [ES5For-of25.js] +var a = [1, 2, 3]; +for (var v of a) { + v; + a; +} +//# sourceMappingURL=ES5For-of25.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of25(target=es2015).js.map b/tests/baselines/reference/ES5For-of25(target=es2015).js.map new file mode 100644 index 0000000000000..4cb55270ed3c6 --- /dev/null +++ b/tests/baselines/reference/ES5For-of25(target=es2015).js.map @@ -0,0 +1,3 @@ +//// [ES5For-of25.js.map] +{"version":3,"file":"ES5For-of25.js","sourceRoot":"","sources":["ES5For-of25.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAClB,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IACd,CAAC,CAAC;IACF,CAAC,CAAC;AACN,CAAC"} +//// https://sokra.github.io/source-map-visualization#base64,dmFyIGEgPSBbMSwgMiwgM107DQpmb3IgKHZhciB2IG9mIGEpIHsNCiAgICB2Ow0KICAgIGE7DQp9DQovLyMgc291cmNlTWFwcGluZ1VSTD1FUzVGb3Itb2YyNS5qcy5tYXA=,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRVM1Rm9yLW9mMjUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJFUzVGb3Itb2YyNS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxJQUFJLENBQUMsR0FBRyxDQUFDLENBQUMsRUFBRSxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUM7QUFDbEIsS0FBSyxJQUFJLENBQUMsSUFBSSxDQUFDLEVBQUUsQ0FBQztJQUNkLENBQUMsQ0FBQztJQUNGLENBQUMsQ0FBQztBQUNOLENBQUMifQ==,dmFyIGEgPSBbMSwgMiwgM107CmZvciAodmFyIHYgb2YgYSkgewogICAgdjsKICAgIGE7Cn0= diff --git a/tests/baselines/reference/ES5For-of25(target=es2015).sourcemap.txt b/tests/baselines/reference/ES5For-of25(target=es2015).sourcemap.txt new file mode 100644 index 0000000000000..12f7a2d129fc4 --- /dev/null +++ b/tests/baselines/reference/ES5For-of25(target=es2015).sourcemap.txt @@ -0,0 +1,112 @@ +=================================================================== +JsFile: ES5For-of25.js +mapUrl: ES5For-of25.js.map +sourceRoot: +sources: ES5For-of25.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:ES5For-of25.js +sourceFile:ES5For-of25.ts +------------------------------------------------------------------- +>>>var a = [1, 2, 3]; +1 > +2 >^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^ +9 > ^^ +10> ^ +11> ^ +12> ^ +13> ^-> +1 > +2 >var +3 > a +4 > = +5 > [ +6 > 1 +7 > , +8 > 2 +9 > , +10> 3 +11> ] +12> ; +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) +3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) +4 >Emitted(1, 9) Source(1, 9) + SourceIndex(0) +5 >Emitted(1, 10) Source(1, 10) + SourceIndex(0) +6 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) +7 >Emitted(1, 13) Source(1, 13) + SourceIndex(0) +8 >Emitted(1, 14) Source(1, 14) + SourceIndex(0) +9 >Emitted(1, 16) Source(1, 16) + SourceIndex(0) +10>Emitted(1, 17) Source(1, 17) + SourceIndex(0) +11>Emitted(1, 18) Source(1, 18) + SourceIndex(0) +12>Emitted(1, 19) Source(1, 19) + SourceIndex(0) +--- +>>>for (var v of a) { +1-> +2 >^^^^^ +3 > ^^^^ +4 > ^ +5 > ^^^^ +6 > ^ +7 > ^^ +8 > ^ +1-> + > +2 >for ( +3 > var +4 > v +5 > of +6 > a +7 > ) +8 > { +1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 6) Source(2, 6) + SourceIndex(0) +3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +4 >Emitted(2, 11) Source(2, 11) + SourceIndex(0) +5 >Emitted(2, 15) Source(2, 15) + SourceIndex(0) +6 >Emitted(2, 16) Source(2, 16) + SourceIndex(0) +7 >Emitted(2, 18) Source(2, 18) + SourceIndex(0) +8 >Emitted(2, 19) Source(2, 19) + SourceIndex(0) +--- +>>> v; +1 >^^^^ +2 > ^ +3 > ^ +4 > ^-> +1 > + > +2 > v +3 > ; +1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +2 >Emitted(3, 6) Source(3, 6) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +--- +>>> a; +1->^^^^ +2 > ^ +3 > ^ +1-> + > +2 > a +3 > ; +1->Emitted(4, 5) Source(4, 5) + SourceIndex(0) +2 >Emitted(4, 6) Source(4, 6) + SourceIndex(0) +3 >Emitted(4, 7) Source(4, 7) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(5, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(5, 2) Source(5, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=ES5For-of25.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of25.symbols b/tests/baselines/reference/ES5For-of25(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of25.symbols rename to tests/baselines/reference/ES5For-of25(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of25.types b/tests/baselines/reference/ES5For-of25(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of25.types rename to tests/baselines/reference/ES5For-of25(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of25.js b/tests/baselines/reference/ES5For-of25(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of25.js rename to tests/baselines/reference/ES5For-of25(target=es5).js diff --git a/tests/baselines/reference/ES5For-of25.js.map b/tests/baselines/reference/ES5For-of25(target=es5).js.map similarity index 100% rename from tests/baselines/reference/ES5For-of25.js.map rename to tests/baselines/reference/ES5For-of25(target=es5).js.map diff --git a/tests/baselines/reference/ES5For-of25.sourcemap.txt b/tests/baselines/reference/ES5For-of25(target=es5).sourcemap.txt similarity index 100% rename from tests/baselines/reference/ES5For-of25.sourcemap.txt rename to tests/baselines/reference/ES5For-of25(target=es5).sourcemap.txt diff --git a/tests/baselines/reference/ES5For-of25(target=es5).symbols b/tests/baselines/reference/ES5For-of25(target=es5).symbols new file mode 100644 index 0000000000000..cee3f1e3f2012 --- /dev/null +++ b/tests/baselines/reference/ES5For-of25(target=es5).symbols @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of25.ts] //// + +=== ES5For-of25.ts === +var a = [1, 2, 3]; +>a : Symbol(a, Decl(ES5For-of25.ts, 0, 3)) + +for (var v of a) { +>v : Symbol(v, Decl(ES5For-of25.ts, 1, 8)) +>a : Symbol(a, Decl(ES5For-of25.ts, 0, 3)) + + v; +>v : Symbol(v, Decl(ES5For-of25.ts, 1, 8)) + + a; +>a : Symbol(a, Decl(ES5For-of25.ts, 0, 3)) +} diff --git a/tests/baselines/reference/ES5For-of25(target=es5).types b/tests/baselines/reference/ES5For-of25(target=es5).types new file mode 100644 index 0000000000000..ed60b882e359a --- /dev/null +++ b/tests/baselines/reference/ES5For-of25(target=es5).types @@ -0,0 +1,29 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of25.ts] //// + +=== ES5For-of25.ts === +var a = [1, 2, 3]; +>a : number[] +> : ^^^^^^^^ +>[1, 2, 3] : number[] +> : ^^^^^^^^ +>1 : 1 +> : ^ +>2 : 2 +> : ^ +>3 : 3 +> : ^ + +for (var v of a) { +>v : number +> : ^^^^^^ +>a : number[] +> : ^^^^^^^^ + + v; +>v : number +> : ^^^^^^ + + a; +>a : number[] +> : ^^^^^^^^ +} diff --git a/tests/baselines/reference/ES5For-of26(target=es2015).errors.txt b/tests/baselines/reference/ES5For-of26(target=es2015).errors.txt new file mode 100644 index 0000000000000..6227f31ed7c5e --- /dev/null +++ b/tests/baselines/reference/ES5For-of26(target=es2015).errors.txt @@ -0,0 +1,10 @@ +ES5For-of26.ts(1,10): error TS2488: Type 'number' must have a '[Symbol.iterator]()' method that returns an iterator. + + +==== ES5For-of26.ts (1 errors) ==== + for (var [a = 0, b = 1] of [2, 3]) { + ~~~~~~~~~~~~~~ +!!! error TS2488: Type 'number' must have a '[Symbol.iterator]()' method that returns an iterator. + a; + b; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of26(target=es2015).js b/tests/baselines/reference/ES5For-of26(target=es2015).js new file mode 100644 index 0000000000000..9a37217bc7329 --- /dev/null +++ b/tests/baselines/reference/ES5For-of26(target=es2015).js @@ -0,0 +1,14 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of26.ts] //// + +//// [ES5For-of26.ts] +for (var [a = 0, b = 1] of [2, 3]) { + a; + b; +} + +//// [ES5For-of26.js] +for (var [a = 0, b = 1] of [2, 3]) { + a; + b; +} +//# sourceMappingURL=ES5For-of26.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of26(target=es2015).js.map b/tests/baselines/reference/ES5For-of26(target=es2015).js.map new file mode 100644 index 0000000000000..51d0525b9d6e4 --- /dev/null +++ b/tests/baselines/reference/ES5For-of26(target=es2015).js.map @@ -0,0 +1,3 @@ +//// [ES5For-of26.js.map] +{"version":3,"file":"ES5For-of26.js","sourceRoot":"","sources":["ES5For-of26.ts"],"names":[],"mappings":"AAAA,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IAChC,CAAC,CAAC;IACF,CAAC,CAAC;AACN,CAAC"} +//// https://sokra.github.io/source-map-visualization#base64,Zm9yICh2YXIgW2EgPSAwLCBiID0gMV0gb2YgWzIsIDNdKSB7DQogICAgYTsNCiAgICBiOw0KfQ0KLy8jIHNvdXJjZU1hcHBpbmdVUkw9RVM1Rm9yLW9mMjYuanMubWFw,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRVM1Rm9yLW9mMjYuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJFUzVGb3Itb2YyNi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxLQUFLLElBQUksQ0FBQyxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsR0FBRyxDQUFDLENBQUMsSUFBSSxDQUFDLENBQUMsRUFBRSxDQUFDLENBQUMsRUFBRSxDQUFDO0lBQ2hDLENBQUMsQ0FBQztJQUNGLENBQUMsQ0FBQztBQUNOLENBQUMifQ==,Zm9yICh2YXIgW2EgPSAwLCBiID0gMV0gb2YgWzIsIDNdKSB7CiAgICBhOwogICAgYjsKfQ== diff --git a/tests/baselines/reference/ES5For-of26(target=es2015).sourcemap.txt b/tests/baselines/reference/ES5For-of26(target=es2015).sourcemap.txt new file mode 100644 index 0000000000000..162846607b68b --- /dev/null +++ b/tests/baselines/reference/ES5For-of26(target=es2015).sourcemap.txt @@ -0,0 +1,108 @@ +=================================================================== +JsFile: ES5For-of26.js +mapUrl: ES5For-of26.js.map +sourceRoot: +sources: ES5For-of26.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:ES5For-of26.js +sourceFile:ES5For-of26.ts +------------------------------------------------------------------- +>>>for (var [a = 0, b = 1] of [2, 3]) { +1 > +2 >^^^^^ +3 > ^^^^ +4 > ^ +5 > ^ +6 > ^^^ +7 > ^ +8 > ^^ +9 > ^ +10> ^^^ +11> ^ +12> ^ +13> ^^^^ +14> ^ +15> ^ +16> ^^ +17> ^ +18> ^ +19> ^^ +20> ^ +1 > +2 >for ( +3 > var +4 > [ +5 > a +6 > = +7 > 0 +8 > , +9 > b +10> = +11> 1 +12> ] +13> of +14> [ +15> 2 +16> , +17> 3 +18> ] +19> ) +20> { +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) +3 >Emitted(1, 10) Source(1, 10) + SourceIndex(0) +4 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) +5 >Emitted(1, 12) Source(1, 12) + SourceIndex(0) +6 >Emitted(1, 15) Source(1, 15) + SourceIndex(0) +7 >Emitted(1, 16) Source(1, 16) + SourceIndex(0) +8 >Emitted(1, 18) Source(1, 18) + SourceIndex(0) +9 >Emitted(1, 19) Source(1, 19) + SourceIndex(0) +10>Emitted(1, 22) Source(1, 22) + SourceIndex(0) +11>Emitted(1, 23) Source(1, 23) + SourceIndex(0) +12>Emitted(1, 24) Source(1, 24) + SourceIndex(0) +13>Emitted(1, 28) Source(1, 28) + SourceIndex(0) +14>Emitted(1, 29) Source(1, 29) + SourceIndex(0) +15>Emitted(1, 30) Source(1, 30) + SourceIndex(0) +16>Emitted(1, 32) Source(1, 32) + SourceIndex(0) +17>Emitted(1, 33) Source(1, 33) + SourceIndex(0) +18>Emitted(1, 34) Source(1, 34) + SourceIndex(0) +19>Emitted(1, 36) Source(1, 36) + SourceIndex(0) +20>Emitted(1, 37) Source(1, 37) + SourceIndex(0) +--- +>>> a; +1 >^^^^ +2 > ^ +3 > ^ +4 > ^-> +1 > + > +2 > a +3 > ; +1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(2, 6) Source(2, 6) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +--- +>>> b; +1->^^^^ +2 > ^ +3 > ^ +1-> + > +2 > b +3 > ; +1->Emitted(3, 5) Source(3, 5) + SourceIndex(0) +2 >Emitted(3, 6) Source(3, 6) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(4, 1) Source(4, 1) + SourceIndex(0) +2 >Emitted(4, 2) Source(4, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=ES5For-of26.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of26.symbols b/tests/baselines/reference/ES5For-of26(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of26.symbols rename to tests/baselines/reference/ES5For-of26(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of26.types b/tests/baselines/reference/ES5For-of26(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of26.types rename to tests/baselines/reference/ES5For-of26(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of26.errors.txt b/tests/baselines/reference/ES5For-of26(target=es5).errors.txt similarity index 100% rename from tests/baselines/reference/ES5For-of26.errors.txt rename to tests/baselines/reference/ES5For-of26(target=es5).errors.txt diff --git a/tests/baselines/reference/ES5For-of26.js b/tests/baselines/reference/ES5For-of26(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of26.js rename to tests/baselines/reference/ES5For-of26(target=es5).js diff --git a/tests/baselines/reference/ES5For-of26.js.map b/tests/baselines/reference/ES5For-of26(target=es5).js.map similarity index 100% rename from tests/baselines/reference/ES5For-of26.js.map rename to tests/baselines/reference/ES5For-of26(target=es5).js.map diff --git a/tests/baselines/reference/ES5For-of26.sourcemap.txt b/tests/baselines/reference/ES5For-of26(target=es5).sourcemap.txt similarity index 100% rename from tests/baselines/reference/ES5For-of26.sourcemap.txt rename to tests/baselines/reference/ES5For-of26(target=es5).sourcemap.txt diff --git a/tests/baselines/reference/ES5For-of26(target=es5).symbols b/tests/baselines/reference/ES5For-of26(target=es5).symbols new file mode 100644 index 0000000000000..d0d28e1b6d844 --- /dev/null +++ b/tests/baselines/reference/ES5For-of26(target=es5).symbols @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of26.ts] //// + +=== ES5For-of26.ts === +for (var [a = 0, b = 1] of [2, 3]) { +>a : Symbol(a, Decl(ES5For-of26.ts, 0, 10)) +>b : Symbol(b, Decl(ES5For-of26.ts, 0, 16)) + + a; +>a : Symbol(a, Decl(ES5For-of26.ts, 0, 10)) + + b; +>b : Symbol(b, Decl(ES5For-of26.ts, 0, 16)) +} diff --git a/tests/baselines/reference/ES5For-of26(target=es5).types b/tests/baselines/reference/ES5For-of26(target=es5).types new file mode 100644 index 0000000000000..2dd2a1af7852a --- /dev/null +++ b/tests/baselines/reference/ES5For-of26(target=es5).types @@ -0,0 +1,27 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of26.ts] //// + +=== ES5For-of26.ts === +for (var [a = 0, b = 1] of [2, 3]) { +>a : any +> : ^^^ +>0 : 0 +> : ^ +>b : any +> : ^^^ +>1 : 1 +> : ^ +>[2, 3] : number[] +> : ^^^^^^^^ +>2 : 2 +> : ^ +>3 : 3 +> : ^ + + a; +>a : any +> : ^^^ + + b; +>b : any +> : ^^^ +} diff --git a/tests/baselines/reference/ES5For-of27.errors.txt b/tests/baselines/reference/ES5For-of27(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/ES5For-of27.errors.txt rename to tests/baselines/reference/ES5For-of27(target=es2015).errors.txt diff --git a/tests/baselines/reference/ES5For-of27(target=es2015).js b/tests/baselines/reference/ES5For-of27(target=es2015).js new file mode 100644 index 0000000000000..1ca415339df70 --- /dev/null +++ b/tests/baselines/reference/ES5For-of27(target=es2015).js @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of27.ts] //// + +//// [ES5For-of27.ts] +for (var {x: a = 0, y: b = 1} of [2, 3]) { + a; + b; +} + +//// [ES5For-of27.js] +for (var { x: a = 0, y: b = 1 } of [2, 3]) { + a; + b; +} diff --git a/tests/baselines/reference/ES5For-of27.symbols b/tests/baselines/reference/ES5For-of27(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of27.symbols rename to tests/baselines/reference/ES5For-of27(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of27.types b/tests/baselines/reference/ES5For-of27(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of27.types rename to tests/baselines/reference/ES5For-of27(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of27(target=es5).errors.txt b/tests/baselines/reference/ES5For-of27(target=es5).errors.txt new file mode 100644 index 0000000000000..0e8087a19d99f --- /dev/null +++ b/tests/baselines/reference/ES5For-of27(target=es5).errors.txt @@ -0,0 +1,13 @@ +ES5For-of27.ts(1,11): error TS2339: Property 'x' does not exist on type 'Number'. +ES5For-of27.ts(1,21): error TS2339: Property 'y' does not exist on type 'Number'. + + +==== ES5For-of27.ts (2 errors) ==== + for (var {x: a = 0, y: b = 1} of [2, 3]) { + ~ +!!! error TS2339: Property 'x' does not exist on type 'Number'. + ~ +!!! error TS2339: Property 'y' does not exist on type 'Number'. + a; + b; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of27.js b/tests/baselines/reference/ES5For-of27(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of27.js rename to tests/baselines/reference/ES5For-of27(target=es5).js diff --git a/tests/baselines/reference/ES5For-of27(target=es5).symbols b/tests/baselines/reference/ES5For-of27(target=es5).symbols new file mode 100644 index 0000000000000..24d413a286b9f --- /dev/null +++ b/tests/baselines/reference/ES5For-of27(target=es5).symbols @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of27.ts] //// + +=== ES5For-of27.ts === +for (var {x: a = 0, y: b = 1} of [2, 3]) { +>a : Symbol(a, Decl(ES5For-of27.ts, 0, 10)) +>b : Symbol(b, Decl(ES5For-of27.ts, 0, 19)) + + a; +>a : Symbol(a, Decl(ES5For-of27.ts, 0, 10)) + + b; +>b : Symbol(b, Decl(ES5For-of27.ts, 0, 19)) +} diff --git a/tests/baselines/reference/ES5For-of27(target=es5).types b/tests/baselines/reference/ES5For-of27(target=es5).types new file mode 100644 index 0000000000000..89b46c7536cb8 --- /dev/null +++ b/tests/baselines/reference/ES5For-of27(target=es5).types @@ -0,0 +1,31 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of27.ts] //// + +=== ES5For-of27.ts === +for (var {x: a = 0, y: b = 1} of [2, 3]) { +>x : any +> : ^^^ +>a : any +> : ^^^ +>0 : 0 +> : ^ +>y : any +> : ^^^ +>b : any +> : ^^^ +>1 : 1 +> : ^ +>[2, 3] : number[] +> : ^^^^^^^^ +>2 : 2 +> : ^ +>3 : 3 +> : ^ + + a; +>a : any +> : ^^^ + + b; +>b : any +> : ^^^ +} diff --git a/tests/baselines/reference/ES5For-of28(target=es2015).errors.txt b/tests/baselines/reference/ES5For-of28(target=es2015).errors.txt new file mode 100644 index 0000000000000..afafb236c22ce --- /dev/null +++ b/tests/baselines/reference/ES5For-of28(target=es2015).errors.txt @@ -0,0 +1,10 @@ +ES5For-of28.ts(1,10): error TS2488: Type 'number' must have a '[Symbol.iterator]()' method that returns an iterator. + + +==== ES5For-of28.ts (1 errors) ==== + for (let [a = 0, b = 1] of [2, 3]) { + ~~~~~~~~~~~~~~ +!!! error TS2488: Type 'number' must have a '[Symbol.iterator]()' method that returns an iterator. + a; + b; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of28(target=es2015).js b/tests/baselines/reference/ES5For-of28(target=es2015).js new file mode 100644 index 0000000000000..c9314fb1830b5 --- /dev/null +++ b/tests/baselines/reference/ES5For-of28(target=es2015).js @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of28.ts] //// + +//// [ES5For-of28.ts] +for (let [a = 0, b = 1] of [2, 3]) { + a; + b; +} + +//// [ES5For-of28.js] +for (let [a = 0, b = 1] of [2, 3]) { + a; + b; +} diff --git a/tests/baselines/reference/ES5For-of28.symbols b/tests/baselines/reference/ES5For-of28(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of28.symbols rename to tests/baselines/reference/ES5For-of28(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of28.types b/tests/baselines/reference/ES5For-of28(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of28.types rename to tests/baselines/reference/ES5For-of28(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of28.errors.txt b/tests/baselines/reference/ES5For-of28(target=es5).errors.txt similarity index 100% rename from tests/baselines/reference/ES5For-of28.errors.txt rename to tests/baselines/reference/ES5For-of28(target=es5).errors.txt diff --git a/tests/baselines/reference/ES5For-of28.js b/tests/baselines/reference/ES5For-of28(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of28.js rename to tests/baselines/reference/ES5For-of28(target=es5).js diff --git a/tests/baselines/reference/ES5For-of28(target=es5).symbols b/tests/baselines/reference/ES5For-of28(target=es5).symbols new file mode 100644 index 0000000000000..1f2da5c469776 --- /dev/null +++ b/tests/baselines/reference/ES5For-of28(target=es5).symbols @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of28.ts] //// + +=== ES5For-of28.ts === +for (let [a = 0, b = 1] of [2, 3]) { +>a : Symbol(a, Decl(ES5For-of28.ts, 0, 10)) +>b : Symbol(b, Decl(ES5For-of28.ts, 0, 16)) + + a; +>a : Symbol(a, Decl(ES5For-of28.ts, 0, 10)) + + b; +>b : Symbol(b, Decl(ES5For-of28.ts, 0, 16)) +} diff --git a/tests/baselines/reference/ES5For-of28(target=es5).types b/tests/baselines/reference/ES5For-of28(target=es5).types new file mode 100644 index 0000000000000..68e96ac12d4b9 --- /dev/null +++ b/tests/baselines/reference/ES5For-of28(target=es5).types @@ -0,0 +1,27 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of28.ts] //// + +=== ES5For-of28.ts === +for (let [a = 0, b = 1] of [2, 3]) { +>a : any +> : ^^^ +>0 : 0 +> : ^ +>b : any +> : ^^^ +>1 : 1 +> : ^ +>[2, 3] : number[] +> : ^^^^^^^^ +>2 : 2 +> : ^ +>3 : 3 +> : ^ + + a; +>a : any +> : ^^^ + + b; +>b : any +> : ^^^ +} diff --git a/tests/baselines/reference/ES5For-of29.errors.txt b/tests/baselines/reference/ES5For-of29(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/ES5For-of29.errors.txt rename to tests/baselines/reference/ES5For-of29(target=es2015).errors.txt diff --git a/tests/baselines/reference/ES5For-of29(target=es2015).js b/tests/baselines/reference/ES5For-of29(target=es2015).js new file mode 100644 index 0000000000000..ca022d966c1ac --- /dev/null +++ b/tests/baselines/reference/ES5For-of29(target=es2015).js @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of29.ts] //// + +//// [ES5For-of29.ts] +for (const {x: a = 0, y: b = 1} of [2, 3]) { + a; + b; +} + +//// [ES5For-of29.js] +for (const { x: a = 0, y: b = 1 } of [2, 3]) { + a; + b; +} diff --git a/tests/baselines/reference/ES5For-of29.symbols b/tests/baselines/reference/ES5For-of29(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of29.symbols rename to tests/baselines/reference/ES5For-of29(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of29.types b/tests/baselines/reference/ES5For-of29(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of29.types rename to tests/baselines/reference/ES5For-of29(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of29(target=es5).errors.txt b/tests/baselines/reference/ES5For-of29(target=es5).errors.txt new file mode 100644 index 0000000000000..ff9834e6f86ff --- /dev/null +++ b/tests/baselines/reference/ES5For-of29(target=es5).errors.txt @@ -0,0 +1,13 @@ +ES5For-of29.ts(1,13): error TS2339: Property 'x' does not exist on type 'Number'. +ES5For-of29.ts(1,23): error TS2339: Property 'y' does not exist on type 'Number'. + + +==== ES5For-of29.ts (2 errors) ==== + for (const {x: a = 0, y: b = 1} of [2, 3]) { + ~ +!!! error TS2339: Property 'x' does not exist on type 'Number'. + ~ +!!! error TS2339: Property 'y' does not exist on type 'Number'. + a; + b; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of29.js b/tests/baselines/reference/ES5For-of29(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of29.js rename to tests/baselines/reference/ES5For-of29(target=es5).js diff --git a/tests/baselines/reference/ES5For-of29(target=es5).symbols b/tests/baselines/reference/ES5For-of29(target=es5).symbols new file mode 100644 index 0000000000000..b28307c3b94f5 --- /dev/null +++ b/tests/baselines/reference/ES5For-of29(target=es5).symbols @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of29.ts] //// + +=== ES5For-of29.ts === +for (const {x: a = 0, y: b = 1} of [2, 3]) { +>a : Symbol(a, Decl(ES5For-of29.ts, 0, 12)) +>b : Symbol(b, Decl(ES5For-of29.ts, 0, 21)) + + a; +>a : Symbol(a, Decl(ES5For-of29.ts, 0, 12)) + + b; +>b : Symbol(b, Decl(ES5For-of29.ts, 0, 21)) +} diff --git a/tests/baselines/reference/ES5For-of29(target=es5).types b/tests/baselines/reference/ES5For-of29(target=es5).types new file mode 100644 index 0000000000000..332f380358f76 --- /dev/null +++ b/tests/baselines/reference/ES5For-of29(target=es5).types @@ -0,0 +1,31 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of29.ts] //// + +=== ES5For-of29.ts === +for (const {x: a = 0, y: b = 1} of [2, 3]) { +>x : any +> : ^^^ +>a : any +> : ^^^ +>0 : 0 +> : ^ +>y : any +> : ^^^ +>b : any +> : ^^^ +>1 : 1 +> : ^ +>[2, 3] : number[] +> : ^^^^^^^^ +>2 : 2 +> : ^ +>3 : 3 +> : ^ + + a; +>a : any +> : ^^^ + + b; +>b : any +> : ^^^ +} diff --git a/tests/baselines/reference/ES5For-of3(target=es2015).js b/tests/baselines/reference/ES5For-of3(target=es2015).js new file mode 100644 index 0000000000000..e44cd90361a76 --- /dev/null +++ b/tests/baselines/reference/ES5For-of3(target=es2015).js @@ -0,0 +1,10 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of3.ts] //// + +//// [ES5For-of3.ts] +for (var v of ['a', 'b', 'c']) + var x = v; + +//// [ES5For-of3.js] +for (var v of ['a', 'b', 'c']) + var x = v; +//# sourceMappingURL=ES5For-of3.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of3(target=es2015).js.map b/tests/baselines/reference/ES5For-of3(target=es2015).js.map new file mode 100644 index 0000000000000..429f6596ae844 --- /dev/null +++ b/tests/baselines/reference/ES5For-of3(target=es2015).js.map @@ -0,0 +1,3 @@ +//// [ES5For-of3.js.map] +{"version":3,"file":"ES5For-of3.js","sourceRoot":"","sources":["ES5For-of3.ts"],"names":[],"mappings":"AAAA,KAAK,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IACzB,IAAI,CAAC,GAAG,CAAC,CAAC"} +//// https://sokra.github.io/source-map-visualization#base64,Zm9yICh2YXIgdiBvZiBbJ2EnLCAnYicsICdjJ10pDQogICAgdmFyIHggPSB2Ow0KLy8jIHNvdXJjZU1hcHBpbmdVUkw9RVM1Rm9yLW9mMy5qcy5tYXA=,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRVM1Rm9yLW9mMy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIkVTNUZvci1vZjMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsS0FBSyxJQUFJLENBQUMsSUFBSSxDQUFDLEdBQUcsRUFBRSxHQUFHLEVBQUUsR0FBRyxDQUFDO0lBQ3pCLElBQUksQ0FBQyxHQUFHLENBQUMsQ0FBQyJ9,Zm9yICh2YXIgdiBvZiBbJ2EnLCAnYicsICdjJ10pCiAgICB2YXIgeCA9IHY7 diff --git a/tests/baselines/reference/ES5For-of3(target=es2015).sourcemap.txt b/tests/baselines/reference/ES5For-of3(target=es2015).sourcemap.txt new file mode 100644 index 0000000000000..997427799cd70 --- /dev/null +++ b/tests/baselines/reference/ES5For-of3(target=es2015).sourcemap.txt @@ -0,0 +1,71 @@ +=================================================================== +JsFile: ES5For-of3.js +mapUrl: ES5For-of3.js.map +sourceRoot: +sources: ES5For-of3.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:ES5For-of3.js +sourceFile:ES5For-of3.ts +------------------------------------------------------------------- +>>>for (var v of ['a', 'b', 'c']) +1 > +2 >^^^^^ +3 > ^^^^ +4 > ^ +5 > ^^^^ +6 > ^ +7 > ^^^ +8 > ^^ +9 > ^^^ +10> ^^ +11> ^^^ +12> ^ +1 > +2 >for ( +3 > var +4 > v +5 > of +6 > [ +7 > 'a' +8 > , +9 > 'b' +10> , +11> 'c' +12> ] +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) +3 >Emitted(1, 10) Source(1, 10) + SourceIndex(0) +4 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) +5 >Emitted(1, 15) Source(1, 15) + SourceIndex(0) +6 >Emitted(1, 16) Source(1, 16) + SourceIndex(0) +7 >Emitted(1, 19) Source(1, 19) + SourceIndex(0) +8 >Emitted(1, 21) Source(1, 21) + SourceIndex(0) +9 >Emitted(1, 24) Source(1, 24) + SourceIndex(0) +10>Emitted(1, 26) Source(1, 26) + SourceIndex(0) +11>Emitted(1, 29) Source(1, 29) + SourceIndex(0) +12>Emitted(1, 30) Source(1, 30) + SourceIndex(0) +--- +>>> var x = v; +1 >^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1 >) + > +2 > var +3 > x +4 > = +5 > v +6 > ; +1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(2, 9) Source(2, 9) + SourceIndex(0) +3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +4 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +5 >Emitted(2, 14) Source(2, 14) + SourceIndex(0) +6 >Emitted(2, 15) Source(2, 15) + SourceIndex(0) +--- +>>>//# sourceMappingURL=ES5For-of3.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of3.symbols b/tests/baselines/reference/ES5For-of3(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of3.symbols rename to tests/baselines/reference/ES5For-of3(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of3.types b/tests/baselines/reference/ES5For-of3(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of3.types rename to tests/baselines/reference/ES5For-of3(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of3.js b/tests/baselines/reference/ES5For-of3(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of3.js rename to tests/baselines/reference/ES5For-of3(target=es5).js diff --git a/tests/baselines/reference/ES5For-of3.js.map b/tests/baselines/reference/ES5For-of3(target=es5).js.map similarity index 100% rename from tests/baselines/reference/ES5For-of3.js.map rename to tests/baselines/reference/ES5For-of3(target=es5).js.map diff --git a/tests/baselines/reference/ES5For-of3.sourcemap.txt b/tests/baselines/reference/ES5For-of3(target=es5).sourcemap.txt similarity index 100% rename from tests/baselines/reference/ES5For-of3.sourcemap.txt rename to tests/baselines/reference/ES5For-of3(target=es5).sourcemap.txt diff --git a/tests/baselines/reference/ES5For-of3(target=es5).symbols b/tests/baselines/reference/ES5For-of3(target=es5).symbols new file mode 100644 index 0000000000000..21ff7d8e98a0c --- /dev/null +++ b/tests/baselines/reference/ES5For-of3(target=es5).symbols @@ -0,0 +1,10 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of3.ts] //// + +=== ES5For-of3.ts === +for (var v of ['a', 'b', 'c']) +>v : Symbol(v, Decl(ES5For-of3.ts, 0, 8)) + + var x = v; +>x : Symbol(x, Decl(ES5For-of3.ts, 1, 7)) +>v : Symbol(v, Decl(ES5For-of3.ts, 0, 8)) + diff --git a/tests/baselines/reference/ES5For-of3(target=es5).types b/tests/baselines/reference/ES5For-of3(target=es5).types new file mode 100644 index 0000000000000..9d3377f5217a4 --- /dev/null +++ b/tests/baselines/reference/ES5For-of3(target=es5).types @@ -0,0 +1,21 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of3.ts] //// + +=== ES5For-of3.ts === +for (var v of ['a', 'b', 'c']) +>v : string +> : ^^^^^^ +>['a', 'b', 'c'] : string[] +> : ^^^^^^^^ +>'a' : "a" +> : ^^^ +>'b' : "b" +> : ^^^ +>'c' : "c" +> : ^^^ + + var x = v; +>x : string +> : ^^^^^^ +>v : string +> : ^^^^^^ + diff --git a/tests/baselines/reference/ES5For-of30(target=es2015).errors.txt b/tests/baselines/reference/ES5For-of30(target=es2015).errors.txt new file mode 100644 index 0000000000000..adc43fc874caf --- /dev/null +++ b/tests/baselines/reference/ES5For-of30(target=es2015).errors.txt @@ -0,0 +1,18 @@ +ES5For-of30.ts(3,6): error TS2488: Type 'string | number' must have a '[Symbol.iterator]()' method that returns an iterator. +ES5For-of30.ts(3,7): error TS2322: Type 'number' is not assignable to type 'string'. +ES5For-of30.ts(3,14): error TS2322: Type 'string' is not assignable to type 'number'. + + +==== ES5For-of30.ts (3 errors) ==== + var a: string, b: number; + var tuple: [number, string] = [2, "3"]; + for ([a = 1, b = ""] of tuple) { + ~~~~~~~~~~~~~~~ +!!! error TS2488: Type 'string | number' must have a '[Symbol.iterator]()' method that returns an iterator. + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. + ~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. + a; + b; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of30(target=es2015).js b/tests/baselines/reference/ES5For-of30(target=es2015).js new file mode 100644 index 0000000000000..60cb68e48134c --- /dev/null +++ b/tests/baselines/reference/ES5For-of30(target=es2015).js @@ -0,0 +1,17 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts] //// + +//// [ES5For-of30.ts] +var a: string, b: number; +var tuple: [number, string] = [2, "3"]; +for ([a = 1, b = ""] of tuple) { + a; + b; +} + +//// [ES5For-of30.js] +var a, b; +var tuple = [2, "3"]; +for ([a = 1, b = ""] of tuple) { + a; + b; +} diff --git a/tests/baselines/reference/ES5For-of30.symbols b/tests/baselines/reference/ES5For-of30(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of30.symbols rename to tests/baselines/reference/ES5For-of30(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of30.types b/tests/baselines/reference/ES5For-of30(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of30.types rename to tests/baselines/reference/ES5For-of30(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of30.errors.txt b/tests/baselines/reference/ES5For-of30(target=es5).errors.txt similarity index 100% rename from tests/baselines/reference/ES5For-of30.errors.txt rename to tests/baselines/reference/ES5For-of30(target=es5).errors.txt diff --git a/tests/baselines/reference/ES5For-of30.js b/tests/baselines/reference/ES5For-of30(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of30.js rename to tests/baselines/reference/ES5For-of30(target=es5).js diff --git a/tests/baselines/reference/ES5For-of30(target=es5).symbols b/tests/baselines/reference/ES5For-of30(target=es5).symbols new file mode 100644 index 0000000000000..d9804400b3cd6 --- /dev/null +++ b/tests/baselines/reference/ES5For-of30(target=es5).symbols @@ -0,0 +1,21 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts] //// + +=== ES5For-of30.ts === +var a: string, b: number; +>a : Symbol(a, Decl(ES5For-of30.ts, 0, 3)) +>b : Symbol(b, Decl(ES5For-of30.ts, 0, 14)) + +var tuple: [number, string] = [2, "3"]; +>tuple : Symbol(tuple, Decl(ES5For-of30.ts, 1, 3)) + +for ([a = 1, b = ""] of tuple) { +>a : Symbol(a, Decl(ES5For-of30.ts, 0, 3)) +>b : Symbol(b, Decl(ES5For-of30.ts, 0, 14)) +>tuple : Symbol(tuple, Decl(ES5For-of30.ts, 1, 3)) + + a; +>a : Symbol(a, Decl(ES5For-of30.ts, 0, 3)) + + b; +>b : Symbol(b, Decl(ES5For-of30.ts, 0, 14)) +} diff --git a/tests/baselines/reference/ES5For-of30(target=es5).types b/tests/baselines/reference/ES5For-of30(target=es5).types new file mode 100644 index 0000000000000..2cbbb805b614f --- /dev/null +++ b/tests/baselines/reference/ES5For-of30(target=es5).types @@ -0,0 +1,45 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts] //// + +=== ES5For-of30.ts === +var a: string, b: number; +>a : string +> : ^^^^^^ +>b : number +> : ^^^^^^ + +var tuple: [number, string] = [2, "3"]; +>tuple : [number, string] +> : ^^^^^^^^^^^^^^^^ +>[2, "3"] : [number, string] +> : ^^^^^^^^^^^^^^^^ +>2 : 2 +> : ^ +>"3" : "3" +> : ^^^ + +for ([a = 1, b = ""] of tuple) { +>[a = 1, b = ""] : [number, string] +> : ^^^^^^^^^^^^^^^^ +>a = 1 : 1 +> : ^ +>a : string +> : ^^^^^^ +>1 : 1 +> : ^ +>b = "" : "" +> : ^^ +>b : number +> : ^^^^^^ +>"" : "" +> : ^^ +>tuple : [number, string] +> : ^^^^^^^^^^^^^^^^ + + a; +>a : string +> : ^^^^^^ + + b; +>b : number +> : ^^^^^^ +} diff --git a/tests/baselines/reference/ES5For-of31.errors.txt b/tests/baselines/reference/ES5For-of31(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/ES5For-of31.errors.txt rename to tests/baselines/reference/ES5For-of31(target=es2015).errors.txt diff --git a/tests/baselines/reference/ES5For-of31(target=es2015).js b/tests/baselines/reference/ES5For-of31(target=es2015).js new file mode 100644 index 0000000000000..0edabe9531fea --- /dev/null +++ b/tests/baselines/reference/ES5For-of31(target=es2015).js @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of31.ts] //// + +//// [ES5For-of31.ts] +var a: string, b: number; + +for ({ a: b = 1, b: a = ""} of []) { + a; + b; +} + +//// [ES5For-of31.js] +var a, b; +for ({ a: b = 1, b: a = "" } of []) { + a; + b; +} diff --git a/tests/baselines/reference/ES5For-of31.symbols b/tests/baselines/reference/ES5For-of31(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of31.symbols rename to tests/baselines/reference/ES5For-of31(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of31.types b/tests/baselines/reference/ES5For-of31(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of31.types rename to tests/baselines/reference/ES5For-of31(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of31(target=es5).errors.txt b/tests/baselines/reference/ES5For-of31(target=es5).errors.txt new file mode 100644 index 0000000000000..2c311153ffc35 --- /dev/null +++ b/tests/baselines/reference/ES5For-of31(target=es5).errors.txt @@ -0,0 +1,15 @@ +ES5For-of31.ts(3,8): error TS2339: Property 'a' does not exist on type 'undefined'. +ES5For-of31.ts(3,18): error TS2339: Property 'b' does not exist on type 'undefined'. + + +==== ES5For-of31.ts (2 errors) ==== + var a: string, b: number; + + for ({ a: b = 1, b: a = ""} of []) { + ~ +!!! error TS2339: Property 'a' does not exist on type 'undefined'. + ~ +!!! error TS2339: Property 'b' does not exist on type 'undefined'. + a; + b; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of31.js b/tests/baselines/reference/ES5For-of31(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of31.js rename to tests/baselines/reference/ES5For-of31(target=es5).js diff --git a/tests/baselines/reference/ES5For-of31(target=es5).symbols b/tests/baselines/reference/ES5For-of31(target=es5).symbols new file mode 100644 index 0000000000000..540fb0dd04ee3 --- /dev/null +++ b/tests/baselines/reference/ES5For-of31(target=es5).symbols @@ -0,0 +1,19 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of31.ts] //// + +=== ES5For-of31.ts === +var a: string, b: number; +>a : Symbol(a, Decl(ES5For-of31.ts, 0, 3)) +>b : Symbol(b, Decl(ES5For-of31.ts, 0, 14)) + +for ({ a: b = 1, b: a = ""} of []) { +>a : Symbol(a, Decl(ES5For-of31.ts, 2, 6)) +>b : Symbol(b, Decl(ES5For-of31.ts, 0, 14)) +>b : Symbol(b, Decl(ES5For-of31.ts, 2, 16)) +>a : Symbol(a, Decl(ES5For-of31.ts, 0, 3)) + + a; +>a : Symbol(a, Decl(ES5For-of31.ts, 0, 3)) + + b; +>b : Symbol(b, Decl(ES5For-of31.ts, 0, 14)) +} diff --git a/tests/baselines/reference/ES5For-of31(target=es5).types b/tests/baselines/reference/ES5For-of31(target=es5).types new file mode 100644 index 0000000000000..7dc4c17850c8b --- /dev/null +++ b/tests/baselines/reference/ES5For-of31(target=es5).types @@ -0,0 +1,39 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of31.ts] //// + +=== ES5For-of31.ts === +var a: string, b: number; +>a : string +> : ^^^^^^ +>b : number +> : ^^^^^^ + +for ({ a: b = 1, b: a = ""} of []) { +>{ a: b = 1, b: a = ""} : { a?: number; b?: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>a : number +> : ^^^^^^ +>b = 1 : 1 +> : ^ +>b : number +> : ^^^^^^ +>1 : 1 +> : ^ +>b : string +> : ^^^^^^ +>a = "" : "" +> : ^^ +>a : string +> : ^^^^^^ +>"" : "" +> : ^^ +>[] : undefined[] +> : ^^^^^^^^^^^ + + a; +>a : string +> : ^^^^^^ + + b; +>b : number +> : ^^^^^^ +} diff --git a/tests/baselines/reference/ES5For-of33(target=es2015).js b/tests/baselines/reference/ES5For-of33(target=es2015).js new file mode 100644 index 0000000000000..fcd852d9a96e8 --- /dev/null +++ b/tests/baselines/reference/ES5For-of33(target=es2015).js @@ -0,0 +1,12 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of33.ts] //// + +//// [ES5For-of33.ts] +for (var v of ['a', 'b', 'c']) { + console.log(v); +} + +//// [ES5For-of33.js] +for (var v of ['a', 'b', 'c']) { + console.log(v); +} +//# sourceMappingURL=ES5For-of33.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of33(target=es2015).js.map b/tests/baselines/reference/ES5For-of33(target=es2015).js.map new file mode 100644 index 0000000000000..1a0671a3d8b5c --- /dev/null +++ b/tests/baselines/reference/ES5For-of33(target=es2015).js.map @@ -0,0 +1,3 @@ +//// [ES5For-of33.js.map] +{"version":3,"file":"ES5For-of33.js","sourceRoot":"","sources":["ES5For-of33.ts"],"names":[],"mappings":"AAAA,KAAK,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;IAC5B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC"} +//// https://sokra.github.io/source-map-visualization#base64,Zm9yICh2YXIgdiBvZiBbJ2EnLCAnYicsICdjJ10pIHsNCiAgICBjb25zb2xlLmxvZyh2KTsNCn0NCi8vIyBzb3VyY2VNYXBwaW5nVVJMPUVTNUZvci1vZjMzLmpzLm1hcA==,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRVM1Rm9yLW9mMzMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJFUzVGb3Itb2YzMy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxLQUFLLElBQUksQ0FBQyxJQUFJLENBQUMsR0FBRyxFQUFFLEdBQUcsRUFBRSxHQUFHLENBQUMsRUFBRSxDQUFDO0lBQzVCLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUM7QUFDbkIsQ0FBQyJ9,Zm9yICh2YXIgdiBvZiBbJ2EnLCAnYicsICdjJ10pIHsKICAgIGNvbnNvbGUubG9nKHYpOwp9 diff --git a/tests/baselines/reference/ES5For-of33(target=es2015).sourcemap.txt b/tests/baselines/reference/ES5For-of33(target=es2015).sourcemap.txt new file mode 100644 index 0000000000000..1b33263a0705d --- /dev/null +++ b/tests/baselines/reference/ES5For-of33(target=es2015).sourcemap.txt @@ -0,0 +1,92 @@ +=================================================================== +JsFile: ES5For-of33.js +mapUrl: ES5For-of33.js.map +sourceRoot: +sources: ES5For-of33.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:ES5For-of33.js +sourceFile:ES5For-of33.ts +------------------------------------------------------------------- +>>>for (var v of ['a', 'b', 'c']) { +1 > +2 >^^^^^ +3 > ^^^^ +4 > ^ +5 > ^^^^ +6 > ^ +7 > ^^^ +8 > ^^ +9 > ^^^ +10> ^^ +11> ^^^ +12> ^ +13> ^^ +14> ^ +1 > +2 >for ( +3 > var +4 > v +5 > of +6 > [ +7 > 'a' +8 > , +9 > 'b' +10> , +11> 'c' +12> ] +13> ) +14> { +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) +3 >Emitted(1, 10) Source(1, 10) + SourceIndex(0) +4 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) +5 >Emitted(1, 15) Source(1, 15) + SourceIndex(0) +6 >Emitted(1, 16) Source(1, 16) + SourceIndex(0) +7 >Emitted(1, 19) Source(1, 19) + SourceIndex(0) +8 >Emitted(1, 21) Source(1, 21) + SourceIndex(0) +9 >Emitted(1, 24) Source(1, 24) + SourceIndex(0) +10>Emitted(1, 26) Source(1, 26) + SourceIndex(0) +11>Emitted(1, 29) Source(1, 29) + SourceIndex(0) +12>Emitted(1, 30) Source(1, 30) + SourceIndex(0) +13>Emitted(1, 32) Source(1, 32) + SourceIndex(0) +14>Emitted(1, 33) Source(1, 33) + SourceIndex(0) +--- +>>> console.log(v); +1 >^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^ +8 > ^ +1 > + > +2 > console +3 > . +4 > log +5 > ( +6 > v +7 > ) +8 > ; +1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +3 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +4 >Emitted(2, 16) Source(2, 16) + SourceIndex(0) +5 >Emitted(2, 17) Source(2, 17) + SourceIndex(0) +6 >Emitted(2, 18) Source(2, 18) + SourceIndex(0) +7 >Emitted(2, 19) Source(2, 19) + SourceIndex(0) +8 >Emitted(2, 20) Source(2, 20) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 2) Source(3, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=ES5For-of33.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of33.symbols b/tests/baselines/reference/ES5For-of33(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of33.symbols rename to tests/baselines/reference/ES5For-of33(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of33.types b/tests/baselines/reference/ES5For-of33(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of33.types rename to tests/baselines/reference/ES5For-of33(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of33.js b/tests/baselines/reference/ES5For-of33(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of33.js rename to tests/baselines/reference/ES5For-of33(target=es5).js diff --git a/tests/baselines/reference/ES5For-of33.js.map b/tests/baselines/reference/ES5For-of33(target=es5).js.map similarity index 100% rename from tests/baselines/reference/ES5For-of33.js.map rename to tests/baselines/reference/ES5For-of33(target=es5).js.map diff --git a/tests/baselines/reference/ES5For-of33.sourcemap.txt b/tests/baselines/reference/ES5For-of33(target=es5).sourcemap.txt similarity index 100% rename from tests/baselines/reference/ES5For-of33.sourcemap.txt rename to tests/baselines/reference/ES5For-of33(target=es5).sourcemap.txt diff --git a/tests/baselines/reference/ES5For-of33(target=es5).symbols b/tests/baselines/reference/ES5For-of33(target=es5).symbols new file mode 100644 index 0000000000000..6ab34a601a072 --- /dev/null +++ b/tests/baselines/reference/ES5For-of33(target=es5).symbols @@ -0,0 +1,12 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of33.ts] //// + +=== ES5For-of33.ts === +for (var v of ['a', 'b', 'c']) { +>v : Symbol(v, Decl(ES5For-of33.ts, 0, 8)) + + console.log(v); +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>v : Symbol(v, Decl(ES5For-of33.ts, 0, 8)) +} diff --git a/tests/baselines/reference/ES5For-of33(target=es5).types b/tests/baselines/reference/ES5For-of33(target=es5).types new file mode 100644 index 0000000000000..f21f2292603bb --- /dev/null +++ b/tests/baselines/reference/ES5For-of33(target=es5).types @@ -0,0 +1,27 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of33.ts] //// + +=== ES5For-of33.ts === +for (var v of ['a', 'b', 'c']) { +>v : string +> : ^^^^^^ +>['a', 'b', 'c'] : string[] +> : ^^^^^^^^ +>'a' : "a" +> : ^^^ +>'b' : "b" +> : ^^^ +>'c' : "c" +> : ^^^ + + console.log(v); +>console.log(v) : void +> : ^^^^ +>console.log : (...data: any[]) => void +> : ^^^^ ^^ ^^^^^ +>console : Console +> : ^^^^^^^ +>log : (...data: any[]) => void +> : ^^^^ ^^ ^^^^^ +>v : string +> : ^^^^^^ +} diff --git a/tests/baselines/reference/ES5For-of34.errors.txt b/tests/baselines/reference/ES5For-of34(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/ES5For-of34.errors.txt rename to tests/baselines/reference/ES5For-of34(target=es2015).errors.txt diff --git a/tests/baselines/reference/ES5For-of34(target=es2015).js b/tests/baselines/reference/ES5For-of34(target=es2015).js new file mode 100644 index 0000000000000..34a1923ab398f --- /dev/null +++ b/tests/baselines/reference/ES5For-of34(target=es2015).js @@ -0,0 +1,18 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of34.ts] //// + +//// [ES5For-of34.ts] +function foo() { + return { x: 0 }; +} +for (foo().x of ['a', 'b', 'c']) { + var p = foo().x; +} + +//// [ES5For-of34.js] +function foo() { + return { x: 0 }; +} +for (foo().x of ['a', 'b', 'c']) { + var p = foo().x; +} +//# sourceMappingURL=ES5For-of34.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of34(target=es2015).js.map b/tests/baselines/reference/ES5For-of34(target=es2015).js.map new file mode 100644 index 0000000000000..96e6605e94f21 --- /dev/null +++ b/tests/baselines/reference/ES5For-of34(target=es2015).js.map @@ -0,0 +1,3 @@ +//// [ES5For-of34.js.map] +{"version":3,"file":"ES5For-of34.js","sourceRoot":"","sources":["ES5For-of34.ts"],"names":[],"mappings":"AAAA,SAAS,GAAG;IACR,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACpB,CAAC;AACD,KAAK,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;IAC9B,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;AACpB,CAAC"} +//// https://sokra.github.io/source-map-visualization#base64,ZnVuY3Rpb24gZm9vKCkgew0KICAgIHJldHVybiB7IHg6IDAgfTsNCn0NCmZvciAoZm9vKCkueCBvZiBbJ2EnLCAnYicsICdjJ10pIHsNCiAgICB2YXIgcCA9IGZvbygpLng7DQp9DQovLyMgc291cmNlTWFwcGluZ1VSTD1FUzVGb3Itb2YzNC5qcy5tYXA=,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRVM1Rm9yLW9mMzQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJFUzVGb3Itb2YzNC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxTQUFTLEdBQUc7SUFDUixPQUFPLEVBQUUsQ0FBQyxFQUFFLENBQUMsRUFBRSxDQUFDO0FBQ3BCLENBQUM7QUFDRCxLQUFLLEdBQUcsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLEdBQUcsRUFBRSxHQUFHLEVBQUUsR0FBRyxDQUFDLEVBQUUsQ0FBQztJQUM5QixJQUFJLENBQUMsR0FBRyxHQUFHLEVBQUUsQ0FBQyxDQUFDLENBQUM7QUFDcEIsQ0FBQyJ9,ZnVuY3Rpb24gZm9vKCkgewogICAgcmV0dXJuIHsgeDogMCB9Owp9CmZvciAoZm9vKCkueCBvZiBbJ2EnLCAnYicsICdjJ10pIHsKICAgIHZhciBwID0gZm9vKCkueDsKfQ== diff --git a/tests/baselines/reference/ES5For-of34(target=es2015).sourcemap.txt b/tests/baselines/reference/ES5For-of34(target=es2015).sourcemap.txt new file mode 100644 index 0000000000000..8e317ca4c5df9 --- /dev/null +++ b/tests/baselines/reference/ES5For-of34(target=es2015).sourcemap.txt @@ -0,0 +1,151 @@ +=================================================================== +JsFile: ES5For-of34.js +mapUrl: ES5For-of34.js.map +sourceRoot: +sources: ES5For-of34.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:ES5For-of34.js +sourceFile:ES5For-of34.ts +------------------------------------------------------------------- +>>>function foo() { +1 > +2 >^^^^^^^^^ +3 > ^^^ +4 > ^^^^^^^^^-> +1 > +2 >function +3 > foo +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 10) Source(1, 10) + SourceIndex(0) +3 >Emitted(1, 13) Source(1, 13) + SourceIndex(0) +--- +>>> return { x: 0 }; +1->^^^^ +2 > ^^^^^^^ +3 > ^^ +4 > ^ +5 > ^^ +6 > ^ +7 > ^^ +8 > ^ +1->() { + > +2 > return +3 > { +4 > x +5 > : +6 > 0 +7 > } +8 > ; +1->Emitted(2, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +3 >Emitted(2, 14) Source(2, 14) + SourceIndex(0) +4 >Emitted(2, 15) Source(2, 15) + SourceIndex(0) +5 >Emitted(2, 17) Source(2, 17) + SourceIndex(0) +6 >Emitted(2, 18) Source(2, 18) + SourceIndex(0) +7 >Emitted(2, 20) Source(2, 20) + SourceIndex(0) +8 >Emitted(2, 21) Source(2, 21) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 2) Source(3, 2) + SourceIndex(0) +--- +>>>for (foo().x of ['a', 'b', 'c']) { +1-> +2 >^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^ +7 > ^^^^ +8 > ^ +9 > ^^^ +10> ^^ +11> ^^^ +12> ^^ +13> ^^^ +14> ^ +15> ^^ +16> ^ +1-> + > +2 >for ( +3 > foo +4 > () +5 > . +6 > x +7 > of +8 > [ +9 > 'a' +10> , +11> 'b' +12> , +13> 'c' +14> ] +15> ) +16> { +1->Emitted(4, 1) Source(4, 1) + SourceIndex(0) +2 >Emitted(4, 6) Source(4, 6) + SourceIndex(0) +3 >Emitted(4, 9) Source(4, 9) + SourceIndex(0) +4 >Emitted(4, 11) Source(4, 11) + SourceIndex(0) +5 >Emitted(4, 12) Source(4, 12) + SourceIndex(0) +6 >Emitted(4, 13) Source(4, 13) + SourceIndex(0) +7 >Emitted(4, 17) Source(4, 17) + SourceIndex(0) +8 >Emitted(4, 18) Source(4, 18) + SourceIndex(0) +9 >Emitted(4, 21) Source(4, 21) + SourceIndex(0) +10>Emitted(4, 23) Source(4, 23) + SourceIndex(0) +11>Emitted(4, 26) Source(4, 26) + SourceIndex(0) +12>Emitted(4, 28) Source(4, 28) + SourceIndex(0) +13>Emitted(4, 31) Source(4, 31) + SourceIndex(0) +14>Emitted(4, 32) Source(4, 32) + SourceIndex(0) +15>Emitted(4, 34) Source(4, 34) + SourceIndex(0) +16>Emitted(4, 35) Source(4, 35) + SourceIndex(0) +--- +>>> var p = foo().x; +1 >^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^ +5 > ^^^ +6 > ^^ +7 > ^ +8 > ^ +9 > ^ +1 > + > +2 > var +3 > p +4 > = +5 > foo +6 > () +7 > . +8 > x +9 > ; +1 >Emitted(5, 5) Source(5, 5) + SourceIndex(0) +2 >Emitted(5, 9) Source(5, 9) + SourceIndex(0) +3 >Emitted(5, 10) Source(5, 10) + SourceIndex(0) +4 >Emitted(5, 13) Source(5, 13) + SourceIndex(0) +5 >Emitted(5, 16) Source(5, 16) + SourceIndex(0) +6 >Emitted(5, 18) Source(5, 18) + SourceIndex(0) +7 >Emitted(5, 19) Source(5, 19) + SourceIndex(0) +8 >Emitted(5, 20) Source(5, 20) + SourceIndex(0) +9 >Emitted(5, 21) Source(5, 21) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(6, 1) Source(6, 1) + SourceIndex(0) +2 >Emitted(6, 2) Source(6, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=ES5For-of34.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of34.symbols b/tests/baselines/reference/ES5For-of34(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of34.symbols rename to tests/baselines/reference/ES5For-of34(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of34.types b/tests/baselines/reference/ES5For-of34(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of34.types rename to tests/baselines/reference/ES5For-of34(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of34(target=es5).errors.txt b/tests/baselines/reference/ES5For-of34(target=es5).errors.txt new file mode 100644 index 0000000000000..f144c20c30d3b --- /dev/null +++ b/tests/baselines/reference/ES5For-of34(target=es5).errors.txt @@ -0,0 +1,12 @@ +ES5For-of34.ts(4,6): error TS2322: Type 'string' is not assignable to type 'number'. + + +==== ES5For-of34.ts (1 errors) ==== + function foo() { + return { x: 0 }; + } + for (foo().x of ['a', 'b', 'c']) { + ~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. + var p = foo().x; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of34.js b/tests/baselines/reference/ES5For-of34(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of34.js rename to tests/baselines/reference/ES5For-of34(target=es5).js diff --git a/tests/baselines/reference/ES5For-of34.js.map b/tests/baselines/reference/ES5For-of34(target=es5).js.map similarity index 100% rename from tests/baselines/reference/ES5For-of34.js.map rename to tests/baselines/reference/ES5For-of34(target=es5).js.map diff --git a/tests/baselines/reference/ES5For-of34.sourcemap.txt b/tests/baselines/reference/ES5For-of34(target=es5).sourcemap.txt similarity index 100% rename from tests/baselines/reference/ES5For-of34.sourcemap.txt rename to tests/baselines/reference/ES5For-of34(target=es5).sourcemap.txt diff --git a/tests/baselines/reference/ES5For-of34(target=es5).symbols b/tests/baselines/reference/ES5For-of34(target=es5).symbols new file mode 100644 index 0000000000000..6f167440f8876 --- /dev/null +++ b/tests/baselines/reference/ES5For-of34(target=es5).symbols @@ -0,0 +1,20 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of34.ts] //// + +=== ES5For-of34.ts === +function foo() { +>foo : Symbol(foo, Decl(ES5For-of34.ts, 0, 0)) + + return { x: 0 }; +>x : Symbol(x, Decl(ES5For-of34.ts, 1, 12)) +} +for (foo().x of ['a', 'b', 'c']) { +>foo().x : Symbol(x, Decl(ES5For-of34.ts, 1, 12)) +>foo : Symbol(foo, Decl(ES5For-of34.ts, 0, 0)) +>x : Symbol(x, Decl(ES5For-of34.ts, 1, 12)) + + var p = foo().x; +>p : Symbol(p, Decl(ES5For-of34.ts, 4, 7)) +>foo().x : Symbol(x, Decl(ES5For-of34.ts, 1, 12)) +>foo : Symbol(foo, Decl(ES5For-of34.ts, 0, 0)) +>x : Symbol(x, Decl(ES5For-of34.ts, 1, 12)) +} diff --git a/tests/baselines/reference/ES5For-of34(target=es5).types b/tests/baselines/reference/ES5For-of34(target=es5).types new file mode 100644 index 0000000000000..b9fb5c316a5b2 --- /dev/null +++ b/tests/baselines/reference/ES5For-of34(target=es5).types @@ -0,0 +1,45 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of34.ts] //// + +=== ES5For-of34.ts === +function foo() { +>foo : () => { x: number; } +> : ^^^^^^^^^^^^^^^^^^^^ + + return { x: 0 }; +>{ x: 0 } : { x: number; } +> : ^^^^^^^^^^^^^^ +>x : number +> : ^^^^^^ +>0 : 0 +> : ^ +} +for (foo().x of ['a', 'b', 'c']) { +>foo().x : number +> : ^^^^^^ +>foo() : { x: number; } +> : ^^^^^^^^^^^^^^ +>foo : () => { x: number; } +> : ^^^^^^^^^^^^^^^^^^^^ +>x : number +> : ^^^^^^ +>['a', 'b', 'c'] : string[] +> : ^^^^^^^^ +>'a' : "a" +> : ^^^ +>'b' : "b" +> : ^^^ +>'c' : "c" +> : ^^^ + + var p = foo().x; +>p : number +> : ^^^^^^ +>foo().x : number +> : ^^^^^^ +>foo() : { x: number; } +> : ^^^^^^^^^^^^^^ +>foo : () => { x: number; } +> : ^^^^^^^^^^^^^^^^^^^^ +>x : number +> : ^^^^^^ +} diff --git a/tests/baselines/reference/ES5For-of35.errors.txt b/tests/baselines/reference/ES5For-of35(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/ES5For-of35.errors.txt rename to tests/baselines/reference/ES5For-of35(target=es2015).errors.txt diff --git a/tests/baselines/reference/ES5For-of35(target=es2015).js b/tests/baselines/reference/ES5For-of35(target=es2015).js new file mode 100644 index 0000000000000..c60f3294b6d66 --- /dev/null +++ b/tests/baselines/reference/ES5For-of35(target=es2015).js @@ -0,0 +1,14 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of35.ts] //// + +//// [ES5For-of35.ts] +for (const {x: a = 0, y: b = 1} of [2, 3]) { + a; + b; +} + +//// [ES5For-of35.js] +for (const { x: a = 0, y: b = 1 } of [2, 3]) { + a; + b; +} +//# sourceMappingURL=ES5For-of35.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of35(target=es2015).js.map b/tests/baselines/reference/ES5For-of35(target=es2015).js.map new file mode 100644 index 0000000000000..c0106e63e4e96 --- /dev/null +++ b/tests/baselines/reference/ES5For-of35(target=es2015).js.map @@ -0,0 +1,3 @@ +//// [ES5For-of35.js.map] +{"version":3,"file":"ES5For-of35.js","sourceRoot":"","sources":["ES5For-of35.ts"],"names":[],"mappings":"AAAA,KAAK,MAAM,EAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,EAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IACxC,CAAC,CAAC;IACF,CAAC,CAAC;AACN,CAAC"} +//// https://sokra.github.io/source-map-visualization#base64,Zm9yIChjb25zdCB7IHg6IGEgPSAwLCB5OiBiID0gMSB9IG9mIFsyLCAzXSkgew0KICAgIGE7DQogICAgYjsNCn0NCi8vIyBzb3VyY2VNYXBwaW5nVVJMPUVTNUZvci1vZjM1LmpzLm1hcA==,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRVM1Rm9yLW9mMzUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJFUzVGb3Itb2YzNS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxLQUFLLE1BQU0sRUFBQyxDQUFDLEVBQUUsQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDLEVBQUUsQ0FBQyxHQUFHLENBQUMsRUFBQyxJQUFJLENBQUMsQ0FBQyxFQUFFLENBQUMsQ0FBQyxFQUFFLENBQUM7SUFDeEMsQ0FBQyxDQUFDO0lBQ0YsQ0FBQyxDQUFDO0FBQ04sQ0FBQyJ9,Zm9yIChjb25zdCB7eDogYSA9IDAsIHk6IGIgPSAxfSBvZiBbMiwgM10pIHsKICAgIGE7CiAgICBiOwp9 diff --git a/tests/baselines/reference/ES5For-of35(target=es2015).sourcemap.txt b/tests/baselines/reference/ES5For-of35(target=es2015).sourcemap.txt new file mode 100644 index 0000000000000..f096b11328b9a --- /dev/null +++ b/tests/baselines/reference/ES5For-of35(target=es2015).sourcemap.txt @@ -0,0 +1,120 @@ +=================================================================== +JsFile: ES5For-of35.js +mapUrl: ES5For-of35.js.map +sourceRoot: +sources: ES5For-of35.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:ES5For-of35.js +sourceFile:ES5For-of35.ts +------------------------------------------------------------------- +>>>for (const { x: a = 0, y: b = 1 } of [2, 3]) { +1 > +2 >^^^^^ +3 > ^^^^^^ +4 > ^^ +5 > ^ +6 > ^^ +7 > ^ +8 > ^^^ +9 > ^ +10> ^^ +11> ^ +12> ^^ +13> ^ +14> ^^^ +15> ^ +16> ^^ +17> ^^^^ +18> ^ +19> ^ +20> ^^ +21> ^ +22> ^ +23> ^^ +24> ^ +1 > +2 >for ( +3 > const +4 > { +5 > x +6 > : +7 > a +8 > = +9 > 0 +10> , +11> y +12> : +13> b +14> = +15> 1 +16> } +17> of +18> [ +19> 2 +20> , +21> 3 +22> ] +23> ) +24> { +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) +3 >Emitted(1, 12) Source(1, 12) + SourceIndex(0) +4 >Emitted(1, 14) Source(1, 13) + SourceIndex(0) +5 >Emitted(1, 15) Source(1, 14) + SourceIndex(0) +6 >Emitted(1, 17) Source(1, 16) + SourceIndex(0) +7 >Emitted(1, 18) Source(1, 17) + SourceIndex(0) +8 >Emitted(1, 21) Source(1, 20) + SourceIndex(0) +9 >Emitted(1, 22) Source(1, 21) + SourceIndex(0) +10>Emitted(1, 24) Source(1, 23) + SourceIndex(0) +11>Emitted(1, 25) Source(1, 24) + SourceIndex(0) +12>Emitted(1, 27) Source(1, 26) + SourceIndex(0) +13>Emitted(1, 28) Source(1, 27) + SourceIndex(0) +14>Emitted(1, 31) Source(1, 30) + SourceIndex(0) +15>Emitted(1, 32) Source(1, 31) + SourceIndex(0) +16>Emitted(1, 34) Source(1, 32) + SourceIndex(0) +17>Emitted(1, 38) Source(1, 36) + SourceIndex(0) +18>Emitted(1, 39) Source(1, 37) + SourceIndex(0) +19>Emitted(1, 40) Source(1, 38) + SourceIndex(0) +20>Emitted(1, 42) Source(1, 40) + SourceIndex(0) +21>Emitted(1, 43) Source(1, 41) + SourceIndex(0) +22>Emitted(1, 44) Source(1, 42) + SourceIndex(0) +23>Emitted(1, 46) Source(1, 44) + SourceIndex(0) +24>Emitted(1, 47) Source(1, 45) + SourceIndex(0) +--- +>>> a; +1 >^^^^ +2 > ^ +3 > ^ +4 > ^-> +1 > + > +2 > a +3 > ; +1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(2, 6) Source(2, 6) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +--- +>>> b; +1->^^^^ +2 > ^ +3 > ^ +1-> + > +2 > b +3 > ; +1->Emitted(3, 5) Source(3, 5) + SourceIndex(0) +2 >Emitted(3, 6) Source(3, 6) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(4, 1) Source(4, 1) + SourceIndex(0) +2 >Emitted(4, 2) Source(4, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=ES5For-of35.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of35.symbols b/tests/baselines/reference/ES5For-of35(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of35.symbols rename to tests/baselines/reference/ES5For-of35(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of35.types b/tests/baselines/reference/ES5For-of35(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of35.types rename to tests/baselines/reference/ES5For-of35(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of35(target=es5).errors.txt b/tests/baselines/reference/ES5For-of35(target=es5).errors.txt new file mode 100644 index 0000000000000..64fe6dcc61a3a --- /dev/null +++ b/tests/baselines/reference/ES5For-of35(target=es5).errors.txt @@ -0,0 +1,13 @@ +ES5For-of35.ts(1,13): error TS2339: Property 'x' does not exist on type 'Number'. +ES5For-of35.ts(1,23): error TS2339: Property 'y' does not exist on type 'Number'. + + +==== ES5For-of35.ts (2 errors) ==== + for (const {x: a = 0, y: b = 1} of [2, 3]) { + ~ +!!! error TS2339: Property 'x' does not exist on type 'Number'. + ~ +!!! error TS2339: Property 'y' does not exist on type 'Number'. + a; + b; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of35.js b/tests/baselines/reference/ES5For-of35(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of35.js rename to tests/baselines/reference/ES5For-of35(target=es5).js diff --git a/tests/baselines/reference/ES5For-of35.js.map b/tests/baselines/reference/ES5For-of35(target=es5).js.map similarity index 100% rename from tests/baselines/reference/ES5For-of35.js.map rename to tests/baselines/reference/ES5For-of35(target=es5).js.map diff --git a/tests/baselines/reference/ES5For-of35.sourcemap.txt b/tests/baselines/reference/ES5For-of35(target=es5).sourcemap.txt similarity index 100% rename from tests/baselines/reference/ES5For-of35.sourcemap.txt rename to tests/baselines/reference/ES5For-of35(target=es5).sourcemap.txt diff --git a/tests/baselines/reference/ES5For-of35(target=es5).symbols b/tests/baselines/reference/ES5For-of35(target=es5).symbols new file mode 100644 index 0000000000000..8dcd9d0ccddf8 --- /dev/null +++ b/tests/baselines/reference/ES5For-of35(target=es5).symbols @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of35.ts] //// + +=== ES5For-of35.ts === +for (const {x: a = 0, y: b = 1} of [2, 3]) { +>a : Symbol(a, Decl(ES5For-of35.ts, 0, 12)) +>b : Symbol(b, Decl(ES5For-of35.ts, 0, 21)) + + a; +>a : Symbol(a, Decl(ES5For-of35.ts, 0, 12)) + + b; +>b : Symbol(b, Decl(ES5For-of35.ts, 0, 21)) +} diff --git a/tests/baselines/reference/ES5For-of35(target=es5).types b/tests/baselines/reference/ES5For-of35(target=es5).types new file mode 100644 index 0000000000000..2ef2c1735c334 --- /dev/null +++ b/tests/baselines/reference/ES5For-of35(target=es5).types @@ -0,0 +1,31 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of35.ts] //// + +=== ES5For-of35.ts === +for (const {x: a = 0, y: b = 1} of [2, 3]) { +>x : any +> : ^^^ +>a : any +> : ^^^ +>0 : 0 +> : ^ +>y : any +> : ^^^ +>b : any +> : ^^^ +>1 : 1 +> : ^ +>[2, 3] : number[] +> : ^^^^^^^^ +>2 : 2 +> : ^ +>3 : 3 +> : ^ + + a; +>a : any +> : ^^^ + + b; +>b : any +> : ^^^ +} diff --git a/tests/baselines/reference/ES5For-of36(target=es2015).errors.txt b/tests/baselines/reference/ES5For-of36(target=es2015).errors.txt new file mode 100644 index 0000000000000..c39a271f1749a --- /dev/null +++ b/tests/baselines/reference/ES5For-of36(target=es2015).errors.txt @@ -0,0 +1,10 @@ +ES5For-of36.ts(1,10): error TS2488: Type 'number' must have a '[Symbol.iterator]()' method that returns an iterator. + + +==== ES5For-of36.ts (1 errors) ==== + for (let [a = 0, b = 1] of [2, 3]) { + ~~~~~~~~~~~~~~ +!!! error TS2488: Type 'number' must have a '[Symbol.iterator]()' method that returns an iterator. + a; + b; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of36(target=es2015).js b/tests/baselines/reference/ES5For-of36(target=es2015).js new file mode 100644 index 0000000000000..dd91fc95a43ce --- /dev/null +++ b/tests/baselines/reference/ES5For-of36(target=es2015).js @@ -0,0 +1,14 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of36.ts] //// + +//// [ES5For-of36.ts] +for (let [a = 0, b = 1] of [2, 3]) { + a; + b; +} + +//// [ES5For-of36.js] +for (let [a = 0, b = 1] of [2, 3]) { + a; + b; +} +//# sourceMappingURL=ES5For-of36.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of36(target=es2015).js.map b/tests/baselines/reference/ES5For-of36(target=es2015).js.map new file mode 100644 index 0000000000000..cfe267605f3e3 --- /dev/null +++ b/tests/baselines/reference/ES5For-of36(target=es2015).js.map @@ -0,0 +1,3 @@ +//// [ES5For-of36.js.map] +{"version":3,"file":"ES5For-of36.js","sourceRoot":"","sources":["ES5For-of36.ts"],"names":[],"mappings":"AAAA,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IAChC,CAAC,CAAC;IACF,CAAC,CAAC;AACN,CAAC"} +//// https://sokra.github.io/source-map-visualization#base64,Zm9yIChsZXQgW2EgPSAwLCBiID0gMV0gb2YgWzIsIDNdKSB7DQogICAgYTsNCiAgICBiOw0KfQ0KLy8jIHNvdXJjZU1hcHBpbmdVUkw9RVM1Rm9yLW9mMzYuanMubWFw,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRVM1Rm9yLW9mMzYuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJFUzVGb3Itb2YzNi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxLQUFLLElBQUksQ0FBQyxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsR0FBRyxDQUFDLENBQUMsSUFBSSxDQUFDLENBQUMsRUFBRSxDQUFDLENBQUMsRUFBRSxDQUFDO0lBQ2hDLENBQUMsQ0FBQztJQUNGLENBQUMsQ0FBQztBQUNOLENBQUMifQ==,Zm9yIChsZXQgW2EgPSAwLCBiID0gMV0gb2YgWzIsIDNdKSB7CiAgICBhOwogICAgYjsKfQ== diff --git a/tests/baselines/reference/ES5For-of36(target=es2015).sourcemap.txt b/tests/baselines/reference/ES5For-of36(target=es2015).sourcemap.txt new file mode 100644 index 0000000000000..03acfa9fab6ff --- /dev/null +++ b/tests/baselines/reference/ES5For-of36(target=es2015).sourcemap.txt @@ -0,0 +1,108 @@ +=================================================================== +JsFile: ES5For-of36.js +mapUrl: ES5For-of36.js.map +sourceRoot: +sources: ES5For-of36.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:ES5For-of36.js +sourceFile:ES5For-of36.ts +------------------------------------------------------------------- +>>>for (let [a = 0, b = 1] of [2, 3]) { +1 > +2 >^^^^^ +3 > ^^^^ +4 > ^ +5 > ^ +6 > ^^^ +7 > ^ +8 > ^^ +9 > ^ +10> ^^^ +11> ^ +12> ^ +13> ^^^^ +14> ^ +15> ^ +16> ^^ +17> ^ +18> ^ +19> ^^ +20> ^ +1 > +2 >for ( +3 > let +4 > [ +5 > a +6 > = +7 > 0 +8 > , +9 > b +10> = +11> 1 +12> ] +13> of +14> [ +15> 2 +16> , +17> 3 +18> ] +19> ) +20> { +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) +3 >Emitted(1, 10) Source(1, 10) + SourceIndex(0) +4 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) +5 >Emitted(1, 12) Source(1, 12) + SourceIndex(0) +6 >Emitted(1, 15) Source(1, 15) + SourceIndex(0) +7 >Emitted(1, 16) Source(1, 16) + SourceIndex(0) +8 >Emitted(1, 18) Source(1, 18) + SourceIndex(0) +9 >Emitted(1, 19) Source(1, 19) + SourceIndex(0) +10>Emitted(1, 22) Source(1, 22) + SourceIndex(0) +11>Emitted(1, 23) Source(1, 23) + SourceIndex(0) +12>Emitted(1, 24) Source(1, 24) + SourceIndex(0) +13>Emitted(1, 28) Source(1, 28) + SourceIndex(0) +14>Emitted(1, 29) Source(1, 29) + SourceIndex(0) +15>Emitted(1, 30) Source(1, 30) + SourceIndex(0) +16>Emitted(1, 32) Source(1, 32) + SourceIndex(0) +17>Emitted(1, 33) Source(1, 33) + SourceIndex(0) +18>Emitted(1, 34) Source(1, 34) + SourceIndex(0) +19>Emitted(1, 36) Source(1, 36) + SourceIndex(0) +20>Emitted(1, 37) Source(1, 37) + SourceIndex(0) +--- +>>> a; +1 >^^^^ +2 > ^ +3 > ^ +4 > ^-> +1 > + > +2 > a +3 > ; +1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(2, 6) Source(2, 6) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +--- +>>> b; +1->^^^^ +2 > ^ +3 > ^ +1-> + > +2 > b +3 > ; +1->Emitted(3, 5) Source(3, 5) + SourceIndex(0) +2 >Emitted(3, 6) Source(3, 6) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(4, 1) Source(4, 1) + SourceIndex(0) +2 >Emitted(4, 2) Source(4, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=ES5For-of36.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of36.symbols b/tests/baselines/reference/ES5For-of36(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of36.symbols rename to tests/baselines/reference/ES5For-of36(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of36.types b/tests/baselines/reference/ES5For-of36(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of36.types rename to tests/baselines/reference/ES5For-of36(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of36.errors.txt b/tests/baselines/reference/ES5For-of36(target=es5).errors.txt similarity index 100% rename from tests/baselines/reference/ES5For-of36.errors.txt rename to tests/baselines/reference/ES5For-of36(target=es5).errors.txt diff --git a/tests/baselines/reference/ES5For-of36.js b/tests/baselines/reference/ES5For-of36(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of36.js rename to tests/baselines/reference/ES5For-of36(target=es5).js diff --git a/tests/baselines/reference/ES5For-of36.js.map b/tests/baselines/reference/ES5For-of36(target=es5).js.map similarity index 100% rename from tests/baselines/reference/ES5For-of36.js.map rename to tests/baselines/reference/ES5For-of36(target=es5).js.map diff --git a/tests/baselines/reference/ES5For-of36.sourcemap.txt b/tests/baselines/reference/ES5For-of36(target=es5).sourcemap.txt similarity index 100% rename from tests/baselines/reference/ES5For-of36.sourcemap.txt rename to tests/baselines/reference/ES5For-of36(target=es5).sourcemap.txt diff --git a/tests/baselines/reference/ES5For-of36(target=es5).symbols b/tests/baselines/reference/ES5For-of36(target=es5).symbols new file mode 100644 index 0000000000000..5385cfbb0d72d --- /dev/null +++ b/tests/baselines/reference/ES5For-of36(target=es5).symbols @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of36.ts] //// + +=== ES5For-of36.ts === +for (let [a = 0, b = 1] of [2, 3]) { +>a : Symbol(a, Decl(ES5For-of36.ts, 0, 10)) +>b : Symbol(b, Decl(ES5For-of36.ts, 0, 16)) + + a; +>a : Symbol(a, Decl(ES5For-of36.ts, 0, 10)) + + b; +>b : Symbol(b, Decl(ES5For-of36.ts, 0, 16)) +} diff --git a/tests/baselines/reference/ES5For-of36(target=es5).types b/tests/baselines/reference/ES5For-of36(target=es5).types new file mode 100644 index 0000000000000..dc0fc1320ee22 --- /dev/null +++ b/tests/baselines/reference/ES5For-of36(target=es5).types @@ -0,0 +1,27 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of36.ts] //// + +=== ES5For-of36.ts === +for (let [a = 0, b = 1] of [2, 3]) { +>a : any +> : ^^^ +>0 : 0 +> : ^ +>b : any +> : ^^^ +>1 : 1 +> : ^ +>[2, 3] : number[] +> : ^^^^^^^^ +>2 : 2 +> : ^ +>3 : 3 +> : ^ + + a; +>a : any +> : ^^^ + + b; +>b : any +> : ^^^ +} diff --git a/tests/baselines/reference/ES5For-of37(target=es2015).js b/tests/baselines/reference/ES5For-of37(target=es2015).js new file mode 100644 index 0000000000000..4bf3af2c37343 --- /dev/null +++ b/tests/baselines/reference/ES5For-of37(target=es2015).js @@ -0,0 +1,35 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of37.ts] //// + +//// [ES5For-of37.ts] +// https://github.com/microsoft/TypeScript/issues/30083 + +for (const i of [0, 1, 2, 3, 4]) { + try { + // Ensure catch binding for the following loop is reset per iteration: + for (const j of [1, 2, 3]) { + if (i === 2) { + throw new Error('ERR'); + } + } + console.log(i); + } catch (err) { + console.log('E %s %s', i, err); + } +} + +//// [ES5For-of37.js] +// https://github.com/microsoft/TypeScript/issues/30083 +for (const i of [0, 1, 2, 3, 4]) { + try { + // Ensure catch binding for the following loop is reset per iteration: + for (const j of [1, 2, 3]) { + if (i === 2) { + throw new Error('ERR'); + } + } + console.log(i); + } + catch (err) { + console.log('E %s %s', i, err); + } +} diff --git a/tests/baselines/reference/ES5For-of37.symbols b/tests/baselines/reference/ES5For-of37(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of37.symbols rename to tests/baselines/reference/ES5For-of37(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of37.types b/tests/baselines/reference/ES5For-of37(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of37.types rename to tests/baselines/reference/ES5For-of37(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of37.js b/tests/baselines/reference/ES5For-of37(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of37.js rename to tests/baselines/reference/ES5For-of37(target=es5).js diff --git a/tests/baselines/reference/ES5For-of37(target=es5).symbols b/tests/baselines/reference/ES5For-of37(target=es5).symbols new file mode 100644 index 0000000000000..e23334fe836ef --- /dev/null +++ b/tests/baselines/reference/ES5For-of37(target=es5).symbols @@ -0,0 +1,37 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of37.ts] //// + +=== ES5For-of37.ts === +// https://github.com/microsoft/TypeScript/issues/30083 + +for (const i of [0, 1, 2, 3, 4]) { +>i : Symbol(i, Decl(ES5For-of37.ts, 2, 10)) + + try { + // Ensure catch binding for the following loop is reset per iteration: + for (const j of [1, 2, 3]) { +>j : Symbol(j, Decl(ES5For-of37.ts, 5, 18)) + + if (i === 2) { +>i : Symbol(i, Decl(ES5For-of37.ts, 2, 10)) + + throw new Error('ERR'); +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + } + } + console.log(i); +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>i : Symbol(i, Decl(ES5For-of37.ts, 2, 10)) + + } catch (err) { +>err : Symbol(err, Decl(ES5For-of37.ts, 11, 13)) + + console.log('E %s %s', i, err); +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>i : Symbol(i, Decl(ES5For-of37.ts, 2, 10)) +>err : Symbol(err, Decl(ES5For-of37.ts, 11, 13)) + } +} diff --git a/tests/baselines/reference/ES5For-of37(target=es5).types b/tests/baselines/reference/ES5For-of37(target=es5).types new file mode 100644 index 0000000000000..58c2d9689f3f5 --- /dev/null +++ b/tests/baselines/reference/ES5For-of37(target=es5).types @@ -0,0 +1,83 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of37.ts] //// + +=== ES5For-of37.ts === +// https://github.com/microsoft/TypeScript/issues/30083 + +for (const i of [0, 1, 2, 3, 4]) { +>i : number +> : ^^^^^^ +>[0, 1, 2, 3, 4] : number[] +> : ^^^^^^^^ +>0 : 0 +> : ^ +>1 : 1 +> : ^ +>2 : 2 +> : ^ +>3 : 3 +> : ^ +>4 : 4 +> : ^ + + try { + // Ensure catch binding for the following loop is reset per iteration: + for (const j of [1, 2, 3]) { +>j : number +> : ^^^^^^ +>[1, 2, 3] : number[] +> : ^^^^^^^^ +>1 : 1 +> : ^ +>2 : 2 +> : ^ +>3 : 3 +> : ^ + + if (i === 2) { +>i === 2 : boolean +> : ^^^^^^^ +>i : number +> : ^^^^^^ +>2 : 2 +> : ^ + + throw new Error('ERR'); +>new Error('ERR') : Error +> : ^^^^^ +>Error : ErrorConstructor +> : ^^^^^^^^^^^^^^^^ +>'ERR' : "ERR" +> : ^^^^^ + } + } + console.log(i); +>console.log(i) : void +> : ^^^^ +>console.log : (...data: any[]) => void +> : ^^^^ ^^ ^^^^^ +>console : Console +> : ^^^^^^^ +>log : (...data: any[]) => void +> : ^^^^ ^^ ^^^^^ +>i : number +> : ^^^^^^ + + } catch (err) { +>err : any + + console.log('E %s %s', i, err); +>console.log('E %s %s', i, err) : void +> : ^^^^ +>console.log : (...data: any[]) => void +> : ^^^^ ^^ ^^^^^ +>console : Console +> : ^^^^^^^ +>log : (...data: any[]) => void +> : ^^^^ ^^ ^^^^^ +>'E %s %s' : "E %s %s" +> : ^^^^^^^^^ +>i : number +> : ^^^^^^ +>err : any + } +} diff --git a/tests/baselines/reference/ES5For-of4(target=es2015).js b/tests/baselines/reference/ES5For-of4(target=es2015).js new file mode 100644 index 0000000000000..497507bb4f7b0 --- /dev/null +++ b/tests/baselines/reference/ES5For-of4(target=es2015).js @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of4.ts] //// + +//// [ES5For-of4.ts] +for (var v of []) + var x = v; +var y = v; + +//// [ES5For-of4.js] +for (var v of []) + var x = v; +var y = v; diff --git a/tests/baselines/reference/ES5For-of4.symbols b/tests/baselines/reference/ES5For-of4(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of4.symbols rename to tests/baselines/reference/ES5For-of4(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of4.types b/tests/baselines/reference/ES5For-of4(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of4.types rename to tests/baselines/reference/ES5For-of4(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of4.js b/tests/baselines/reference/ES5For-of4(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of4.js rename to tests/baselines/reference/ES5For-of4(target=es5).js diff --git a/tests/baselines/reference/ES5For-of4(target=es5).symbols b/tests/baselines/reference/ES5For-of4(target=es5).symbols new file mode 100644 index 0000000000000..ef390450d7960 --- /dev/null +++ b/tests/baselines/reference/ES5For-of4(target=es5).symbols @@ -0,0 +1,14 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of4.ts] //// + +=== ES5For-of4.ts === +for (var v of []) +>v : Symbol(v, Decl(ES5For-of4.ts, 0, 8)) + + var x = v; +>x : Symbol(x, Decl(ES5For-of4.ts, 1, 7)) +>v : Symbol(v, Decl(ES5For-of4.ts, 0, 8)) + +var y = v; +>y : Symbol(y, Decl(ES5For-of4.ts, 2, 3)) +>v : Symbol(v, Decl(ES5For-of4.ts, 0, 8)) + diff --git a/tests/baselines/reference/ES5For-of4(target=es5).types b/tests/baselines/reference/ES5For-of4(target=es5).types new file mode 100644 index 0000000000000..7cad355200ff1 --- /dev/null +++ b/tests/baselines/reference/ES5For-of4(target=es5).types @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of4.ts] //// + +=== ES5For-of4.ts === +for (var v of []) +>v : any +>[] : undefined[] +> : ^^^^^^^^^^^ + + var x = v; +>x : any +>v : any + +var y = v; +>y : any +>v : any + diff --git a/tests/baselines/reference/ES5For-of5(target=es2015).js b/tests/baselines/reference/ES5For-of5(target=es2015).js new file mode 100644 index 0000000000000..795cd99365c42 --- /dev/null +++ b/tests/baselines/reference/ES5For-of5(target=es2015).js @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of5.ts] //// + +//// [ES5For-of5.ts] +for (var _a of []) { + var x = _a; +} + +//// [ES5For-of5.js] +for (var _a of []) { + var x = _a; +} diff --git a/tests/baselines/reference/ES5For-of5.symbols b/tests/baselines/reference/ES5For-of5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of5.symbols rename to tests/baselines/reference/ES5For-of5(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of5.types b/tests/baselines/reference/ES5For-of5(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of5.types rename to tests/baselines/reference/ES5For-of5(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of5.js b/tests/baselines/reference/ES5For-of5(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of5.js rename to tests/baselines/reference/ES5For-of5(target=es5).js diff --git a/tests/baselines/reference/ES5For-of5(target=es5).symbols b/tests/baselines/reference/ES5For-of5(target=es5).symbols new file mode 100644 index 0000000000000..dc6c85fc6ab5a --- /dev/null +++ b/tests/baselines/reference/ES5For-of5(target=es5).symbols @@ -0,0 +1,10 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of5.ts] //// + +=== ES5For-of5.ts === +for (var _a of []) { +>_a : Symbol(_a, Decl(ES5For-of5.ts, 0, 8)) + + var x = _a; +>x : Symbol(x, Decl(ES5For-of5.ts, 1, 7)) +>_a : Symbol(_a, Decl(ES5For-of5.ts, 0, 8)) +} diff --git a/tests/baselines/reference/ES5For-of5(target=es5).types b/tests/baselines/reference/ES5For-of5(target=es5).types new file mode 100644 index 0000000000000..cb0edb7986759 --- /dev/null +++ b/tests/baselines/reference/ES5For-of5(target=es5).types @@ -0,0 +1,12 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of5.ts] //// + +=== ES5For-of5.ts === +for (var _a of []) { +>_a : any +>[] : undefined[] +> : ^^^^^^^^^^^ + + var x = _a; +>x : any +>_a : any +} diff --git a/tests/baselines/reference/ES5For-of6(target=es2015).js b/tests/baselines/reference/ES5For-of6(target=es2015).js new file mode 100644 index 0000000000000..e734734077bf1 --- /dev/null +++ b/tests/baselines/reference/ES5For-of6(target=es2015).js @@ -0,0 +1,15 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of6.ts] //// + +//// [ES5For-of6.ts] +for (var w of []) { + for (var v of []) { + var x = [w, v]; + } +} + +//// [ES5For-of6.js] +for (var w of []) { + for (var v of []) { + var x = [w, v]; + } +} diff --git a/tests/baselines/reference/ES5For-of6.symbols b/tests/baselines/reference/ES5For-of6(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of6.symbols rename to tests/baselines/reference/ES5For-of6(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of6.types b/tests/baselines/reference/ES5For-of6(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of6.types rename to tests/baselines/reference/ES5For-of6(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of6.js b/tests/baselines/reference/ES5For-of6(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of6.js rename to tests/baselines/reference/ES5For-of6(target=es5).js diff --git a/tests/baselines/reference/ES5For-of6(target=es5).symbols b/tests/baselines/reference/ES5For-of6(target=es5).symbols new file mode 100644 index 0000000000000..2b758d1006d41 --- /dev/null +++ b/tests/baselines/reference/ES5For-of6(target=es5).symbols @@ -0,0 +1,15 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of6.ts] //// + +=== ES5For-of6.ts === +for (var w of []) { +>w : Symbol(w, Decl(ES5For-of6.ts, 0, 8)) + + for (var v of []) { +>v : Symbol(v, Decl(ES5For-of6.ts, 1, 12)) + + var x = [w, v]; +>x : Symbol(x, Decl(ES5For-of6.ts, 2, 11)) +>w : Symbol(w, Decl(ES5For-of6.ts, 0, 8)) +>v : Symbol(v, Decl(ES5For-of6.ts, 1, 12)) + } +} diff --git a/tests/baselines/reference/ES5For-of6(target=es5).types b/tests/baselines/reference/ES5For-of6(target=es5).types new file mode 100644 index 0000000000000..1060c46c2ddc5 --- /dev/null +++ b/tests/baselines/reference/ES5For-of6(target=es5).types @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of6.ts] //// + +=== ES5For-of6.ts === +for (var w of []) { +>w : any +>[] : undefined[] +> : ^^^^^^^^^^^ + + for (var v of []) { +>v : any +>[] : undefined[] +> : ^^^^^^^^^^^ + + var x = [w, v]; +>x : any[] +> : ^^^^^ +>[w, v] : any[] +> : ^^^^^ +>w : any +>v : any + } +} diff --git a/tests/baselines/reference/ES5For-of7.errors.txt b/tests/baselines/reference/ES5For-of7(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/ES5For-of7.errors.txt rename to tests/baselines/reference/ES5For-of7(target=es2015).errors.txt diff --git a/tests/baselines/reference/ES5For-of7(target=es2015).js b/tests/baselines/reference/ES5For-of7(target=es2015).js new file mode 100644 index 0000000000000..2cb31ac52e2fa --- /dev/null +++ b/tests/baselines/reference/ES5For-of7(target=es2015).js @@ -0,0 +1,18 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts] //// + +//// [ES5For-of7.ts] +for (var w of []) { + var x = w; +} + +for (var v of []) { + var x = [w, v]; +} + +//// [ES5For-of7.js] +for (var w of []) { + var x = w; +} +for (var v of []) { + var x = [w, v]; +} diff --git a/tests/baselines/reference/ES5For-of7.symbols b/tests/baselines/reference/ES5For-of7(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of7.symbols rename to tests/baselines/reference/ES5For-of7(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of7.types b/tests/baselines/reference/ES5For-of7(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of7.types rename to tests/baselines/reference/ES5For-of7(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of7(target=es5).errors.txt b/tests/baselines/reference/ES5For-of7(target=es5).errors.txt new file mode 100644 index 0000000000000..321726f9e2572 --- /dev/null +++ b/tests/baselines/reference/ES5For-of7(target=es5).errors.txt @@ -0,0 +1,14 @@ +ES5For-of7.ts(6,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'any[]'. + + +==== ES5For-of7.ts (1 errors) ==== + for (var w of []) { + var x = w; + } + + for (var v of []) { + var x = [w, v]; + ~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'any[]'. +!!! related TS6203 ES5For-of7.ts:2:9: 'x' was also declared here. + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of7.js b/tests/baselines/reference/ES5For-of7(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of7.js rename to tests/baselines/reference/ES5For-of7(target=es5).js diff --git a/tests/baselines/reference/ES5For-of7(target=es5).symbols b/tests/baselines/reference/ES5For-of7(target=es5).symbols new file mode 100644 index 0000000000000..dd673610c5b81 --- /dev/null +++ b/tests/baselines/reference/ES5For-of7(target=es5).symbols @@ -0,0 +1,19 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts] //// + +=== ES5For-of7.ts === +for (var w of []) { +>w : Symbol(w, Decl(ES5For-of7.ts, 0, 8)) + + var x = w; +>x : Symbol(x, Decl(ES5For-of7.ts, 1, 7), Decl(ES5For-of7.ts, 5, 7)) +>w : Symbol(w, Decl(ES5For-of7.ts, 0, 8)) +} + +for (var v of []) { +>v : Symbol(v, Decl(ES5For-of7.ts, 4, 8)) + + var x = [w, v]; +>x : Symbol(x, Decl(ES5For-of7.ts, 1, 7), Decl(ES5For-of7.ts, 5, 7)) +>w : Symbol(w, Decl(ES5For-of7.ts, 0, 8)) +>v : Symbol(v, Decl(ES5For-of7.ts, 4, 8)) +} diff --git a/tests/baselines/reference/ES5For-of7(target=es5).types b/tests/baselines/reference/ES5For-of7(target=es5).types new file mode 100644 index 0000000000000..5c3d6231b8457 --- /dev/null +++ b/tests/baselines/reference/ES5For-of7(target=es5).types @@ -0,0 +1,32 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts] //// + +=== ES5For-of7.ts === +for (var w of []) { +>w : any +> : ^^^ +>[] : undefined[] +> : ^^^^^^^^^^^ + + var x = w; +>x : any +> : ^^^ +>w : any +> : ^^^ +} + +for (var v of []) { +>v : any +> : ^^^ +>[] : undefined[] +> : ^^^^^^^^^^^ + + var x = [w, v]; +>x : any +> : ^^^ +>[w, v] : any[] +> : ^^^^^ +>w : any +> : ^^^ +>v : any +> : ^^^ +} diff --git a/tests/baselines/reference/ES5For-of8.errors.txt b/tests/baselines/reference/ES5For-of8(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/ES5For-of8.errors.txt rename to tests/baselines/reference/ES5For-of8(target=es2015).errors.txt diff --git a/tests/baselines/reference/ES5For-of8(target=es2015).js b/tests/baselines/reference/ES5For-of8(target=es2015).js new file mode 100644 index 0000000000000..d70a3fada883f --- /dev/null +++ b/tests/baselines/reference/ES5For-of8(target=es2015).js @@ -0,0 +1,18 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of8.ts] //// + +//// [ES5For-of8.ts] +function foo() { + return { x: 0 }; +} +for (foo().x of ['a', 'b', 'c']) { + var p = foo().x; +} + +//// [ES5For-of8.js] +function foo() { + return { x: 0 }; +} +for (foo().x of ['a', 'b', 'c']) { + var p = foo().x; +} +//# sourceMappingURL=ES5For-of8.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of8(target=es2015).js.map b/tests/baselines/reference/ES5For-of8(target=es2015).js.map new file mode 100644 index 0000000000000..97760cd0f5f7c --- /dev/null +++ b/tests/baselines/reference/ES5For-of8(target=es2015).js.map @@ -0,0 +1,3 @@ +//// [ES5For-of8.js.map] +{"version":3,"file":"ES5For-of8.js","sourceRoot":"","sources":["ES5For-of8.ts"],"names":[],"mappings":"AAAA,SAAS,GAAG;IACR,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACpB,CAAC;AACD,KAAK,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;IAC9B,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;AACpB,CAAC"} +//// https://sokra.github.io/source-map-visualization#base64,ZnVuY3Rpb24gZm9vKCkgew0KICAgIHJldHVybiB7IHg6IDAgfTsNCn0NCmZvciAoZm9vKCkueCBvZiBbJ2EnLCAnYicsICdjJ10pIHsNCiAgICB2YXIgcCA9IGZvbygpLng7DQp9DQovLyMgc291cmNlTWFwcGluZ1VSTD1FUzVGb3Itb2Y4LmpzLm1hcA==,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRVM1Rm9yLW9mOC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIkVTNUZvci1vZjgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsU0FBUyxHQUFHO0lBQ1IsT0FBTyxFQUFFLENBQUMsRUFBRSxDQUFDLEVBQUUsQ0FBQztBQUNwQixDQUFDO0FBQ0QsS0FBSyxHQUFHLEVBQUUsQ0FBQyxDQUFDLElBQUksQ0FBQyxHQUFHLEVBQUUsR0FBRyxFQUFFLEdBQUcsQ0FBQyxFQUFFLENBQUM7SUFDOUIsSUFBSSxDQUFDLEdBQUcsR0FBRyxFQUFFLENBQUMsQ0FBQyxDQUFDO0FBQ3BCLENBQUMifQ==,ZnVuY3Rpb24gZm9vKCkgewogICAgcmV0dXJuIHsgeDogMCB9Owp9CmZvciAoZm9vKCkueCBvZiBbJ2EnLCAnYicsICdjJ10pIHsKICAgIHZhciBwID0gZm9vKCkueDsKfQ== diff --git a/tests/baselines/reference/ES5For-of8(target=es2015).sourcemap.txt b/tests/baselines/reference/ES5For-of8(target=es2015).sourcemap.txt new file mode 100644 index 0000000000000..db2c386850e74 --- /dev/null +++ b/tests/baselines/reference/ES5For-of8(target=es2015).sourcemap.txt @@ -0,0 +1,151 @@ +=================================================================== +JsFile: ES5For-of8.js +mapUrl: ES5For-of8.js.map +sourceRoot: +sources: ES5For-of8.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:ES5For-of8.js +sourceFile:ES5For-of8.ts +------------------------------------------------------------------- +>>>function foo() { +1 > +2 >^^^^^^^^^ +3 > ^^^ +4 > ^^^^^^^^^-> +1 > +2 >function +3 > foo +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 10) Source(1, 10) + SourceIndex(0) +3 >Emitted(1, 13) Source(1, 13) + SourceIndex(0) +--- +>>> return { x: 0 }; +1->^^^^ +2 > ^^^^^^^ +3 > ^^ +4 > ^ +5 > ^^ +6 > ^ +7 > ^^ +8 > ^ +1->() { + > +2 > return +3 > { +4 > x +5 > : +6 > 0 +7 > } +8 > ; +1->Emitted(2, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +3 >Emitted(2, 14) Source(2, 14) + SourceIndex(0) +4 >Emitted(2, 15) Source(2, 15) + SourceIndex(0) +5 >Emitted(2, 17) Source(2, 17) + SourceIndex(0) +6 >Emitted(2, 18) Source(2, 18) + SourceIndex(0) +7 >Emitted(2, 20) Source(2, 20) + SourceIndex(0) +8 >Emitted(2, 21) Source(2, 21) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 2) Source(3, 2) + SourceIndex(0) +--- +>>>for (foo().x of ['a', 'b', 'c']) { +1-> +2 >^^^^^ +3 > ^^^ +4 > ^^ +5 > ^ +6 > ^ +7 > ^^^^ +8 > ^ +9 > ^^^ +10> ^^ +11> ^^^ +12> ^^ +13> ^^^ +14> ^ +15> ^^ +16> ^ +1-> + > +2 >for ( +3 > foo +4 > () +5 > . +6 > x +7 > of +8 > [ +9 > 'a' +10> , +11> 'b' +12> , +13> 'c' +14> ] +15> ) +16> { +1->Emitted(4, 1) Source(4, 1) + SourceIndex(0) +2 >Emitted(4, 6) Source(4, 6) + SourceIndex(0) +3 >Emitted(4, 9) Source(4, 9) + SourceIndex(0) +4 >Emitted(4, 11) Source(4, 11) + SourceIndex(0) +5 >Emitted(4, 12) Source(4, 12) + SourceIndex(0) +6 >Emitted(4, 13) Source(4, 13) + SourceIndex(0) +7 >Emitted(4, 17) Source(4, 17) + SourceIndex(0) +8 >Emitted(4, 18) Source(4, 18) + SourceIndex(0) +9 >Emitted(4, 21) Source(4, 21) + SourceIndex(0) +10>Emitted(4, 23) Source(4, 23) + SourceIndex(0) +11>Emitted(4, 26) Source(4, 26) + SourceIndex(0) +12>Emitted(4, 28) Source(4, 28) + SourceIndex(0) +13>Emitted(4, 31) Source(4, 31) + SourceIndex(0) +14>Emitted(4, 32) Source(4, 32) + SourceIndex(0) +15>Emitted(4, 34) Source(4, 34) + SourceIndex(0) +16>Emitted(4, 35) Source(4, 35) + SourceIndex(0) +--- +>>> var p = foo().x; +1 >^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^ +5 > ^^^ +6 > ^^ +7 > ^ +8 > ^ +9 > ^ +1 > + > +2 > var +3 > p +4 > = +5 > foo +6 > () +7 > . +8 > x +9 > ; +1 >Emitted(5, 5) Source(5, 5) + SourceIndex(0) +2 >Emitted(5, 9) Source(5, 9) + SourceIndex(0) +3 >Emitted(5, 10) Source(5, 10) + SourceIndex(0) +4 >Emitted(5, 13) Source(5, 13) + SourceIndex(0) +5 >Emitted(5, 16) Source(5, 16) + SourceIndex(0) +6 >Emitted(5, 18) Source(5, 18) + SourceIndex(0) +7 >Emitted(5, 19) Source(5, 19) + SourceIndex(0) +8 >Emitted(5, 20) Source(5, 20) + SourceIndex(0) +9 >Emitted(5, 21) Source(5, 21) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(6, 1) Source(6, 1) + SourceIndex(0) +2 >Emitted(6, 2) Source(6, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=ES5For-of8.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of8.symbols b/tests/baselines/reference/ES5For-of8(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of8.symbols rename to tests/baselines/reference/ES5For-of8(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of8.types b/tests/baselines/reference/ES5For-of8(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of8.types rename to tests/baselines/reference/ES5For-of8(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of8(target=es5).errors.txt b/tests/baselines/reference/ES5For-of8(target=es5).errors.txt new file mode 100644 index 0000000000000..707302366a09c --- /dev/null +++ b/tests/baselines/reference/ES5For-of8(target=es5).errors.txt @@ -0,0 +1,12 @@ +ES5For-of8.ts(4,6): error TS2322: Type 'string' is not assignable to type 'number'. + + +==== ES5For-of8.ts (1 errors) ==== + function foo() { + return { x: 0 }; + } + for (foo().x of ['a', 'b', 'c']) { + ~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. + var p = foo().x; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of8.js b/tests/baselines/reference/ES5For-of8(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of8.js rename to tests/baselines/reference/ES5For-of8(target=es5).js diff --git a/tests/baselines/reference/ES5For-of8.js.map b/tests/baselines/reference/ES5For-of8(target=es5).js.map similarity index 100% rename from tests/baselines/reference/ES5For-of8.js.map rename to tests/baselines/reference/ES5For-of8(target=es5).js.map diff --git a/tests/baselines/reference/ES5For-of8.sourcemap.txt b/tests/baselines/reference/ES5For-of8(target=es5).sourcemap.txt similarity index 100% rename from tests/baselines/reference/ES5For-of8.sourcemap.txt rename to tests/baselines/reference/ES5For-of8(target=es5).sourcemap.txt diff --git a/tests/baselines/reference/ES5For-of8(target=es5).symbols b/tests/baselines/reference/ES5For-of8(target=es5).symbols new file mode 100644 index 0000000000000..2cbf0905d3f9a --- /dev/null +++ b/tests/baselines/reference/ES5For-of8(target=es5).symbols @@ -0,0 +1,20 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of8.ts] //// + +=== ES5For-of8.ts === +function foo() { +>foo : Symbol(foo, Decl(ES5For-of8.ts, 0, 0)) + + return { x: 0 }; +>x : Symbol(x, Decl(ES5For-of8.ts, 1, 12)) +} +for (foo().x of ['a', 'b', 'c']) { +>foo().x : Symbol(x, Decl(ES5For-of8.ts, 1, 12)) +>foo : Symbol(foo, Decl(ES5For-of8.ts, 0, 0)) +>x : Symbol(x, Decl(ES5For-of8.ts, 1, 12)) + + var p = foo().x; +>p : Symbol(p, Decl(ES5For-of8.ts, 4, 7)) +>foo().x : Symbol(x, Decl(ES5For-of8.ts, 1, 12)) +>foo : Symbol(foo, Decl(ES5For-of8.ts, 0, 0)) +>x : Symbol(x, Decl(ES5For-of8.ts, 1, 12)) +} diff --git a/tests/baselines/reference/ES5For-of8(target=es5).types b/tests/baselines/reference/ES5For-of8(target=es5).types new file mode 100644 index 0000000000000..07818487e657d --- /dev/null +++ b/tests/baselines/reference/ES5For-of8(target=es5).types @@ -0,0 +1,45 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of8.ts] //// + +=== ES5For-of8.ts === +function foo() { +>foo : () => { x: number; } +> : ^^^^^^^^^^^^^^^^^^^^ + + return { x: 0 }; +>{ x: 0 } : { x: number; } +> : ^^^^^^^^^^^^^^ +>x : number +> : ^^^^^^ +>0 : 0 +> : ^ +} +for (foo().x of ['a', 'b', 'c']) { +>foo().x : number +> : ^^^^^^ +>foo() : { x: number; } +> : ^^^^^^^^^^^^^^ +>foo : () => { x: number; } +> : ^^^^^^^^^^^^^^^^^^^^ +>x : number +> : ^^^^^^ +>['a', 'b', 'c'] : string[] +> : ^^^^^^^^ +>'a' : "a" +> : ^^^ +>'b' : "b" +> : ^^^ +>'c' : "c" +> : ^^^ + + var p = foo().x; +>p : number +> : ^^^^^^ +>foo().x : number +> : ^^^^^^ +>foo() : { x: number; } +> : ^^^^^^^^^^^^^^ +>foo : () => { x: number; } +> : ^^^^^^^^^^^^^^^^^^^^ +>x : number +> : ^^^^^^ +} diff --git a/tests/baselines/reference/ES5For-of9(target=es2015).js b/tests/baselines/reference/ES5For-of9(target=es2015).js new file mode 100644 index 0000000000000..d95adfed513e8 --- /dev/null +++ b/tests/baselines/reference/ES5For-of9(target=es2015).js @@ -0,0 +1,21 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of9.ts] //// + +//// [ES5For-of9.ts] +function foo() { + return { x: 0 }; +} +for (foo().x of []) { + for (foo().x of []) { + var p = foo().x; + } +} + +//// [ES5For-of9.js] +function foo() { + return { x: 0 }; +} +for (foo().x of []) { + for (foo().x of []) { + var p = foo().x; + } +} diff --git a/tests/baselines/reference/ES5For-of9.symbols b/tests/baselines/reference/ES5For-of9(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-of9.symbols rename to tests/baselines/reference/ES5For-of9(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-of9.types b/tests/baselines/reference/ES5For-of9(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-of9.types rename to tests/baselines/reference/ES5For-of9(target=es2015).types diff --git a/tests/baselines/reference/ES5For-of9.js b/tests/baselines/reference/ES5For-of9(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-of9.js rename to tests/baselines/reference/ES5For-of9(target=es5).js diff --git a/tests/baselines/reference/ES5For-of9(target=es5).symbols b/tests/baselines/reference/ES5For-of9(target=es5).symbols new file mode 100644 index 0000000000000..a40cfc6e4d121 --- /dev/null +++ b/tests/baselines/reference/ES5For-of9(target=es5).symbols @@ -0,0 +1,26 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of9.ts] //// + +=== ES5For-of9.ts === +function foo() { +>foo : Symbol(foo, Decl(ES5For-of9.ts, 0, 0)) + + return { x: 0 }; +>x : Symbol(x, Decl(ES5For-of9.ts, 1, 12)) +} +for (foo().x of []) { +>foo().x : Symbol(x, Decl(ES5For-of9.ts, 1, 12)) +>foo : Symbol(foo, Decl(ES5For-of9.ts, 0, 0)) +>x : Symbol(x, Decl(ES5For-of9.ts, 1, 12)) + + for (foo().x of []) { +>foo().x : Symbol(x, Decl(ES5For-of9.ts, 1, 12)) +>foo : Symbol(foo, Decl(ES5For-of9.ts, 0, 0)) +>x : Symbol(x, Decl(ES5For-of9.ts, 1, 12)) + + var p = foo().x; +>p : Symbol(p, Decl(ES5For-of9.ts, 5, 11)) +>foo().x : Symbol(x, Decl(ES5For-of9.ts, 1, 12)) +>foo : Symbol(foo, Decl(ES5For-of9.ts, 0, 0)) +>x : Symbol(x, Decl(ES5For-of9.ts, 1, 12)) + } +} diff --git a/tests/baselines/reference/ES5For-of9(target=es5).types b/tests/baselines/reference/ES5For-of9(target=es5).types new file mode 100644 index 0000000000000..699d2a7d41363 --- /dev/null +++ b/tests/baselines/reference/ES5For-of9(target=es5).types @@ -0,0 +1,52 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-of9.ts] //// + +=== ES5For-of9.ts === +function foo() { +>foo : () => { x: number; } +> : ^^^^^^^^^^^^^^^^^^^^ + + return { x: 0 }; +>{ x: 0 } : { x: number; } +> : ^^^^^^^^^^^^^^ +>x : number +> : ^^^^^^ +>0 : 0 +> : ^ +} +for (foo().x of []) { +>foo().x : number +> : ^^^^^^ +>foo() : { x: number; } +> : ^^^^^^^^^^^^^^ +>foo : () => { x: number; } +> : ^^^^^^^^^^^^^^^^^^^^ +>x : number +> : ^^^^^^ +>[] : undefined[] +> : ^^^^^^^^^^^ + + for (foo().x of []) { +>foo().x : number +> : ^^^^^^ +>foo() : { x: number; } +> : ^^^^^^^^^^^^^^ +>foo : () => { x: number; } +> : ^^^^^^^^^^^^^^^^^^^^ +>x : number +> : ^^^^^^ +>[] : undefined[] +> : ^^^^^^^^^^^ + + var p = foo().x; +>p : number +> : ^^^^^^ +>foo().x : number +> : ^^^^^^ +>foo() : { x: number; } +> : ^^^^^^^^^^^^^^ +>foo : () => { x: number; } +> : ^^^^^^^^^^^^^^^^^^^^ +>x : number +> : ^^^^^^ + } +} diff --git a/tests/baselines/reference/ES5For-ofTypeCheck1(target=es2015).js b/tests/baselines/reference/ES5For-ofTypeCheck1(target=es2015).js new file mode 100644 index 0000000000000..f32d5caec8dee --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck1(target=es2015).js @@ -0,0 +1,7 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck1.ts] //// + +//// [ES5For-ofTypeCheck1.ts] +for (var v of "") { } + +//// [ES5For-ofTypeCheck1.js] +for (var v of "") { } diff --git a/tests/baselines/reference/ES5For-ofTypeCheck1.symbols b/tests/baselines/reference/ES5For-ofTypeCheck1(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck1.symbols rename to tests/baselines/reference/ES5For-ofTypeCheck1(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-ofTypeCheck1.types b/tests/baselines/reference/ES5For-ofTypeCheck1(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck1.types rename to tests/baselines/reference/ES5For-ofTypeCheck1(target=es2015).types diff --git a/tests/baselines/reference/ES5For-ofTypeCheck1.js b/tests/baselines/reference/ES5For-ofTypeCheck1(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck1.js rename to tests/baselines/reference/ES5For-ofTypeCheck1(target=es5).js diff --git a/tests/baselines/reference/ES5For-ofTypeCheck1(target=es5).symbols b/tests/baselines/reference/ES5For-ofTypeCheck1(target=es5).symbols new file mode 100644 index 0000000000000..01901f1612f59 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck1(target=es5).symbols @@ -0,0 +1,6 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck1.ts] //// + +=== ES5For-ofTypeCheck1.ts === +for (var v of "") { } +>v : Symbol(v, Decl(ES5For-ofTypeCheck1.ts, 0, 8)) + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck1(target=es5).types b/tests/baselines/reference/ES5For-ofTypeCheck1(target=es5).types new file mode 100644 index 0000000000000..470f8b6cc5d9b --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck1(target=es5).types @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck1.ts] //// + +=== ES5For-ofTypeCheck1.ts === +for (var v of "") { } +>v : string +> : ^^^^^^ +>"" : "" +> : ^^ + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck10(target=es2015).js b/tests/baselines/reference/ES5For-ofTypeCheck10(target=es2015).js new file mode 100644 index 0000000000000..97194c0d63a90 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck10(target=es2015).js @@ -0,0 +1,32 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts] //// + +//// [ES5For-ofTypeCheck10.ts] +// In ES3/5, you cannot for...of over an arbitrary iterable. +class MyStringIterator { + next() { + return { + done: true, + value: "" + }; + } + [Symbol.iterator]() { + return this; + } +} + +for (var v of new MyStringIterator) { } + +//// [ES5For-ofTypeCheck10.js] +// In ES3/5, you cannot for...of over an arbitrary iterable. +class MyStringIterator { + next() { + return { + done: true, + value: "" + }; + } + [Symbol.iterator]() { + return this; + } +} +for (var v of new MyStringIterator) { } diff --git a/tests/baselines/reference/ES5For-ofTypeCheck10.symbols b/tests/baselines/reference/ES5For-ofTypeCheck10(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck10.symbols rename to tests/baselines/reference/ES5For-ofTypeCheck10(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-ofTypeCheck10(target=es2015).types b/tests/baselines/reference/ES5For-ofTypeCheck10(target=es2015).types new file mode 100644 index 0000000000000..fcc821aced51f --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck10(target=es2015).types @@ -0,0 +1,54 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts] //// + +=== ES5For-ofTypeCheck10.ts === +// In ES3/5, you cannot for...of over an arbitrary iterable. +class MyStringIterator { +>MyStringIterator : MyStringIterator +> : ^^^^^^^^^^^^^^^^ + + next() { +>next : () => { done: boolean; value: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + return { +>{ done: true, value: "" } : { done: boolean; value: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + done: true, +>done : boolean +> : ^^^^^^^ +>true : true +> : ^^^^ + + value: "" +>value : string +> : ^^^^^^ +>"" : "" +> : ^^ + + }; + } + [Symbol.iterator]() { +>[Symbol.iterator] : () => this +> : ^^^^^^^^^^ +>Symbol.iterator : unique symbol +> : ^^^^^^^^^^^^^ +>Symbol : SymbolConstructor +> : ^^^^^^^^^^^^^^^^^ +>iterator : unique symbol +> : ^^^^^^^^^^^^^ + + return this; +>this : this +> : ^^^^ + } +} + +for (var v of new MyStringIterator) { } +>v : string +> : ^^^^^^ +>new MyStringIterator : MyStringIterator +> : ^^^^^^^^^^^^^^^^ +>MyStringIterator : typeof MyStringIterator +> : ^^^^^^^^^^^^^^^^^^^^^^^ + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck10.errors.txt b/tests/baselines/reference/ES5For-ofTypeCheck10(target=es5).errors.txt similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck10.errors.txt rename to tests/baselines/reference/ES5For-ofTypeCheck10(target=es5).errors.txt diff --git a/tests/baselines/reference/ES5For-ofTypeCheck10.js b/tests/baselines/reference/ES5For-ofTypeCheck10(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck10.js rename to tests/baselines/reference/ES5For-ofTypeCheck10(target=es5).js diff --git a/tests/baselines/reference/ES5For-ofTypeCheck10(target=es5).symbols b/tests/baselines/reference/ES5For-ofTypeCheck10(target=es5).symbols new file mode 100644 index 0000000000000..c0604bc7923fc --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck10(target=es5).symbols @@ -0,0 +1,34 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts] //// + +=== ES5For-ofTypeCheck10.ts === +// In ES3/5, you cannot for...of over an arbitrary iterable. +class MyStringIterator { +>MyStringIterator : Symbol(MyStringIterator, Decl(ES5For-ofTypeCheck10.ts, 0, 0)) + + next() { +>next : Symbol(MyStringIterator.next, Decl(ES5For-ofTypeCheck10.ts, 1, 24)) + + return { + done: true, +>done : Symbol(done, Decl(ES5For-ofTypeCheck10.ts, 3, 16)) + + value: "" +>value : Symbol(value, Decl(ES5For-ofTypeCheck10.ts, 4, 23)) + + }; + } + [Symbol.iterator]() { +>[Symbol.iterator] : Symbol(MyStringIterator[Symbol.iterator], Decl(ES5For-ofTypeCheck10.ts, 7, 5)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) + + return this; +>this : Symbol(MyStringIterator, Decl(ES5For-ofTypeCheck10.ts, 0, 0)) + } +} + +for (var v of new MyStringIterator) { } +>v : Symbol(v, Decl(ES5For-ofTypeCheck10.ts, 13, 8)) +>MyStringIterator : Symbol(MyStringIterator, Decl(ES5For-ofTypeCheck10.ts, 0, 0)) + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck10.types b/tests/baselines/reference/ES5For-ofTypeCheck10(target=es5).types similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck10.types rename to tests/baselines/reference/ES5For-ofTypeCheck10(target=es5).types diff --git a/tests/baselines/reference/ES5For-ofTypeCheck11.errors.txt b/tests/baselines/reference/ES5For-ofTypeCheck11(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck11.errors.txt rename to tests/baselines/reference/ES5For-ofTypeCheck11(target=es2015).errors.txt diff --git a/tests/baselines/reference/ES5For-ofTypeCheck11(target=es2015).js b/tests/baselines/reference/ES5For-ofTypeCheck11(target=es2015).js new file mode 100644 index 0000000000000..f229a61c8f484 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck11(target=es2015).js @@ -0,0 +1,10 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck11.ts] //// + +//// [ES5For-ofTypeCheck11.ts] +declare var union: string | number[]; +var v: string; +for (v of union) { } + +//// [ES5For-ofTypeCheck11.js] +var v; +for (v of union) { } diff --git a/tests/baselines/reference/ES5For-ofTypeCheck11.symbols b/tests/baselines/reference/ES5For-ofTypeCheck11(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck11.symbols rename to tests/baselines/reference/ES5For-ofTypeCheck11(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-ofTypeCheck11.types b/tests/baselines/reference/ES5For-ofTypeCheck11(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck11.types rename to tests/baselines/reference/ES5For-ofTypeCheck11(target=es2015).types diff --git a/tests/baselines/reference/ES5For-ofTypeCheck11(target=es5).errors.txt b/tests/baselines/reference/ES5For-ofTypeCheck11(target=es5).errors.txt new file mode 100644 index 0000000000000..4ccd0dc727574 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck11(target=es5).errors.txt @@ -0,0 +1,11 @@ +ES5For-ofTypeCheck11.ts(3,6): error TS2322: Type 'string | number' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. + + +==== ES5For-ofTypeCheck11.ts (1 errors) ==== + declare var union: string | number[]; + var v: string; + for (v of union) { } + ~ +!!! error TS2322: Type 'string | number' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-ofTypeCheck11.js b/tests/baselines/reference/ES5For-ofTypeCheck11(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck11.js rename to tests/baselines/reference/ES5For-ofTypeCheck11(target=es5).js diff --git a/tests/baselines/reference/ES5For-ofTypeCheck11(target=es5).symbols b/tests/baselines/reference/ES5For-ofTypeCheck11(target=es5).symbols new file mode 100644 index 0000000000000..cfdf8ac0287c6 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck11(target=es5).symbols @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck11.ts] //// + +=== ES5For-ofTypeCheck11.ts === +declare var union: string | number[]; +>union : Symbol(union, Decl(ES5For-ofTypeCheck11.ts, 0, 11)) + +var v: string; +>v : Symbol(v, Decl(ES5For-ofTypeCheck11.ts, 1, 3)) + +for (v of union) { } +>v : Symbol(v, Decl(ES5For-ofTypeCheck11.ts, 1, 3)) +>union : Symbol(union, Decl(ES5For-ofTypeCheck11.ts, 0, 11)) + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck11(target=es5).types b/tests/baselines/reference/ES5For-ofTypeCheck11(target=es5).types new file mode 100644 index 0000000000000..f1551d5b1b1cd --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck11(target=es5).types @@ -0,0 +1,17 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck11.ts] //// + +=== ES5For-ofTypeCheck11.ts === +declare var union: string | number[]; +>union : string | number[] +> : ^^^^^^^^^^^^^^^^^ + +var v: string; +>v : string +> : ^^^^^^ + +for (v of union) { } +>v : string +> : ^^^^^^ +>union : string | number[] +> : ^^^^^^^^^^^^^^^^^ + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck12(target=es2015).errors.txt b/tests/baselines/reference/ES5For-ofTypeCheck12(target=es2015).errors.txt new file mode 100644 index 0000000000000..1a303d394466c --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck12(target=es2015).errors.txt @@ -0,0 +1,7 @@ +ES5For-ofTypeCheck12.ts(1,17): error TS2488: Type '0' must have a '[Symbol.iterator]()' method that returns an iterator. + + +==== ES5For-ofTypeCheck12.ts (1 errors) ==== + for (const v of 0) { } + ~ +!!! error TS2488: Type '0' must have a '[Symbol.iterator]()' method that returns an iterator. \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-ofTypeCheck12(target=es2015).js b/tests/baselines/reference/ES5For-ofTypeCheck12(target=es2015).js new file mode 100644 index 0000000000000..08ef9bfaddc82 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck12(target=es2015).js @@ -0,0 +1,7 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck12.ts] //// + +//// [ES5For-ofTypeCheck12.ts] +for (const v of 0) { } + +//// [ES5For-ofTypeCheck12.js] +for (const v of 0) { } diff --git a/tests/baselines/reference/ES5For-ofTypeCheck12.symbols b/tests/baselines/reference/ES5For-ofTypeCheck12(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck12.symbols rename to tests/baselines/reference/ES5For-ofTypeCheck12(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-ofTypeCheck12.types b/tests/baselines/reference/ES5For-ofTypeCheck12(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck12.types rename to tests/baselines/reference/ES5For-ofTypeCheck12(target=es2015).types diff --git a/tests/baselines/reference/ES5For-ofTypeCheck12.errors.txt b/tests/baselines/reference/ES5For-ofTypeCheck12(target=es5).errors.txt similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck12.errors.txt rename to tests/baselines/reference/ES5For-ofTypeCheck12(target=es5).errors.txt diff --git a/tests/baselines/reference/ES5For-ofTypeCheck12.js b/tests/baselines/reference/ES5For-ofTypeCheck12(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck12.js rename to tests/baselines/reference/ES5For-ofTypeCheck12(target=es5).js diff --git a/tests/baselines/reference/ES5For-ofTypeCheck12(target=es5).symbols b/tests/baselines/reference/ES5For-ofTypeCheck12(target=es5).symbols new file mode 100644 index 0000000000000..3f16282e32e29 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck12(target=es5).symbols @@ -0,0 +1,6 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck12.ts] //// + +=== ES5For-ofTypeCheck12.ts === +for (const v of 0) { } +>v : Symbol(v, Decl(ES5For-ofTypeCheck12.ts, 0, 10)) + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck12(target=es5).types b/tests/baselines/reference/ES5For-ofTypeCheck12(target=es5).types new file mode 100644 index 0000000000000..59a63f12ec22d --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck12(target=es5).types @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck12.ts] //// + +=== ES5For-ofTypeCheck12.ts === +for (const v of 0) { } +>v : any +> : ^^^ +>0 : 0 +> : ^ + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck13(target=es2015).js b/tests/baselines/reference/ES5For-ofTypeCheck13(target=es2015).js new file mode 100644 index 0000000000000..a87f0b48390d4 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck13(target=es2015).js @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck13.ts] //// + +//// [ES5For-ofTypeCheck13.ts] +const strSet: Set = new Set() +strSet.add('Hello') +strSet.add('World') +for (const str of strSet) { } + +//// [ES5For-ofTypeCheck13.js] +const strSet = new Set(); +strSet.add('Hello'); +strSet.add('World'); +for (const str of strSet) { } diff --git a/tests/baselines/reference/ES5For-ofTypeCheck13.symbols b/tests/baselines/reference/ES5For-ofTypeCheck13(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck13.symbols rename to tests/baselines/reference/ES5For-ofTypeCheck13(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-ofTypeCheck13(target=es2015).types b/tests/baselines/reference/ES5For-ofTypeCheck13(target=es2015).types new file mode 100644 index 0000000000000..7a115a43f980e --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck13(target=es2015).types @@ -0,0 +1,41 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck13.ts] //// + +=== ES5For-ofTypeCheck13.ts === +const strSet: Set = new Set() +>strSet : Set +> : ^^^^^^^^^^^ +>new Set() : Set +> : ^^^^^^^^^^^ +>Set : SetConstructor +> : ^^^^^^^^^^^^^^ + +strSet.add('Hello') +>strSet.add('Hello') : Set +> : ^^^^^^^^^^^ +>strSet.add : (value: string) => Set +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^ +>strSet : Set +> : ^^^^^^^^^^^ +>add : (value: string) => Set +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^ +>'Hello' : "Hello" +> : ^^^^^^^ + +strSet.add('World') +>strSet.add('World') : Set +> : ^^^^^^^^^^^ +>strSet.add : (value: string) => Set +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^ +>strSet : Set +> : ^^^^^^^^^^^ +>add : (value: string) => Set +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^ +>'World' : "World" +> : ^^^^^^^ + +for (const str of strSet) { } +>str : string +> : ^^^^^^ +>strSet : Set +> : ^^^^^^^^^^^ + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck13.errors.txt b/tests/baselines/reference/ES5For-ofTypeCheck13(target=es5).errors.txt similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck13.errors.txt rename to tests/baselines/reference/ES5For-ofTypeCheck13(target=es5).errors.txt diff --git a/tests/baselines/reference/ES5For-ofTypeCheck13.js b/tests/baselines/reference/ES5For-ofTypeCheck13(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck13.js rename to tests/baselines/reference/ES5For-ofTypeCheck13(target=es5).js diff --git a/tests/baselines/reference/ES5For-ofTypeCheck13(target=es5).symbols b/tests/baselines/reference/ES5For-ofTypeCheck13(target=es5).symbols new file mode 100644 index 0000000000000..4c7557d45d2ab --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck13(target=es5).symbols @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck13.ts] //// + +=== ES5For-ofTypeCheck13.ts === +const strSet: Set = new Set() +>strSet : Symbol(strSet, Decl(ES5For-ofTypeCheck13.ts, 0, 5)) +>Set : Symbol(Set, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Set : Symbol(Set, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +strSet.add('Hello') +>strSet.add : Symbol(Set.add, Decl(lib.es2015.collection.d.ts, --, --)) +>strSet : Symbol(strSet, Decl(ES5For-ofTypeCheck13.ts, 0, 5)) +>add : Symbol(Set.add, Decl(lib.es2015.collection.d.ts, --, --)) + +strSet.add('World') +>strSet.add : Symbol(Set.add, Decl(lib.es2015.collection.d.ts, --, --)) +>strSet : Symbol(strSet, Decl(ES5For-ofTypeCheck13.ts, 0, 5)) +>add : Symbol(Set.add, Decl(lib.es2015.collection.d.ts, --, --)) + +for (const str of strSet) { } +>str : Symbol(str, Decl(ES5For-ofTypeCheck13.ts, 3, 10)) +>strSet : Symbol(strSet, Decl(ES5For-ofTypeCheck13.ts, 0, 5)) + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck13.types b/tests/baselines/reference/ES5For-ofTypeCheck13(target=es5).types similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck13.types rename to tests/baselines/reference/ES5For-ofTypeCheck13(target=es5).types diff --git a/tests/baselines/reference/ES5For-ofTypeCheck14(target=es2015).js b/tests/baselines/reference/ES5For-ofTypeCheck14(target=es2015).js new file mode 100644 index 0000000000000..1bfb17228f4fe --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck14(target=es2015).js @@ -0,0 +1,8 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck14.ts] //// + +//// [ES5For-ofTypeCheck14.ts] +declare var union: string | Set +for (const e of union) { } + +//// [ES5For-ofTypeCheck14.js] +for (const e of union) { } diff --git a/tests/baselines/reference/ES5For-ofTypeCheck14.symbols b/tests/baselines/reference/ES5For-ofTypeCheck14(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck14.symbols rename to tests/baselines/reference/ES5For-ofTypeCheck14(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-ofTypeCheck14(target=es2015).types b/tests/baselines/reference/ES5For-ofTypeCheck14(target=es2015).types new file mode 100644 index 0000000000000..ee9946a831d94 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck14(target=es2015).types @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck14.ts] //// + +=== ES5For-ofTypeCheck14.ts === +declare var union: string | Set +>union : string | Set +> : ^^^^^^^^^^^^^^^^^^^^ + +for (const e of union) { } +>e : string | number +> : ^^^^^^^^^^^^^^^ +>union : string | Set +> : ^^^^^^^^^^^^^^^^^^^^ + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck14.errors.txt b/tests/baselines/reference/ES5For-ofTypeCheck14(target=es5).errors.txt similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck14.errors.txt rename to tests/baselines/reference/ES5For-ofTypeCheck14(target=es5).errors.txt diff --git a/tests/baselines/reference/ES5For-ofTypeCheck14.js b/tests/baselines/reference/ES5For-ofTypeCheck14(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck14.js rename to tests/baselines/reference/ES5For-ofTypeCheck14(target=es5).js diff --git a/tests/baselines/reference/ES5For-ofTypeCheck14(target=es5).symbols b/tests/baselines/reference/ES5For-ofTypeCheck14(target=es5).symbols new file mode 100644 index 0000000000000..d964cb61ed992 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck14(target=es5).symbols @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck14.ts] //// + +=== ES5For-ofTypeCheck14.ts === +declare var union: string | Set +>union : Symbol(union, Decl(ES5For-ofTypeCheck14.ts, 0, 11)) +>Set : Symbol(Set, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +for (const e of union) { } +>e : Symbol(e, Decl(ES5For-ofTypeCheck14.ts, 1, 10)) +>union : Symbol(union, Decl(ES5For-ofTypeCheck14.ts, 0, 11)) + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck14.types b/tests/baselines/reference/ES5For-ofTypeCheck14(target=es5).types similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck14.types rename to tests/baselines/reference/ES5For-ofTypeCheck14(target=es5).types diff --git a/tests/baselines/reference/ES5For-ofTypeCheck2(target=es2015).js b/tests/baselines/reference/ES5For-ofTypeCheck2(target=es2015).js new file mode 100644 index 0000000000000..64e31173c7eb0 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck2(target=es2015).js @@ -0,0 +1,7 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck2.ts] //// + +//// [ES5For-ofTypeCheck2.ts] +for (var v of [true]) { } + +//// [ES5For-ofTypeCheck2.js] +for (var v of [true]) { } diff --git a/tests/baselines/reference/ES5For-ofTypeCheck2.symbols b/tests/baselines/reference/ES5For-ofTypeCheck2(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck2.symbols rename to tests/baselines/reference/ES5For-ofTypeCheck2(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-ofTypeCheck2.types b/tests/baselines/reference/ES5For-ofTypeCheck2(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck2.types rename to tests/baselines/reference/ES5For-ofTypeCheck2(target=es2015).types diff --git a/tests/baselines/reference/ES5For-ofTypeCheck2.js b/tests/baselines/reference/ES5For-ofTypeCheck2(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck2.js rename to tests/baselines/reference/ES5For-ofTypeCheck2(target=es5).js diff --git a/tests/baselines/reference/ES5For-ofTypeCheck2(target=es5).symbols b/tests/baselines/reference/ES5For-ofTypeCheck2(target=es5).symbols new file mode 100644 index 0000000000000..ba1baa606b955 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck2(target=es5).symbols @@ -0,0 +1,6 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck2.ts] //// + +=== ES5For-ofTypeCheck2.ts === +for (var v of [true]) { } +>v : Symbol(v, Decl(ES5For-ofTypeCheck2.ts, 0, 8)) + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck2(target=es5).types b/tests/baselines/reference/ES5For-ofTypeCheck2(target=es5).types new file mode 100644 index 0000000000000..9de441f7808c3 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck2(target=es5).types @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck2.ts] //// + +=== ES5For-ofTypeCheck2.ts === +for (var v of [true]) { } +>v : boolean +> : ^^^^^^^ +>[true] : boolean[] +> : ^^^^^^^^^ +>true : true +> : ^^^^ + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck3(target=es2015).js b/tests/baselines/reference/ES5For-ofTypeCheck3(target=es2015).js new file mode 100644 index 0000000000000..9d5ed68694b1a --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck3(target=es2015).js @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck3.ts] //// + +//// [ES5For-ofTypeCheck3.ts] +var tuple: [string, number] = ["", 0]; +for (var v of tuple) { } + +//// [ES5For-ofTypeCheck3.js] +var tuple = ["", 0]; +for (var v of tuple) { } diff --git a/tests/baselines/reference/ES5For-ofTypeCheck3.symbols b/tests/baselines/reference/ES5For-ofTypeCheck3(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck3.symbols rename to tests/baselines/reference/ES5For-ofTypeCheck3(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-ofTypeCheck3.types b/tests/baselines/reference/ES5For-ofTypeCheck3(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck3.types rename to tests/baselines/reference/ES5For-ofTypeCheck3(target=es2015).types diff --git a/tests/baselines/reference/ES5For-ofTypeCheck3.js b/tests/baselines/reference/ES5For-ofTypeCheck3(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck3.js rename to tests/baselines/reference/ES5For-ofTypeCheck3(target=es5).js diff --git a/tests/baselines/reference/ES5For-ofTypeCheck3(target=es5).symbols b/tests/baselines/reference/ES5For-ofTypeCheck3(target=es5).symbols new file mode 100644 index 0000000000000..269866024e3e4 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck3(target=es5).symbols @@ -0,0 +1,10 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck3.ts] //// + +=== ES5For-ofTypeCheck3.ts === +var tuple: [string, number] = ["", 0]; +>tuple : Symbol(tuple, Decl(ES5For-ofTypeCheck3.ts, 0, 3)) + +for (var v of tuple) { } +>v : Symbol(v, Decl(ES5For-ofTypeCheck3.ts, 1, 8)) +>tuple : Symbol(tuple, Decl(ES5For-ofTypeCheck3.ts, 0, 3)) + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck3(target=es5).types b/tests/baselines/reference/ES5For-ofTypeCheck3(target=es5).types new file mode 100644 index 0000000000000..be27f742e17de --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck3(target=es5).types @@ -0,0 +1,19 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck3.ts] //// + +=== ES5For-ofTypeCheck3.ts === +var tuple: [string, number] = ["", 0]; +>tuple : [string, number] +> : ^^^^^^^^^^^^^^^^ +>["", 0] : [string, number] +> : ^^^^^^^^^^^^^^^^ +>"" : "" +> : ^^ +>0 : 0 +> : ^ + +for (var v of tuple) { } +>v : string | number +> : ^^^^^^^^^^^^^^^ +>tuple : [string, number] +> : ^^^^^^^^^^^^^^^^ + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck4(target=es2015).js b/tests/baselines/reference/ES5For-ofTypeCheck4(target=es2015).js new file mode 100644 index 0000000000000..0551df0328a21 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck4(target=es2015).js @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck4.ts] //// + +//// [ES5For-ofTypeCheck4.ts] +var union: string | string[]; +for (const v of union) { } + +//// [ES5For-ofTypeCheck4.js] +var union; +for (const v of union) { } diff --git a/tests/baselines/reference/ES5For-ofTypeCheck4.symbols b/tests/baselines/reference/ES5For-ofTypeCheck4(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck4.symbols rename to tests/baselines/reference/ES5For-ofTypeCheck4(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-ofTypeCheck4.types b/tests/baselines/reference/ES5For-ofTypeCheck4(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck4.types rename to tests/baselines/reference/ES5For-ofTypeCheck4(target=es2015).types diff --git a/tests/baselines/reference/ES5For-ofTypeCheck4.js b/tests/baselines/reference/ES5For-ofTypeCheck4(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck4.js rename to tests/baselines/reference/ES5For-ofTypeCheck4(target=es5).js diff --git a/tests/baselines/reference/ES5For-ofTypeCheck4(target=es5).symbols b/tests/baselines/reference/ES5For-ofTypeCheck4(target=es5).symbols new file mode 100644 index 0000000000000..f71743bec5408 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck4(target=es5).symbols @@ -0,0 +1,10 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck4.ts] //// + +=== ES5For-ofTypeCheck4.ts === +var union: string | string[]; +>union : Symbol(union, Decl(ES5For-ofTypeCheck4.ts, 0, 3)) + +for (const v of union) { } +>v : Symbol(v, Decl(ES5For-ofTypeCheck4.ts, 1, 10)) +>union : Symbol(union, Decl(ES5For-ofTypeCheck4.ts, 0, 3)) + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck4(target=es5).types b/tests/baselines/reference/ES5For-ofTypeCheck4(target=es5).types new file mode 100644 index 0000000000000..55620f0e041cd --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck4(target=es5).types @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck4.ts] //// + +=== ES5For-ofTypeCheck4.ts === +var union: string | string[]; +>union : string | string[] +> : ^^^^^^^^^^^^^^^^^ + +for (const v of union) { } +>v : string +> : ^^^^^^ +>union : string | string[] +> : ^^^^^^^^^^^^^^^^^ + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck5(target=es2015).js b/tests/baselines/reference/ES5For-ofTypeCheck5(target=es2015).js new file mode 100644 index 0000000000000..8b99c7eaffef1 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck5(target=es2015).js @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck5.ts] //// + +//// [ES5For-ofTypeCheck5.ts] +var union: string | number[]; +for (var v of union) { } + +//// [ES5For-ofTypeCheck5.js] +var union; +for (var v of union) { } diff --git a/tests/baselines/reference/ES5For-ofTypeCheck5.symbols b/tests/baselines/reference/ES5For-ofTypeCheck5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck5.symbols rename to tests/baselines/reference/ES5For-ofTypeCheck5(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-ofTypeCheck5.types b/tests/baselines/reference/ES5For-ofTypeCheck5(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck5.types rename to tests/baselines/reference/ES5For-ofTypeCheck5(target=es2015).types diff --git a/tests/baselines/reference/ES5For-ofTypeCheck5.js b/tests/baselines/reference/ES5For-ofTypeCheck5(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck5.js rename to tests/baselines/reference/ES5For-ofTypeCheck5(target=es5).js diff --git a/tests/baselines/reference/ES5For-ofTypeCheck5(target=es5).symbols b/tests/baselines/reference/ES5For-ofTypeCheck5(target=es5).symbols new file mode 100644 index 0000000000000..f2466f09cb132 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck5(target=es5).symbols @@ -0,0 +1,10 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck5.ts] //// + +=== ES5For-ofTypeCheck5.ts === +var union: string | number[]; +>union : Symbol(union, Decl(ES5For-ofTypeCheck5.ts, 0, 3)) + +for (var v of union) { } +>v : Symbol(v, Decl(ES5For-ofTypeCheck5.ts, 1, 8)) +>union : Symbol(union, Decl(ES5For-ofTypeCheck5.ts, 0, 3)) + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck5(target=es5).types b/tests/baselines/reference/ES5For-ofTypeCheck5(target=es5).types new file mode 100644 index 0000000000000..ca816a6683f85 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck5(target=es5).types @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck5.ts] //// + +=== ES5For-ofTypeCheck5.ts === +var union: string | number[]; +>union : string | number[] +> : ^^^^^^^^^^^^^^^^^ + +for (var v of union) { } +>v : string | number +> : ^^^^^^^^^^^^^^^ +>union : string | number[] +> : ^^^^^^^^^^^^^^^^^ + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck6(target=es2015).js b/tests/baselines/reference/ES5For-ofTypeCheck6(target=es2015).js new file mode 100644 index 0000000000000..508f9d7e1c5b4 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck6(target=es2015).js @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck6.ts] //// + +//// [ES5For-ofTypeCheck6.ts] +var union: string[] | number[]; +for (var v of union) { } + +//// [ES5For-ofTypeCheck6.js] +var union; +for (var v of union) { } diff --git a/tests/baselines/reference/ES5For-ofTypeCheck6.symbols b/tests/baselines/reference/ES5For-ofTypeCheck6(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck6.symbols rename to tests/baselines/reference/ES5For-ofTypeCheck6(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-ofTypeCheck6.types b/tests/baselines/reference/ES5For-ofTypeCheck6(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck6.types rename to tests/baselines/reference/ES5For-ofTypeCheck6(target=es2015).types diff --git a/tests/baselines/reference/ES5For-ofTypeCheck6.js b/tests/baselines/reference/ES5For-ofTypeCheck6(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck6.js rename to tests/baselines/reference/ES5For-ofTypeCheck6(target=es5).js diff --git a/tests/baselines/reference/ES5For-ofTypeCheck6(target=es5).symbols b/tests/baselines/reference/ES5For-ofTypeCheck6(target=es5).symbols new file mode 100644 index 0000000000000..c69262d78f137 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck6(target=es5).symbols @@ -0,0 +1,10 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck6.ts] //// + +=== ES5For-ofTypeCheck6.ts === +var union: string[] | number[]; +>union : Symbol(union, Decl(ES5For-ofTypeCheck6.ts, 0, 3)) + +for (var v of union) { } +>v : Symbol(v, Decl(ES5For-ofTypeCheck6.ts, 1, 8)) +>union : Symbol(union, Decl(ES5For-ofTypeCheck6.ts, 0, 3)) + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck6(target=es5).types b/tests/baselines/reference/ES5For-ofTypeCheck6(target=es5).types new file mode 100644 index 0000000000000..94ee13411ddbe --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck6(target=es5).types @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck6.ts] //// + +=== ES5For-ofTypeCheck6.ts === +var union: string[] | number[]; +>union : string[] | number[] +> : ^^^^^^^^^^^^^^^^^^^ + +for (var v of union) { } +>v : string | number +> : ^^^^^^^^^^^^^^^ +>union : string[] | number[] +> : ^^^^^^^^^^^^^^^^^^^ + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck7(target=es2015).errors.txt b/tests/baselines/reference/ES5For-ofTypeCheck7(target=es2015).errors.txt new file mode 100644 index 0000000000000..a421c486b33e7 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck7(target=es2015).errors.txt @@ -0,0 +1,8 @@ +ES5For-ofTypeCheck7.ts(2,15): error TS2488: Type 'string | number' must have a '[Symbol.iterator]()' method that returns an iterator. + + +==== ES5For-ofTypeCheck7.ts (1 errors) ==== + declare var union: string | number; + for (var v of union) { } + ~~~~~ +!!! error TS2488: Type 'string | number' must have a '[Symbol.iterator]()' method that returns an iterator. \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-ofTypeCheck7(target=es2015).js b/tests/baselines/reference/ES5For-ofTypeCheck7(target=es2015).js new file mode 100644 index 0000000000000..61ba335fa56d1 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck7(target=es2015).js @@ -0,0 +1,8 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck7.ts] //// + +//// [ES5For-ofTypeCheck7.ts] +declare var union: string | number; +for (var v of union) { } + +//// [ES5For-ofTypeCheck7.js] +for (var v of union) { } diff --git a/tests/baselines/reference/ES5For-ofTypeCheck7.symbols b/tests/baselines/reference/ES5For-ofTypeCheck7(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck7.symbols rename to tests/baselines/reference/ES5For-ofTypeCheck7(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-ofTypeCheck7(target=es2015).types b/tests/baselines/reference/ES5For-ofTypeCheck7(target=es2015).types new file mode 100644 index 0000000000000..d8d8eadf541e6 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck7(target=es2015).types @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck7.ts] //// + +=== ES5For-ofTypeCheck7.ts === +declare var union: string | number; +>union : string | number +> : ^^^^^^^^^^^^^^^ + +for (var v of union) { } +>v : any +> : ^^^ +>union : string | number +> : ^^^^^^^^^^^^^^^ + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck7.errors.txt b/tests/baselines/reference/ES5For-ofTypeCheck7(target=es5).errors.txt similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck7.errors.txt rename to tests/baselines/reference/ES5For-ofTypeCheck7(target=es5).errors.txt diff --git a/tests/baselines/reference/ES5For-ofTypeCheck7.js b/tests/baselines/reference/ES5For-ofTypeCheck7(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck7.js rename to tests/baselines/reference/ES5For-ofTypeCheck7(target=es5).js diff --git a/tests/baselines/reference/ES5For-ofTypeCheck7(target=es5).symbols b/tests/baselines/reference/ES5For-ofTypeCheck7(target=es5).symbols new file mode 100644 index 0000000000000..68dbdf6f50db5 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck7(target=es5).symbols @@ -0,0 +1,10 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck7.ts] //// + +=== ES5For-ofTypeCheck7.ts === +declare var union: string | number; +>union : Symbol(union, Decl(ES5For-ofTypeCheck7.ts, 0, 11)) + +for (var v of union) { } +>v : Symbol(v, Decl(ES5For-ofTypeCheck7.ts, 1, 8)) +>union : Symbol(union, Decl(ES5For-ofTypeCheck7.ts, 0, 11)) + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck7.types b/tests/baselines/reference/ES5For-ofTypeCheck7(target=es5).types similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck7.types rename to tests/baselines/reference/ES5For-ofTypeCheck7(target=es5).types diff --git a/tests/baselines/reference/ES5For-ofTypeCheck8.errors.txt b/tests/baselines/reference/ES5For-ofTypeCheck8(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck8.errors.txt rename to tests/baselines/reference/ES5For-ofTypeCheck8(target=es2015).errors.txt diff --git a/tests/baselines/reference/ES5For-ofTypeCheck8(target=es2015).js b/tests/baselines/reference/ES5For-ofTypeCheck8(target=es2015).js new file mode 100644 index 0000000000000..9650d247a14e4 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck8(target=es2015).js @@ -0,0 +1,10 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck8.ts] //// + +//// [ES5For-ofTypeCheck8.ts] +declare var union: string | string[]| number[]| symbol[]; +var v: symbol; +for (v of union) { } + +//// [ES5For-ofTypeCheck8.js] +var v; +for (v of union) { } diff --git a/tests/baselines/reference/ES5For-ofTypeCheck8.symbols b/tests/baselines/reference/ES5For-ofTypeCheck8(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck8.symbols rename to tests/baselines/reference/ES5For-ofTypeCheck8(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-ofTypeCheck8.types b/tests/baselines/reference/ES5For-ofTypeCheck8(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck8.types rename to tests/baselines/reference/ES5For-ofTypeCheck8(target=es2015).types diff --git a/tests/baselines/reference/ES5For-ofTypeCheck8(target=es5).errors.txt b/tests/baselines/reference/ES5For-ofTypeCheck8(target=es5).errors.txt new file mode 100644 index 0000000000000..3f82df8f45f66 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck8(target=es5).errors.txt @@ -0,0 +1,11 @@ +ES5For-ofTypeCheck8.ts(3,6): error TS2322: Type 'string | number | symbol' is not assignable to type 'symbol'. + Type 'string' is not assignable to type 'symbol'. + + +==== ES5For-ofTypeCheck8.ts (1 errors) ==== + declare var union: string | string[]| number[]| symbol[]; + var v: symbol; + for (v of union) { } + ~ +!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'symbol'. +!!! error TS2322: Type 'string' is not assignable to type 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-ofTypeCheck8.js b/tests/baselines/reference/ES5For-ofTypeCheck8(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck8.js rename to tests/baselines/reference/ES5For-ofTypeCheck8(target=es5).js diff --git a/tests/baselines/reference/ES5For-ofTypeCheck8(target=es5).symbols b/tests/baselines/reference/ES5For-ofTypeCheck8(target=es5).symbols new file mode 100644 index 0000000000000..faf229923b679 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck8(target=es5).symbols @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck8.ts] //// + +=== ES5For-ofTypeCheck8.ts === +declare var union: string | string[]| number[]| symbol[]; +>union : Symbol(union, Decl(ES5For-ofTypeCheck8.ts, 0, 11)) + +var v: symbol; +>v : Symbol(v, Decl(ES5For-ofTypeCheck8.ts, 1, 3)) + +for (v of union) { } +>v : Symbol(v, Decl(ES5For-ofTypeCheck8.ts, 1, 3)) +>union : Symbol(union, Decl(ES5For-ofTypeCheck8.ts, 0, 11)) + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck8(target=es5).types b/tests/baselines/reference/ES5For-ofTypeCheck8(target=es5).types new file mode 100644 index 0000000000000..4616a6fe6bae9 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck8(target=es5).types @@ -0,0 +1,17 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck8.ts] //// + +=== ES5For-ofTypeCheck8.ts === +declare var union: string | string[]| number[]| symbol[]; +>union : string | string[] | number[] | symbol[] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +var v: symbol; +>v : symbol +> : ^^^^^^ + +for (v of union) { } +>v : symbol +> : ^^^^^^ +>union : string | string[] | number[] | symbol[] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck9(target=es2015).errors.txt b/tests/baselines/reference/ES5For-ofTypeCheck9(target=es2015).errors.txt new file mode 100644 index 0000000000000..57f902cf30689 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck9(target=es2015).errors.txt @@ -0,0 +1,8 @@ +ES5For-ofTypeCheck9.ts(2,15): error TS2488: Type 'string | number | symbol | string[]' must have a '[Symbol.iterator]()' method that returns an iterator. + + +==== ES5For-ofTypeCheck9.ts (1 errors) ==== + declare var union: string | string[] | number | symbol; + for (let v of union) { } + ~~~~~ +!!! error TS2488: Type 'string | number | symbol | string[]' must have a '[Symbol.iterator]()' method that returns an iterator. \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-ofTypeCheck9(target=es2015).js b/tests/baselines/reference/ES5For-ofTypeCheck9(target=es2015).js new file mode 100644 index 0000000000000..2b614ef7a75be --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck9(target=es2015).js @@ -0,0 +1,8 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck9.ts] //// + +//// [ES5For-ofTypeCheck9.ts] +declare var union: string | string[] | number | symbol; +for (let v of union) { } + +//// [ES5For-ofTypeCheck9.js] +for (let v of union) { } diff --git a/tests/baselines/reference/ES5For-ofTypeCheck9.symbols b/tests/baselines/reference/ES5For-ofTypeCheck9(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck9.symbols rename to tests/baselines/reference/ES5For-ofTypeCheck9(target=es2015).symbols diff --git a/tests/baselines/reference/ES5For-ofTypeCheck9(target=es2015).types b/tests/baselines/reference/ES5For-ofTypeCheck9(target=es2015).types new file mode 100644 index 0000000000000..df9ceb0d13846 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck9(target=es2015).types @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck9.ts] //// + +=== ES5For-ofTypeCheck9.ts === +declare var union: string | string[] | number | symbol; +>union : string | number | symbol | string[] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +for (let v of union) { } +>v : any +> : ^^^ +>union : string | number | symbol | string[] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck9.errors.txt b/tests/baselines/reference/ES5For-ofTypeCheck9(target=es5).errors.txt similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck9.errors.txt rename to tests/baselines/reference/ES5For-ofTypeCheck9(target=es5).errors.txt diff --git a/tests/baselines/reference/ES5For-ofTypeCheck9.js b/tests/baselines/reference/ES5For-ofTypeCheck9(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck9.js rename to tests/baselines/reference/ES5For-ofTypeCheck9(target=es5).js diff --git a/tests/baselines/reference/ES5For-ofTypeCheck9(target=es5).symbols b/tests/baselines/reference/ES5For-ofTypeCheck9(target=es5).symbols new file mode 100644 index 0000000000000..8bcf34bf7682c --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck9(target=es5).symbols @@ -0,0 +1,10 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck9.ts] //// + +=== ES5For-ofTypeCheck9.ts === +declare var union: string | string[] | number | symbol; +>union : Symbol(union, Decl(ES5For-ofTypeCheck9.ts, 0, 11)) + +for (let v of union) { } +>v : Symbol(v, Decl(ES5For-ofTypeCheck9.ts, 1, 8)) +>union : Symbol(union, Decl(ES5For-ofTypeCheck9.ts, 0, 11)) + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck9.types b/tests/baselines/reference/ES5For-ofTypeCheck9(target=es5).types similarity index 100% rename from tests/baselines/reference/ES5For-ofTypeCheck9.types rename to tests/baselines/reference/ES5For-ofTypeCheck9(target=es5).types diff --git a/tests/baselines/reference/ES5SymbolProperty1(target=es2015).js b/tests/baselines/reference/ES5SymbolProperty1(target=es2015).js new file mode 100644 index 0000000000000..ea2f9fc33d176 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty1(target=es2015).js @@ -0,0 +1,20 @@ +//// [tests/cases/conformance/Symbols/ES5SymbolProperty1.ts] //// + +//// [ES5SymbolProperty1.ts] +interface SymbolConstructor { + foo: string; +} +var Symbol: SymbolConstructor; + +var obj = { + [Symbol.foo]: 0 +} + +obj[Symbol.foo]; + +//// [ES5SymbolProperty1.js] +var Symbol; +var obj = { + [Symbol.foo]: 0 +}; +obj[Symbol.foo]; diff --git a/tests/baselines/reference/ES5SymbolProperty1.symbols b/tests/baselines/reference/ES5SymbolProperty1(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5SymbolProperty1.symbols rename to tests/baselines/reference/ES5SymbolProperty1(target=es2015).symbols diff --git a/tests/baselines/reference/ES5SymbolProperty1.types b/tests/baselines/reference/ES5SymbolProperty1(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5SymbolProperty1.types rename to tests/baselines/reference/ES5SymbolProperty1(target=es2015).types diff --git a/tests/baselines/reference/ES5SymbolProperty1.js b/tests/baselines/reference/ES5SymbolProperty1(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5SymbolProperty1.js rename to tests/baselines/reference/ES5SymbolProperty1(target=es5).js diff --git a/tests/baselines/reference/ES5SymbolProperty1(target=es5).symbols b/tests/baselines/reference/ES5SymbolProperty1(target=es5).symbols new file mode 100644 index 0000000000000..af9cdfc362fa7 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty1(target=es5).symbols @@ -0,0 +1,29 @@ +//// [tests/cases/conformance/Symbols/ES5SymbolProperty1.ts] //// + +=== ES5SymbolProperty1.ts === +interface SymbolConstructor { +>SymbolConstructor : Symbol(SymbolConstructor, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.asynciterable.d.ts, --, --), Decl(ES5SymbolProperty1.ts, 0, 0)) + + foo: string; +>foo : Symbol(SymbolConstructor.foo, Decl(ES5SymbolProperty1.ts, 0, 29)) +} +var Symbol: SymbolConstructor; +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(ES5SymbolProperty1.ts, 3, 3)) +>SymbolConstructor : Symbol(SymbolConstructor, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.asynciterable.d.ts, --, --), Decl(ES5SymbolProperty1.ts, 0, 0)) + +var obj = { +>obj : Symbol(obj, Decl(ES5SymbolProperty1.ts, 5, 3)) + + [Symbol.foo]: 0 +>[Symbol.foo] : Symbol([Symbol.foo], Decl(ES5SymbolProperty1.ts, 5, 11)) +>Symbol.foo : Symbol(SymbolConstructor.foo, Decl(ES5SymbolProperty1.ts, 0, 29)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(ES5SymbolProperty1.ts, 3, 3)) +>foo : Symbol(SymbolConstructor.foo, Decl(ES5SymbolProperty1.ts, 0, 29)) +} + +obj[Symbol.foo]; +>obj : Symbol(obj, Decl(ES5SymbolProperty1.ts, 5, 3)) +>Symbol.foo : Symbol(SymbolConstructor.foo, Decl(ES5SymbolProperty1.ts, 0, 29)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(ES5SymbolProperty1.ts, 3, 3)) +>foo : Symbol(SymbolConstructor.foo, Decl(ES5SymbolProperty1.ts, 0, 29)) + diff --git a/tests/baselines/reference/ES5SymbolProperty1(target=es5).types b/tests/baselines/reference/ES5SymbolProperty1(target=es5).types new file mode 100644 index 0000000000000..6be7f701e4a12 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty1(target=es5).types @@ -0,0 +1,43 @@ +//// [tests/cases/conformance/Symbols/ES5SymbolProperty1.ts] //// + +=== ES5SymbolProperty1.ts === +interface SymbolConstructor { + foo: string; +>foo : string +> : ^^^^^^ +} +var Symbol: SymbolConstructor; +>Symbol : SymbolConstructor +> : ^^^^^^^^^^^^^^^^^ + +var obj = { +>obj : { [Symbol.foo]: number; } +> : ^^ ^^^^^^ ^^ +>{ [Symbol.foo]: 0} : { [Symbol.foo]: number; } +> : ^^ ^^^^^^ ^^ + + [Symbol.foo]: 0 +>[Symbol.foo] : number +> : ^^^^^^ +>Symbol.foo : string +> : ^^^^^^ +>Symbol : SymbolConstructor +> : ^^^^^^^^^^^^^^^^^ +>foo : string +> : ^^^^^^ +>0 : 0 +> : ^ +} + +obj[Symbol.foo]; +>obj[Symbol.foo] : number +> : ^^^^^^ +>obj : { [Symbol.foo]: number; } +> : ^^ ^^^^^^ ^^ +>Symbol.foo : string +> : ^^^^^^ +>Symbol : SymbolConstructor +> : ^^^^^^^^^^^^^^^^^ +>foo : string +> : ^^^^^^ + diff --git a/tests/baselines/reference/ES5SymbolProperty2(target=es2015).js b/tests/baselines/reference/ES5SymbolProperty2(target=es2015).js new file mode 100644 index 0000000000000..97b6ce5bdbe62 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty2(target=es2015).js @@ -0,0 +1,25 @@ +//// [tests/cases/conformance/Symbols/ES5SymbolProperty2.ts] //// + +//// [ES5SymbolProperty2.ts] +namespace M { + var Symbol: any; + + export class C { + [Symbol.iterator]() { } + } + (new C)[Symbol.iterator]; +} + +(new M.C)[Symbol.iterator]; + +//// [ES5SymbolProperty2.js] +var M; +(function (M) { + var Symbol; + class C { + [Symbol.iterator]() { } + } + M.C = C; + (new C)[Symbol.iterator]; +})(M || (M = {})); +(new M.C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolProperty2.symbols b/tests/baselines/reference/ES5SymbolProperty2(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5SymbolProperty2.symbols rename to tests/baselines/reference/ES5SymbolProperty2(target=es2015).symbols diff --git a/tests/baselines/reference/ES5SymbolProperty2.types b/tests/baselines/reference/ES5SymbolProperty2(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5SymbolProperty2.types rename to tests/baselines/reference/ES5SymbolProperty2(target=es2015).types diff --git a/tests/baselines/reference/ES5SymbolProperty2.js b/tests/baselines/reference/ES5SymbolProperty2(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5SymbolProperty2.js rename to tests/baselines/reference/ES5SymbolProperty2(target=es5).js diff --git a/tests/baselines/reference/ES5SymbolProperty2(target=es5).symbols b/tests/baselines/reference/ES5SymbolProperty2(target=es5).symbols new file mode 100644 index 0000000000000..e7a2ab4d7cb5e --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty2(target=es5).symbols @@ -0,0 +1,29 @@ +//// [tests/cases/conformance/Symbols/ES5SymbolProperty2.ts] //// + +=== ES5SymbolProperty2.ts === +namespace M { +>M : Symbol(M, Decl(ES5SymbolProperty2.ts, 0, 0)) + + var Symbol: any; +>Symbol : Symbol(Symbol, Decl(ES5SymbolProperty2.ts, 1, 7)) + + export class C { +>C : Symbol(C, Decl(ES5SymbolProperty2.ts, 1, 20)) + + [Symbol.iterator]() { } +>[Symbol.iterator] : Symbol(C[Symbol.iterator], Decl(ES5SymbolProperty2.ts, 3, 20)) +>Symbol : Symbol(Symbol, Decl(ES5SymbolProperty2.ts, 1, 7)) + } + (new C)[Symbol.iterator]; +>C : Symbol(C, Decl(ES5SymbolProperty2.ts, 1, 20)) +>Symbol : Symbol(Symbol, Decl(ES5SymbolProperty2.ts, 1, 7)) +} + +(new M.C)[Symbol.iterator]; +>M.C : Symbol(M.C, Decl(ES5SymbolProperty2.ts, 1, 20)) +>M : Symbol(M, Decl(ES5SymbolProperty2.ts, 0, 0)) +>C : Symbol(M.C, Decl(ES5SymbolProperty2.ts, 1, 20)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) + diff --git a/tests/baselines/reference/ES5SymbolProperty2(target=es5).types b/tests/baselines/reference/ES5SymbolProperty2(target=es5).types new file mode 100644 index 0000000000000..0fd0ed64949a9 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty2(target=es5).types @@ -0,0 +1,58 @@ +//// [tests/cases/conformance/Symbols/ES5SymbolProperty2.ts] //// + +=== ES5SymbolProperty2.ts === +namespace M { +>M : typeof M +> : ^^^^^^^^ + + var Symbol: any; +>Symbol : any + + export class C { +>C : C +> : ^ + + [Symbol.iterator]() { } +>[Symbol.iterator] : () => void +> : ^^^^^^^^^^ +>Symbol.iterator : any +>Symbol : any +> : ^^^ +>iterator : any +> : ^^^ + } + (new C)[Symbol.iterator]; +>(new C)[Symbol.iterator] : () => void +> : ^^^^^^^^^^ +>(new C) : C +> : ^ +>new C : C +> : ^ +>C : typeof C +> : ^^^^^^^^ +>Symbol.iterator : any +>Symbol : any +> : ^^^ +>iterator : any +> : ^^^ +} + +(new M.C)[Symbol.iterator]; +>(new M.C)[Symbol.iterator] : error +>(new M.C) : M.C +> : ^^^ +>new M.C : M.C +> : ^^^ +>M.C : typeof M.C +> : ^^^^^^^^^^ +>M : typeof M +> : ^^^^^^^^ +>C : typeof M.C +> : ^^^^^^^^^^ +>Symbol.iterator : unique symbol +> : ^^^^^^^^^^^^^ +>Symbol : SymbolConstructor +> : ^^^^^^^^^^^^^^^^^ +>iterator : unique symbol +> : ^^^^^^^^^^^^^ + diff --git a/tests/baselines/reference/ES5SymbolProperty3.errors.txt b/tests/baselines/reference/ES5SymbolProperty3(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/ES5SymbolProperty3.errors.txt rename to tests/baselines/reference/ES5SymbolProperty3(target=es2015).errors.txt diff --git a/tests/baselines/reference/ES5SymbolProperty3(target=es2015).js b/tests/baselines/reference/ES5SymbolProperty3(target=es2015).js new file mode 100644 index 0000000000000..f30919700ea48 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty3(target=es2015).js @@ -0,0 +1,17 @@ +//// [tests/cases/conformance/Symbols/ES5SymbolProperty3.ts] //// + +//// [ES5SymbolProperty3.ts] +var Symbol: any; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] + +//// [ES5SymbolProperty3.js] +var Symbol; +class C { + [Symbol.iterator]() { } +} +(new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolProperty3.symbols b/tests/baselines/reference/ES5SymbolProperty3(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5SymbolProperty3.symbols rename to tests/baselines/reference/ES5SymbolProperty3(target=es2015).symbols diff --git a/tests/baselines/reference/ES5SymbolProperty3.types b/tests/baselines/reference/ES5SymbolProperty3(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5SymbolProperty3.types rename to tests/baselines/reference/ES5SymbolProperty3(target=es2015).types diff --git a/tests/baselines/reference/ES5SymbolProperty3(target=es5).errors.txt b/tests/baselines/reference/ES5SymbolProperty3(target=es5).errors.txt new file mode 100644 index 0000000000000..09bb9fdb41853 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty3(target=es5).errors.txt @@ -0,0 +1,14 @@ +ES5SymbolProperty3.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'Symbol' must be of type 'SymbolConstructor', but here has type 'any'. + + +==== ES5SymbolProperty3.ts (1 errors) ==== + var Symbol: any; + ~~~~~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Symbol' must be of type 'SymbolConstructor', but here has type 'any'. +!!! related TS6203 lib.es2015.symbol.d.ts:--:--: 'Symbol' was also declared here. + + class C { + [Symbol.iterator]() { } + } + + (new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty3.js b/tests/baselines/reference/ES5SymbolProperty3(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5SymbolProperty3.js rename to tests/baselines/reference/ES5SymbolProperty3(target=es5).js diff --git a/tests/baselines/reference/ES5SymbolProperty3(target=es5).symbols b/tests/baselines/reference/ES5SymbolProperty3(target=es5).symbols new file mode 100644 index 0000000000000..6bd8dab23811c --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty3(target=es5).symbols @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/Symbols/ES5SymbolProperty3.ts] //// + +=== ES5SymbolProperty3.ts === +var Symbol: any; +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(ES5SymbolProperty3.ts, 0, 3)) + +class C { +>C : Symbol(C, Decl(ES5SymbolProperty3.ts, 0, 16)) + + [Symbol.iterator]() { } +>[Symbol.iterator] : Symbol(C[Symbol.iterator], Decl(ES5SymbolProperty3.ts, 2, 9)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(ES5SymbolProperty3.ts, 0, 3)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +} + +(new C)[Symbol.iterator] +>C : Symbol(C, Decl(ES5SymbolProperty3.ts, 0, 16)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(ES5SymbolProperty3.ts, 0, 3)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) + diff --git a/tests/baselines/reference/ES5SymbolProperty3(target=es5).types b/tests/baselines/reference/ES5SymbolProperty3(target=es5).types new file mode 100644 index 0000000000000..6629a31f3444d --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty3(target=es5).types @@ -0,0 +1,38 @@ +//// [tests/cases/conformance/Symbols/ES5SymbolProperty3.ts] //// + +=== ES5SymbolProperty3.ts === +var Symbol: any; +>Symbol : SymbolConstructor +> : ^^^^^^^^^^^^^^^^^ + +class C { +>C : C +> : ^ + + [Symbol.iterator]() { } +>[Symbol.iterator] : () => void +> : ^^^^^^^^^^ +>Symbol.iterator : unique symbol +> : ^^^^^^^^^^^^^ +>Symbol : SymbolConstructor +> : ^^^^^^^^^^^^^^^^^ +>iterator : unique symbol +> : ^^^^^^^^^^^^^ +} + +(new C)[Symbol.iterator] +>(new C)[Symbol.iterator] : () => void +> : ^^^^^^^^^^ +>(new C) : C +> : ^ +>new C : C +> : ^ +>C : typeof C +> : ^^^^^^^^ +>Symbol.iterator : unique symbol +> : ^^^^^^^^^^^^^ +>Symbol : SymbolConstructor +> : ^^^^^^^^^^^^^^^^^ +>iterator : unique symbol +> : ^^^^^^^^^^^^^ + diff --git a/tests/baselines/reference/ES5SymbolProperty4.errors.txt b/tests/baselines/reference/ES5SymbolProperty4(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/ES5SymbolProperty4.errors.txt rename to tests/baselines/reference/ES5SymbolProperty4(target=es2015).errors.txt diff --git a/tests/baselines/reference/ES5SymbolProperty4(target=es2015).js b/tests/baselines/reference/ES5SymbolProperty4(target=es2015).js new file mode 100644 index 0000000000000..942255c915d4e --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty4(target=es2015).js @@ -0,0 +1,17 @@ +//// [tests/cases/conformance/Symbols/ES5SymbolProperty4.ts] //// + +//// [ES5SymbolProperty4.ts] +var Symbol: { iterator: string }; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] + +//// [ES5SymbolProperty4.js] +var Symbol; +class C { + [Symbol.iterator]() { } +} +(new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolProperty4.symbols b/tests/baselines/reference/ES5SymbolProperty4(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5SymbolProperty4.symbols rename to tests/baselines/reference/ES5SymbolProperty4(target=es2015).symbols diff --git a/tests/baselines/reference/ES5SymbolProperty4.types b/tests/baselines/reference/ES5SymbolProperty4(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5SymbolProperty4.types rename to tests/baselines/reference/ES5SymbolProperty4(target=es2015).types diff --git a/tests/baselines/reference/ES5SymbolProperty4(target=es5).errors.txt b/tests/baselines/reference/ES5SymbolProperty4(target=es5).errors.txt new file mode 100644 index 0000000000000..38a4b466e074a --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty4(target=es5).errors.txt @@ -0,0 +1,14 @@ +ES5SymbolProperty4.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'Symbol' must be of type 'SymbolConstructor', but here has type '{ iterator: string; }'. + + +==== ES5SymbolProperty4.ts (1 errors) ==== + var Symbol: { iterator: string }; + ~~~~~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Symbol' must be of type 'SymbolConstructor', but here has type '{ iterator: string; }'. +!!! related TS6203 lib.es2015.symbol.d.ts:--:--: 'Symbol' was also declared here. + + class C { + [Symbol.iterator]() { } + } + + (new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty4.js b/tests/baselines/reference/ES5SymbolProperty4(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5SymbolProperty4.js rename to tests/baselines/reference/ES5SymbolProperty4(target=es5).js diff --git a/tests/baselines/reference/ES5SymbolProperty4(target=es5).symbols b/tests/baselines/reference/ES5SymbolProperty4(target=es5).symbols new file mode 100644 index 0000000000000..a20d13686ebea --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty4(target=es5).symbols @@ -0,0 +1,23 @@ +//// [tests/cases/conformance/Symbols/ES5SymbolProperty4.ts] //// + +=== ES5SymbolProperty4.ts === +var Symbol: { iterator: string }; +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(ES5SymbolProperty4.ts, 0, 3)) +>iterator : Symbol(iterator, Decl(ES5SymbolProperty4.ts, 0, 13)) + +class C { +>C : Symbol(C, Decl(ES5SymbolProperty4.ts, 0, 33)) + + [Symbol.iterator]() { } +>[Symbol.iterator] : Symbol(C[Symbol.iterator], Decl(ES5SymbolProperty4.ts, 2, 9)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(ES5SymbolProperty4.ts, 0, 3)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +} + +(new C)[Symbol.iterator] +>C : Symbol(C, Decl(ES5SymbolProperty4.ts, 0, 33)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(ES5SymbolProperty4.ts, 0, 3)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) + diff --git a/tests/baselines/reference/ES5SymbolProperty4(target=es5).types b/tests/baselines/reference/ES5SymbolProperty4(target=es5).types new file mode 100644 index 0000000000000..55c9cb1b08450 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty4(target=es5).types @@ -0,0 +1,40 @@ +//// [tests/cases/conformance/Symbols/ES5SymbolProperty4.ts] //// + +=== ES5SymbolProperty4.ts === +var Symbol: { iterator: string }; +>Symbol : SymbolConstructor +> : ^^^^^^^^^^^^^^^^^ +>iterator : string +> : ^^^^^^ + +class C { +>C : C +> : ^ + + [Symbol.iterator]() { } +>[Symbol.iterator] : () => void +> : ^^^^^^^^^^ +>Symbol.iterator : unique symbol +> : ^^^^^^^^^^^^^ +>Symbol : SymbolConstructor +> : ^^^^^^^^^^^^^^^^^ +>iterator : unique symbol +> : ^^^^^^^^^^^^^ +} + +(new C)[Symbol.iterator] +>(new C)[Symbol.iterator] : () => void +> : ^^^^^^^^^^ +>(new C) : C +> : ^ +>new C : C +> : ^ +>C : typeof C +> : ^^^^^^^^ +>Symbol.iterator : unique symbol +> : ^^^^^^^^^^^^^ +>Symbol : SymbolConstructor +> : ^^^^^^^^^^^^^^^^^ +>iterator : unique symbol +> : ^^^^^^^^^^^^^ + diff --git a/tests/baselines/reference/ES5SymbolProperty5.errors.txt b/tests/baselines/reference/ES5SymbolProperty5(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/ES5SymbolProperty5.errors.txt rename to tests/baselines/reference/ES5SymbolProperty5(target=es2015).errors.txt diff --git a/tests/baselines/reference/ES5SymbolProperty5(target=es2015).js b/tests/baselines/reference/ES5SymbolProperty5(target=es2015).js new file mode 100644 index 0000000000000..17445f237dc9c --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty5(target=es2015).js @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/Symbols/ES5SymbolProperty5.ts] //// + +//// [ES5SymbolProperty5.ts] +declare var Symbol: { iterator: symbol }; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator](0) // Should error + +//// [ES5SymbolProperty5.js] +class C { + [Symbol.iterator]() { } +} +(new C)[Symbol.iterator](0); // Should error diff --git a/tests/baselines/reference/ES5SymbolProperty5.symbols b/tests/baselines/reference/ES5SymbolProperty5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5SymbolProperty5.symbols rename to tests/baselines/reference/ES5SymbolProperty5(target=es2015).symbols diff --git a/tests/baselines/reference/ES5SymbolProperty5.types b/tests/baselines/reference/ES5SymbolProperty5(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5SymbolProperty5.types rename to tests/baselines/reference/ES5SymbolProperty5(target=es2015).types diff --git a/tests/baselines/reference/ES5SymbolProperty5(target=es5).errors.txt b/tests/baselines/reference/ES5SymbolProperty5(target=es5).errors.txt new file mode 100644 index 0000000000000..962069c9d2a70 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty5(target=es5).errors.txt @@ -0,0 +1,17 @@ +ES5SymbolProperty5.ts(1,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'Symbol' must be of type 'SymbolConstructor', but here has type '{ iterator: symbol; }'. +ES5SymbolProperty5.ts(7,26): error TS2554: Expected 0 arguments, but got 1. + + +==== ES5SymbolProperty5.ts (2 errors) ==== + declare var Symbol: { iterator: symbol }; + ~~~~~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Symbol' must be of type 'SymbolConstructor', but here has type '{ iterator: symbol; }'. +!!! related TS6203 lib.es2015.symbol.d.ts:--:--: 'Symbol' was also declared here. + + class C { + [Symbol.iterator]() { } + } + + (new C)[Symbol.iterator](0) // Should error + ~ +!!! error TS2554: Expected 0 arguments, but got 1. \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty5.js b/tests/baselines/reference/ES5SymbolProperty5(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5SymbolProperty5.js rename to tests/baselines/reference/ES5SymbolProperty5(target=es5).js diff --git a/tests/baselines/reference/ES5SymbolProperty5(target=es5).symbols b/tests/baselines/reference/ES5SymbolProperty5(target=es5).symbols new file mode 100644 index 0000000000000..c0b016b14b44f --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty5(target=es5).symbols @@ -0,0 +1,23 @@ +//// [tests/cases/conformance/Symbols/ES5SymbolProperty5.ts] //// + +=== ES5SymbolProperty5.ts === +declare var Symbol: { iterator: symbol }; +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(ES5SymbolProperty5.ts, 0, 11)) +>iterator : Symbol(iterator, Decl(ES5SymbolProperty5.ts, 0, 21)) + +class C { +>C : Symbol(C, Decl(ES5SymbolProperty5.ts, 0, 41)) + + [Symbol.iterator]() { } +>[Symbol.iterator] : Symbol(C[Symbol.iterator], Decl(ES5SymbolProperty5.ts, 2, 9)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(ES5SymbolProperty5.ts, 0, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +} + +(new C)[Symbol.iterator](0) // Should error +>C : Symbol(C, Decl(ES5SymbolProperty5.ts, 0, 41)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(ES5SymbolProperty5.ts, 0, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) + diff --git a/tests/baselines/reference/ES5SymbolProperty5(target=es5).types b/tests/baselines/reference/ES5SymbolProperty5(target=es5).types new file mode 100644 index 0000000000000..72bd530e52e21 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty5(target=es5).types @@ -0,0 +1,44 @@ +//// [tests/cases/conformance/Symbols/ES5SymbolProperty5.ts] //// + +=== ES5SymbolProperty5.ts === +declare var Symbol: { iterator: symbol }; +>Symbol : SymbolConstructor +> : ^^^^^^^^^^^^^^^^^ +>iterator : symbol +> : ^^^^^^ + +class C { +>C : C +> : ^ + + [Symbol.iterator]() { } +>[Symbol.iterator] : () => void +> : ^^^^^^^^^^ +>Symbol.iterator : unique symbol +> : ^^^^^^^^^^^^^ +>Symbol : SymbolConstructor +> : ^^^^^^^^^^^^^^^^^ +>iterator : unique symbol +> : ^^^^^^^^^^^^^ +} + +(new C)[Symbol.iterator](0) // Should error +>(new C)[Symbol.iterator](0) : void +> : ^^^^ +>(new C)[Symbol.iterator] : () => void +> : ^^^^^^^^^^ +>(new C) : C +> : ^ +>new C : C +> : ^ +>C : typeof C +> : ^^^^^^^^ +>Symbol.iterator : unique symbol +> : ^^^^^^^^^^^^^ +>Symbol : SymbolConstructor +> : ^^^^^^^^^^^^^^^^^ +>iterator : unique symbol +> : ^^^^^^^^^^^^^ +>0 : 0 +> : ^ + diff --git a/tests/baselines/reference/ES5SymbolProperty6(target=es2015).js b/tests/baselines/reference/ES5SymbolProperty6(target=es2015).js new file mode 100644 index 0000000000000..ddc5d58ccb2f7 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty6(target=es2015).js @@ -0,0 +1,14 @@ +//// [tests/cases/conformance/Symbols/ES5SymbolProperty6.ts] //// + +//// [ES5SymbolProperty6.ts] +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] + +//// [ES5SymbolProperty6.js] +class C { + [Symbol.iterator]() { } +} +(new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolProperty6.symbols b/tests/baselines/reference/ES5SymbolProperty6(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5SymbolProperty6.symbols rename to tests/baselines/reference/ES5SymbolProperty6(target=es2015).symbols diff --git a/tests/baselines/reference/ES5SymbolProperty6.types b/tests/baselines/reference/ES5SymbolProperty6(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5SymbolProperty6.types rename to tests/baselines/reference/ES5SymbolProperty6(target=es2015).types diff --git a/tests/baselines/reference/ES5SymbolProperty6.js b/tests/baselines/reference/ES5SymbolProperty6(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5SymbolProperty6.js rename to tests/baselines/reference/ES5SymbolProperty6(target=es5).js diff --git a/tests/baselines/reference/ES5SymbolProperty6(target=es5).symbols b/tests/baselines/reference/ES5SymbolProperty6(target=es5).symbols new file mode 100644 index 0000000000000..b06b612860900 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty6(target=es5).symbols @@ -0,0 +1,19 @@ +//// [tests/cases/conformance/Symbols/ES5SymbolProperty6.ts] //// + +=== ES5SymbolProperty6.ts === +class C { +>C : Symbol(C, Decl(ES5SymbolProperty6.ts, 0, 0)) + + [Symbol.iterator]() { } +>[Symbol.iterator] : Symbol(C[Symbol.iterator], Decl(ES5SymbolProperty6.ts, 0, 9)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +} + +(new C)[Symbol.iterator] +>C : Symbol(C, Decl(ES5SymbolProperty6.ts, 0, 0)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) + diff --git a/tests/baselines/reference/ES5SymbolProperty6(target=es5).types b/tests/baselines/reference/ES5SymbolProperty6(target=es5).types new file mode 100644 index 0000000000000..fc7db7e1dcbb8 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty6(target=es5).types @@ -0,0 +1,34 @@ +//// [tests/cases/conformance/Symbols/ES5SymbolProperty6.ts] //// + +=== ES5SymbolProperty6.ts === +class C { +>C : C +> : ^ + + [Symbol.iterator]() { } +>[Symbol.iterator] : () => void +> : ^^^^^^^^^^ +>Symbol.iterator : unique symbol +> : ^^^^^^^^^^^^^ +>Symbol : SymbolConstructor +> : ^^^^^^^^^^^^^^^^^ +>iterator : unique symbol +> : ^^^^^^^^^^^^^ +} + +(new C)[Symbol.iterator] +>(new C)[Symbol.iterator] : () => void +> : ^^^^^^^^^^ +>(new C) : C +> : ^ +>new C : C +> : ^ +>C : typeof C +> : ^^^^^^^^ +>Symbol.iterator : unique symbol +> : ^^^^^^^^^^^^^ +>Symbol : SymbolConstructor +> : ^^^^^^^^^^^^^^^^^ +>iterator : unique symbol +> : ^^^^^^^^^^^^^ + diff --git a/tests/baselines/reference/ES5SymbolProperty7.errors.txt b/tests/baselines/reference/ES5SymbolProperty7(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/ES5SymbolProperty7.errors.txt rename to tests/baselines/reference/ES5SymbolProperty7(target=es2015).errors.txt diff --git a/tests/baselines/reference/ES5SymbolProperty7(target=es2015).js b/tests/baselines/reference/ES5SymbolProperty7(target=es2015).js new file mode 100644 index 0000000000000..abf0d00799513 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty7(target=es2015).js @@ -0,0 +1,17 @@ +//// [tests/cases/conformance/Symbols/ES5SymbolProperty7.ts] //// + +//// [ES5SymbolProperty7.ts] +var Symbol: { iterator: any }; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] + +//// [ES5SymbolProperty7.js] +var Symbol; +class C { + [Symbol.iterator]() { } +} +(new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolProperty7.symbols b/tests/baselines/reference/ES5SymbolProperty7(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5SymbolProperty7.symbols rename to tests/baselines/reference/ES5SymbolProperty7(target=es2015).symbols diff --git a/tests/baselines/reference/ES5SymbolProperty7.types b/tests/baselines/reference/ES5SymbolProperty7(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5SymbolProperty7.types rename to tests/baselines/reference/ES5SymbolProperty7(target=es2015).types diff --git a/tests/baselines/reference/ES5SymbolProperty7(target=es5).errors.txt b/tests/baselines/reference/ES5SymbolProperty7(target=es5).errors.txt new file mode 100644 index 0000000000000..9c083f0824bd8 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty7(target=es5).errors.txt @@ -0,0 +1,14 @@ +ES5SymbolProperty7.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'Symbol' must be of type 'SymbolConstructor', but here has type '{ iterator: any; }'. + + +==== ES5SymbolProperty7.ts (1 errors) ==== + var Symbol: { iterator: any }; + ~~~~~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Symbol' must be of type 'SymbolConstructor', but here has type '{ iterator: any; }'. +!!! related TS6203 lib.es2015.symbol.d.ts:--:--: 'Symbol' was also declared here. + + class C { + [Symbol.iterator]() { } + } + + (new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty7.js b/tests/baselines/reference/ES5SymbolProperty7(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5SymbolProperty7.js rename to tests/baselines/reference/ES5SymbolProperty7(target=es5).js diff --git a/tests/baselines/reference/ES5SymbolProperty7(target=es5).symbols b/tests/baselines/reference/ES5SymbolProperty7(target=es5).symbols new file mode 100644 index 0000000000000..ddfe21b83fe9d --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty7(target=es5).symbols @@ -0,0 +1,23 @@ +//// [tests/cases/conformance/Symbols/ES5SymbolProperty7.ts] //// + +=== ES5SymbolProperty7.ts === +var Symbol: { iterator: any }; +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(ES5SymbolProperty7.ts, 0, 3)) +>iterator : Symbol(iterator, Decl(ES5SymbolProperty7.ts, 0, 13)) + +class C { +>C : Symbol(C, Decl(ES5SymbolProperty7.ts, 0, 30)) + + [Symbol.iterator]() { } +>[Symbol.iterator] : Symbol(C[Symbol.iterator], Decl(ES5SymbolProperty7.ts, 2, 9)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(ES5SymbolProperty7.ts, 0, 3)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +} + +(new C)[Symbol.iterator] +>C : Symbol(C, Decl(ES5SymbolProperty7.ts, 0, 30)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(ES5SymbolProperty7.ts, 0, 3)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) + diff --git a/tests/baselines/reference/ES5SymbolProperty7(target=es5).types b/tests/baselines/reference/ES5SymbolProperty7(target=es5).types new file mode 100644 index 0000000000000..4667d91401d30 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty7(target=es5).types @@ -0,0 +1,40 @@ +//// [tests/cases/conformance/Symbols/ES5SymbolProperty7.ts] //// + +=== ES5SymbolProperty7.ts === +var Symbol: { iterator: any }; +>Symbol : SymbolConstructor +> : ^^^^^^^^^^^^^^^^^ +>iterator : any +> : ^^^ + +class C { +>C : C +> : ^ + + [Symbol.iterator]() { } +>[Symbol.iterator] : () => void +> : ^^^^^^^^^^ +>Symbol.iterator : unique symbol +> : ^^^^^^^^^^^^^ +>Symbol : SymbolConstructor +> : ^^^^^^^^^^^^^^^^^ +>iterator : unique symbol +> : ^^^^^^^^^^^^^ +} + +(new C)[Symbol.iterator] +>(new C)[Symbol.iterator] : () => void +> : ^^^^^^^^^^ +>(new C) : C +> : ^ +>new C : C +> : ^ +>C : typeof C +> : ^^^^^^^^ +>Symbol.iterator : unique symbol +> : ^^^^^^^^^^^^^ +>Symbol : SymbolConstructor +> : ^^^^^^^^^^^^^^^^^ +>iterator : unique symbol +> : ^^^^^^^^^^^^^ + diff --git a/tests/baselines/reference/ES5SymbolType1.js b/tests/baselines/reference/ES5SymbolType1(target=es2015).js similarity index 100% rename from tests/baselines/reference/ES5SymbolType1.js rename to tests/baselines/reference/ES5SymbolType1(target=es2015).js diff --git a/tests/baselines/reference/ES5SymbolType1.symbols b/tests/baselines/reference/ES5SymbolType1(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5SymbolType1.symbols rename to tests/baselines/reference/ES5SymbolType1(target=es2015).symbols diff --git a/tests/baselines/reference/ES5SymbolType1.types b/tests/baselines/reference/ES5SymbolType1(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5SymbolType1.types rename to tests/baselines/reference/ES5SymbolType1(target=es2015).types diff --git a/tests/baselines/reference/ES5SymbolType1(target=es5).js b/tests/baselines/reference/ES5SymbolType1(target=es5).js new file mode 100644 index 0000000000000..0709bb89a8d27 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolType1(target=es5).js @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/Symbols/ES5SymbolType1.ts] //// + +//// [ES5SymbolType1.ts] +var s: symbol; +s.toString(); + +//// [ES5SymbolType1.js] +var s; +s.toString(); diff --git a/tests/baselines/reference/ES5SymbolType1(target=es5).symbols b/tests/baselines/reference/ES5SymbolType1(target=es5).symbols new file mode 100644 index 0000000000000..d31cd5558ad81 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolType1(target=es5).symbols @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/Symbols/ES5SymbolType1.ts] //// + +=== ES5SymbolType1.ts === +var s: symbol; +>s : Symbol(s, Decl(ES5SymbolType1.ts, 0, 3)) + +s.toString(); +>s.toString : Symbol(Symbol.toString, Decl(lib.es5.d.ts, --, --)) +>s : Symbol(s, Decl(ES5SymbolType1.ts, 0, 3)) +>toString : Symbol(Symbol.toString, Decl(lib.es5.d.ts, --, --)) + diff --git a/tests/baselines/reference/ES5SymbolType1(target=es5).types b/tests/baselines/reference/ES5SymbolType1(target=es5).types new file mode 100644 index 0000000000000..a8c00932002b0 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolType1(target=es5).types @@ -0,0 +1,17 @@ +//// [tests/cases/conformance/Symbols/ES5SymbolType1.ts] //// + +=== ES5SymbolType1.ts === +var s: symbol; +>s : symbol +> : ^^^^^^ + +s.toString(); +>s.toString() : string +> : ^^^^^^ +>s.toString : () => string +> : ^^^^^^ +>s : symbol +> : ^^^^^^ +>toString : () => string +> : ^^^^^^ + diff --git a/tests/baselines/reference/ES5for-of32(target=es2015).js b/tests/baselines/reference/ES5for-of32(target=es2015).js new file mode 100644 index 0000000000000..052ffa24567c1 --- /dev/null +++ b/tests/baselines/reference/ES5for-of32(target=es2015).js @@ -0,0 +1,23 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5for-of32.ts] //// + +//// [ES5for-of32.ts] +var array = [1,2,3]; +var sum = 0; + +for (let num of array) { + if (sum === 0) { + array = [4,5,6] + } + + sum += num; +} + +//// [ES5for-of32.js] +var array = [1, 2, 3]; +var sum = 0; +for (let num of array) { + if (sum === 0) { + array = [4, 5, 6]; + } + sum += num; +} diff --git a/tests/baselines/reference/ES5for-of32.symbols b/tests/baselines/reference/ES5for-of32(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ES5for-of32.symbols rename to tests/baselines/reference/ES5for-of32(target=es2015).symbols diff --git a/tests/baselines/reference/ES5for-of32.types b/tests/baselines/reference/ES5for-of32(target=es2015).types similarity index 100% rename from tests/baselines/reference/ES5for-of32.types rename to tests/baselines/reference/ES5for-of32(target=es2015).types diff --git a/tests/baselines/reference/ES5for-of32.js b/tests/baselines/reference/ES5for-of32(target=es5).js similarity index 100% rename from tests/baselines/reference/ES5for-of32.js rename to tests/baselines/reference/ES5for-of32(target=es5).js diff --git a/tests/baselines/reference/ES5for-of32(target=es5).symbols b/tests/baselines/reference/ES5for-of32(target=es5).symbols new file mode 100644 index 0000000000000..41ac3447f94d3 --- /dev/null +++ b/tests/baselines/reference/ES5for-of32(target=es5).symbols @@ -0,0 +1,24 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5for-of32.ts] //// + +=== ES5for-of32.ts === +var array = [1,2,3]; +>array : Symbol(array, Decl(ES5for-of32.ts, 0, 3)) + +var sum = 0; +>sum : Symbol(sum, Decl(ES5for-of32.ts, 1, 3)) + +for (let num of array) { +>num : Symbol(num, Decl(ES5for-of32.ts, 3, 8)) +>array : Symbol(array, Decl(ES5for-of32.ts, 0, 3)) + + if (sum === 0) { +>sum : Symbol(sum, Decl(ES5for-of32.ts, 1, 3)) + + array = [4,5,6] +>array : Symbol(array, Decl(ES5for-of32.ts, 0, 3)) + } + + sum += num; +>sum : Symbol(sum, Decl(ES5for-of32.ts, 1, 3)) +>num : Symbol(num, Decl(ES5for-of32.ts, 3, 8)) +} diff --git a/tests/baselines/reference/ES5for-of32(target=es5).types b/tests/baselines/reference/ES5for-of32(target=es5).types new file mode 100644 index 0000000000000..73590e0d84a9f --- /dev/null +++ b/tests/baselines/reference/ES5for-of32(target=es5).types @@ -0,0 +1,58 @@ +//// [tests/cases/conformance/statements/for-ofStatements/ES5for-of32.ts] //// + +=== ES5for-of32.ts === +var array = [1,2,3]; +>array : number[] +> : ^^^^^^^^ +>[1,2,3] : number[] +> : ^^^^^^^^ +>1 : 1 +> : ^ +>2 : 2 +> : ^ +>3 : 3 +> : ^ + +var sum = 0; +>sum : number +> : ^^^^^^ +>0 : 0 +> : ^ + +for (let num of array) { +>num : number +> : ^^^^^^ +>array : number[] +> : ^^^^^^^^ + + if (sum === 0) { +>sum === 0 : boolean +> : ^^^^^^^ +>sum : number +> : ^^^^^^ +>0 : 0 +> : ^ + + array = [4,5,6] +>array = [4,5,6] : number[] +> : ^^^^^^^^ +>array : number[] +> : ^^^^^^^^ +>[4,5,6] : number[] +> : ^^^^^^^^ +>4 : 4 +> : ^ +>5 : 5 +> : ^ +>6 : 6 +> : ^ + } + + sum += num; +>sum += num : number +> : ^^^^^^ +>sum : number +> : ^^^^^^ +>num : number +> : ^^^^^^ +} diff --git a/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.js b/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.js index 60db514328ab2..b40350403e36a 100644 --- a/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.js @@ -25,13 +25,12 @@ var enumdule; enumdule[enumdule["Blue"] = 1] = "Blue"; })(enumdule || (enumdule = {})); (function (enumdule) { - var Point = /** @class */ (function () { - function Point(x, y) { + class Point { + constructor(x, y) { this.x = x; this.y = y; } - return Point; - }()); + } enumdule.Point = Point; })(enumdule || (enumdule = {})); var x; diff --git a/tests/baselines/reference/ExportAssignment7.js b/tests/baselines/reference/ExportAssignment7.js index b700e79cfcb3c..b905bd99d6da7 100644 --- a/tests/baselines/reference/ExportAssignment7.js +++ b/tests/baselines/reference/ExportAssignment7.js @@ -9,9 +9,6 @@ export = B; //// [ExportAssignment7.js] "use strict"; exports.C = void 0; -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { +} module.exports = B; diff --git a/tests/baselines/reference/ExportAssignment8.js b/tests/baselines/reference/ExportAssignment8.js index 436c5262c5481..8a5accb005a43 100644 --- a/tests/baselines/reference/ExportAssignment8.js +++ b/tests/baselines/reference/ExportAssignment8.js @@ -9,9 +9,6 @@ export class C { //// [ExportAssignment8.js] "use strict"; exports.C = void 0; -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { +} module.exports = B; diff --git a/tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.js b/tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.js index 5e55dc15be60a..cfb8f415a6125 100644 --- a/tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.js +++ b/tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.js @@ -24,15 +24,14 @@ namespace A { //// [ExportClassWhichExtendsInterfaceWithInaccessibleType.js] var A; (function (A) { - var Point2d = /** @class */ (function () { - function Point2d(x, y) { + class Point2d { + constructor(x, y) { this.x = x; this.y = y; } - Point2d.prototype.fromOrigin = function (p) { + fromOrigin(p) { return 1; - }; - return Point2d; - }()); + } + } A.Point2d = Point2d; })(A || (A = {})); diff --git a/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js index 450891120fd51..5bc5f88617903 100644 --- a/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js +++ b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js @@ -23,45 +23,21 @@ namespace A { //// [ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); var A; (function (A) { - var Point = /** @class */ (function () { - function Point() { - } - return Point; - }()); + class Point { + } A.Point = Point; A.Origin = { x: 0, y: 0 }; - var Point3d = /** @class */ (function (_super) { - __extends(Point3d, _super); - function Point3d() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Point3d; - }(Point)); + class Point3d extends Point { + } A.Point3d = Point3d; A.Origin3d = { x: 0, y: 0, z: 0 }; - var Line = /** @class */ (function () { - function Line(start, end) { + class Line { + constructor(start, end) { this.start = start; this.end = end; } - return Line; - }()); + } A.Line = Line; })(A || (A = {})); diff --git a/tests/baselines/reference/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.js b/tests/baselines/reference/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.js index 9a2fcad55accc..b8dde61f184f7 100644 --- a/tests/baselines/reference/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.js +++ b/tests/baselines/reference/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.js @@ -20,15 +20,9 @@ namespace A { //// [ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.js] var A; (function (A) { - var Point = /** @class */ (function () { - function Point() { - } - return Point; - }()); - var points = /** @class */ (function () { - function points() { - } - return points; - }()); + class Point { + } + class points { + } A.points = points; })(A || (A = {})); diff --git a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js index 6cbc55e50dbe3..ed4d8fcd03c5a 100644 --- a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js +++ b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js @@ -27,47 +27,23 @@ namespace A { //// [ExportClassWithInaccessibleTypeInTypeParameterConstraint.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); var A; (function (A) { - var Point = /** @class */ (function () { - function Point() { - } - return Point; - }()); + class Point { + } A.Origin = { x: 0, y: 0 }; - var Point3d = /** @class */ (function (_super) { - __extends(Point3d, _super); - function Point3d() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Point3d; - }(Point)); + class Point3d extends Point { + } A.Point3d = Point3d; A.Origin3d = { x: 0, y: 0, z: 0 }; - var Line = /** @class */ (function () { - function Line(start, end) { + class Line { + constructor(start, end) { this.start = start; this.end = end; } - Line.fromorigin2d = function (p) { + static fromorigin2d(p) { return null; - }; - return Line; - }()); + } + } A.Line = Line; })(A || (A = {})); diff --git a/tests/baselines/reference/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.js b/tests/baselines/reference/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.js index ad6d2b8e60e7b..4593cc08e5e2c 100644 --- a/tests/baselines/reference/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.js +++ b/tests/baselines/reference/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.js @@ -20,19 +20,15 @@ namespace A { //// [ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.js] var A; (function (A) { - var Point = /** @class */ (function () { - function Point() { - } - return Point; - }()); + class Point { + } A.Point = Point; - var Line = /** @class */ (function () { - function Line(start, end) { + class Line { + constructor(start, end) { this.start = start; this.end = end; } - return Line; - }()); + } A.Line = Line; function fromOrigin(p) { return new Line({ x: 0, y: 0 }, p); diff --git a/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.js b/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.js index f8fa7861814ab..0ed1326e526b2 100644 --- a/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.js +++ b/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.js @@ -20,18 +20,14 @@ namespace A { //// [ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.js] var A; (function (A) { - var Point = /** @class */ (function () { - function Point() { - } - return Point; - }()); - var Line = /** @class */ (function () { - function Line(start, end) { + class Point { + } + class Line { + constructor(start, end) { this.start = start; this.end = end; } - return Line; - }()); + } A.Line = Line; function fromOrigin(p) { return new Line({ x: 0, y: 0 }, p); diff --git a/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.js b/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.js index d6489f6061f5f..2971123fa6da6 100644 --- a/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.js +++ b/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.js @@ -20,19 +20,15 @@ namespace A { //// [ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.js] var A; (function (A) { - var Point = /** @class */ (function () { - function Point() { - } - return Point; - }()); + class Point { + } A.Point = Point; - var Line = /** @class */ (function () { - function Line(start, end) { + class Line { + constructor(start, end) { this.start = start; this.end = end; } - return Line; - }()); + } function fromOrigin(p) { return new Line({ x: 0, y: 0 }, p); } diff --git a/tests/baselines/reference/ExportModuleWithAccessibleTypesOnItsExportedMembers.js b/tests/baselines/reference/ExportModuleWithAccessibleTypesOnItsExportedMembers.js index 9f493380db4c9..7b5e31c8d3353 100644 --- a/tests/baselines/reference/ExportModuleWithAccessibleTypesOnItsExportedMembers.js +++ b/tests/baselines/reference/ExportModuleWithAccessibleTypesOnItsExportedMembers.js @@ -25,25 +25,23 @@ namespace A { //// [ExportModuleWithAccessibleTypesOnItsExportedMembers.js] var A; (function (A) { - var Point = /** @class */ (function () { - function Point(x, y) { + class Point { + constructor(x, y) { this.x = x; this.y = y; } - return Point; - }()); + } A.Point = Point; - var B; + let B; (function (B) { B.Origin = new Point(0, 0); - var Line = /** @class */ (function () { - function Line(start, end) { + class Line { + constructor(start, end) { } - Line.fromOrigin = function (p) { + static fromOrigin(p) { return new Line({ x: 0, y: 0 }, p); - }; - return Line; - }()); + } + } B.Line = Line; })(B = A.B || (A.B = {})); })(A || (A = {})); diff --git a/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.js b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.js index 6f31bca303164..2f3630539aaa0 100644 --- a/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.js +++ b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.js @@ -16,13 +16,12 @@ namespace A { //// [ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.js] var A; (function (A) { - var Point = /** @class */ (function () { - function Point(x, y) { + class Point { + constructor(x, y) { this.x = x; this.y = y; } - 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 1c4f77934b6a6..e89b61ccb7e12 100644 --- a/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.js +++ b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.js @@ -16,12 +16,11 @@ namespace A { //// [ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.js] var A; (function (A) { - var Point = /** @class */ (function () { - function Point(x, y) { + class Point { + constructor(x, y) { this.x = x; this.y = y; } - return Point; - }()); + } A.UnitSquare = null; })(A || (A = {})); diff --git a/tests/baselines/reference/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.js b/tests/baselines/reference/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.js index 6a209583d3531..c7fdf2060f47e 100644 --- a/tests/baselines/reference/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.js +++ b/tests/baselines/reference/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.js @@ -13,10 +13,7 @@ namespace A { //// [ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.js] var A; (function (A) { - var B = /** @class */ (function () { - function B() { - } - return B; - }()); + class B { + } A.beez2 = new Array(); })(A || (A = {})); diff --git a/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.js b/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.js index 28bb71b193794..b41f9abb29659 100644 --- a/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.js @@ -54,7 +54,7 @@ var A; //// [module.js] var A; (function (A) { - var Point; + let Point; (function (Point) { Point.Origin = { x: 0, y: 0 }; })(Point = A.Point || (A.Point = {})); diff --git a/tests/baselines/reference/FunctionAndModuleWithSameNameAndDifferentCommonRoot.js b/tests/baselines/reference/FunctionAndModuleWithSameNameAndDifferentCommonRoot.js index 15d86e1c7325e..73ca62dcd88f1 100644 --- a/tests/baselines/reference/FunctionAndModuleWithSameNameAndDifferentCommonRoot.js +++ b/tests/baselines/reference/FunctionAndModuleWithSameNameAndDifferentCommonRoot.js @@ -33,7 +33,7 @@ var A; //// [module.js] var B; (function (B) { - var Point; + let Point; (function (Point) { Point.Origin = { x: 0, y: 0 }; })(Point = B.Point || (B.Point = {})); diff --git a/tests/baselines/reference/FunctionDeclaration8_es6.js b/tests/baselines/reference/FunctionDeclaration8_es6.js index 99453bca92a8a..114f8a31dfc09 100644 --- a/tests/baselines/reference/FunctionDeclaration8_es6.js +++ b/tests/baselines/reference/FunctionDeclaration8_es6.js @@ -4,5 +4,4 @@ var v = { [yield]: foo } //// [FunctionDeclaration8_es6.js] -var _a; -var v = (_a = {}, _a[yield] = foo, _a); +var v = { [yield]: foo }; diff --git a/tests/baselines/reference/MemberAccessorDeclaration15.js b/tests/baselines/reference/MemberAccessorDeclaration15.js index 4d3b763e8e3bb..126c5f798e8a6 100644 --- a/tests/baselines/reference/MemberAccessorDeclaration15.js +++ b/tests/baselines/reference/MemberAccessorDeclaration15.js @@ -6,13 +6,6 @@ class C { } //// [MemberAccessorDeclaration15.js] -var C = /** @class */ (function () { - function C() { - } - Object.defineProperty(C.prototype, "Foo", { - set: function (a) { }, - enumerable: false, - configurable: true - }); - return C; -}()); +class C { + set Foo(a) { } +} diff --git a/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.js b/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.js index 170371d4cba1a..b58b60a1471a5 100644 --- a/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.js @@ -36,7 +36,7 @@ var X; (function (X) { var Y; (function (Y) { - var Point; + let Point; (function (Point) { Point.Origin = new Point(0, 0); })(Point = Y.Point || (Y.Point = {})); @@ -48,13 +48,12 @@ var X; var Y; (function (Y) { // duplicate identifier - var Point = /** @class */ (function () { - function Point(x, y) { + class Point { + constructor(x, y) { this.x = x; this.y = y; } - return Point; - }()); + } Y.Point = Point; })(Y = X.Y || (X.Y = {})); })(X || (X = {})); @@ -64,8 +63,5 @@ var A; A.Instance = new A(); })(A || (A = {})); // duplicate identifier -var A = /** @class */ (function () { - function A() { - } - return A; -}()); +class A { +} diff --git a/tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.js b/tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.js index e9f9583ff3fec..a83ab20eed641 100644 --- a/tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.js @@ -21,13 +21,12 @@ var y = new enumdule.Point(0, 0); //// [ModuleAndEnumWithSameNameAndCommonRoot.js] var enumdule; (function (enumdule) { - var Point = /** @class */ (function () { - function Point(x, y) { + class Point { + constructor(x, y) { this.x = x; this.y = y; } - return Point; - }()); + } enumdule.Point = Point; })(enumdule || (enumdule = {})); (function (enumdule) { diff --git a/tests/baselines/reference/ModuleAndFunctionWithSameNameAndCommonRoot.js b/tests/baselines/reference/ModuleAndFunctionWithSameNameAndCommonRoot.js index b4441249deafd..305592b816244 100644 --- a/tests/baselines/reference/ModuleAndFunctionWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/ModuleAndFunctionWithSameNameAndCommonRoot.js @@ -32,7 +32,7 @@ namespace B { //// [module.js] var A; (function (A) { - var Point; + let Point; (function (Point) { Point.Origin = { x: 0, y: 0 }; })(Point = A.Point || (A.Point = {})); @@ -49,7 +49,7 @@ var A; //// [simple.js] var B; (function (B) { - var Point; + let Point; (function (Point) { Point.Origin = { x: 0, y: 0 }; })(Point = B.Point || (B.Point = {})); diff --git a/tests/baselines/reference/ModuleWithExportedAndNonExportedClasses.js b/tests/baselines/reference/ModuleWithExportedAndNonExportedClasses.js index d9b0c2039686c..674e4cc2c336f 100644 --- a/tests/baselines/reference/ModuleWithExportedAndNonExportedClasses.js +++ b/tests/baselines/reference/ModuleWithExportedAndNonExportedClasses.js @@ -38,28 +38,16 @@ var ag2 = new A.A2(); //// [ModuleWithExportedAndNonExportedClasses.js] var A; (function (A_1) { - var A = /** @class */ (function () { - function A() { - } - return A; - }()); + class A { + } A_1.A = A; - var AG = /** @class */ (function () { - function AG() { - } - return AG; - }()); + class AG { + } A_1.AG = AG; - var A2 = /** @class */ (function () { - function A2() { - } - return A2; - }()); - var AG2 = /** @class */ (function () { - function AG2() { - } - return AG2; - }()); + class A2 { + } + class AG2 { + } })(A || (A = {})); // no errors expected, these are all exported var a; diff --git a/tests/baselines/reference/ModuleWithExportedAndNonExportedEnums.js b/tests/baselines/reference/ModuleWithExportedAndNonExportedEnums.js index 2cdf02f5f97de..7cc7f1d0d3b29 100644 --- a/tests/baselines/reference/ModuleWithExportedAndNonExportedEnums.js +++ b/tests/baselines/reference/ModuleWithExportedAndNonExportedEnums.js @@ -16,12 +16,12 @@ var b = A.Day.Monday; //// [ModuleWithExportedAndNonExportedEnums.js] var A; (function (A) { - var Color; + let Color; (function (Color) { Color[Color["Red"] = 0] = "Red"; Color[Color["Blue"] = 1] = "Blue"; })(Color = A.Color || (A.Color = {})); - var Day; + let Day; (function (Day) { Day[Day["Monday"] = 0] = "Monday"; Day[Day["Tuesday"] = 1] = "Tuesday"; diff --git a/tests/baselines/reference/ModuleWithExportedAndNonExportedImportAlias.js b/tests/baselines/reference/ModuleWithExportedAndNonExportedImportAlias.js index c666185e82bf9..eaea0758bedd9 100644 --- a/tests/baselines/reference/ModuleWithExportedAndNonExportedImportAlias.js +++ b/tests/baselines/reference/ModuleWithExportedAndNonExportedImportAlias.js @@ -44,13 +44,12 @@ var line = Geometry.Lines.Line; //// [ModuleWithExportedAndNonExportedImportAlias.js] var B; (function (B) { - var Line = /** @class */ (function () { - function Line(start, end) { + class Line { + constructor(start, end) { this.start = start; this.end = end; } - return Line; - }()); + } B.Line = Line; })(B || (B = {})); var Geometry; diff --git a/tests/baselines/reference/NonInitializedExportInInternalModule.js b/tests/baselines/reference/NonInitializedExportInInternalModule.js index 0273474a2c11c..ecc4cb85f4043 100644 --- a/tests/baselines/reference/NonInitializedExportInInternalModule.js +++ b/tests/baselines/reference/NonInitializedExportInInternalModule.js @@ -41,17 +41,14 @@ var Inner; (function (Inner) { var ; let; - var ; - var A = /** @class */ (function () { - function A() { - } - return A; - }()); - var B; + const ; + class A { + } + let B; (function (B) { B.a = 1, B.c = 2; })(B || (B = {})); - var C; + let C; (function (C) { C.a = 1, C.c = 2; })(C || (C = {})); @@ -60,11 +57,8 @@ var Inner; Inner.b1 = 1; Inner.c1 = 'a'; Inner.d1 = 1; - var D = /** @class */ (function () { - function D() { - } - return D; - }()); + class D { + } Inner.e1 = new D; Inner.f1 = new D; Inner.g1 = new D; diff --git a/tests/baselines/reference/ParameterList6.js b/tests/baselines/reference/ParameterList6.js index 7ccd946b44433..42eebf7339892 100644 --- a/tests/baselines/reference/ParameterList6.js +++ b/tests/baselines/reference/ParameterList6.js @@ -7,8 +7,7 @@ class C { } //// [ParameterList6.js] -var C = /** @class */ (function () { - function C(C) { +class C { + constructor(C) { } - return C; -}()); +} diff --git a/tests/baselines/reference/ParameterList7.js b/tests/baselines/reference/ParameterList7.js index 57eadcb8da30f..f62bda39e684c 100644 --- a/tests/baselines/reference/ParameterList7.js +++ b/tests/baselines/reference/ParameterList7.js @@ -8,9 +8,8 @@ class C1 { } //// [ParameterList7.js] -var C1 = /** @class */ (function () { - function C1(p3) { +class C1 { + constructor(p3) { this.p3 = p3; } // OK - return C1; -}()); +} diff --git a/tests/baselines/reference/Protected1.js b/tests/baselines/reference/Protected1.js index b7a1f4eaa48bf..f342e0d3efa78 100644 --- a/tests/baselines/reference/Protected1.js +++ b/tests/baselines/reference/Protected1.js @@ -5,8 +5,5 @@ protected class C { } //// [Protected1.js] -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { +} diff --git a/tests/baselines/reference/Protected3.js b/tests/baselines/reference/Protected3.js index 4fe3e0a4c5c5d..06e6054bd6950 100644 --- a/tests/baselines/reference/Protected3.js +++ b/tests/baselines/reference/Protected3.js @@ -6,8 +6,6 @@ class C { } //// [Protected3.js] -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { + constructor() { } +} diff --git a/tests/baselines/reference/Protected4.js b/tests/baselines/reference/Protected4.js index 67232f9d1edf8..75cfa2a7c6a68 100644 --- a/tests/baselines/reference/Protected4.js +++ b/tests/baselines/reference/Protected4.js @@ -6,9 +6,6 @@ class C { } //// [Protected4.js] -var C = /** @class */ (function () { - function C() { - } - C.prototype.m = function () { }; - return C; -}()); +class C { + m() { } +} diff --git a/tests/baselines/reference/Protected5.js b/tests/baselines/reference/Protected5.js index a2ee17321590f..537f8234b6e32 100644 --- a/tests/baselines/reference/Protected5.js +++ b/tests/baselines/reference/Protected5.js @@ -6,9 +6,6 @@ class C { } //// [Protected5.js] -var C = /** @class */ (function () { - function C() { - } - C.m = function () { }; - return C; -}()); +class C { + static m() { } +} diff --git a/tests/baselines/reference/Protected6.js b/tests/baselines/reference/Protected6.js index 5a34d06deea46..384830949b4b7 100644 --- a/tests/baselines/reference/Protected6.js +++ b/tests/baselines/reference/Protected6.js @@ -6,9 +6,6 @@ class C { } //// [Protected6.js] -var C = /** @class */ (function () { - function C() { - } - C.m = function () { }; - return C; -}()); +class C { + static m() { } +} diff --git a/tests/baselines/reference/Protected7.js b/tests/baselines/reference/Protected7.js index 022c1468c7160..d965c7b9d6ca0 100644 --- a/tests/baselines/reference/Protected7.js +++ b/tests/baselines/reference/Protected7.js @@ -6,9 +6,6 @@ class C { } //// [Protected7.js] -var C = /** @class */ (function () { - function C() { - } - C.prototype.m = function () { }; - return C; -}()); +class C { + m() { } +} diff --git a/tests/baselines/reference/Protected9.js b/tests/baselines/reference/Protected9.js index d9a9d81000973..2088595fe56cb 100644 --- a/tests/baselines/reference/Protected9.js +++ b/tests/baselines/reference/Protected9.js @@ -6,9 +6,8 @@ class C { } //// [Protected9.js] -var C = /** @class */ (function () { - function C(p) { +class C { + constructor(p) { this.p = p; } - return C; -}()); +} diff --git a/tests/baselines/reference/TemplateExpression1.js b/tests/baselines/reference/TemplateExpression1.js index 5bd36658939ec..ada7989792446 100644 --- a/tests/baselines/reference/TemplateExpression1.js +++ b/tests/baselines/reference/TemplateExpression1.js @@ -4,4 +4,4 @@ var v = `foo ${ a //// [TemplateExpression1.js] -var v = "foo ".concat(a); +var v = `foo ${a; diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.js b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.js index 11dc78314e9f7..1ebda368cb584 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.js +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.js @@ -45,22 +45,16 @@ var l: X.Y.Z.Line; //// [TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.js] var A; (function (A) { - var Point = /** @class */ (function () { - function Point() { - } - return Point; - }()); + class Point { + } A.Point = Point; })(A || (A = {})); (function (A) { - var Point = /** @class */ (function () { - function Point() { - } - Point.prototype.fromCarthesian = function (p) { + class Point { + fromCarthesian(p) { return { x: p.x, y: p.y }; - }; - return Point; - }()); + } + } })(A || (A = {})); // ensure merges as expected var p; @@ -71,25 +65,19 @@ var X; (function (Y) { var Z; (function (Z) { - var Line = /** @class */ (function () { - function Line() { - } - return Line; - }()); + class Line { + } Z.Line = Line; })(Z = Y.Z || (Y.Z = {})); })(Y = X.Y || (X.Y = {})); })(X || (X = {})); (function (X) { - var Y; + let Y; (function (Y) { - var Z; + let Z; (function (Z) { - var Line = /** @class */ (function () { - function Line() { - } - return Line; - }()); + class Line { + } })(Z = Y.Z || (Y.Z = {})); })(Y = X.Y || (X.Y = {})); })(X || (X = {})); diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.js b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.js index 54f168e3f52e0..ca5e9f124eb2a 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.js +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.js @@ -44,7 +44,7 @@ var p = new A.Utils.Plane(o, { x: 1, y: 1 }); //// [part1.js] var A; (function (A) { - var Utils; + let Utils; (function (Utils) { function mirror(p) { return { x: p.y, y: p.x }; @@ -58,15 +58,14 @@ var A; (function (A) { // not a collision, since we don't export var Origin = "0,0"; - var Utils; + let Utils; (function (Utils) { - var Plane = /** @class */ (function () { - function Plane(tl, br) { + class Plane { + constructor(tl, br) { this.tl = tl; this.br = br; } - return Plane; - }()); + } Utils.Plane = Plane; })(Utils = A.Utils || (A.Utils = {})); })(A || (A = {})); diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.js b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.js index f5285b0f7de52..e99534b34e351 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.js +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.js @@ -37,20 +37,14 @@ namespace X { //// [TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.js] var A; (function (A) { - var Point = /** @class */ (function () { - function Point() { - } - return Point; - }()); + class Point { + } A.Point = Point; })(A || (A = {})); (function (A) { // expected error - var Point = /** @class */ (function () { - function Point() { - } - return Point; - }()); + class Point { + } A.Point = Point; })(A || (A = {})); var X; @@ -59,26 +53,20 @@ var X; (function (Y) { var Z; (function (Z) { - var Line = /** @class */ (function () { - function Line() { - } - return Line; - }()); + class Line { + } Z.Line = Line; })(Z = Y.Z || (Y.Z = {})); })(Y = X.Y || (X.Y = {})); })(X || (X = {})); (function (X) { - var Y; + let Y; (function (Y) { - var Z; + let Z; (function (Z) { // expected error - var Line = /** @class */ (function () { - function Line() { - } - return Line; - }()); + class Line { + } Z.Line = Line; })(Z = Y.Z || (Y.Z = {})); })(Y = X.Y || (X.Y = {})); diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.js b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.js index 3b491e270d92d..1b6a6033cf6d2 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.js +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.js @@ -35,7 +35,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.A = void 0; var A; (function (A) { - var Utils; + let Utils; (function (Utils) { function mirror(p) { return { x: p.y, y: p.x }; @@ -52,15 +52,14 @@ var A; (function (A) { // collision with 'Origin' var in other part of merged module A.Origin = { x: 0, y: 0 }; - var Utils; + let Utils; (function (Utils) { - var Plane = /** @class */ (function () { - function Plane(tl, br) { + class Plane { + constructor(tl, br) { this.tl = tl; this.br = br; } - return Plane; - }()); + } Utils.Plane = Plane; })(Utils = A.Utils || (A.Utils = {})); })(A || (exports.A = A = {})); diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.js b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.js index e7ee79902558f..c804721aa5ecc 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.js +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.js @@ -44,7 +44,7 @@ var A; })(B = A.B || (A.B = {})); })(A || (A = {})); (function (A) { - var B; + let B; (function (B) { })(B || (B = {})); })(A || (A = {})); @@ -57,25 +57,19 @@ var X; (function (Y) { var Z; (function (Z) { - var Line = /** @class */ (function () { - function Line() { - } - return Line; - }()); + class Line { + } Z.Line = Line; })(Z = Y.Z || (Y.Z = {})); })(Y = X.Y || (X.Y = {})); })(X || (X = {})); (function (X) { - var Y; + let Y; (function (Y) { - var Z; + let Z; (function (Z) { - var Line = /** @class */ (function () { - function Line() { - } - return Line; - }()); + class Line { + } Z.Line = Line; })(Z || (Z = {})); })(Y = X.Y || (X.Y = {})); diff --git a/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.js b/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.js index b4e3df988acde..b5d0a4c3fa616 100644 --- a/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.js +++ b/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.js @@ -33,9 +33,9 @@ namespace otherRoot { //// [part1.js] var Root; (function (Root) { - var A; + let A; (function (A) { - var Utils; + let Utils; (function (Utils) { function mirror(p) { return { x: p.y, y: p.x }; @@ -47,19 +47,18 @@ var Root; //// [part2.js] var otherRoot; (function (otherRoot) { - var A; + let A; (function (A) { // have to be fully qualified since in different root A.Origin = { x: 0, y: 0 }; - var Utils; + let Utils; (function (Utils) { - var Plane = /** @class */ (function () { - function Plane(tl, br) { + class Plane { + constructor(tl, br) { this.tl = tl; this.br = br; } - return Plane; - }()); + } Utils.Plane = Plane; })(Utils = A.Utils || (A.Utils = {})); })(A = otherRoot.A || (otherRoot.A = {})); diff --git a/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndSameCommonRoot.js b/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndSameCommonRoot.js index 0b39efa124d75..364e8a2e7c766 100644 --- a/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndSameCommonRoot.js +++ b/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndSameCommonRoot.js @@ -42,7 +42,7 @@ var p = new A.Utils.Plane(o, { x: 1, y: 1 }); //// [part1.js] var A; (function (A) { - var Utils; + let Utils; (function (Utils) { function mirror(p) { return { x: p.y, y: p.x }; @@ -54,15 +54,14 @@ var A; var A; (function (A) { A.Origin = { x: 0, y: 0 }; - var Utils; + let Utils; (function (Utils) { - var Plane = /** @class */ (function () { - function Plane(tl, br) { + class Plane { + constructor(tl, br) { this.tl = tl; this.br = br; } - return Plane; - }()); + } Utils.Plane = Plane; })(Utils = A.Utils || (A.Utils = {})); })(A || (A = {})); diff --git a/tests/baselines/reference/TypeGuardWithArrayUnion.js b/tests/baselines/reference/TypeGuardWithArrayUnion.js index e52e11ff3fa71..fda6574e2d060 100644 --- a/tests/baselines/reference/TypeGuardWithArrayUnion.js +++ b/tests/baselines/reference/TypeGuardWithArrayUnion.js @@ -13,11 +13,8 @@ function saySize(message: Message | Message[]) { //// [TypeGuardWithArrayUnion.js] -var Message = /** @class */ (function () { - function Message() { - } - return Message; -}()); +class Message { +} function saySize(message) { if (message instanceof Array) { return message.length; // Should have type Message[] here diff --git a/tests/baselines/reference/abstractClassInLocalScope.js b/tests/baselines/reference/abstractClassInLocalScope.js index 33ac1f8a647bd..67990f045fd7c 100644 --- a/tests/baselines/reference/abstractClassInLocalScope.js +++ b/tests/baselines/reference/abstractClassInLocalScope.js @@ -10,34 +10,11 @@ //// [abstractClassInLocalScope.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -(function () { - var A = /** @class */ (function () { - function A() { - } - return A; - }()); - var B = /** @class */ (function (_super) { - __extends(B, _super); - function B() { - return _super !== null && _super.apply(this, arguments) || this; - } - return B; - }(A)); +(() => { + class A { + } + class B extends A { + } new B(); return A; })(); diff --git a/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js b/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js index c26fa08b26423..1b0c13d877935 100644 --- a/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js +++ b/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js @@ -10,34 +10,11 @@ //// [abstractClassInLocalScopeIsAbstract.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -(function () { - var A = /** @class */ (function () { - function A() { - } - return A; - }()); - var B = /** @class */ (function (_super) { - __extends(B, _super); - function B() { - return _super !== null && _super.apply(this, arguments) || this; - } - return B; - }(A)); +(() => { + class A { + } + class B extends A { + } new A(); new B(); })(); diff --git a/tests/baselines/reference/abstractClassUnionInstantiation.js b/tests/baselines/reference/abstractClassUnionInstantiation.js index 6f28f395ec709..daef675355adc 100644 --- a/tests/baselines/reference/abstractClassUnionInstantiation.js +++ b/tests/baselines/reference/abstractClassUnionInstantiation.js @@ -24,30 +24,18 @@ new cls3(); // should work [AbstractA, AbstractB].map(cls => new cls()); // should error //// [abstractClassUnionInstantiation.js] -var ConcreteA = /** @class */ (function () { - function ConcreteA() { - } - return ConcreteA; -}()); -var ConcreteB = /** @class */ (function () { - function ConcreteB() { - } - return ConcreteB; -}()); -var AbstractA = /** @class */ (function () { - function AbstractA() { - } - return AbstractA; -}()); -var AbstractB = /** @class */ (function () { - function AbstractB() { - } - return AbstractB; -}()); +class ConcreteA { +} +class ConcreteB { +} +class AbstractA { +} +class AbstractB { +} new cls1(); // should error new cls2(); // should error new cls3(); // should work -[ConcreteA, AbstractA, AbstractB].map(function (cls) { return new cls(); }); // should error -[AbstractA, AbstractB, ConcreteA].map(function (cls) { return new cls(); }); // should error -[ConcreteA, ConcreteB].map(function (cls) { return new cls(); }); // should work -[AbstractA, AbstractB].map(function (cls) { return new cls(); }); // should error +[ConcreteA, AbstractA, AbstractB].map(cls => new cls()); // should error +[AbstractA, AbstractB, ConcreteA].map(cls => new cls()); // should error +[ConcreteA, ConcreteB].map(cls => new cls()); // should work +[AbstractA, AbstractB].map(cls => new cls()); // should error diff --git a/tests/baselines/reference/abstractPropertyBasics(target=es2015).js b/tests/baselines/reference/abstractPropertyBasics(target=es2015).js new file mode 100644 index 0000000000000..dbc3fa5095331 --- /dev/null +++ b/tests/baselines/reference/abstractPropertyBasics(target=es2015).js @@ -0,0 +1,38 @@ +//// [tests/cases/compiler/abstractPropertyBasics.ts] //// + +//// [abstractPropertyBasics.ts] +interface A { + prop: string; + raw: string; + m(): void; +} +abstract class B implements A { + abstract prop: string; + abstract raw: string; + abstract readonly ro: string; + abstract get readonlyProp(): string; + abstract set readonlyProp(val: string); + abstract m(): void; +} +class C extends B { + get prop() { return "foo"; } + set prop(v) { } + raw = "edge"; + readonly ro = "readonly please"; + readonlyProp!: string; + m() { } +} + +//// [abstractPropertyBasics.js] +class B { +} +class C extends B { + constructor() { + super(...arguments); + this.raw = "edge"; + this.ro = "readonly please"; + } + get prop() { return "foo"; } + set prop(v) { } + m() { } +} diff --git a/tests/baselines/reference/abstractPropertyBasics.symbols b/tests/baselines/reference/abstractPropertyBasics(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/abstractPropertyBasics.symbols rename to tests/baselines/reference/abstractPropertyBasics(target=es2015).symbols diff --git a/tests/baselines/reference/abstractPropertyBasics.types b/tests/baselines/reference/abstractPropertyBasics(target=es2015).types similarity index 100% rename from tests/baselines/reference/abstractPropertyBasics.types rename to tests/baselines/reference/abstractPropertyBasics(target=es2015).types diff --git a/tests/baselines/reference/abstractPropertyBasics.js b/tests/baselines/reference/abstractPropertyBasics(target=es5).js similarity index 100% rename from tests/baselines/reference/abstractPropertyBasics.js rename to tests/baselines/reference/abstractPropertyBasics(target=es5).js diff --git a/tests/baselines/reference/abstractPropertyBasics(target=es5).symbols b/tests/baselines/reference/abstractPropertyBasics(target=es5).symbols new file mode 100644 index 0000000000000..b251e283c2965 --- /dev/null +++ b/tests/baselines/reference/abstractPropertyBasics(target=es5).symbols @@ -0,0 +1,61 @@ +//// [tests/cases/compiler/abstractPropertyBasics.ts] //// + +=== abstractPropertyBasics.ts === +interface A { +>A : Symbol(A, Decl(abstractPropertyBasics.ts, 0, 0)) + + prop: string; +>prop : Symbol(A.prop, Decl(abstractPropertyBasics.ts, 0, 13)) + + raw: string; +>raw : Symbol(A.raw, Decl(abstractPropertyBasics.ts, 1, 17)) + + m(): void; +>m : Symbol(A.m, Decl(abstractPropertyBasics.ts, 2, 16)) +} +abstract class B implements A { +>B : Symbol(B, Decl(abstractPropertyBasics.ts, 4, 1)) +>A : Symbol(A, Decl(abstractPropertyBasics.ts, 0, 0)) + + abstract prop: string; +>prop : Symbol(B.prop, Decl(abstractPropertyBasics.ts, 5, 31)) + + abstract raw: string; +>raw : Symbol(B.raw, Decl(abstractPropertyBasics.ts, 6, 26)) + + abstract readonly ro: string; +>ro : Symbol(B.ro, Decl(abstractPropertyBasics.ts, 7, 25)) + + abstract get readonlyProp(): string; +>readonlyProp : Symbol(B.readonlyProp, Decl(abstractPropertyBasics.ts, 8, 33), Decl(abstractPropertyBasics.ts, 9, 40)) + + abstract set readonlyProp(val: string); +>readonlyProp : Symbol(B.readonlyProp, Decl(abstractPropertyBasics.ts, 8, 33), Decl(abstractPropertyBasics.ts, 9, 40)) +>val : Symbol(val, Decl(abstractPropertyBasics.ts, 10, 30)) + + abstract m(): void; +>m : Symbol(B.m, Decl(abstractPropertyBasics.ts, 10, 43)) +} +class C extends B { +>C : Symbol(C, Decl(abstractPropertyBasics.ts, 12, 1)) +>B : Symbol(B, Decl(abstractPropertyBasics.ts, 4, 1)) + + get prop() { return "foo"; } +>prop : Symbol(C.prop, Decl(abstractPropertyBasics.ts, 13, 19), Decl(abstractPropertyBasics.ts, 14, 32)) + + set prop(v) { } +>prop : Symbol(C.prop, Decl(abstractPropertyBasics.ts, 13, 19), Decl(abstractPropertyBasics.ts, 14, 32)) +>v : Symbol(v, Decl(abstractPropertyBasics.ts, 15, 13)) + + raw = "edge"; +>raw : Symbol(C.raw, Decl(abstractPropertyBasics.ts, 15, 19)) + + readonly ro = "readonly please"; +>ro : Symbol(C.ro, Decl(abstractPropertyBasics.ts, 16, 17)) + + readonlyProp!: string; +>readonlyProp : Symbol(C.readonlyProp, Decl(abstractPropertyBasics.ts, 17, 36)) + + m() { } +>m : Symbol(C.m, Decl(abstractPropertyBasics.ts, 18, 26)) +} diff --git a/tests/baselines/reference/abstractPropertyBasics(target=es5).types b/tests/baselines/reference/abstractPropertyBasics(target=es5).types new file mode 100644 index 0000000000000..c62b71a86e149 --- /dev/null +++ b/tests/baselines/reference/abstractPropertyBasics(target=es5).types @@ -0,0 +1,84 @@ +//// [tests/cases/compiler/abstractPropertyBasics.ts] //// + +=== abstractPropertyBasics.ts === +interface A { + prop: string; +>prop : string +> : ^^^^^^ + + raw: string; +>raw : string +> : ^^^^^^ + + m(): void; +>m : () => void +> : ^^^^^^ +} +abstract class B implements A { +>B : B +> : ^ + + abstract prop: string; +>prop : string +> : ^^^^^^ + + abstract raw: string; +>raw : string +> : ^^^^^^ + + abstract readonly ro: string; +>ro : string +> : ^^^^^^ + + abstract get readonlyProp(): string; +>readonlyProp : string +> : ^^^^^^ + + abstract set readonlyProp(val: string); +>readonlyProp : string +> : ^^^^^^ +>val : string +> : ^^^^^^ + + abstract m(): void; +>m : () => void +> : ^^^^^^ +} +class C extends B { +>C : C +> : ^ +>B : B +> : ^ + + get prop() { return "foo"; } +>prop : string +> : ^^^^^^ +>"foo" : "foo" +> : ^^^^^ + + set prop(v) { } +>prop : string +> : ^^^^^^ +>v : string +> : ^^^^^^ + + raw = "edge"; +>raw : string +> : ^^^^^^ +>"edge" : "edge" +> : ^^^^^^ + + readonly ro = "readonly please"; +>ro : "readonly please" +> : ^^^^^^^^^^^^^^^^^ +>"readonly please" : "readonly please" +> : ^^^^^^^^^^^^^^^^^ + + readonlyProp!: string; +>readonlyProp : string +> : ^^^^^^ + + m() { } +>m : () => void +> : ^^^^^^^^^^ +} diff --git a/tests/baselines/reference/abstractPropertyInConstructor.js b/tests/baselines/reference/abstractPropertyInConstructor.js index 5656a8c9a6120..a237aad964662 100644 --- a/tests/baselines/reference/abstractPropertyInConstructor.js +++ b/tests/baselines/reference/abstractPropertyInConstructor.js @@ -96,97 +96,69 @@ class C2 { //// [abstractPropertyInConstructor.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var AbstractClass = /** @class */ (function () { - function AbstractClass(str, other) { - var _this = this; +class AbstractClass { + constructor(str, other) { this.other = this.prop; - this.fn = function () { return _this.prop; }; + this.fn = () => this.prop; this.method(parseInt(str)); - var val = this.prop.toLowerCase(); + let val = this.prop.toLowerCase(); if (!str) { this.prop = "Hello World"; } this.cb(str); // OK, reference is inside function - var innerFunction = function () { - return _this.prop; + const innerFunction = () => { + return this.prop; }; // OK, references are to another instance other.cb(other.prop); } - AbstractClass.prototype.method2 = function () { + method2() { this.prop = this.prop + "!"; - }; - return AbstractClass; -}()); -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) { }; + } +} +class DerivedAbstractClass extends AbstractClass { + constructor(str, other, yetAnother) { + super(str, other); + this.cb = (s) => { }; // there is no implementation of 'prop' in any base class - _this.cb(_this.prop.toLowerCase()); - _this.method(1); + this.cb(this.prop.toLowerCase()); + this.method(1); // OK, references are to another instance other.cb(other.prop); yetAnother.cb(yetAnother.prop); - return _this; } - return DerivedAbstractClass; -}(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 = ""; - _this.cb = function (s) { }; - _this.cb(_this.prop); - return _this; +} +class Implementation extends DerivedAbstractClass { + constructor(str, other, yetAnother) { + super(str, other, yetAnother); + this.prop = ""; + this.cb = (s) => { }; + this.cb(this.prop); } - Implementation.prototype.method = function (n) { + method(n) { this.cb(this.prop + n); - }; - return Implementation; -}(DerivedAbstractClass)); -var User = /** @class */ (function () { - function User(a) { + } +} +class User { + constructor(a) { a.prop; a.cb("hi"); a.method(12); a.method2(); } - return User; -}()); -var C1 = /** @class */ (function () { - function C1() { - var _a; - var self = this; // ok - var _b = this, x = _b.x, y1 = _b.y; // error - (_a = this, x = _a.x, y1 = _a.y, y1 = _a["y"]); // error +} +class C1 { + constructor() { + let self = this; // ok + let { x, y: y1 } = this; // error + ({ x, y: y1, "y": y1 } = this); // error } - return C1; -}()); -var C2 = /** @class */ (function () { - function C2() { - var _a; - var self = this; // ok - var _b = this, x = _b.x, y1 = _b.y; // ok - (_a = this, x = _a.x, y1 = _a.y, y1 = _a["y"]); // ok +} +class C2 { + constructor() { + let self = this; // ok + let { x, y: y1 } = this; // ok + ({ x, y: y1, "y": y1 } = this); // ok } - return C2; -}()); +} diff --git a/tests/baselines/reference/abstractPropertyInitializer.js b/tests/baselines/reference/abstractPropertyInitializer.js index edb169729b932..20bc62f280f08 100644 --- a/tests/baselines/reference/abstractPropertyInitializer.js +++ b/tests/baselines/reference/abstractPropertyInitializer.js @@ -8,11 +8,8 @@ abstract class C { //// [abstractPropertyInitializer.js] "use strict"; -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { +} //// [abstractPropertyInitializer.d.ts] diff --git a/tests/baselines/reference/abstractPropertyNegative.errors.txt b/tests/baselines/reference/abstractPropertyNegative(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/abstractPropertyNegative.errors.txt rename to tests/baselines/reference/abstractPropertyNegative(target=es2015).errors.txt diff --git a/tests/baselines/reference/abstractPropertyNegative(target=es2015).js b/tests/baselines/reference/abstractPropertyNegative(target=es2015).js new file mode 100644 index 0000000000000..6d8a2c7bd37a2 --- /dev/null +++ b/tests/baselines/reference/abstractPropertyNegative(target=es2015).js @@ -0,0 +1,83 @@ +//// [tests/cases/compiler/abstractPropertyNegative.ts] //// + +//// [abstractPropertyNegative.ts] +interface A { + prop: string; + m(): string; +} +abstract class B implements A { + abstract prop: string; + public abstract readonly ro: string; + abstract get readonlyProp(): string; + abstract m(): string; + abstract get mismatch(): string; + abstract set mismatch(val: number); +} +class C extends B { + readonly ro = "readonly please"; + abstract notAllowed: string; + get concreteWithNoBody(): string; +} +let c = new C(); +c.ro = "error: lhs of assignment can't be readonly"; + +abstract class WrongTypeProperty { + abstract num: number; +} +class WrongTypePropertyImpl extends WrongTypeProperty { + num = "nope, wrong"; +} +abstract class WrongTypeAccessor { + abstract get num(): number; +} +class WrongTypeAccessorImpl extends WrongTypeAccessor { + get num() { return "nope, wrong"; } +} +class WrongTypeAccessorImpl2 extends WrongTypeAccessor { + num = "nope, wrong"; +} + +abstract class AbstractAccessorMismatch { + abstract get p1(): string; + set p1(val: string) { }; + get p2(): string { return "should work"; } + abstract set p2(val: string); +} + + +//// [abstractPropertyNegative.js] +class B { +} +class C extends B { + constructor() { + super(...arguments); + this.ro = "readonly please"; + } + get concreteWithNoBody() { } +} +let c = new C(); +c.ro = "error: lhs of assignment can't be readonly"; +class WrongTypeProperty { +} +class WrongTypePropertyImpl extends WrongTypeProperty { + constructor() { + super(...arguments); + this.num = "nope, wrong"; + } +} +class WrongTypeAccessor { +} +class WrongTypeAccessorImpl extends WrongTypeAccessor { + get num() { return "nope, wrong"; } +} +class WrongTypeAccessorImpl2 extends WrongTypeAccessor { + constructor() { + super(...arguments); + this.num = "nope, wrong"; + } +} +class AbstractAccessorMismatch { + set p1(val) { } + ; + get p2() { return "should work"; } +} diff --git a/tests/baselines/reference/abstractPropertyNegative.symbols b/tests/baselines/reference/abstractPropertyNegative(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/abstractPropertyNegative.symbols rename to tests/baselines/reference/abstractPropertyNegative(target=es2015).symbols diff --git a/tests/baselines/reference/abstractPropertyNegative.types b/tests/baselines/reference/abstractPropertyNegative(target=es2015).types similarity index 100% rename from tests/baselines/reference/abstractPropertyNegative.types rename to tests/baselines/reference/abstractPropertyNegative(target=es2015).types diff --git a/tests/baselines/reference/abstractPropertyNegative(target=es5).errors.txt b/tests/baselines/reference/abstractPropertyNegative(target=es5).errors.txt new file mode 100644 index 0000000000000..34f7fd8e45361 --- /dev/null +++ b/tests/baselines/reference/abstractPropertyNegative(target=es5).errors.txt @@ -0,0 +1,85 @@ +abstractPropertyNegative.ts(13,7): error TS2654: Non-abstract class 'C' is missing implementations for the following members of 'B': 'prop', 'readonlyProp', 'm', 'mismatch'. +abstractPropertyNegative.ts(15,5): error TS1253: Abstract properties can only appear within an abstract class. +abstractPropertyNegative.ts(16,37): error TS1005: '{' expected. +abstractPropertyNegative.ts(19,3): error TS2540: Cannot assign to 'ro' because it is a read-only property. +abstractPropertyNegative.ts(25,5): error TS2416: Property 'num' in type 'WrongTypePropertyImpl' is not assignable to the same property in base type 'WrongTypeProperty'. + Type 'string' is not assignable to type 'number'. +abstractPropertyNegative.ts(31,9): error TS2416: Property 'num' in type 'WrongTypeAccessorImpl' is not assignable to the same property in base type 'WrongTypeAccessor'. + Type 'string' is not assignable to type 'number'. +abstractPropertyNegative.ts(34,5): error TS2416: Property 'num' in type 'WrongTypeAccessorImpl2' is not assignable to the same property in base type 'WrongTypeAccessor'. + Type 'string' is not assignable to type 'number'. +abstractPropertyNegative.ts(38,18): error TS2676: Accessors must both be abstract or non-abstract. +abstractPropertyNegative.ts(39,9): error TS2676: Accessors must both be abstract or non-abstract. +abstractPropertyNegative.ts(40,9): error TS2676: Accessors must both be abstract or non-abstract. +abstractPropertyNegative.ts(41,18): error TS2676: Accessors must both be abstract or non-abstract. + + +==== abstractPropertyNegative.ts (11 errors) ==== + interface A { + prop: string; + m(): string; + } + abstract class B implements A { + abstract prop: string; + public abstract readonly ro: string; + abstract get readonlyProp(): string; + abstract m(): string; + abstract get mismatch(): string; + abstract set mismatch(val: number); + } + class C extends B { + ~ +!!! error TS2654: Non-abstract class 'C' is missing implementations for the following members of 'B': 'prop', 'readonlyProp', 'm', 'mismatch'. + readonly ro = "readonly please"; + abstract notAllowed: string; + ~~~~~~~~ +!!! error TS1253: Abstract properties can only appear within an abstract class. + get concreteWithNoBody(): string; + ~ +!!! error TS1005: '{' expected. + } + let c = new C(); + c.ro = "error: lhs of assignment can't be readonly"; + ~~ +!!! error TS2540: Cannot assign to 'ro' because it is a read-only property. + + abstract class WrongTypeProperty { + abstract num: number; + } + class WrongTypePropertyImpl extends WrongTypeProperty { + num = "nope, wrong"; + ~~~ +!!! error TS2416: Property 'num' in type 'WrongTypePropertyImpl' is not assignable to the same property in base type 'WrongTypeProperty'. +!!! error TS2416: Type 'string' is not assignable to type 'number'. + } + abstract class WrongTypeAccessor { + abstract get num(): number; + } + class WrongTypeAccessorImpl extends WrongTypeAccessor { + get num() { return "nope, wrong"; } + ~~~ +!!! error TS2416: Property 'num' in type 'WrongTypeAccessorImpl' is not assignable to the same property in base type 'WrongTypeAccessor'. +!!! error TS2416: Type 'string' is not assignable to type 'number'. + } + class WrongTypeAccessorImpl2 extends WrongTypeAccessor { + num = "nope, wrong"; + ~~~ +!!! error TS2416: Property 'num' in type 'WrongTypeAccessorImpl2' is not assignable to the same property in base type 'WrongTypeAccessor'. +!!! error TS2416: Type 'string' is not assignable to type 'number'. + } + + abstract class AbstractAccessorMismatch { + abstract get p1(): string; + ~~ +!!! error TS2676: Accessors must both be abstract or non-abstract. + set p1(val: string) { }; + ~~ +!!! error TS2676: Accessors must both be abstract or non-abstract. + get p2(): string { return "should work"; } + ~~ +!!! error TS2676: Accessors must both be abstract or non-abstract. + abstract set p2(val: string); + ~~ +!!! error TS2676: Accessors must both be abstract or non-abstract. + } + \ No newline at end of file diff --git a/tests/baselines/reference/abstractPropertyNegative.js b/tests/baselines/reference/abstractPropertyNegative(target=es5).js similarity index 100% rename from tests/baselines/reference/abstractPropertyNegative.js rename to tests/baselines/reference/abstractPropertyNegative(target=es5).js diff --git a/tests/baselines/reference/abstractPropertyNegative(target=es5).symbols b/tests/baselines/reference/abstractPropertyNegative(target=es5).symbols new file mode 100644 index 0000000000000..f6565eaa25624 --- /dev/null +++ b/tests/baselines/reference/abstractPropertyNegative(target=es5).symbols @@ -0,0 +1,109 @@ +//// [tests/cases/compiler/abstractPropertyNegative.ts] //// + +=== abstractPropertyNegative.ts === +interface A { +>A : Symbol(A, Decl(abstractPropertyNegative.ts, 0, 0)) + + prop: string; +>prop : Symbol(A.prop, Decl(abstractPropertyNegative.ts, 0, 13)) + + m(): string; +>m : Symbol(A.m, Decl(abstractPropertyNegative.ts, 1, 17)) +} +abstract class B implements A { +>B : Symbol(B, Decl(abstractPropertyNegative.ts, 3, 1)) +>A : Symbol(A, Decl(abstractPropertyNegative.ts, 0, 0)) + + abstract prop: string; +>prop : Symbol(B.prop, Decl(abstractPropertyNegative.ts, 4, 31)) + + public abstract readonly ro: string; +>ro : Symbol(B.ro, Decl(abstractPropertyNegative.ts, 5, 26)) + + abstract get readonlyProp(): string; +>readonlyProp : Symbol(B.readonlyProp, Decl(abstractPropertyNegative.ts, 6, 40)) + + abstract m(): string; +>m : Symbol(B.m, Decl(abstractPropertyNegative.ts, 7, 40)) + + abstract get mismatch(): string; +>mismatch : Symbol(B.mismatch, Decl(abstractPropertyNegative.ts, 8, 25), Decl(abstractPropertyNegative.ts, 9, 36)) + + abstract set mismatch(val: number); +>mismatch : Symbol(B.mismatch, Decl(abstractPropertyNegative.ts, 8, 25), Decl(abstractPropertyNegative.ts, 9, 36)) +>val : Symbol(val, Decl(abstractPropertyNegative.ts, 10, 26)) +} +class C extends B { +>C : Symbol(C, Decl(abstractPropertyNegative.ts, 11, 1)) +>B : Symbol(B, Decl(abstractPropertyNegative.ts, 3, 1)) + + readonly ro = "readonly please"; +>ro : Symbol(C.ro, Decl(abstractPropertyNegative.ts, 12, 19)) + + abstract notAllowed: string; +>notAllowed : Symbol(C.notAllowed, Decl(abstractPropertyNegative.ts, 13, 36)) + + get concreteWithNoBody(): string; +>concreteWithNoBody : Symbol(C.concreteWithNoBody, Decl(abstractPropertyNegative.ts, 14, 32)) +} +let c = new C(); +>c : Symbol(c, Decl(abstractPropertyNegative.ts, 17, 3)) +>C : Symbol(C, Decl(abstractPropertyNegative.ts, 11, 1)) + +c.ro = "error: lhs of assignment can't be readonly"; +>c.ro : Symbol(C.ro, Decl(abstractPropertyNegative.ts, 12, 19)) +>c : Symbol(c, Decl(abstractPropertyNegative.ts, 17, 3)) +>ro : Symbol(C.ro, Decl(abstractPropertyNegative.ts, 12, 19)) + +abstract class WrongTypeProperty { +>WrongTypeProperty : Symbol(WrongTypeProperty, Decl(abstractPropertyNegative.ts, 18, 52)) + + abstract num: number; +>num : Symbol(WrongTypeProperty.num, Decl(abstractPropertyNegative.ts, 20, 34)) +} +class WrongTypePropertyImpl extends WrongTypeProperty { +>WrongTypePropertyImpl : Symbol(WrongTypePropertyImpl, Decl(abstractPropertyNegative.ts, 22, 1)) +>WrongTypeProperty : Symbol(WrongTypeProperty, Decl(abstractPropertyNegative.ts, 18, 52)) + + num = "nope, wrong"; +>num : Symbol(WrongTypePropertyImpl.num, Decl(abstractPropertyNegative.ts, 23, 55)) +} +abstract class WrongTypeAccessor { +>WrongTypeAccessor : Symbol(WrongTypeAccessor, Decl(abstractPropertyNegative.ts, 25, 1)) + + abstract get num(): number; +>num : Symbol(WrongTypeAccessor.num, Decl(abstractPropertyNegative.ts, 26, 34)) +} +class WrongTypeAccessorImpl extends WrongTypeAccessor { +>WrongTypeAccessorImpl : Symbol(WrongTypeAccessorImpl, Decl(abstractPropertyNegative.ts, 28, 1)) +>WrongTypeAccessor : Symbol(WrongTypeAccessor, Decl(abstractPropertyNegative.ts, 25, 1)) + + get num() { return "nope, wrong"; } +>num : Symbol(WrongTypeAccessorImpl.num, Decl(abstractPropertyNegative.ts, 29, 55)) +} +class WrongTypeAccessorImpl2 extends WrongTypeAccessor { +>WrongTypeAccessorImpl2 : Symbol(WrongTypeAccessorImpl2, Decl(abstractPropertyNegative.ts, 31, 1)) +>WrongTypeAccessor : Symbol(WrongTypeAccessor, Decl(abstractPropertyNegative.ts, 25, 1)) + + num = "nope, wrong"; +>num : Symbol(WrongTypeAccessorImpl2.num, Decl(abstractPropertyNegative.ts, 32, 56)) +} + +abstract class AbstractAccessorMismatch { +>AbstractAccessorMismatch : Symbol(AbstractAccessorMismatch, Decl(abstractPropertyNegative.ts, 34, 1)) + + abstract get p1(): string; +>p1 : Symbol(AbstractAccessorMismatch.p1, Decl(abstractPropertyNegative.ts, 36, 41), Decl(abstractPropertyNegative.ts, 37, 30)) + + set p1(val: string) { }; +>p1 : Symbol(AbstractAccessorMismatch.p1, Decl(abstractPropertyNegative.ts, 36, 41), Decl(abstractPropertyNegative.ts, 37, 30)) +>val : Symbol(val, Decl(abstractPropertyNegative.ts, 38, 11)) + + get p2(): string { return "should work"; } +>p2 : Symbol(AbstractAccessorMismatch.p2, Decl(abstractPropertyNegative.ts, 38, 28), Decl(abstractPropertyNegative.ts, 39, 46)) + + abstract set p2(val: string); +>p2 : Symbol(AbstractAccessorMismatch.p2, Decl(abstractPropertyNegative.ts, 38, 28), Decl(abstractPropertyNegative.ts, 39, 46)) +>val : Symbol(val, Decl(abstractPropertyNegative.ts, 40, 20)) +} + diff --git a/tests/baselines/reference/abstractPropertyNegative(target=es5).types b/tests/baselines/reference/abstractPropertyNegative(target=es5).types new file mode 100644 index 0000000000000..eb11f44c3c3c4 --- /dev/null +++ b/tests/baselines/reference/abstractPropertyNegative(target=es5).types @@ -0,0 +1,162 @@ +//// [tests/cases/compiler/abstractPropertyNegative.ts] //// + +=== abstractPropertyNegative.ts === +interface A { + prop: string; +>prop : string +> : ^^^^^^ + + m(): string; +>m : () => string +> : ^^^^^^ +} +abstract class B implements A { +>B : B +> : ^ + + abstract prop: string; +>prop : string +> : ^^^^^^ + + public abstract readonly ro: string; +>ro : string +> : ^^^^^^ + + abstract get readonlyProp(): string; +>readonlyProp : string +> : ^^^^^^ + + abstract m(): string; +>m : () => string +> : ^^^^^^ + + abstract get mismatch(): string; +>mismatch : string +> : ^^^^^^ + + abstract set mismatch(val: number); +>mismatch : string +> : ^^^^^^ +>val : number +> : ^^^^^^ +} +class C extends B { +>C : C +> : ^ +>B : B +> : ^ + + readonly ro = "readonly please"; +>ro : "readonly please" +> : ^^^^^^^^^^^^^^^^^ +>"readonly please" : "readonly please" +> : ^^^^^^^^^^^^^^^^^ + + abstract notAllowed: string; +>notAllowed : string +> : ^^^^^^ + + get concreteWithNoBody(): string; +>concreteWithNoBody : string +> : ^^^^^^ +} +let c = new C(); +>c : C +> : ^ +>new C() : C +> : ^ +>C : typeof C +> : ^^^^^^^^ + +c.ro = "error: lhs of assignment can't be readonly"; +>c.ro = "error: lhs of assignment can't be readonly" : "error: lhs of assignment can't be readonly" +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>c.ro : any +> : ^^^ +>c : C +> : ^ +>ro : any +> : ^^^ +>"error: lhs of assignment can't be readonly" : "error: lhs of assignment can't be readonly" +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +abstract class WrongTypeProperty { +>WrongTypeProperty : WrongTypeProperty +> : ^^^^^^^^^^^^^^^^^ + + abstract num: number; +>num : number +> : ^^^^^^ +} +class WrongTypePropertyImpl extends WrongTypeProperty { +>WrongTypePropertyImpl : WrongTypePropertyImpl +> : ^^^^^^^^^^^^^^^^^^^^^ +>WrongTypeProperty : WrongTypeProperty +> : ^^^^^^^^^^^^^^^^^ + + num = "nope, wrong"; +>num : string +> : ^^^^^^ +>"nope, wrong" : "nope, wrong" +> : ^^^^^^^^^^^^^ +} +abstract class WrongTypeAccessor { +>WrongTypeAccessor : WrongTypeAccessor +> : ^^^^^^^^^^^^^^^^^ + + abstract get num(): number; +>num : number +> : ^^^^^^ +} +class WrongTypeAccessorImpl extends WrongTypeAccessor { +>WrongTypeAccessorImpl : WrongTypeAccessorImpl +> : ^^^^^^^^^^^^^^^^^^^^^ +>WrongTypeAccessor : WrongTypeAccessor +> : ^^^^^^^^^^^^^^^^^ + + get num() { return "nope, wrong"; } +>num : string +> : ^^^^^^ +>"nope, wrong" : "nope, wrong" +> : ^^^^^^^^^^^^^ +} +class WrongTypeAccessorImpl2 extends WrongTypeAccessor { +>WrongTypeAccessorImpl2 : WrongTypeAccessorImpl2 +> : ^^^^^^^^^^^^^^^^^^^^^^ +>WrongTypeAccessor : WrongTypeAccessor +> : ^^^^^^^^^^^^^^^^^ + + num = "nope, wrong"; +>num : string +> : ^^^^^^ +>"nope, wrong" : "nope, wrong" +> : ^^^^^^^^^^^^^ +} + +abstract class AbstractAccessorMismatch { +>AbstractAccessorMismatch : AbstractAccessorMismatch +> : ^^^^^^^^^^^^^^^^^^^^^^^^ + + abstract get p1(): string; +>p1 : string +> : ^^^^^^ + + set p1(val: string) { }; +>p1 : string +> : ^^^^^^ +>val : string +> : ^^^^^^ + + get p2(): string { return "should work"; } +>p2 : string +> : ^^^^^^ +>"should work" : "should work" +> : ^^^^^^^^^^^^^ + + abstract set p2(val: string); +>p2 : string +> : ^^^^^^ +>val : string +> : ^^^^^^ +} + diff --git a/tests/baselines/reference/accessInstanceMemberFromStaticMethod01.js b/tests/baselines/reference/accessInstanceMemberFromStaticMethod01.js index 250e78259926f..e881500e64486 100644 --- a/tests/baselines/reference/accessInstanceMemberFromStaticMethod01.js +++ b/tests/baselines/reference/accessInstanceMemberFromStaticMethod01.js @@ -10,11 +10,8 @@ class C { } //// [accessInstanceMemberFromStaticMethod01.js] -var C = /** @class */ (function () { - function C() { +class C { + bar() { + let k = foo; } - C.prototype.bar = function () { - var k = foo; - }; - return C; -}()); +} diff --git a/tests/baselines/reference/accessOverriddenBaseClassMember1.js b/tests/baselines/reference/accessOverriddenBaseClassMember1.js index 1a81263e63813..df054ac23c535 100644 --- a/tests/baselines/reference/accessOverriddenBaseClassMember1.js +++ b/tests/baselines/reference/accessOverriddenBaseClassMember1.js @@ -18,40 +18,21 @@ class ColoredPoint extends Point { //// [accessOverriddenBaseClassMember1.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var Point = /** @class */ (function () { - function Point(x, y) { +class Point { + constructor(x, y) { this.x = x; this.y = y; } - Point.prototype.toString = function () { + toString() { return "x=" + this.x + " y=" + this.y; - }; - return Point; -}()); -var ColoredPoint = /** @class */ (function (_super) { - __extends(ColoredPoint, _super); - function ColoredPoint(x, y, color) { - var _this = _super.call(this, x, y) || this; - _this.color = color; - return _this; } - ColoredPoint.prototype.toString = function () { - return _super.prototype.toString.call(this) + " color=" + this.color; - }; - return ColoredPoint; -}(Point)); +} +class ColoredPoint extends Point { + constructor(x, y, color) { + super(x, y); + this.color = color; + } + toString() { + return super.toString() + " color=" + this.color; + } +} diff --git a/tests/baselines/reference/accessStaticMemberFromInstanceMethod01.js b/tests/baselines/reference/accessStaticMemberFromInstanceMethod01.js index f87f90e4f5423..de8e397a95c4b 100644 --- a/tests/baselines/reference/accessStaticMemberFromInstanceMethod01.js +++ b/tests/baselines/reference/accessStaticMemberFromInstanceMethod01.js @@ -10,11 +10,8 @@ class C { } //// [accessStaticMemberFromInstanceMethod01.js] -var C = /** @class */ (function () { - function C() { +class C { + static bar() { + let k = foo; } - C.bar = function () { - var k = foo; - }; - return C; -}()); +} diff --git a/tests/baselines/reference/accessibilityModifiers.errors.txt b/tests/baselines/reference/accessibilityModifiers(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/accessibilityModifiers.errors.txt rename to tests/baselines/reference/accessibilityModifiers(target=es2015).errors.txt diff --git a/tests/baselines/reference/accessibilityModifiers(target=es2015).js b/tests/baselines/reference/accessibilityModifiers(target=es2015).js new file mode 100644 index 0000000000000..04c572ea4e276 --- /dev/null +++ b/tests/baselines/reference/accessibilityModifiers(target=es2015).js @@ -0,0 +1,79 @@ +//// [tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts] //// + +//// [accessibilityModifiers.ts] +// No errors +class C { + private static privateProperty; + private static privateMethod() { } + private static get privateGetter() { return 0; } + private static set privateSetter(a: number) { } + + protected static protectedProperty; + protected static protectedMethod() { } + protected static get protectedGetter() { return 0; } + protected static set protectedSetter(a: number) { } + + public static publicProperty; + public static publicMethod() { } + public static get publicGetter() { return 0; } + public static set publicSetter(a: number) { } +} + +// Errors, accessibility modifiers must precede static +class D { + static private privateProperty; + static private privateMethod() { } + static private get privateGetter() { return 0; } + static private set privateSetter(a: number) { } + + static protected protectedProperty; + static protected protectedMethod() { } + static protected get protectedGetter() { return 0; } + static protected set protectedSetter(a: number) { } + + static public publicProperty; + static public publicMethod() { } + static public get publicGetter() { return 0; } + static public set publicSetter(a: number) { } +} + +// Errors, multiple accessibility modifier +class E { + private public protected property; + public protected method() { } + private protected get getter() { return 0; } + public public set setter(a: number) { } +} + + +//// [accessibilityModifiers.js] +// No errors +class C { + static privateMethod() { } + static get privateGetter() { return 0; } + static set privateSetter(a) { } + static protectedMethod() { } + static get protectedGetter() { return 0; } + static set protectedSetter(a) { } + static publicMethod() { } + static get publicGetter() { return 0; } + static set publicSetter(a) { } +} +// Errors, accessibility modifiers must precede static +class D { + static privateMethod() { } + static get privateGetter() { return 0; } + static set privateSetter(a) { } + static protectedMethod() { } + static get protectedGetter() { return 0; } + static set protectedSetter(a) { } + static publicMethod() { } + static get publicGetter() { return 0; } + static set publicSetter(a) { } +} +// Errors, multiple accessibility modifier +class E { + method() { } + get getter() { return 0; } + set setter(a) { } +} diff --git a/tests/baselines/reference/accessibilityModifiers.symbols b/tests/baselines/reference/accessibilityModifiers(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/accessibilityModifiers.symbols rename to tests/baselines/reference/accessibilityModifiers(target=es2015).symbols diff --git a/tests/baselines/reference/accessibilityModifiers.types b/tests/baselines/reference/accessibilityModifiers(target=es2015).types similarity index 100% rename from tests/baselines/reference/accessibilityModifiers.types rename to tests/baselines/reference/accessibilityModifiers(target=es2015).types diff --git a/tests/baselines/reference/accessibilityModifiers(target=es5).errors.txt b/tests/baselines/reference/accessibilityModifiers(target=es5).errors.txt new file mode 100644 index 0000000000000..260ac25d0cfc0 --- /dev/null +++ b/tests/baselines/reference/accessibilityModifiers(target=es5).errors.txt @@ -0,0 +1,95 @@ +accessibilityModifiers.ts(21,12): error TS1029: 'private' modifier must precede 'static' modifier. +accessibilityModifiers.ts(22,12): error TS1029: 'private' modifier must precede 'static' modifier. +accessibilityModifiers.ts(23,12): error TS1029: 'private' modifier must precede 'static' modifier. +accessibilityModifiers.ts(24,12): error TS1029: 'private' modifier must precede 'static' modifier. +accessibilityModifiers.ts(26,12): error TS1029: 'protected' modifier must precede 'static' modifier. +accessibilityModifiers.ts(27,12): error TS1029: 'protected' modifier must precede 'static' modifier. +accessibilityModifiers.ts(28,12): error TS1029: 'protected' modifier must precede 'static' modifier. +accessibilityModifiers.ts(29,12): error TS1029: 'protected' modifier must precede 'static' modifier. +accessibilityModifiers.ts(31,12): error TS1029: 'public' modifier must precede 'static' modifier. +accessibilityModifiers.ts(32,12): error TS1029: 'public' modifier must precede 'static' modifier. +accessibilityModifiers.ts(33,12): error TS1029: 'public' modifier must precede 'static' modifier. +accessibilityModifiers.ts(34,12): error TS1029: 'public' modifier must precede 'static' modifier. +accessibilityModifiers.ts(39,13): error TS1028: Accessibility modifier already seen. +accessibilityModifiers.ts(40,12): error TS1028: Accessibility modifier already seen. +accessibilityModifiers.ts(41,13): error TS1028: Accessibility modifier already seen. +accessibilityModifiers.ts(42,12): error TS1028: Accessibility modifier already seen. + + +==== accessibilityModifiers.ts (16 errors) ==== + // No errors + class C { + private static privateProperty; + private static privateMethod() { } + private static get privateGetter() { return 0; } + private static set privateSetter(a: number) { } + + protected static protectedProperty; + protected static protectedMethod() { } + protected static get protectedGetter() { return 0; } + protected static set protectedSetter(a: number) { } + + public static publicProperty; + public static publicMethod() { } + public static get publicGetter() { return 0; } + public static set publicSetter(a: number) { } + } + + // Errors, accessibility modifiers must precede static + class D { + static private privateProperty; + ~~~~~~~ +!!! error TS1029: 'private' modifier must precede 'static' modifier. + static private privateMethod() { } + ~~~~~~~ +!!! error TS1029: 'private' modifier must precede 'static' modifier. + static private get privateGetter() { return 0; } + ~~~~~~~ +!!! error TS1029: 'private' modifier must precede 'static' modifier. + static private set privateSetter(a: number) { } + ~~~~~~~ +!!! error TS1029: 'private' modifier must precede 'static' modifier. + + static protected protectedProperty; + ~~~~~~~~~ +!!! error TS1029: 'protected' modifier must precede 'static' modifier. + static protected protectedMethod() { } + ~~~~~~~~~ +!!! error TS1029: 'protected' modifier must precede 'static' modifier. + static protected get protectedGetter() { return 0; } + ~~~~~~~~~ +!!! error TS1029: 'protected' modifier must precede 'static' modifier. + static protected set protectedSetter(a: number) { } + ~~~~~~~~~ +!!! error TS1029: 'protected' modifier must precede 'static' modifier. + + static public publicProperty; + ~~~~~~ +!!! error TS1029: 'public' modifier must precede 'static' modifier. + static public publicMethod() { } + ~~~~~~ +!!! error TS1029: 'public' modifier must precede 'static' modifier. + static public get publicGetter() { return 0; } + ~~~~~~ +!!! error TS1029: 'public' modifier must precede 'static' modifier. + static public set publicSetter(a: number) { } + ~~~~~~ +!!! error TS1029: 'public' modifier must precede 'static' modifier. + } + + // Errors, multiple accessibility modifier + class E { + private public protected property; + ~~~~~~ +!!! error TS1028: Accessibility modifier already seen. + public protected method() { } + ~~~~~~~~~ +!!! error TS1028: Accessibility modifier already seen. + private protected get getter() { return 0; } + ~~~~~~~~~ +!!! error TS1028: Accessibility modifier already seen. + public public set setter(a: number) { } + ~~~~~~ +!!! error TS1028: Accessibility modifier already seen. + } + \ No newline at end of file diff --git a/tests/baselines/reference/accessibilityModifiers.js b/tests/baselines/reference/accessibilityModifiers(target=es5).js similarity index 100% rename from tests/baselines/reference/accessibilityModifiers.js rename to tests/baselines/reference/accessibilityModifiers(target=es5).js diff --git a/tests/baselines/reference/accessibilityModifiers(target=es5).symbols b/tests/baselines/reference/accessibilityModifiers(target=es5).symbols new file mode 100644 index 0000000000000..c3b1545f30467 --- /dev/null +++ b/tests/baselines/reference/accessibilityModifiers(target=es5).symbols @@ -0,0 +1,109 @@ +//// [tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts] //// + +=== accessibilityModifiers.ts === +// No errors +class C { +>C : Symbol(C, Decl(accessibilityModifiers.ts, 0, 0)) + + private static privateProperty; +>privateProperty : Symbol(C.privateProperty, Decl(accessibilityModifiers.ts, 1, 9)) + + private static privateMethod() { } +>privateMethod : Symbol(C.privateMethod, Decl(accessibilityModifiers.ts, 2, 35)) + + private static get privateGetter() { return 0; } +>privateGetter : Symbol(C.privateGetter, Decl(accessibilityModifiers.ts, 3, 38)) + + private static set privateSetter(a: number) { } +>privateSetter : Symbol(C.privateSetter, Decl(accessibilityModifiers.ts, 4, 52)) +>a : Symbol(a, Decl(accessibilityModifiers.ts, 5, 37)) + + protected static protectedProperty; +>protectedProperty : Symbol(C.protectedProperty, Decl(accessibilityModifiers.ts, 5, 51)) + + protected static protectedMethod() { } +>protectedMethod : Symbol(C.protectedMethod, Decl(accessibilityModifiers.ts, 7, 39)) + + protected static get protectedGetter() { return 0; } +>protectedGetter : Symbol(C.protectedGetter, Decl(accessibilityModifiers.ts, 8, 42)) + + protected static set protectedSetter(a: number) { } +>protectedSetter : Symbol(C.protectedSetter, Decl(accessibilityModifiers.ts, 9, 56)) +>a : Symbol(a, Decl(accessibilityModifiers.ts, 10, 41)) + + public static publicProperty; +>publicProperty : Symbol(C.publicProperty, Decl(accessibilityModifiers.ts, 10, 55)) + + public static publicMethod() { } +>publicMethod : Symbol(C.publicMethod, Decl(accessibilityModifiers.ts, 12, 33)) + + public static get publicGetter() { return 0; } +>publicGetter : Symbol(C.publicGetter, Decl(accessibilityModifiers.ts, 13, 36)) + + public static set publicSetter(a: number) { } +>publicSetter : Symbol(C.publicSetter, Decl(accessibilityModifiers.ts, 14, 50)) +>a : Symbol(a, Decl(accessibilityModifiers.ts, 15, 35)) +} + +// Errors, accessibility modifiers must precede static +class D { +>D : Symbol(D, Decl(accessibilityModifiers.ts, 16, 1)) + + static private privateProperty; +>privateProperty : Symbol(D.privateProperty, Decl(accessibilityModifiers.ts, 19, 9)) + + static private privateMethod() { } +>privateMethod : Symbol(D.privateMethod, Decl(accessibilityModifiers.ts, 20, 35)) + + static private get privateGetter() { return 0; } +>privateGetter : Symbol(D.privateGetter, Decl(accessibilityModifiers.ts, 21, 38)) + + static private set privateSetter(a: number) { } +>privateSetter : Symbol(D.privateSetter, Decl(accessibilityModifiers.ts, 22, 52)) +>a : Symbol(a, Decl(accessibilityModifiers.ts, 23, 37)) + + static protected protectedProperty; +>protectedProperty : Symbol(D.protectedProperty, Decl(accessibilityModifiers.ts, 23, 51)) + + static protected protectedMethod() { } +>protectedMethod : Symbol(D.protectedMethod, Decl(accessibilityModifiers.ts, 25, 39)) + + static protected get protectedGetter() { return 0; } +>protectedGetter : Symbol(D.protectedGetter, Decl(accessibilityModifiers.ts, 26, 42)) + + static protected set protectedSetter(a: number) { } +>protectedSetter : Symbol(D.protectedSetter, Decl(accessibilityModifiers.ts, 27, 56)) +>a : Symbol(a, Decl(accessibilityModifiers.ts, 28, 41)) + + static public publicProperty; +>publicProperty : Symbol(D.publicProperty, Decl(accessibilityModifiers.ts, 28, 55)) + + static public publicMethod() { } +>publicMethod : Symbol(D.publicMethod, Decl(accessibilityModifiers.ts, 30, 33)) + + static public get publicGetter() { return 0; } +>publicGetter : Symbol(D.publicGetter, Decl(accessibilityModifiers.ts, 31, 36)) + + static public set publicSetter(a: number) { } +>publicSetter : Symbol(D.publicSetter, Decl(accessibilityModifiers.ts, 32, 50)) +>a : Symbol(a, Decl(accessibilityModifiers.ts, 33, 35)) +} + +// Errors, multiple accessibility modifier +class E { +>E : Symbol(E, Decl(accessibilityModifiers.ts, 34, 1)) + + private public protected property; +>property : Symbol(E.property, Decl(accessibilityModifiers.ts, 37, 9)) + + public protected method() { } +>method : Symbol(E.method, Decl(accessibilityModifiers.ts, 38, 38)) + + private protected get getter() { return 0; } +>getter : Symbol(E.getter, Decl(accessibilityModifiers.ts, 39, 33)) + + public public set setter(a: number) { } +>setter : Symbol(E.setter, Decl(accessibilityModifiers.ts, 40, 48)) +>a : Symbol(a, Decl(accessibilityModifiers.ts, 41, 29)) +} + diff --git a/tests/baselines/reference/accessibilityModifiers(target=es5).types b/tests/baselines/reference/accessibilityModifiers(target=es5).types new file mode 100644 index 0000000000000..1a6f62356a3f5 --- /dev/null +++ b/tests/baselines/reference/accessibilityModifiers(target=es5).types @@ -0,0 +1,161 @@ +//// [tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts] //// + +=== accessibilityModifiers.ts === +// No errors +class C { +>C : C +> : ^ + + private static privateProperty; +>privateProperty : any +> : ^^^ + + private static privateMethod() { } +>privateMethod : () => void +> : ^^^^^^^^^^ + + private static get privateGetter() { return 0; } +>privateGetter : number +> : ^^^^^^ +>0 : 0 +> : ^ + + private static set privateSetter(a: number) { } +>privateSetter : number +> : ^^^^^^ +>a : number +> : ^^^^^^ + + protected static protectedProperty; +>protectedProperty : any +> : ^^^ + + protected static protectedMethod() { } +>protectedMethod : () => void +> : ^^^^^^^^^^ + + protected static get protectedGetter() { return 0; } +>protectedGetter : number +> : ^^^^^^ +>0 : 0 +> : ^ + + protected static set protectedSetter(a: number) { } +>protectedSetter : number +> : ^^^^^^ +>a : number +> : ^^^^^^ + + public static publicProperty; +>publicProperty : any +> : ^^^ + + public static publicMethod() { } +>publicMethod : () => void +> : ^^^^^^^^^^ + + public static get publicGetter() { return 0; } +>publicGetter : number +> : ^^^^^^ +>0 : 0 +> : ^ + + public static set publicSetter(a: number) { } +>publicSetter : number +> : ^^^^^^ +>a : number +> : ^^^^^^ +} + +// Errors, accessibility modifiers must precede static +class D { +>D : D +> : ^ + + static private privateProperty; +>privateProperty : any +> : ^^^ + + static private privateMethod() { } +>privateMethod : () => void +> : ^^^^^^^^^^ + + static private get privateGetter() { return 0; } +>privateGetter : number +> : ^^^^^^ +>0 : 0 +> : ^ + + static private set privateSetter(a: number) { } +>privateSetter : number +> : ^^^^^^ +>a : number +> : ^^^^^^ + + static protected protectedProperty; +>protectedProperty : any +> : ^^^ + + static protected protectedMethod() { } +>protectedMethod : () => void +> : ^^^^^^^^^^ + + static protected get protectedGetter() { return 0; } +>protectedGetter : number +> : ^^^^^^ +>0 : 0 +> : ^ + + static protected set protectedSetter(a: number) { } +>protectedSetter : number +> : ^^^^^^ +>a : number +> : ^^^^^^ + + static public publicProperty; +>publicProperty : any +> : ^^^ + + static public publicMethod() { } +>publicMethod : () => void +> : ^^^^^^^^^^ + + static public get publicGetter() { return 0; } +>publicGetter : number +> : ^^^^^^ +>0 : 0 +> : ^ + + static public set publicSetter(a: number) { } +>publicSetter : number +> : ^^^^^^ +>a : number +> : ^^^^^^ +} + +// Errors, multiple accessibility modifier +class E { +>E : E +> : ^ + + private public protected property; +>property : any +> : ^^^ + + public protected method() { } +>method : () => void +> : ^^^^^^^^^^ + + private protected get getter() { return 0; } +>getter : number +> : ^^^^^^ +>0 : 0 +> : ^ + + public public set setter(a: number) { } +>setter : number +> : ^^^^^^ +>a : number +> : ^^^^^^ +} + diff --git a/tests/baselines/reference/accessorAccidentalCallDiagnostic.errors.txt b/tests/baselines/reference/accessorAccidentalCallDiagnostic(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/accessorAccidentalCallDiagnostic.errors.txt rename to tests/baselines/reference/accessorAccidentalCallDiagnostic(target=es2015).errors.txt diff --git a/tests/baselines/reference/accessorAccidentalCallDiagnostic(target=es2015).js b/tests/baselines/reference/accessorAccidentalCallDiagnostic(target=es2015).js new file mode 100644 index 0000000000000..9f923f5ab20db --- /dev/null +++ b/tests/baselines/reference/accessorAccidentalCallDiagnostic(target=es2015).js @@ -0,0 +1,20 @@ +//// [tests/cases/compiler/accessorAccidentalCallDiagnostic.ts] //// + +//// [accessorAccidentalCallDiagnostic.ts] +// https://github.com/microsoft/TypeScript/issues/24554 +class Test24554 { + get property(): number { return 1; } +} +function test24554(x: Test24554) { + return x.property(); +} + + +//// [accessorAccidentalCallDiagnostic.js] +// https://github.com/microsoft/TypeScript/issues/24554 +class Test24554 { + get property() { return 1; } +} +function test24554(x) { + return x.property(); +} diff --git a/tests/baselines/reference/accessorAccidentalCallDiagnostic.symbols b/tests/baselines/reference/accessorAccidentalCallDiagnostic(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/accessorAccidentalCallDiagnostic.symbols rename to tests/baselines/reference/accessorAccidentalCallDiagnostic(target=es2015).symbols diff --git a/tests/baselines/reference/accessorAccidentalCallDiagnostic.types b/tests/baselines/reference/accessorAccidentalCallDiagnostic(target=es2015).types similarity index 100% rename from tests/baselines/reference/accessorAccidentalCallDiagnostic.types rename to tests/baselines/reference/accessorAccidentalCallDiagnostic(target=es2015).types diff --git a/tests/baselines/reference/accessorAccidentalCallDiagnostic(target=es5).errors.txt b/tests/baselines/reference/accessorAccidentalCallDiagnostic(target=es5).errors.txt new file mode 100644 index 0000000000000..5d51cd8be52ea --- /dev/null +++ b/tests/baselines/reference/accessorAccidentalCallDiagnostic(target=es5).errors.txt @@ -0,0 +1,16 @@ +accessorAccidentalCallDiagnostic.ts(6,14): error TS6234: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'? + Type 'Number' has no call signatures. + + +==== accessorAccidentalCallDiagnostic.ts (1 errors) ==== + // https://github.com/microsoft/TypeScript/issues/24554 + class Test24554 { + get property(): number { return 1; } + } + function test24554(x: Test24554) { + return x.property(); + ~~~~~~~~ +!!! error TS6234: This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'? +!!! error TS6234: Type 'Number' has no call signatures. + } + \ No newline at end of file diff --git a/tests/baselines/reference/accessorAccidentalCallDiagnostic.js b/tests/baselines/reference/accessorAccidentalCallDiagnostic(target=es5).js similarity index 100% rename from tests/baselines/reference/accessorAccidentalCallDiagnostic.js rename to tests/baselines/reference/accessorAccidentalCallDiagnostic(target=es5).js diff --git a/tests/baselines/reference/accessorAccidentalCallDiagnostic(target=es5).symbols b/tests/baselines/reference/accessorAccidentalCallDiagnostic(target=es5).symbols new file mode 100644 index 0000000000000..66b25a906c8b6 --- /dev/null +++ b/tests/baselines/reference/accessorAccidentalCallDiagnostic(target=es5).symbols @@ -0,0 +1,21 @@ +//// [tests/cases/compiler/accessorAccidentalCallDiagnostic.ts] //// + +=== accessorAccidentalCallDiagnostic.ts === +// https://github.com/microsoft/TypeScript/issues/24554 +class Test24554 { +>Test24554 : Symbol(Test24554, Decl(accessorAccidentalCallDiagnostic.ts, 0, 0)) + + get property(): number { return 1; } +>property : Symbol(Test24554.property, Decl(accessorAccidentalCallDiagnostic.ts, 1, 17)) +} +function test24554(x: Test24554) { +>test24554 : Symbol(test24554, Decl(accessorAccidentalCallDiagnostic.ts, 3, 1)) +>x : Symbol(x, Decl(accessorAccidentalCallDiagnostic.ts, 4, 19)) +>Test24554 : Symbol(Test24554, Decl(accessorAccidentalCallDiagnostic.ts, 0, 0)) + + return x.property(); +>x.property : Symbol(Test24554.property, Decl(accessorAccidentalCallDiagnostic.ts, 1, 17)) +>x : Symbol(x, Decl(accessorAccidentalCallDiagnostic.ts, 4, 19)) +>property : Symbol(Test24554.property, Decl(accessorAccidentalCallDiagnostic.ts, 1, 17)) +} + diff --git a/tests/baselines/reference/accessorAccidentalCallDiagnostic(target=es5).types b/tests/baselines/reference/accessorAccidentalCallDiagnostic(target=es5).types new file mode 100644 index 0000000000000..84013fe02eb17 --- /dev/null +++ b/tests/baselines/reference/accessorAccidentalCallDiagnostic(target=es5).types @@ -0,0 +1,31 @@ +//// [tests/cases/compiler/accessorAccidentalCallDiagnostic.ts] //// + +=== accessorAccidentalCallDiagnostic.ts === +// https://github.com/microsoft/TypeScript/issues/24554 +class Test24554 { +>Test24554 : Test24554 +> : ^^^^^^^^^ + + get property(): number { return 1; } +>property : number +> : ^^^^^^ +>1 : 1 +> : ^ +} +function test24554(x: Test24554) { +>test24554 : (x: Test24554) => any +> : ^ ^^ ^^^^^^^^ +>x : Test24554 +> : ^^^^^^^^^ + + return x.property(); +>x.property() : any +> : ^^^ +>x.property : number +> : ^^^^^^ +>x : Test24554 +> : ^^^^^^^^^ +>property : number +> : ^^^^^^ +} + diff --git a/tests/baselines/reference/accessorInAmbientContextES5(target=es2015).js b/tests/baselines/reference/accessorInAmbientContextES5(target=es2015).js new file mode 100644 index 0000000000000..dac427e6df2ad --- /dev/null +++ b/tests/baselines/reference/accessorInAmbientContextES5(target=es2015).js @@ -0,0 +1,75 @@ +//// [tests/cases/compiler/accessorInAmbientContextES5.ts] //// + +//// [accessorInAmbientContextES5.ts] +// Should allow accessor in ambient contexts even when targeting ES5 + +declare class AmbientClass { + accessor prop1: string; + static accessor prop2: number; + private accessor prop3: boolean; + private static accessor prop4: symbol; +} + +declare namespace AmbientNamespace { + class C { + accessor prop: string; + } +} + +// Should also work in .d.ts files (simulated with declare) +declare module "some-module" { + export class ExportedClass { + accessor value: any; + } +} + +// Regular class should still error when targeting ES5 +class RegularClass { + accessor shouldError: string; // Should still error +} + +//// [accessorInAmbientContextES5.js] +// Should allow accessor in ambient contexts even when targeting ES5 +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _RegularClass_shouldError_accessor_storage; +// Regular class should still error when targeting ES5 +class RegularClass { + constructor() { + _RegularClass_shouldError_accessor_storage.set(this, void 0); + } + get shouldError() { return __classPrivateFieldGet(this, _RegularClass_shouldError_accessor_storage, "f"); } // Should still error + set shouldError(value) { __classPrivateFieldSet(this, _RegularClass_shouldError_accessor_storage, value, "f"); } +} +_RegularClass_shouldError_accessor_storage = new WeakMap(); + + +//// [accessorInAmbientContextES5.d.ts] +declare class AmbientClass { + accessor prop1: string; + static accessor prop2: number; + private accessor prop3; + private static accessor prop4; +} +declare namespace AmbientNamespace { + class C { + accessor prop: string; + } +} +declare module "some-module" { + class ExportedClass { + accessor value: any; + } +} +declare class RegularClass { + accessor shouldError: string; +} diff --git a/tests/baselines/reference/accessorInAmbientContextES5.symbols b/tests/baselines/reference/accessorInAmbientContextES5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/accessorInAmbientContextES5.symbols rename to tests/baselines/reference/accessorInAmbientContextES5(target=es2015).symbols diff --git a/tests/baselines/reference/accessorInAmbientContextES5(target=es2015).types b/tests/baselines/reference/accessorInAmbientContextES5(target=es2015).types new file mode 100644 index 0000000000000..a1519de527550 --- /dev/null +++ b/tests/baselines/reference/accessorInAmbientContextES5(target=es2015).types @@ -0,0 +1,63 @@ +//// [tests/cases/compiler/accessorInAmbientContextES5.ts] //// + +=== accessorInAmbientContextES5.ts === +// Should allow accessor in ambient contexts even when targeting ES5 + +declare class AmbientClass { +>AmbientClass : AmbientClass +> : ^^^^^^^^^^^^ + + accessor prop1: string; +>prop1 : string +> : ^^^^^^ + + static accessor prop2: number; +>prop2 : number +> : ^^^^^^ + + private accessor prop3: boolean; +>prop3 : boolean +> : ^^^^^^^ + + private static accessor prop4: symbol; +>prop4 : symbol +> : ^^^^^^ +} + +declare namespace AmbientNamespace { +>AmbientNamespace : typeof AmbientNamespace +> : ^^^^^^^^^^^^^^^^^^^^^^^ + + class C { +>C : C +> : ^ + + accessor prop: string; +>prop : string +> : ^^^^^^ + } +} + +// Should also work in .d.ts files (simulated with declare) +declare module "some-module" { +>"some-module" : typeof import("some-module") +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + export class ExportedClass { +>ExportedClass : ExportedClass +> : ^^^^^^^^^^^^^ + + accessor value: any; +>value : any + } +} + +// Regular class should still error when targeting ES5 +class RegularClass { +>RegularClass : RegularClass +> : ^^^^^^^^^^^^ + + accessor shouldError: string; // Should still error +>shouldError : string +> : ^^^^^^ +} diff --git a/tests/baselines/reference/accessorInAmbientContextES5.errors.txt b/tests/baselines/reference/accessorInAmbientContextES5(target=es5).errors.txt similarity index 100% rename from tests/baselines/reference/accessorInAmbientContextES5.errors.txt rename to tests/baselines/reference/accessorInAmbientContextES5(target=es5).errors.txt diff --git a/tests/baselines/reference/accessorInAmbientContextES5.js b/tests/baselines/reference/accessorInAmbientContextES5(target=es5).js similarity index 100% rename from tests/baselines/reference/accessorInAmbientContextES5.js rename to tests/baselines/reference/accessorInAmbientContextES5(target=es5).js diff --git a/tests/baselines/reference/accessorInAmbientContextES5(target=es5).symbols b/tests/baselines/reference/accessorInAmbientContextES5(target=es5).symbols new file mode 100644 index 0000000000000..c37f91917d28c --- /dev/null +++ b/tests/baselines/reference/accessorInAmbientContextES5(target=es5).symbols @@ -0,0 +1,51 @@ +//// [tests/cases/compiler/accessorInAmbientContextES5.ts] //// + +=== accessorInAmbientContextES5.ts === +// Should allow accessor in ambient contexts even when targeting ES5 + +declare class AmbientClass { +>AmbientClass : Symbol(AmbientClass, Decl(accessorInAmbientContextES5.ts, 0, 0)) + + accessor prop1: string; +>prop1 : Symbol(AmbientClass.prop1, Decl(accessorInAmbientContextES5.ts, 2, 28)) + + static accessor prop2: number; +>prop2 : Symbol(AmbientClass.prop2, Decl(accessorInAmbientContextES5.ts, 3, 27)) + + private accessor prop3: boolean; +>prop3 : Symbol(AmbientClass.prop3, Decl(accessorInAmbientContextES5.ts, 4, 34)) + + private static accessor prop4: symbol; +>prop4 : Symbol(AmbientClass.prop4, Decl(accessorInAmbientContextES5.ts, 5, 36)) +} + +declare namespace AmbientNamespace { +>AmbientNamespace : Symbol(AmbientNamespace, Decl(accessorInAmbientContextES5.ts, 7, 1)) + + class C { +>C : Symbol(C, Decl(accessorInAmbientContextES5.ts, 9, 36)) + + accessor prop: string; +>prop : Symbol(C.prop, Decl(accessorInAmbientContextES5.ts, 10, 13)) + } +} + +// Should also work in .d.ts files (simulated with declare) +declare module "some-module" { +>"some-module" : Symbol("some-module", Decl(accessorInAmbientContextES5.ts, 13, 1)) + + export class ExportedClass { +>ExportedClass : Symbol(ExportedClass, Decl(accessorInAmbientContextES5.ts, 16, 30)) + + accessor value: any; +>value : Symbol(ExportedClass.value, Decl(accessorInAmbientContextES5.ts, 17, 32)) + } +} + +// Regular class should still error when targeting ES5 +class RegularClass { +>RegularClass : Symbol(RegularClass, Decl(accessorInAmbientContextES5.ts, 20, 1)) + + accessor shouldError: string; // Should still error +>shouldError : Symbol(RegularClass.shouldError, Decl(accessorInAmbientContextES5.ts, 23, 20)) +} diff --git a/tests/baselines/reference/accessorInAmbientContextES5.types b/tests/baselines/reference/accessorInAmbientContextES5(target=es5).types similarity index 100% rename from tests/baselines/reference/accessorInAmbientContextES5.types rename to tests/baselines/reference/accessorInAmbientContextES5(target=es5).types diff --git a/tests/baselines/reference/accessorParameterAccessibilityModifier.errors.txt b/tests/baselines/reference/accessorParameterAccessibilityModifier(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/accessorParameterAccessibilityModifier.errors.txt rename to tests/baselines/reference/accessorParameterAccessibilityModifier(target=es2015).errors.txt diff --git a/tests/baselines/reference/accessorParameterAccessibilityModifier(target=es2015).js b/tests/baselines/reference/accessorParameterAccessibilityModifier(target=es2015).js new file mode 100644 index 0000000000000..e930a48da4dae --- /dev/null +++ b/tests/baselines/reference/accessorParameterAccessibilityModifier(target=es2015).js @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/accessorParameterAccessibilityModifier.ts] //// + +//// [accessorParameterAccessibilityModifier.ts] +class C { + set X(public v) { } + static set X(public v2) { } +} + +//// [accessorParameterAccessibilityModifier.js] +class C { + set X(v) { } + static set X(v2) { } +} diff --git a/tests/baselines/reference/accessorParameterAccessibilityModifier.symbols b/tests/baselines/reference/accessorParameterAccessibilityModifier(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/accessorParameterAccessibilityModifier.symbols rename to tests/baselines/reference/accessorParameterAccessibilityModifier(target=es2015).symbols diff --git a/tests/baselines/reference/accessorParameterAccessibilityModifier.types b/tests/baselines/reference/accessorParameterAccessibilityModifier(target=es2015).types similarity index 100% rename from tests/baselines/reference/accessorParameterAccessibilityModifier.types rename to tests/baselines/reference/accessorParameterAccessibilityModifier(target=es2015).types diff --git a/tests/baselines/reference/accessorParameterAccessibilityModifier(target=es5).errors.txt b/tests/baselines/reference/accessorParameterAccessibilityModifier(target=es5).errors.txt new file mode 100644 index 0000000000000..46de3d531dfb0 --- /dev/null +++ b/tests/baselines/reference/accessorParameterAccessibilityModifier(target=es5).errors.txt @@ -0,0 +1,13 @@ +accessorParameterAccessibilityModifier.ts(2,11): error TS2369: A parameter property is only allowed in a constructor implementation. +accessorParameterAccessibilityModifier.ts(3,18): error TS2369: A parameter property is only allowed in a constructor implementation. + + +==== accessorParameterAccessibilityModifier.ts (2 errors) ==== + class C { + set X(public v) { } + ~~~~~~~~ +!!! error TS2369: A parameter property is only allowed in a constructor implementation. + static set X(public v2) { } + ~~~~~~~~~ +!!! error TS2369: A parameter property is only allowed in a constructor implementation. + } \ No newline at end of file diff --git a/tests/baselines/reference/accessorParameterAccessibilityModifier.js b/tests/baselines/reference/accessorParameterAccessibilityModifier(target=es5).js similarity index 100% rename from tests/baselines/reference/accessorParameterAccessibilityModifier.js rename to tests/baselines/reference/accessorParameterAccessibilityModifier(target=es5).js diff --git a/tests/baselines/reference/accessorParameterAccessibilityModifier(target=es5).symbols b/tests/baselines/reference/accessorParameterAccessibilityModifier(target=es5).symbols new file mode 100644 index 0000000000000..19a35c15cd0dc --- /dev/null +++ b/tests/baselines/reference/accessorParameterAccessibilityModifier(target=es5).symbols @@ -0,0 +1,14 @@ +//// [tests/cases/compiler/accessorParameterAccessibilityModifier.ts] //// + +=== accessorParameterAccessibilityModifier.ts === +class C { +>C : Symbol(C, Decl(accessorParameterAccessibilityModifier.ts, 0, 0)) + + set X(public v) { } +>X : Symbol(C.X, Decl(accessorParameterAccessibilityModifier.ts, 0, 9)) +>v : Symbol(v, Decl(accessorParameterAccessibilityModifier.ts, 1, 10)) + + static set X(public v2) { } +>X : Symbol(C.X, Decl(accessorParameterAccessibilityModifier.ts, 1, 23)) +>v2 : Symbol(v2, Decl(accessorParameterAccessibilityModifier.ts, 2, 17)) +} diff --git a/tests/baselines/reference/accessorParameterAccessibilityModifier(target=es5).types b/tests/baselines/reference/accessorParameterAccessibilityModifier(target=es5).types new file mode 100644 index 0000000000000..8ce63cfb95f35 --- /dev/null +++ b/tests/baselines/reference/accessorParameterAccessibilityModifier(target=es5).types @@ -0,0 +1,19 @@ +//// [tests/cases/compiler/accessorParameterAccessibilityModifier.ts] //// + +=== accessorParameterAccessibilityModifier.ts === +class C { +>C : C +> : ^ + + set X(public v) { } +>X : any +> : ^^^ +>v : any +> : ^^^ + + static set X(public v2) { } +>X : any +> : ^^^ +>v2 : any +> : ^^^ +} diff --git a/tests/baselines/reference/accessorWithES5(target=es2015).js b/tests/baselines/reference/accessorWithES5(target=es2015).js new file mode 100644 index 0000000000000..6a4a1f425a403 --- /dev/null +++ b/tests/baselines/reference/accessorWithES5(target=es2015).js @@ -0,0 +1,38 @@ +//// [tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithES5.ts] //// + +//// [accessorWithES5.ts] +class C { + get x() { + return 1; + } +} + +class D { + set x(v) { + } +} + +var x = { + get a() { return 1 } +} + +var y = { + set b(v) { } +} + +//// [accessorWithES5.js] +class C { + get x() { + return 1; + } +} +class D { + set x(v) { + } +} +var x = { + get a() { return 1; } +}; +var y = { + set b(v) { } +}; diff --git a/tests/baselines/reference/accessorWithES5.symbols b/tests/baselines/reference/accessorWithES5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/accessorWithES5.symbols rename to tests/baselines/reference/accessorWithES5(target=es2015).symbols diff --git a/tests/baselines/reference/accessorWithES5.types b/tests/baselines/reference/accessorWithES5(target=es2015).types similarity index 100% rename from tests/baselines/reference/accessorWithES5.types rename to tests/baselines/reference/accessorWithES5(target=es2015).types diff --git a/tests/baselines/reference/accessorWithES5.js b/tests/baselines/reference/accessorWithES5(target=es5).js similarity index 100% rename from tests/baselines/reference/accessorWithES5.js rename to tests/baselines/reference/accessorWithES5(target=es5).js diff --git a/tests/baselines/reference/accessorWithES5(target=es5).symbols b/tests/baselines/reference/accessorWithES5(target=es5).symbols new file mode 100644 index 0000000000000..0a7e2176a58ca --- /dev/null +++ b/tests/baselines/reference/accessorWithES5(target=es5).symbols @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithES5.ts] //// + +=== accessorWithES5.ts === +class C { +>C : Symbol(C, Decl(accessorWithES5.ts, 0, 0)) + + get x() { +>x : Symbol(C.x, Decl(accessorWithES5.ts, 0, 9)) + + return 1; + } +} + +class D { +>D : Symbol(D, Decl(accessorWithES5.ts, 4, 1)) + + set x(v) { +>x : Symbol(D.x, Decl(accessorWithES5.ts, 6, 9)) +>v : Symbol(v, Decl(accessorWithES5.ts, 7, 10)) + } +} + +var x = { +>x : Symbol(x, Decl(accessorWithES5.ts, 11, 3)) + + get a() { return 1 } +>a : Symbol(a, Decl(accessorWithES5.ts, 11, 9)) +} + +var y = { +>y : Symbol(y, Decl(accessorWithES5.ts, 15, 3)) + + set b(v) { } +>b : Symbol(b, Decl(accessorWithES5.ts, 15, 9)) +>v : Symbol(v, Decl(accessorWithES5.ts, 16, 10)) +} diff --git a/tests/baselines/reference/accessorWithES5(target=es5).types b/tests/baselines/reference/accessorWithES5(target=es5).types new file mode 100644 index 0000000000000..9c1950168feb6 --- /dev/null +++ b/tests/baselines/reference/accessorWithES5(target=es5).types @@ -0,0 +1,50 @@ +//// [tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithES5.ts] //// + +=== accessorWithES5.ts === +class C { +>C : C +> : ^ + + get x() { +>x : number +> : ^^^^^^ + + return 1; +>1 : 1 +> : ^ + } +} + +class D { +>D : D +> : ^ + + set x(v) { +>x : any +>v : any + } +} + +var x = { +>x : { readonly a: number; } +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>{ get a() { return 1 }} : { readonly a: number; } +> : ^^^^^^^^^^^^^^^^^^^^^^^ + + get a() { return 1 } +>a : number +> : ^^^^^^ +>1 : 1 +> : ^ +} + +var y = { +>y : { b: any; } +> : ^^^^^^^^^^^ +>{ set b(v) { }} : { b: any; } +> : ^^^^^^^^^^^ + + set b(v) { } +>b : any +>v : any +} diff --git a/tests/baselines/reference/accessorWithInitializer.errors.txt b/tests/baselines/reference/accessorWithInitializer(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/accessorWithInitializer.errors.txt rename to tests/baselines/reference/accessorWithInitializer(target=es2015).errors.txt diff --git a/tests/baselines/reference/accessorWithInitializer(target=es2015).js b/tests/baselines/reference/accessorWithInitializer(target=es2015).js new file mode 100644 index 0000000000000..db9477e948950 --- /dev/null +++ b/tests/baselines/reference/accessorWithInitializer(target=es2015).js @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/accessorWithInitializer.ts] //// + +//// [accessorWithInitializer.ts] +class C { + set X(v = 0) { } + static set X(v2 = 0) { } +} + +//// [accessorWithInitializer.js] +class C { + set X(v = 0) { } + static set X(v2 = 0) { } +} diff --git a/tests/baselines/reference/accessorWithInitializer.symbols b/tests/baselines/reference/accessorWithInitializer(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/accessorWithInitializer.symbols rename to tests/baselines/reference/accessorWithInitializer(target=es2015).symbols diff --git a/tests/baselines/reference/accessorWithInitializer.types b/tests/baselines/reference/accessorWithInitializer(target=es2015).types similarity index 100% rename from tests/baselines/reference/accessorWithInitializer.types rename to tests/baselines/reference/accessorWithInitializer(target=es2015).types diff --git a/tests/baselines/reference/accessorWithInitializer(target=es5).errors.txt b/tests/baselines/reference/accessorWithInitializer(target=es5).errors.txt new file mode 100644 index 0000000000000..2a1b64da30ac4 --- /dev/null +++ b/tests/baselines/reference/accessorWithInitializer(target=es5).errors.txt @@ -0,0 +1,13 @@ +accessorWithInitializer.ts(2,9): error TS1052: A 'set' accessor parameter cannot have an initializer. +accessorWithInitializer.ts(3,16): error TS1052: A 'set' accessor parameter cannot have an initializer. + + +==== accessorWithInitializer.ts (2 errors) ==== + class C { + set X(v = 0) { } + ~ +!!! error TS1052: A 'set' accessor parameter cannot have an initializer. + static set X(v2 = 0) { } + ~ +!!! error TS1052: A 'set' accessor parameter cannot have an initializer. + } \ No newline at end of file diff --git a/tests/baselines/reference/accessorWithInitializer.js b/tests/baselines/reference/accessorWithInitializer(target=es5).js similarity index 100% rename from tests/baselines/reference/accessorWithInitializer.js rename to tests/baselines/reference/accessorWithInitializer(target=es5).js diff --git a/tests/baselines/reference/accessorWithInitializer(target=es5).symbols b/tests/baselines/reference/accessorWithInitializer(target=es5).symbols new file mode 100644 index 0000000000000..82f61f90c7312 --- /dev/null +++ b/tests/baselines/reference/accessorWithInitializer(target=es5).symbols @@ -0,0 +1,14 @@ +//// [tests/cases/compiler/accessorWithInitializer.ts] //// + +=== accessorWithInitializer.ts === +class C { +>C : Symbol(C, Decl(accessorWithInitializer.ts, 0, 0)) + + set X(v = 0) { } +>X : Symbol(C.X, Decl(accessorWithInitializer.ts, 0, 9)) +>v : Symbol(v, Decl(accessorWithInitializer.ts, 1, 10)) + + static set X(v2 = 0) { } +>X : Symbol(C.X, Decl(accessorWithInitializer.ts, 1, 20)) +>v2 : Symbol(v2, Decl(accessorWithInitializer.ts, 2, 17)) +} diff --git a/tests/baselines/reference/accessorWithInitializer(target=es5).types b/tests/baselines/reference/accessorWithInitializer(target=es5).types new file mode 100644 index 0000000000000..e6b53f8cbcc0d --- /dev/null +++ b/tests/baselines/reference/accessorWithInitializer(target=es5).types @@ -0,0 +1,23 @@ +//// [tests/cases/compiler/accessorWithInitializer.ts] //// + +=== accessorWithInitializer.ts === +class C { +>C : C +> : ^ + + set X(v = 0) { } +>X : any +> : ^^^ +>v : number +> : ^^^^^^ +>0 : 0 +> : ^ + + static set X(v2 = 0) { } +>X : any +> : ^^^ +>v2 : number +> : ^^^^^^ +>0 : 0 +> : ^ +} diff --git a/tests/baselines/reference/accessorWithLineTerminator(target=es2015).js b/tests/baselines/reference/accessorWithLineTerminator(target=es2015).js new file mode 100644 index 0000000000000..632c5ac17d7cc --- /dev/null +++ b/tests/baselines/reference/accessorWithLineTerminator(target=es2015).js @@ -0,0 +1,16 @@ +//// [tests/cases/compiler/accessorWithLineTerminator.ts] //// + +//// [accessorWithLineTerminator.ts] +class C { + get + x() { return 1 } + + set + x(v) { } +} + +//// [accessorWithLineTerminator.js] +class C { + get x() { return 1; } + set x(v) { } +} diff --git a/tests/baselines/reference/accessorWithLineTerminator.symbols b/tests/baselines/reference/accessorWithLineTerminator(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/accessorWithLineTerminator.symbols rename to tests/baselines/reference/accessorWithLineTerminator(target=es2015).symbols diff --git a/tests/baselines/reference/accessorWithLineTerminator.types b/tests/baselines/reference/accessorWithLineTerminator(target=es2015).types similarity index 100% rename from tests/baselines/reference/accessorWithLineTerminator.types rename to tests/baselines/reference/accessorWithLineTerminator(target=es2015).types diff --git a/tests/baselines/reference/accessorWithLineTerminator.js b/tests/baselines/reference/accessorWithLineTerminator(target=es5).js similarity index 100% rename from tests/baselines/reference/accessorWithLineTerminator.js rename to tests/baselines/reference/accessorWithLineTerminator(target=es5).js diff --git a/tests/baselines/reference/accessorWithLineTerminator(target=es5).symbols b/tests/baselines/reference/accessorWithLineTerminator(target=es5).symbols new file mode 100644 index 0000000000000..7af2827dfb9ec --- /dev/null +++ b/tests/baselines/reference/accessorWithLineTerminator(target=es5).symbols @@ -0,0 +1,15 @@ +//// [tests/cases/compiler/accessorWithLineTerminator.ts] //// + +=== accessorWithLineTerminator.ts === +class C { +>C : Symbol(C, Decl(accessorWithLineTerminator.ts, 0, 0)) + + get + x() { return 1 } +>x : Symbol(C.x, Decl(accessorWithLineTerminator.ts, 0, 9), Decl(accessorWithLineTerminator.ts, 2, 20)) + + set + x(v) { } +>x : Symbol(C.x, Decl(accessorWithLineTerminator.ts, 0, 9), Decl(accessorWithLineTerminator.ts, 2, 20)) +>v : Symbol(v, Decl(accessorWithLineTerminator.ts, 5, 6)) +} diff --git a/tests/baselines/reference/accessorWithLineTerminator(target=es5).types b/tests/baselines/reference/accessorWithLineTerminator(target=es5).types new file mode 100644 index 0000000000000..368c118965b2c --- /dev/null +++ b/tests/baselines/reference/accessorWithLineTerminator(target=es5).types @@ -0,0 +1,21 @@ +//// [tests/cases/compiler/accessorWithLineTerminator.ts] //// + +=== accessorWithLineTerminator.ts === +class C { +>C : C +> : ^ + + get + x() { return 1 } +>x : number +> : ^^^^^^ +>1 : 1 +> : ^ + + set + x(v) { } +>x : number +> : ^^^^^^ +>v : number +> : ^^^^^^ +} diff --git a/tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers(target=es2015).js b/tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers(target=es2015).js new file mode 100644 index 0000000000000..de837ed885091 --- /dev/null +++ b/tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers(target=es2015).js @@ -0,0 +1,64 @@ +//// [tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithMismatchedAccessibilityModifiers.ts] //// + +//// [accessorWithMismatchedAccessibilityModifiers.ts] +class C { + get x() { + return 1; + } + private set x(v) { + } +} + +class D { + protected get x() { + return 1; + } + private set x(v) { + } +} + +class E { + protected set x(v) { + } + get x() { + return 1; + } +} + +class F { + protected static set x(v) { + } + static get x() { + return 1; + } +} + +//// [accessorWithMismatchedAccessibilityModifiers.js] +class C { + get x() { + return 1; + } + set x(v) { + } +} +class D { + get x() { + return 1; + } + set x(v) { + } +} +class E { + set x(v) { + } + get x() { + return 1; + } +} +class F { + static set x(v) { + } + static get x() { + return 1; + } +} diff --git a/tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers.symbols b/tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers.symbols rename to tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers(target=es2015).symbols diff --git a/tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers.types b/tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers(target=es2015).types similarity index 100% rename from tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers.types rename to tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers(target=es2015).types diff --git a/tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers.js b/tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers(target=es5).js similarity index 100% rename from tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers.js rename to tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers(target=es5).js diff --git a/tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers(target=es5).symbols b/tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers(target=es5).symbols new file mode 100644 index 0000000000000..6d2dabf4cda7f --- /dev/null +++ b/tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers(target=es5).symbols @@ -0,0 +1,58 @@ +//// [tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithMismatchedAccessibilityModifiers.ts] //// + +=== accessorWithMismatchedAccessibilityModifiers.ts === +class C { +>C : Symbol(C, Decl(accessorWithMismatchedAccessibilityModifiers.ts, 0, 0)) + + get x() { +>x : Symbol(C.x, Decl(accessorWithMismatchedAccessibilityModifiers.ts, 0, 9), Decl(accessorWithMismatchedAccessibilityModifiers.ts, 3, 5)) + + return 1; + } + private set x(v) { +>x : Symbol(C.x, Decl(accessorWithMismatchedAccessibilityModifiers.ts, 0, 9), Decl(accessorWithMismatchedAccessibilityModifiers.ts, 3, 5)) +>v : Symbol(v, Decl(accessorWithMismatchedAccessibilityModifiers.ts, 4, 18)) + } +} + +class D { +>D : Symbol(D, Decl(accessorWithMismatchedAccessibilityModifiers.ts, 6, 1)) + + protected get x() { +>x : Symbol(D.x, Decl(accessorWithMismatchedAccessibilityModifiers.ts, 8, 9), Decl(accessorWithMismatchedAccessibilityModifiers.ts, 11, 5)) + + return 1; + } + private set x(v) { +>x : Symbol(D.x, Decl(accessorWithMismatchedAccessibilityModifiers.ts, 8, 9), Decl(accessorWithMismatchedAccessibilityModifiers.ts, 11, 5)) +>v : Symbol(v, Decl(accessorWithMismatchedAccessibilityModifiers.ts, 12, 18)) + } +} + +class E { +>E : Symbol(E, Decl(accessorWithMismatchedAccessibilityModifiers.ts, 14, 1)) + + protected set x(v) { +>x : Symbol(E.x, Decl(accessorWithMismatchedAccessibilityModifiers.ts, 16, 9), Decl(accessorWithMismatchedAccessibilityModifiers.ts, 18, 5)) +>v : Symbol(v, Decl(accessorWithMismatchedAccessibilityModifiers.ts, 17, 20)) + } + get x() { +>x : Symbol(E.x, Decl(accessorWithMismatchedAccessibilityModifiers.ts, 16, 9), Decl(accessorWithMismatchedAccessibilityModifiers.ts, 18, 5)) + + return 1; + } +} + +class F { +>F : Symbol(F, Decl(accessorWithMismatchedAccessibilityModifiers.ts, 22, 1)) + + protected static set x(v) { +>x : Symbol(F.x, Decl(accessorWithMismatchedAccessibilityModifiers.ts, 24, 9), Decl(accessorWithMismatchedAccessibilityModifiers.ts, 26, 5)) +>v : Symbol(v, Decl(accessorWithMismatchedAccessibilityModifiers.ts, 25, 27)) + } + static get x() { +>x : Symbol(F.x, Decl(accessorWithMismatchedAccessibilityModifiers.ts, 24, 9), Decl(accessorWithMismatchedAccessibilityModifiers.ts, 26, 5)) + + return 1; + } +} diff --git a/tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers(target=es5).types b/tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers(target=es5).types new file mode 100644 index 0000000000000..881e5528ac789 --- /dev/null +++ b/tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers(target=es5).types @@ -0,0 +1,82 @@ +//// [tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithMismatchedAccessibilityModifiers.ts] //// + +=== accessorWithMismatchedAccessibilityModifiers.ts === +class C { +>C : C +> : ^ + + get x() { +>x : number +> : ^^^^^^ + + return 1; +>1 : 1 +> : ^ + } + private set x(v) { +>x : number +> : ^^^^^^ +>v : number +> : ^^^^^^ + } +} + +class D { +>D : D +> : ^ + + protected get x() { +>x : number +> : ^^^^^^ + + return 1; +>1 : 1 +> : ^ + } + private set x(v) { +>x : number +> : ^^^^^^ +>v : number +> : ^^^^^^ + } +} + +class E { +>E : E +> : ^ + + protected set x(v) { +>x : number +> : ^^^^^^ +>v : number +> : ^^^^^^ + } + get x() { +>x : number +> : ^^^^^^ + + return 1; +>1 : 1 +> : ^ + } +} + +class F { +>F : F +> : ^ + + protected static set x(v) { +>x : number +> : ^^^^^^ +>v : number +> : ^^^^^^ + } + static get x() { +>x : number +> : ^^^^^^ + + return 1; +>1 : 1 +> : ^ + } +} diff --git a/tests/baselines/reference/accessorWithRestParam.errors.txt b/tests/baselines/reference/accessorWithRestParam(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/accessorWithRestParam.errors.txt rename to tests/baselines/reference/accessorWithRestParam(target=es2015).errors.txt diff --git a/tests/baselines/reference/accessorWithRestParam(target=es2015).js b/tests/baselines/reference/accessorWithRestParam(target=es2015).js new file mode 100644 index 0000000000000..894e8420ad1da --- /dev/null +++ b/tests/baselines/reference/accessorWithRestParam(target=es2015).js @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/accessorWithRestParam.ts] //// + +//// [accessorWithRestParam.ts] +class C { + set X(...v) { } + static set X(...v2) { } +} + +//// [accessorWithRestParam.js] +class C { + set X(...v) { } + static set X(...v2) { } +} diff --git a/tests/baselines/reference/accessorWithRestParam.symbols b/tests/baselines/reference/accessorWithRestParam(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/accessorWithRestParam.symbols rename to tests/baselines/reference/accessorWithRestParam(target=es2015).symbols diff --git a/tests/baselines/reference/accessorWithRestParam.types b/tests/baselines/reference/accessorWithRestParam(target=es2015).types similarity index 100% rename from tests/baselines/reference/accessorWithRestParam.types rename to tests/baselines/reference/accessorWithRestParam(target=es2015).types diff --git a/tests/baselines/reference/accessorWithRestParam(target=es5).errors.txt b/tests/baselines/reference/accessorWithRestParam(target=es5).errors.txt new file mode 100644 index 0000000000000..8e94f0ee95af0 --- /dev/null +++ b/tests/baselines/reference/accessorWithRestParam(target=es5).errors.txt @@ -0,0 +1,13 @@ +accessorWithRestParam.ts(2,11): error TS1053: A 'set' accessor cannot have rest parameter. +accessorWithRestParam.ts(3,18): error TS1053: A 'set' accessor cannot have rest parameter. + + +==== accessorWithRestParam.ts (2 errors) ==== + class C { + set X(...v) { } + ~~~ +!!! error TS1053: A 'set' accessor cannot have rest parameter. + static set X(...v2) { } + ~~~ +!!! error TS1053: A 'set' accessor cannot have rest parameter. + } \ No newline at end of file diff --git a/tests/baselines/reference/accessorWithRestParam.js b/tests/baselines/reference/accessorWithRestParam(target=es5).js similarity index 100% rename from tests/baselines/reference/accessorWithRestParam.js rename to tests/baselines/reference/accessorWithRestParam(target=es5).js diff --git a/tests/baselines/reference/accessorWithRestParam(target=es5).symbols b/tests/baselines/reference/accessorWithRestParam(target=es5).symbols new file mode 100644 index 0000000000000..98944c336b277 --- /dev/null +++ b/tests/baselines/reference/accessorWithRestParam(target=es5).symbols @@ -0,0 +1,14 @@ +//// [tests/cases/compiler/accessorWithRestParam.ts] //// + +=== accessorWithRestParam.ts === +class C { +>C : Symbol(C, Decl(accessorWithRestParam.ts, 0, 0)) + + set X(...v) { } +>X : Symbol(C.X, Decl(accessorWithRestParam.ts, 0, 9)) +>v : Symbol(v, Decl(accessorWithRestParam.ts, 1, 10)) + + static set X(...v2) { } +>X : Symbol(C.X, Decl(accessorWithRestParam.ts, 1, 19)) +>v2 : Symbol(v2, Decl(accessorWithRestParam.ts, 2, 17)) +} diff --git a/tests/baselines/reference/accessorWithRestParam(target=es5).types b/tests/baselines/reference/accessorWithRestParam(target=es5).types new file mode 100644 index 0000000000000..a2dc42967e245 --- /dev/null +++ b/tests/baselines/reference/accessorWithRestParam(target=es5).types @@ -0,0 +1,19 @@ +//// [tests/cases/compiler/accessorWithRestParam.ts] //// + +=== accessorWithRestParam.ts === +class C { +>C : C +> : ^ + + set X(...v) { } +>X : any +> : ^^^ +>v : any[] +> : ^^^^^ + + static set X(...v2) { } +>X : any +> : ^^^ +>v2 : any[] +> : ^^^^^ +} diff --git a/tests/baselines/reference/accessorWithoutBody1.errors.txt b/tests/baselines/reference/accessorWithoutBody1(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/accessorWithoutBody1.errors.txt rename to tests/baselines/reference/accessorWithoutBody1(target=es2015).errors.txt diff --git a/tests/baselines/reference/accessorWithoutBody1.js b/tests/baselines/reference/accessorWithoutBody1(target=es2015).js similarity index 100% rename from tests/baselines/reference/accessorWithoutBody1.js rename to tests/baselines/reference/accessorWithoutBody1(target=es2015).js diff --git a/tests/baselines/reference/accessorWithoutBody1.symbols b/tests/baselines/reference/accessorWithoutBody1(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/accessorWithoutBody1.symbols rename to tests/baselines/reference/accessorWithoutBody1(target=es2015).symbols diff --git a/tests/baselines/reference/accessorWithoutBody1.types b/tests/baselines/reference/accessorWithoutBody1(target=es2015).types similarity index 100% rename from tests/baselines/reference/accessorWithoutBody1.types rename to tests/baselines/reference/accessorWithoutBody1(target=es2015).types diff --git a/tests/baselines/reference/accessorWithoutBody1(target=es5).errors.txt b/tests/baselines/reference/accessorWithoutBody1(target=es5).errors.txt new file mode 100644 index 0000000000000..da7b29fe6b64e --- /dev/null +++ b/tests/baselines/reference/accessorWithoutBody1(target=es5).errors.txt @@ -0,0 +1,7 @@ +accessorWithoutBody1.ts(1,19): error TS1005: '{' expected. + + +==== accessorWithoutBody1.ts (1 errors) ==== + var v = { get foo() } + ~ +!!! error TS1005: '{' expected. \ No newline at end of file diff --git a/tests/baselines/reference/accessorWithoutBody1(target=es5).js b/tests/baselines/reference/accessorWithoutBody1(target=es5).js new file mode 100644 index 0000000000000..930cd3e6559b3 --- /dev/null +++ b/tests/baselines/reference/accessorWithoutBody1(target=es5).js @@ -0,0 +1,7 @@ +//// [tests/cases/compiler/accessorWithoutBody1.ts] //// + +//// [accessorWithoutBody1.ts] +var v = { get foo() } + +//// [accessorWithoutBody1.js] +var v = { get foo() { } }; diff --git a/tests/baselines/reference/accessorWithoutBody1(target=es5).symbols b/tests/baselines/reference/accessorWithoutBody1(target=es5).symbols new file mode 100644 index 0000000000000..288e4fa6ad87f --- /dev/null +++ b/tests/baselines/reference/accessorWithoutBody1(target=es5).symbols @@ -0,0 +1,7 @@ +//// [tests/cases/compiler/accessorWithoutBody1.ts] //// + +=== accessorWithoutBody1.ts === +var v = { get foo() } +>v : Symbol(v, Decl(accessorWithoutBody1.ts, 0, 3)) +>foo : Symbol(foo, Decl(accessorWithoutBody1.ts, 0, 9)) + diff --git a/tests/baselines/reference/accessorWithoutBody1(target=es5).types b/tests/baselines/reference/accessorWithoutBody1(target=es5).types new file mode 100644 index 0000000000000..c2035bdba9c30 --- /dev/null +++ b/tests/baselines/reference/accessorWithoutBody1(target=es5).types @@ -0,0 +1,11 @@ +//// [tests/cases/compiler/accessorWithoutBody1.ts] //// + +=== accessorWithoutBody1.ts === +var v = { get foo() } +>v : { readonly foo: any; } +> : ^^^^^^^^^^^^^^^^^^^^^^ +>{ get foo() } : { readonly foo: any; } +> : ^^^^^^^^^^^^^^^^^^^^^^ +>foo : any +> : ^^^ + diff --git a/tests/baselines/reference/accessorWithoutBody2.errors.txt b/tests/baselines/reference/accessorWithoutBody2(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/accessorWithoutBody2.errors.txt rename to tests/baselines/reference/accessorWithoutBody2(target=es2015).errors.txt diff --git a/tests/baselines/reference/accessorWithoutBody2.js b/tests/baselines/reference/accessorWithoutBody2(target=es2015).js similarity index 100% rename from tests/baselines/reference/accessorWithoutBody2.js rename to tests/baselines/reference/accessorWithoutBody2(target=es2015).js diff --git a/tests/baselines/reference/accessorWithoutBody2.symbols b/tests/baselines/reference/accessorWithoutBody2(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/accessorWithoutBody2.symbols rename to tests/baselines/reference/accessorWithoutBody2(target=es2015).symbols diff --git a/tests/baselines/reference/accessorWithoutBody2.types b/tests/baselines/reference/accessorWithoutBody2(target=es2015).types similarity index 100% rename from tests/baselines/reference/accessorWithoutBody2.types rename to tests/baselines/reference/accessorWithoutBody2(target=es2015).types diff --git a/tests/baselines/reference/accessorWithoutBody2(target=es5).errors.txt b/tests/baselines/reference/accessorWithoutBody2(target=es5).errors.txt new file mode 100644 index 0000000000000..596da62347794 --- /dev/null +++ b/tests/baselines/reference/accessorWithoutBody2(target=es5).errors.txt @@ -0,0 +1,7 @@ +accessorWithoutBody2.ts(1,20): error TS1005: '{' expected. + + +==== accessorWithoutBody2.ts (1 errors) ==== + var v = { set foo(a) } + ~ +!!! error TS1005: '{' expected. \ No newline at end of file diff --git a/tests/baselines/reference/accessorWithoutBody2(target=es5).js b/tests/baselines/reference/accessorWithoutBody2(target=es5).js new file mode 100644 index 0000000000000..39a3bfd02dd40 --- /dev/null +++ b/tests/baselines/reference/accessorWithoutBody2(target=es5).js @@ -0,0 +1,7 @@ +//// [tests/cases/compiler/accessorWithoutBody2.ts] //// + +//// [accessorWithoutBody2.ts] +var v = { set foo(a) } + +//// [accessorWithoutBody2.js] +var v = { set foo(a) { } }; diff --git a/tests/baselines/reference/accessorWithoutBody2(target=es5).symbols b/tests/baselines/reference/accessorWithoutBody2(target=es5).symbols new file mode 100644 index 0000000000000..67f64ebbda474 --- /dev/null +++ b/tests/baselines/reference/accessorWithoutBody2(target=es5).symbols @@ -0,0 +1,8 @@ +//// [tests/cases/compiler/accessorWithoutBody2.ts] //// + +=== accessorWithoutBody2.ts === +var v = { set foo(a) } +>v : Symbol(v, Decl(accessorWithoutBody2.ts, 0, 3)) +>foo : Symbol(foo, Decl(accessorWithoutBody2.ts, 0, 9)) +>a : Symbol(a, Decl(accessorWithoutBody2.ts, 0, 18)) + diff --git a/tests/baselines/reference/accessorWithoutBody2(target=es5).types b/tests/baselines/reference/accessorWithoutBody2(target=es5).types new file mode 100644 index 0000000000000..1cb420bd5aafc --- /dev/null +++ b/tests/baselines/reference/accessorWithoutBody2(target=es5).types @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/accessorWithoutBody2.ts] //// + +=== accessorWithoutBody2.ts === +var v = { set foo(a) } +>v : { foo: any; } +> : ^^^^^^^^^^^^^ +>{ set foo(a) } : { foo: any; } +> : ^^^^^^^^^^^^^ +>foo : any +> : ^^^ +>a : any +> : ^^^ + diff --git a/tests/baselines/reference/accessorsAreNotContextuallyTyped.js b/tests/baselines/reference/accessorsAreNotContextuallyTyped.js index 4daab7e02060c..9ec976eb0a6f4 100644 --- a/tests/baselines/reference/accessorsAreNotContextuallyTyped.js +++ b/tests/baselines/reference/accessorsAreNotContextuallyTyped.js @@ -17,19 +17,12 @@ var r = c.x(''); // string //// [accessorsAreNotContextuallyTyped.js] // accessors are not contextually typed -var C = /** @class */ (function () { - function C() { +class C { + set x(v) { } - Object.defineProperty(C.prototype, "x", { - get: function () { - return function (x) { return ""; }; - }, - set: function (v) { - }, - enumerable: false, - configurable: true - }); - return C; -}()); + get x() { + return (x) => ""; + } +} var c; var r = c.x(''); // string diff --git a/tests/baselines/reference/accessorsEmit.js b/tests/baselines/reference/accessorsEmit.js index bba2f09a44eb8..6b3a7b0443ff1 100644 --- a/tests/baselines/reference/accessorsEmit.js +++ b/tests/baselines/reference/accessorsEmit.js @@ -18,34 +18,17 @@ class Test2 { } //// [accessorsEmit.js] -var Result = /** @class */ (function () { - function Result() { - } - return Result; -}()); -var Test = /** @class */ (function () { - function Test() { +class Result { +} +class Test { + get Property() { + var x = 1; + return null; } - Object.defineProperty(Test.prototype, "Property", { - get: function () { - var x = 1; - return null; - }, - enumerable: false, - configurable: true - }); - return Test; -}()); -var Test2 = /** @class */ (function () { - function Test2() { +} +class Test2 { + get Property() { + var x = 1; + return null; } - Object.defineProperty(Test2.prototype, "Property", { - get: function () { - var x = 1; - return null; - }, - enumerable: false, - configurable: true - }); - return Test2; -}()); +} diff --git a/tests/baselines/reference/accessorsInAmbientContext.errors.txt b/tests/baselines/reference/accessorsInAmbientContext(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/accessorsInAmbientContext.errors.txt rename to tests/baselines/reference/accessorsInAmbientContext(target=es2015).errors.txt diff --git a/tests/baselines/reference/accessorsInAmbientContext.js b/tests/baselines/reference/accessorsInAmbientContext(target=es2015).js similarity index 100% rename from tests/baselines/reference/accessorsInAmbientContext.js rename to tests/baselines/reference/accessorsInAmbientContext(target=es2015).js diff --git a/tests/baselines/reference/accessorsInAmbientContext.symbols b/tests/baselines/reference/accessorsInAmbientContext(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/accessorsInAmbientContext.symbols rename to tests/baselines/reference/accessorsInAmbientContext(target=es2015).symbols diff --git a/tests/baselines/reference/accessorsInAmbientContext.types b/tests/baselines/reference/accessorsInAmbientContext(target=es2015).types similarity index 100% rename from tests/baselines/reference/accessorsInAmbientContext.types rename to tests/baselines/reference/accessorsInAmbientContext(target=es2015).types diff --git a/tests/baselines/reference/accessorsInAmbientContext(target=es5).errors.txt b/tests/baselines/reference/accessorsInAmbientContext(target=es5).errors.txt new file mode 100644 index 0000000000000..9a3e5a8c3690a --- /dev/null +++ b/tests/baselines/reference/accessorsInAmbientContext(target=es5).errors.txt @@ -0,0 +1,44 @@ +accessorsInAmbientContext.ts(3,17): error TS1183: An implementation cannot be declared in ambient contexts. +accessorsInAmbientContext.ts(4,18): error TS1183: An implementation cannot be declared in ambient contexts. +accessorsInAmbientContext.ts(6,24): error TS1183: An implementation cannot be declared in ambient contexts. +accessorsInAmbientContext.ts(7,25): error TS1183: An implementation cannot be declared in ambient contexts. +accessorsInAmbientContext.ts(12,13): error TS1183: An implementation cannot be declared in ambient contexts. +accessorsInAmbientContext.ts(13,14): error TS1183: An implementation cannot be declared in ambient contexts. +accessorsInAmbientContext.ts(15,20): error TS1183: An implementation cannot be declared in ambient contexts. +accessorsInAmbientContext.ts(16,21): error TS1183: An implementation cannot be declared in ambient contexts. + + +==== accessorsInAmbientContext.ts (8 errors) ==== + declare namespace M { + class C { + get X() { return 1; } + ~ +!!! error TS1183: An implementation cannot be declared in ambient contexts. + set X(v) { } + ~ +!!! error TS1183: An implementation cannot be declared in ambient contexts. + + static get Y() { return 1; } + ~ +!!! error TS1183: An implementation cannot be declared in ambient contexts. + static set Y(v) { } + ~ +!!! error TS1183: An implementation cannot be declared in ambient contexts. + } + } + + declare class C { + get X() { return 1; } + ~ +!!! error TS1183: An implementation cannot be declared in ambient contexts. + set X(v) { } + ~ +!!! error TS1183: An implementation cannot be declared in ambient contexts. + + static get Y() { return 1; } + ~ +!!! error TS1183: An implementation cannot be declared in ambient contexts. + static set Y(v) { } + ~ +!!! error TS1183: An implementation cannot be declared in ambient contexts. + } \ No newline at end of file diff --git a/tests/baselines/reference/accessorsInAmbientContext(target=es5).js b/tests/baselines/reference/accessorsInAmbientContext(target=es5).js new file mode 100644 index 0000000000000..73122973c5b3c --- /dev/null +++ b/tests/baselines/reference/accessorsInAmbientContext(target=es5).js @@ -0,0 +1,22 @@ +//// [tests/cases/compiler/accessorsInAmbientContext.ts] //// + +//// [accessorsInAmbientContext.ts] +declare namespace M { + class C { + get X() { return 1; } + set X(v) { } + + static get Y() { return 1; } + static set Y(v) { } + } +} + +declare class C { + get X() { return 1; } + set X(v) { } + + static get Y() { return 1; } + static set Y(v) { } +} + +//// [accessorsInAmbientContext.js] diff --git a/tests/baselines/reference/accessorsInAmbientContext(target=es5).symbols b/tests/baselines/reference/accessorsInAmbientContext(target=es5).symbols new file mode 100644 index 0000000000000..57281be16161e --- /dev/null +++ b/tests/baselines/reference/accessorsInAmbientContext(target=es5).symbols @@ -0,0 +1,42 @@ +//// [tests/cases/compiler/accessorsInAmbientContext.ts] //// + +=== accessorsInAmbientContext.ts === +declare namespace M { +>M : Symbol(M, Decl(accessorsInAmbientContext.ts, 0, 0)) + + class C { +>C : Symbol(C, Decl(accessorsInAmbientContext.ts, 0, 21)) + + get X() { return 1; } +>X : Symbol(C.X, Decl(accessorsInAmbientContext.ts, 1, 13), Decl(accessorsInAmbientContext.ts, 2, 29)) + + set X(v) { } +>X : Symbol(C.X, Decl(accessorsInAmbientContext.ts, 1, 13), Decl(accessorsInAmbientContext.ts, 2, 29)) +>v : Symbol(v, Decl(accessorsInAmbientContext.ts, 3, 14)) + + static get Y() { return 1; } +>Y : Symbol(C.Y, Decl(accessorsInAmbientContext.ts, 3, 20), Decl(accessorsInAmbientContext.ts, 5, 36)) + + static set Y(v) { } +>Y : Symbol(C.Y, Decl(accessorsInAmbientContext.ts, 3, 20), Decl(accessorsInAmbientContext.ts, 5, 36)) +>v : Symbol(v, Decl(accessorsInAmbientContext.ts, 6, 21)) + } +} + +declare class C { +>C : Symbol(C, Decl(accessorsInAmbientContext.ts, 8, 1)) + + get X() { return 1; } +>X : Symbol(C.X, Decl(accessorsInAmbientContext.ts, 10, 17), Decl(accessorsInAmbientContext.ts, 11, 25)) + + set X(v) { } +>X : Symbol(C.X, Decl(accessorsInAmbientContext.ts, 10, 17), Decl(accessorsInAmbientContext.ts, 11, 25)) +>v : Symbol(v, Decl(accessorsInAmbientContext.ts, 12, 10)) + + static get Y() { return 1; } +>Y : Symbol(C.Y, Decl(accessorsInAmbientContext.ts, 12, 16), Decl(accessorsInAmbientContext.ts, 14, 32)) + + static set Y(v) { } +>Y : Symbol(C.Y, Decl(accessorsInAmbientContext.ts, 12, 16), Decl(accessorsInAmbientContext.ts, 14, 32)) +>v : Symbol(v, Decl(accessorsInAmbientContext.ts, 15, 17)) +} diff --git a/tests/baselines/reference/accessorsInAmbientContext(target=es5).types b/tests/baselines/reference/accessorsInAmbientContext(target=es5).types new file mode 100644 index 0000000000000..e7ef2644c02cd --- /dev/null +++ b/tests/baselines/reference/accessorsInAmbientContext(target=es5).types @@ -0,0 +1,65 @@ +//// [tests/cases/compiler/accessorsInAmbientContext.ts] //// + +=== accessorsInAmbientContext.ts === +declare namespace M { +>M : typeof M +> : ^^^^^^^^ + + class C { +>C : C +> : ^ + + get X() { return 1; } +>X : number +> : ^^^^^^ +>1 : 1 +> : ^ + + set X(v) { } +>X : number +> : ^^^^^^ +>v : number +> : ^^^^^^ + + static get Y() { return 1; } +>Y : number +> : ^^^^^^ +>1 : 1 +> : ^ + + static set Y(v) { } +>Y : number +> : ^^^^^^ +>v : number +> : ^^^^^^ + } +} + +declare class C { +>C : C +> : ^ + + get X() { return 1; } +>X : number +> : ^^^^^^ +>1 : 1 +> : ^ + + set X(v) { } +>X : number +> : ^^^^^^ +>v : number +> : ^^^^^^ + + static get Y() { return 1; } +>Y : number +> : ^^^^^^ +>1 : 1 +> : ^ + + static set Y(v) { } +>Y : number +> : ^^^^^^ +>v : number +> : ^^^^^^ +} diff --git a/tests/baselines/reference/accessorsOverrideProperty7.errors.txt b/tests/baselines/reference/accessorsOverrideProperty7(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/accessorsOverrideProperty7.errors.txt rename to tests/baselines/reference/accessorsOverrideProperty7(target=es2015).errors.txt diff --git a/tests/baselines/reference/accessorsOverrideProperty7(target=es2015).js b/tests/baselines/reference/accessorsOverrideProperty7(target=es2015).js new file mode 100644 index 0000000000000..2fa70d0f2b72f --- /dev/null +++ b/tests/baselines/reference/accessorsOverrideProperty7(target=es2015).js @@ -0,0 +1,17 @@ +//// [tests/cases/conformance/classes/propertyMemberDeclarations/accessorsOverrideProperty7.ts] //// + +//// [accessorsOverrideProperty7.ts] +abstract class A { + abstract p = 'yep' +} +class B extends A { + get p() { return 'oh no' } // error +} + + +//// [accessorsOverrideProperty7.js] +class A { +} +class B extends A { + get p() { return 'oh no'; } // error +} diff --git a/tests/baselines/reference/accessorsOverrideProperty7.symbols b/tests/baselines/reference/accessorsOverrideProperty7(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/accessorsOverrideProperty7.symbols rename to tests/baselines/reference/accessorsOverrideProperty7(target=es2015).symbols diff --git a/tests/baselines/reference/accessorsOverrideProperty7.types b/tests/baselines/reference/accessorsOverrideProperty7(target=es2015).types similarity index 100% rename from tests/baselines/reference/accessorsOverrideProperty7.types rename to tests/baselines/reference/accessorsOverrideProperty7(target=es2015).types diff --git a/tests/baselines/reference/accessorsOverrideProperty7(target=es5).errors.txt b/tests/baselines/reference/accessorsOverrideProperty7(target=es5).errors.txt new file mode 100644 index 0000000000000..33a92cd351372 --- /dev/null +++ b/tests/baselines/reference/accessorsOverrideProperty7(target=es5).errors.txt @@ -0,0 +1,16 @@ +accessorsOverrideProperty7.ts(2,14): error TS1267: Property 'p' cannot have an initializer because it is marked abstract. +accessorsOverrideProperty7.ts(5,9): error TS2611: 'p' is defined as a property in class 'A', but is overridden here in 'B' as an accessor. + + +==== accessorsOverrideProperty7.ts (2 errors) ==== + abstract class A { + abstract p = 'yep' + ~ +!!! error TS1267: Property 'p' cannot have an initializer because it is marked abstract. + } + class B extends A { + get p() { return 'oh no' } // error + ~ +!!! error TS2611: 'p' is defined as a property in class 'A', but is overridden here in 'B' as an accessor. + } + \ No newline at end of file diff --git a/tests/baselines/reference/accessorsOverrideProperty7.js b/tests/baselines/reference/accessorsOverrideProperty7(target=es5).js similarity index 100% rename from tests/baselines/reference/accessorsOverrideProperty7.js rename to tests/baselines/reference/accessorsOverrideProperty7(target=es5).js diff --git a/tests/baselines/reference/accessorsOverrideProperty7(target=es5).symbols b/tests/baselines/reference/accessorsOverrideProperty7(target=es5).symbols new file mode 100644 index 0000000000000..4cc176675fa0b --- /dev/null +++ b/tests/baselines/reference/accessorsOverrideProperty7(target=es5).symbols @@ -0,0 +1,17 @@ +//// [tests/cases/conformance/classes/propertyMemberDeclarations/accessorsOverrideProperty7.ts] //// + +=== accessorsOverrideProperty7.ts === +abstract class A { +>A : Symbol(A, Decl(accessorsOverrideProperty7.ts, 0, 0)) + + abstract p = 'yep' +>p : Symbol(A.p, Decl(accessorsOverrideProperty7.ts, 0, 18)) +} +class B extends A { +>B : Symbol(B, Decl(accessorsOverrideProperty7.ts, 2, 1)) +>A : Symbol(A, Decl(accessorsOverrideProperty7.ts, 0, 0)) + + get p() { return 'oh no' } // error +>p : Symbol(B.p, Decl(accessorsOverrideProperty7.ts, 3, 19)) +} + diff --git a/tests/baselines/reference/accessorsOverrideProperty7(target=es5).types b/tests/baselines/reference/accessorsOverrideProperty7(target=es5).types new file mode 100644 index 0000000000000..cf3a4c4c87fd8 --- /dev/null +++ b/tests/baselines/reference/accessorsOverrideProperty7(target=es5).types @@ -0,0 +1,26 @@ +//// [tests/cases/conformance/classes/propertyMemberDeclarations/accessorsOverrideProperty7.ts] //// + +=== accessorsOverrideProperty7.ts === +abstract class A { +>A : A +> : ^ + + abstract p = 'yep' +>p : string +> : ^^^^^^ +>'yep' : "yep" +> : ^^^^^ +} +class B extends A { +>B : B +> : ^ +>A : A +> : ^ + + get p() { return 'oh no' } // error +>p : string +> : ^^^^^^ +>'oh no' : "oh no" +> : ^^^^^^^ +} + diff --git a/tests/baselines/reference/accessors_spec_section-4.5_error-cases.js b/tests/baselines/reference/accessors_spec_section-4.5_error-cases.js index 9a23d75382896..9ea30819ca58d 100644 --- a/tests/baselines/reference/accessors_spec_section-4.5_error-cases.js +++ b/tests/baselines/reference/accessors_spec_section-4.5_error-cases.js @@ -16,32 +16,13 @@ class LanguageSpec_section_4_5_error_cases { } //// [accessors_spec_section-4.5_error-cases.js] -var LanguageSpec_section_4_5_error_cases = /** @class */ (function () { - function LanguageSpec_section_4_5_error_cases() { - } - Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedSetter_SetterFirst", { - get: function () { return ""; }, - set: function (a) { }, - enumerable: false, - configurable: true - }); - Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedSetter_SetterLast", { - get: function () { return ""; }, - set: function (a) { }, - enumerable: false, - configurable: true - }); - Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedGetter_GetterFirst", { - get: function () { return ""; }, - set: function (aStr) { aStr = 0; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedGetter_GetterLast", { - get: function () { return ""; }, - set: function (aStr) { aStr = 0; }, - enumerable: false, - configurable: true - }); - return LanguageSpec_section_4_5_error_cases; -}()); +class LanguageSpec_section_4_5_error_cases { + set AnnotatedSetter_SetterFirst(a) { } + get AnnotatedSetter_SetterFirst() { return ""; } + get AnnotatedSetter_SetterLast() { return ""; } + set AnnotatedSetter_SetterLast(a) { } + get AnnotatedGetter_GetterFirst() { return ""; } + set AnnotatedGetter_GetterFirst(aStr) { aStr = 0; } + set AnnotatedGetter_GetterLast(aStr) { aStr = 0; } + get AnnotatedGetter_GetterLast() { return ""; } +} 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 24c228f075453..81138a81d0bc6 100644 --- a/tests/baselines/reference/accessors_spec_section-4.5_inference.js +++ b/tests/baselines/reference/accessors_spec_section-4.5_inference.js @@ -27,71 +27,21 @@ class LanguageSpec_section_4_5_inference { } //// [accessors_spec_section-4.5_inference.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var A = /** @class */ (function () { - function A() { - } - return A; -}()); -var B = /** @class */ (function (_super) { - __extends(B, _super); - function B() { - return _super !== null && _super.apply(this, arguments) || this; - } - return B; -}(A)); -var LanguageSpec_section_4_5_inference = /** @class */ (function () { - function LanguageSpec_section_4_5_inference() { - } - Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredGetterFromSetterAnnotation", { - get: function () { return new B(); }, - set: function (a) { }, - enumerable: false, - configurable: true - }); - Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredGetterFromSetterAnnotation_GetterFirst", { - get: function () { return new B(); }, - set: function (a) { }, - enumerable: false, - configurable: true - }); - Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredFromGetter", { - get: function () { return new B(); }, - set: function (a) { }, - enumerable: false, - configurable: true - }); - Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredFromGetter_SetterFirst", { - get: function () { return new B(); }, - set: function (a) { }, - enumerable: false, - configurable: true - }); - Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredSetterFromGetterAnnotation", { - get: function () { return new B(); }, - set: function (a) { }, - enumerable: false, - configurable: true - }); - Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredSetterFromGetterAnnotation_GetterFirst", { - get: function () { return new B(); }, - set: function (a) { }, - enumerable: false, - configurable: true - }); - return LanguageSpec_section_4_5_inference; -}()); +class A { +} +class B extends A { +} +class LanguageSpec_section_4_5_inference { + set InferredGetterFromSetterAnnotation(a) { } + get InferredGetterFromSetterAnnotation() { return new B(); } + get InferredGetterFromSetterAnnotation_GetterFirst() { return new B(); } + set InferredGetterFromSetterAnnotation_GetterFirst(a) { } + get InferredFromGetter() { return new B(); } + set InferredFromGetter(a) { } + set InferredFromGetter_SetterFirst(a) { } + get InferredFromGetter_SetterFirst() { return new B(); } + set InferredSetterFromGetterAnnotation(a) { } + get InferredSetterFromGetterAnnotation() { return new B(); } + get InferredSetterFromGetterAnnotation_GetterFirst() { return new B(); } + set InferredSetterFromGetterAnnotation_GetterFirst(a) { } +} diff --git a/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js b/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js index 589def5941fd3..44661c52d3bed 100644 --- a/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js +++ b/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js @@ -43,12 +43,9 @@ var r20 = a + ((a: string) => { return a }); //// [additionOperatorWithAnyAndEveryType.js] function foo() { } -var C = /** @class */ (function () { - function C() { - } - C.foo = function () { }; - return C; -}()); +class C { + static foo() { } +} var E; (function (E) { E[E["a"] = 0] = "a"; @@ -85,4 +82,4 @@ var r16 = a + M; var r17 = a + ''; var r18 = a + 123; var r19 = a + { a: '' }; -var r20 = a + (function (a) { return a; }); +var r20 = a + ((a) => { return a; }); diff --git a/tests/baselines/reference/additionOperatorWithConstrainedTypeParameter.js b/tests/baselines/reference/additionOperatorWithConstrainedTypeParameter.js index dbf1f3ddaa83e..6bd92fe270e43 100644 --- a/tests/baselines/reference/additionOperatorWithConstrainedTypeParameter.js +++ b/tests/baselines/reference/additionOperatorWithConstrainedTypeParameter.js @@ -21,8 +21,7 @@ function sum(n, v, k) { n += v[k]; // += should work the same way } function realSum(n, vs, k) { - for (var _i = 0, vs_1 = vs; _i < vs_1.length; _i++) { - var v = vs_1[_i]; + for (const v of vs) { n = n + v[k]; n += v[k]; } diff --git a/tests/baselines/reference/additionOperatorWithInvalidOperands.js b/tests/baselines/reference/additionOperatorWithInvalidOperands.js index d42f381dfd70c..ee53f3b495928 100644 --- a/tests/baselines/reference/additionOperatorWithInvalidOperands.js +++ b/tests/baselines/reference/additionOperatorWithInvalidOperands.js @@ -44,12 +44,9 @@ var r20 = E.a + M; //// [additionOperatorWithInvalidOperands.js] function foo() { } -var C = /** @class */ (function () { - function C() { - } - C.foo = function () { }; - return C; -}()); +class C { + static foo() { } +} var E; (function (E) { E[E["a"] = 0] = "a"; diff --git a/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js b/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js index 6a38d10bd00aa..61b416eee5c68 100644 --- a/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js +++ b/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js @@ -40,4 +40,4 @@ var r7 = null + d; var r8 = null + true; var r9 = null + { a: '' }; var r10 = null + foo(); -var r11 = null + (function () { }); +var r11 = null + (() => { }); diff --git a/tests/baselines/reference/additionOperatorWithTypeParameter.js b/tests/baselines/reference/additionOperatorWithTypeParameter.js index aaf8c9d72d9b2..51302d3e39f06 100644 --- a/tests/baselines/reference/additionOperatorWithTypeParameter.js +++ b/tests/baselines/reference/additionOperatorWithTypeParameter.js @@ -48,13 +48,13 @@ var E; E[E["b"] = 1] = "b"; })(E || (E = {})); function foo(t, u) { - var a; - var b; - var c; - var d; - var e; - var g; - var f; + let a; + let b; + let c; + let d; + let e; + let g; + let f; // type parameter as left operand var r1 = t + a; // ok, one operand is any var r2 = t + b; @@ -76,6 +76,6 @@ function foo(t, u) { var r16 = t + undefined; var r17 = t + t; var r18 = t + u; - var r19 = t + (function () { }); + var r19 = t + (() => { }); var r20 = t + []; } diff --git a/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js b/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js index c4d1cafd628d3..8dc0815fc1e71 100644 --- a/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js +++ b/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js @@ -40,4 +40,4 @@ var r7 = undefined + d; var r8 = undefined + true; var r9 = undefined + { a: '' }; var r10 = undefined + foo(); -var r11 = undefined + (function () { }); +var r11 = undefined + (() => { }); diff --git a/tests/baselines/reference/aliasAssignments.js b/tests/baselines/reference/aliasAssignments.js index c7016729c6542..c142e3ab3cfd2 100644 --- a/tests/baselines/reference/aliasAssignments.js +++ b/tests/baselines/reference/aliasAssignments.js @@ -17,16 +17,13 @@ y = moduleA; // should be error "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.someClass = void 0; -var someClass = /** @class */ (function () { - function someClass() { - } - return someClass; -}()); +class someClass { +} exports.someClass = someClass; //// [aliasAssignments_1.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var moduleA = require("./aliasAssignments_moduleA"); +const moduleA = require("./aliasAssignments_moduleA"); var x = moduleA; x = 1; // Should be error var y = 1; diff --git a/tests/baselines/reference/aliasBug.js b/tests/baselines/reference/aliasBug.js index 06141186575be..49ea8df48062e 100644 --- a/tests/baselines/reference/aliasBug.js +++ b/tests/baselines/reference/aliasBug.js @@ -24,21 +24,15 @@ function use() { //// [aliasBug.js] var foo; (function (foo) { - var Provide = /** @class */ (function () { - function Provide() { - } - return Provide; - }()); + class Provide { + } foo.Provide = Provide; - var bar; + let bar; (function (bar) { - var baz; + let baz; (function (baz) { - var boo = /** @class */ (function () { - function boo() { - } - return boo; - }()); + class boo { + } baz.boo = boo; })(baz = bar.baz || (bar.baz = {})); })(bar = foo.bar || (foo.bar = {})); diff --git a/tests/baselines/reference/aliasDoesNotDuplicateSignatures.js b/tests/baselines/reference/aliasDoesNotDuplicateSignatures.js index b3fc7f93ca314..83897aa62f9b6 100644 --- a/tests/baselines/reference/aliasDoesNotDuplicateSignatures.js +++ b/tests/baselines/reference/aliasDoesNotDuplicateSignatures.js @@ -17,7 +17,7 @@ let x2: string = f; //// [user.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var demoModule_1 = require("demoModule"); +const demoModule_1 = require("demoModule"); // Assign an incorrect type here to see the type of 'f'. -var x1 = demoNS.f; -var x2 = demoModule_1.f; +let x1 = demoNS.f; +let x2 = demoModule_1.f; diff --git a/tests/baselines/reference/aliasErrors.js b/tests/baselines/reference/aliasErrors.js index 5c30d59958a58..fb7e5c0f70c99 100644 --- a/tests/baselines/reference/aliasErrors.js +++ b/tests/baselines/reference/aliasErrors.js @@ -35,21 +35,15 @@ function use() { //// [aliasErrors.js] var foo; (function (foo) { - var Provide = /** @class */ (function () { - function Provide() { - } - return Provide; - }()); + class Provide { + } foo.Provide = Provide; - var bar; + let bar; (function (bar) { - var baz; + let baz; (function (baz) { - var boo = /** @class */ (function () { - function boo() { - } - return boo; - }()); + class boo { + } baz.boo = boo; })(baz = bar.baz || (bar.baz = {})); })(bar = foo.bar || (foo.bar = {})); diff --git a/tests/baselines/reference/aliasInaccessibleModule2.js b/tests/baselines/reference/aliasInaccessibleModule2.js index 46dd42695bb16..979b7157bb7ce 100644 --- a/tests/baselines/reference/aliasInaccessibleModule2.js +++ b/tests/baselines/reference/aliasInaccessibleModule2.js @@ -14,13 +14,10 @@ namespace M { //// [aliasInaccessibleModule2.js] var M; (function (M) { - var N; + let N; (function (N) { - var C = /** @class */ (function () { - function C() { - } - return C; - }()); + class C { + } })(N || (N = {})); var R = N; M.X = R; diff --git a/tests/baselines/reference/aliasInstantiationExpressionGenericIntersectionNoCrash1.js b/tests/baselines/reference/aliasInstantiationExpressionGenericIntersectionNoCrash1.js index 33b0409825620..3288d203a99aa 100644 --- a/tests/baselines/reference/aliasInstantiationExpressionGenericIntersectionNoCrash1.js +++ b/tests/baselines/reference/aliasInstantiationExpressionGenericIntersectionNoCrash1.js @@ -15,9 +15,6 @@ e as ErrAlias; //// [aliasInstantiationExpressionGenericIntersectionNoCrash1.js] "use strict"; -var ErrImpl = /** @class */ (function () { - function ErrImpl() { - } - return ErrImpl; -}()); +class ErrImpl { +} e; diff --git a/tests/baselines/reference/aliasOfGenericFunctionWithRestBehavedSameAsUnaliased.js b/tests/baselines/reference/aliasOfGenericFunctionWithRestBehavedSameAsUnaliased.js index 2c9b4bfc91371..b9243024a9295 100644 --- a/tests/baselines/reference/aliasOfGenericFunctionWithRestBehavedSameAsUnaliased.js +++ b/tests/baselines/reference/aliasOfGenericFunctionWithRestBehavedSameAsUnaliased.js @@ -38,7 +38,7 @@ let check3: test3 = "y"; //// [aliasOfGenericFunctionWithRestBehavedSameAsUnaliased.js] "use strict"; // the type printback for every `test` below should be "y" -var check = "y"; -var check1 = "y"; -var check2 = "y"; -var check3 = "y"; +let check = "y"; +let check1 = "y"; +let check2 = "y"; +let check3 = "y"; diff --git a/tests/baselines/reference/aliasUsageInAccessorsOfClass(target=es2015).js b/tests/baselines/reference/aliasUsageInAccessorsOfClass(target=es2015).js new file mode 100644 index 0000000000000..94399a1e62209 --- /dev/null +++ b/tests/baselines/reference/aliasUsageInAccessorsOfClass(target=es2015).js @@ -0,0 +1,56 @@ +//// [tests/cases/compiler/aliasUsageInAccessorsOfClass.ts] //// + +//// [aliasUsage1_backbone.ts] +export class Model { + public someData: string; +} + +//// [aliasUsage1_moduleA.ts] +import Backbone = require("./aliasUsage1_backbone"); +export class VisualizationModel extends Backbone.Model { + // interesting stuff here +} + +//// [aliasUsage1_main.ts] +import Backbone = require("./aliasUsage1_backbone"); +import moduleA = require("./aliasUsage1_moduleA"); +interface IHasVisualizationModel { + VisualizationModel: typeof Backbone.Model; +} +class C2 { + x: IHasVisualizationModel; + get A() { + return this.x; + } + set A(x) { + x = moduleA; + } +} + +//// [aliasUsage1_backbone.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Model = void 0; +class Model { +} +exports.Model = Model; +//// [aliasUsage1_moduleA.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.VisualizationModel = void 0; +const Backbone = require("./aliasUsage1_backbone"); +class VisualizationModel extends Backbone.Model { +} +exports.VisualizationModel = VisualizationModel; +//// [aliasUsage1_main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const moduleA = require("./aliasUsage1_moduleA"); +class C2 { + get A() { + return this.x; + } + set A(x) { + x = moduleA; + } +} diff --git a/tests/baselines/reference/aliasUsageInAccessorsOfClass.symbols b/tests/baselines/reference/aliasUsageInAccessorsOfClass(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/aliasUsageInAccessorsOfClass.symbols rename to tests/baselines/reference/aliasUsageInAccessorsOfClass(target=es2015).symbols diff --git a/tests/baselines/reference/aliasUsageInAccessorsOfClass.types b/tests/baselines/reference/aliasUsageInAccessorsOfClass(target=es2015).types similarity index 100% rename from tests/baselines/reference/aliasUsageInAccessorsOfClass.types rename to tests/baselines/reference/aliasUsageInAccessorsOfClass(target=es2015).types diff --git a/tests/baselines/reference/aliasUsageInAccessorsOfClass.js b/tests/baselines/reference/aliasUsageInAccessorsOfClass(target=es5).js similarity index 100% rename from tests/baselines/reference/aliasUsageInAccessorsOfClass.js rename to tests/baselines/reference/aliasUsageInAccessorsOfClass(target=es5).js diff --git a/tests/baselines/reference/aliasUsageInAccessorsOfClass(target=es5).symbols b/tests/baselines/reference/aliasUsageInAccessorsOfClass(target=es5).symbols new file mode 100644 index 0000000000000..d1d413ac6d15d --- /dev/null +++ b/tests/baselines/reference/aliasUsageInAccessorsOfClass(target=es5).symbols @@ -0,0 +1,63 @@ +//// [tests/cases/compiler/aliasUsageInAccessorsOfClass.ts] //// + +=== aliasUsage1_main.ts === +import Backbone = require("./aliasUsage1_backbone"); +>Backbone : Symbol(Backbone, Decl(aliasUsage1_main.ts, 0, 0)) + +import moduleA = require("./aliasUsage1_moduleA"); +>moduleA : Symbol(moduleA, Decl(aliasUsage1_main.ts, 0, 52)) + +interface IHasVisualizationModel { +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsage1_main.ts, 1, 50)) + + VisualizationModel: typeof Backbone.Model; +>VisualizationModel : Symbol(IHasVisualizationModel.VisualizationModel, Decl(aliasUsage1_main.ts, 2, 34)) +>Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsage1_backbone.ts, 0, 0)) +>Backbone : Symbol(Backbone, Decl(aliasUsage1_main.ts, 0, 0)) +>Model : Symbol(Backbone.Model, Decl(aliasUsage1_backbone.ts, 0, 0)) +} +class C2 { +>C2 : Symbol(C2, Decl(aliasUsage1_main.ts, 4, 1)) + + x: IHasVisualizationModel; +>x : Symbol(C2.x, Decl(aliasUsage1_main.ts, 5, 10)) +>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsage1_main.ts, 1, 50)) + + get A() { +>A : Symbol(C2.A, Decl(aliasUsage1_main.ts, 6, 30), Decl(aliasUsage1_main.ts, 9, 5)) + + return this.x; +>this.x : Symbol(C2.x, Decl(aliasUsage1_main.ts, 5, 10)) +>this : Symbol(C2, Decl(aliasUsage1_main.ts, 4, 1)) +>x : Symbol(C2.x, Decl(aliasUsage1_main.ts, 5, 10)) + } + set A(x) { +>A : Symbol(C2.A, Decl(aliasUsage1_main.ts, 6, 30), Decl(aliasUsage1_main.ts, 9, 5)) +>x : Symbol(x, Decl(aliasUsage1_main.ts, 10, 10)) + + x = moduleA; +>x : Symbol(x, Decl(aliasUsage1_main.ts, 10, 10)) +>moduleA : Symbol(moduleA, Decl(aliasUsage1_main.ts, 0, 52)) + } +} +=== aliasUsage1_backbone.ts === +export class Model { +>Model : Symbol(Model, Decl(aliasUsage1_backbone.ts, 0, 0)) + + public someData: string; +>someData : Symbol(Model.someData, Decl(aliasUsage1_backbone.ts, 0, 20)) +} + +=== aliasUsage1_moduleA.ts === +import Backbone = require("./aliasUsage1_backbone"); +>Backbone : Symbol(Backbone, Decl(aliasUsage1_moduleA.ts, 0, 0)) + +export class VisualizationModel extends Backbone.Model { +>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsage1_moduleA.ts, 0, 52)) +>Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsage1_backbone.ts, 0, 0)) +>Backbone : Symbol(Backbone, Decl(aliasUsage1_moduleA.ts, 0, 0)) +>Model : Symbol(Backbone.Model, Decl(aliasUsage1_backbone.ts, 0, 0)) + + // interesting stuff here +} + diff --git a/tests/baselines/reference/aliasUsageInAccessorsOfClass(target=es5).types b/tests/baselines/reference/aliasUsageInAccessorsOfClass(target=es5).types new file mode 100644 index 0000000000000..7beed70e17673 --- /dev/null +++ b/tests/baselines/reference/aliasUsageInAccessorsOfClass(target=es5).types @@ -0,0 +1,85 @@ +//// [tests/cases/compiler/aliasUsageInAccessorsOfClass.ts] //// + +=== aliasUsage1_main.ts === +import Backbone = require("./aliasUsage1_backbone"); +>Backbone : typeof Backbone +> : ^^^^^^^^^^^^^^^ + +import moduleA = require("./aliasUsage1_moduleA"); +>moduleA : typeof moduleA +> : ^^^^^^^^^^^^^^ + +interface IHasVisualizationModel { + VisualizationModel: typeof Backbone.Model; +>VisualizationModel : typeof Backbone.Model +> : ^^^^^^^^^^^^^^^^^^^^^ +>Backbone.Model : typeof Backbone.Model +> : ^^^^^^^^^^^^^^^^^^^^^ +>Backbone : typeof Backbone +> : ^^^^^^^^^^^^^^^ +>Model : typeof Backbone.Model +> : ^^^^^^^^^^^^^^^^^^^^^ +} +class C2 { +>C2 : C2 +> : ^^ + + x: IHasVisualizationModel; +>x : IHasVisualizationModel +> : ^^^^^^^^^^^^^^^^^^^^^^ + + get A() { +>A : IHasVisualizationModel +> : ^^^^^^^^^^^^^^^^^^^^^^ + + return this.x; +>this.x : IHasVisualizationModel +> : ^^^^^^^^^^^^^^^^^^^^^^ +>this : this +> : ^^^^ +>x : IHasVisualizationModel +> : ^^^^^^^^^^^^^^^^^^^^^^ + } + set A(x) { +>A : IHasVisualizationModel +> : ^^^^^^^^^^^^^^^^^^^^^^ +>x : IHasVisualizationModel +> : ^^^^^^^^^^^^^^^^^^^^^^ + + x = moduleA; +>x = moduleA : typeof moduleA +> : ^^^^^^^^^^^^^^ +>x : IHasVisualizationModel +> : ^^^^^^^^^^^^^^^^^^^^^^ +>moduleA : typeof moduleA +> : ^^^^^^^^^^^^^^ + } +} +=== aliasUsage1_backbone.ts === +export class Model { +>Model : Model +> : ^^^^^ + + public someData: string; +>someData : string +> : ^^^^^^ +} + +=== aliasUsage1_moduleA.ts === +import Backbone = require("./aliasUsage1_backbone"); +>Backbone : typeof Backbone +> : ^^^^^^^^^^^^^^^ + +export class VisualizationModel extends Backbone.Model { +>VisualizationModel : VisualizationModel +> : ^^^^^^^^^^^^^^^^^^ +>Backbone.Model : Backbone.Model +> : ^^^^^^^^^^^^^^ +>Backbone : typeof Backbone +> : ^^^^^^^^^^^^^^^ +>Model : typeof Backbone.Model +> : ^^^^^^^^^^^^^^^^^^^^^ + + // interesting stuff here +} + diff --git a/tests/baselines/reference/aliasUsageInArray.js b/tests/baselines/reference/aliasUsageInArray.js index 565d7c47f02dd..e6fc432309790 100644 --- a/tests/baselines/reference/aliasUsageInArray.js +++ b/tests/baselines/reference/aliasUsageInArray.js @@ -25,43 +25,20 @@ var xs2: typeof moduleA[] = [moduleA]; "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Model = void 0; -var Model = /** @class */ (function () { - function Model() { - } - return Model; -}()); +class Model { +} exports.Model = Model; //// [aliasUsageInArray_moduleA.js] "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.VisualizationModel = void 0; -var Backbone = require("./aliasUsageInArray_backbone"); -var VisualizationModel = /** @class */ (function (_super) { - __extends(VisualizationModel, _super); - function VisualizationModel() { - return _super !== null && _super.apply(this, arguments) || this; - } - return VisualizationModel; -}(Backbone.Model)); +const Backbone = require("./aliasUsageInArray_backbone"); +class VisualizationModel extends Backbone.Model { +} exports.VisualizationModel = VisualizationModel; //// [aliasUsageInArray_main.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var moduleA = require("./aliasUsageInArray_moduleA"); +const 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 037c21f0dcd77..edaee4debcb30 100644 --- a/tests/baselines/reference/aliasUsageInFunctionExpression.js +++ b/tests/baselines/reference/aliasUsageInFunctionExpression.js @@ -24,43 +24,20 @@ f = (x) => moduleA; "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Model = void 0; -var Model = /** @class */ (function () { - function Model() { - } - return Model; -}()); +class Model { +} exports.Model = Model; //// [aliasUsageInFunctionExpression_moduleA.js] "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.VisualizationModel = void 0; -var Backbone = require("./aliasUsageInFunctionExpression_backbone"); -var VisualizationModel = /** @class */ (function (_super) { - __extends(VisualizationModel, _super); - function VisualizationModel() { - return _super !== null && _super.apply(this, arguments) || this; - } - return VisualizationModel; -}(Backbone.Model)); +const Backbone = require("./aliasUsageInFunctionExpression_backbone"); +class VisualizationModel extends Backbone.Model { +} exports.VisualizationModel = VisualizationModel; //// [aliasUsageInFunctionExpression_main.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var moduleA = require("./aliasUsageInFunctionExpression_moduleA"); -var f = function (x) { return x; }; -f = function (x) { return moduleA; }; +const moduleA = require("./aliasUsageInFunctionExpression_moduleA"); +var f = (x) => x; +f = (x) => moduleA; diff --git a/tests/baselines/reference/aliasUsageInGenericFunction.js b/tests/baselines/reference/aliasUsageInGenericFunction.js index 8d229a117830b..05781b2049764 100644 --- a/tests/baselines/reference/aliasUsageInGenericFunction.js +++ b/tests/baselines/reference/aliasUsageInGenericFunction.js @@ -28,44 +28,21 @@ var r2 = foo({ a: null }); "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Model = void 0; -var Model = /** @class */ (function () { - function Model() { - } - return Model; -}()); +class Model { +} exports.Model = Model; //// [aliasUsageInGenericFunction_moduleA.js] "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.VisualizationModel = void 0; -var Backbone = require("./aliasUsageInGenericFunction_backbone"); -var VisualizationModel = /** @class */ (function (_super) { - __extends(VisualizationModel, _super); - function VisualizationModel() { - return _super !== null && _super.apply(this, arguments) || this; - } - return VisualizationModel; -}(Backbone.Model)); +const Backbone = require("./aliasUsageInGenericFunction_backbone"); +class VisualizationModel extends Backbone.Model { +} exports.VisualizationModel = VisualizationModel; //// [aliasUsageInGenericFunction_main.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var moduleA = require("./aliasUsageInGenericFunction_moduleA"); +const moduleA = require("./aliasUsageInGenericFunction_moduleA"); function foo(x) { return x; } diff --git a/tests/baselines/reference/aliasUsageInIndexerOfClass.js b/tests/baselines/reference/aliasUsageInIndexerOfClass.js index 7ce3cc298d041..f136ee4d72423 100644 --- a/tests/baselines/reference/aliasUsageInIndexerOfClass.js +++ b/tests/baselines/reference/aliasUsageInIndexerOfClass.js @@ -30,52 +30,25 @@ class N2 { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Model = void 0; -var Model = /** @class */ (function () { - function Model() { - } - return Model; -}()); +class Model { +} exports.Model = Model; //// [aliasUsageInIndexerOfClass_moduleA.js] "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.VisualizationModel = void 0; -var Backbone = require("./aliasUsageInIndexerOfClass_backbone"); -var VisualizationModel = /** @class */ (function (_super) { - __extends(VisualizationModel, _super); - function VisualizationModel() { - return _super !== null && _super.apply(this, arguments) || this; - } - return VisualizationModel; -}(Backbone.Model)); +const Backbone = require("./aliasUsageInIndexerOfClass_backbone"); +class VisualizationModel extends Backbone.Model { +} exports.VisualizationModel = VisualizationModel; //// [aliasUsageInIndexerOfClass_main.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var moduleA = require("./aliasUsageInIndexerOfClass_moduleA"); -var N = /** @class */ (function () { - function N() { +const moduleA = require("./aliasUsageInIndexerOfClass_moduleA"); +class N { + constructor() { this.x = moduleA; } - return N; -}()); -var N2 = /** @class */ (function () { - function N2() { - } - return N2; -}()); +} +class N2 { +} diff --git a/tests/baselines/reference/aliasUsageInObjectLiteral.js b/tests/baselines/reference/aliasUsageInObjectLiteral.js index fb5c1b3e9a963..ebee1274603e9 100644 --- a/tests/baselines/reference/aliasUsageInObjectLiteral.js +++ b/tests/baselines/reference/aliasUsageInObjectLiteral.js @@ -25,44 +25,21 @@ var c: { y: { z: IHasVisualizationModel } } = { y: { z: moduleA } }; "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Model = void 0; -var Model = /** @class */ (function () { - function Model() { - } - return Model; -}()); +class Model { +} exports.Model = Model; //// [aliasUsageInObjectLiteral_moduleA.js] "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.VisualizationModel = void 0; -var Backbone = require("./aliasUsageInObjectLiteral_backbone"); -var VisualizationModel = /** @class */ (function (_super) { - __extends(VisualizationModel, _super); - function VisualizationModel() { - return _super !== null && _super.apply(this, arguments) || this; - } - return VisualizationModel; -}(Backbone.Model)); +const Backbone = require("./aliasUsageInObjectLiteral_backbone"); +class VisualizationModel extends Backbone.Model { +} exports.VisualizationModel = VisualizationModel; //// [aliasUsageInObjectLiteral_main.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var moduleA = require("./aliasUsageInObjectLiteral_moduleA"); +const moduleA = require("./aliasUsageInObjectLiteral_moduleA"); var a = { x: moduleA }; var b = { x: moduleA }; var c = { y: { z: moduleA } }; diff --git a/tests/baselines/reference/aliasUsageInOrExpression.js b/tests/baselines/reference/aliasUsageInOrExpression.js index 25545e99de318..64047c7769748 100644 --- a/tests/baselines/reference/aliasUsageInOrExpression.js +++ b/tests/baselines/reference/aliasUsageInOrExpression.js @@ -28,44 +28,21 @@ var f: { x: IHasVisualizationModel } = <{ x: IHasVisualizationModel }>null ? { x "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Model = void 0; -var Model = /** @class */ (function () { - function Model() { - } - return Model; -}()); +class Model { +} exports.Model = Model; //// [aliasUsageInOrExpression_moduleA.js] "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.VisualizationModel = void 0; -var Backbone = require("./aliasUsageInOrExpression_backbone"); -var VisualizationModel = /** @class */ (function (_super) { - __extends(VisualizationModel, _super); - function VisualizationModel() { - return _super !== null && _super.apply(this, arguments) || this; - } - return VisualizationModel; -}(Backbone.Model)); +const Backbone = require("./aliasUsageInOrExpression_backbone"); +class VisualizationModel extends Backbone.Model { +} exports.VisualizationModel = VisualizationModel; //// [aliasUsageInOrExpression_main.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var moduleA = require("./aliasUsageInOrExpression_moduleA"); +const moduleA = require("./aliasUsageInOrExpression_moduleA"); var d1 = i || moduleA; var d2 = i || moduleA; var d2 = moduleA || i; diff --git a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js index dcb3d9c483fc8..2cf2f0137bbb9 100644 --- a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js +++ b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js @@ -28,70 +28,26 @@ class D extends C { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Model = void 0; -var Model = /** @class */ (function () { - function Model() { - } - return Model; -}()); +class Model { +} exports.Model = Model; //// [aliasUsageInTypeArgumentOfExtendsClause_moduleA.js] "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.VisualizationModel = void 0; -var Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone"); -var VisualizationModel = /** @class */ (function (_super) { - __extends(VisualizationModel, _super); - function VisualizationModel() { - return _super !== null && _super.apply(this, arguments) || this; - } - return VisualizationModel; -}(Backbone.Model)); +const Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone"); +class VisualizationModel extends Backbone.Model { +} exports.VisualizationModel = VisualizationModel; //// [aliasUsageInTypeArgumentOfExtendsClause_main.js] "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", { value: true }); -var moduleA = require("./aliasUsageInTypeArgumentOfExtendsClause_moduleA"); -var C = /** @class */ (function () { - function C() { - } - return C; -}()); -var D = /** @class */ (function (_super) { - __extends(D, _super); - function D() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.x = moduleA; - return _this; +const moduleA = require("./aliasUsageInTypeArgumentOfExtendsClause_moduleA"); +class C { +} +class D extends C { + constructor() { + super(...arguments); + this.x = moduleA; } - return D; -}(C)); +} diff --git a/tests/baselines/reference/aliasUsageInVarAssignment.js b/tests/baselines/reference/aliasUsageInVarAssignment.js index 0e553a6e0a64b..a6ca39be48e68 100644 --- a/tests/baselines/reference/aliasUsageInVarAssignment.js +++ b/tests/baselines/reference/aliasUsageInVarAssignment.js @@ -24,39 +24,16 @@ var m: typeof moduleA = i; "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Model = void 0; -var Model = /** @class */ (function () { - function Model() { - } - return Model; -}()); +class Model { +} exports.Model = Model; //// [aliasUsageInVarAssignment_moduleA.js] "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.VisualizationModel = void 0; -var Backbone = require("./aliasUsageInVarAssignment_backbone"); -var VisualizationModel = /** @class */ (function (_super) { - __extends(VisualizationModel, _super); - function VisualizationModel() { - return _super !== null && _super.apply(this, arguments) || this; - } - return VisualizationModel; -}(Backbone.Model)); +const Backbone = require("./aliasUsageInVarAssignment_backbone"); +class VisualizationModel extends Backbone.Model { +} exports.VisualizationModel = VisualizationModel; //// [aliasUsageInVarAssignment_main.js] "use strict"; diff --git a/tests/baselines/reference/aliasUsedAsNameValue.js b/tests/baselines/reference/aliasUsedAsNameValue.js index 4f40c1a91a058..f8f3fdffa05f7 100644 --- a/tests/baselines/reference/aliasUsedAsNameValue.js +++ b/tests/baselines/reference/aliasUsedAsNameValue.js @@ -33,8 +33,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.a = void 0; /// /// -var mod = require("./aliasUsedAsNameValue_0"); -var b = require("./aliasUsedAsNameValue_1"); +const mod = require("./aliasUsedAsNameValue_0"); +const b = require("./aliasUsedAsNameValue_1"); var a = function () { //var x = mod.id; // TODO needed hack that mod is loaded b.b(mod); diff --git a/tests/baselines/reference/aliasesInSystemModule1.js b/tests/baselines/reference/aliasesInSystemModule1.js index d62fa78253009..2a8e3bb83f742 100644 --- a/tests/baselines/reference/aliasesInSystemModule1.js +++ b/tests/baselines/reference/aliasesInSystemModule1.js @@ -36,9 +36,9 @@ System.register(["foo"], function (exports_1, context_1) { z = new cls2(); (function (M) { M.cls = alias.Class; - var x = new alias.Class(); - var y = new M.cls(); - var z = new cls2(); + let x = new alias.Class(); + let y = new M.cls(); + let z = new cls2(); })(M || (M = {})); } }; diff --git a/tests/baselines/reference/aliasesInSystemModule2.js b/tests/baselines/reference/aliasesInSystemModule2.js index 7b72650283e83..ef462f184d38e 100644 --- a/tests/baselines/reference/aliasesInSystemModule2.js +++ b/tests/baselines/reference/aliasesInSystemModule2.js @@ -35,9 +35,9 @@ System.register(["foo"], function (exports_1, context_1) { z = new cls2(); (function (M) { M.cls = foo_1.alias.Class; - var x = new foo_1.alias.Class(); - var y = new M.cls(); - var z = new cls2(); + let x = new foo_1.alias.Class(); + let y = new M.cls(); + let z = new cls2(); })(M || (M = {})); } }; diff --git a/tests/baselines/reference/allowImportClausesToMergeWithTypes.js b/tests/baselines/reference/allowImportClausesToMergeWithTypes.js index c4f490d1435a4..e86a028cd1feb 100644 --- a/tests/baselines/reference/allowImportClausesToMergeWithTypes.js +++ b/tests/baselines/reference/allowImportClausesToMergeWithTypes.js @@ -40,9 +40,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; -var b_1 = __importDefault(require("./b")); +const b_1 = __importDefault(require("./b")); exports.default = b_1.default; -var x = { x: "" }; +const x = { x: "" }; b_1.default; //// [index.js] "use strict"; @@ -50,9 +50,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -var a_1 = __importDefault(require("./a")); -var x = { x: "" }; +const a_1 = __importDefault(require("./a")); +const x = { x: "" }; a_1.default; -var b_1 = __importDefault(require("./b")); +const b_1 = __importDefault(require("./b")); b_1.default; -var y = x; +const y = x; diff --git a/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.js b/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.js index 920b628fbf4b2..88e7f5f65f150 100644 --- a/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.js +++ b/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.js @@ -28,13 +28,13 @@ exports.vextend = extend; "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.a = void 0; -var func_1 = require("./func"); +const func_1 = require("./func"); // hover on vextend exports.a = (0, func_1.vextend)({ watch: { - data1: function (val) { + data1(val) { this.data2 = 1; }, - data2: function (val) { }, + data2(val) { }, } }); diff --git a/tests/baselines/reference/allowSyntheticDefaultImports1.js b/tests/baselines/reference/allowSyntheticDefaultImports1.js index 0b266c9009022..eecb8bb251495 100644 --- a/tests/baselines/reference/allowSyntheticDefaultImports1.js +++ b/tests/baselines/reference/allowSyntheticDefaultImports1.js @@ -17,5 +17,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); exports.x = void 0; -var b_1 = __importDefault(require("./b")); +const b_1 = __importDefault(require("./b")); exports.x = new b_1.default.Foo(); diff --git a/tests/baselines/reference/allowSyntheticDefaultImports10.js b/tests/baselines/reference/allowSyntheticDefaultImports10.js index 13ee18518c4ec..63bfe93ce78f9 100644 --- a/tests/baselines/reference/allowSyntheticDefaultImports10.js +++ b/tests/baselines/reference/allowSyntheticDefaultImports10.js @@ -13,6 +13,6 @@ Foo.default.default.foo(); //// [a.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var Foo = require("./b"); +const Foo = require("./b"); Foo.default.bar(); Foo.default.default.foo(); diff --git a/tests/baselines/reference/allowSyntheticDefaultImports3.js b/tests/baselines/reference/allowSyntheticDefaultImports3.js index b2525e1b33912..92257d6bd115c 100644 --- a/tests/baselines/reference/allowSyntheticDefaultImports3.js +++ b/tests/baselines/reference/allowSyntheticDefaultImports3.js @@ -18,11 +18,8 @@ System.register([], function (exports_1, context_1) { return { setters: [], execute: function () { - Foo = /** @class */ (function () { - function Foo() { - } - return Foo; - }()); + Foo = class Foo { + }; exports_1("Foo", Foo); } }; diff --git a/tests/baselines/reference/allowSyntheticDefaultImports4.js b/tests/baselines/reference/allowSyntheticDefaultImports4.js index ecd5acabd4757..a6ec766c41600 100644 --- a/tests/baselines/reference/allowSyntheticDefaultImports4.js +++ b/tests/baselines/reference/allowSyntheticDefaultImports4.js @@ -18,5 +18,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); exports.x = void 0; -var b_1 = __importDefault(require("./b")); +const b_1 = __importDefault(require("./b")); exports.x = new b_1.default(); diff --git a/tests/baselines/reference/allowSyntheticDefaultImports9.js b/tests/baselines/reference/allowSyntheticDefaultImports9.js index 5206974ee1db0..cc99033f91689 100644 --- a/tests/baselines/reference/allowSyntheticDefaultImports9.js +++ b/tests/baselines/reference/allowSyntheticDefaultImports9.js @@ -16,6 +16,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -var b_1 = __importDefault(require("./b")); +const b_1 = __importDefault(require("./b")); b_1.default.bar(); b_1.default.foo(); diff --git a/tests/baselines/reference/allowSyntheticDefaultImportsCanPaintCrossModuleDeclaration.js b/tests/baselines/reference/allowSyntheticDefaultImportsCanPaintCrossModuleDeclaration.js index 783e2c08e08a6..2a232b42e1cba 100644 --- a/tests/baselines/reference/allowSyntheticDefaultImportsCanPaintCrossModuleDeclaration.js +++ b/tests/baselines/reference/allowSyntheticDefaultImportsCanPaintCrossModuleDeclaration.js @@ -22,7 +22,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.A = void 0; -var file1_1 = require("./file1"); +const file1_1 = require("./file1"); exports.A = (0, file1_1.styled)(); diff --git a/tests/baselines/reference/allowUnescapedParagraphAndLineSeparatorsInStringLiteral.js b/tests/baselines/reference/allowUnescapedParagraphAndLineSeparatorsInStringLiteral.js index 9080fce8c91d5..c54c62dd3d2f0 100644 --- a/tests/baselines/reference/allowUnescapedParagraphAndLineSeparatorsInStringLiteral.js +++ b/tests/baselines/reference/allowUnescapedParagraphAndLineSeparatorsInStringLiteral.js @@ -33,14 +33,14 @@ var stringContainingUnescapedLineSeparator1 = "
STRING_CONTENT
"; var stringContainingUnescapedParagraphSeparator1 = "
STRING_CONTENT
"; var stringContainingUnescapedLineSeparator2 = '
STRING_CONTENT
'; var stringContainingUnescapedParagraphSeparator2 = '
STRING_CONTENT
'; -var stringContainingUnescapedLineSeparator3 = "\u2028STRING_CONTENT\u2028"; -var stringContainingUnescapedParagraphSeparator3 = "\u2029STRING_CONTENT\u2029"; +var stringContainingUnescapedLineSeparator3 = `
STRING_CONTENT
`; +var stringContainingUnescapedParagraphSeparator3 = `
STRING_CONTENT
`; // Array of unescaped line / paragraph separators var arr = [ "

STRING_CONTENT

", "


STRING_CONTENT


", "STRING_CONTENT
", "
STRING_CONTENT", - "", + `\
`, '
' ]; diff --git a/tests/baselines/reference/alwaysStrictModule3.js b/tests/baselines/reference/alwaysStrictModule3.js index 4665cfb4f06c9..a827144f67a36 100644 --- a/tests/baselines/reference/alwaysStrictModule3.js +++ b/tests/baselines/reference/alwaysStrictModule3.js @@ -6,4 +6,4 @@ export const a = 1; //// [alwaysStrictModule3.js] // module ES2015 -export var a = 1; +export const a = 1; diff --git a/tests/baselines/reference/alwaysStrictModule6.js b/tests/baselines/reference/alwaysStrictModule6(target=es2015).js similarity index 100% rename from tests/baselines/reference/alwaysStrictModule6.js rename to tests/baselines/reference/alwaysStrictModule6(target=es2015).js diff --git a/tests/baselines/reference/alwaysStrictModule6.symbols b/tests/baselines/reference/alwaysStrictModule6(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/alwaysStrictModule6.symbols rename to tests/baselines/reference/alwaysStrictModule6(target=es2015).symbols diff --git a/tests/baselines/reference/alwaysStrictModule6.types b/tests/baselines/reference/alwaysStrictModule6(target=es2015).types similarity index 100% rename from tests/baselines/reference/alwaysStrictModule6.types rename to tests/baselines/reference/alwaysStrictModule6(target=es2015).types diff --git a/tests/baselines/reference/alwaysStrictModule6(target=es5).js b/tests/baselines/reference/alwaysStrictModule6(target=es5).js new file mode 100644 index 0000000000000..f2ce673c3034c --- /dev/null +++ b/tests/baselines/reference/alwaysStrictModule6(target=es5).js @@ -0,0 +1,12 @@ +//// [tests/cases/compiler/alwaysStrictModule6.ts] //// + +//// [alwaysStrictModule6.ts] +// Targeting ES5 +export const a = 1; + +//// [alwaysStrictModule6.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +// Targeting ES5 +exports.a = 1; diff --git a/tests/baselines/reference/alwaysStrictModule6(target=es5).symbols b/tests/baselines/reference/alwaysStrictModule6(target=es5).symbols new file mode 100644 index 0000000000000..24da65b84e825 --- /dev/null +++ b/tests/baselines/reference/alwaysStrictModule6(target=es5).symbols @@ -0,0 +1,7 @@ +//// [tests/cases/compiler/alwaysStrictModule6.ts] //// + +=== alwaysStrictModule6.ts === +// Targeting ES5 +export const a = 1; +>a : Symbol(a, Decl(alwaysStrictModule6.ts, 1, 12)) + diff --git a/tests/baselines/reference/alwaysStrictModule6(target=es5).types b/tests/baselines/reference/alwaysStrictModule6(target=es5).types new file mode 100644 index 0000000000000..173dbe590d804 --- /dev/null +++ b/tests/baselines/reference/alwaysStrictModule6(target=es5).types @@ -0,0 +1,10 @@ +//// [tests/cases/compiler/alwaysStrictModule6.ts] //// + +=== alwaysStrictModule6.ts === +// Targeting ES5 +export const a = 1; +>a : 1 +> : ^ +>1 : 1 +> : ^ + diff --git a/tests/baselines/reference/ambient.js b/tests/baselines/reference/ambient.js index 5e94b128f71b8..d75b7f7fd8cd0 100644 --- a/tests/baselines/reference/ambient.js +++ b/tests/baselines/reference/ambient.js @@ -15,11 +15,8 @@ declare namespace ns { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.A = void 0; -var A = /** @class */ (function () { - function A() { - } - return A; -}()); +class A { +} exports.A = A; //// [b.js] "use strict"; diff --git a/tests/baselines/reference/ambientAccessors.js b/tests/baselines/reference/ambientAccessors(target=es2015).js similarity index 100% rename from tests/baselines/reference/ambientAccessors.js rename to tests/baselines/reference/ambientAccessors(target=es2015).js diff --git a/tests/baselines/reference/ambientAccessors.symbols b/tests/baselines/reference/ambientAccessors(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ambientAccessors.symbols rename to tests/baselines/reference/ambientAccessors(target=es2015).symbols diff --git a/tests/baselines/reference/ambientAccessors.types b/tests/baselines/reference/ambientAccessors(target=es2015).types similarity index 100% rename from tests/baselines/reference/ambientAccessors.types rename to tests/baselines/reference/ambientAccessors(target=es2015).types diff --git a/tests/baselines/reference/ambientAccessors(target=es5).js b/tests/baselines/reference/ambientAccessors(target=es5).js new file mode 100644 index 0000000000000..f9835d3460dd9 --- /dev/null +++ b/tests/baselines/reference/ambientAccessors(target=es5).js @@ -0,0 +1,32 @@ +//// [tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/ambientAccessors.ts] //// + +//// [ambientAccessors.ts] +// ok to use accessors in ambient class in ES3 +declare class C { + static get a(): string; + static set a(value: string); + + private static get b(): string; + private static set b(foo: string); + + get x(): string; + set x(value: string); + + private get y(): string; + private set y(foo: string); +} + +//// [ambientAccessors.js] + + +//// [ambientAccessors.d.ts] +declare class C { + static get a(): string; + static set a(value: string); + private static get b(); + private static set b(value); + get x(): string; + set x(value: string); + private get y(); + private set y(value); +} diff --git a/tests/baselines/reference/ambientAccessors(target=es5).symbols b/tests/baselines/reference/ambientAccessors(target=es5).symbols new file mode 100644 index 0000000000000..3937cede3ede5 --- /dev/null +++ b/tests/baselines/reference/ambientAccessors(target=es5).symbols @@ -0,0 +1,35 @@ +//// [tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/ambientAccessors.ts] //// + +=== ambientAccessors.ts === +// ok to use accessors in ambient class in ES3 +declare class C { +>C : Symbol(C, Decl(ambientAccessors.ts, 0, 0)) + + static get a(): string; +>a : Symbol(C.a, Decl(ambientAccessors.ts, 1, 17), Decl(ambientAccessors.ts, 2, 27)) + + static set a(value: string); +>a : Symbol(C.a, Decl(ambientAccessors.ts, 1, 17), Decl(ambientAccessors.ts, 2, 27)) +>value : Symbol(value, Decl(ambientAccessors.ts, 3, 17)) + + private static get b(): string; +>b : Symbol(C.b, Decl(ambientAccessors.ts, 3, 32), Decl(ambientAccessors.ts, 5, 35)) + + private static set b(foo: string); +>b : Symbol(C.b, Decl(ambientAccessors.ts, 3, 32), Decl(ambientAccessors.ts, 5, 35)) +>foo : Symbol(foo, Decl(ambientAccessors.ts, 6, 25)) + + get x(): string; +>x : Symbol(C.x, Decl(ambientAccessors.ts, 6, 38), Decl(ambientAccessors.ts, 8, 20)) + + set x(value: string); +>x : Symbol(C.x, Decl(ambientAccessors.ts, 6, 38), Decl(ambientAccessors.ts, 8, 20)) +>value : Symbol(value, Decl(ambientAccessors.ts, 9, 10)) + + private get y(): string; +>y : Symbol(C.y, Decl(ambientAccessors.ts, 9, 25), Decl(ambientAccessors.ts, 11, 28)) + + private set y(foo: string); +>y : Symbol(C.y, Decl(ambientAccessors.ts, 9, 25), Decl(ambientAccessors.ts, 11, 28)) +>foo : Symbol(foo, Decl(ambientAccessors.ts, 12, 18)) +} diff --git a/tests/baselines/reference/ambientAccessors(target=es5).types b/tests/baselines/reference/ambientAccessors(target=es5).types new file mode 100644 index 0000000000000..7525fb5fee95f --- /dev/null +++ b/tests/baselines/reference/ambientAccessors(target=es5).types @@ -0,0 +1,48 @@ +//// [tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/ambientAccessors.ts] //// + +=== ambientAccessors.ts === +// ok to use accessors in ambient class in ES3 +declare class C { +>C : C +> : ^ + + static get a(): string; +>a : string +> : ^^^^^^ + + static set a(value: string); +>a : string +> : ^^^^^^ +>value : string +> : ^^^^^^ + + private static get b(): string; +>b : string +> : ^^^^^^ + + private static set b(foo: string); +>b : string +> : ^^^^^^ +>foo : string +> : ^^^^^^ + + get x(): string; +>x : string +> : ^^^^^^ + + set x(value: string); +>x : string +> : ^^^^^^ +>value : string +> : ^^^^^^ + + private get y(): string; +>y : string +> : ^^^^^^ + + private set y(foo: string); +>y : string +> : ^^^^^^ +>foo : string +> : ^^^^^^ +} diff --git a/tests/baselines/reference/ambientConstLiterals.js b/tests/baselines/reference/ambientConstLiterals.js index 8b35d43487203..ebdf5daeff362 100644 --- a/tests/baselines/reference/ambientConstLiterals.js +++ b/tests/baselines/reference/ambientConstLiterals.js @@ -34,21 +34,21 @@ var E; E[E["C"] = 2] = "C"; E[E["non identifier"] = 3] = "non identifier"; })(E || (E = {})); -var c1 = "abc"; -var c2 = 123; -var c3 = c1; -var c4 = c2; -var c5 = f(123); -var c6 = f(-123); -var c7 = true; -var c8 = E.A; -var c8b = E["non identifier"]; -var c9 = { x: "abc" }; -var c10 = [123]; -var c11 = "abc" + "def"; -var c12 = 123 + 456; -var c13 = Math.random() > 0.5 ? "abc" : "def"; -var c14 = Math.random() > 0.5 ? 123 : 456; +const c1 = "abc"; +const c2 = 123; +const c3 = c1; +const c4 = c2; +const c5 = f(123); +const c6 = f(-123); +const c7 = true; +const c8 = E.A; +const c8b = E["non identifier"]; +const c9 = { x: "abc" }; +const c10 = [123]; +const c11 = "abc" + "def"; +const c12 = 123 + 456; +const c13 = Math.random() > 0.5 ? "abc" : "def"; +const c14 = Math.random() > 0.5 ? 123 : 456; //// [ambientConstLiterals.d.ts] diff --git a/tests/baselines/reference/ambientDeclarationsExternal.js b/tests/baselines/reference/ambientDeclarationsExternal.js index 6a4569d3dfcef..872ca9f1f8041 100644 --- a/tests/baselines/reference/ambientDeclarationsExternal.js +++ b/tests/baselines/reference/ambientDeclarationsExternal.js @@ -29,6 +29,6 @@ var n: number; "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Ambient external module members are always exported with or without export keyword when module lacks export assignment -var imp3 = require("equ2"); +const imp3 = require("equ2"); var n = imp3.x; var n; diff --git a/tests/baselines/reference/ambientDeclarationsPatterns.js b/tests/baselines/reference/ambientDeclarationsPatterns.js index 60a00583a8ba9..3344d96b11c20 100644 --- a/tests/baselines/reference/ambientDeclarationsPatterns.js +++ b/tests/baselines/reference/ambientDeclarationsPatterns.js @@ -39,10 +39,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); /// -var foobarbaz_1 = require("foobarbaz"); +const foobarbaz_1 = require("foobarbaz"); (0, foobarbaz_1.foo)(foobarbaz_1.baz); -var foosball_1 = require("foosball"); +const foosball_1 = require("foosball"); (0, foobarbaz_1.foo)(foosball_1.foos); // Works with relative file name -var file_text_1 = __importDefault(require("./file!text")); +const file_text_1 = __importDefault(require("./file!text")); (0, foobarbaz_1.foo)(file_text_1.default); diff --git a/tests/baselines/reference/ambientExternalModuleInAnotherExternalModule.js b/tests/baselines/reference/ambientExternalModuleInAnotherExternalModule.js index 900b03f321350..44a551ba0f300 100644 --- a/tests/baselines/reference/ambientExternalModuleInAnotherExternalModule.js +++ b/tests/baselines/reference/ambientExternalModuleInAnotherExternalModule.js @@ -14,12 +14,9 @@ var x = ext; //// [ambientExternalModuleInAnotherExternalModule.js] "use strict"; -var D = /** @class */ (function () { - function D() { - } - return D; -}()); +class D { +} // Cannot resolve this ext module reference -var ext = require("ext"); +const ext = require("ext"); var x = ext; module.exports = D; diff --git a/tests/baselines/reference/ambientGetters.errors.txt b/tests/baselines/reference/ambientGetters(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/ambientGetters.errors.txt rename to tests/baselines/reference/ambientGetters(target=es2015).errors.txt diff --git a/tests/baselines/reference/ambientGetters.js b/tests/baselines/reference/ambientGetters(target=es2015).js similarity index 100% rename from tests/baselines/reference/ambientGetters.js rename to tests/baselines/reference/ambientGetters(target=es2015).js diff --git a/tests/baselines/reference/ambientGetters.symbols b/tests/baselines/reference/ambientGetters(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/ambientGetters.symbols rename to tests/baselines/reference/ambientGetters(target=es2015).symbols diff --git a/tests/baselines/reference/ambientGetters.types b/tests/baselines/reference/ambientGetters(target=es2015).types similarity index 100% rename from tests/baselines/reference/ambientGetters.types rename to tests/baselines/reference/ambientGetters(target=es2015).types diff --git a/tests/baselines/reference/ambientGetters(target=es5).errors.txt b/tests/baselines/reference/ambientGetters(target=es5).errors.txt new file mode 100644 index 0000000000000..f9b413134eb70 --- /dev/null +++ b/tests/baselines/reference/ambientGetters(target=es5).errors.txt @@ -0,0 +1,13 @@ +ambientGetters.ts(6,18): error TS1183: An implementation cannot be declared in ambient contexts. + + +==== ambientGetters.ts (1 errors) ==== + declare class A { + get length() : number; + } + + declare class B { + get length() { return 0; } + ~ +!!! error TS1183: An implementation cannot be declared in ambient contexts. + } \ No newline at end of file diff --git a/tests/baselines/reference/ambientGetters(target=es5).js b/tests/baselines/reference/ambientGetters(target=es5).js new file mode 100644 index 0000000000000..df95e36dbfd3e --- /dev/null +++ b/tests/baselines/reference/ambientGetters(target=es5).js @@ -0,0 +1,12 @@ +//// [tests/cases/compiler/ambientGetters.ts] //// + +//// [ambientGetters.ts] +declare class A { + get length() : number; +} + +declare class B { + get length() { return 0; } +} + +//// [ambientGetters.js] diff --git a/tests/baselines/reference/ambientGetters(target=es5).symbols b/tests/baselines/reference/ambientGetters(target=es5).symbols new file mode 100644 index 0000000000000..04d68bb5859f9 --- /dev/null +++ b/tests/baselines/reference/ambientGetters(target=es5).symbols @@ -0,0 +1,16 @@ +//// [tests/cases/compiler/ambientGetters.ts] //// + +=== ambientGetters.ts === +declare class A { +>A : Symbol(A, Decl(ambientGetters.ts, 0, 0)) + + get length() : number; +>length : Symbol(A.length, Decl(ambientGetters.ts, 0, 17)) +} + +declare class B { +>B : Symbol(B, Decl(ambientGetters.ts, 2, 1)) + + get length() { return 0; } +>length : Symbol(B.length, Decl(ambientGetters.ts, 4, 17)) +} diff --git a/tests/baselines/reference/ambientGetters(target=es5).types b/tests/baselines/reference/ambientGetters(target=es5).types new file mode 100644 index 0000000000000..c5bf3a8759444 --- /dev/null +++ b/tests/baselines/reference/ambientGetters(target=es5).types @@ -0,0 +1,22 @@ +//// [tests/cases/compiler/ambientGetters.ts] //// + +=== ambientGetters.ts === +declare class A { +>A : A +> : ^ + + get length() : number; +>length : number +> : ^^^^^^ +} + +declare class B { +>B : B +> : ^ + + get length() { return 0; } +>length : number +> : ^^^^^^ +>0 : 0 +> : ^ +} diff --git a/tests/baselines/reference/ambientNameRestrictions.js b/tests/baselines/reference/ambientNameRestrictions.js index 11ad18420f2d1..dccf38ca98059 100644 --- a/tests/baselines/reference/ambientNameRestrictions.js +++ b/tests/baselines/reference/ambientNameRestrictions.js @@ -7,5 +7,4 @@ export declare namespace Foo { //// [ambientNameRestrictions.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/tests/baselines/reference/ambientRequireFunction(module=commonjs).js b/tests/baselines/reference/ambientRequireFunction(module=commonjs).js index 348ee0a144389..430403e508cff 100644 --- a/tests/baselines/reference/ambientRequireFunction(module=commonjs).js +++ b/tests/baselines/reference/ambientRequireFunction(module=commonjs).js @@ -15,5 +15,5 @@ const text = fs.readFileSync("/a/b/c"); //// [app.js] /// -var fs = require("fs"); -var text = fs.readFileSync("/a/b/c"); +const fs = require("fs"); +const text = fs.readFileSync("/a/b/c"); diff --git a/tests/baselines/reference/ambientRequireFunction(module=preserve).js b/tests/baselines/reference/ambientRequireFunction(module=preserve).js index 348ee0a144389..430403e508cff 100644 --- a/tests/baselines/reference/ambientRequireFunction(module=preserve).js +++ b/tests/baselines/reference/ambientRequireFunction(module=preserve).js @@ -15,5 +15,5 @@ const text = fs.readFileSync("/a/b/c"); //// [app.js] /// -var fs = require("fs"); -var text = fs.readFileSync("/a/b/c"); +const fs = require("fs"); +const text = fs.readFileSync("/a/b/c"); diff --git a/tests/baselines/reference/ambientShorthand.js b/tests/baselines/reference/ambientShorthand.js index f2ceb3f85ab1a..e0fdb6a7dcbfb 100644 --- a/tests/baselines/reference/ambientShorthand.js +++ b/tests/baselines/reference/ambientShorthand.js @@ -50,7 +50,7 @@ var __importStar = (this && this.__importStar) || (function () { })(); Object.defineProperty(exports, "__esModule", { value: true }); /// -var jquery_1 = __importStar(require("jquery")); -var baz = __importStar(require("fs")); -var boom = require("jquery"); +const jquery_1 = __importStar(require("jquery")); +const baz = __importStar(require("fs")); +const boom = require("jquery"); (0, jquery_1.default)(jquery_1.bar, baz, boom); diff --git a/tests/baselines/reference/ambientShorthand_reExport.js b/tests/baselines/reference/ambientShorthand_reExport.js index fad16379ad344..34cb38935efce 100644 --- a/tests/baselines/reference/ambientShorthand_reExport.js +++ b/tests/baselines/reference/ambientShorthand_reExport.js @@ -76,7 +76,7 @@ var __importStar = (this && this.__importStar) || (function () { }; })(); Object.defineProperty(exports, "__esModule", { value: true }); -var reExportX_1 = require("./reExportX"); -var $ = __importStar(require("./reExportAll")); +const reExportX_1 = require("./reExportX"); +const $ = __importStar(require("./reExportAll")); // '$' is not callable, it is an object. (0, reExportX_1.x)($); diff --git a/tests/baselines/reference/ambiguousCallsWhereReturnTypesAgree.js b/tests/baselines/reference/ambiguousCallsWhereReturnTypesAgree.js index 9f7661c7a5579..6d3892807e237 100644 --- a/tests/baselines/reference/ambiguousCallsWhereReturnTypesAgree.js +++ b/tests/baselines/reference/ambiguousCallsWhereReturnTypesAgree.js @@ -31,24 +31,18 @@ class TestClass2 { //// [ambiguousCallsWhereReturnTypesAgree.js] -var TestClass = /** @class */ (function () { - function TestClass() { +class TestClass { + bar(x) { } - TestClass.prototype.bar = function (x) { - }; - TestClass.prototype.foo = function (x) { + foo(x) { this.bar(x); // should not error - }; - return TestClass; -}()); -var TestClass2 = /** @class */ (function () { - function TestClass2() { } - TestClass2.prototype.bar = function (x) { +} +class TestClass2 { + bar(x) { return 0; - }; - TestClass2.prototype.foo = function (x) { + } + foo(x) { return this.bar(x); // should not error - }; - return TestClass2; -}()); + } +} diff --git a/tests/baselines/reference/ambiguousGenericAssertion1.js b/tests/baselines/reference/ambiguousGenericAssertion1.js index 8cfd823941f07..7c0b0e667cc0a 100644 --- a/tests/baselines/reference/ambiguousGenericAssertion1.js +++ b/tests/baselines/reference/ambiguousGenericAssertion1.js @@ -9,7 +9,7 @@ var r3 = <(x: T) => T>f; // ambiguous, appears to the parser as a << operatio //// [ambiguousGenericAssertion1.js] function f(x) { return null; } -var r = function (x) { return x; }; +var r = (x) => x; var r2 = f; // valid var r3 = << T > (x), T; T > f; // ambiguous, appears to the parser as a << operation diff --git a/tests/baselines/reference/ambiguousOverloadResolution.js b/tests/baselines/reference/ambiguousOverloadResolution.js index da03893c9e486..c844269d597ce 100644 --- a/tests/baselines/reference/ambiguousOverloadResolution.js +++ b/tests/baselines/reference/ambiguousOverloadResolution.js @@ -11,32 +11,9 @@ var x: B; var t: number = f(x, x); // Not an error //// [ambiguousOverloadResolution.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var A = /** @class */ (function () { - function A() { - } - return A; -}()); -var B = /** @class */ (function (_super) { - __extends(B, _super); - function B() { - return _super !== null && _super.apply(this, arguments) || this; - } - return B; -}(A)); +class A { +} +class B extends 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 ad02552328f0e..777ffff2aeb43 100644 --- a/tests/baselines/reference/amdDeclarationEmitNoExtraDeclare.js +++ b/tests/baselines/reference/amdDeclarationEmitNoExtraDeclare.js @@ -22,56 +22,27 @@ export function Configurable>(base: T): T { //// [dist.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); define("Configurable", ["require", "exports"], function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Configurable = Configurable; function Configurable(base) { - return /** @class */ (function (_super) { - __extends(class_1, _super); - function class_1() { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return _super.apply(this, args) || this; + return class extends base { + constructor(...args) { + super(...args); } - return class_1; - }(base)); + }; } }); define("Class", ["require", "exports", "Configurable"], function (require, exports, Configurable_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ActualClass = exports.HiddenClass = void 0; - var HiddenClass = /** @class */ (function () { - function HiddenClass() { - } - return HiddenClass; - }()); + class HiddenClass { + } exports.HiddenClass = HiddenClass; - var ActualClass = /** @class */ (function (_super) { - __extends(ActualClass, _super); - function ActualClass() { - return _super !== null && _super.apply(this, arguments) || this; - } - return ActualClass; - }((0, Configurable_1.Configurable)(HiddenClass))); + class ActualClass extends (0, Configurable_1.Configurable)(HiddenClass) { + } exports.ActualClass = ActualClass; }); diff --git a/tests/baselines/reference/amdDependencyComment1.js b/tests/baselines/reference/amdDependencyComment1.js index 86a25964b7a93..e12e84748597b 100644 --- a/tests/baselines/reference/amdDependencyComment1.js +++ b/tests/baselines/reference/amdDependencyComment1.js @@ -10,5 +10,5 @@ m1.f(); "use strict"; /// Object.defineProperty(exports, "__esModule", { value: true }); -var m1 = require("m2"); +const m1 = require("m2"); m1.f(); diff --git a/tests/baselines/reference/amdDependencyCommentName1.js b/tests/baselines/reference/amdDependencyCommentName1.js index 8acd9de790c6c..7538bd86ee39e 100644 --- a/tests/baselines/reference/amdDependencyCommentName1.js +++ b/tests/baselines/reference/amdDependencyCommentName1.js @@ -10,5 +10,5 @@ m1.f(); "use strict"; /// Object.defineProperty(exports, "__esModule", { value: true }); -var m1 = require("m2"); +const m1 = require("m2"); m1.f(); diff --git a/tests/baselines/reference/amdImportNotAsPrimaryExpression.js b/tests/baselines/reference/amdImportNotAsPrimaryExpression.js index 89128a66b616a..f3749276a5242 100644 --- a/tests/baselines/reference/amdImportNotAsPrimaryExpression.js +++ b/tests/baselines/reference/amdImportNotAsPrimaryExpression.js @@ -36,14 +36,13 @@ define(["require", "exports"], function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.E1 = exports.C1 = void 0; - var C1 = /** @class */ (function () { - function C1() { + class C1 { + constructor() { this.m1 = 42; } - C1.s1 = true; - return C1; - }()); + } exports.C1 = C1; + C1.s1 = true; var E1; (function (E1) { E1[E1["A"] = 0] = "A"; diff --git a/tests/baselines/reference/amdModuleBundleNoDuplicateDeclarationEmitComments.js b/tests/baselines/reference/amdModuleBundleNoDuplicateDeclarationEmitComments.js index 0f7d4bf3528b8..977a58f7ddee1 100644 --- a/tests/baselines/reference/amdModuleBundleNoDuplicateDeclarationEmitComments.js +++ b/tests/baselines/reference/amdModuleBundleNoDuplicateDeclarationEmitComments.js @@ -13,11 +13,8 @@ define("mynamespace::SomeModuleA", ["require", "exports"], function (require, ex Object.defineProperty(exports, "__esModule", { value: true }); exports.Foo = void 0; /// - var Foo = /** @class */ (function () { - function Foo() { - } - return Foo; - }()); + class Foo { + } exports.Foo = Foo; }); define("mynamespace::SomeModuleB", ["require", "exports"], function (require, exports) { @@ -25,11 +22,8 @@ define("mynamespace::SomeModuleB", ["require", "exports"], function (require, ex Object.defineProperty(exports, "__esModule", { value: true }); exports.Bar = void 0; /// - var Bar = /** @class */ (function () { - function Bar() { - } - return Bar; - }()); + class Bar { + } exports.Bar = Bar; }); diff --git a/tests/baselines/reference/amdModuleConstEnumUsage.js b/tests/baselines/reference/amdModuleConstEnumUsage.js index 7cec2bf640e32..a6450c87a83fc 100644 --- a/tests/baselines/reference/amdModuleConstEnumUsage.js +++ b/tests/baselines/reference/amdModuleConstEnumUsage.js @@ -30,13 +30,10 @@ define(["require", "exports"], function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.User = void 0; - var User = /** @class */ (function () { - function User() { - } - User.prototype.method = function (input) { + class User { + method(input) { if (0 /* CharCode.A */ === input) { } - }; - return User; - }()); + } + } exports.User = User; }); diff --git a/tests/baselines/reference/amdModuleName1.js b/tests/baselines/reference/amdModuleName1.js index 8d2f54823c9d7..a862504699549 100644 --- a/tests/baselines/reference/amdModuleName1.js +++ b/tests/baselines/reference/amdModuleName1.js @@ -15,11 +15,10 @@ export = Foo; define("NamedModule", ["require", "exports"], function (require, exports) { "use strict"; /// - var Foo = /** @class */ (function () { - function Foo() { + class Foo { + constructor() { this.x = 5; } - return Foo; - }()); + } return Foo; }); diff --git a/tests/baselines/reference/amdModuleName2.js b/tests/baselines/reference/amdModuleName2.js index 9bfaff9e0cb46..0f5bc7b78b43f 100644 --- a/tests/baselines/reference/amdModuleName2.js +++ b/tests/baselines/reference/amdModuleName2.js @@ -17,11 +17,10 @@ define("SecondModuleName", ["require", "exports"], function (require, exports) { "use strict"; /// /// - var Foo = /** @class */ (function () { - function Foo() { + class Foo { + constructor() { this.x = 5; } - return Foo; - }()); + } return Foo; }); diff --git a/tests/baselines/reference/anonClassDeclarationEmitIsAnon.js b/tests/baselines/reference/anonClassDeclarationEmitIsAnon.js index 2c0dc04e17776..422051bc7ebe0 100644 --- a/tests/baselines/reference/anonClassDeclarationEmitIsAnon.js +++ b/tests/baselines/reference/anonClassDeclarationEmitIsAnon.js @@ -36,82 +36,43 @@ export class TimestampedUser extends Timestamped(User) { //// [wrapClass.js] "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.wrapClass = wrapClass; exports.Timestamped = Timestamped; function wrapClass(param) { - return /** @class */ (function () { - function Wrapped() { - } - Wrapped.prototype.foo = function () { + return class Wrapped { + foo() { return param; - }; - return Wrapped; - }()); + } + }; } function Timestamped(Base) { - return /** @class */ (function (_super) { - __extends(class_1, _super); - function class_1() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.timestamp = Date.now(); - return _this; + return class extends Base { + constructor() { + super(...arguments); + this.timestamp = Date.now(); } - return class_1; - }(Base)); + }; } //// [index.js] "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.TimestampedUser = exports.User = void 0; -var wrapClass_1 = require("./wrapClass"); +const wrapClass_1 = require("./wrapClass"); exports.default = (0, wrapClass_1.wrapClass)(0); // Simple class -var User = /** @class */ (function () { - function User() { +class User { + constructor() { this.name = ''; } - return User; -}()); +} exports.User = User; // User that is Timestamped -var TimestampedUser = /** @class */ (function (_super) { - __extends(TimestampedUser, _super); - function TimestampedUser() { - return _super.call(this) || this; +class TimestampedUser extends (0, wrapClass_1.Timestamped)(User) { + constructor() { + super(); } - return TimestampedUser; -}((0, wrapClass_1.Timestamped)(User))); +} exports.TimestampedUser = TimestampedUser; diff --git a/tests/baselines/reference/anonterface.js b/tests/baselines/reference/anonterface.js index d3f0b19d15683..c7e0fa4431e57 100644 --- a/tests/baselines/reference/anonterface.js +++ b/tests/baselines/reference/anonterface.js @@ -19,14 +19,11 @@ c.m(function(n) { return "hello: "+n; },18); //// [anonterface.js] var M; (function (M) { - var C = /** @class */ (function () { - function C() { - } - C.prototype.m = function (fn, n2) { + class C { + m(fn, n2) { return fn(n2); - }; - return C; - }()); + } + } M.C = C; })(M || (M = {})); var c = new M.C(); diff --git a/tests/baselines/reference/anonymousClassDeclarationDoesntPrintWithReadonly.js b/tests/baselines/reference/anonymousClassDeclarationDoesntPrintWithReadonly.js index ad6dafad14c7f..6a42de58a2a13 100644 --- a/tests/baselines/reference/anonymousClassDeclarationDoesntPrintWithReadonly.js +++ b/tests/baselines/reference/anonymousClassDeclarationDoesntPrintWithReadonly.js @@ -11,39 +11,18 @@ export function y() { //// [anonymousClassDeclarationDoesntPrintWithReadonly.js] "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.X = void 0; exports.y = y; -var X = /** @class */ (function () { - function X(a) { +class X { + constructor(a) { this.a = a; } - return X; -}()); +} exports.X = X; function y() { - return /** @class */ (function (_super) { - __extends(class_1, _super); - function class_1() { - return _super !== null && _super.apply(this, arguments) || this; - } - return class_1; - }(X)); + return class extends X { + }; } diff --git a/tests/baselines/reference/anonymousClassExpression1.js b/tests/baselines/reference/anonymousClassExpression1.js index 19d56aa17bfff..3e5146cc886ec 100644 --- a/tests/baselines/reference/anonymousClassExpression1.js +++ b/tests/baselines/reference/anonymousClassExpression1.js @@ -7,9 +7,6 @@ function f() { //// [anonymousClassExpression1.js] function f() { - return typeof /** @class */ (function () { - function class_1() { - } - return class_1; - }()) === "function"; + return typeof class { + } === "function"; } diff --git a/tests/baselines/reference/anonymousClassExpression2.js b/tests/baselines/reference/anonymousClassExpression2.js index 78ebb7c647468..015ed36417ebb 100644 --- a/tests/baselines/reference/anonymousClassExpression2.js +++ b/tests/baselines/reference/anonymousClassExpression2.js @@ -25,21 +25,15 @@ while (0) { // note: repros with `while (0);` too // but it's less inscrutable and more obvious to put it *inside* the loop while (0) { - var A = /** @class */ (function () { - function A() { - } - A.prototype.methodA = function () { + class A { + methodA() { 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 () { + } + class B { + methodB() { this.methodA; // error this.methodB; // ok - }; - return B; - }()); + } + } } diff --git a/tests/baselines/reference/anyAndUnknownHaveFalsyComponents.js b/tests/baselines/reference/anyAndUnknownHaveFalsyComponents.js index 6bc2b2b59e6c6..57b210842881a 100644 --- a/tests/baselines/reference/anyAndUnknownHaveFalsyComponents.js +++ b/tests/baselines/reference/anyAndUnknownHaveFalsyComponents.js @@ -31,26 +31,15 @@ function foo2() { //// [anyAndUnknownHaveFalsyComponents.js] -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -var y1 = x1 && 3; +const y1 = x1 && 3; function foo1() { - return __assign({ display: "block" }, (isTreeHeader1 && { + return Object.assign({ display: "block" }, (isTreeHeader1 && { display: "flex", })); } -var y2 = x2 && 3; +const y2 = x2 && 3; function foo2() { - return __assign({ display: "block" }, (isTreeHeader1 && { + return Object.assign({ display: "block" }, (isTreeHeader1 && { display: "flex", })); } diff --git a/tests/baselines/reference/anyAsGenericFunctionCall.js b/tests/baselines/reference/anyAsGenericFunctionCall.js index 742c22380c830..9f7f9469360f2 100644 --- a/tests/baselines/reference/anyAsGenericFunctionCall.js +++ b/tests/baselines/reference/anyAsGenericFunctionCall.js @@ -18,10 +18,7 @@ var d = x(x); var x; var a = x(); var b = x('hello'); -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { +} var c = x(x); var d = x(x); diff --git a/tests/baselines/reference/anyAssignabilityInInheritance.js b/tests/baselines/reference/anyAssignabilityInInheritance.js index e875dd54df978..e297c39e595c0 100644 --- a/tests/baselines/reference/anyAssignabilityInInheritance.js +++ b/tests/baselines/reference/anyAssignabilityInInheritance.js @@ -101,17 +101,11 @@ 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() { - } - return A; -}()); +class A { +} var r3 = foo3(a); // any -var A2 = /** @class */ (function () { - function A2() { - } - return A2; -}()); +class A2 { +} var r3 = foo3(a); // any var r3 = foo3(a); // any var r3 = foo3(a); // any @@ -125,11 +119,8 @@ function f() { } f.bar = 1; })(f || (f = {})); var r3 = foo3(a); // any -var CC = /** @class */ (function () { - function CC() { - } - return CC; -}()); +class CC { +} (function (CC) { CC.bar = 1; })(CC || (CC = {})); diff --git a/tests/baselines/reference/anyAssignableToEveryType.js b/tests/baselines/reference/anyAssignableToEveryType.js index 82f1f33bfe1c6..89616436c6a38 100644 --- a/tests/baselines/reference/anyAssignableToEveryType.js +++ b/tests/baselines/reference/anyAssignableToEveryType.js @@ -49,11 +49,8 @@ function foo(x: T, y: U, z: V) { //// [anyAssignableToEveryType.js] var a; -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { +} var ac; var ai; var E; diff --git a/tests/baselines/reference/anyAssignableToEveryType2.js b/tests/baselines/reference/anyAssignableToEveryType2.js index df6b6d02678f3..b2b39eb69861a 100644 --- a/tests/baselines/reference/anyAssignableToEveryType2.js +++ b/tests/baselines/reference/anyAssignableToEveryType2.js @@ -134,16 +134,10 @@ 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() { - } - return A; -}()); -var A2 = /** @class */ (function () { - function A2() { - } - return A2; -}()); +class A { +} +class A2 { +} var E; (function (E) { E[E["A"] = 0] = "A"; @@ -152,11 +146,8 @@ function f() { } (function (f) { f.bar = 1; })(f || (f = {})); -var c = /** @class */ (function () { - function c() { - } - return c; -}()); +class c { +} (function (c) { c.bar = 1; })(c || (c = {})); diff --git a/tests/baselines/reference/anyIdenticalToItself.js b/tests/baselines/reference/anyIdenticalToItself.js index f987b7a1fcdd4..7a4289adcd754 100644 --- a/tests/baselines/reference/anyIdenticalToItself.js +++ b/tests/baselines/reference/anyIdenticalToItself.js @@ -16,18 +16,11 @@ class C { //// [anyIdenticalToItself.js] function foo(x, y) { } -var C = /** @class */ (function () { - function C() { +class C { + get X() { + var y; + return y; } - Object.defineProperty(C.prototype, "X", { - get: function () { - var y; - return y; - }, - set: function (v) { - }, - enumerable: false, - configurable: true - }); - return C; -}()); + set X(v) { + } +} diff --git a/tests/baselines/reference/anyInferenceAnonymousFunctions.js b/tests/baselines/reference/anyInferenceAnonymousFunctions.js index b53bac5c9f3fb..473446d4ff15e 100644 --- a/tests/baselines/reference/anyInferenceAnonymousFunctions.js +++ b/tests/baselines/reference/anyInferenceAnonymousFunctions.js @@ -24,9 +24,9 @@ var paired; paired.reduce(function (a1, a2) { return a1.concat({}); }, []); -paired.reduce(function (b1, b2) { +paired.reduce((b1, b2) => { return b1.concat({}); }, []); -paired.reduce(function (b3, b4) { return b3.concat({}); }, []); -paired.map(function (c1) { return c1.count; }); +paired.reduce((b3, b4) => b3.concat({}), []); +paired.map((c1) => c1.count); paired.map(function (c2) { return c2.count; }); diff --git a/tests/baselines/reference/apparentTypeSubtyping.js b/tests/baselines/reference/apparentTypeSubtyping.js index aef1ab7d1badc..e94cce20f046e 100644 --- a/tests/baselines/reference/apparentTypeSubtyping.js +++ b/tests/baselines/reference/apparentTypeSubtyping.js @@ -26,44 +26,13 @@ class Derived2 extends Base2 { // error because of the prototy //// [apparentTypeSubtyping.js] // subtype checks use the apparent type of the target type // S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var Base = /** @class */ (function () { - function Base() { - } - return Base; -}()); +class Base { +} // 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() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Derived; -}(Base)); -var Base2 = /** @class */ (function () { - function Base2() { - } - return Base2; -}()); +class Derived extends Base { +} +class Base2 { +} // 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() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Derived2; -}(Base2)); +class Derived2 extends Base2 { +} diff --git a/tests/baselines/reference/apparentTypeSupertype.js b/tests/baselines/reference/apparentTypeSupertype.js index e7dcffde189b0..bf4e3f8a71966 100644 --- a/tests/baselines/reference/apparentTypeSupertype.js +++ b/tests/baselines/reference/apparentTypeSupertype.js @@ -16,31 +16,8 @@ class Derived extends Base { // error //// [apparentTypeSupertype.js] // subtype checks use the apparent type of the target type // S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var Base = /** @class */ (function () { - function Base() { - } - return Base; -}()); +class Base { +} // 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() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Derived; -}(Base)); +class Derived extends Base { +} diff --git a/tests/baselines/reference/argsInScope.js b/tests/baselines/reference/argsInScope.js index 6ba6be2e7c4d4..9183bef01141a 100644 --- a/tests/baselines/reference/argsInScope.js +++ b/tests/baselines/reference/argsInScope.js @@ -14,15 +14,12 @@ c.P(1,2,3); //// [argsInScope.js] -var C = /** @class */ (function () { - function C() { - } - C.prototype.P = function (ii, j, k) { +class C { + P(ii, j, k) { for (var i = 0; i < arguments.length; i++) { // WScript.Echo("param: " + arguments[i]); } - }; - return C; -}()); + } +} var c = new C(); c.P(1, 2, 3); diff --git a/tests/baselines/reference/argumentExpressionContextualTyping.js b/tests/baselines/reference/argumentExpressionContextualTyping.js index 4c73d0e458679..0ab90a276c6a1 100644 --- a/tests/baselines/reference/argumentExpressionContextualTyping.js +++ b/tests/baselines/reference/argumentExpressionContextualTyping.js @@ -21,22 +21,9 @@ baz(["string", 1, true, ...array]); // Error foo(o); // Error because x has an array type namely (string|number)[] //// [argumentExpressionContextualTyping.js] -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; // In a typed function call, argument expressions are contextually typed by their corresponding parameter types. -function foo(_a) { - var _b = _a.x, a = _b[0], b = _b[1], _c = _a.y, c = _c.c, d = _c.d, e = _c.e; -} -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 foo({ x: [a, b], y: { c, d, e } }) { } +function bar({ x: [a, b = 10], y: { c, d, e = { f: 1 } } }) { } 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 } }; @@ -47,5 +34,5 @@ var tuple = ["string", 1, true]; baz(tuple); baz(["string", 1, true]); baz(array); // Error -baz(__spreadArray(["string", 1, true], array, true)); // Error +baz(["string", 1, true, ...array]); // Error foo(o); // Error because x has an array type namely (string|number)[] diff --git a/tests/baselines/reference/argumentsAsPropertyName.js b/tests/baselines/reference/argumentsAsPropertyName.js index 2b65bf195afd0..165050408ea2b 100644 --- a/tests/baselines/reference/argumentsAsPropertyName.js +++ b/tests/baselines/reference/argumentsAsPropertyName.js @@ -19,13 +19,10 @@ function myFunction(myType: MyType) { //// [argumentsAsPropertyName.js] function myFunction(myType) { - var _loop_1 = function (i) { + for (let i = 0; i < 10; i++) { use(myType.arguments[i]); // create closure so that tsc will turn loop body into function - var x = 5; + const x = 5; [1, 2, 3].forEach(function (j) { use(x); }); - }; - for (var i = 0; i < 10; i++) { - _loop_1(i); } } diff --git a/tests/baselines/reference/argumentsAsPropertyName2.js b/tests/baselines/reference/argumentsAsPropertyName2.js index 29243412d7419..46d94dbf3a2dd 100644 --- a/tests/baselines/reference/argumentsAsPropertyName2.js +++ b/tests/baselines/reference/argumentsAsPropertyName2.js @@ -17,15 +17,11 @@ function foo() { //// [argumentsAsPropertyName2.js] // target: es5 function foo() { - var _loop_1 = function (x) { - var i; + for (let x = 0; x < 1; ++x) { + let i; [].forEach(function () { i; }); ({ arguments: 0 }); - ({ arguments: arguments_1 }); - ({ arguments: arguments_1 }); - }; - var arguments_1 = arguments; - for (var x = 0; x < 1; ++x) { - _loop_1(x); + ({ arguments }); + ({ arguments: arguments }); } } diff --git a/tests/baselines/reference/argumentsObjectIterator01_ES5(target=es2015).js b/tests/baselines/reference/argumentsObjectIterator01_ES5(target=es2015).js new file mode 100644 index 0000000000000..31f46e6e4481c --- /dev/null +++ b/tests/baselines/reference/argumentsObjectIterator01_ES5(target=es2015).js @@ -0,0 +1,19 @@ +//// [tests/cases/compiler/argumentsObjectIterator01_ES5.ts] //// + +//// [argumentsObjectIterator01_ES5.ts] +function doubleAndReturnAsArray(x: number, y: number, z: number): [number, number, number] { + let result = []; + for (let arg of arguments) { + result.push(arg + arg); + } + return <[any, any, any]>result; +} + +//// [argumentsObjectIterator01_ES5.js] +function doubleAndReturnAsArray(x, y, z) { + let result = []; + for (let arg of arguments) { + result.push(arg + arg); + } + return result; +} diff --git a/tests/baselines/reference/argumentsObjectIterator01_ES5.symbols b/tests/baselines/reference/argumentsObjectIterator01_ES5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/argumentsObjectIterator01_ES5.symbols rename to tests/baselines/reference/argumentsObjectIterator01_ES5(target=es2015).symbols diff --git a/tests/baselines/reference/argumentsObjectIterator01_ES5(target=es2015).types b/tests/baselines/reference/argumentsObjectIterator01_ES5(target=es2015).types new file mode 100644 index 0000000000000..029ea74a7bc8e --- /dev/null +++ b/tests/baselines/reference/argumentsObjectIterator01_ES5(target=es2015).types @@ -0,0 +1,43 @@ +//// [tests/cases/compiler/argumentsObjectIterator01_ES5.ts] //// + +=== argumentsObjectIterator01_ES5.ts === +function doubleAndReturnAsArray(x: number, y: number, z: number): [number, number, number] { +>doubleAndReturnAsArray : (x: number, y: number, z: number) => [number, number, number] +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>x : number +> : ^^^^^^ +>y : number +> : ^^^^^^ +>z : number +> : ^^^^^^ + + let result = []; +>result : any[] +> : ^^^^^ +>[] : undefined[] +> : ^^^^^^^^^^^ + + for (let arg of arguments) { +>arg : any +>arguments : IArguments +> : ^^^^^^^^^^ + + result.push(arg + arg); +>result.push(arg + arg) : number +> : ^^^^^^ +>result.push : (...items: any[]) => number +> : ^^^^ ^^^^^^^^^^^^ +>result : any[] +> : ^^^^^ +>push : (...items: any[]) => number +> : ^^^^ ^^^^^^^^^^^^ +>arg + arg : any +>arg : any +>arg : any + } + return <[any, any, any]>result; +><[any, any, any]>result : [any, any, any] +> : ^^^^^^^^^^^^^^^ +>result : any[] +> : ^^^^^ +} diff --git a/tests/baselines/reference/argumentsObjectIterator01_ES5.errors.txt b/tests/baselines/reference/argumentsObjectIterator01_ES5(target=es5).errors.txt similarity index 100% rename from tests/baselines/reference/argumentsObjectIterator01_ES5.errors.txt rename to tests/baselines/reference/argumentsObjectIterator01_ES5(target=es5).errors.txt diff --git a/tests/baselines/reference/argumentsObjectIterator01_ES5.js b/tests/baselines/reference/argumentsObjectIterator01_ES5(target=es5).js similarity index 100% rename from tests/baselines/reference/argumentsObjectIterator01_ES5.js rename to tests/baselines/reference/argumentsObjectIterator01_ES5(target=es5).js diff --git a/tests/baselines/reference/argumentsObjectIterator01_ES5(target=es5).symbols b/tests/baselines/reference/argumentsObjectIterator01_ES5(target=es5).symbols new file mode 100644 index 0000000000000..f4685e4f83589 --- /dev/null +++ b/tests/baselines/reference/argumentsObjectIterator01_ES5(target=es5).symbols @@ -0,0 +1,26 @@ +//// [tests/cases/compiler/argumentsObjectIterator01_ES5.ts] //// + +=== argumentsObjectIterator01_ES5.ts === +function doubleAndReturnAsArray(x: number, y: number, z: number): [number, number, number] { +>doubleAndReturnAsArray : Symbol(doubleAndReturnAsArray, Decl(argumentsObjectIterator01_ES5.ts, 0, 0)) +>x : Symbol(x, Decl(argumentsObjectIterator01_ES5.ts, 0, 32)) +>y : Symbol(y, Decl(argumentsObjectIterator01_ES5.ts, 0, 42)) +>z : Symbol(z, Decl(argumentsObjectIterator01_ES5.ts, 0, 53)) + + let result = []; +>result : Symbol(result, Decl(argumentsObjectIterator01_ES5.ts, 1, 7)) + + for (let arg of arguments) { +>arg : Symbol(arg, Decl(argumentsObjectIterator01_ES5.ts, 2, 12)) +>arguments : Symbol(arguments) + + result.push(arg + arg); +>result.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) +>result : Symbol(result, Decl(argumentsObjectIterator01_ES5.ts, 1, 7)) +>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) +>arg : Symbol(arg, Decl(argumentsObjectIterator01_ES5.ts, 2, 12)) +>arg : Symbol(arg, Decl(argumentsObjectIterator01_ES5.ts, 2, 12)) + } + return <[any, any, any]>result; +>result : Symbol(result, Decl(argumentsObjectIterator01_ES5.ts, 1, 7)) +} diff --git a/tests/baselines/reference/argumentsObjectIterator01_ES5.types b/tests/baselines/reference/argumentsObjectIterator01_ES5(target=es5).types similarity index 100% rename from tests/baselines/reference/argumentsObjectIterator01_ES5.types rename to tests/baselines/reference/argumentsObjectIterator01_ES5(target=es5).types diff --git a/tests/baselines/reference/argumentsObjectIterator02_ES5(target=es2015).js b/tests/baselines/reference/argumentsObjectIterator02_ES5(target=es2015).js new file mode 100644 index 0000000000000..d1a28404a2925 --- /dev/null +++ b/tests/baselines/reference/argumentsObjectIterator02_ES5(target=es2015).js @@ -0,0 +1,24 @@ +//// [tests/cases/compiler/argumentsObjectIterator02_ES5.ts] //// + +//// [argumentsObjectIterator02_ES5.ts] +function doubleAndReturnAsArray(x: number, y: number, z: number): [number, number, number] { + let blah = arguments[Symbol.iterator]; + + let result = []; + for (let arg of blah()) { + result.push(arg + arg); + } + return <[any, any, any]>result; +} + + + +//// [argumentsObjectIterator02_ES5.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/argumentsObjectIterator02_ES5.symbols b/tests/baselines/reference/argumentsObjectIterator02_ES5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/argumentsObjectIterator02_ES5.symbols rename to tests/baselines/reference/argumentsObjectIterator02_ES5(target=es2015).symbols diff --git a/tests/baselines/reference/argumentsObjectIterator02_ES5(target=es2015).types b/tests/baselines/reference/argumentsObjectIterator02_ES5(target=es2015).types new file mode 100644 index 0000000000000..a93506d96710c --- /dev/null +++ b/tests/baselines/reference/argumentsObjectIterator02_ES5(target=es2015).types @@ -0,0 +1,61 @@ +//// [tests/cases/compiler/argumentsObjectIterator02_ES5.ts] //// + +=== argumentsObjectIterator02_ES5.ts === +function doubleAndReturnAsArray(x: number, y: number, z: number): [number, number, number] { +>doubleAndReturnAsArray : (x: number, y: number, z: number) => [number, number, number] +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>x : number +> : ^^^^^^ +>y : number +> : ^^^^^^ +>z : number +> : ^^^^^^ + + let blah = arguments[Symbol.iterator]; +>blah : () => ArrayIterator +> : ^^^^^^ +>arguments[Symbol.iterator] : () => ArrayIterator +> : ^^^^^^ +>arguments : IArguments +> : ^^^^^^^^^^ +>Symbol.iterator : unique symbol +> : ^^^^^^^^^^^^^ +>Symbol : SymbolConstructor +> : ^^^^^^^^^^^^^^^^^ +>iterator : unique symbol +> : ^^^^^^^^^^^^^ + + let result = []; +>result : any[] +> : ^^^^^ +>[] : undefined[] +> : ^^^^^^^^^^^ + + for (let arg of blah()) { +>arg : any +>blah() : ArrayIterator +> : ^^^^^^^^^^^^^^^^^^ +>blah : () => ArrayIterator +> : ^^^^^^ + + result.push(arg + arg); +>result.push(arg + arg) : number +> : ^^^^^^ +>result.push : (...items: any[]) => number +> : ^^^^ ^^^^^^^^^^^^ +>result : any[] +> : ^^^^^ +>push : (...items: any[]) => number +> : ^^^^ ^^^^^^^^^^^^ +>arg + arg : any +>arg : any +>arg : any + } + return <[any, any, any]>result; +><[any, any, any]>result : [any, any, any] +> : ^^^^^^^^^^^^^^^ +>result : any[] +> : ^^^^^ +} + + diff --git a/tests/baselines/reference/argumentsObjectIterator02_ES5.errors.txt b/tests/baselines/reference/argumentsObjectIterator02_ES5(target=es5).errors.txt similarity index 100% rename from tests/baselines/reference/argumentsObjectIterator02_ES5.errors.txt rename to tests/baselines/reference/argumentsObjectIterator02_ES5(target=es5).errors.txt diff --git a/tests/baselines/reference/argumentsObjectIterator02_ES5.js b/tests/baselines/reference/argumentsObjectIterator02_ES5(target=es5).js similarity index 100% rename from tests/baselines/reference/argumentsObjectIterator02_ES5.js rename to tests/baselines/reference/argumentsObjectIterator02_ES5(target=es5).js diff --git a/tests/baselines/reference/argumentsObjectIterator02_ES5(target=es5).symbols b/tests/baselines/reference/argumentsObjectIterator02_ES5(target=es5).symbols new file mode 100644 index 0000000000000..4829342aa88ff --- /dev/null +++ b/tests/baselines/reference/argumentsObjectIterator02_ES5(target=es5).symbols @@ -0,0 +1,35 @@ +//// [tests/cases/compiler/argumentsObjectIterator02_ES5.ts] //// + +=== argumentsObjectIterator02_ES5.ts === +function doubleAndReturnAsArray(x: number, y: number, z: number): [number, number, number] { +>doubleAndReturnAsArray : Symbol(doubleAndReturnAsArray, Decl(argumentsObjectIterator02_ES5.ts, 0, 0)) +>x : Symbol(x, Decl(argumentsObjectIterator02_ES5.ts, 0, 32)) +>y : Symbol(y, Decl(argumentsObjectIterator02_ES5.ts, 0, 42)) +>z : Symbol(z, Decl(argumentsObjectIterator02_ES5.ts, 0, 53)) + + let blah = arguments[Symbol.iterator]; +>blah : Symbol(blah, Decl(argumentsObjectIterator02_ES5.ts, 1, 7)) +>arguments : Symbol(arguments) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) + + let result = []; +>result : Symbol(result, Decl(argumentsObjectIterator02_ES5.ts, 3, 7)) + + for (let arg of blah()) { +>arg : Symbol(arg, Decl(argumentsObjectIterator02_ES5.ts, 4, 12)) +>blah : Symbol(blah, Decl(argumentsObjectIterator02_ES5.ts, 1, 7)) + + result.push(arg + arg); +>result.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) +>result : Symbol(result, Decl(argumentsObjectIterator02_ES5.ts, 3, 7)) +>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) +>arg : Symbol(arg, Decl(argumentsObjectIterator02_ES5.ts, 4, 12)) +>arg : Symbol(arg, Decl(argumentsObjectIterator02_ES5.ts, 4, 12)) + } + return <[any, any, any]>result; +>result : Symbol(result, Decl(argumentsObjectIterator02_ES5.ts, 3, 7)) +} + + diff --git a/tests/baselines/reference/argumentsObjectIterator02_ES5.types b/tests/baselines/reference/argumentsObjectIterator02_ES5(target=es5).types similarity index 100% rename from tests/baselines/reference/argumentsObjectIterator02_ES5.types rename to tests/baselines/reference/argumentsObjectIterator02_ES5(target=es5).types diff --git a/tests/baselines/reference/argumentsObjectIterator03_ES5(target=es2015).js b/tests/baselines/reference/argumentsObjectIterator03_ES5(target=es2015).js new file mode 100644 index 0000000000000..b1ea2af47f1d4 --- /dev/null +++ b/tests/baselines/reference/argumentsObjectIterator03_ES5(target=es2015).js @@ -0,0 +1,16 @@ +//// [tests/cases/compiler/argumentsObjectIterator03_ES5.ts] //// + +//// [argumentsObjectIterator03_ES5.ts] +function asReversedTuple(a: number, b: string, c: boolean): [boolean, string, number] { + let [x, y, z] = arguments; + + return [z, y, x]; +} + + + +//// [argumentsObjectIterator03_ES5.js] +function asReversedTuple(a, b, c) { + let [x, y, z] = arguments; + return [z, y, x]; +} diff --git a/tests/baselines/reference/argumentsObjectIterator03_ES5.symbols b/tests/baselines/reference/argumentsObjectIterator03_ES5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/argumentsObjectIterator03_ES5.symbols rename to tests/baselines/reference/argumentsObjectIterator03_ES5(target=es2015).symbols diff --git a/tests/baselines/reference/argumentsObjectIterator03_ES5(target=es2015).types b/tests/baselines/reference/argumentsObjectIterator03_ES5(target=es2015).types new file mode 100644 index 0000000000000..75070cc48b3ed --- /dev/null +++ b/tests/baselines/reference/argumentsObjectIterator03_ES5(target=es2015).types @@ -0,0 +1,32 @@ +//// [tests/cases/compiler/argumentsObjectIterator03_ES5.ts] //// + +=== argumentsObjectIterator03_ES5.ts === +function asReversedTuple(a: number, b: string, c: boolean): [boolean, string, number] { +>asReversedTuple : (a: number, b: string, c: boolean) => [boolean, string, number] +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>a : number +> : ^^^^^^ +>b : string +> : ^^^^^^ +>c : boolean +> : ^^^^^^^ + + let [x, y, z] = arguments; +>x : any +> : ^^^ +>y : any +> : ^^^ +>z : any +> : ^^^ +>arguments : IArguments +> : ^^^^^^^^^^ + + return [z, y, x]; +>[z, y, x] : [any, any, any] +> : ^^^^^^^^^^^^^^^ +>z : any +>y : any +>x : any +} + + diff --git a/tests/baselines/reference/argumentsObjectIterator03_ES5.errors.txt b/tests/baselines/reference/argumentsObjectIterator03_ES5(target=es5).errors.txt similarity index 100% rename from tests/baselines/reference/argumentsObjectIterator03_ES5.errors.txt rename to tests/baselines/reference/argumentsObjectIterator03_ES5(target=es5).errors.txt diff --git a/tests/baselines/reference/argumentsObjectIterator03_ES5.js b/tests/baselines/reference/argumentsObjectIterator03_ES5(target=es5).js similarity index 100% rename from tests/baselines/reference/argumentsObjectIterator03_ES5.js rename to tests/baselines/reference/argumentsObjectIterator03_ES5(target=es5).js diff --git a/tests/baselines/reference/argumentsObjectIterator03_ES5(target=es5).symbols b/tests/baselines/reference/argumentsObjectIterator03_ES5(target=es5).symbols new file mode 100644 index 0000000000000..94bcac6fc7ba1 --- /dev/null +++ b/tests/baselines/reference/argumentsObjectIterator03_ES5(target=es5).symbols @@ -0,0 +1,22 @@ +//// [tests/cases/compiler/argumentsObjectIterator03_ES5.ts] //// + +=== argumentsObjectIterator03_ES5.ts === +function asReversedTuple(a: number, b: string, c: boolean): [boolean, string, number] { +>asReversedTuple : Symbol(asReversedTuple, Decl(argumentsObjectIterator03_ES5.ts, 0, 0)) +>a : Symbol(a, Decl(argumentsObjectIterator03_ES5.ts, 0, 25)) +>b : Symbol(b, Decl(argumentsObjectIterator03_ES5.ts, 0, 35)) +>c : Symbol(c, Decl(argumentsObjectIterator03_ES5.ts, 0, 46)) + + let [x, y, z] = arguments; +>x : Symbol(x, Decl(argumentsObjectIterator03_ES5.ts, 1, 9)) +>y : Symbol(y, Decl(argumentsObjectIterator03_ES5.ts, 1, 11)) +>z : Symbol(z, Decl(argumentsObjectIterator03_ES5.ts, 1, 14)) +>arguments : Symbol(arguments) + + return [z, y, x]; +>z : Symbol(z, Decl(argumentsObjectIterator03_ES5.ts, 1, 14)) +>y : Symbol(y, Decl(argumentsObjectIterator03_ES5.ts, 1, 11)) +>x : Symbol(x, Decl(argumentsObjectIterator03_ES5.ts, 1, 9)) +} + + diff --git a/tests/baselines/reference/argumentsObjectIterator03_ES5.types b/tests/baselines/reference/argumentsObjectIterator03_ES5(target=es5).types similarity index 100% rename from tests/baselines/reference/argumentsObjectIterator03_ES5.types rename to tests/baselines/reference/argumentsObjectIterator03_ES5(target=es5).types diff --git a/tests/baselines/reference/argumentsPropertyNameInJsMode1.js b/tests/baselines/reference/argumentsPropertyNameInJsMode1.js index e01cb9303c2d3..d3d9b4dcf8d67 100644 --- a/tests/baselines/reference/argumentsPropertyNameInJsMode1.js +++ b/tests/baselines/reference/argumentsPropertyNameInJsMode1.js @@ -13,11 +13,11 @@ f2(1, 2, 3); //// [a.js] -var foo = { - f1: function (params) { } +const foo = { + f1: (params) => { } }; function f2(x) { - foo.f1({ x: x, arguments: [] }); + foo.f1({ x, arguments: [] }); } f2(1, 2, 3); diff --git a/tests/baselines/reference/argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.js b/tests/baselines/reference/argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.js index 29bf050f4f38a..23f2ad2259a4c 100644 --- a/tests/baselines/reference/argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.js +++ b/tests/baselines/reference/argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.js @@ -117,59 +117,53 @@ function D7() { //// [argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.js] function A() { - return /** @class */ (function () { - function T() { + return class T { + constructor() { this.a = arguments; } - return T; - }()); + }; } function A1() { - return new /** @class */ (function () { - function T() { + return new class T { + constructor() { this.a = arguments; } - return T; - }()); + }; } function B() { - return /** @class */ (function () { - function T() { + return class T { + constructor() { this.a = { b: arguments }; } - return T; - }()); + }; } function B1() { - return new /** @class */ (function () { - function T() { + return new class T { + constructor() { this.a = { b: arguments }; } - return T; - }()); + }; } function C() { - return /** @class */ (function () { - function T() { + return class T { + constructor() { this.a = function () { arguments; }; } - return T; - }()); + }; } function D() { - return /** @class */ (function () { - function T() { - this.a = function () { return arguments; }; // should error + return class T { + constructor() { + this.a = () => arguments; // should error } - return T; - }()); + }; } function D1() { - return /** @class */ (function () { - function T() { - this.a = function () { + return class T { + constructor() { + this.a = () => { arguments; // should error - var b = function () { + const b = () => { return arguments; // should error }; function f() { @@ -177,41 +171,32 @@ function D1() { } }; } - return T; - }()); + }; } function D2() { - return /** @class */ (function () { - function class_1() { + return class { + constructor() { arguments; // ok } - Object.defineProperty(class_1.prototype, "foo", { - get: function () { - return arguments; // ok - }, - set: function (foo) { - arguments; // ok - }, - enumerable: false, - configurable: true - }); - class_1.prototype.bar = function () { + get foo() { + return arguments; // ok + } + set foo(foo) { + arguments; // ok + } + bar() { arguments; // ok - }; - class_1.prototype[Symbol.iterator] = function () { + } + [Symbol.iterator]() { arguments; // ok - }; - return class_1; - }()); + } + }; } function D3() { var _a; - return _a = /** @class */ (function () { - function T() { - } - return T; - }()), - (function () { + return _a = class T { + }, + (() => { arguments; // should error while (1) { arguments; // should error @@ -221,12 +206,9 @@ function D3() { } function D4() { var _a; - return _a = /** @class */ (function () { - function T() { - } - return T; - }()), - (function () { + return _a = class T { + }, + (() => { function f() { arguments; // ok } @@ -234,30 +216,22 @@ function D4() { _a; } function D5() { - return /** @class */ (function () { - function T() { - this.a = (function () { return arguments; })(); // should error + return class T { + constructor() { + this.a = (() => { return arguments; })(); // should error } - return T; - }()); + }; } function D6() { - return /** @class */ (function () { - function T() { - this.a = function (x) { - if (x === void 0) { x = arguments; } - }; // should error + return class T { + constructor() { + this.a = (x = arguments) => { }; // should error } - return T; - }()); + }; } function D7() { - return /** @class */ (function () { - function T() { + return class T { + a(x = arguments) { } - T.prototype.a = function (x) { - if (x === void 0) { x = arguments; } - }; - return T; - }()); + }; } diff --git a/tests/baselines/reference/argumentsUsedInObjectLiteralProperty.js b/tests/baselines/reference/argumentsUsedInObjectLiteralProperty.js index 8567411cce3bb..010d4d4477e7a 100644 --- a/tests/baselines/reference/argumentsUsedInObjectLiteralProperty.js +++ b/tests/baselines/reference/argumentsUsedInObjectLiteralProperty.js @@ -10,13 +10,10 @@ class A { } //// [argumentsUsedInObjectLiteralProperty.js] -var A = /** @class */ (function () { - function A() { - } - A.createSelectableViewModel = function (initialState, selectedValue) { +class A { + static createSelectableViewModel(initialState, selectedValue) { return { selectedValue: arguments.length }; - }; - return A; -}()); + } +} diff --git a/tests/baselines/reference/arithAssignTyping.js b/tests/baselines/reference/arithAssignTyping.js index 66785837bc56d..99261d44127b9 100644 --- a/tests/baselines/reference/arithAssignTyping.js +++ b/tests/baselines/reference/arithAssignTyping.js @@ -17,11 +17,8 @@ f >>>= 1; // error f ^= 1; // error //// [arithAssignTyping.js] -var f = /** @class */ (function () { - function f() { - } - return f; -}()); +class f { +} f += ''; // error f += 1; // error f -= 1; // error diff --git a/tests/baselines/reference/arithmeticOperatorWithTypeParameter.js b/tests/baselines/reference/arithmeticOperatorWithTypeParameter.js index b25225c6e579a..7fbaca72e110f 100644 --- a/tests/baselines/reference/arithmeticOperatorWithTypeParameter.js +++ b/tests/baselines/reference/arithmeticOperatorWithTypeParameter.js @@ -134,11 +134,11 @@ function foo(t: T) { //// [arithmeticOperatorWithTypeParameter.js] // type parameter type is not valid for arithmetic operand function foo(t) { - var a; - var b; - var c; - var d; - var e; + let a; + let b; + let c; + let d; + let e; var r1a1 = a * t; var r1a2 = a / t; var r1a3 = a % t; diff --git a/tests/baselines/reference/arityAndOrderCompatibility01.errors.txt b/tests/baselines/reference/arityAndOrderCompatibility01.errors.txt index 188e9e1160afc..5e19ee4881f40 100644 --- a/tests/baselines/reference/arityAndOrderCompatibility01.errors.txt +++ b/tests/baselines/reference/arityAndOrderCompatibility01.errors.txt @@ -1,5 +1,5 @@ arityAndOrderCompatibility01.ts(15,12): error TS2493: Tuple type '[string, number]' of length '2' has no element at index '2'. -arityAndOrderCompatibility01.ts(17,5): error TS2461: Type '{ 0: string; 1: number; length: 2; }' is not an array type. +arityAndOrderCompatibility01.ts(17,5): error TS2488: Type '{ 0: string; 1: number; length: 2; }' must have a '[Symbol.iterator]()' method that returns an iterator. arityAndOrderCompatibility01.ts(18,5): error TS2322: Type '[string, number]' is not assignable to type '[number, number, number]'. Source has 2 element(s) but target requires 3. arityAndOrderCompatibility01.ts(19,5): error TS2741: Property '2' is missing in type 'StrNum' but required in type '[number, number, number]'. @@ -50,7 +50,7 @@ arityAndOrderCompatibility01.ts(32,5): error TS2322: Type '{ 0: string; 1: numbe var [d, e, f] = y; var [g, h, i] = z; ~~~~~~~~~ -!!! error TS2461: Type '{ 0: string; 1: number; length: 2; }' is not an array type. +!!! error TS2488: Type '{ 0: string; 1: number; length: 2; }' must have a '[Symbol.iterator]()' method that returns an iterator. var j1: [number, number, number] = x; ~~ !!! error TS2322: Type '[string, number]' is not assignable to type '[number, number, number]'. diff --git a/tests/baselines/reference/arityAndOrderCompatibility01.js b/tests/baselines/reference/arityAndOrderCompatibility01.js index 4226f80656b02..5d83b413c9373 100644 --- a/tests/baselines/reference/arityAndOrderCompatibility01.js +++ b/tests/baselines/reference/arityAndOrderCompatibility01.js @@ -39,9 +39,9 @@ var o3: [string, number] = y; //// [arityAndOrderCompatibility01.js] -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]; +var [a, b, c] = x; +var [d, e, f] = y; +var [g, h, i] = z; var j1 = x; var j2 = y; var j3 = z; diff --git a/tests/baselines/reference/arityErrorRelatedSpanBindingPattern.js b/tests/baselines/reference/arityErrorRelatedSpanBindingPattern.js index 6d4adebd8469f..61e156447ea13 100644 --- a/tests/baselines/reference/arityErrorRelatedSpanBindingPattern.js +++ b/tests/baselines/reference/arityErrorRelatedSpanBindingPattern.js @@ -11,11 +11,7 @@ bar("", 0); //// [arityErrorRelatedSpanBindingPattern.js] -function foo(a, b, _a) { - var c = _a.c; -} -function bar(a, b, _a) { - var c = _a[0]; -} +function foo(a, b, { c }) { } +function bar(a, b, [c]) { } foo("", 0); bar("", 0); diff --git a/tests/baselines/reference/arrayAssignmentPatternWithAny.js b/tests/baselines/reference/arrayAssignmentPatternWithAny.js index 5160c81de9b09..0476548d87bc6 100644 --- a/tests/baselines/reference/arrayAssignmentPatternWithAny.js +++ b/tests/baselines/reference/arrayAssignmentPatternWithAny.js @@ -8,4 +8,4 @@ var x: string; //// [arrayAssignmentPatternWithAny.js] var a; var x; -x = a[0]; +[x] = a; diff --git a/tests/baselines/reference/arrayAssignmentTest1.js b/tests/baselines/reference/arrayAssignmentTest1.js index 0d2051b310bef..6843dc672ba48 100644 --- a/tests/baselines/reference/arrayAssignmentTest1.js +++ b/tests/baselines/reference/arrayAssignmentTest1.js @@ -88,42 +88,16 @@ arr_any = c3; // should be an error - is arr_any = i1; // should be an error - is //// [arrayAssignmentTest1.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - 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.C1M1 = function () { return null; }; - return C1; -}()); -var C2 = /** @class */ (function (_super) { - __extends(C2, _super); - function C2() { - return _super !== null && _super.apply(this, arguments) || this; - } - C2.prototype.C2M1 = function () { return null; }; - return C2; -}(C1)); -var C3 = /** @class */ (function () { - function C3() { - } - C3.prototype.CM3M1 = function () { return 3; }; - return C3; -}()); +class C1 { + IM1() { return null; } + C1M1() { return null; } +} +class C2 extends C1 { + C2M1() { return null; } +} +class C3 { + CM3M1() { return 3; } +} /* This behaves unexpectedly with the following types: diff --git a/tests/baselines/reference/arrayAssignmentTest2.js b/tests/baselines/reference/arrayAssignmentTest2.js index caeeb10d16c23..432c43dd6870c 100644 --- a/tests/baselines/reference/arrayAssignmentTest2.js +++ b/tests/baselines/reference/arrayAssignmentTest2.js @@ -62,42 +62,16 @@ arr_any = i1; // should be an error - is //// [arrayAssignmentTest2.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - 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.C1M1 = function () { return null; }; - return C1; -}()); -var C2 = /** @class */ (function (_super) { - __extends(C2, _super); - function C2() { - return _super !== null && _super.apply(this, arguments) || this; - } - C2.prototype.C2M1 = function () { return null; }; - return C2; -}(C1)); -var C3 = /** @class */ (function () { - function C3() { - } - C3.prototype.CM3M1 = function () { return 3; }; - return C3; -}()); +class C1 { + IM1() { return null; } + C1M1() { return null; } +} +class C2 extends C1 { + C2M1() { return null; } +} +class C3 { + CM3M1() { return 3; } +} /* This behaves unexpectedly with the following types: diff --git a/tests/baselines/reference/arrayAssignmentTest3.js b/tests/baselines/reference/arrayAssignmentTest3.js index 1db156b9707dc..35e14b292ed9b 100644 --- a/tests/baselines/reference/arrayAssignmentTest3.js +++ b/tests/baselines/reference/arrayAssignmentTest3.js @@ -20,16 +20,12 @@ var xx = new a(null, 7, new B()); // The following gives no error // Michal saw no error if he used number instead of B, // but I do... -var B = /** @class */ (function () { - function B() { - } - return B; -}()); -var a = /** @class */ (function () { - function a(x, y, z) { +class B { +} +class a { + constructor(x, y, z) { this.x = x; this.y = y; } - 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 1a568ee4fef60..66c701032999d 100644 --- a/tests/baselines/reference/arrayAssignmentTest4.js +++ b/tests/baselines/reference/arrayAssignmentTest4.js @@ -27,12 +27,9 @@ arr_any = c3; // should be an error - is //// [arrayAssignmentTest4.js] -var C3 = /** @class */ (function () { - function C3() { - } - C3.prototype.CM3M1 = function () { return 3; }; - return C3; -}()); +class C3 { + CM3M1() { return 3; } +} /* This behaves unexpectedly with teh following types: diff --git a/tests/baselines/reference/arrayAssignmentTest5.js b/tests/baselines/reference/arrayAssignmentTest5.js index af4f52ed5a192..e1006e91b81b6 100644 --- a/tests/baselines/reference/arrayAssignmentTest5.js +++ b/tests/baselines/reference/arrayAssignmentTest5.js @@ -38,20 +38,17 @@ namespace Test { //// [arrayAssignmentTest5.js] var Test; (function (Test) { - var Bug = /** @class */ (function () { - function Bug() { - } - Bug.prototype.onEnter = function (line, state, offset) { + class Bug { + onEnter(line, state, offset) { var lineTokens = this.tokenize(line, state, true); var tokens = lineTokens.tokens; if (tokens.length === 0) { return this.onEnter(line, tokens, offset); // <== this should produce an error since onEnter can not be called with (string, IStateToken[], offset) } - }; - Bug.prototype.tokenize = function (line, state, includeStates) { + } + tokenize(line, state, includeStates) { return null; - }; - return Bug; - }()); + } + } Test.Bug = Bug; })(Test || (Test = {})); diff --git a/tests/baselines/reference/arrayAssignmentTest6.js b/tests/baselines/reference/arrayAssignmentTest6.js index f00581c93f8e3..7a521047fc2ce 100644 --- a/tests/baselines/reference/arrayAssignmentTest6.js +++ b/tests/baselines/reference/arrayAssignmentTest6.js @@ -25,13 +25,10 @@ namespace Test { //// [arrayAssignmentTest6.js] var Test; (function (Test) { - var Bug = /** @class */ (function () { - function Bug() { - } - Bug.prototype.tokenize = function (line, tokens, includeStates) { + class Bug { + tokenize(line, tokens, includeStates) { return null; - }; - return Bug; - }()); + } + } Test.Bug = Bug; })(Test || (Test = {})); diff --git a/tests/baselines/reference/arrayBestCommonTypes.js b/tests/baselines/reference/arrayBestCommonTypes.js index e54bf00b8779d..4bba7b000efc6 100644 --- a/tests/baselines/reference/arrayBestCommonTypes.js +++ b/tests/baselines/reference/arrayBestCommonTypes.js @@ -110,48 +110,17 @@ namespace NonEmptyTypes { //// [arrayBestCommonTypes.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); var EmptyTypes; (function (EmptyTypes) { - var base = /** @class */ (function () { - function base() { - } - return base; - }()); - var base2 = /** @class */ (function () { - function base2() { - } - return base2; - }()); - var derived = /** @class */ (function (_super) { - __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; } - return null; - }; - f.prototype.x = function () { + class base { + } + class base2 { + } + class derived extends base { + } + class f { + voidIfAny(x, y = false) { return null; } + x() { (this.voidIfAny([4, 2][0])); (this.voidIfAny([4, 2, undefined][0])); (this.voidIfAny([undefined, 2, 4][0])); @@ -180,37 +149,20 @@ var EmptyTypes; var b2 = [base2Obj, baseObj, ifaceObj]; var b3 = [baseObj, ifaceObj, base2Obj]; var b4 = [ifaceObj, baseObj, base2Obj]; - }; - return f; - }()); + } + } })(EmptyTypes || (EmptyTypes = {})); var NonEmptyTypes; (function (NonEmptyTypes) { - var base = /** @class */ (function () { - function base() { - } - return base; - }()); - var base2 = /** @class */ (function () { - function base2() { - } - return base2; - }()); - var derived = /** @class */ (function (_super) { - __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; } - return null; - }; - f.prototype.x = function () { + class base { + } + class base2 { + } + class derived extends base { + } + class f { + voidIfAny(x, y = false) { return null; } + x() { (this.voidIfAny([4, 2][0])); (this.voidIfAny([4, 2, undefined][0])); (this.voidIfAny([undefined, 2, 4][0])); @@ -239,7 +191,6 @@ var NonEmptyTypes; var b2 = [base2Obj, baseObj, ifaceObj]; var b3 = [baseObj, ifaceObj, base2Obj]; var b4 = [ifaceObj, baseObj, base2Obj]; - }; - return f; - }()); + } + } })(NonEmptyTypes || (NonEmptyTypes = {})); diff --git a/tests/baselines/reference/arrayConcatMap.js b/tests/baselines/reference/arrayConcatMap.js index 7b4f312d07c39..fdd4f7eb618d4 100644 --- a/tests/baselines/reference/arrayConcatMap.js +++ b/tests/baselines/reference/arrayConcatMap.js @@ -6,4 +6,4 @@ var x = [].concat([{ a: 1 }], [{ a: 2 }]) //// [arrayConcatMap.js] var x = [].concat([{ a: 1 }], [{ a: 2 }]) - .map(function (b) { return b.a; }); + .map(b => b.a); diff --git a/tests/baselines/reference/arrayDestructuringInSwitch1.js b/tests/baselines/reference/arrayDestructuringInSwitch1.js index 4608b0a569c2f..4ae098b16c468 100644 --- a/tests/baselines/reference/arrayDestructuringInSwitch1.js +++ b/tests/baselines/reference/arrayDestructuringInSwitch1.js @@ -24,21 +24,18 @@ export function evaluate(expression: Expression): boolean { } //// [arrayDestructuringInSwitch1.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.evaluate = evaluate; -function evaluate(expression) { +export function evaluate(expression) { if (Array.isArray(expression)) { - var operator = expression[0], operands = expression.slice(1); + const [operator, ...operands] = expression; switch (operator) { case 'and': { - return operands.every(function (child) { return evaluate(child); }); + return operands.every((child) => evaluate(child)); } case 'not': { return !evaluate(operands[0]); } default: { - throw new Error("".concat(operator, " is not a supported operator")); + throw new Error(`${operator} is not a supported operator`); } } } diff --git a/tests/baselines/reference/arrayDestructuringInSwitch2.js b/tests/baselines/reference/arrayDestructuringInSwitch2.js index 4da13269936fa..b603aec10bff6 100644 --- a/tests/baselines/reference/arrayDestructuringInSwitch2.js +++ b/tests/baselines/reference/arrayDestructuringInSwitch2.js @@ -18,14 +18,14 @@ function foo(x: X): 1 { //// [arrayDestructuringInSwitch2.js] function foo(x) { - var kind = x.kind, a = x.a; + const { kind, a } = x; switch (kind) { case "a": return a[0]; case "b": return 1; default: - var n = a[0]; + const [n] = a; return a; } } diff --git a/tests/baselines/reference/arrayEvery.js b/tests/baselines/reference/arrayEvery.js index 04eece1b8d175..f85e0e4291bd1 100644 --- a/tests/baselines/reference/arrayEvery.js +++ b/tests/baselines/reference/arrayEvery.js @@ -11,8 +11,8 @@ if (foo.every(isString)) { //// [arrayEvery.js] -var foo = ['aaa']; -var isString = function (x) { return typeof x === 'string'; }; +const foo = ['aaa']; +const isString = (x) => typeof x === 'string'; if (foo.every(isString)) { foo[0].slice(0); } diff --git a/tests/baselines/reference/arrayFilter.js b/tests/baselines/reference/arrayFilter.js index c53f2e82e1bb0..b9aeed39312d2 100644 --- a/tests/baselines/reference/arrayFilter.js +++ b/tests/baselines/reference/arrayFilter.js @@ -15,4 +15,4 @@ var foo = [ { name: null }, { name: 'baz' } ]; -foo.filter(function (x) { return x.name; }); //should accepted all possible types not only boolean! +foo.filter(x => 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 8d460074302b5..c5f4756e96f9b 100644 --- a/tests/baselines/reference/arrayFind.js +++ b/tests/baselines/reference/arrayFind.js @@ -18,7 +18,7 @@ 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); +const arrayOfStringsNumbersAndBooleans = ["string", false, 0, "strung", 1, true]; +const foundNumber = arrayOfStringsNumbersAndBooleans.find(isNumber); +const readonlyArrayOfStringsNumbersAndBooleans = arrayOfStringsNumbersAndBooleans; +const readonlyFoundNumber = readonlyArrayOfStringsNumbersAndBooleans.find(isNumber); diff --git a/tests/baselines/reference/arrayFlatMap.js b/tests/baselines/reference/arrayFlatMap.js index cf0bcd800034f..1143092f9e3ae 100644 --- a/tests/baselines/reference/arrayFlatMap.js +++ b/tests/baselines/reference/arrayFlatMap.js @@ -8,7 +8,7 @@ readonlyArray.flatMap((): ReadonlyArray => []); // ok //// [arrayFlatMap.js] -var array = []; -var readonlyArray = []; -array.flatMap(function () { return []; }); // ok -readonlyArray.flatMap(function () { return []; }); // ok +const array = []; +const readonlyArray = []; +array.flatMap(() => []); // ok +readonlyArray.flatMap(() => []); // ok diff --git a/tests/baselines/reference/arrayFrom.js b/tests/baselines/reference/arrayFrom.js index 13609e4b1692a..477082fedc961 100644 --- a/tests/baselines/reference/arrayFrom.js +++ b/tests/baselines/reference/arrayFrom.js @@ -41,34 +41,22 @@ 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 }); -}); -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 }); -}); -var result8 = Array.from(inputARand); -var result9 = Array.from(inputARand, function (_a) { - var a = _a.a; - return ({ b: a }); -}); -var result10 = Array.from(new Set()); -var result11 = Array.from(inputASet, function (_a) { - var a = _a.a; - return ({ b: a }); -}); +const inputA = []; +const inputB = []; +const inputALike = { length: 0 }; +const inputARand = getEither(inputA, inputALike); +const inputASet = new Set(); +const result1 = Array.from(inputA); +const result2 = Array.from(inputA.values()); +const result3 = Array.from(inputA.values()); // expect error +const result4 = Array.from(inputB, ({ b }) => ({ a: b })); +const result5 = Array.from(inputALike); +const result6 = Array.from(inputALike); // expect error +const result7 = Array.from(inputALike, ({ a }) => ({ b: a })); +const result8 = Array.from(inputARand); +const result9 = Array.from(inputARand, ({ a }) => ({ b: a })); +const result10 = Array.from(new Set()); +const result11 = Array.from(inputASet, ({ a }) => ({ 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/arrayIndexWithArrayFails.js b/tests/baselines/reference/arrayIndexWithArrayFails.js index 312b1b790c588..3a29bc51b5753 100644 --- a/tests/baselines/reference/arrayIndexWithArrayFails.js +++ b/tests/baselines/reference/arrayIndexWithArrayFails.js @@ -6,4 +6,4 @@ declare const arr2: number[]; const j = arr2[arr1[0]]; // should error //// [arrayIndexWithArrayFails.js] -var j = arr2[arr1[0]]; // should error +const j = arr2[arr1[0]]; // should error diff --git a/tests/baselines/reference/arrayLiteralComments.js b/tests/baselines/reference/arrayLiteralComments.js index 4d2d03e07f18f..53363bac2d251 100644 --- a/tests/baselines/reference/arrayLiteralComments.js +++ b/tests/baselines/reference/arrayLiteralComments.js @@ -20,7 +20,7 @@ var testArrayWithFunc = [ var testArrayWithFunc = [ // Function comment function () { - var x = 1; + let x = 1; }, // String comment '1', diff --git a/tests/baselines/reference/arrayLiteralContextualType.js b/tests/baselines/reference/arrayLiteralContextualType.js index 63c236537589e..ed1ffb8559192 100644 --- a/tests/baselines/reference/arrayLiteralContextualType.js +++ b/tests/baselines/reference/arrayLiteralContextualType.js @@ -32,20 +32,18 @@ foo(arr); // ok because arr is Array not {}[] bar(arr); // ok because arr is Array not {}[] //// [arrayLiteralContextualType.js] -var Giraffe = /** @class */ (function () { - function Giraffe() { +class Giraffe { + constructor() { this.name = "Giraffe"; this.neckLength = "3m"; } - return Giraffe; -}()); -var Elephant = /** @class */ (function () { - function Elephant() { +} +class Elephant { + constructor() { this.name = "Elephant"; this.trunkDiameter = "20cm"; } - return Elephant; -}()); +} function foo(animals) { } function bar(animals) { } foo([ diff --git a/tests/baselines/reference/arrayLiteralExpressionContextualTyping.js b/tests/baselines/reference/arrayLiteralExpressionContextualTyping.js index acba52443a9b4..b88916841bd55 100644 --- a/tests/baselines/reference/arrayLiteralExpressionContextualTyping.js +++ b/tests/baselines/reference/arrayLiteralExpressionContextualTyping.js @@ -18,15 +18,6 @@ var spr2:[number, number, number] = [1, 2, 3, ...tup]; // Error //// [arrayLiteralExpressionContextualTyping.js] -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; // In a contextually typed array literal expression containing no spread elements, an element expression at index N is contextually typed by // the type of the property with the numeric name N in the contextual type, if any, or otherwise // the numeric index type of the contextual type, if any. @@ -37,6 +28,6 @@ var tup1 = [1, 2, 3, "string"]; var tup2 = [1, 2, 3, "string"]; // Error // In a contextually typed array literal expression containing one or more spread elements, // an element expression at index N is contextually typed by the numeric index type of the contextual type, if any. -var spr = __spreadArray([1, 2, 3], array, true); -var spr1 = __spreadArray([1, 2, 3], tup, true); -var spr2 = __spreadArray([1, 2, 3], tup, true); // Error +var spr = [1, 2, 3, ...array]; +var spr1 = [1, 2, 3, ...tup]; +var spr2 = [1, 2, 3, ...tup]; // Error diff --git a/tests/baselines/reference/arrayLiteralInNonVarArgParameter.js b/tests/baselines/reference/arrayLiteralInNonVarArgParameter.js index 83321fddac144..aa2d281e03e72 100644 --- a/tests/baselines/reference/arrayLiteralInNonVarArgParameter.js +++ b/tests/baselines/reference/arrayLiteralInNonVarArgParameter.js @@ -7,10 +7,5 @@ panic([], 'one', 'two'); //// [arrayLiteralInNonVarArgParameter.js] -function panic(val) { - var opt = []; - for (var _i = 1; _i < arguments.length; _i++) { - opt[_i - 1] = arguments[_i]; - } -} +function panic(val, ...opt) { } panic([], 'one', 'two'); diff --git a/tests/baselines/reference/arrayLiteralSpread.js b/tests/baselines/reference/arrayLiteralSpread.js index a0ea9ce127f74..5efdb6c45d19b 100644 --- a/tests/baselines/reference/arrayLiteralSpread.js +++ b/tests/baselines/reference/arrayLiteralSpread.js @@ -26,32 +26,23 @@ function f2() { //// [arrayLiteralSpread.js] -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; function f0() { var a = [1, 2, 3]; - var a1 = __spreadArray([], a, true); - var a2 = __spreadArray([1], a, true); - var a3 = __spreadArray([1, 2], a, true); - var a4 = __spreadArray(__spreadArray([], a, true), [1], false); - var a5 = __spreadArray(__spreadArray([], a, true), [1, 2], false); - var a6 = __spreadArray(__spreadArray([1, 2], a, true), [1, 2], false); - var a7 = __spreadArray(__spreadArray(__spreadArray([1], a, true), [2], false), a, true); - var a8 = __spreadArray(__spreadArray(__spreadArray([], a, true), a, true), a, true); + var a1 = [...a]; + var a2 = [1, ...a]; + var a3 = [1, 2, ...a]; + var a4 = [...a, 1]; + var a5 = [...a, 1, 2]; + var a6 = [1, 2, ...a, 1, 2]; + var a7 = [1, ...a, 2, ...a]; + var a8 = [...a, ...a, ...a]; } function f1() { var a = [1, 2, 3]; - var b = __spreadArray(__spreadArray(["hello"], a, true), [true], false); + var b = ["hello", ...a, true]; var b; } function f2() { - var a = []; - var b = [5]; + var a = [...[...[...[...[...[]]]]]]; + var b = [...[...[...[...[...[5]]]]]]; } diff --git a/tests/baselines/reference/arrayLiteralSpreadES5iterable.js b/tests/baselines/reference/arrayLiteralSpreadES5iterable.js index 3f16bdfbeebe4..bf3a64e62817b 100644 --- a/tests/baselines/reference/arrayLiteralSpreadES5iterable.js +++ b/tests/baselines/reference/arrayLiteralSpreadES5iterable.js @@ -26,48 +26,23 @@ function f2() { //// [arrayLiteralSpreadES5iterable.js] -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; function f0() { var a = [1, 2, 3]; - var a1 = __spreadArray([], __read(a), false); - var a2 = __spreadArray([1], __read(a), false); - var a3 = __spreadArray([1, 2], __read(a), false); - var a4 = __spreadArray(__spreadArray([], __read(a), false), [1], false); - var a5 = __spreadArray(__spreadArray([], __read(a), false), [1, 2], false); - var a6 = __spreadArray(__spreadArray([1, 2], __read(a), false), [1, 2], false); - var a7 = __spreadArray(__spreadArray(__spreadArray([1], __read(a), false), [2], false), __read(a), false); - var a8 = __spreadArray(__spreadArray(__spreadArray([], __read(a), false), __read(a), false), __read(a), false); + var a1 = [...a]; + var a2 = [1, ...a]; + var a3 = [1, 2, ...a]; + var a4 = [...a, 1]; + var a5 = [...a, 1, 2]; + var a6 = [1, 2, ...a, 1, 2]; + var a7 = [1, ...a, 2, ...a]; + var a8 = [...a, ...a, ...a]; } function f1() { var a = [1, 2, 3]; - var b = __spreadArray(__spreadArray(["hello"], __read(a), false), [true], false); + var b = ["hello", ...a, true]; var b; } function f2() { - var a = []; - var b = [5]; + var a = [...[...[...[...[...[]]]]]]; + var b = [...[...[...[...[...[5]]]]]]; } diff --git a/tests/baselines/reference/arrayLiteralTypeInference.js b/tests/baselines/reference/arrayLiteralTypeInference.js index 9d27f4c561fa3..9e0bd09c70c32 100644 --- a/tests/baselines/reference/arrayLiteralTypeInference.js +++ b/tests/baselines/reference/arrayLiteralTypeInference.js @@ -54,40 +54,12 @@ var z3: { id: number }[] = //// [arrayLiteralTypeInference.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var Action = /** @class */ (function () { - function Action() { - } - return Action; -}()); -var ActionA = /** @class */ (function (_super) { - __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() { - return _super !== null && _super.apply(this, arguments) || this; - } - return ActionB; -}(Action)); +class Action { +} +class ActionA extends Action { +} +class ActionB extends Action { +} var x1 = [ { id: 2, trueness: false }, { id: 3, name: "three" } diff --git a/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.js b/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.js index a1ff23200df6c..9790866ccf0f9 100644 --- a/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.js +++ b/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.js @@ -25,7 +25,7 @@ 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[] -var gs = [function (b) { return 2; }, function (a) { return 1; }]; // (b: { x: number; z?: number }) => number[] +var ds = [(x) => 1, (x) => 2]; // { (x:Object) => number }[] +var es = [(x) => 2, (x) => 1]; // { (x:string) => number }[] +var fs = [(a) => 1, (b) => 2]; // (a: { x: number; y?: number }) => number[] +var gs = [(b) => 2, (a) => 1]; // (b: { x: number; z?: number }) => number[] diff --git a/tests/baselines/reference/arrayLiterals.js b/tests/baselines/reference/arrayLiterals.js index 0f2dc1f7e2ebf..b7f57d1aa4e72 100644 --- a/tests/baselines/reference/arrayLiterals.js +++ b/tests/baselines/reference/arrayLiterals.js @@ -40,21 +40,6 @@ var context4: Base[] = [new Derived1(), new Derived1()]; //// [arrayLiterals.js] // Empty array literal with no contextual type has type Undefined[] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - 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[] @@ -62,11 +47,8 @@ var stringArrArr = [[''], [""]]; var stringArr = ['', ""]; var numberArr = [0, 0.0, 0x00, 1e1]; var boolArr = [false, true, false, true]; -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { +} var classArr = [new C(), new C()]; var classTypeArray = [C, C, C]; var classTypeArray; // Should OK, not be a parse error @@ -74,26 +56,13 @@ var classTypeArray; // Should OK, not be a parse error 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() { - } - return Base; -}()); -var Derived1 = /** @class */ (function (_super) { - __extends(Derived1, _super); - function Derived1() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Derived1; -}(Base)); +class Base { +} +class Derived1 extends Base { +} ; -var Derived2 = /** @class */ (function (_super) { - __extends(Derived2, _super); - function Derived2() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Derived2; -}(Base)); +class Derived2 extends 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[] diff --git a/tests/baselines/reference/arrayLiterals2ES5.js b/tests/baselines/reference/arrayLiterals2ES5.js index 23b9662bb0506..ecd528dfd1a1f 100644 --- a/tests/baselines/reference/arrayLiterals2ES5.js +++ b/tests/baselines/reference/arrayLiterals2ES5.js @@ -64,23 +64,14 @@ var d9 = [[...temp1], ...["hello"]]; // Elisionopt SpreadElement // ElementList, Elisionopt AssignmentExpression // ElementList, Elisionopt SpreadElement -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; // SpreadElement: // ... AssignmentExpression var a0 = [, , 2, 3, 4]; var a1 = ["hello", "world"]; -var a2 = __spreadArray(__spreadArray([, , ,], a0, true), ["hello"], false); -var a3 = __spreadArray([, ,], a0, true); -var a4 = [function () { return 1; },]; -var a5 = __spreadArray(__spreadArray([], a0, true), [,], false); +var a2 = [, , , ...a0, "hello"]; +var a3 = [, , ...a0]; +var a4 = [() => 1,]; +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, @@ -93,8 +84,8 @@ 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] +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 @@ -103,13 +94,13 @@ var temp1 = [1, 2, 3]; var temp2 = [[1, 2, 3], ["hello", "string"]]; var temp3 = [undefined, null, undefined]; var temp4 = []; -var d0 = __spreadArray([1, true], temp, true); // has type (string|number|boolean)[] -var d1 = __spreadArray([], temp, true); // has type string[] -var d2 = __spreadArray([], temp1, true); -var d3 = __spreadArray([], temp1, true); -var d4 = __spreadArray(__spreadArray([], temp, true), temp1, true); -var d5 = __spreadArray([], temp3, true); -var d6 = __spreadArray([], temp4, true); -var d7 = __spreadArray([], temp1, true); -var d8 = [__spreadArray([], temp1, true)]; -var d9 = __spreadArray([__spreadArray([], temp1, true)], ["hello"], false); +var d0 = [1, true, ...temp,]; // has type (string|number|boolean)[] +var d1 = [...temp]; // has type string[] +var d2 = [...temp1]; +var d3 = [...temp1]; +var d4 = [...temp, ...temp1]; +var d5 = [...temp3]; +var d6 = [...temp4]; +var d7 = [...[...temp1]]; +var d8 = [[...temp1]]; +var d9 = [[...temp1], ...["hello"]]; diff --git a/tests/baselines/reference/arrayLiterals3.js b/tests/baselines/reference/arrayLiterals3.js index 15601e737ad96..333172ea450bd 100644 --- a/tests/baselines/reference/arrayLiterals3.js +++ b/tests/baselines/reference/arrayLiterals3.js @@ -42,15 +42,6 @@ var c2: myArray = [...temp1, ...temp]; // Error cannot assign (number // - 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, // the element expression is contextually typed by the type of that property. -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; // 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. @@ -59,13 +50,13 @@ 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]; +var [b1, b2] = [1, 2, "string", true]; // 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 = __spreadArray([], temp2, true); // Error -var c1 = __spreadArray([], temp1, true); // Error cannot assign number[] to [number, number, number] -var c2 = __spreadArray(__spreadArray([], temp1, true), temp, true); // Error cannot assign (number|string)[] to number[] +var c0 = [...temp2]; // Error +var c1 = [...temp1]; // Error cannot assign number[] to [number, number, number] +var c2 = [...temp1, ...temp]; // Error cannot assign (number|string)[] to number[] diff --git a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js index b048aded77a6d..094bc0ffbd767 100644 --- a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js +++ b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js @@ -28,38 +28,12 @@ var myDerivedList: DerivedList; var as = [list, myDerivedList]; // List[] //// [arrayLiteralsWithRecursiveGenerics.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var List = /** @class */ (function () { - function List() { - } - return List; -}()); -var DerivedList = /** @class */ (function (_super) { - __extends(DerivedList, _super); - function DerivedList() { - return _super !== null && _super.apply(this, arguments) || this; - } - return DerivedList; -}(List)); -var MyList = /** @class */ (function () { - function MyList() { - } - return MyList; -}()); +class List { +} +class DerivedList extends List { +} +class MyList { +} var list; var list2; var myList; diff --git a/tests/baselines/reference/arrayOfExportedClass.js b/tests/baselines/reference/arrayOfExportedClass.js index 2a41475c1cd33..354f75ec5609f 100644 --- a/tests/baselines/reference/arrayOfExportedClass.js +++ b/tests/baselines/reference/arrayOfExportedClass.js @@ -26,20 +26,14 @@ export = Road; //// [arrayOfExportedClass_0.js] "use strict"; -var Car = /** @class */ (function () { - function Car() { - } - return Car; -}()); +class Car { +} module.exports = Car; //// [arrayOfExportedClass_1.js] "use strict"; -var Road = /** @class */ (function () { - function Road() { - } - Road.prototype.AddCars = function (cars) { +class Road { + AddCars(cars) { this.cars = cars; - }; - return Road; -}()); + } +} module.exports = Road; diff --git a/tests/baselines/reference/arrayOfFunctionTypes3.js b/tests/baselines/reference/arrayOfFunctionTypes3.js index d56193714c2e2..0c28523c9b73a 100644 --- a/tests/baselines/reference/arrayOfFunctionTypes3.js +++ b/tests/baselines/reference/arrayOfFunctionTypes3.js @@ -30,13 +30,10 @@ var r7 = r6(''); // any not string //// [arrayOfFunctionTypes3.js] // valid uses of arrays of function types -var x = [function () { return 1; }, function () { }]; +var x = [() => 1, () => { }]; var r2 = x[0](); -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { +} var y = [C, C]; var r3 = new y[0](); var a; diff --git a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js index 4f326443f931c..0408bc57205c8 100644 --- a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js +++ b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js @@ -22,40 +22,12 @@ rrb = cra; // error: 'A' is not assignable to 'B' //// [arrayOfSubtypeIsAssignableToReadonlyArray.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var A = /** @class */ (function () { - function A() { - } - return A; -}()); -var B = /** @class */ (function (_super) { - __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() { - return _super !== null && _super.apply(this, arguments) || this; - } - return C; -}(Array)); +class A { +} +class B extends A { +} +class C extends Array { +} rra = ara; rrb = arb; // OK, Array is assignable to ReadonlyArray rra = arb; diff --git a/tests/baselines/reference/arrayReferenceWithoutTypeArgs.js b/tests/baselines/reference/arrayReferenceWithoutTypeArgs.js index 7bb632a55f625..838f89a424139 100644 --- a/tests/baselines/reference/arrayReferenceWithoutTypeArgs.js +++ b/tests/baselines/reference/arrayReferenceWithoutTypeArgs.js @@ -6,9 +6,6 @@ class X { } //// [arrayReferenceWithoutTypeArgs.js] -var X = /** @class */ (function () { - function X() { - } - X.prototype.f = function (a) { }; - return X; -}()); +class X { + f(a) { } +} diff --git a/tests/baselines/reference/arraySpreadImportHelpers.errors.txt b/tests/baselines/reference/arraySpreadImportHelpers(target=es5).errors.txt similarity index 100% rename from tests/baselines/reference/arraySpreadImportHelpers.errors.txt rename to tests/baselines/reference/arraySpreadImportHelpers(target=es5).errors.txt diff --git a/tests/baselines/reference/arrayToLocaleStringES5(target=es2015).js b/tests/baselines/reference/arrayToLocaleStringES5(target=es2015).js new file mode 100644 index 0000000000000..f2c438cb390c5 --- /dev/null +++ b/tests/baselines/reference/arrayToLocaleStringES5(target=es2015).js @@ -0,0 +1,106 @@ +//// [tests/cases/compiler/arrayToLocaleStringES5.ts] //// + +//// [arrayToLocaleStringES5.ts] +let str: string; +const arr = [1, 2, 3]; +str = arr.toLocaleString(); // OK +str = arr.toLocaleString('en-US'); // should be error +str = arr.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error + +const dates: readonly Date[] = [new Date(), new Date()]; +str = dates.toLocaleString(); // OK +str = dates.toLocaleString('fr'); // should be error +str = dates.toLocaleString('fr', { timeZone: 'UTC' }); // should be error + +const int8Array = new Int8Array(3); +str = int8Array.toLocaleString(); // OK +str = int8Array.toLocaleString('en-US'); // should be error +str = int8Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error + +const uint8Array = new Uint8Array(3); +str = uint8Array.toLocaleString(); // OK +str = uint8Array.toLocaleString('en-US'); // should be error +str = uint8Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error + +const uint8ClampedArray = new Uint8ClampedArray(3); +str = uint8ClampedArray.toLocaleString(); // OK +str = uint8ClampedArray.toLocaleString('en-US'); // should be error +str = uint8ClampedArray.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error + +const int16Array = new Int16Array(3); +str = int16Array.toLocaleString(); // OK +str = int16Array.toLocaleString('en-US'); // should be error +str = int16Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error + +const uint16Array = new Uint16Array(3); +str = uint16Array.toLocaleString(); // OK +str = uint16Array.toLocaleString('en-US'); // should be error +str = uint16Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error + +const int32Array = new Int32Array(3); +str = int32Array.toLocaleString(); // OK +str = int32Array.toLocaleString('en-US'); // should be error +str = int32Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error + +const uint32Array = new Uint32Array(3); +str = uint32Array.toLocaleString(); // OK +str = uint32Array.toLocaleString('en-US'); // should be error +str = uint32Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error + +const float32Array = new Float32Array(3); +str = float32Array.toLocaleString(); // OK +str = float32Array.toLocaleString('en-US'); // should be error +str = float32Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error + +const float64Array = new Float64Array(3); +str = float64Array.toLocaleString(); // OK +str = float64Array.toLocaleString('en-US'); // should be error +str = float64Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error + + +//// [arrayToLocaleStringES5.js] +let str; +const arr = [1, 2, 3]; +str = arr.toLocaleString(); // OK +str = arr.toLocaleString('en-US'); // should be error +str = arr.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +const dates = [new Date(), new Date()]; +str = dates.toLocaleString(); // OK +str = dates.toLocaleString('fr'); // should be error +str = dates.toLocaleString('fr', { timeZone: 'UTC' }); // should be error +const int8Array = new Int8Array(3); +str = int8Array.toLocaleString(); // OK +str = int8Array.toLocaleString('en-US'); // should be error +str = int8Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +const uint8Array = new Uint8Array(3); +str = uint8Array.toLocaleString(); // OK +str = uint8Array.toLocaleString('en-US'); // should be error +str = uint8Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +const uint8ClampedArray = new Uint8ClampedArray(3); +str = uint8ClampedArray.toLocaleString(); // OK +str = uint8ClampedArray.toLocaleString('en-US'); // should be error +str = uint8ClampedArray.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +const int16Array = new Int16Array(3); +str = int16Array.toLocaleString(); // OK +str = int16Array.toLocaleString('en-US'); // should be error +str = int16Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +const uint16Array = new Uint16Array(3); +str = uint16Array.toLocaleString(); // OK +str = uint16Array.toLocaleString('en-US'); // should be error +str = uint16Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +const int32Array = new Int32Array(3); +str = int32Array.toLocaleString(); // OK +str = int32Array.toLocaleString('en-US'); // should be error +str = int32Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +const uint32Array = new Uint32Array(3); +str = uint32Array.toLocaleString(); // OK +str = uint32Array.toLocaleString('en-US'); // should be error +str = uint32Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +const float32Array = new Float32Array(3); +str = float32Array.toLocaleString(); // OK +str = float32Array.toLocaleString('en-US'); // should be error +str = float32Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +const float64Array = new Float64Array(3); +str = float64Array.toLocaleString(); // OK +str = float64Array.toLocaleString('en-US'); // should be error +str = float64Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error diff --git a/tests/baselines/reference/arrayToLocaleStringES5.symbols b/tests/baselines/reference/arrayToLocaleStringES5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/arrayToLocaleStringES5.symbols rename to tests/baselines/reference/arrayToLocaleStringES5(target=es2015).symbols diff --git a/tests/baselines/reference/arrayToLocaleStringES5.types b/tests/baselines/reference/arrayToLocaleStringES5(target=es2015).types similarity index 100% rename from tests/baselines/reference/arrayToLocaleStringES5.types rename to tests/baselines/reference/arrayToLocaleStringES5(target=es2015).types diff --git a/tests/baselines/reference/arrayToLocaleStringES5.js b/tests/baselines/reference/arrayToLocaleStringES5(target=es5).js similarity index 100% rename from tests/baselines/reference/arrayToLocaleStringES5.js rename to tests/baselines/reference/arrayToLocaleStringES5(target=es5).js diff --git a/tests/baselines/reference/arrayToLocaleStringES5(target=es5).symbols b/tests/baselines/reference/arrayToLocaleStringES5(target=es5).symbols new file mode 100644 index 0000000000000..e7f054ae188f5 --- /dev/null +++ b/tests/baselines/reference/arrayToLocaleStringES5(target=es5).symbols @@ -0,0 +1,270 @@ +//// [tests/cases/compiler/arrayToLocaleStringES5.ts] //// + +=== arrayToLocaleStringES5.ts === +let str: string; +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) + +const arr = [1, 2, 3]; +>arr : Symbol(arr, Decl(arrayToLocaleStringES5.ts, 1, 5)) + +str = arr.toLocaleString(); // OK +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>arr.toLocaleString : Symbol(Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>arr : Symbol(arr, Decl(arrayToLocaleStringES5.ts, 1, 5)) +>toLocaleString : Symbol(Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) + +str = arr.toLocaleString('en-US'); // should be error +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>arr.toLocaleString : Symbol(Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>arr : Symbol(arr, Decl(arrayToLocaleStringES5.ts, 1, 5)) +>toLocaleString : Symbol(Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) + +str = arr.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>arr.toLocaleString : Symbol(Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>arr : Symbol(arr, Decl(arrayToLocaleStringES5.ts, 1, 5)) +>toLocaleString : Symbol(Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>style : Symbol(style, Decl(arrayToLocaleStringES5.ts, 4, 35)) +>currency : Symbol(currency, Decl(arrayToLocaleStringES5.ts, 4, 54)) + +const dates: readonly Date[] = [new Date(), new Date()]; +>dates : Symbol(dates, Decl(arrayToLocaleStringES5.ts, 6, 5)) +>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +str = dates.toLocaleString(); // OK +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>dates.toLocaleString : Symbol(ReadonlyArray.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>dates : Symbol(dates, Decl(arrayToLocaleStringES5.ts, 6, 5)) +>toLocaleString : Symbol(ReadonlyArray.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) + +str = dates.toLocaleString('fr'); // should be error +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>dates.toLocaleString : Symbol(ReadonlyArray.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>dates : Symbol(dates, Decl(arrayToLocaleStringES5.ts, 6, 5)) +>toLocaleString : Symbol(ReadonlyArray.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) + +str = dates.toLocaleString('fr', { timeZone: 'UTC' }); // should be error +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>dates.toLocaleString : Symbol(ReadonlyArray.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>dates : Symbol(dates, Decl(arrayToLocaleStringES5.ts, 6, 5)) +>toLocaleString : Symbol(ReadonlyArray.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>timeZone : Symbol(timeZone, Decl(arrayToLocaleStringES5.ts, 9, 34)) + +const int8Array = new Int8Array(3); +>int8Array : Symbol(int8Array, Decl(arrayToLocaleStringES5.ts, 11, 5)) +>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +str = int8Array.toLocaleString(); // OK +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>int8Array.toLocaleString : Symbol(Int8Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>int8Array : Symbol(int8Array, Decl(arrayToLocaleStringES5.ts, 11, 5)) +>toLocaleString : Symbol(Int8Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) + +str = int8Array.toLocaleString('en-US'); // should be error +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>int8Array.toLocaleString : Symbol(Int8Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>int8Array : Symbol(int8Array, Decl(arrayToLocaleStringES5.ts, 11, 5)) +>toLocaleString : Symbol(Int8Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) + +str = int8Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>int8Array.toLocaleString : Symbol(Int8Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>int8Array : Symbol(int8Array, Decl(arrayToLocaleStringES5.ts, 11, 5)) +>toLocaleString : Symbol(Int8Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>style : Symbol(style, Decl(arrayToLocaleStringES5.ts, 14, 41)) +>currency : Symbol(currency, Decl(arrayToLocaleStringES5.ts, 14, 60)) + +const uint8Array = new Uint8Array(3); +>uint8Array : Symbol(uint8Array, Decl(arrayToLocaleStringES5.ts, 16, 5)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +str = uint8Array.toLocaleString(); // OK +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>uint8Array.toLocaleString : Symbol(Uint8Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>uint8Array : Symbol(uint8Array, Decl(arrayToLocaleStringES5.ts, 16, 5)) +>toLocaleString : Symbol(Uint8Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) + +str = uint8Array.toLocaleString('en-US'); // should be error +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>uint8Array.toLocaleString : Symbol(Uint8Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>uint8Array : Symbol(uint8Array, Decl(arrayToLocaleStringES5.ts, 16, 5)) +>toLocaleString : Symbol(Uint8Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) + +str = uint8Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>uint8Array.toLocaleString : Symbol(Uint8Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>uint8Array : Symbol(uint8Array, Decl(arrayToLocaleStringES5.ts, 16, 5)) +>toLocaleString : Symbol(Uint8Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>style : Symbol(style, Decl(arrayToLocaleStringES5.ts, 19, 42)) +>currency : Symbol(currency, Decl(arrayToLocaleStringES5.ts, 19, 61)) + +const uint8ClampedArray = new Uint8ClampedArray(3); +>uint8ClampedArray : Symbol(uint8ClampedArray, Decl(arrayToLocaleStringES5.ts, 21, 5)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +str = uint8ClampedArray.toLocaleString(); // OK +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>uint8ClampedArray.toLocaleString : Symbol(Uint8ClampedArray.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>uint8ClampedArray : Symbol(uint8ClampedArray, Decl(arrayToLocaleStringES5.ts, 21, 5)) +>toLocaleString : Symbol(Uint8ClampedArray.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) + +str = uint8ClampedArray.toLocaleString('en-US'); // should be error +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>uint8ClampedArray.toLocaleString : Symbol(Uint8ClampedArray.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>uint8ClampedArray : Symbol(uint8ClampedArray, Decl(arrayToLocaleStringES5.ts, 21, 5)) +>toLocaleString : Symbol(Uint8ClampedArray.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) + +str = uint8ClampedArray.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>uint8ClampedArray.toLocaleString : Symbol(Uint8ClampedArray.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>uint8ClampedArray : Symbol(uint8ClampedArray, Decl(arrayToLocaleStringES5.ts, 21, 5)) +>toLocaleString : Symbol(Uint8ClampedArray.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>style : Symbol(style, Decl(arrayToLocaleStringES5.ts, 24, 49)) +>currency : Symbol(currency, Decl(arrayToLocaleStringES5.ts, 24, 68)) + +const int16Array = new Int16Array(3); +>int16Array : Symbol(int16Array, Decl(arrayToLocaleStringES5.ts, 26, 5)) +>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +str = int16Array.toLocaleString(); // OK +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>int16Array.toLocaleString : Symbol(Int16Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>int16Array : Symbol(int16Array, Decl(arrayToLocaleStringES5.ts, 26, 5)) +>toLocaleString : Symbol(Int16Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) + +str = int16Array.toLocaleString('en-US'); // should be error +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>int16Array.toLocaleString : Symbol(Int16Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>int16Array : Symbol(int16Array, Decl(arrayToLocaleStringES5.ts, 26, 5)) +>toLocaleString : Symbol(Int16Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) + +str = int16Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>int16Array.toLocaleString : Symbol(Int16Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>int16Array : Symbol(int16Array, Decl(arrayToLocaleStringES5.ts, 26, 5)) +>toLocaleString : Symbol(Int16Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>style : Symbol(style, Decl(arrayToLocaleStringES5.ts, 29, 42)) +>currency : Symbol(currency, Decl(arrayToLocaleStringES5.ts, 29, 61)) + +const uint16Array = new Uint16Array(3); +>uint16Array : Symbol(uint16Array, Decl(arrayToLocaleStringES5.ts, 31, 5)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +str = uint16Array.toLocaleString(); // OK +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>uint16Array.toLocaleString : Symbol(Uint16Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>uint16Array : Symbol(uint16Array, Decl(arrayToLocaleStringES5.ts, 31, 5)) +>toLocaleString : Symbol(Uint16Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) + +str = uint16Array.toLocaleString('en-US'); // should be error +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>uint16Array.toLocaleString : Symbol(Uint16Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>uint16Array : Symbol(uint16Array, Decl(arrayToLocaleStringES5.ts, 31, 5)) +>toLocaleString : Symbol(Uint16Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) + +str = uint16Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>uint16Array.toLocaleString : Symbol(Uint16Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>uint16Array : Symbol(uint16Array, Decl(arrayToLocaleStringES5.ts, 31, 5)) +>toLocaleString : Symbol(Uint16Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>style : Symbol(style, Decl(arrayToLocaleStringES5.ts, 34, 43)) +>currency : Symbol(currency, Decl(arrayToLocaleStringES5.ts, 34, 62)) + +const int32Array = new Int32Array(3); +>int32Array : Symbol(int32Array, Decl(arrayToLocaleStringES5.ts, 36, 5)) +>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +str = int32Array.toLocaleString(); // OK +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>int32Array.toLocaleString : Symbol(Int32Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>int32Array : Symbol(int32Array, Decl(arrayToLocaleStringES5.ts, 36, 5)) +>toLocaleString : Symbol(Int32Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) + +str = int32Array.toLocaleString('en-US'); // should be error +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>int32Array.toLocaleString : Symbol(Int32Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>int32Array : Symbol(int32Array, Decl(arrayToLocaleStringES5.ts, 36, 5)) +>toLocaleString : Symbol(Int32Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) + +str = int32Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>int32Array.toLocaleString : Symbol(Int32Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>int32Array : Symbol(int32Array, Decl(arrayToLocaleStringES5.ts, 36, 5)) +>toLocaleString : Symbol(Int32Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>style : Symbol(style, Decl(arrayToLocaleStringES5.ts, 39, 42)) +>currency : Symbol(currency, Decl(arrayToLocaleStringES5.ts, 39, 61)) + +const uint32Array = new Uint32Array(3); +>uint32Array : Symbol(uint32Array, Decl(arrayToLocaleStringES5.ts, 41, 5)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +str = uint32Array.toLocaleString(); // OK +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>uint32Array.toLocaleString : Symbol(Uint32Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>uint32Array : Symbol(uint32Array, Decl(arrayToLocaleStringES5.ts, 41, 5)) +>toLocaleString : Symbol(Uint32Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) + +str = uint32Array.toLocaleString('en-US'); // should be error +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>uint32Array.toLocaleString : Symbol(Uint32Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>uint32Array : Symbol(uint32Array, Decl(arrayToLocaleStringES5.ts, 41, 5)) +>toLocaleString : Symbol(Uint32Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) + +str = uint32Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>uint32Array.toLocaleString : Symbol(Uint32Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>uint32Array : Symbol(uint32Array, Decl(arrayToLocaleStringES5.ts, 41, 5)) +>toLocaleString : Symbol(Uint32Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>style : Symbol(style, Decl(arrayToLocaleStringES5.ts, 44, 43)) +>currency : Symbol(currency, Decl(arrayToLocaleStringES5.ts, 44, 62)) + +const float32Array = new Float32Array(3); +>float32Array : Symbol(float32Array, Decl(arrayToLocaleStringES5.ts, 46, 5)) +>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +str = float32Array.toLocaleString(); // OK +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>float32Array.toLocaleString : Symbol(Float32Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>float32Array : Symbol(float32Array, Decl(arrayToLocaleStringES5.ts, 46, 5)) +>toLocaleString : Symbol(Float32Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) + +str = float32Array.toLocaleString('en-US'); // should be error +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>float32Array.toLocaleString : Symbol(Float32Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>float32Array : Symbol(float32Array, Decl(arrayToLocaleStringES5.ts, 46, 5)) +>toLocaleString : Symbol(Float32Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) + +str = float32Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>float32Array.toLocaleString : Symbol(Float32Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>float32Array : Symbol(float32Array, Decl(arrayToLocaleStringES5.ts, 46, 5)) +>toLocaleString : Symbol(Float32Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>style : Symbol(style, Decl(arrayToLocaleStringES5.ts, 49, 44)) +>currency : Symbol(currency, Decl(arrayToLocaleStringES5.ts, 49, 63)) + +const float64Array = new Float64Array(3); +>float64Array : Symbol(float64Array, Decl(arrayToLocaleStringES5.ts, 51, 5)) +>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +str = float64Array.toLocaleString(); // OK +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>float64Array.toLocaleString : Symbol(Float64Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>float64Array : Symbol(float64Array, Decl(arrayToLocaleStringES5.ts, 51, 5)) +>toLocaleString : Symbol(Float64Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) + +str = float64Array.toLocaleString('en-US'); // should be error +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>float64Array.toLocaleString : Symbol(Float64Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>float64Array : Symbol(float64Array, Decl(arrayToLocaleStringES5.ts, 51, 5)) +>toLocaleString : Symbol(Float64Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) + +str = float64Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +>str : Symbol(str, Decl(arrayToLocaleStringES5.ts, 0, 3)) +>float64Array.toLocaleString : Symbol(Float64Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>float64Array : Symbol(float64Array, Decl(arrayToLocaleStringES5.ts, 51, 5)) +>toLocaleString : Symbol(Float64Array.toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>style : Symbol(style, Decl(arrayToLocaleStringES5.ts, 54, 44)) +>currency : Symbol(currency, Decl(arrayToLocaleStringES5.ts, 54, 63)) + diff --git a/tests/baselines/reference/arrayToLocaleStringES5(target=es5).types b/tests/baselines/reference/arrayToLocaleStringES5(target=es5).types new file mode 100644 index 0000000000000..008380d28a7e9 --- /dev/null +++ b/tests/baselines/reference/arrayToLocaleStringES5(target=es5).types @@ -0,0 +1,735 @@ +//// [tests/cases/compiler/arrayToLocaleStringES5.ts] //// + +=== arrayToLocaleStringES5.ts === +let str: string; +>str : string +> : ^^^^^^ + +const arr = [1, 2, 3]; +>arr : number[] +> : ^^^^^^^^ +>[1, 2, 3] : number[] +> : ^^^^^^^^ +>1 : 1 +> : ^ +>2 : 2 +> : ^ +>3 : 3 +> : ^ + +str = arr.toLocaleString(); // OK +>str = arr.toLocaleString() : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>arr.toLocaleString() : string +> : ^^^^^^ +>arr.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>arr : number[] +> : ^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ + +str = arr.toLocaleString('en-US'); // should be error +>str = arr.toLocaleString('en-US') : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>arr.toLocaleString('en-US') : string +> : ^^^^^^ +>arr.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>arr : number[] +> : ^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>'en-US' : "en-US" +> : ^^^^^^^ + +str = arr.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +>str = arr.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }) : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>arr.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }) : string +> : ^^^^^^ +>arr.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>arr : number[] +> : ^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>'en-US' : "en-US" +> : ^^^^^^^ +>{ style: 'currency', currency: 'EUR' } : { style: "currency"; currency: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>style : "currency" +> : ^^^^^^^^^^ +>'currency' : "currency" +> : ^^^^^^^^^^ +>currency : string +> : ^^^^^^ +>'EUR' : "EUR" +> : ^^^^^ + +const dates: readonly Date[] = [new Date(), new Date()]; +>dates : readonly Date[] +> : ^^^^^^^^^^^^^^^ +>[new Date(), new Date()] : Date[] +> : ^^^^^^ +>new Date() : Date +> : ^^^^ +>Date : DateConstructor +> : ^^^^^^^^^^^^^^^ +>new Date() : Date +> : ^^^^ +>Date : DateConstructor +> : ^^^^^^^^^^^^^^^ + +str = dates.toLocaleString(); // OK +>str = dates.toLocaleString() : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>dates.toLocaleString() : string +> : ^^^^^^ +>dates.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>dates : readonly Date[] +> : ^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ + +str = dates.toLocaleString('fr'); // should be error +>str = dates.toLocaleString('fr') : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>dates.toLocaleString('fr') : string +> : ^^^^^^ +>dates.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>dates : readonly Date[] +> : ^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>'fr' : "fr" +> : ^^^^ + +str = dates.toLocaleString('fr', { timeZone: 'UTC' }); // should be error +>str = dates.toLocaleString('fr', { timeZone: 'UTC' }) : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>dates.toLocaleString('fr', { timeZone: 'UTC' }) : string +> : ^^^^^^ +>dates.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>dates : readonly Date[] +> : ^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>'fr' : "fr" +> : ^^^^ +>{ timeZone: 'UTC' } : { timeZone: string; } +> : ^^^^^^^^^^^^^^^^^^^^^ +>timeZone : string +> : ^^^^^^ +>'UTC' : "UTC" +> : ^^^^^ + +const int8Array = new Int8Array(3); +>int8Array : Int8Array +> : ^^^^^^^^^^^^^^^^^^^^^^ +>new Int8Array(3) : Int8Array +> : ^^^^^^^^^^^^^^^^^^^^^^ +>Int8Array : Int8ArrayConstructor +> : ^^^^^^^^^^^^^^^^^^^^ +>3 : 3 +> : ^ + +str = int8Array.toLocaleString(); // OK +>str = int8Array.toLocaleString() : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>int8Array.toLocaleString() : string +> : ^^^^^^ +>int8Array.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>int8Array : Int8Array +> : ^^^^^^^^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ + +str = int8Array.toLocaleString('en-US'); // should be error +>str = int8Array.toLocaleString('en-US') : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>int8Array.toLocaleString('en-US') : string +> : ^^^^^^ +>int8Array.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>int8Array : Int8Array +> : ^^^^^^^^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>'en-US' : "en-US" +> : ^^^^^^^ + +str = int8Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +>str = int8Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }) : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>int8Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }) : string +> : ^^^^^^ +>int8Array.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>int8Array : Int8Array +> : ^^^^^^^^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>'en-US' : "en-US" +> : ^^^^^^^ +>{ style: 'currency', currency: 'EUR' } : { style: "currency"; currency: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>style : "currency" +> : ^^^^^^^^^^ +>'currency' : "currency" +> : ^^^^^^^^^^ +>currency : string +> : ^^^^^^ +>'EUR' : "EUR" +> : ^^^^^ + +const uint8Array = new Uint8Array(3); +>uint8Array : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>new Uint8Array(3) : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>Uint8Array : Uint8ArrayConstructor +> : ^^^^^^^^^^^^^^^^^^^^^ +>3 : 3 +> : ^ + +str = uint8Array.toLocaleString(); // OK +>str = uint8Array.toLocaleString() : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>uint8Array.toLocaleString() : string +> : ^^^^^^ +>uint8Array.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>uint8Array : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ + +str = uint8Array.toLocaleString('en-US'); // should be error +>str = uint8Array.toLocaleString('en-US') : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>uint8Array.toLocaleString('en-US') : string +> : ^^^^^^ +>uint8Array.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>uint8Array : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>'en-US' : "en-US" +> : ^^^^^^^ + +str = uint8Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +>str = uint8Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }) : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>uint8Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }) : string +> : ^^^^^^ +>uint8Array.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>uint8Array : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>'en-US' : "en-US" +> : ^^^^^^^ +>{ style: 'currency', currency: 'EUR' } : { style: "currency"; currency: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>style : "currency" +> : ^^^^^^^^^^ +>'currency' : "currency" +> : ^^^^^^^^^^ +>currency : string +> : ^^^^^^ +>'EUR' : "EUR" +> : ^^^^^ + +const uint8ClampedArray = new Uint8ClampedArray(3); +>uint8ClampedArray : Uint8ClampedArray +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>new Uint8ClampedArray(3) : Uint8ClampedArray +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>Uint8ClampedArray : Uint8ClampedArrayConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>3 : 3 +> : ^ + +str = uint8ClampedArray.toLocaleString(); // OK +>str = uint8ClampedArray.toLocaleString() : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>uint8ClampedArray.toLocaleString() : string +> : ^^^^^^ +>uint8ClampedArray.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>uint8ClampedArray : Uint8ClampedArray +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ + +str = uint8ClampedArray.toLocaleString('en-US'); // should be error +>str = uint8ClampedArray.toLocaleString('en-US') : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>uint8ClampedArray.toLocaleString('en-US') : string +> : ^^^^^^ +>uint8ClampedArray.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>uint8ClampedArray : Uint8ClampedArray +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>'en-US' : "en-US" +> : ^^^^^^^ + +str = uint8ClampedArray.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +>str = uint8ClampedArray.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }) : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>uint8ClampedArray.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }) : string +> : ^^^^^^ +>uint8ClampedArray.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>uint8ClampedArray : Uint8ClampedArray +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>'en-US' : "en-US" +> : ^^^^^^^ +>{ style: 'currency', currency: 'EUR' } : { style: "currency"; currency: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>style : "currency" +> : ^^^^^^^^^^ +>'currency' : "currency" +> : ^^^^^^^^^^ +>currency : string +> : ^^^^^^ +>'EUR' : "EUR" +> : ^^^^^ + +const int16Array = new Int16Array(3); +>int16Array : Int16Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>new Int16Array(3) : Int16Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>Int16Array : Int16ArrayConstructor +> : ^^^^^^^^^^^^^^^^^^^^^ +>3 : 3 +> : ^ + +str = int16Array.toLocaleString(); // OK +>str = int16Array.toLocaleString() : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>int16Array.toLocaleString() : string +> : ^^^^^^ +>int16Array.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>int16Array : Int16Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ + +str = int16Array.toLocaleString('en-US'); // should be error +>str = int16Array.toLocaleString('en-US') : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>int16Array.toLocaleString('en-US') : string +> : ^^^^^^ +>int16Array.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>int16Array : Int16Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>'en-US' : "en-US" +> : ^^^^^^^ + +str = int16Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +>str = int16Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }) : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>int16Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }) : string +> : ^^^^^^ +>int16Array.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>int16Array : Int16Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>'en-US' : "en-US" +> : ^^^^^^^ +>{ style: 'currency', currency: 'EUR' } : { style: "currency"; currency: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>style : "currency" +> : ^^^^^^^^^^ +>'currency' : "currency" +> : ^^^^^^^^^^ +>currency : string +> : ^^^^^^ +>'EUR' : "EUR" +> : ^^^^^ + +const uint16Array = new Uint16Array(3); +>uint16Array : Uint16Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^ +>new Uint16Array(3) : Uint16Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^ +>Uint16Array : Uint16ArrayConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^ +>3 : 3 +> : ^ + +str = uint16Array.toLocaleString(); // OK +>str = uint16Array.toLocaleString() : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>uint16Array.toLocaleString() : string +> : ^^^^^^ +>uint16Array.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>uint16Array : Uint16Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ + +str = uint16Array.toLocaleString('en-US'); // should be error +>str = uint16Array.toLocaleString('en-US') : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>uint16Array.toLocaleString('en-US') : string +> : ^^^^^^ +>uint16Array.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>uint16Array : Uint16Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>'en-US' : "en-US" +> : ^^^^^^^ + +str = uint16Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +>str = uint16Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }) : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>uint16Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }) : string +> : ^^^^^^ +>uint16Array.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>uint16Array : Uint16Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>'en-US' : "en-US" +> : ^^^^^^^ +>{ style: 'currency', currency: 'EUR' } : { style: "currency"; currency: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>style : "currency" +> : ^^^^^^^^^^ +>'currency' : "currency" +> : ^^^^^^^^^^ +>currency : string +> : ^^^^^^ +>'EUR' : "EUR" +> : ^^^^^ + +const int32Array = new Int32Array(3); +>int32Array : Int32Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>new Int32Array(3) : Int32Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>Int32Array : Int32ArrayConstructor +> : ^^^^^^^^^^^^^^^^^^^^^ +>3 : 3 +> : ^ + +str = int32Array.toLocaleString(); // OK +>str = int32Array.toLocaleString() : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>int32Array.toLocaleString() : string +> : ^^^^^^ +>int32Array.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>int32Array : Int32Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ + +str = int32Array.toLocaleString('en-US'); // should be error +>str = int32Array.toLocaleString('en-US') : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>int32Array.toLocaleString('en-US') : string +> : ^^^^^^ +>int32Array.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>int32Array : Int32Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>'en-US' : "en-US" +> : ^^^^^^^ + +str = int32Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +>str = int32Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }) : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>int32Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }) : string +> : ^^^^^^ +>int32Array.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>int32Array : Int32Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>'en-US' : "en-US" +> : ^^^^^^^ +>{ style: 'currency', currency: 'EUR' } : { style: "currency"; currency: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>style : "currency" +> : ^^^^^^^^^^ +>'currency' : "currency" +> : ^^^^^^^^^^ +>currency : string +> : ^^^^^^ +>'EUR' : "EUR" +> : ^^^^^ + +const uint32Array = new Uint32Array(3); +>uint32Array : Uint32Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^ +>new Uint32Array(3) : Uint32Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^ +>Uint32Array : Uint32ArrayConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^ +>3 : 3 +> : ^ + +str = uint32Array.toLocaleString(); // OK +>str = uint32Array.toLocaleString() : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>uint32Array.toLocaleString() : string +> : ^^^^^^ +>uint32Array.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>uint32Array : Uint32Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ + +str = uint32Array.toLocaleString('en-US'); // should be error +>str = uint32Array.toLocaleString('en-US') : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>uint32Array.toLocaleString('en-US') : string +> : ^^^^^^ +>uint32Array.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>uint32Array : Uint32Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>'en-US' : "en-US" +> : ^^^^^^^ + +str = uint32Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +>str = uint32Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }) : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>uint32Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }) : string +> : ^^^^^^ +>uint32Array.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>uint32Array : Uint32Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>'en-US' : "en-US" +> : ^^^^^^^ +>{ style: 'currency', currency: 'EUR' } : { style: "currency"; currency: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>style : "currency" +> : ^^^^^^^^^^ +>'currency' : "currency" +> : ^^^^^^^^^^ +>currency : string +> : ^^^^^^ +>'EUR' : "EUR" +> : ^^^^^ + +const float32Array = new Float32Array(3); +>float32Array : Float32Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ +>new Float32Array(3) : Float32Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ +>Float32Array : Float32ArrayConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>3 : 3 +> : ^ + +str = float32Array.toLocaleString(); // OK +>str = float32Array.toLocaleString() : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>float32Array.toLocaleString() : string +> : ^^^^^^ +>float32Array.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>float32Array : Float32Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ + +str = float32Array.toLocaleString('en-US'); // should be error +>str = float32Array.toLocaleString('en-US') : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>float32Array.toLocaleString('en-US') : string +> : ^^^^^^ +>float32Array.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>float32Array : Float32Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>'en-US' : "en-US" +> : ^^^^^^^ + +str = float32Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +>str = float32Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }) : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>float32Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }) : string +> : ^^^^^^ +>float32Array.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>float32Array : Float32Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>'en-US' : "en-US" +> : ^^^^^^^ +>{ style: 'currency', currency: 'EUR' } : { style: "currency"; currency: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>style : "currency" +> : ^^^^^^^^^^ +>'currency' : "currency" +> : ^^^^^^^^^^ +>currency : string +> : ^^^^^^ +>'EUR' : "EUR" +> : ^^^^^ + +const float64Array = new Float64Array(3); +>float64Array : Float64Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ +>new Float64Array(3) : Float64Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ +>Float64Array : Float64ArrayConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>3 : 3 +> : ^ + +str = float64Array.toLocaleString(); // OK +>str = float64Array.toLocaleString() : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>float64Array.toLocaleString() : string +> : ^^^^^^ +>float64Array.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>float64Array : Float64Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ + +str = float64Array.toLocaleString('en-US'); // should be error +>str = float64Array.toLocaleString('en-US') : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>float64Array.toLocaleString('en-US') : string +> : ^^^^^^ +>float64Array.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>float64Array : Float64Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>'en-US' : "en-US" +> : ^^^^^^^ + +str = float64Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }); // should be error +>str = float64Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }) : string +> : ^^^^^^ +>str : string +> : ^^^^^^ +>float64Array.toLocaleString('en-US', { style: 'currency', currency: 'EUR' }) : string +> : ^^^^^^ +>float64Array.toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>float64Array : Float64Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ +>toLocaleString : { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions): string; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^^ +>'en-US' : "en-US" +> : ^^^^^^^ +>{ style: 'currency', currency: 'EUR' } : { style: "currency"; currency: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>style : "currency" +> : ^^^^^^^^^^ +>'currency' : "currency" +> : ^^^^^^^^^^ +>currency : string +> : ^^^^^^ +>'EUR' : "EUR" +> : ^^^^^ + diff --git a/tests/baselines/reference/arrayconcat.js b/tests/baselines/reference/arrayconcat.js index b42610336bb66..a9bdddc8daab3 100644 --- a/tests/baselines/reference/arrayconcat.js +++ b/tests/baselines/reference/arrayconcat.js @@ -31,10 +31,8 @@ class parser { } //// [arrayconcat.js] -var parser = /** @class */ (function () { - function parser() { - } - parser.prototype.m = function () { +class parser { + m() { this.options = this.options.sort(function (a, b) { var aName = a.name.toLowerCase(); var bName = b.name.toLowerCase(); @@ -48,6 +46,5 @@ var parser = /** @class */ (function () { return 0; } }); - }; - return parser; -}()); + } +} diff --git a/tests/baselines/reference/arrowFunctionContexts.js b/tests/baselines/reference/arrowFunctionContexts.js index 60d6fbb1f3b9b..a8114b4ebcfbd 100644 --- a/tests/baselines/reference/arrowFunctionContexts.js +++ b/tests/baselines/reference/arrowFunctionContexts.js @@ -98,110 +98,81 @@ var asserted2: any; //// [arrowFunctionContexts.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var _this = this; // Arrow function used in with statement with (window) { - var p = function () { return _this; }; + var p = () => this; } // Arrow function as argument to super call -var Base = /** @class */ (function () { - function Base(n) { - } - return Base; -}()); -var Derived = /** @class */ (function (_super) { - __extends(Derived, _super); - function Derived() { - var _this = _super.call(this, function () { return _this; }) || this; - return _this; +class Base { + constructor(n) { } +} +class Derived extends Base { + constructor() { + super(() => this); } - return Derived; -}(Base)); +} // Arrow function as function argument -window.setTimeout(function () { return null; }, 100); +window.setTimeout(() => null, 100); // Arrow function as value in array literal -var obj = function (n) { return ''; }; +var obj = (n) => ''; var obj; // OK -var arr = [function (n) { return ''; }]; +var arr = [(n) => '']; var arr; // Incorrect error here (bug 829597) // Arrow function as enum value var E; (function (E) { - var _this = this; - E[E["x"] = function () { return 4; }] = "x"; - E[E["y"] = (function () { return _this; }).length] = "y"; // error, can't use this in enum + E[E["x"] = () => 4] = "x"; + E[E["y"] = (() => this).length] = "y"; // error, can't use this in enum })(E || (E = {})); // Arrow function as module variable initializer var M; (function (M) { - M.a = function (s) { return ''; }; - var b = function (s) { return s; }; + M.a = (s) => ''; + var b = (s) => s; })(M || (M = {})); // Repeat above for module members that are functions? (necessary to redo all of them?) var M2; (function (M2) { - var _this = this; // Arrow function used in with statement with (window) { - var p = function () { return _this; }; + var p = () => this; } // Arrow function as argument to super call - var Base = /** @class */ (function () { - function Base(n) { - } - return Base; - }()); - var Derived = /** @class */ (function (_super) { - __extends(Derived, _super); - function Derived() { - var _this = _super.call(this, function () { return _this; }) || this; - return _this; + class Base { + constructor(n) { } + } + class Derived extends Base { + constructor() { + super(() => this); } - return Derived; - }(Base)); + } // Arrow function as function argument - window.setTimeout(function () { return null; }, 100); + window.setTimeout(() => null, 100); // Arrow function as value in array literal - var obj = function (n) { return ''; }; + var obj = (n) => ''; var obj; // OK - var arr = [function (n) { return ''; }]; + var arr = [(n) => '']; var arr; // Incorrect error here (bug 829597) // Arrow function as enum value - var E; + let E; (function (E) { - var _this = this; - E[E["x"] = function () { return 4; }] = "x"; - E[E["y"] = (function () { return _this; }).length] = "y"; + E[E["x"] = () => 4] = "x"; + E[E["y"] = (() => this).length] = "y"; })(E || (E = {})); // Arrow function as module variable initializer - var M; + let M; (function (M) { - M.a = function (s) { return ''; }; - var b = function (s) { return s; }; + M.a = (s) => ''; + var b = (s) => s; })(M || (M = {})); })(M2 || (M2 = {})); // (ParamList) => { ... } is a generic arrow function -var generic1 = function (n) { return [n]; }; +var generic1 = (n) => [n]; var generic1; // Incorrect error, Bug 829597 -var generic2 = function (n) { return [n]; }; +var generic2 = (n) => { return [n]; }; var generic2; // ((ParamList) => { ... } ) is a type assertion to an arrow function -var asserted1 = (function (n) { return [n]; }); +var asserted1 = ((n) => [n]); var asserted1; -var asserted2 = (function (n) { return n; }); +var asserted2 = ((n) => { return n; }); var asserted2; diff --git a/tests/baselines/reference/arrowFunctionErrorSpan.js b/tests/baselines/reference/arrowFunctionErrorSpan.js index b9dd81a62ea09..9f7967b6acccf 100644 --- a/tests/baselines/reference/arrowFunctionErrorSpan.js +++ b/tests/baselines/reference/arrowFunctionErrorSpan.js @@ -59,35 +59,35 @@ f(_ => 1 + //// [arrowFunctionErrorSpan.js] function f(a) { } // oneliner -f(function () { }); +f(() => { }); // multiline, body -f(function () { +f(() => { }); // multiline 2, body -f(function () { +f(() => { }); // multiline 3, arrow on a new line -f(function () { }); +f(() => { }); // multiline 4, arguments -f(function (a, b, c, d) { }); +f((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 // comment 2 -function () { +() => { // comment 4 } // comment 5 ); // body is not a block -f(function (_) { return 1 + - 2; }); +f(_ => 1 + + 2); diff --git a/tests/baselines/reference/arrowFunctionExpressions.js b/tests/baselines/reference/arrowFunctionExpressions.js index f4be03dd189a6..d7b5511f2746d 100644 --- a/tests/baselines/reference/arrowFunctionExpressions.js +++ b/tests/baselines/reference/arrowFunctionExpressions.js @@ -103,88 +103,65 @@ 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 = (p) => p.length; +var a = (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 = j => { return 0; }; +var b = (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 = n => c = n; +var d = (n) => c = n; var d; // Binding patterns in arrow functions -var p1 = function (_a) { - var a = _a[0]; -}; -var p2 = function (_a) { - var a = _a.slice(0); -}; -var p3 = function (_a) { - var a = _a[1]; -}; -var p4 = function (_a) { - var a = _a.slice(1); -}; -var p5 = function (_a) { - var _b = _a[0], a = _b === void 0 ? 1 : _b; -}; -var p6 = function (_a) { - var a = _a.a; -}; -var p7 = function (_a) { - var b = _a.a.b; -}; -var p8 = function (_a) { - var _b = _a.a, a = _b === void 0 ? 1 : _b; -}; -var p9 = function (_a) { - var _b = _a.a, _c = _b === void 0 ? { b: 1 } : _b, _d = _c.b, b = _d === void 0 ? 1 : _d; -}; -var p10 = function (_a) { - var _b = _a[0], value = _b.value, done = _b.done; -}; +var p1 = ([a]) => { }; +var p2 = ([...a]) => { }; +var p3 = ([, a]) => { }; +var p4 = ([, ...a]) => { }; +var p5 = ([a = 1]) => { }; +var p6 = ({ a }) => { }; +var p7 = ({ a: { b } }) => { }; +var p8 = ({ a = 1 }) => { }; +var p9 = ({ a: { b = 1 } = { b: 1 } }) => { }; +var p10 = ([{ value, done }]) => { }; // Arrow function used in class member initializer // Arrow function used in class member function -var MyClass = /** @class */ (function () { - function MyClass() { - var _this = this; - this.m = function (n) { return n + 1; }; - this.p = function (n) { return n && _this; }; +class MyClass { + constructor() { + this.m = (n) => n + 1; + this.p = (n) => n && this; } - MyClass.prototype.fn = function () { - var _this = this; - var m = function (n) { return n + 1; }; - var p = function (n) { return n && _this; }; - }; - return MyClass; -}()); + fn() { + var m = (n) => n + 1; + var p = (n) => n && this; + } +} // Arrow function used in arrow function -var arrrr = function () { return function (m) { return function () { return function (n) { return m + n; }; }; }; }; +var arrrr = () => (m) => () => (n) => 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; }; }; + var arr = (n) => (p) => p * n; arr(3)(4).toExponential(); } // Arrow function used in function function someOtherFn() { - var arr = function (n) { return '' + n; }; + var arr = (n) => '' + n; arr(4).charAt(0); } // Arrow function used in nested function in function function outerFn() { function innerFn() { - var arrowFn = function () { }; + var arrowFn = () => { }; var p = arrowFn(); var p; } } // Arrow function used in nested function in arrow function -var f = function (n) { +var f = (n) => { function fn(x) { - return function () { return n + x; }; + return () => n + x; } return fn(4); }; @@ -192,9 +169,9 @@ var g = f('')(); var g; // Arrow function used in nested function in arrow function in nested function function someOuterFn() { - var arr = function (n) { + var arr = (n) => { function innerFn() { - return function () { return n.length; }; + return () => n.length; } return innerFn; }; @@ -204,14 +181,13 @@ var h = someOuterFn()('')()(); h.toExponential(); // Arrow function used in try/catch/finally in function function tryCatchFn() { - var _this = this; try { - var x = function () { return _this; }; + var x = () => this; } catch (e) { - var t = function () { return e + _this; }; + var t = () => e + this; } finally { - var m = function () { return _this + ''; }; + var m = () => this + ''; } } diff --git a/tests/baselines/reference/arrowFunctionExpressions.types b/tests/baselines/reference/arrowFunctionExpressions.types index cf5973fc84e6f..3158e45386ff0 100644 --- a/tests/baselines/reference/arrowFunctionExpressions.types +++ b/tests/baselines/reference/arrowFunctionExpressions.types @@ -91,10 +91,10 @@ var p1 = ([a]) => { }; > : ^^^ var p2 = ([...a]) => { }; ->p2 : ([...a]: any[]) => void -> : ^ ^^^^^^^^^^^^^^^^ ->([...a]) => { } : ([...a]: any[]) => void -> : ^ ^^^^^^^^^^^^^^^^ +>p2 : ([...a]: Iterable) => void +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>([...a]) => { } : ([...a]: Iterable) => void +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >a : any[] > : ^^^^^ diff --git a/tests/baselines/reference/arrowFunctionInConstructorArgument1.js b/tests/baselines/reference/arrowFunctionInConstructorArgument1.js index d7762cad8adba..a8b634872976b 100644 --- a/tests/baselines/reference/arrowFunctionInConstructorArgument1.js +++ b/tests/baselines/reference/arrowFunctionInConstructorArgument1.js @@ -8,9 +8,7 @@ var c = new C(() => { return asdf; } ) // should error //// [arrowFunctionInConstructorArgument1.js] -var C = /** @class */ (function () { - function C(x) { - } - return C; -}()); -var c = new C(function () { return asdf; }); // should error +class C { + constructor(x) { } +} +var c = new C(() => { return asdf; }); // should error diff --git a/tests/baselines/reference/arrowFunctionInExpressionStatement1.js b/tests/baselines/reference/arrowFunctionInExpressionStatement1.js index 8edeb9c0a3460..99750843cb59c 100644 --- a/tests/baselines/reference/arrowFunctionInExpressionStatement1.js +++ b/tests/baselines/reference/arrowFunctionInExpressionStatement1.js @@ -4,4 +4,4 @@ () => 0; //// [arrowFunctionInExpressionStatement1.js] -(function () { return 0; }); +() => 0; diff --git a/tests/baselines/reference/arrowFunctionInExpressionStatement2.js b/tests/baselines/reference/arrowFunctionInExpressionStatement2.js index 550a88228d8ba..ae6bc2fb642aa 100644 --- a/tests/baselines/reference/arrowFunctionInExpressionStatement2.js +++ b/tests/baselines/reference/arrowFunctionInExpressionStatement2.js @@ -8,5 +8,5 @@ namespace M { //// [arrowFunctionInExpressionStatement2.js] var M; (function (M) { - (function () { return 0; }); + () => 0; })(M || (M = {})); diff --git a/tests/baselines/reference/arrowFunctionMissingCurlyWithSemicolon.js b/tests/baselines/reference/arrowFunctionMissingCurlyWithSemicolon.js index ea026b5bb5bc7..02e5e1fcd80fa 100644 --- a/tests/baselines/reference/arrowFunctionMissingCurlyWithSemicolon.js +++ b/tests/baselines/reference/arrowFunctionMissingCurlyWithSemicolon.js @@ -8,6 +8,6 @@ var square = (x: number) => x * x; //// [arrowFunctionMissingCurlyWithSemicolon.js] // Should error at semicolon. -var f = function () { return ; }; +var f = () => ; var b = 1 * 2 * 3 * 4; -var square = function (x) { return x * x; }; +var square = (x) => x * x; diff --git a/tests/baselines/reference/arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.js b/tests/baselines/reference/arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.js index 5e99656ebdea6..0356b15dda05a 100644 --- a/tests/baselines/reference/arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.js +++ b/tests/baselines/reference/arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.js @@ -18,14 +18,14 @@ const test = () => ({ //// [arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.js] -var test = function () { return ({ +const test = () => ({ // "Identifier expected." error on "!" and two "Duplicate identifier '(Missing)'." errors on space. prop: !value, // remove ! to see that errors will be gone - run: function () { + run: () => { // comment next line or remove "()" to see that errors will be gone if (!a.b()) { return 'special'; } return 'default'; } -}); }; +}); diff --git a/tests/baselines/reference/arrowFunctionWithObjectLiteralBody1.js b/tests/baselines/reference/arrowFunctionWithObjectLiteralBody1.js index 07163e950d79d..3e769e193b641 100644 --- a/tests/baselines/reference/arrowFunctionWithObjectLiteralBody1.js +++ b/tests/baselines/reference/arrowFunctionWithObjectLiteralBody1.js @@ -4,4 +4,4 @@ var v = a => {} //// [arrowFunctionWithObjectLiteralBody1.js] -var v = function (a) { return ({}); }; +var v = a => ({}); diff --git a/tests/baselines/reference/arrowFunctionWithObjectLiteralBody2.js b/tests/baselines/reference/arrowFunctionWithObjectLiteralBody2.js index a7a6cae46a019..b56295a674aa6 100644 --- a/tests/baselines/reference/arrowFunctionWithObjectLiteralBody2.js +++ b/tests/baselines/reference/arrowFunctionWithObjectLiteralBody2.js @@ -4,4 +4,4 @@ var v = a => {} //// [arrowFunctionWithObjectLiteralBody2.js] -var v = function (a) { return ({}); }; +var v = a => ({}); diff --git a/tests/baselines/reference/arrowFunctionWithObjectLiteralBody5.js b/tests/baselines/reference/arrowFunctionWithObjectLiteralBody5.js index 4e83d53574428..f42a8a3de8c45 100644 --- a/tests/baselines/reference/arrowFunctionWithObjectLiteralBody5.js +++ b/tests/baselines/reference/arrowFunctionWithObjectLiteralBody5.js @@ -10,7 +10,7 @@ var c = () => ({ name: "foo", message: "bar" }); 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" }); }; +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/arrowFunctionWithParameterNameAsync_es2017(target=es2015).js b/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es2017(target=es2015).js new file mode 100644 index 0000000000000..a53f208b4f58d --- /dev/null +++ b/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es2017(target=es2015).js @@ -0,0 +1,7 @@ +//// [tests/cases/conformance/async/es2017/asyncArrowFunction/arrowFunctionWithParameterNameAsync_es2017.ts] //// + +//// [arrowFunctionWithParameterNameAsync_es2017.ts] +const x = async => async; + +//// [arrowFunctionWithParameterNameAsync_es2017.js] +const x = async => async; diff --git a/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es2017.symbols b/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es2017(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/arrowFunctionWithParameterNameAsync_es2017.symbols rename to tests/baselines/reference/arrowFunctionWithParameterNameAsync_es2017(target=es2015).symbols diff --git a/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es2017.types b/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es2017(target=es2015).types similarity index 100% rename from tests/baselines/reference/arrowFunctionWithParameterNameAsync_es2017.types rename to tests/baselines/reference/arrowFunctionWithParameterNameAsync_es2017(target=es2015).types diff --git a/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es2017.js b/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es2017(target=es5).js similarity index 100% rename from tests/baselines/reference/arrowFunctionWithParameterNameAsync_es2017.js rename to tests/baselines/reference/arrowFunctionWithParameterNameAsync_es2017(target=es5).js diff --git a/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es2017(target=es5).symbols b/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es2017(target=es5).symbols new file mode 100644 index 0000000000000..97a12e1650dc4 --- /dev/null +++ b/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es2017(target=es5).symbols @@ -0,0 +1,8 @@ +//// [tests/cases/conformance/async/es2017/asyncArrowFunction/arrowFunctionWithParameterNameAsync_es2017.ts] //// + +=== arrowFunctionWithParameterNameAsync_es2017.ts === +const x = async => async; +>x : Symbol(x, Decl(arrowFunctionWithParameterNameAsync_es2017.ts, 0, 5)) +>async : Symbol(async, Decl(arrowFunctionWithParameterNameAsync_es2017.ts, 0, 9)) +>async : Symbol(async, Decl(arrowFunctionWithParameterNameAsync_es2017.ts, 0, 9)) + diff --git a/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es2017(target=es5).types b/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es2017(target=es5).types new file mode 100644 index 0000000000000..a9a7af90fd59b --- /dev/null +++ b/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es2017(target=es5).types @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/async/es2017/asyncArrowFunction/arrowFunctionWithParameterNameAsync_es2017.ts] //// + +=== arrowFunctionWithParameterNameAsync_es2017.ts === +const x = async => async; +>x : (async: any) => any +> : ^ ^^^^^^^^^^^^^ +>async => async : (async: any) => any +> : ^ ^^^^^^^^^^^^^ +>async : any +>async : any + diff --git a/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es5(target=es2015).js b/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es5(target=es2015).js new file mode 100644 index 0000000000000..facea9ac74ca7 --- /dev/null +++ b/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es5(target=es2015).js @@ -0,0 +1,7 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/arrowFunctionWithParameterNameAsync_es5.ts] //// + +//// [arrowFunctionWithParameterNameAsync_es5.ts] +const x = async => async; + +//// [arrowFunctionWithParameterNameAsync_es5.js] +const x = async => async; diff --git a/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es5.symbols b/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/arrowFunctionWithParameterNameAsync_es5.symbols rename to tests/baselines/reference/arrowFunctionWithParameterNameAsync_es5(target=es2015).symbols diff --git a/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es5.types b/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/arrowFunctionWithParameterNameAsync_es5.types rename to tests/baselines/reference/arrowFunctionWithParameterNameAsync_es5(target=es2015).types diff --git a/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es5.js b/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/arrowFunctionWithParameterNameAsync_es5.js rename to tests/baselines/reference/arrowFunctionWithParameterNameAsync_es5(target=es5).js diff --git a/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es5(target=es5).symbols b/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es5(target=es5).symbols new file mode 100644 index 0000000000000..db4e2f9be973e --- /dev/null +++ b/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es5(target=es5).symbols @@ -0,0 +1,8 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/arrowFunctionWithParameterNameAsync_es5.ts] //// + +=== arrowFunctionWithParameterNameAsync_es5.ts === +const x = async => async; +>x : Symbol(x, Decl(arrowFunctionWithParameterNameAsync_es5.ts, 0, 5)) +>async : Symbol(async, Decl(arrowFunctionWithParameterNameAsync_es5.ts, 0, 9)) +>async : Symbol(async, Decl(arrowFunctionWithParameterNameAsync_es5.ts, 0, 9)) + diff --git a/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es5(target=es5).types b/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es5(target=es5).types new file mode 100644 index 0000000000000..689a6d058d413 --- /dev/null +++ b/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es5(target=es5).types @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/arrowFunctionWithParameterNameAsync_es5.ts] //// + +=== arrowFunctionWithParameterNameAsync_es5.ts === +const x = async => async; +>x : (async: any) => any +> : ^ ^^^^^^^^^^^^^ +>async => async : (async: any) => any +> : ^ ^^^^^^^^^^^^^ +>async : any +>async : any + diff --git a/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es6(target=es2015).js b/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es6(target=es2015).js new file mode 100644 index 0000000000000..32a1f739fbb6b --- /dev/null +++ b/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es6(target=es2015).js @@ -0,0 +1,7 @@ +//// [tests/cases/conformance/async/es6/asyncArrowFunction/arrowFunctionWithParameterNameAsync_es6.ts] //// + +//// [arrowFunctionWithParameterNameAsync_es6.ts] +const x = async => async; + +//// [arrowFunctionWithParameterNameAsync_es6.js] +const x = async => async; diff --git a/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es6.symbols b/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es6(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/arrowFunctionWithParameterNameAsync_es6.symbols rename to tests/baselines/reference/arrowFunctionWithParameterNameAsync_es6(target=es2015).symbols diff --git a/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es6.types b/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es6(target=es2015).types similarity index 100% rename from tests/baselines/reference/arrowFunctionWithParameterNameAsync_es6.types rename to tests/baselines/reference/arrowFunctionWithParameterNameAsync_es6(target=es2015).types diff --git a/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es6.js b/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es6(target=es5).js similarity index 100% rename from tests/baselines/reference/arrowFunctionWithParameterNameAsync_es6.js rename to tests/baselines/reference/arrowFunctionWithParameterNameAsync_es6(target=es5).js diff --git a/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es6(target=es5).symbols b/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es6(target=es5).symbols new file mode 100644 index 0000000000000..aff006029f768 --- /dev/null +++ b/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es6(target=es5).symbols @@ -0,0 +1,8 @@ +//// [tests/cases/conformance/async/es6/asyncArrowFunction/arrowFunctionWithParameterNameAsync_es6.ts] //// + +=== arrowFunctionWithParameterNameAsync_es6.ts === +const x = async => async; +>x : Symbol(x, Decl(arrowFunctionWithParameterNameAsync_es6.ts, 0, 5)) +>async : Symbol(async, Decl(arrowFunctionWithParameterNameAsync_es6.ts, 0, 9)) +>async : Symbol(async, Decl(arrowFunctionWithParameterNameAsync_es6.ts, 0, 9)) + diff --git a/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es6(target=es5).types b/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es6(target=es5).types new file mode 100644 index 0000000000000..83d46dba73a98 --- /dev/null +++ b/tests/baselines/reference/arrowFunctionWithParameterNameAsync_es6(target=es5).types @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/async/es6/asyncArrowFunction/arrowFunctionWithParameterNameAsync_es6.ts] //// + +=== arrowFunctionWithParameterNameAsync_es6.ts === +const x = async => async; +>x : (async: any) => any +> : ^ ^^^^^^^^^^^^^ +>async => async : (async: any) => any +> : ^ ^^^^^^^^^^^^^ +>async : any +>async : any + diff --git a/tests/baselines/reference/arrowFunctionsMissingTokens.js b/tests/baselines/reference/arrowFunctionsMissingTokens.js index 7b549aaf20f3c..a7534a4bb721f 100644 --- a/tests/baselines/reference/arrowFunctionsMissingTokens.js +++ b/tests/baselines/reference/arrowFunctionsMissingTokens.js @@ -70,50 +70,50 @@ namespace okay { //// [arrowFunctionsMissingTokens.js] var missingArrowsWithCurly; (function (missingArrowsWithCurly) { - var a = function () { }; - var b = function () { }; - var c = function (x) { }; - var d = function (x, y) { }; - var e = function (x, y) { }; + var a = () => { }; + var b = () => { }; + var c = (x) => { }; + var d = (x, y) => { }; + var e = (x, y) => { }; })(missingArrowsWithCurly || (missingArrowsWithCurly = {})); var missingCurliesWithArrow; (function (missingCurliesWithArrow) { - var withStatement; + let withStatement; (function (withStatement) { - var a = function () { var k = 10; }; - var b = function () { var k = 10; }; - var c = function (x) { var k = 10; }; - var d = function (x, y) { var k = 10; }; - var e = function (x, y) { var k = 10; }; - var f = function () { var k = 10; }; + var a = () => { var k = 10; }; + var b = () => { var k = 10; }; + var c = (x) => { var k = 10; }; + var d = (x, y) => { var k = 10; }; + var e = (x, y) => { var k = 10; }; + var f = () => { var k = 10; }; })(withStatement || (withStatement = {})); - var withoutStatement; + let withoutStatement; (function (withoutStatement) { - var a = function () { return ; }; + var a = () => ; })(withoutStatement || (withoutStatement = {})); ; - var b = function () { return ; }; + var b = () => ; })(missingCurliesWithArrow || (missingCurliesWithArrow = {})); -var c = function (x) { return ; }; +var c = (x) => ; ; -var d = function (x, y) { return ; }; +var d = (x, y) => ; ; -var e = function (x, y) { return ; }; +var e = (x, y) => ; ; -var f = function () { return ; }; +var f = () => ; var ce_nEst_pas_une_arrow_function; (function (ce_nEst_pas_une_arrow_function) { var a = (); - var b = function () { return ; }; + var b = () => ; var c = (x); - var d = function (x, y) { return ; }; - var e = function (x, y) { return ; }; + var d = (x, y) => ; + var e = (x, y) => ; })(ce_nEst_pas_une_arrow_function || (ce_nEst_pas_une_arrow_function = {})); var okay; (function (okay) { - var a = function () { }; - var b = function () { }; - var c = function (x) { }; - var d = function (x, y) { }; - var e = function (x, y) { }; + var a = () => { }; + var b = () => { }; + var c = (x) => { }; + var d = (x, y) => { }; + var e = (x, y) => { }; })(okay || (okay = {})); diff --git a/tests/baselines/reference/asOperator3.js b/tests/baselines/reference/asOperator3.js index 9eac43c07e479..bc1fed43548b9 100644 --- a/tests/baselines/reference/asOperator3.js +++ b/tests/baselines/reference/asOperator3.js @@ -13,15 +13,11 @@ var g = tag `Hello ${123} World` as string; var h = tag `Hello` as string; //// [asOperator3.js] -var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; -}; -var a = "".concat(123 + 456); -var b = "leading ".concat(123 + 456); -var c = "".concat(123 + 456, " trailing"); -var d = "Hello ".concat(123, " World"); -var e = "Hello"; -var f = 1 + "".concat(1, " end of string"); -var g = tag(__makeTemplateObject(["Hello ", " World"], ["Hello ", " World"]), 123); -var h = tag(__makeTemplateObject(["Hello"], ["Hello"])); +var a = `${123 + 456}`; +var b = `leading ${123 + 456}`; +var c = `${123 + 456} trailing`; +var d = `Hello ${123} World`; +var e = `Hello`; +var f = 1 + `${1} end of string`; +var g = tag `Hello ${123} World`; +var h = tag `Hello`; diff --git a/tests/baselines/reference/asOperator4.js b/tests/baselines/reference/asOperator4.js index 6d8b39830440b..9a1b08235cb5b 100644 --- a/tests/baselines/reference/asOperator4.js +++ b/tests/baselines/reference/asOperator4.js @@ -19,7 +19,7 @@ function foo() { } //// [bar.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var foo_1 = require("./foo"); +const 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 1de18b75954e1..0ef77ba3cf5ce 100644 --- a/tests/baselines/reference/asOperatorASI.js +++ b/tests/baselines/reference/asOperatorASI.js @@ -14,18 +14,11 @@ as(Foo); // should emit //// [asOperatorASI.js] -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() { - } - return Foo; -}()); +class Foo { +} // Example 1 var x = 10; -as(__makeTemplateObject(["Hello world"], ["Hello world"])); // should not error +as `Hello world`; // should not error // Example 2 var y = 20; as(Foo); // should emit diff --git a/tests/baselines/reference/asOperatorContextualType.js b/tests/baselines/reference/asOperatorContextualType.js index 0d55b4dbd3fb6..e4198d64229b6 100644 --- a/tests/baselines/reference/asOperatorContextualType.js +++ b/tests/baselines/reference/asOperatorContextualType.js @@ -6,4 +6,4 @@ var x = (v => v) as (x: number) => string; //// [asOperatorContextualType.js] // should error -var x = (function (v) { return v; }); +var x = (v => v); diff --git a/tests/baselines/reference/asiAbstract.js b/tests/baselines/reference/asiAbstract.js index 55a6f8b175b44..0182fa37a9fc7 100644 --- a/tests/baselines/reference/asiAbstract.js +++ b/tests/baselines/reference/asiAbstract.js @@ -19,20 +19,11 @@ class C3 { //// [asiAbstract.js] abstract; -var NonAbstractClass = /** @class */ (function () { - function NonAbstractClass() { +class NonAbstractClass { +} +class C2 { + nonAbstractFunction() { } - return NonAbstractClass; -}()); -var C2 = /** @class */ (function () { - function C2() { - } - C2.prototype.nonAbstractFunction = function () { - }; - return C2; -}()); -var C3 = /** @class */ (function () { - function C3() { - } - return C3; -}()); +} +class C3 { +} diff --git a/tests/baselines/reference/asiInES6Classes.js b/tests/baselines/reference/asiInES6Classes.js index c0a9938449112..9bfbc5ef80c05 100644 --- a/tests/baselines/reference/asiInES6Classes.js +++ b/tests/baselines/reference/asiInES6Classes.js @@ -25,14 +25,13 @@ class Foo { //// [asiInES6Classes.js] -var Foo = /** @class */ (function () { - function Foo() { +class Foo { + constructor() { this.defaults = { done: false }; } - Foo.prototype.bar = function () { + bar() { return 3; - }; - return Foo; -}()); + } +} diff --git a/tests/baselines/reference/asiPreventsParsingAsNamespace04.js b/tests/baselines/reference/asiPreventsParsingAsNamespace04.js index 027b839404df2..588b439e536a4 100644 --- a/tests/baselines/reference/asiPreventsParsingAsNamespace04.js +++ b/tests/baselines/reference/asiPreventsParsingAsNamespace04.js @@ -5,5 +5,5 @@ let module = 10; module in {} //// [asiPreventsParsingAsNamespace04.js] -var module = 10; +let module = 10; module in {}; diff --git a/tests/baselines/reference/asiPreventsParsingAsNamespace05.js b/tests/baselines/reference/asiPreventsParsingAsNamespace05.js index 0abf89d14d1c7..a8901cdac3199 100644 --- a/tests/baselines/reference/asiPreventsParsingAsNamespace05.js +++ b/tests/baselines/reference/asiPreventsParsingAsNamespace05.js @@ -12,7 +12,7 @@ a.b.c } //// [asiPreventsParsingAsNamespace05.js] -var namespace = 10; +let namespace = 10; var a; (function (a) { var b; diff --git a/tests/baselines/reference/asiPublicPrivateProtected.js b/tests/baselines/reference/asiPublicPrivateProtected.js index 4f9ba76fc8e67..17806e03bd62b 100644 --- a/tests/baselines/reference/asiPublicPrivateProtected.js +++ b/tests/baselines/reference/asiPublicPrivateProtected.js @@ -44,52 +44,31 @@ class ClassWithThreeMembers { //// [asiPublicPrivateProtected.js] public; -var NonPublicClass = /** @class */ (function () { - function NonPublicClass() { +class NonPublicClass { + s() { } - NonPublicClass.prototype.s = function () { - }; - return NonPublicClass; -}()); -var NonPublicClass2 = /** @class */ (function () { - function NonPublicClass2() { +} +class NonPublicClass2 { + nonPublicFunction() { } - NonPublicClass2.prototype.nonPublicFunction = function () { - }; - return NonPublicClass2; -}()); +} private; -var NonPrivateClass = /** @class */ (function () { - function NonPrivateClass() { +class NonPrivateClass { + s() { } - NonPrivateClass.prototype.s = function () { - }; - return NonPrivateClass; -}()); -var NonPrivateClass2 = /** @class */ (function () { - function NonPrivateClass2() { +} +class NonPrivateClass2 { + nonPrivateFunction() { } - NonPrivateClass2.prototype.nonPrivateFunction = function () { - }; - return NonPrivateClass2; -}()); +} protected; -var NonProtectedClass = /** @class */ (function () { - function NonProtectedClass() { +class NonProtectedClass { + s() { } - NonProtectedClass.prototype.s = function () { - }; - return NonProtectedClass; -}()); -var NonProtectedClass2 = /** @class */ (function () { - function NonProtectedClass2() { +} +class NonProtectedClass2 { + nonProtectedFunction() { } - NonProtectedClass2.prototype.nonProtectedFunction = function () { - }; - return NonProtectedClass2; -}()); -var ClassWithThreeMembers = /** @class */ (function () { - function ClassWithThreeMembers() { - } - return ClassWithThreeMembers; -}()); +} +class ClassWithThreeMembers { +} diff --git a/tests/baselines/reference/assertInWrapSomeTypeParameter.js b/tests/baselines/reference/assertInWrapSomeTypeParameter.js index e2428d6a5bbe6..81bd47164b0bc 100644 --- a/tests/baselines/reference/assertInWrapSomeTypeParameter.js +++ b/tests/baselines/reference/assertInWrapSomeTypeParameter.js @@ -8,11 +8,8 @@ class C> { } //// [assertInWrapSomeTypeParameter.js] -var C = /** @class */ (function () { - function C() { - } - C.prototype.foo = function (x) { +class C { + foo(x) { return null; - }; - return C; -}()); + } +} diff --git a/tests/baselines/reference/assertionFunctionWildcardImport1.js b/tests/baselines/reference/assertionFunctionWildcardImport1.js index 7061098dba010..11f0c6c93f61f 100644 --- a/tests/baselines/reference/assertionFunctionWildcardImport1.js +++ b/tests/baselines/reference/assertionFunctionWildcardImport1.js @@ -68,7 +68,7 @@ var __importStar = (this && this.__importStar) || (function () { })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.Debug = void 0; -var Debug = __importStar(require("../debug")); +const Debug = __importStar(require("../debug")); exports.Debug = Debug; //// [foo.js] "use strict"; @@ -106,8 +106,8 @@ var __importStar = (this && this.__importStar) || (function () { }; })(); Object.defineProperty(exports, "__esModule", { value: true }); -var ts = __importStar(require("./_namespaces/ts")); -var ts_1 = require("./_namespaces/ts"); +const ts = __importStar(require("./_namespaces/ts")); +const ts_1 = require("./_namespaces/ts"); ts.Debug.assert(true); ts_1.Debug.assert(true); //// [ts.js] @@ -164,7 +164,7 @@ var __importStar = (this && this.__importStar) || (function () { }; })(); Object.defineProperty(exports, "__esModule", { value: true }); -var ts = __importStar(require("./_namespaces/ts")); -var ts_1 = require("./_namespaces/ts"); +const ts = __importStar(require("./_namespaces/ts")); +const ts_1 = require("./_namespaces/ts"); ts.Debug.assert(true); ts_1.Debug.assert(true); diff --git a/tests/baselines/reference/assertionFunctionWildcardImport2.js b/tests/baselines/reference/assertionFunctionWildcardImport2.js index 21014a3b2ce1f..25edf1e2fe676 100644 --- a/tests/baselines/reference/assertionFunctionWildcardImport2.js +++ b/tests/baselines/reference/assertionFunctionWildcardImport2.js @@ -65,7 +65,7 @@ var __importStar = (this && this.__importStar) || (function () { }; })(); Object.defineProperty(exports, "__esModule", { value: true }); -var asserts = __importStar(require("./asserts")); +const asserts = __importStar(require("./asserts")); function test(obj) { asserts.isNonNullable(obj); obj.trim(); diff --git a/tests/baselines/reference/assertionFunctionsCanNarrowByDiscriminant.js b/tests/baselines/reference/assertionFunctionsCanNarrowByDiscriminant.js index 2cacd1f1534de..4979a83b3590b 100644 --- a/tests/baselines/reference/assertionFunctionsCanNarrowByDiscriminant.js +++ b/tests/baselines/reference/assertionFunctionsCanNarrowByDiscriminant.js @@ -28,9 +28,9 @@ animalOrUndef.canMeow; // since is cat, should not be an error //// [assertionFunctionsCanNarrowByDiscriminant.js] "use strict"; -var animal = { type: 'cat', canMeow: true }; +const animal = { type: 'cat', canMeow: true }; assertEqual(animal.type, 'cat'); animal.canMeow; // since is cat, should not be an error -var animalOrUndef = { type: 'cat', canMeow: true }; +const animalOrUndef = { type: 'cat', canMeow: true }; assertEqual(animalOrUndef === null || animalOrUndef === void 0 ? void 0 : animalOrUndef.type, 'cat'); animalOrUndef.canMeow; // since is cat, should not be an error diff --git a/tests/baselines/reference/assertionTypePredicates1.js b/tests/baselines/reference/assertionTypePredicates1.js index dd591b729358c..af916d889abfb 100644 --- a/tests/baselines/reference/assertionTypePredicates1.js +++ b/tests/baselines/reference/assertionTypePredicates1.js @@ -262,22 +262,7 @@ function testFunctionThisParameter2( //// [assertionTypePredicates1.js] "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var assert = function (value) { }; +const assert = value => { }; function f01(x) { if (!!true) { assert(typeof x === "string"); @@ -357,32 +342,30 @@ function f10(x) { x; // Unreachable } } -var Test = /** @class */ (function () { - function Test() { - } - Test.prototype.assert = function (value) { +class Test { + assert(value) { if (value) return; throw new Error(); - }; - Test.prototype.isTest2 = function () { + } + isTest2() { return this instanceof Test2; - }; - Test.prototype.assertIsTest2 = function () { + } + assertIsTest2() { if (this instanceof Test2) return; throw new Error(); - }; - Test.prototype.assertThis = function () { + } + assertThis() { if (!this) return; throw new Error(); - }; - Test.prototype.bar = function () { + } + bar() { this.assertThis(); this; - }; - Test.prototype.foo = function (x) { + } + foo(x) { this.assert(typeof x === "string"); x.length; if (this.isTest2()) { @@ -390,40 +373,30 @@ var Test = /** @class */ (function () { } this.assertIsTest2(); this.z; - }; - Test.prototype.baz = function (x) { + } + baz(x) { this.assert(false); x; // Unreachable - }; - return Test; -}()); -var Test2 = /** @class */ (function (_super) { - __extends(Test2, _super); - function Test2() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.z = 0; - return _this; - } - return Test2; -}(Test)); -var Derived = /** @class */ (function (_super) { - __extends(Derived, _super); - function Derived() { - return _super !== null && _super.apply(this, arguments) || this; - } - Derived.prototype.foo = function (x) { - _super.prototype.assert.call(this, typeof x === "string"); + } +} +class Test2 extends Test { + constructor() { + super(...arguments); + this.z = 0; + } +} +class Derived extends Test { + foo(x) { + super.assert(typeof x === "string"); x.length; - }; - Derived.prototype.baz = function (x) { - _super.prototype.assert.call(this, false); + } + baz(x) { + super.assert(false); x; // Unreachable - }; - return Derived; -}(Test)); + } +} function f11(items) { - for (var _i = 0, items_1 = items; _i < items_1.length; _i++) { - var item = items_1[_i]; + for (let item of items) { if (item.isTest2()) { item.z; } @@ -432,53 +405,45 @@ function f11(items) { } } function f20(x) { - var assert = function (value) { }; + const assert = (value) => { }; assert(typeof x === "string"); // Error - var a = [assert]; + const a = [assert]; a[0](typeof x === "string"); // Error - var t1 = new Test(); + const t1 = new Test(); t1.assert(typeof x === "string"); // Error - var t2 = new Test(); + const 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]; + for (let thing of things) { thing.isGood(); thing.good; } } -var TestPropertyDeclaration1 = /** @class */ (function () { - function TestPropertyDeclaration1() { - this.assert = function (value) { }; +class TestPropertyDeclaration1 { + constructor() { + this.assert = (value) => { }; } - TestPropertyDeclaration1.prototype.other = function (x) { + other(x) { this.assert(x); // error x; - }; - return TestPropertyDeclaration1; -}()); -var TestPropertyDeclaration2 = /** @class */ (function () { - function TestPropertyDeclaration2() { - this.assert = function (value) { }; - } - TestPropertyDeclaration2.prototype.other = function (x) { + } +} +class TestPropertyDeclaration2 { + constructor() { + this.assert = (value) => { }; + } + other(x) { this.assert(x); // ok x; - }; - return TestPropertyDeclaration2; -}()); -var ChildInheritedPropertyDeclaration = /** @class */ (function (_super) { - __extends(ChildInheritedPropertyDeclaration, _super); - function ChildInheritedPropertyDeclaration() { - return _super !== null && _super.apply(this, arguments) || this; - } - ChildInheritedPropertyDeclaration.prototype.other = function (x) { + } +} +class ChildInheritedPropertyDeclaration extends ParentInheritedPropertyDeclaration { + other(x) { this.assert(x); // ok x; - }; - return ChildInheritedPropertyDeclaration; -}(ParentInheritedPropertyDeclaration)); + } +} function testPropertySignature(x, y) { x.assert(y); // ok x; diff --git a/tests/baselines/reference/assertionTypePredicates2.js b/tests/baselines/reference/assertionTypePredicates2.js index ada62f93812d4..5d370c8f5d9d2 100644 --- a/tests/baselines/reference/assertionTypePredicates2.js +++ b/tests/baselines/reference/assertionTypePredicates2.js @@ -26,12 +26,9 @@ export const main = () => { //// [assertionTypePredicates2.js] -"use strict"; /** * @typedef {{ x: number }} A */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.main = void 0; /** * @typedef { A & { y: number } } B */ @@ -39,14 +36,13 @@ exports.main = void 0; * @param {A} a * @returns { asserts a is B } */ -var foo = function (a) { +const foo = (a) => { if ( /** @type { B } */(a).y !== 0) throw TypeError(); return undefined; }; -var main = function () { +export const main = () => { /** @type { A } */ - var a = { x: 1 }; + const a = { x: 1 }; foo(a); }; -exports.main = main; diff --git a/tests/baselines/reference/assignAnyToEveryType.js b/tests/baselines/reference/assignAnyToEveryType.js index 7d68f62e3d705..d40d7f369a430 100644 --- a/tests/baselines/reference/assignAnyToEveryType.js +++ b/tests/baselines/reference/assignAnyToEveryType.js @@ -65,11 +65,8 @@ var E; var g = x; var g2 = E.A; g2 = x; -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { +} var h = x; var i = x; var j = x; diff --git a/tests/baselines/reference/assignEveryTypeToAny.js b/tests/baselines/reference/assignEveryTypeToAny.js index 0c7e4b20f59d4..70ee1192da101 100644 --- a/tests/baselines/reference/assignEveryTypeToAny.js +++ b/tests/baselines/reference/assignEveryTypeToAny.js @@ -84,17 +84,14 @@ var f = E.A; x = f; var g; x = g; -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { +} var h; x = h; var i; x = i; -x = { f: function () { return 1; } }; -x = { f: function (x) { return x; } }; +x = { f() { return 1; } }; +x = { f(x) { return x; } }; function j(a) { x = a; } diff --git a/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.js b/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.js index 9671f8d71852b..4f55a6f15e912 100644 --- a/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.js +++ b/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.js @@ -13,5 +13,5 @@ fn(function (a, b) { return true; }) //// [assignLambdaToNominalSubtypeOfFunction.js] function fn(cb) { } -fn(function (a, b) { return true; }); +fn((a, b) => true); fn(function (a, b) { return true; }); diff --git a/tests/baselines/reference/assignSharedArrayBufferToArrayBuffer.errors.txt b/tests/baselines/reference/assignSharedArrayBufferToArrayBuffer(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/assignSharedArrayBufferToArrayBuffer.errors.txt rename to tests/baselines/reference/assignSharedArrayBufferToArrayBuffer(target=es2015).errors.txt diff --git a/tests/baselines/reference/assignSharedArrayBufferToArrayBuffer.js b/tests/baselines/reference/assignSharedArrayBufferToArrayBuffer(target=es2015).js similarity index 100% rename from tests/baselines/reference/assignSharedArrayBufferToArrayBuffer.js rename to tests/baselines/reference/assignSharedArrayBufferToArrayBuffer(target=es2015).js diff --git a/tests/baselines/reference/assignSharedArrayBufferToArrayBuffer.symbols b/tests/baselines/reference/assignSharedArrayBufferToArrayBuffer(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/assignSharedArrayBufferToArrayBuffer.symbols rename to tests/baselines/reference/assignSharedArrayBufferToArrayBuffer(target=es2015).symbols diff --git a/tests/baselines/reference/assignSharedArrayBufferToArrayBuffer.types b/tests/baselines/reference/assignSharedArrayBufferToArrayBuffer(target=es2015).types similarity index 100% rename from tests/baselines/reference/assignSharedArrayBufferToArrayBuffer.types rename to tests/baselines/reference/assignSharedArrayBufferToArrayBuffer(target=es2015).types diff --git a/tests/baselines/reference/assignSharedArrayBufferToArrayBuffer(target=es5).errors.txt b/tests/baselines/reference/assignSharedArrayBufferToArrayBuffer(target=es5).errors.txt new file mode 100644 index 0000000000000..cc22119ec5064 --- /dev/null +++ b/tests/baselines/reference/assignSharedArrayBufferToArrayBuffer(target=es5).errors.txt @@ -0,0 +1,11 @@ +assignSharedArrayBufferToArrayBuffer.ts(1,5): error TS2322: Type 'SharedArrayBuffer' is not assignable to type 'ArrayBuffer'. + Types of property '[Symbol.toStringTag]' are incompatible. + Type '"SharedArrayBuffer"' is not assignable to type '"ArrayBuffer"'. + + +==== assignSharedArrayBufferToArrayBuffer.ts (1 errors) ==== + var foo: ArrayBuffer = new SharedArrayBuffer(1024); // should error + ~~~ +!!! error TS2322: Type 'SharedArrayBuffer' is not assignable to type 'ArrayBuffer'. +!!! error TS2322: Types of property '[Symbol.toStringTag]' are incompatible. +!!! error TS2322: Type '"SharedArrayBuffer"' is not assignable to type '"ArrayBuffer"'. \ No newline at end of file diff --git a/tests/baselines/reference/assignSharedArrayBufferToArrayBuffer(target=es5).js b/tests/baselines/reference/assignSharedArrayBufferToArrayBuffer(target=es5).js new file mode 100644 index 0000000000000..f7642aae6275d --- /dev/null +++ b/tests/baselines/reference/assignSharedArrayBufferToArrayBuffer(target=es5).js @@ -0,0 +1,7 @@ +//// [tests/cases/conformance/es2017/assignSharedArrayBufferToArrayBuffer.ts] //// + +//// [assignSharedArrayBufferToArrayBuffer.ts] +var foo: ArrayBuffer = new SharedArrayBuffer(1024); // should error + +//// [assignSharedArrayBufferToArrayBuffer.js] +var foo = new SharedArrayBuffer(1024); // should error diff --git a/tests/baselines/reference/assignSharedArrayBufferToArrayBuffer(target=es5).symbols b/tests/baselines/reference/assignSharedArrayBufferToArrayBuffer(target=es5).symbols new file mode 100644 index 0000000000000..43cfb5a1787b0 --- /dev/null +++ b/tests/baselines/reference/assignSharedArrayBufferToArrayBuffer(target=es5).symbols @@ -0,0 +1,8 @@ +//// [tests/cases/conformance/es2017/assignSharedArrayBufferToArrayBuffer.ts] //// + +=== assignSharedArrayBufferToArrayBuffer.ts === +var foo: ArrayBuffer = new SharedArrayBuffer(1024); // should error +>foo : Symbol(foo, Decl(assignSharedArrayBufferToArrayBuffer.ts, 0, 3)) +>ArrayBuffer : Symbol(ArrayBuffer, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>SharedArrayBuffer : Symbol(SharedArrayBuffer, Decl(lib.es2017.sharedmemory.d.ts, --, --), Decl(lib.es2017.sharedmemory.d.ts, --, --)) + diff --git a/tests/baselines/reference/assignSharedArrayBufferToArrayBuffer(target=es5).types b/tests/baselines/reference/assignSharedArrayBufferToArrayBuffer(target=es5).types new file mode 100644 index 0000000000000..1f6b881dfb452 --- /dev/null +++ b/tests/baselines/reference/assignSharedArrayBufferToArrayBuffer(target=es5).types @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/es2017/assignSharedArrayBufferToArrayBuffer.ts] //// + +=== assignSharedArrayBufferToArrayBuffer.ts === +var foo: ArrayBuffer = new SharedArrayBuffer(1024); // should error +>foo : ArrayBuffer +> : ^^^^^^^^^^^ +>new SharedArrayBuffer(1024) : SharedArrayBuffer +> : ^^^^^^^^^^^^^^^^^ +>SharedArrayBuffer : SharedArrayBufferConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>1024 : 1024 +> : ^^^^ + diff --git a/tests/baselines/reference/assignToExistingClass.js b/tests/baselines/reference/assignToExistingClass.js index 69b61d3eff57c..47ae3419585de 100644 --- a/tests/baselines/reference/assignToExistingClass.js +++ b/tests/baselines/reference/assignToExistingClass.js @@ -20,19 +20,13 @@ namespace Test { //// [assignToExistingClass.js] var Test; (function (Test) { - var Mocked = /** @class */ (function () { - function Mocked() { - } - return Mocked; - }()); - var Tester = /** @class */ (function () { - function Tester() { - } - Tester.prototype.willThrowError = function () { + class Mocked { + } + class Tester { + willThrowError() { Mocked = Mocked || function () { return { myProp: "test" }; }; - }; - return Tester; - }()); + } + } })(Test || (Test = {})); diff --git a/tests/baselines/reference/assignToObjectTypeWithPrototypeProperty.js b/tests/baselines/reference/assignToObjectTypeWithPrototypeProperty.js index a43fc66615cfc..227df70ceb84f 100644 --- a/tests/baselines/reference/assignToObjectTypeWithPrototypeProperty.js +++ b/tests/baselines/reference/assignToObjectTypeWithPrototypeProperty.js @@ -6,10 +6,7 @@ var p: XEvent = XEvent.prototype; var x: {prototype: XEvent} = XEvent; //// [assignToObjectTypeWithPrototypeProperty.js] -var XEvent = /** @class */ (function () { - function XEvent() { - } - return XEvent; -}()); +class XEvent { +} var p = XEvent.prototype; var x = XEvent; diff --git a/tests/baselines/reference/assigningFunctionToTupleIssuesError.js b/tests/baselines/reference/assigningFunctionToTupleIssuesError.js index f5502a8feaad0..6308be96efea6 100644 --- a/tests/baselines/reference/assigningFunctionToTupleIssuesError.js +++ b/tests/baselines/reference/assigningFunctionToTupleIssuesError.js @@ -5,4 +5,4 @@ declare let a: () => void; let b: [string] = a; //// [assigningFunctionToTupleIssuesError.js] -var b = a; +let b = a; diff --git a/tests/baselines/reference/assignmentCompatBug2.js b/tests/baselines/reference/assignmentCompatBug2.js index 8eafbe2b11059..456cf290f5256 100644 --- a/tests/baselines/reference/assignmentCompatBug2.js +++ b/tests/baselines/reference/assignmentCompatBug2.js @@ -46,28 +46,28 @@ b2 = { a: 0 }; // error b2 = { b: 0, a: 0 }; var b3; b3 = { - f: function (n) { return 0; }, - g: function (s) { return 0; }, + f: (n) => { return 0; }, + g: (s) => { return 0; }, m: 0, }; // ok b3 = { - f: function (n) { return 0; }, - g: function (s) { return 0; }, + f: (n) => { return 0; }, + g: (s) => { return 0; }, }; // error b3 = { - f: function (n) { return 0; }, + f: (n) => { return 0; }, m: 0, }; // error b3 = { - f: function (n) { return 0; }, - g: function (s) { return 0; }, + f: (n) => { return 0; }, + g: (s) => { return 0; }, m: 0, n: 0, - k: function (a) { return null; }, + k: (a) => { return null; }, }; // ok b3 = { - f: function (n) { return 0; }, - g: function (s) { return 0; }, + f: (n) => { return 0; }, + g: (s) => { return 0; }, n: 0, - k: function (a) { return null; }, + k: (a) => { return null; }, }; // error diff --git a/tests/baselines/reference/assignmentCompatBug3.js b/tests/baselines/reference/assignmentCompatBug3.js index b0497db1715ff..a0564b026de76 100644 --- a/tests/baselines/reference/assignmentCompatBug3.js +++ b/tests/baselines/reference/assignmentCompatBug3.js @@ -39,18 +39,11 @@ function makePoint(x, y) { } }; } -var C = /** @class */ (function () { - function C() { +class C { + get x() { + return 0; } - Object.defineProperty(C.prototype, "x", { - get: function () { - return 0; - }, - enumerable: false, - configurable: true - }); - return C; -}()); +} function foo(test) { } var x; var y; diff --git a/tests/baselines/reference/assignmentCompatBug5.js b/tests/baselines/reference/assignmentCompatBug5.js index 3206dcdc9da5b..da21fd6b4cb50 100644 --- a/tests/baselines/reference/assignmentCompatBug5.js +++ b/tests/baselines/reference/assignmentCompatBug5.js @@ -20,5 +20,5 @@ function foo2(x) { } foo2(["s", "t"]); function foo3(x) { } ; -foo3(function (s) { }); -foo3(function (n) { return; }); +foo3((s) => { }); +foo3((n) => { return; }); diff --git a/tests/baselines/reference/assignmentCompatInterfaceWithStringIndexSignature.js b/tests/baselines/reference/assignmentCompatInterfaceWithStringIndexSignature.js index a03a4d0efb07c..1c9dde49802e8 100644 --- a/tests/baselines/reference/assignmentCompatInterfaceWithStringIndexSignature.js +++ b/tests/baselines/reference/assignmentCompatInterfaceWithStringIndexSignature.js @@ -19,11 +19,8 @@ Biz(new Foo()); //// [assignmentCompatInterfaceWithStringIndexSignature.js] -var Foo = /** @class */ (function () { - function Foo() { - } - Foo.prototype.Boz = function () { }; - return Foo; -}()); +class Foo { + Boz() { } +} function Biz(map) { } Biz(new Foo()); diff --git a/tests/baselines/reference/assignmentCompatOnNew.js b/tests/baselines/reference/assignmentCompatOnNew.js index f5607ae2eea0d..9d67c7f066007 100644 --- a/tests/baselines/reference/assignmentCompatOnNew.js +++ b/tests/baselines/reference/assignmentCompatOnNew.js @@ -9,11 +9,8 @@ bar(Foo); // Error, but should be allowed //// [assignmentCompatOnNew.js] -var Foo = /** @class */ (function () { - function Foo() { - } - return Foo; -}()); +class Foo { +} ; function bar(x) { } bar(Foo); // Error, but should be allowed diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures.js b/tests/baselines/reference/assignmentCompatWithCallSignatures.js index c22e0d3b838af..6a2112cb85e30 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures.js @@ -53,18 +53,18 @@ t = s; t = a2; a = s; a = a2; -t = function (x) { return 1; }; -t = function () { return 1; }; +t = (x) => 1; +t = () => 1; t = function (x) { return ''; }; -a = function (x) { return 1; }; -a = function () { return 1; }; +a = (x) => 1; +a = () => 1; a = function (x) { return ''; }; // these are errors t = s2; t = a3; -t = function (x) { return 1; }; +t = (x) => 1; t = function (x) { return ''; }; a = s2; a = a3; -a = function (x) { return 1; }; +a = (x) => 1; a = function (x) { return ''; }; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures2.js b/tests/baselines/reference/assignmentCompatWithCallSignatures2.js index 1528b9305f2a7..c739091496769 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures2.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures2.js @@ -60,24 +60,24 @@ t = s; t = a2; a = s; a = a2; -t = { f: function () { return 1; } }; -t = { f: function (x) { return 1; } }; +t = { f: () => 1 }; +t = { f: (x) => 1 }; t = { f: function f() { return 1; } }; -t = { f: function (x) { return ''; } }; -a = { f: function () { return 1; } }; -a = { f: function (x) { return 1; } }; +t = { f(x) { return ''; } }; +a = { f: () => 1 }; +a = { f: (x) => 1 }; a = { f: function (x) { return ''; } }; // errors -t = function () { return 1; }; +t = () => 1; t = function (x) { return ''; }; -a = function () { return 1; }; +a = () => 1; a = function (x) { return ''; }; // these are errors t = s2; t = a3; -t = function (x) { return 1; }; +t = (x) => 1; t = function (x) { return ''; }; a = s2; a = a3; -a = function (x) { return 1; }; +a = (x) => 1; a = function (x) { return ''; }; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures3.js b/tests/baselines/reference/assignmentCompatWithCallSignatures3.js index cdc9bdebef257..d01798e6bdfa1 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures3.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures3.js @@ -103,47 +103,14 @@ b18 = a18; // ok //// [assignmentCompatWithCallSignatures3.js] // these are all permitted with the current rules, since we do not do contextual signature instantiation -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var Base = /** @class */ (function () { - function Base() { - } - return Base; -}()); -var Derived = /** @class */ (function (_super) { - __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() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Derived2; -}(Derived)); -var OtherDerived = /** @class */ (function (_super) { - __extends(OtherDerived, _super); - function OtherDerived() { - return _super !== null && _super.apply(this, arguments) || this; - } - return OtherDerived; -}(Base)); +class Base { +} +class Derived extends Base { +} +class Derived2 extends Derived { +} +class OtherDerived extends Base { +} a = b; // ok b = a; // ok a2 = b2; // ok diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures4.js b/tests/baselines/reference/assignmentCompatWithCallSignatures4.js index 7be077910bbdb..6df08dde1ec83 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures4.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures4.js @@ -102,50 +102,17 @@ namespace Errors { //// [assignmentCompatWithCallSignatures4.js] // These are mostly permitted with the current loose rules. All ok unless otherwise noted. -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); var Errors; (function (Errors) { - var Base = /** @class */ (function () { - function Base() { - } - return Base; - }()); - var Derived = /** @class */ (function (_super) { - __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() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Derived2; - }(Derived)); - var OtherDerived = /** @class */ (function (_super) { - __extends(OtherDerived, _super); - function OtherDerived() { - return _super !== null && _super.apply(this, arguments) || this; - } - return OtherDerived; - }(Base)); - var WithNonGenericSignaturesInBaseType; + class Base { + } + class Derived extends Base { + } + class Derived2 extends Derived { + } + class OtherDerived extends Base { + } + let WithNonGenericSignaturesInBaseType; (function (WithNonGenericSignaturesInBaseType) { a2 = b2; b2 = a2; @@ -168,7 +135,7 @@ var Errors; a17 = b17; b17 = a17; })(WithNonGenericSignaturesInBaseType || (WithNonGenericSignaturesInBaseType = {})); - var WithGenericSignaturesInBaseType; + let WithGenericSignaturesInBaseType; (function (WithGenericSignaturesInBaseType) { a2 = b2; b2 = a2; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures5.js b/tests/baselines/reference/assignmentCompatWithCallSignatures5.js index 458d0f9444d57..dafc3a58b0f19 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures5.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures5.js @@ -69,47 +69,14 @@ b18 = a18; // ok //// [assignmentCompatWithCallSignatures5.js] // checking assignment compat for function types. No errors in this file -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var Base = /** @class */ (function () { - function Base() { - } - return Base; -}()); -var Derived = /** @class */ (function (_super) { - __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() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Derived2; -}(Derived)); -var OtherDerived = /** @class */ (function (_super) { - __extends(OtherDerived, _super); - function OtherDerived() { - return _super !== null && _super.apply(this, arguments) || this; - } - return OtherDerived; -}(Base)); +class Base { +} +class Derived extends Base { +} +class Derived2 extends Derived { +} +class OtherDerived extends Base { +} a = b; // ok b = a; // ok a2 = b2; // ok diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures6.js b/tests/baselines/reference/assignmentCompatWithCallSignatures6.js index 07364b412fbbd..24ccd2559f9c2 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures6.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures6.js @@ -46,47 +46,14 @@ b16 = x.a16; //// [assignmentCompatWithCallSignatures6.js] // checking assignment compatibility relations for function types. All valid -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var Base = /** @class */ (function () { - function Base() { - } - return Base; -}()); -var Derived = /** @class */ (function (_super) { - __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() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Derived2; -}(Derived)); -var OtherDerived = /** @class */ (function (_super) { - __extends(OtherDerived, _super); - function OtherDerived() { - return _super !== null && _super.apply(this, arguments) || this; - } - return OtherDerived; -}(Base)); +class Base { +} +class Derived extends Base { +} +class Derived2 extends Derived { +} +class OtherDerived extends Base { +} x.a = b; b = x.a; x.a2 = b2; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignaturesWithOptionalParameters.js b/tests/baselines/reference/assignmentCompatWithCallSignaturesWithOptionalParameters.js index 21cabbf0bea02..c0170e2789f48 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignaturesWithOptionalParameters.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignaturesWithOptionalParameters.js @@ -73,48 +73,48 @@ declare 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 -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 = () => 1; // ok, same number of required params +a = (x) => 1; // ok, same number of required params +a = (x) => 1; // error, too many required params a = b.a; // ok a = b.a2; // ok a = b.a3; // error a = b.a4; // error a = b.a5; // ok a = b.a6; // error -a2 = function () { return 1; }; // ok, same number of required params -a2 = function (x) { return 1; }; // ok, same number of required params -a2 = function (x) { return 1; }; // ok, same number of params +a2 = () => 1; // ok, same number of required params +a2 = (x) => 1; // ok, same number of required params +a2 = (x) => 1; // ok, same number of params a2 = b.a; // ok a2 = b.a2; // ok a2 = b.a3; // ok, same number of params a2 = b.a4; // ok, excess params are optional in b.a3 a2 = b.a5; // ok a2 = b.a6; // error -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; }; // error, too many required params +a3 = () => 1; // ok, fewer required params +a3 = (x) => 1; // ok, fewer required params +a3 = (x) => 1; // ok, same number of required params +a3 = (x, y) => 1; // error, too many required params a3 = b.a; // ok a3 = b.a2; // ok a3 = b.a3; // ok a3 = b.a4; // ok a3 = b.a5; // ok a3 = b.a6; // error -a4 = function () { return 1; }; // ok, fewer required params -a4 = function (x, y) { return 1; }; // ok, fewer required params -a4 = function (x) { return 1; }; // ok, same number of required params -a4 = function (x, y) { return 1; }; // ok, same number of params +a4 = () => 1; // ok, fewer required params +a4 = (x, y) => 1; // ok, fewer required params +a4 = (x) => 1; // ok, same number of required params +a4 = (x, y) => 1; // ok, same number of params a4 = b.a; // ok a4 = b.a2; // ok a4 = b.a3; // ok a4 = b.a4; // ok a4 = b.a5; // ok a4 = b.a6; // ok, same number of params -a5 = function () { return 1; }; // ok, fewer required params -a5 = function (x, y) { return 1; }; // ok, fewer required params -a5 = function (x) { return 1; }; // ok, fewer params in lambda -a5 = function (x, y) { return 1; }; // ok, same number of params +a5 = () => 1; // ok, fewer required params +a5 = (x, y) => 1; // ok, fewer required params +a5 = (x) => 1; // ok, fewer params in lambda +a5 = (x, y) => 1; // ok, same number of params a5 = b.a; // ok a5 = b.a2; // ok a5 = b.a3; // ok, fewer params in b.a3 diff --git a/tests/baselines/reference/assignmentCompatWithCallSignaturesWithRestParameters.js b/tests/baselines/reference/assignmentCompatWithCallSignaturesWithRestParameters.js index 200540d6373e7..cfd3135696c11 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignaturesWithRestParameters.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignaturesWithRestParameters.js @@ -50,76 +50,34 @@ 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 = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - 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 -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 +a = () => 1; // ok, same number of required params +a = (...args) => 1; // ok, same number of required params +a = (...args) => 1; // error, type mismatch +a = (x) => 1; // ok, same number of required params +a = (x, y, z) => 1; // ok, same number of required params +a = (x) => 1; // ok, rest param corresponds to infinite number of params +a = (x) => 1; // error, incompatible type var a2; -a2 = function () { return 1; }; // ok, fewer required params -a2 = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - 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 = []; - 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 = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; - } - 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 +a2 = () => 1; // ok, fewer required params +a2 = (...args) => 1; // ok, fewer required params +a2 = (x) => 1; // ok, fewer required params +a2 = (x) => 1; // ok, same number of required params +a2 = (x, ...args) => 1; // ok, same number of required params +a2 = (x, ...args) => 1; // should be type mismatch error +a2 = (x, y) => 1; // ok, rest param corresponds to infinite number of params +a2 = (x, y) => 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 = []; - for (var _i = 1; _i < arguments.length; _i++) { - z[_i - 1] = arguments[_i]; - } - return 1; -}; // error -a3 = function (x, y, z) { return 1; }; // error +a3 = () => 1; // ok, fewer required params +a3 = (x) => 1; // ok, fewer required params +a3 = (x) => 1; // ok, same number of required params +a3 = (x, y) => 1; // ok, all present params match +a3 = (x, y, z) => 1; // error +a3 = (x, ...z) => 1; // error +a3 = (x, y, z) => 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 = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; - } - return 1; -}; // error, rest params have type mismatch +a4 = () => 1; // ok, fewer required params +a4 = (x, y) => 1; // error, type mismatch +a4 = (x) => 1; // ok, all present params match +a4 = (x, y) => 1; // error, second param has type mismatch +a4 = (x, y) => 1; // ok, same number of required params with matching types +a4 = (x, ...args) => 1; // error, rest params have type mismatch diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures.js index fc3f1032914b4..678f1ed9d1ca6 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures.js @@ -49,9 +49,9 @@ a = a2; // these are errors t = s2; t = a3; -t = function (x) { return 1; }; +t = (x) => 1; t = function (x) { return ''; }; a = s2; a = a3; -a = function (x) { return 1; }; +a = (x) => 1; a = function (x) { return ''; }; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures2.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures2.js index 137507b68a57b..dc3e4f903c766 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures2.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures2.js @@ -53,16 +53,16 @@ t = a2; a = s; a = a2; // errors -t = function () { return 1; }; +t = () => 1; t = function (x) { return ''; }; -a = function () { return 1; }; +a = () => 1; a = function (x) { return ''; }; // these are errors t = s2; t = a3; -t = function (x) { return 1; }; +t = (x) => 1; t = function (x) { return ''; }; a = s2; a = a3; -a = function (x) { return 1; }; +a = (x) => 1; a = function (x) { return ''; }; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js index 4e018ae363ac3..c9c3b4f0efaff 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js @@ -103,47 +103,14 @@ b18 = a18; // ok //// [assignmentCompatWithConstructSignatures3.js] // checking assignment compatibility relations for function types. All of these are valid. -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var Base = /** @class */ (function () { - function Base() { - } - return Base; -}()); -var Derived = /** @class */ (function (_super) { - __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() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Derived2; -}(Derived)); -var OtherDerived = /** @class */ (function (_super) { - __extends(OtherDerived, _super); - function OtherDerived() { - return _super !== null && _super.apply(this, arguments) || this; - } - return OtherDerived; -}(Base)); +class Base { +} +class Derived extends Base { +} +class Derived2 extends Derived { +} +class OtherDerived extends Base { +} a = b; // ok b = a; // ok a2 = b2; // ok diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js index 9e3b6c58fc9e3..e17d36e46a057 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js @@ -102,50 +102,17 @@ namespace Errors { //// [assignmentCompatWithConstructSignatures4.js] // checking assignment compatibility relations for function types. -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); var Errors; (function (Errors) { - var Base = /** @class */ (function () { - function Base() { - } - return Base; - }()); - var Derived = /** @class */ (function (_super) { - __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() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Derived2; - }(Derived)); - var OtherDerived = /** @class */ (function (_super) { - __extends(OtherDerived, _super); - function OtherDerived() { - return _super !== null && _super.apply(this, arguments) || this; - } - return OtherDerived; - }(Base)); - var WithNonGenericSignaturesInBaseType; + class Base { + } + class Derived extends Base { + } + class Derived2 extends Derived { + } + class OtherDerived extends Base { + } + let WithNonGenericSignaturesInBaseType; (function (WithNonGenericSignaturesInBaseType) { a2 = b2; // ok b2 = a2; // ok @@ -168,7 +135,7 @@ var Errors; a17 = b17; // error b17 = a17; // error })(WithNonGenericSignaturesInBaseType || (WithNonGenericSignaturesInBaseType = {})); - var WithGenericSignaturesInBaseType; + let WithGenericSignaturesInBaseType; (function (WithGenericSignaturesInBaseType) { a2 = b2; // ok b2 = a2; // ok diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js index 07460f736472f..cfe57b5c866bc 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js @@ -69,47 +69,14 @@ b18 = a18; // ok //// [assignmentCompatWithConstructSignatures5.js] // checking assignment compat for function types. All valid -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var Base = /** @class */ (function () { - function Base() { - } - return Base; -}()); -var Derived = /** @class */ (function (_super) { - __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() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Derived2; -}(Derived)); -var OtherDerived = /** @class */ (function (_super) { - __extends(OtherDerived, _super); - function OtherDerived() { - return _super !== null && _super.apply(this, arguments) || this; - } - return OtherDerived; -}(Base)); +class Base { +} +class Derived extends Base { +} +class Derived2 extends Derived { +} +class OtherDerived extends Base { +} a = b; // ok b = a; // ok a2 = b2; // ok diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js index d85d3e9b8f690..8c8ac42b8be07 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js @@ -46,47 +46,14 @@ b16 = x.a16; //// [assignmentCompatWithConstructSignatures6.js] // checking assignment compatibility relations for function types. All valid. -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var Base = /** @class */ (function () { - function Base() { - } - return Base; -}()); -var Derived = /** @class */ (function (_super) { - __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() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Derived2; -}(Derived)); -var OtherDerived = /** @class */ (function (_super) { - __extends(OtherDerived, _super); - function OtherDerived() { - return _super !== null && _super.apply(this, arguments) || this; - } - return OtherDerived; -}(Base)); +class Base { +} +class Derived extends Base { +} +class Derived2 extends Derived { +} +class OtherDerived extends Base { +} x.a = b; b = x.a; x.a2 = b2; diff --git a/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.js b/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.js index 5d9d2a9f8bea9..01d9214511c83 100644 --- a/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.js +++ b/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.js @@ -269,7 +269,7 @@ var Example5; // https://github.com/Microsoft/TypeScript/issues/14865 var GH14865; (function (GH14865) { - var a = { type: "A", data: "whatevs" }; + const a = { type: "A", data: "whatevs" }; a.type; // "A" | "B" b.type; // "A" | "B" b = a; // should be assignable @@ -293,8 +293,8 @@ var GH12052; return "linear"; } } - var bad = { type: getAxisType() }; - var good = { type: undefined }; + const bad = { type: getAxisType() }; + const good = { type: undefined }; good.type = getAxisType(); })(GH12052 || (GH12052 = {})); // https://github.com/Microsoft/TypeScript/issues/18421 @@ -311,14 +311,14 @@ var GH15907; (function (GH15907) { function dispatchAction(action) { } - var active = true; + const 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 = { + const obj2 = { type: obj1.type }; } @@ -326,22 +326,22 @@ var GH20889; // https://github.com/microsoft/TypeScript/issues/39357 var GH39357; (function (GH39357) { - var a = b === "a" || b === "b" ? [b, 1] : ["c", ""]; + const a = b === "a" || b === "b" ? [b, 1] : ["c", ""]; })(GH39357 || (GH39357 = {})); // https://github.com/microsoft/TypeScript/issues/58603 var GH58603; (function (GH58603) { - var MyEnum; + let MyEnum; (function (MyEnum) { MyEnum[MyEnum["A"] = 1] = "A"; MyEnum[MyEnum["B"] = 2] = "B"; })(MyEnum || (MyEnum = {})); function something(a) { } function indirect(kind, id) { - something({ kind: kind, id: id }); + something({ kind, id }); } function test(obj) { - var x1 = obj; - var x2 = { kind: obj.kind, value: obj.value }; + let x1 = obj; + let x2 = { kind: obj.kind, value: obj.value }; } })(GH58603 || (GH58603 = {})); diff --git a/tests/baselines/reference/assignmentCompatWithEnumIndexer.js b/tests/baselines/reference/assignmentCompatWithEnumIndexer.js index cdd80c8bcfced..eeb071a8ef494 100644 --- a/tests/baselines/reference/assignmentCompatWithEnumIndexer.js +++ b/tests/baselines/reference/assignmentCompatWithEnumIndexer.js @@ -13,4 +13,4 @@ var E; (function (E) { E[E["A"] = 0] = "A"; })(E || (E = {})); -var foo = {}; +let foo = {}; diff --git a/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.js b/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.js index 722711c2c93ab..942fe3967283e 100644 --- a/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.js +++ b/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.js @@ -136,45 +136,37 @@ namespace GenericSignaturesValid { // call signatures in derived types must have the same or fewer optional parameters as the target for assignment var ClassTypeParam; (function (ClassTypeParam) { - var Base = /** @class */ (function () { - function Base() { - var _this = this; - this.init = function () { - _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 - _this.a5 = function (x, y) { return null; }; // ok, same number of params + class Base { + constructor() { + this.init = () => { + this.a = () => null; // ok, same T of required params + this.a = (x) => null; // ok, same T of required params + this.a = (x) => null; // error, too many required params + this.a2 = () => null; // ok, same T of required params + this.a2 = (x) => null; // ok, same T of required params + this.a2 = (x) => null; // ok, same number of params + this.a3 = () => null; // ok, fewer required params + this.a3 = (x) => null; // ok, fewer required params + this.a3 = (x) => null; // ok, same T of required params + this.a3 = (x, y) => null; // error, too many required params + this.a4 = () => null; // ok, fewer required params + this.a4 = (x, y) => null; // ok, fewer required params + this.a4 = (x) => null; // ok, same T of required params + this.a4 = (x, y) => null; // ok, same number of params + this.a5 = () => null; // ok, fewer required params + this.a5 = (x, y) => null; // ok, fewer required params + this.a5 = (x) => null; // ok, all present params match + this.a5 = (x, y) => null; // ok, same number of params }; } - return Base; - }()); + } })(ClassTypeParam || (ClassTypeParam = {})); var GenericSignaturesInvalid; (function (GenericSignaturesInvalid) { - var Base2 = /** @class */ (function () { - function Base2() { - } - return Base2; - }()); - var Target = /** @class */ (function () { - function Target() { - } - return Target; - }()); + class Base2 { + } + class Target { + } function foo() { var b; var t; @@ -208,30 +200,28 @@ var GenericSignaturesInvalid; })(GenericSignaturesInvalid || (GenericSignaturesInvalid = {})); var GenericSignaturesValid; (function (GenericSignaturesValid) { - var Base2 = /** @class */ (function () { - function Base2() { - var _this = this; - this.init = function () { - _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 - _this.a5 = function (x, y) { return null; }; // ok, same number of params + class Base2 { + constructor() { + this.init = () => { + this.a = () => null; // ok, same T of required params + this.a = (x) => null; // ok, same T of required params + this.a = (x) => null; // error, too many required params + this.a2 = () => null; // ok, same T of required params + this.a2 = (x) => null; // ok, same T of required params + this.a2 = (x) => null; // ok, same number of params + this.a3 = () => null; // ok, fewer required params + this.a3 = (x) => null; // ok, fewer required params + this.a3 = (x) => null; // ok, same T of required params + this.a3 = (x, y) => null; // error, too many required params + this.a4 = () => null; // ok, fewer required params + this.a4 = (x, y) => null; // ok, fewer required params + this.a4 = (x) => null; // ok, same T of required params + this.a4 = (x, y) => null; // ok, same number of params + this.a5 = () => null; // ok, fewer required params + this.a5 = (x, y) => null; // ok, fewer required params + this.a5 = (x) => null; // ok, all present params match + this.a5 = (x, y) => null; // ok, same number of params }; } - return Base2; - }()); + } })(GenericSignaturesValid || (GenericSignaturesValid = {})); diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer.js b/tests/baselines/reference/assignmentCompatWithNumericIndexer.js index 20720cf290a71..f7852ecaf58ab 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer.js +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer.js @@ -47,44 +47,18 @@ namespace Generics { //// [assignmentCompatWithNumericIndexer.js] // Derived type indexer must be subtype of base type indexer -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var A = /** @class */ (function () { - function A() { - } - return A; -}()); +class A { +} a = b; b = a; // error a = b2; b2 = a; // error var Generics; (function (Generics) { - var A = /** @class */ (function () { - function A() { - } - return A; - }()); - var B = /** @class */ (function (_super) { - __extends(B, _super); - function B() { - return _super !== null && _super.apply(this, arguments) || this; - } - return B; - }(A)); + class A { + } + class B extends A { + } function foo() { var a; var b; diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js index 9329efbbf3264..1b901a2e9aaea 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js @@ -44,44 +44,18 @@ namespace Generics { //// [assignmentCompatWithNumericIndexer3.js] // Derived type indexer must be subtype of base type indexer -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var A = /** @class */ (function () { - function A() { - } - return A; -}()); +class A { +} a = b; // error b = a; // ok -var B2 = /** @class */ (function (_super) { - __extends(B2, _super); - function B2() { - return _super !== null && _super.apply(this, arguments) || this; - } - return B2; -}(A)); +class B2 extends A { +} a = b2; // ok b2 = a; // error var Generics; (function (Generics) { - var A = /** @class */ (function () { - function A() { - } - return A; - }()); + class A { + } function foo() { var a; var b; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers.js b/tests/baselines/reference/assignmentCompatWithObjectMembers.js index 89dc75b5fe122..7b8babe05e507 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers.js @@ -92,16 +92,10 @@ namespace ObjectTypes { // no errors expected var SimpleTypes; (function (SimpleTypes) { - var S = /** @class */ (function () { - function S() { - } - return S; - }()); - var T = /** @class */ (function () { - function T() { - } - return T; - }()); + class S { + } + class T { + } var s; var t; var s2; @@ -132,16 +126,10 @@ var SimpleTypes; })(SimpleTypes || (SimpleTypes = {})); var ObjectTypes; (function (ObjectTypes) { - var S = /** @class */ (function () { - function S() { - } - return S; - }()); - var T = /** @class */ (function () { - function T() { - } - return T; - }()); + class S { + } + class T { + } var s; var t; var s2; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers2.js b/tests/baselines/reference/assignmentCompatWithObjectMembers2.js index 6bda8ea8ffa18..d17a38e99c3ab 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers2.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers2.js @@ -47,16 +47,10 @@ 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() { - } - return S; -}()); -var T = /** @class */ (function () { - function T() { - } - return T; -}()); +class S { +} +class T { +} var s; var t; var s2; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers3.js b/tests/baselines/reference/assignmentCompatWithObjectMembers3.js index bb71098c20054..33d5a14d979e7 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers3.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers3.js @@ -47,16 +47,10 @@ 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() { - } - return S; -}()); -var T = /** @class */ (function () { - function T() { - } - return T; -}()); +class S { +} +class T { +} var s; var t; var s2; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers4.js b/tests/baselines/reference/assignmentCompatWithObjectMembers4.js index 93cd47af52552..58ecfb8be5232 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers4.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers4.js @@ -95,52 +95,18 @@ namespace WithBase { //// [assignmentCompatWithObjectMembers4.js] // members N and M of types S and T have the same name, same accessibility, same optionality, and N is not assignable M -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); var OnlyDerived; (function (OnlyDerived) { - var Base = /** @class */ (function () { - function Base() { - } - return Base; - }()); - var Derived = /** @class */ (function (_super) { - __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() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Derived2; - }(Base)); - var S = /** @class */ (function () { - function S() { - } - return S; - }()); - var T = /** @class */ (function () { - function T() { - } - return T; - }()); + class Base { + } + class Derived extends Base { + } + class Derived2 extends Base { + } + class S { + } + class T { + } var a2 = { foo: new Derived() }; var b2 = { foo: new Derived2() }; s = t; // error @@ -165,35 +131,16 @@ var OnlyDerived; })(OnlyDerived || (OnlyDerived = {})); var WithBase; (function (WithBase) { - var Base = /** @class */ (function () { - function Base() { - } - return Base; - }()); - var Derived = /** @class */ (function (_super) { - __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() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Derived2; - }(Base)); - var S = /** @class */ (function () { - function S() { - } - return S; - }()); - var T = /** @class */ (function () { - function T() { - } - return T; - }()); + class Base { + } + class Derived extends Base { + } + class Derived2 extends Base { + } + class S { + } + class T { + } var a2 = { foo: new Base() }; var b2 = { foo: new Derived2() }; s = t; // ok diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers5.js b/tests/baselines/reference/assignmentCompatWithObjectMembers5.js index 0da7ab9d13299..13e09cccd21fe 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers5.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers5.js @@ -17,10 +17,7 @@ c = i; // error i = c; // error //// [assignmentCompatWithObjectMembers5.js] -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { +} c = i; // error i = c; // error diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.js b/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.js index 5a87f367adfa2..20daaf82e1392 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.js @@ -116,22 +116,13 @@ namespace TargetIsPublic { var TargetIsPublic; (function (TargetIsPublic) { // targets - var Base = /** @class */ (function () { - function Base() { - } - return Base; - }()); + class Base { + } // sources - var D = /** @class */ (function () { - function D() { - } - return D; - }()); - var E = /** @class */ (function () { - function E() { - } - return E; - }()); + class D { + } + class E { + } a = b; a = i; a = d; @@ -156,22 +147,13 @@ var TargetIsPublic; })(TargetIsPublic || (TargetIsPublic = {})); (function (TargetIsPublic) { // targets - var Base = /** @class */ (function () { - function Base() { - } - return Base; - }()); + class Base { + } // sources - var D = /** @class */ (function () { - function D() { - } - return D; - }()); - var E = /** @class */ (function () { - function E() { - } - return E; - }()); + class D { + } + class E { + } a = b; // error a = i; // error a = d; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersNumericNames.js b/tests/baselines/reference/assignmentCompatWithObjectMembersNumericNames.js index 836fbe85310de..b6a861f9f508f 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersNumericNames.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersNumericNames.js @@ -47,16 +47,10 @@ 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() { - } - return S; -}()); -var T = /** @class */ (function () { - function T() { - } - return T; -}()); +class S { +} +class T { +} var s; var t; var s2; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js index afd0d3f76c549..e20f3c05b7f38 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js @@ -92,40 +92,12 @@ namespace SourceHasOptional { //// [assignmentCompatWithObjectMembersOptionality.js] // Derived member is not optional but base member is, should be ok -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var Base = /** @class */ (function () { - function Base() { - } - return Base; -}()); -var Derived = /** @class */ (function (_super) { - __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() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Derived2; -}(Derived)); +class Base { +} +class Derived extends Base { +} +class Derived2 extends Derived { +} var TargetHasOptional; (function (TargetHasOptional) { var b = { opt: new Base() }; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js index a77437c73b151..b826539c8322a 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js @@ -95,40 +95,12 @@ namespace SourceHasOptional { //// [assignmentCompatWithObjectMembersOptionality2.js] // M is optional and S contains no property with the same name as M // N is optional and T contains no property with the same name as N -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var Base = /** @class */ (function () { - function Base() { - } - return Base; -}()); -var Derived = /** @class */ (function (_super) { - __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() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Derived2; -}(Derived)); +class Base { +} +class Derived extends Base { +} +class Derived2 extends Derived { +} var TargetHasOptional; (function (TargetHasOptional) { var b = { opt: new Base() }; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersStringNumericNames.js b/tests/baselines/reference/assignmentCompatWithObjectMembersStringNumericNames.js index a9fea11c20cfb..97a21b2192768 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersStringNumericNames.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersStringNumericNames.js @@ -92,16 +92,10 @@ namespace NumbersAndStrings { // string named numeric properties work correctly, errors below unless otherwise noted var JustStrings; (function (JustStrings) { - var S = /** @class */ (function () { - function S() { - } - return S; - }()); - var T = /** @class */ (function () { - function T() { - } - return T; - }()); + class S { + } + class T { + } var a2 = { '1.0': '' }; var b2 = { '1': '' }; s = t; @@ -126,16 +120,10 @@ var JustStrings; })(JustStrings || (JustStrings = {})); var NumbersAndStrings; (function (NumbersAndStrings) { - var S = /** @class */ (function () { - function S() { - } - return S; - }()); - var T = /** @class */ (function () { - function T() { - } - return T; - }()); + class S { + } + class T { + } var a2 = { '1.0': '' }; var b2 = { 1.: '' }; s = t; // ok diff --git a/tests/baselines/reference/assignmentCompatWithOverloads.js b/tests/baselines/reference/assignmentCompatWithOverloads.js index 7e6d7e0752ab7..ff44cbf7002c4 100644 --- a/tests/baselines/reference/assignmentCompatWithOverloads.js +++ b/tests/baselines/reference/assignmentCompatWithOverloads.js @@ -42,10 +42,8 @@ g = f1; // OK g = f2; // Error g = f3; // Error g = f4; // Error -var C = /** @class */ (function () { - function C(x) { - } - return C; -}()); +class C { + constructor(x) { } +} var d; d = C; // Error diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer.js b/tests/baselines/reference/assignmentCompatWithStringIndexer.js index ec0713fcc280a..e8ea5651fa5cf 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer.js +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer.js @@ -58,53 +58,22 @@ namespace Generics { //// [assignmentCompatWithStringIndexer.js] // index signatures must be compatible in assignments -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var A = /** @class */ (function () { - function A() { - } - return A; -}()); +class A { +} a = b; // ok b = a; // error a = b2; // ok b2 = a; // error var Generics; (function (Generics) { - var A = /** @class */ (function () { - function A() { - } - return A; - }()); - var B = /** @class */ (function (_super) { - __extends(B, _super); - function B() { - return _super !== null && _super.apply(this, arguments) || this; - } - return B; - }(A)); + class A { + } + class B extends A { + } a1 = b1; // ok b1 = a1; // error - var B2 = /** @class */ (function (_super) { - __extends(B2, _super); - function B2() { - return _super !== null && _super.apply(this, arguments) || this; - } - return B2; - }(A)); + class B2 extends A { + } a1 = b2; // ok b2 = a1; // error function foo() { diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer3.js b/tests/baselines/reference/assignmentCompatWithStringIndexer3.js index 0abdb96a66f69..13940ddaa412a 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer3.js +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer3.js @@ -31,11 +31,8 @@ a = b1; // error b1 = a; // error var Generics; (function (Generics) { - var A = /** @class */ (function () { - function A() { - } - return A; - }()); + class A { + } function foo() { var a; var b; diff --git a/tests/baselines/reference/assignmentCompatability10.js b/tests/baselines/reference/assignmentCompatability10.js index dba6b098c2d44..97cf7d99ae31f 100644 --- a/tests/baselines/reference/assignmentCompatability10.js +++ b/tests/baselines/reference/assignmentCompatability10.js @@ -21,13 +21,12 @@ var __test1__; })(__test1__ || (__test1__ = {})); var __test2__; (function (__test2__) { - var classWithPublicAndOptional = /** @class */ (function () { - function classWithPublicAndOptional(one, two) { + class classWithPublicAndOptional { + constructor(one, two) { this.one = one; this.two = two; } - return classWithPublicAndOptional; - }()); + } __test2__.classWithPublicAndOptional = classWithPublicAndOptional; var x4 = new classWithPublicAndOptional(1); ; diff --git a/tests/baselines/reference/assignmentCompatability39.js b/tests/baselines/reference/assignmentCompatability39.js index cdd347ebbb9c0..ed095fc6125ed 100644 --- a/tests/baselines/reference/assignmentCompatability39.js +++ b/tests/baselines/reference/assignmentCompatability39.js @@ -21,13 +21,12 @@ var __test1__; })(__test1__ || (__test1__ = {})); var __test2__; (function (__test2__) { - var classWithTwoPublic = /** @class */ (function () { - function classWithTwoPublic(one, two) { + class classWithTwoPublic { + constructor(one, two) { this.one = one; this.two = two; } - return classWithTwoPublic; - }()); + } __test2__.classWithTwoPublic = classWithTwoPublic; var x2 = new classWithTwoPublic(1, "a"); ; diff --git a/tests/baselines/reference/assignmentCompatability40.js b/tests/baselines/reference/assignmentCompatability40.js index 8b43022760f76..ba25bcee8af47 100644 --- a/tests/baselines/reference/assignmentCompatability40.js +++ b/tests/baselines/reference/assignmentCompatability40.js @@ -21,12 +21,11 @@ var __test1__; })(__test1__ || (__test1__ = {})); var __test2__; (function (__test2__) { - var classWithPrivate = /** @class */ (function () { - function classWithPrivate(one) { + class classWithPrivate { + constructor(one) { this.one = one; } - return classWithPrivate; - }()); + } __test2__.classWithPrivate = classWithPrivate; var x5 = new classWithPrivate(1); ; diff --git a/tests/baselines/reference/assignmentCompatability41.js b/tests/baselines/reference/assignmentCompatability41.js index 70681c2953703..176f6d1a34257 100644 --- a/tests/baselines/reference/assignmentCompatability41.js +++ b/tests/baselines/reference/assignmentCompatability41.js @@ -21,13 +21,12 @@ var __test1__; })(__test1__ || (__test1__ = {})); var __test2__; (function (__test2__) { - var classWithTwoPrivate = /** @class */ (function () { - function classWithTwoPrivate(one, two) { + class classWithTwoPrivate { + constructor(one, two) { this.one = one; this.two = two; } - return classWithTwoPrivate; - }()); + } __test2__.classWithTwoPrivate = classWithTwoPrivate; var x6 = new classWithTwoPrivate(1, "a"); ; diff --git a/tests/baselines/reference/assignmentCompatability42.js b/tests/baselines/reference/assignmentCompatability42.js index 2b088f43a1dbb..3efcdb54a6d63 100644 --- a/tests/baselines/reference/assignmentCompatability42.js +++ b/tests/baselines/reference/assignmentCompatability42.js @@ -21,13 +21,12 @@ var __test1__; })(__test1__ || (__test1__ = {})); var __test2__; (function (__test2__) { - var classWithPublicPrivate = /** @class */ (function () { - function classWithPublicPrivate(one, two) { + class classWithPublicPrivate { + constructor(one, two) { this.one = one; this.two = two; } - return classWithPublicPrivate; - }()); + } __test2__.classWithPublicPrivate = classWithPublicPrivate; var x7 = new classWithPublicPrivate(1, "a"); ; diff --git a/tests/baselines/reference/assignmentCompatability44.js b/tests/baselines/reference/assignmentCompatability44.js index 5550c3ca545e4..738de24a038ba 100644 --- a/tests/baselines/reference/assignmentCompatability44.js +++ b/tests/baselines/reference/assignmentCompatability44.js @@ -9,9 +9,7 @@ const foo: { new(): Foo } = Foo; //// [assignmentCompatability44.js] -var Foo = /** @class */ (function () { - function Foo(x) { - } - return Foo; -}()); -var foo = Foo; +class Foo { + constructor(x) { } +} +const foo = Foo; diff --git a/tests/baselines/reference/assignmentCompatability45.js b/tests/baselines/reference/assignmentCompatability45.js index f712233976267..c7ae1fb63ca81 100644 --- a/tests/baselines/reference/assignmentCompatability45.js +++ b/tests/baselines/reference/assignmentCompatability45.js @@ -11,31 +11,11 @@ const b: typeof A = B; //// [assignmentCompatability45.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var A = /** @class */ (function () { - function A() { +class A { +} +class B extends A { + constructor(x) { + super(); } - return A; -}()); -var B = /** @class */ (function (_super) { - __extends(B, _super); - function B(x) { - return _super.call(this) || this; - } - return B; -}(A)); -var b = B; +} +const b = B; diff --git a/tests/baselines/reference/assignmentCompatability8.js b/tests/baselines/reference/assignmentCompatability8.js index 513d44ae3af48..e0e9fd7fb5ebf 100644 --- a/tests/baselines/reference/assignmentCompatability8.js +++ b/tests/baselines/reference/assignmentCompatability8.js @@ -21,12 +21,11 @@ var __test1__; })(__test1__ || (__test1__ = {})); var __test2__; (function (__test2__) { - var classWithPublic = /** @class */ (function () { - function classWithPublic(one) { + class classWithPublic { + constructor(one) { this.one = one; } - return classWithPublic; - }()); + } __test2__.classWithPublic = classWithPublic; var x1 = new classWithPublic(1); ; diff --git a/tests/baselines/reference/assignmentCompatability9.js b/tests/baselines/reference/assignmentCompatability9.js index 0a8c0640d109c..f6951b819e576 100644 --- a/tests/baselines/reference/assignmentCompatability9.js +++ b/tests/baselines/reference/assignmentCompatability9.js @@ -21,12 +21,11 @@ var __test1__; })(__test1__ || (__test1__ = {})); var __test2__; (function (__test2__) { - var classWithOptional = /** @class */ (function () { - function classWithOptional(one) { + class classWithOptional { + constructor(one) { this.one = one; } - return classWithOptional; - }()); + } __test2__.classWithOptional = classWithOptional; var x3 = new classWithOptional(); ; 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 c233e66b00e3c..96bae1d84ffed 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 @@ -51,4 +51,4 @@ fn(['']); fn(4); fn({}); // Should work -fn(function (a) { }); +fn(a => { }); 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 2b61c2d1984c9..f4d2de50fcc33 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 @@ -51,4 +51,4 @@ fn(['']); fn(4); fn({}); // Should work -fn(function (a) { }); +fn(a => { }); diff --git a/tests/baselines/reference/assignmentGenericLookupTypeNarrowing.js b/tests/baselines/reference/assignmentGenericLookupTypeNarrowing.js index 52f6be2d86a20..1c86cba51bbac 100644 --- a/tests/baselines/reference/assignmentGenericLookupTypeNarrowing.js +++ b/tests/baselines/reference/assignmentGenericLookupTypeNarrowing.js @@ -16,10 +16,10 @@ function bar(key: K) { //// [assignmentGenericLookupTypeNarrowing.js] // Repro from #26130 -var mappedObject = { foo: { x: "hello" } }; +let mappedObject = { foo: { x: "hello" } }; function bar(key) { - var element = foo(mappedObject[key]); + const element = foo(mappedObject[key]); if (element == null) return; - var x = element.x; + const x = element.x; } diff --git a/tests/baselines/reference/assignmentIndexedToPrimitives.js b/tests/baselines/reference/assignmentIndexedToPrimitives.js index 8fd43de37243c..ebd79a745d750 100644 --- a/tests/baselines/reference/assignmentIndexedToPrimitives.js +++ b/tests/baselines/reference/assignmentIndexedToPrimitives.js @@ -19,15 +19,15 @@ const so3: string = { 0: "1" }; //// [assignmentIndexedToPrimitives.js] -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" }; +const n1 = [0]; +const n2 = ["0"]; +const n3 = [0, "1"]; +const n4 = [0]; +const s1 = [0]; +const s2 = ["0"]; +const s3 = [0, "1"]; +const s4 = ["0", "1"]; +const no1 = { 0: 1 }; +const so1 = { 0: 1 }; +const so2 = { "0": 1 }; +const so3 = { 0: "1" }; diff --git a/tests/baselines/reference/assignmentLHSIsValue.js b/tests/baselines/reference/assignmentLHSIsValue.js index 31df7b43ba226..cc6dd6342a1f4 100644 --- a/tests/baselines/reference/assignmentLHSIsValue.js +++ b/tests/baselines/reference/assignmentLHSIsValue.js @@ -73,32 +73,14 @@ foo() = value; (foo()) = value; //// [assignmentLHSIsValue.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); // expected error for all the LHS of assignments var value; // this -var C = /** @class */ (function () { - function C() { - this = value; - } - C.prototype.foo = function () { this = value; }; - C.sfoo = function () { this = value; }; - return C; -}()); +class C { + constructor() { this = value; } + foo() { this = value; } + static sfoo() { this = value; } +} function foo() { this = value; } this = value; // identifiers: module, class, enum, function @@ -125,23 +107,17 @@ false = value; } value; // array literals -'' = value[0], '' = value[1]; +['', ''] = value; // super -var Derived = /** @class */ (function (_super) { - __extends(Derived, _super); - function Derived() { - var _this = _super.call(this) || this; - _super.prototype. = value; - return _this; - } - Derived.prototype.foo = function () { _super.prototype. = value; }; - Derived.sfoo = function () { _super. = value; }; - return Derived; -}(C)); +class Derived extends C { + constructor() { super(); super. = value; } + foo() { super. = value; } + static sfoo() { super. = value; } +} // function expression function bar() { } value; -(function () { }); +() => { }; value; // function calls foo() = value; diff --git a/tests/baselines/reference/assignmentNestedInLiterals.js b/tests/baselines/reference/assignmentNestedInLiterals.js index a2d6e9547f167..5b70082168b93 100644 --- a/tests/baselines/reference/assignmentNestedInLiterals.js +++ b/tests/baselines/reference/assignmentNestedInLiterals.js @@ -18,6 +18,5 @@ target = [x = 1, y = x]; var aegis, a, b; aegis = { x: a = 1, y: b = a }; var kowloona, c, d; -for (var _i = 0, _a = [c = 1, d = c]; _i < _a.length; _i++) { - kowloona = _a[_i]; +for (kowloona of [c = 1, d = c]) { } diff --git a/tests/baselines/reference/assignmentNonObjectTypeConstraints.js b/tests/baselines/reference/assignmentNonObjectTypeConstraints.js index 2ad82c991588d..5edb595c6d624 100644 --- a/tests/baselines/reference/assignmentNonObjectTypeConstraints.js +++ b/tests/baselines/reference/assignmentNonObjectTypeConstraints.js @@ -27,16 +27,10 @@ function foo(x) { } foo(5); foo(0 /* E.A */); -var A = /** @class */ (function () { - function A() { - } - return A; -}()); -var B = /** @class */ (function () { - function B() { - } - return B; -}()); +class A { +} +class B { +} function bar(x) { var y = x; // Ok } diff --git a/tests/baselines/reference/assignmentRestElementWithErrorSourceType.js b/tests/baselines/reference/assignmentRestElementWithErrorSourceType.js index 748b2b387aa61..7b08e17158db1 100644 --- a/tests/baselines/reference/assignmentRestElementWithErrorSourceType.js +++ b/tests/baselines/reference/assignmentRestElementWithErrorSourceType.js @@ -6,4 +6,4 @@ var tuple: [string, number]; //// [assignmentRestElementWithErrorSourceType.js] var tuple; -c = tupel.slice(0); // intentionally misspelled +[...c] = tupel; // intentionally misspelled diff --git a/tests/baselines/reference/assignmentToConditionalBrandedStringTemplateOrMapping.js b/tests/baselines/reference/assignmentToConditionalBrandedStringTemplateOrMapping.js index 4e6244df8e0e1..c8d43222ce0ed 100644 --- a/tests/baselines/reference/assignmentToConditionalBrandedStringTemplateOrMapping.js +++ b/tests/baselines/reference/assignmentToConditionalBrandedStringTemplateOrMapping.js @@ -13,9 +13,9 @@ c = d; //// [assignmentToConditionalBrandedStringTemplateOrMapping.js] -var a = null; -var b = null; +let a = null; +let b = null; a = b; -var c = null; -var d = null; +let c = null; +let d = null; c = d; diff --git a/tests/baselines/reference/assignmentToExpandingArrayType.js b/tests/baselines/reference/assignmentToExpandingArrayType.js index 7e94d82cb69c7..56ecd88ad8055 100644 --- a/tests/baselines/reference/assignmentToExpandingArrayType.js +++ b/tests/baselines/reference/assignmentToExpandingArrayType.js @@ -31,7 +31,7 @@ x[0] = { foo: 'hi' } //// [assignmentToExpandingArrayType.js] // Fixes exponential time/space in #14628 -var x = []; +let x = []; x[0] = { foo: 'hi' }; x[0] = { foo: 'hi' }; x[0] = { foo: 'hi' }; diff --git a/tests/baselines/reference/assignmentToFunction.js b/tests/baselines/reference/assignmentToFunction.js index e6d01acac961e..6858bf3d9a8d7 100644 --- a/tests/baselines/reference/assignmentToFunction.js +++ b/tests/baselines/reference/assignmentToFunction.js @@ -14,7 +14,7 @@ namespace foo { //// [assignmentToFunction.js] function fn() { } -fn = function () { return 3; }; +fn = () => 3; var foo; (function (foo) { function xyz() { diff --git a/tests/baselines/reference/assignmentToInstantiationExpression.js b/tests/baselines/reference/assignmentToInstantiationExpression.js index e9a1d61ba0ff4..b7bf050b76e74 100644 --- a/tests/baselines/reference/assignmentToInstantiationExpression.js +++ b/tests/baselines/reference/assignmentToInstantiationExpression.js @@ -15,9 +15,9 @@ getValue2 = () => 1234; //// [assignmentToInstantiationExpression.js] "use strict"; -var obj = {}; -(obj.fn) = function () { return 1234; }; -var getValue; -(getValue) = function () { return 1234; }; -var getValue2; -(getValue2) = function () { return 1234; }; +let obj = {}; +(obj.fn) = () => 1234; +let getValue; +(getValue) = () => 1234; +let getValue2; +(getValue2) = () => 1234; diff --git a/tests/baselines/reference/assignmentToObjectAndFunction.js b/tests/baselines/reference/assignmentToObjectAndFunction.js index 216e38ebd05bb..3bc4cc4bcb2f1 100644 --- a/tests/baselines/reference/assignmentToObjectAndFunction.js +++ b/tests/baselines/reference/assignmentToObjectAndFunction.js @@ -34,7 +34,7 @@ var badFundule: Function = bad; // error //// [assignmentToObjectAndFunction.js] var errObj = { toString: 0 }; // Error, incompatible toString var goodObj = { - toString: function (x) { + toString(x) { return ""; } }; // Ok, because toString is a subtype of Object's toString diff --git a/tests/baselines/reference/assignmentToParenthesizedIdentifiers.js b/tests/baselines/reference/assignmentToParenthesizedIdentifiers.js index f7ed48ef43762..f8f18ea30942a 100644 --- a/tests/baselines/reference/assignmentToParenthesizedIdentifiers.js +++ b/tests/baselines/reference/assignmentToParenthesizedIdentifiers.js @@ -92,7 +92,7 @@ M = { y: 3 }; // Error (M) = { y: 3 }; // Error var M2; (function (M2) { - var M3; + let M3; (function (M3) { })(M3 = M2.M3 || (M2.M3 = {})); M3 = { x: 3 }; // Error @@ -104,8 +104,8 @@ 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 +fn = () => 3; // Bug 823548: Should be error (fn is not a reference) +(fn) = () => 3; // Should be error function fn2(x, y) { x = 3; (x) = 3; // OK @@ -128,10 +128,7 @@ var E; })(E || (E = {})); E = undefined; // Error (E) = undefined; // Error -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { +} C = undefined; // Error (C) = undefined; // Error diff --git a/tests/baselines/reference/assignmentToReferenceTypes.js b/tests/baselines/reference/assignmentToReferenceTypes.js index b42dcf53f0b08..ac5b8e673d382 100644 --- a/tests/baselines/reference/assignmentToReferenceTypes.js +++ b/tests/baselines/reference/assignmentToReferenceTypes.js @@ -28,11 +28,8 @@ function g(x) { //// [assignmentToReferenceTypes.js] // Should all be allowed M = null; -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { +} C = null; var E; (function (E) { diff --git a/tests/baselines/reference/assignmentToVoidZero2.js b/tests/baselines/reference/assignmentToVoidZero2.js index 530097504ea48..3d12268850d27 100644 --- a/tests/baselines/reference/assignmentToVoidZero2.js +++ b/tests/baselines/reference/assignmentToVoidZero2.js @@ -36,7 +36,7 @@ c.p + c.q; //// [importer.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var assignmentToVoidZero2_1 = require("./assignmentToVoidZero2"); +const assignmentToVoidZero2_1 = require("./assignmentToVoidZero2"); assignmentToVoidZero2_1.j + assignmentToVoidZero2_1.k; diff --git a/tests/baselines/reference/assignmentTypeNarrowing.js b/tests/baselines/reference/assignmentTypeNarrowing.js index 9d67dd0c50c3b..85457ff356b16 100644 --- a/tests/baselines/reference/assignmentTypeNarrowing.js +++ b/tests/baselines/reference/assignmentTypeNarrowing.js @@ -38,26 +38,24 @@ arr.push({ x: "ok" }); //// [assignmentTypeNarrowing.js] -var _a, _b, _c; -var x; +let x; x = ""; x; // string -x = [true][0]; +[x] = [true]; x; // boolean -_a = [1][0], x = _a === void 0 ? "" : _a; +[x = ""] = [1]; x; // string | number -(x = { x: true }.x); +({ x } = { x: true }); x; // boolean -(x = { y: 1 }.y); +({ y: x } = { y: 1 }); x; // number -(_b = { x: true }.x, x = _b === void 0 ? "" : _b); +({ x = "" } = { x: true }); x; // string | boolean -(_c = { y: 1 }.y, x = _c === void 0 ? /a/ : _c); +({ y: x = /a/ } = { y: 1 }); x; // number | RegExp -var a; -for (var _i = 0, a_1 = a; _i < a_1.length; _i++) { - x = a_1[_i]; +let a; +for (x of a) { x; // string } -var arr = [{ x: "ok" }]; // weak type +const arr = [{ x: "ok" }]; // weak type arr.push({ x: "ok" }); diff --git a/tests/baselines/reference/assignments.js b/tests/baselines/reference/assignments.js index 1e7ff2bcce510..dac0ea346af56 100644 --- a/tests/baselines/reference/assignments.js +++ b/tests/baselines/reference/assignments.js @@ -43,11 +43,8 @@ I = null; // Error // Assign to a parameter // Assign to an interface M = null; // Error -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { +} C = null; // Error var E; (function (E) { diff --git a/tests/baselines/reference/asyncAliasReturnType_es5(target=es2015).js b/tests/baselines/reference/asyncAliasReturnType_es5(target=es2015).js new file mode 100644 index 0000000000000..7d8afa6da467e --- /dev/null +++ b/tests/baselines/reference/asyncAliasReturnType_es5(target=es2015).js @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/async/es5/asyncAliasReturnType_es5.ts] //// + +//// [asyncAliasReturnType_es5.ts] +type PromiseAlias = Promise; + +async function f(): PromiseAlias { +} + +//// [asyncAliasReturnType_es5.js] +function f() { + return __awaiter(this, void 0, void 0, function* () { + }); +} diff --git a/tests/baselines/reference/asyncAliasReturnType_es5.symbols b/tests/baselines/reference/asyncAliasReturnType_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncAliasReturnType_es5.symbols rename to tests/baselines/reference/asyncAliasReturnType_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncAliasReturnType_es5.types b/tests/baselines/reference/asyncAliasReturnType_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncAliasReturnType_es5.types rename to tests/baselines/reference/asyncAliasReturnType_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncAliasReturnType_es5.errors.txt b/tests/baselines/reference/asyncAliasReturnType_es5(target=es5).errors.txt similarity index 100% rename from tests/baselines/reference/asyncAliasReturnType_es5.errors.txt rename to tests/baselines/reference/asyncAliasReturnType_es5(target=es5).errors.txt diff --git a/tests/baselines/reference/asyncAliasReturnType_es5.js b/tests/baselines/reference/asyncAliasReturnType_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncAliasReturnType_es5.js rename to tests/baselines/reference/asyncAliasReturnType_es5(target=es5).js diff --git a/tests/baselines/reference/asyncAliasReturnType_es5(target=es5).symbols b/tests/baselines/reference/asyncAliasReturnType_es5(target=es5).symbols new file mode 100644 index 0000000000000..3790887a2328a --- /dev/null +++ b/tests/baselines/reference/asyncAliasReturnType_es5(target=es5).symbols @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/async/es5/asyncAliasReturnType_es5.ts] //// + +=== asyncAliasReturnType_es5.ts === +type PromiseAlias = Promise; +>PromiseAlias : Symbol(PromiseAlias, Decl(asyncAliasReturnType_es5.ts, 0, 0)) +>T : Symbol(T, Decl(asyncAliasReturnType_es5.ts, 0, 18)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>T : Symbol(T, Decl(asyncAliasReturnType_es5.ts, 0, 18)) + +async function f(): PromiseAlias { +>f : Symbol(f, Decl(asyncAliasReturnType_es5.ts, 0, 34)) +>PromiseAlias : Symbol(PromiseAlias, Decl(asyncAliasReturnType_es5.ts, 0, 0)) +} diff --git a/tests/baselines/reference/asyncAliasReturnType_es5(target=es5).types b/tests/baselines/reference/asyncAliasReturnType_es5(target=es5).types new file mode 100644 index 0000000000000..9515d2bcae6fc --- /dev/null +++ b/tests/baselines/reference/asyncAliasReturnType_es5(target=es5).types @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/async/es5/asyncAliasReturnType_es5.ts] //// + +=== asyncAliasReturnType_es5.ts === +type PromiseAlias = Promise; +>PromiseAlias : PromiseAlias +> : ^^^^^^^^^^^^^^^ + +async function f(): PromiseAlias { +>f : () => PromiseAlias +> : ^^^^^^ +} diff --git a/tests/baselines/reference/asyncArrowFunction10_es5.errors.txt b/tests/baselines/reference/asyncArrowFunction10_es5(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/asyncArrowFunction10_es5.errors.txt rename to tests/baselines/reference/asyncArrowFunction10_es5(target=es2015).errors.txt diff --git a/tests/baselines/reference/asyncArrowFunction10_es5(target=es2015).js b/tests/baselines/reference/asyncArrowFunction10_es5(target=es2015).js new file mode 100644 index 0000000000000..8c315b6d44af7 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction10_es5(target=es2015).js @@ -0,0 +1,14 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction10_es5.ts] //// + +//// [asyncArrowFunction10_es5.ts] +var foo = async (): Promise => { + // Legal to use 'await' in a type context. + var v: await; +} + + +//// [asyncArrowFunction10_es5.js] +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/asyncArrowFunction10_es5.symbols b/tests/baselines/reference/asyncArrowFunction10_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncArrowFunction10_es5.symbols rename to tests/baselines/reference/asyncArrowFunction10_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncArrowFunction10_es5.types b/tests/baselines/reference/asyncArrowFunction10_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncArrowFunction10_es5.types rename to tests/baselines/reference/asyncArrowFunction10_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncArrowFunction10_es5(target=es5).errors.txt b/tests/baselines/reference/asyncArrowFunction10_es5(target=es5).errors.txt new file mode 100644 index 0000000000000..d6a9d124aa772 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction10_es5(target=es5).errors.txt @@ -0,0 +1,11 @@ +asyncArrowFunction10_es5.ts(3,11): error TS2552: Cannot find name 'await'. Did you mean 'Awaited'? + + +==== asyncArrowFunction10_es5.ts (1 errors) ==== + var foo = async (): Promise => { + // Legal to use 'await' in a type context. + var v: await; + ~~~~~ +!!! error TS2552: Cannot find name 'await'. Did you mean 'Awaited'? + } + \ No newline at end of file diff --git a/tests/baselines/reference/asyncArrowFunction10_es5.js b/tests/baselines/reference/asyncArrowFunction10_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncArrowFunction10_es5.js rename to tests/baselines/reference/asyncArrowFunction10_es5(target=es5).js diff --git a/tests/baselines/reference/asyncArrowFunction10_es5(target=es5).symbols b/tests/baselines/reference/asyncArrowFunction10_es5(target=es5).symbols new file mode 100644 index 0000000000000..ead6ad140015b --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction10_es5(target=es5).symbols @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction10_es5.ts] //// + +=== asyncArrowFunction10_es5.ts === +var foo = async (): Promise => { +>foo : Symbol(foo, Decl(asyncArrowFunction10_es5.ts, 0, 3)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + // Legal to use 'await' in a type context. + var v: await; +>v : Symbol(v, Decl(asyncArrowFunction10_es5.ts, 2, 6)) +>await : Symbol(await) +} + diff --git a/tests/baselines/reference/asyncArrowFunction10_es5(target=es5).types b/tests/baselines/reference/asyncArrowFunction10_es5(target=es5).types new file mode 100644 index 0000000000000..0b338d5baa63f --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction10_es5(target=es5).types @@ -0,0 +1,15 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction10_es5.ts] //// + +=== asyncArrowFunction10_es5.ts === +var foo = async (): Promise => { +>foo : () => Promise +> : ^^^^^^ +>async (): Promise => { // Legal to use 'await' in a type context. var v: await;} : () => Promise +> : ^^^^^^ + + // Legal to use 'await' in a type context. + var v: await; +>v : await +> : ^^^^^ +} + diff --git a/tests/baselines/reference/asyncArrowFunction11_es5(target=es2015).js b/tests/baselines/reference/asyncArrowFunction11_es5(target=es2015).js new file mode 100644 index 0000000000000..80a7fd774664c --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction11_es5(target=es2015).js @@ -0,0 +1,30 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction11_es5.ts] //// + +//// [asyncArrowFunction11_es5.ts] +// https://github.com/Microsoft/TypeScript/issues/24722 +class A { + b = async (...args: any[]) => { + await Promise.resolve(); + const obj = { ["a"]: () => this }; // computed property name after `await` triggers case + }; +} + +//// [asyncArrowFunction11_es5.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +// https://github.com/Microsoft/TypeScript/issues/24722 +class A { + constructor() { + this.b = (...args) => __awaiter(this, void 0, void 0, function* () { + yield Promise.resolve(); + const obj = { ["a"]: () => this }; // computed property name after `await` triggers case + }); + } +} diff --git a/tests/baselines/reference/asyncArrowFunction11_es5.symbols b/tests/baselines/reference/asyncArrowFunction11_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncArrowFunction11_es5.symbols rename to tests/baselines/reference/asyncArrowFunction11_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncArrowFunction11_es5.types b/tests/baselines/reference/asyncArrowFunction11_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncArrowFunction11_es5.types rename to tests/baselines/reference/asyncArrowFunction11_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncArrowFunction11_es5.js b/tests/baselines/reference/asyncArrowFunction11_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncArrowFunction11_es5.js rename to tests/baselines/reference/asyncArrowFunction11_es5(target=es5).js diff --git a/tests/baselines/reference/asyncArrowFunction11_es5(target=es5).symbols b/tests/baselines/reference/asyncArrowFunction11_es5(target=es5).symbols new file mode 100644 index 0000000000000..9485f0a7b3094 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction11_es5(target=es5).symbols @@ -0,0 +1,24 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction11_es5.ts] //// + +=== asyncArrowFunction11_es5.ts === +// https://github.com/Microsoft/TypeScript/issues/24722 +class A { +>A : Symbol(A, Decl(asyncArrowFunction11_es5.ts, 0, 0)) + + b = async (...args: any[]) => { +>b : Symbol(A.b, Decl(asyncArrowFunction11_es5.ts, 1, 9)) +>args : Symbol(args, Decl(asyncArrowFunction11_es5.ts, 2, 15)) + + await Promise.resolve(); +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + const obj = { ["a"]: () => this }; // computed property name after `await` triggers case +>obj : Symbol(obj, Decl(asyncArrowFunction11_es5.ts, 4, 13)) +>["a"] : Symbol(["a"], Decl(asyncArrowFunction11_es5.ts, 4, 21)) +>"a" : Symbol(["a"], Decl(asyncArrowFunction11_es5.ts, 4, 21)) +>this : Symbol(A, Decl(asyncArrowFunction11_es5.ts, 0, 0)) + + }; +} diff --git a/tests/baselines/reference/asyncArrowFunction11_es5(target=es5).types b/tests/baselines/reference/asyncArrowFunction11_es5(target=es5).types new file mode 100644 index 0000000000000..395793e8ed2ad --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction11_es5(target=es5).types @@ -0,0 +1,44 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction11_es5.ts] //// + +=== asyncArrowFunction11_es5.ts === +// https://github.com/Microsoft/TypeScript/issues/24722 +class A { +>A : A +> : ^ + + b = async (...args: any[]) => { +>b : (...args: any[]) => Promise +> : ^^^^ ^^ ^^^^^^^^^^^^^^^^^^ +>async (...args: any[]) => { await Promise.resolve(); const obj = { ["a"]: () => this }; // computed property name after `await` triggers case } : (...args: any[]) => Promise +> : ^^^^ ^^ ^^^^^^^^^^^^^^^^^^ +>args : any[] +> : ^^^^^ + + await Promise.resolve(); +>await Promise.resolve() : void +> : ^^^^ +>Promise.resolve() : Promise +> : ^^^^^^^^^^^^^ +>Promise.resolve : { (): Promise; (value: T): Promise>; (value: T | PromiseLike): Promise>; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^ ^^ ^^^ ^^^ +>Promise : PromiseConstructor +> : ^^^^^^^^^^^^^^^^^^ +>resolve : { (): Promise; (value: T): Promise>; (value: T | PromiseLike): Promise>; } +> : ^^^^^^ ^^^ ^^ ^^ ^^^ ^^^ ^^ ^^ ^^^ ^^^ + + const obj = { ["a"]: () => this }; // computed property name after `await` triggers case +>obj : { a: () => this; } +> : ^^^^^^^^^^^^^^^^^^ +>{ ["a"]: () => this } : { a: () => this; } +> : ^^^^^^^^^^^^^^^^^^ +>["a"] : () => this +> : ^^^^^^^^^^ +>"a" : "a" +> : ^^^ +>() => this : () => this +> : ^^^^^^^^^^ +>this : this +> : ^^^^ + + }; +} diff --git a/tests/baselines/reference/asyncArrowFunction1_es5(target=es2015).js b/tests/baselines/reference/asyncArrowFunction1_es5(target=es2015).js new file mode 100644 index 0000000000000..6b747595f8e99 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction1_es5(target=es2015).js @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction1_es5.ts] //// + +//// [asyncArrowFunction1_es5.ts] +var foo = async (): Promise => { +}; + +//// [asyncArrowFunction1_es5.js] +var foo = () => __awaiter(this, void 0, void 0, function* () { +}); diff --git a/tests/baselines/reference/asyncArrowFunction1_es5.symbols b/tests/baselines/reference/asyncArrowFunction1_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncArrowFunction1_es5.symbols rename to tests/baselines/reference/asyncArrowFunction1_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncArrowFunction1_es5.types b/tests/baselines/reference/asyncArrowFunction1_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncArrowFunction1_es5.types rename to tests/baselines/reference/asyncArrowFunction1_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncArrowFunction1_es5.js b/tests/baselines/reference/asyncArrowFunction1_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncArrowFunction1_es5.js rename to tests/baselines/reference/asyncArrowFunction1_es5(target=es5).js diff --git a/tests/baselines/reference/asyncArrowFunction1_es5(target=es5).symbols b/tests/baselines/reference/asyncArrowFunction1_es5(target=es5).symbols new file mode 100644 index 0000000000000..4aa48f2b89eeb --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction1_es5(target=es5).symbols @@ -0,0 +1,8 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction1_es5.ts] //// + +=== asyncArrowFunction1_es5.ts === +var foo = async (): Promise => { +>foo : Symbol(foo, Decl(asyncArrowFunction1_es5.ts, 0, 3)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +}; diff --git a/tests/baselines/reference/asyncArrowFunction1_es5(target=es5).types b/tests/baselines/reference/asyncArrowFunction1_es5(target=es5).types new file mode 100644 index 0000000000000..b283114a82ec8 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction1_es5(target=es5).types @@ -0,0 +1,10 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction1_es5.ts] //// + +=== asyncArrowFunction1_es5.ts === +var foo = async (): Promise => { +>foo : () => Promise +> : ^^^^^^ +>async (): Promise => {} : () => Promise +> : ^^^^^^ + +}; diff --git a/tests/baselines/reference/asyncArrowFunction2_es5(target=es2015).js b/tests/baselines/reference/asyncArrowFunction2_es5(target=es2015).js new file mode 100644 index 0000000000000..b37b17ccf6cf9 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction2_es5(target=es2015).js @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction2_es5.ts] //// + +//// [asyncArrowFunction2_es5.ts] +var f = (await) => { +} + +//// [asyncArrowFunction2_es5.js] +var f = (await) => { +}; diff --git a/tests/baselines/reference/asyncArrowFunction2_es5.symbols b/tests/baselines/reference/asyncArrowFunction2_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncArrowFunction2_es5.symbols rename to tests/baselines/reference/asyncArrowFunction2_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncArrowFunction2_es5.types b/tests/baselines/reference/asyncArrowFunction2_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncArrowFunction2_es5.types rename to tests/baselines/reference/asyncArrowFunction2_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncArrowFunction2_es5.js b/tests/baselines/reference/asyncArrowFunction2_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncArrowFunction2_es5.js rename to tests/baselines/reference/asyncArrowFunction2_es5(target=es5).js diff --git a/tests/baselines/reference/asyncArrowFunction2_es5(target=es5).symbols b/tests/baselines/reference/asyncArrowFunction2_es5(target=es5).symbols new file mode 100644 index 0000000000000..69ec6af7d71b8 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction2_es5(target=es5).symbols @@ -0,0 +1,7 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction2_es5.ts] //// + +=== asyncArrowFunction2_es5.ts === +var f = (await) => { +>f : Symbol(f, Decl(asyncArrowFunction2_es5.ts, 0, 3)) +>await : Symbol(await, Decl(asyncArrowFunction2_es5.ts, 0, 9)) +} diff --git a/tests/baselines/reference/asyncArrowFunction2_es5(target=es5).types b/tests/baselines/reference/asyncArrowFunction2_es5(target=es5).types new file mode 100644 index 0000000000000..bf5374cccce47 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction2_es5(target=es5).types @@ -0,0 +1,10 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction2_es5.ts] //// + +=== asyncArrowFunction2_es5.ts === +var f = (await) => { +>f : (await: any) => void +> : ^ ^^^^^^^^^^^^^^ +>(await) => {} : (await: any) => void +> : ^ ^^^^^^^^^^^^^^ +>await : any +} diff --git a/tests/baselines/reference/asyncArrowFunction3_es5.errors.txt b/tests/baselines/reference/asyncArrowFunction3_es5(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/asyncArrowFunction3_es5.errors.txt rename to tests/baselines/reference/asyncArrowFunction3_es5(target=es2015).errors.txt diff --git a/tests/baselines/reference/asyncArrowFunction3_es5(target=es2015).js b/tests/baselines/reference/asyncArrowFunction3_es5(target=es2015).js new file mode 100644 index 0000000000000..68fe8338bebc0 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction3_es5(target=es2015).js @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction3_es5.ts] //// + +//// [asyncArrowFunction3_es5.ts] +function f(await = await) { +} + +//// [asyncArrowFunction3_es5.js] +function f(await = await) { +} diff --git a/tests/baselines/reference/asyncArrowFunction3_es5.symbols b/tests/baselines/reference/asyncArrowFunction3_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncArrowFunction3_es5.symbols rename to tests/baselines/reference/asyncArrowFunction3_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncArrowFunction3_es5.types b/tests/baselines/reference/asyncArrowFunction3_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncArrowFunction3_es5.types rename to tests/baselines/reference/asyncArrowFunction3_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncArrowFunction3_es5(target=es5).errors.txt b/tests/baselines/reference/asyncArrowFunction3_es5(target=es5).errors.txt new file mode 100644 index 0000000000000..b78f02690776d --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction3_es5(target=es5).errors.txt @@ -0,0 +1,8 @@ +asyncArrowFunction3_es5.ts(1,20): error TS2372: Parameter 'await' cannot reference itself. + + +==== asyncArrowFunction3_es5.ts (1 errors) ==== + function f(await = await) { + ~~~~~ +!!! error TS2372: Parameter 'await' cannot reference itself. + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncArrowFunction3_es5.js b/tests/baselines/reference/asyncArrowFunction3_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncArrowFunction3_es5.js rename to tests/baselines/reference/asyncArrowFunction3_es5(target=es5).js diff --git a/tests/baselines/reference/asyncArrowFunction3_es5(target=es5).symbols b/tests/baselines/reference/asyncArrowFunction3_es5(target=es5).symbols new file mode 100644 index 0000000000000..2d83db3ce183a --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction3_es5(target=es5).symbols @@ -0,0 +1,8 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction3_es5.ts] //// + +=== asyncArrowFunction3_es5.ts === +function f(await = await) { +>f : Symbol(f, Decl(asyncArrowFunction3_es5.ts, 0, 0)) +>await : Symbol(await, Decl(asyncArrowFunction3_es5.ts, 0, 11)) +>await : Symbol(await, Decl(asyncArrowFunction3_es5.ts, 0, 11)) +} diff --git a/tests/baselines/reference/asyncArrowFunction3_es5(target=es5).types b/tests/baselines/reference/asyncArrowFunction3_es5(target=es5).types new file mode 100644 index 0000000000000..3b3467c4b3514 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction3_es5(target=es5).types @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction3_es5.ts] //// + +=== asyncArrowFunction3_es5.ts === +function f(await = await) { +>f : (await?: any) => void +> : ^ ^^^^^^^^^^^^^^^ +>await : any +> : ^^^ +>await : any +> : ^^^ +} diff --git a/tests/baselines/reference/asyncArrowFunction4_es5(target=es2015).js b/tests/baselines/reference/asyncArrowFunction4_es5(target=es2015).js new file mode 100644 index 0000000000000..966093d5516eb --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction4_es5(target=es2015).js @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction4_es5.ts] //// + +//// [asyncArrowFunction4_es5.ts] +var await = () => { +} + +//// [asyncArrowFunction4_es5.js] +var await = () => { +}; diff --git a/tests/baselines/reference/asyncArrowFunction4_es5.symbols b/tests/baselines/reference/asyncArrowFunction4_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncArrowFunction4_es5.symbols rename to tests/baselines/reference/asyncArrowFunction4_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncArrowFunction4_es5.types b/tests/baselines/reference/asyncArrowFunction4_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncArrowFunction4_es5.types rename to tests/baselines/reference/asyncArrowFunction4_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncArrowFunction4_es5.js b/tests/baselines/reference/asyncArrowFunction4_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncArrowFunction4_es5.js rename to tests/baselines/reference/asyncArrowFunction4_es5(target=es5).js diff --git a/tests/baselines/reference/asyncArrowFunction4_es5(target=es5).symbols b/tests/baselines/reference/asyncArrowFunction4_es5(target=es5).symbols new file mode 100644 index 0000000000000..995114bd06be7 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction4_es5(target=es5).symbols @@ -0,0 +1,6 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction4_es5.ts] //// + +=== asyncArrowFunction4_es5.ts === +var await = () => { +>await : Symbol(await, Decl(asyncArrowFunction4_es5.ts, 0, 3)) +} diff --git a/tests/baselines/reference/asyncArrowFunction4_es5(target=es5).types b/tests/baselines/reference/asyncArrowFunction4_es5(target=es5).types new file mode 100644 index 0000000000000..37b2702488df3 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction4_es5(target=es5).types @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction4_es5.ts] //// + +=== asyncArrowFunction4_es5.ts === +var await = () => { +>await : () => void +> : ^^^^^^^^^^ +>() => {} : () => void +> : ^^^^^^^^^^ +} diff --git a/tests/baselines/reference/asyncArrowFunction5_es5.errors.txt b/tests/baselines/reference/asyncArrowFunction5_es5(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/asyncArrowFunction5_es5.errors.txt rename to tests/baselines/reference/asyncArrowFunction5_es5(target=es2015).errors.txt diff --git a/tests/baselines/reference/asyncArrowFunction5_es5(target=es2015).js b/tests/baselines/reference/asyncArrowFunction5_es5(target=es2015).js new file mode 100644 index 0000000000000..80f461b5b5ef9 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction5_es5(target=es2015).js @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction5_es5.ts] //// + +//// [asyncArrowFunction5_es5.ts] +var foo = async (await): Promise => { +} + +//// [asyncArrowFunction5_es5.js] +var foo = (await) => __awaiter(this, void 0, void 0, function* () { +}); diff --git a/tests/baselines/reference/asyncArrowFunction5_es5.symbols b/tests/baselines/reference/asyncArrowFunction5_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncArrowFunction5_es5.symbols rename to tests/baselines/reference/asyncArrowFunction5_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncArrowFunction5_es5.types b/tests/baselines/reference/asyncArrowFunction5_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncArrowFunction5_es5.types rename to tests/baselines/reference/asyncArrowFunction5_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncArrowFunction5_es5(target=es5).errors.txt b/tests/baselines/reference/asyncArrowFunction5_es5(target=es5).errors.txt new file mode 100644 index 0000000000000..9d5b679d53bbc --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction5_es5(target=es5).errors.txt @@ -0,0 +1,8 @@ +asyncArrowFunction5_es5.ts(1,18): error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. + + +==== asyncArrowFunction5_es5.ts (1 errors) ==== + var foo = async (await): Promise => { + ~~~~~ +!!! error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncArrowFunction5_es5.js b/tests/baselines/reference/asyncArrowFunction5_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncArrowFunction5_es5.js rename to tests/baselines/reference/asyncArrowFunction5_es5(target=es5).js diff --git a/tests/baselines/reference/asyncArrowFunction5_es5(target=es5).symbols b/tests/baselines/reference/asyncArrowFunction5_es5(target=es5).symbols new file mode 100644 index 0000000000000..adb0eff473b15 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction5_es5(target=es5).symbols @@ -0,0 +1,8 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction5_es5.ts] //// + +=== asyncArrowFunction5_es5.ts === +var foo = async (await): Promise => { +>foo : Symbol(foo, Decl(asyncArrowFunction5_es5.ts, 0, 3)) +>await : Symbol(await, Decl(asyncArrowFunction5_es5.ts, 0, 17)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +} diff --git a/tests/baselines/reference/asyncArrowFunction5_es5(target=es5).types b/tests/baselines/reference/asyncArrowFunction5_es5(target=es5).types new file mode 100644 index 0000000000000..b94c8902cd1da --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction5_es5(target=es5).types @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction5_es5.ts] //// + +=== asyncArrowFunction5_es5.ts === +var foo = async (await): Promise => { +>foo : (await: any) => Promise +> : ^ ^^^^^^^^^^ +>async (await): Promise => {} : (await: any) => Promise +> : ^ ^^^^^^^^^^ +>await : any +> : ^^^ +} diff --git a/tests/baselines/reference/asyncArrowFunction6_es5.errors.txt b/tests/baselines/reference/asyncArrowFunction6_es5(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/asyncArrowFunction6_es5.errors.txt rename to tests/baselines/reference/asyncArrowFunction6_es5(target=es2015).errors.txt diff --git a/tests/baselines/reference/asyncArrowFunction6_es5(target=es2015).js b/tests/baselines/reference/asyncArrowFunction6_es5(target=es2015).js new file mode 100644 index 0000000000000..2e7f25010af40 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction6_es5(target=es2015).js @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction6_es5.ts] //// + +//// [asyncArrowFunction6_es5.ts] +var foo = async (a = await): Promise => { +} + +//// [asyncArrowFunction6_es5.js] +var foo = (...args_1) => __awaiter(this, [...args_1], void 0, function* (a = yield ) { +}); diff --git a/tests/baselines/reference/asyncArrowFunction6_es5.symbols b/tests/baselines/reference/asyncArrowFunction6_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncArrowFunction6_es5.symbols rename to tests/baselines/reference/asyncArrowFunction6_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncArrowFunction6_es5.types b/tests/baselines/reference/asyncArrowFunction6_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncArrowFunction6_es5.types rename to tests/baselines/reference/asyncArrowFunction6_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncArrowFunction6_es5(target=es5).errors.txt b/tests/baselines/reference/asyncArrowFunction6_es5(target=es5).errors.txt new file mode 100644 index 0000000000000..1f4846d8df3c4 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction6_es5(target=es5).errors.txt @@ -0,0 +1,11 @@ +asyncArrowFunction6_es5.ts(1,22): error TS2524: 'await' expressions cannot be used in a parameter initializer. +asyncArrowFunction6_es5.ts(1,27): error TS1109: Expression expected. + + +==== asyncArrowFunction6_es5.ts (2 errors) ==== + var foo = async (a = await): Promise => { + ~~~~~ +!!! error TS2524: 'await' expressions cannot be used in a parameter initializer. + ~ +!!! error TS1109: Expression expected. + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncArrowFunction6_es5.js b/tests/baselines/reference/asyncArrowFunction6_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncArrowFunction6_es5.js rename to tests/baselines/reference/asyncArrowFunction6_es5(target=es5).js diff --git a/tests/baselines/reference/asyncArrowFunction6_es5(target=es5).symbols b/tests/baselines/reference/asyncArrowFunction6_es5(target=es5).symbols new file mode 100644 index 0000000000000..164d2cfd84528 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction6_es5(target=es5).symbols @@ -0,0 +1,8 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction6_es5.ts] //// + +=== asyncArrowFunction6_es5.ts === +var foo = async (a = await): Promise => { +>foo : Symbol(foo, Decl(asyncArrowFunction6_es5.ts, 0, 3)) +>a : Symbol(a, Decl(asyncArrowFunction6_es5.ts, 0, 17)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +} diff --git a/tests/baselines/reference/asyncArrowFunction6_es5(target=es5).types b/tests/baselines/reference/asyncArrowFunction6_es5(target=es5).types new file mode 100644 index 0000000000000..aca685f6e8588 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction6_es5(target=es5).types @@ -0,0 +1,15 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction6_es5.ts] //// + +=== asyncArrowFunction6_es5.ts === +var foo = async (a = await): Promise => { +>foo : (a?: any) => Promise +> : ^ ^^^^^^^^^^^ +>async (a = await): Promise => {} : (a?: any) => Promise +> : ^ ^^^^^^^^^^^ +>a : any +> : ^^^ +>await : any +> : ^^^ +> : any +> : ^^^ +} diff --git a/tests/baselines/reference/asyncArrowFunction7_es5.errors.txt b/tests/baselines/reference/asyncArrowFunction7_es5(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/asyncArrowFunction7_es5.errors.txt rename to tests/baselines/reference/asyncArrowFunction7_es5(target=es2015).errors.txt diff --git a/tests/baselines/reference/asyncArrowFunction7_es5(target=es2015).js b/tests/baselines/reference/asyncArrowFunction7_es5(target=es2015).js new file mode 100644 index 0000000000000..e8b91e84dee15 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction7_es5(target=es2015).js @@ -0,0 +1,15 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction7_es5.ts] //// + +//// [asyncArrowFunction7_es5.ts] +var bar = async (): Promise => { + // 'await' here is an identifier, and not an await expression. + var foo = async (a = await): Promise => { + } +} + +//// [asyncArrowFunction7_es5.js] +var bar = () => __awaiter(this, void 0, void 0, function* () { + // 'await' here is an identifier, and not an await expression. + var foo = (...args_1) => __awaiter(this, [...args_1], void 0, function* (a = yield ) { + }); +}); diff --git a/tests/baselines/reference/asyncArrowFunction7_es5.symbols b/tests/baselines/reference/asyncArrowFunction7_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncArrowFunction7_es5.symbols rename to tests/baselines/reference/asyncArrowFunction7_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncArrowFunction7_es5.types b/tests/baselines/reference/asyncArrowFunction7_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncArrowFunction7_es5.types rename to tests/baselines/reference/asyncArrowFunction7_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncArrowFunction7_es5(target=es5).errors.txt b/tests/baselines/reference/asyncArrowFunction7_es5(target=es5).errors.txt new file mode 100644 index 0000000000000..1a4faee91bd1d --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction7_es5(target=es5).errors.txt @@ -0,0 +1,14 @@ +asyncArrowFunction7_es5.ts(3,24): error TS2524: 'await' expressions cannot be used in a parameter initializer. +asyncArrowFunction7_es5.ts(3,29): error TS1109: Expression expected. + + +==== asyncArrowFunction7_es5.ts (2 errors) ==== + var bar = async (): Promise => { + // 'await' here is an identifier, and not an await expression. + var foo = async (a = await): Promise => { + ~~~~~ +!!! error TS2524: 'await' expressions cannot be used in a parameter initializer. + ~ +!!! error TS1109: Expression expected. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncArrowFunction7_es5.js b/tests/baselines/reference/asyncArrowFunction7_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncArrowFunction7_es5.js rename to tests/baselines/reference/asyncArrowFunction7_es5(target=es5).js diff --git a/tests/baselines/reference/asyncArrowFunction7_es5(target=es5).symbols b/tests/baselines/reference/asyncArrowFunction7_es5(target=es5).symbols new file mode 100644 index 0000000000000..6843bc90b8ddc --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction7_es5(target=es5).symbols @@ -0,0 +1,14 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction7_es5.ts] //// + +=== asyncArrowFunction7_es5.ts === +var bar = async (): Promise => { +>bar : Symbol(bar, Decl(asyncArrowFunction7_es5.ts, 0, 3)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + // 'await' here is an identifier, and not an await expression. + var foo = async (a = await): Promise => { +>foo : Symbol(foo, Decl(asyncArrowFunction7_es5.ts, 2, 5)) +>a : Symbol(a, Decl(asyncArrowFunction7_es5.ts, 2, 19)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + } +} diff --git a/tests/baselines/reference/asyncArrowFunction7_es5(target=es5).types b/tests/baselines/reference/asyncArrowFunction7_es5(target=es5).types new file mode 100644 index 0000000000000..a156ed7f7b710 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction7_es5(target=es5).types @@ -0,0 +1,23 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction7_es5.ts] //// + +=== asyncArrowFunction7_es5.ts === +var bar = async (): Promise => { +>bar : () => Promise +> : ^^^^^^ +>async (): Promise => { // 'await' here is an identifier, and not an await expression. var foo = async (a = await): Promise => { }} : () => Promise +> : ^^^^^^ + + // 'await' here is an identifier, and not an await expression. + var foo = async (a = await): Promise => { +>foo : (a?: any) => Promise +> : ^ ^^^^^^^^^^^ +>async (a = await): Promise => { } : (a?: any) => Promise +> : ^ ^^^^^^^^^^^ +>a : any +> : ^^^ +>await : any +> : ^^^ +> : any +> : ^^^ + } +} diff --git a/tests/baselines/reference/asyncArrowFunction8_es5.errors.txt b/tests/baselines/reference/asyncArrowFunction8_es5(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/asyncArrowFunction8_es5.errors.txt rename to tests/baselines/reference/asyncArrowFunction8_es5(target=es2015).errors.txt diff --git a/tests/baselines/reference/asyncArrowFunction8_es5(target=es2015).js b/tests/baselines/reference/asyncArrowFunction8_es5(target=es2015).js new file mode 100644 index 0000000000000..22af0fe53083a --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction8_es5(target=es2015).js @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction8_es5.ts] //// + +//// [asyncArrowFunction8_es5.ts] +var foo = async (): Promise => { + var v = { [await]: foo } +} + +//// [asyncArrowFunction8_es5.js] +var foo = () => __awaiter(this, void 0, void 0, function* () { + var v = { [yield ]: foo }; +}); diff --git a/tests/baselines/reference/asyncArrowFunction8_es5.symbols b/tests/baselines/reference/asyncArrowFunction8_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncArrowFunction8_es5.symbols rename to tests/baselines/reference/asyncArrowFunction8_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncArrowFunction8_es5.types b/tests/baselines/reference/asyncArrowFunction8_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncArrowFunction8_es5.types rename to tests/baselines/reference/asyncArrowFunction8_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncArrowFunction8_es5(target=es5).errors.txt b/tests/baselines/reference/asyncArrowFunction8_es5(target=es5).errors.txt new file mode 100644 index 0000000000000..47109bea85ff8 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction8_es5(target=es5).errors.txt @@ -0,0 +1,9 @@ +asyncArrowFunction8_es5.ts(2,19): error TS1109: Expression expected. + + +==== asyncArrowFunction8_es5.ts (1 errors) ==== + var foo = async (): Promise => { + var v = { [await]: foo } + ~ +!!! error TS1109: Expression expected. + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncArrowFunction8_es5.js b/tests/baselines/reference/asyncArrowFunction8_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncArrowFunction8_es5.js rename to tests/baselines/reference/asyncArrowFunction8_es5(target=es5).js diff --git a/tests/baselines/reference/asyncArrowFunction8_es5(target=es5).symbols b/tests/baselines/reference/asyncArrowFunction8_es5(target=es5).symbols new file mode 100644 index 0000000000000..9eafcc8b60525 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction8_es5(target=es5).symbols @@ -0,0 +1,12 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction8_es5.ts] //// + +=== asyncArrowFunction8_es5.ts === +var foo = async (): Promise => { +>foo : Symbol(foo, Decl(asyncArrowFunction8_es5.ts, 0, 3)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + var v = { [await]: foo } +>v : Symbol(v, Decl(asyncArrowFunction8_es5.ts, 1, 5)) +>[await] : Symbol([await], Decl(asyncArrowFunction8_es5.ts, 1, 11)) +>foo : Symbol(foo, Decl(asyncArrowFunction8_es5.ts, 0, 3)) +} diff --git a/tests/baselines/reference/asyncArrowFunction8_es5(target=es5).types b/tests/baselines/reference/asyncArrowFunction8_es5(target=es5).types new file mode 100644 index 0000000000000..a5cd7180aa019 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction8_es5(target=es5).types @@ -0,0 +1,23 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction8_es5.ts] //// + +=== asyncArrowFunction8_es5.ts === +var foo = async (): Promise => { +>foo : () => Promise +> : ^^^^^^ +>async (): Promise => { var v = { [await]: foo }} : () => Promise +> : ^^^^^^ + + var v = { [await]: foo } +>v : { [x: number]: () => Promise; } +> : ^^^^^^^^^^^^^^^^^^^^^ ^^^ +>{ [await]: foo } : { [x: number]: () => Promise; } +> : ^^^^^^^^^^^^^^^^^^^^^ ^^^ +>[await] : () => Promise +> : ^^^^^^ +>await : any +> : ^^^ +> : any +> : ^^^ +>foo : () => Promise +> : ^^^^^^ +} diff --git a/tests/baselines/reference/asyncArrowFunction9_es5.errors.txt b/tests/baselines/reference/asyncArrowFunction9_es5(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/asyncArrowFunction9_es5.errors.txt rename to tests/baselines/reference/asyncArrowFunction9_es5(target=es2015).errors.txt diff --git a/tests/baselines/reference/asyncArrowFunction9_es5(target=es2015).js b/tests/baselines/reference/asyncArrowFunction9_es5(target=es2015).js new file mode 100644 index 0000000000000..159225679709d --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction9_es5(target=es2015).js @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction9_es5.ts] //// + +//// [asyncArrowFunction9_es5.ts] +var foo = async (a = await => await): Promise => { +} + +//// [asyncArrowFunction9_es5.js] +var foo = async(a = await => await), Promise; +; +{ +} diff --git a/tests/baselines/reference/asyncArrowFunction9_es5.symbols b/tests/baselines/reference/asyncArrowFunction9_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncArrowFunction9_es5.symbols rename to tests/baselines/reference/asyncArrowFunction9_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncArrowFunction9_es5.types b/tests/baselines/reference/asyncArrowFunction9_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncArrowFunction9_es5.types rename to tests/baselines/reference/asyncArrowFunction9_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncArrowFunction9_es5(target=es5).errors.txt b/tests/baselines/reference/asyncArrowFunction9_es5(target=es5).errors.txt new file mode 100644 index 0000000000000..a1a1c9691c9dd --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction9_es5(target=es5).errors.txt @@ -0,0 +1,24 @@ +asyncArrowFunction9_es5.ts(1,11): error TS2304: Cannot find name 'async'. +asyncArrowFunction9_es5.ts(1,18): error TS2304: Cannot find name 'a'. +asyncArrowFunction9_es5.ts(1,37): error TS1005: ',' expected. +asyncArrowFunction9_es5.ts(1,39): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'any'. +asyncArrowFunction9_es5.ts(1,46): error TS1005: ',' expected. +asyncArrowFunction9_es5.ts(1,53): error TS1109: Expression expected. + + +==== asyncArrowFunction9_es5.ts (6 errors) ==== + var foo = async (a = await => await): Promise => { + ~~~~~ +!!! error TS2304: Cannot find name 'async'. + ~ +!!! error TS2304: Cannot find name 'a'. + ~ +!!! error TS1005: ',' expected. + ~~~~~~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'any'. +!!! related TS6203 lib.es2015.promise.d.ts:--:--: 'Promise' was also declared here. + ~ +!!! error TS1005: ',' expected. + ~~ +!!! error TS1109: Expression expected. + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncArrowFunction9_es5.js b/tests/baselines/reference/asyncArrowFunction9_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncArrowFunction9_es5.js rename to tests/baselines/reference/asyncArrowFunction9_es5(target=es5).js diff --git a/tests/baselines/reference/asyncArrowFunction9_es5(target=es5).symbols b/tests/baselines/reference/asyncArrowFunction9_es5(target=es5).symbols new file mode 100644 index 0000000000000..80756aada3c55 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction9_es5(target=es5).symbols @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction9_es5.ts] //// + +=== asyncArrowFunction9_es5.ts === +var foo = async (a = await => await): Promise => { +>foo : Symbol(foo, Decl(asyncArrowFunction9_es5.ts, 0, 3)) +>await : Symbol(await, Decl(asyncArrowFunction9_es5.ts, 0, 20)) +>await : Symbol(await, Decl(asyncArrowFunction9_es5.ts, 0, 20)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(asyncArrowFunction9_es5.ts, 0, 37)) +} diff --git a/tests/baselines/reference/asyncArrowFunction9_es5(target=es5).types b/tests/baselines/reference/asyncArrowFunction9_es5(target=es5).types new file mode 100644 index 0000000000000..c3d05138bee75 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunction9_es5(target=es5).types @@ -0,0 +1,27 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction9_es5.ts] //// + +=== asyncArrowFunction9_es5.ts === +var foo = async (a = await => await): Promise => { +>foo : any +> : ^^^ +>async (a = await => await) : any +> : ^^^ +>async : any +> : ^^^ +>a = await => await : (await: any) => any +> : ^ ^^^^^^^^^^^^^ +>a : any +> : ^^^ +>await => await : (await: any) => any +> : ^ ^^^^^^^^^^^^^ +>await : any +> : ^^^ +>await : any +> : ^^^ +>Promise : PromiseConstructor +> : ^^^^^^^^^^^^^^^^^^ +> : void +> : ^^^^ +> : any +> : ^^^ +} diff --git a/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5(target=es2015).js b/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5(target=es2015).js new file mode 100644 index 0000000000000..71eb0146ac930 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5(target=es2015).js @@ -0,0 +1,21 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunctionCapturesArguments_es5.ts] //// + +//// [asyncArrowFunctionCapturesArguments_es5.ts] +class C { + method() { + function other() {} + var fn = async () => await other.apply(this, arguments); + } +} + + +//// [asyncArrowFunctionCapturesArguments_es5.js] +class C { + method() { + function other() { } + var fn = () => { + var arguments_1 = arguments; + return __awaiter(this, void 0, void 0, function* () { return yield other.apply(this, arguments_1); }); + }; + } +} diff --git a/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5.symbols b/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5.symbols rename to tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5(target=es2015).types b/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5(target=es2015).types new file mode 100644 index 0000000000000..28155cec6f6c8 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5(target=es2015).types @@ -0,0 +1,35 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunctionCapturesArguments_es5.ts] //// + +=== asyncArrowFunctionCapturesArguments_es5.ts === +class C { +>C : C +> : ^ + + method() { +>method : () => void +> : ^^^^^^^^^^ + + function other() {} +>other : () => void +> : ^^^^^^^^^^ + + var fn = async () => await other.apply(this, arguments); +>fn : () => Promise +> : ^^^^^^^^^^^^^^^^^^ +>async () => await other.apply(this, arguments) : () => Promise +> : ^^^^^^^^^^^^^^^^^^ +>await other.apply(this, arguments) : any +>other.apply(this, arguments) : any +>other.apply : (this: Function, thisArg: any, argArray?: any) => any +> : ^ ^^ ^^ ^^ ^^ ^^^ ^^^^^ +>other : () => void +> : ^^^^^^^^^^ +>apply : (this: Function, thisArg: any, argArray?: any) => any +> : ^ ^^ ^^ ^^ ^^ ^^^ ^^^^^ +>this : this +> : ^^^^ +>arguments : IArguments +> : ^^^^^^^^^^ + } +} + diff --git a/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5.errors.txt b/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5(target=es5).errors.txt similarity index 100% rename from tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5.errors.txt rename to tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5(target=es5).errors.txt diff --git a/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5.js b/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5.js rename to tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5(target=es5).js diff --git a/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5(target=es5).symbols b/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5(target=es5).symbols new file mode 100644 index 0000000000000..4c7ec6afe1296 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5(target=es5).symbols @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunctionCapturesArguments_es5.ts] //// + +=== asyncArrowFunctionCapturesArguments_es5.ts === +class C { +>C : Symbol(C, Decl(asyncArrowFunctionCapturesArguments_es5.ts, 0, 0)) + + method() { +>method : Symbol(C.method, Decl(asyncArrowFunctionCapturesArguments_es5.ts, 0, 9)) + + function other() {} +>other : Symbol(other, Decl(asyncArrowFunctionCapturesArguments_es5.ts, 1, 13)) + + var fn = async () => await other.apply(this, arguments); +>fn : Symbol(fn, Decl(asyncArrowFunctionCapturesArguments_es5.ts, 3, 9)) +>other.apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --)) +>other : Symbol(other, Decl(asyncArrowFunctionCapturesArguments_es5.ts, 1, 13)) +>apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --)) +>this : Symbol(C, Decl(asyncArrowFunctionCapturesArguments_es5.ts, 0, 0)) +>arguments : Symbol(arguments) + } +} + diff --git a/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5.types b/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5(target=es5).types similarity index 100% rename from tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5.types rename to tests/baselines/reference/asyncArrowFunctionCapturesArguments_es5(target=es5).types diff --git a/tests/baselines/reference/asyncArrowFunctionCapturesThis_es5(target=es2015).js b/tests/baselines/reference/asyncArrowFunctionCapturesThis_es5(target=es2015).js new file mode 100644 index 0000000000000..8bc3c65f18db4 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunctionCapturesThis_es5(target=es2015).js @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunctionCapturesThis_es5.ts] //// + +//// [asyncArrowFunctionCapturesThis_es5.ts] +class C { + method() { + var fn = async () => await this; + } +} + + +//// [asyncArrowFunctionCapturesThis_es5.js] +class C { + method() { + var fn = () => __awaiter(this, void 0, void 0, function* () { return yield this; }); + } +} diff --git a/tests/baselines/reference/asyncArrowFunctionCapturesThis_es5.symbols b/tests/baselines/reference/asyncArrowFunctionCapturesThis_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncArrowFunctionCapturesThis_es5.symbols rename to tests/baselines/reference/asyncArrowFunctionCapturesThis_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncArrowFunctionCapturesThis_es5.types b/tests/baselines/reference/asyncArrowFunctionCapturesThis_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncArrowFunctionCapturesThis_es5.types rename to tests/baselines/reference/asyncArrowFunctionCapturesThis_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncArrowFunctionCapturesThis_es5.js b/tests/baselines/reference/asyncArrowFunctionCapturesThis_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncArrowFunctionCapturesThis_es5.js rename to tests/baselines/reference/asyncArrowFunctionCapturesThis_es5(target=es5).js diff --git a/tests/baselines/reference/asyncArrowFunctionCapturesThis_es5(target=es5).symbols b/tests/baselines/reference/asyncArrowFunctionCapturesThis_es5(target=es5).symbols new file mode 100644 index 0000000000000..bc6bb2b9353fb --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunctionCapturesThis_es5(target=es5).symbols @@ -0,0 +1,15 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunctionCapturesThis_es5.ts] //// + +=== asyncArrowFunctionCapturesThis_es5.ts === +class C { +>C : Symbol(C, Decl(asyncArrowFunctionCapturesThis_es5.ts, 0, 0)) + + method() { +>method : Symbol(C.method, Decl(asyncArrowFunctionCapturesThis_es5.ts, 0, 9)) + + var fn = async () => await this; +>fn : Symbol(fn, Decl(asyncArrowFunctionCapturesThis_es5.ts, 2, 9)) +>this : Symbol(C, Decl(asyncArrowFunctionCapturesThis_es5.ts, 0, 0)) + } +} + diff --git a/tests/baselines/reference/asyncArrowFunctionCapturesThis_es5(target=es5).types b/tests/baselines/reference/asyncArrowFunctionCapturesThis_es5(target=es5).types new file mode 100644 index 0000000000000..4ef7b23b55bb9 --- /dev/null +++ b/tests/baselines/reference/asyncArrowFunctionCapturesThis_es5(target=es5).types @@ -0,0 +1,23 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunctionCapturesThis_es5.ts] //// + +=== asyncArrowFunctionCapturesThis_es5.ts === +class C { +>C : C +> : ^ + + method() { +>method : () => void +> : ^^^^^^^^^^ + + var fn = async () => await this; +>fn : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ +>async () => await this : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ +>await this : this +> : ^^^^ +>this : this +> : ^^^^ + } +} + diff --git a/tests/baselines/reference/asyncArrowInClassES5(target=es2015).js b/tests/baselines/reference/asyncArrowInClassES5(target=es2015).js new file mode 100644 index 0000000000000..620d202e6ab00 --- /dev/null +++ b/tests/baselines/reference/asyncArrowInClassES5(target=es2015).js @@ -0,0 +1,19 @@ +//// [tests/cases/compiler/asyncArrowInClassES5.ts] //// + +//// [asyncArrowInClassES5.ts] +// https://github.com/Microsoft/TypeScript/issues/16924 +// Should capture `this` + +class Test { + static member = async (x: string) => { }; +} + + +//// [asyncArrowInClassES5.js] +// https://github.com/Microsoft/TypeScript/issues/16924 +// Should capture `this` +var _a; +class Test { +} +_a = Test; +Test.member = (x) => __awaiter(_a, void 0, void 0, function* () { }); diff --git a/tests/baselines/reference/asyncArrowInClassES5.symbols b/tests/baselines/reference/asyncArrowInClassES5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncArrowInClassES5.symbols rename to tests/baselines/reference/asyncArrowInClassES5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncArrowInClassES5.types b/tests/baselines/reference/asyncArrowInClassES5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncArrowInClassES5.types rename to tests/baselines/reference/asyncArrowInClassES5(target=es2015).types diff --git a/tests/baselines/reference/asyncArrowInClassES5.js b/tests/baselines/reference/asyncArrowInClassES5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncArrowInClassES5.js rename to tests/baselines/reference/asyncArrowInClassES5(target=es5).js diff --git a/tests/baselines/reference/asyncArrowInClassES5(target=es5).symbols b/tests/baselines/reference/asyncArrowInClassES5(target=es5).symbols new file mode 100644 index 0000000000000..853677404a591 --- /dev/null +++ b/tests/baselines/reference/asyncArrowInClassES5(target=es5).symbols @@ -0,0 +1,14 @@ +//// [tests/cases/compiler/asyncArrowInClassES5.ts] //// + +=== asyncArrowInClassES5.ts === +// https://github.com/Microsoft/TypeScript/issues/16924 +// Should capture `this` + +class Test { +>Test : Symbol(Test, Decl(asyncArrowInClassES5.ts, 0, 0)) + + static member = async (x: string) => { }; +>member : Symbol(Test.member, Decl(asyncArrowInClassES5.ts, 3, 12)) +>x : Symbol(x, Decl(asyncArrowInClassES5.ts, 4, 27)) +} + diff --git a/tests/baselines/reference/asyncArrowInClassES5(target=es5).types b/tests/baselines/reference/asyncArrowInClassES5(target=es5).types new file mode 100644 index 0000000000000..a2b5376f6bfb4 --- /dev/null +++ b/tests/baselines/reference/asyncArrowInClassES5(target=es5).types @@ -0,0 +1,19 @@ +//// [tests/cases/compiler/asyncArrowInClassES5.ts] //// + +=== asyncArrowInClassES5.ts === +// https://github.com/Microsoft/TypeScript/issues/16924 +// Should capture `this` + +class Test { +>Test : Test +> : ^^^^ + + static member = async (x: string) => { }; +>member : (x: string) => Promise +> : ^ ^^ ^^^^^^^^^^^^^^^^^^ +>async (x: string) => { } : (x: string) => Promise +> : ^ ^^ ^^^^^^^^^^^^^^^^^^ +>x : string +> : ^^^^^^ +} + diff --git a/tests/baselines/reference/asyncAwaitIsolatedModules_es5.errors.txt b/tests/baselines/reference/asyncAwaitIsolatedModules_es5(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/asyncAwaitIsolatedModules_es5.errors.txt rename to tests/baselines/reference/asyncAwaitIsolatedModules_es5(target=es2015).errors.txt diff --git a/tests/baselines/reference/asyncAwaitIsolatedModules_es5(target=es2015).js b/tests/baselines/reference/asyncAwaitIsolatedModules_es5(target=es2015).js new file mode 100644 index 0000000000000..c37f2b260e803 --- /dev/null +++ b/tests/baselines/reference/asyncAwaitIsolatedModules_es5(target=es2015).js @@ -0,0 +1,118 @@ +//// [tests/cases/conformance/async/es5/asyncAwaitIsolatedModules_es5.ts] //// + +//// [asyncAwaitIsolatedModules_es5.ts] +import { MyPromise } from "missing"; + +declare var p: Promise; +declare var mp: MyPromise; + +async function f0() { } +async function f1(): Promise { } +async function f3(): MyPromise { } + +let f4 = async function() { } +let f5 = async function(): Promise { } +let f6 = async function(): MyPromise { } + +let f7 = async () => { }; +let f8 = async (): Promise => { }; +let f9 = async (): MyPromise => { }; +let f10 = async () => p; +let f11 = async () => mp; +let f12 = async (): Promise => mp; +let f13 = async (): MyPromise => p; + +let o = { + async m1() { }, + async m2(): Promise { }, + async m3(): MyPromise { } +}; + +class C { + async m1() { } + async m2(): Promise { } + async m3(): MyPromise { } + static async m4() { } + static async m5(): Promise { } + static async m6(): MyPromise { } +} + +namespace M { + export async function f1() { } +} + +//// [asyncAwaitIsolatedModules_es5.js] +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +function f0() { + return __awaiter(this, void 0, void 0, function* () { }); +} +function f1() { + return __awaiter(this, void 0, void 0, function* () { }); +} +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* () { }); +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* () { }); + }, + m2() { + return __awaiter(this, void 0, void 0, function* () { }); + }, + m3() { + return __awaiter(this, void 0, void 0, function* () { }); + } +}; +class C { + m1() { + return __awaiter(this, void 0, void 0, function* () { }); + } + m2() { + return __awaiter(this, void 0, void 0, function* () { }); + } + m3() { + return __awaiter(this, void 0, void 0, function* () { }); + } + static m4() { + return __awaiter(this, void 0, void 0, function* () { }); + } + static m5() { + return __awaiter(this, void 0, void 0, function* () { }); + } + static m6() { + return __awaiter(this, void 0, void 0, function* () { }); + } +} +var M; +(function (M) { + function f1() { + return __awaiter(this, void 0, void 0, function* () { }); + } + M.f1 = f1; +})(M || (M = {})); diff --git a/tests/baselines/reference/asyncAwaitIsolatedModules_es5.symbols b/tests/baselines/reference/asyncAwaitIsolatedModules_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncAwaitIsolatedModules_es5.symbols rename to tests/baselines/reference/asyncAwaitIsolatedModules_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncAwaitIsolatedModules_es5.types b/tests/baselines/reference/asyncAwaitIsolatedModules_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncAwaitIsolatedModules_es5.types rename to tests/baselines/reference/asyncAwaitIsolatedModules_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncAwaitIsolatedModules_es5(target=es5).errors.txt b/tests/baselines/reference/asyncAwaitIsolatedModules_es5(target=es5).errors.txt new file mode 100644 index 0000000000000..673f63cce76f6 --- /dev/null +++ b/tests/baselines/reference/asyncAwaitIsolatedModules_es5(target=es5).errors.txt @@ -0,0 +1,45 @@ +asyncAwaitIsolatedModules_es5.ts(1,27): error TS2307: Cannot find module 'missing' or its corresponding type declarations. + + +==== asyncAwaitIsolatedModules_es5.ts (1 errors) ==== + import { MyPromise } from "missing"; + ~~~~~~~~~ +!!! error TS2307: Cannot find module 'missing' or its corresponding type declarations. + + declare var p: Promise; + declare var mp: MyPromise; + + async function f0() { } + async function f1(): Promise { } + async function f3(): MyPromise { } + + let f4 = async function() { } + let f5 = async function(): Promise { } + let f6 = async function(): MyPromise { } + + let f7 = async () => { }; + let f8 = async (): Promise => { }; + let f9 = async (): MyPromise => { }; + let f10 = async () => p; + let f11 = async () => mp; + let f12 = async (): Promise => mp; + let f13 = async (): MyPromise => p; + + let o = { + async m1() { }, + async m2(): Promise { }, + async m3(): MyPromise { } + }; + + class C { + async m1() { } + async m2(): Promise { } + async m3(): MyPromise { } + static async m4() { } + static async m5(): Promise { } + static async m6(): MyPromise { } + } + + namespace M { + export async function f1() { } + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncAwaitIsolatedModules_es5.js b/tests/baselines/reference/asyncAwaitIsolatedModules_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncAwaitIsolatedModules_es5.js rename to tests/baselines/reference/asyncAwaitIsolatedModules_es5(target=es5).js diff --git a/tests/baselines/reference/asyncAwaitIsolatedModules_es5(target=es5).symbols b/tests/baselines/reference/asyncAwaitIsolatedModules_es5(target=es5).symbols new file mode 100644 index 0000000000000..236e5e62924af --- /dev/null +++ b/tests/baselines/reference/asyncAwaitIsolatedModules_es5(target=es5).symbols @@ -0,0 +1,113 @@ +//// [tests/cases/conformance/async/es5/asyncAwaitIsolatedModules_es5.ts] //// + +=== asyncAwaitIsolatedModules_es5.ts === +import { MyPromise } from "missing"; +>MyPromise : Symbol(MyPromise, Decl(asyncAwaitIsolatedModules_es5.ts, 0, 8)) + +declare var p: Promise; +>p : Symbol(p, Decl(asyncAwaitIsolatedModules_es5.ts, 2, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +declare var mp: MyPromise; +>mp : Symbol(mp, Decl(asyncAwaitIsolatedModules_es5.ts, 3, 11)) +>MyPromise : Symbol(MyPromise, Decl(asyncAwaitIsolatedModules_es5.ts, 0, 8)) + +async function f0() { } +>f0 : Symbol(f0, Decl(asyncAwaitIsolatedModules_es5.ts, 3, 34)) + +async function f1(): Promise { } +>f1 : Symbol(f1, Decl(asyncAwaitIsolatedModules_es5.ts, 5, 23)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +async function f3(): MyPromise { } +>f3 : Symbol(f3, Decl(asyncAwaitIsolatedModules_es5.ts, 6, 38)) +>MyPromise : Symbol(MyPromise, Decl(asyncAwaitIsolatedModules_es5.ts, 0, 8)) + +let f4 = async function() { } +>f4 : Symbol(f4, Decl(asyncAwaitIsolatedModules_es5.ts, 9, 3)) + +let f5 = async function(): Promise { } +>f5 : Symbol(f5, Decl(asyncAwaitIsolatedModules_es5.ts, 10, 3)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +let f6 = async function(): MyPromise { } +>f6 : Symbol(f6, Decl(asyncAwaitIsolatedModules_es5.ts, 11, 3)) +>MyPromise : Symbol(MyPromise, Decl(asyncAwaitIsolatedModules_es5.ts, 0, 8)) + +let f7 = async () => { }; +>f7 : Symbol(f7, Decl(asyncAwaitIsolatedModules_es5.ts, 13, 3)) + +let f8 = async (): Promise => { }; +>f8 : Symbol(f8, Decl(asyncAwaitIsolatedModules_es5.ts, 14, 3)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +let f9 = async (): MyPromise => { }; +>f9 : Symbol(f9, Decl(asyncAwaitIsolatedModules_es5.ts, 15, 3)) +>MyPromise : Symbol(MyPromise, Decl(asyncAwaitIsolatedModules_es5.ts, 0, 8)) + +let f10 = async () => p; +>f10 : Symbol(f10, Decl(asyncAwaitIsolatedModules_es5.ts, 16, 3)) +>p : Symbol(p, Decl(asyncAwaitIsolatedModules_es5.ts, 2, 11)) + +let f11 = async () => mp; +>f11 : Symbol(f11, Decl(asyncAwaitIsolatedModules_es5.ts, 17, 3)) +>mp : Symbol(mp, Decl(asyncAwaitIsolatedModules_es5.ts, 3, 11)) + +let f12 = async (): Promise => mp; +>f12 : Symbol(f12, Decl(asyncAwaitIsolatedModules_es5.ts, 18, 3)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>mp : Symbol(mp, Decl(asyncAwaitIsolatedModules_es5.ts, 3, 11)) + +let f13 = async (): MyPromise => p; +>f13 : Symbol(f13, Decl(asyncAwaitIsolatedModules_es5.ts, 19, 3)) +>MyPromise : Symbol(MyPromise, Decl(asyncAwaitIsolatedModules_es5.ts, 0, 8)) +>p : Symbol(p, Decl(asyncAwaitIsolatedModules_es5.ts, 2, 11)) + +let o = { +>o : Symbol(o, Decl(asyncAwaitIsolatedModules_es5.ts, 21, 3)) + + async m1() { }, +>m1 : Symbol(m1, Decl(asyncAwaitIsolatedModules_es5.ts, 21, 9)) + + async m2(): Promise { }, +>m2 : Symbol(m2, Decl(asyncAwaitIsolatedModules_es5.ts, 22, 16)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + async m3(): MyPromise { } +>m3 : Symbol(m3, Decl(asyncAwaitIsolatedModules_es5.ts, 23, 31)) +>MyPromise : Symbol(MyPromise, Decl(asyncAwaitIsolatedModules_es5.ts, 0, 8)) + +}; + +class C { +>C : Symbol(C, Decl(asyncAwaitIsolatedModules_es5.ts, 25, 2)) + + async m1() { } +>m1 : Symbol(C.m1, Decl(asyncAwaitIsolatedModules_es5.ts, 27, 9)) + + async m2(): Promise { } +>m2 : Symbol(C.m2, Decl(asyncAwaitIsolatedModules_es5.ts, 28, 15)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + async m3(): MyPromise { } +>m3 : Symbol(C.m3, Decl(asyncAwaitIsolatedModules_es5.ts, 29, 30)) +>MyPromise : Symbol(MyPromise, Decl(asyncAwaitIsolatedModules_es5.ts, 0, 8)) + + static async m4() { } +>m4 : Symbol(C.m4, Decl(asyncAwaitIsolatedModules_es5.ts, 30, 32)) + + static async m5(): Promise { } +>m5 : Symbol(C.m5, Decl(asyncAwaitIsolatedModules_es5.ts, 31, 22)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + static async m6(): MyPromise { } +>m6 : Symbol(C.m6, Decl(asyncAwaitIsolatedModules_es5.ts, 32, 37)) +>MyPromise : Symbol(MyPromise, Decl(asyncAwaitIsolatedModules_es5.ts, 0, 8)) +} + +namespace M { +>M : Symbol(M, Decl(asyncAwaitIsolatedModules_es5.ts, 34, 1)) + + export async function f1() { } +>f1 : Symbol(f1, Decl(asyncAwaitIsolatedModules_es5.ts, 36, 13)) +} diff --git a/tests/baselines/reference/asyncAwaitIsolatedModules_es5(target=es5).types b/tests/baselines/reference/asyncAwaitIsolatedModules_es5(target=es5).types new file mode 100644 index 0000000000000..e0596ee3c8099 --- /dev/null +++ b/tests/baselines/reference/asyncAwaitIsolatedModules_es5(target=es5).types @@ -0,0 +1,152 @@ +//// [tests/cases/conformance/async/es5/asyncAwaitIsolatedModules_es5.ts] //// + +=== asyncAwaitIsolatedModules_es5.ts === +import { MyPromise } from "missing"; +>MyPromise : any +> : ^^^ + +declare var p: Promise; +>p : Promise +> : ^^^^^^^^^^^^^^^ + +declare var mp: MyPromise; +>mp : MyPromise +> : ^^^^^^^^^^^^^^^^^ + +async function f0() { } +>f0 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + +async function f1(): Promise { } +>f1 : () => Promise +> : ^^^^^^ + +async function f3(): MyPromise { } +>f3 : () => MyPromise +> : ^^^^^^ + +let f4 = async function() { } +>f4 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ +>async function() { } : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + +let f5 = async function(): Promise { } +>f5 : () => Promise +> : ^^^^^^ +>async function(): Promise { } : () => Promise +> : ^^^^^^ + +let f6 = async function(): MyPromise { } +>f6 : () => MyPromise +> : ^^^^^^ +>async function(): MyPromise { } : () => MyPromise +> : ^^^^^^ + +let f7 = async () => { }; +>f7 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ +>async () => { } : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + +let f8 = async (): Promise => { }; +>f8 : () => Promise +> : ^^^^^^ +>async (): Promise => { } : () => Promise +> : ^^^^^^ + +let f9 = async (): MyPromise => { }; +>f9 : () => MyPromise +> : ^^^^^^ +>async (): MyPromise => { } : () => MyPromise +> : ^^^^^^ + +let f10 = async () => p; +>f10 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^^^ +>async () => p : () => Promise +> : ^^^^^^^^^^^^^^^^^^^^^ +>p : Promise +> : ^^^^^^^^^^^^^^^ + +let f11 = async () => mp; +>f11 : () => Promise> +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>async () => mp : () => Promise> +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>mp : MyPromise +> : ^^^^^^^^^^^^^^^^^ + +let f12 = async (): Promise => mp; +>f12 : () => Promise +> : ^^^^^^ +>async (): Promise => mp : () => Promise +> : ^^^^^^ +>mp : MyPromise +> : ^^^^^^^^^^^^^^^^^ + +let f13 = async (): MyPromise => p; +>f13 : () => MyPromise +> : ^^^^^^ +>async (): MyPromise => p : () => MyPromise +> : ^^^^^^ +>p : Promise +> : ^^^^^^^^^^^^^^^ + +let o = { +>o : { m1(): Promise; m2(): Promise; m3(): MyPromise; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^ +>{ async m1() { }, async m2(): Promise { }, async m3(): MyPromise { }} : { m1(): Promise; m2(): Promise; m3(): MyPromise; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^ + + async m1() { }, +>m1 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + + async m2(): Promise { }, +>m2 : () => Promise +> : ^^^^^^ + + async m3(): MyPromise { } +>m3 : () => MyPromise +> : ^^^^^^ + +}; + +class C { +>C : C +> : ^ + + async m1() { } +>m1 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + + async m2(): Promise { } +>m2 : () => Promise +> : ^^^^^^ + + async m3(): MyPromise { } +>m3 : () => MyPromise +> : ^^^^^^ + + static async m4() { } +>m4 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + + static async m5(): Promise { } +>m5 : () => Promise +> : ^^^^^^ + + static async m6(): MyPromise { } +>m6 : () => MyPromise +> : ^^^^^^ +} + +namespace M { +>M : typeof M +> : ^^^^^^^^ + + export async function f1() { } +>f1 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ +} diff --git a/tests/baselines/reference/asyncAwaitNestedClasses_es5(target=es2015).js b/tests/baselines/reference/asyncAwaitNestedClasses_es5(target=es2015).js new file mode 100644 index 0000000000000..52e101f25d4f4 --- /dev/null +++ b/tests/baselines/reference/asyncAwaitNestedClasses_es5(target=es2015).js @@ -0,0 +1,38 @@ +//// [tests/cases/conformance/async/es5/asyncAwaitNestedClasses_es5.ts] //// + +//// [asyncAwaitNestedClasses_es5.ts] +// https://github.com/Microsoft/TypeScript/issues/20744 +class A { + static B = class B { + static func2(): Promise { + return new Promise((resolve) => { resolve(null); }); + } + static C = class C { + static async func() { + await B.func2(); + } + } + } +} + +A.B.C.func(); + +//// [asyncAwaitNestedClasses_es5.js] +var _a; +// https://github.com/Microsoft/TypeScript/issues/20744 +class A { +} +A.B = (_a = class B { + static func2() { + return new Promise((resolve) => { resolve(null); }); + } + }, + _a.C = class C { + static func() { + return __awaiter(this, void 0, void 0, function* () { + yield _a.func2(); + }); + } + }, + _a); +A.B.C.func(); diff --git a/tests/baselines/reference/asyncAwaitNestedClasses_es5.symbols b/tests/baselines/reference/asyncAwaitNestedClasses_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncAwaitNestedClasses_es5.symbols rename to tests/baselines/reference/asyncAwaitNestedClasses_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncAwaitNestedClasses_es5.types b/tests/baselines/reference/asyncAwaitNestedClasses_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncAwaitNestedClasses_es5.types rename to tests/baselines/reference/asyncAwaitNestedClasses_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncAwaitNestedClasses_es5.js b/tests/baselines/reference/asyncAwaitNestedClasses_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncAwaitNestedClasses_es5.js rename to tests/baselines/reference/asyncAwaitNestedClasses_es5(target=es5).js diff --git a/tests/baselines/reference/asyncAwaitNestedClasses_es5(target=es5).symbols b/tests/baselines/reference/asyncAwaitNestedClasses_es5(target=es5).symbols new file mode 100644 index 0000000000000..e8843e94ccfe9 --- /dev/null +++ b/tests/baselines/reference/asyncAwaitNestedClasses_es5(target=es5).symbols @@ -0,0 +1,45 @@ +//// [tests/cases/conformance/async/es5/asyncAwaitNestedClasses_es5.ts] //// + +=== asyncAwaitNestedClasses_es5.ts === +// https://github.com/Microsoft/TypeScript/issues/20744 +class A { +>A : Symbol(A, Decl(asyncAwaitNestedClasses_es5.ts, 0, 0)) + + static B = class B { +>B : Symbol(A.B, Decl(asyncAwaitNestedClasses_es5.ts, 1, 9)) +>B : Symbol(B, Decl(asyncAwaitNestedClasses_es5.ts, 2, 14)) + + static func2(): Promise { +>func2 : Symbol(B.func2, Decl(asyncAwaitNestedClasses_es5.ts, 2, 24)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + return new Promise((resolve) => { resolve(null); }); +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>resolve : Symbol(resolve, Decl(asyncAwaitNestedClasses_es5.ts, 4, 32)) +>resolve : Symbol(resolve, Decl(asyncAwaitNestedClasses_es5.ts, 4, 32)) + } + static C = class C { +>C : Symbol(B.C, Decl(asyncAwaitNestedClasses_es5.ts, 5, 9)) +>C : Symbol(C, Decl(asyncAwaitNestedClasses_es5.ts, 6, 18)) + + static async func() { +>func : Symbol(C.func, Decl(asyncAwaitNestedClasses_es5.ts, 6, 28)) + + await B.func2(); +>B.func2 : Symbol(B.func2, Decl(asyncAwaitNestedClasses_es5.ts, 2, 24)) +>B : Symbol(B, Decl(asyncAwaitNestedClasses_es5.ts, 2, 14)) +>func2 : Symbol(B.func2, Decl(asyncAwaitNestedClasses_es5.ts, 2, 24)) + } + } + } +} + +A.B.C.func(); +>A.B.C.func : Symbol(C.func, Decl(asyncAwaitNestedClasses_es5.ts, 6, 28)) +>A.B.C : Symbol(B.C, Decl(asyncAwaitNestedClasses_es5.ts, 5, 9)) +>A.B : Symbol(A.B, Decl(asyncAwaitNestedClasses_es5.ts, 1, 9)) +>A : Symbol(A, Decl(asyncAwaitNestedClasses_es5.ts, 0, 0)) +>B : Symbol(A.B, Decl(asyncAwaitNestedClasses_es5.ts, 1, 9)) +>C : Symbol(B.C, Decl(asyncAwaitNestedClasses_es5.ts, 5, 9)) +>func : Symbol(C.func, Decl(asyncAwaitNestedClasses_es5.ts, 6, 28)) + diff --git a/tests/baselines/reference/asyncAwaitNestedClasses_es5(target=es5).types b/tests/baselines/reference/asyncAwaitNestedClasses_es5(target=es5).types new file mode 100644 index 0000000000000..8379addae429a --- /dev/null +++ b/tests/baselines/reference/asyncAwaitNestedClasses_es5(target=es5).types @@ -0,0 +1,80 @@ +//// [tests/cases/conformance/async/es5/asyncAwaitNestedClasses_es5.ts] //// + +=== asyncAwaitNestedClasses_es5.ts === +// https://github.com/Microsoft/TypeScript/issues/20744 +class A { +>A : A +> : ^ + + static B = class B { +>B : typeof B +> : ^^^^^^^^ +>class B { static func2(): Promise { return new Promise((resolve) => { resolve(null); }); } static C = class C { static async func() { await B.func2(); } } } : typeof B +> : ^^^^^^^^ +>B : typeof B +> : ^^^^^^^^ + + static func2(): Promise { +>func2 : () => Promise +> : ^^^^^^ + + return new Promise((resolve) => { resolve(null); }); +>new Promise((resolve) => { resolve(null); }) : Promise +> : ^^^^^^^^^^^^^ +>Promise : PromiseConstructor +> : ^^^^^^^^^^^^^^^^^^ +>(resolve) => { resolve(null); } : (resolve: (value: void | PromiseLike) => void) => void +> : ^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^ +>resolve : (value: void | PromiseLike) => void +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>resolve(null) : void +> : ^^^^ +>resolve : (value: void | PromiseLike) => void +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + } + static C = class C { +>C : typeof C +> : ^^^^^^^^ +>class C { static async func() { await B.func2(); } } : typeof C +> : ^^^^^^^^ +>C : typeof C +> : ^^^^^^^^ + + static async func() { +>func : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + + await B.func2(); +>await B.func2() : void +> : ^^^^ +>B.func2() : Promise +> : ^^^^^^^^^^^^^ +>B.func2 : () => Promise +> : ^^^^^^ +>B : typeof B +> : ^^^^^^^^ +>func2 : () => Promise +> : ^^^^^^ + } + } + } +} + +A.B.C.func(); +>A.B.C.func() : Promise +> : ^^^^^^^^^^^^^ +>A.B.C.func : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ +>A.B.C : typeof C +> : ^^^^^^^^ +>A.B : typeof B +> : ^^^^^^^^ +>A : typeof A +> : ^^^^^^^^ +>B : typeof B +> : ^^^^^^^^ +>C : typeof C +> : ^^^^^^^^ +>func : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + diff --git a/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar(target=es2015).js b/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar(target=es2015).js new file mode 100644 index 0000000000000..e642cb7d3ecef --- /dev/null +++ b/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar(target=es2015).js @@ -0,0 +1,79 @@ +//// [tests/cases/compiler/asyncAwaitWithCapturedBlockScopeVar.ts] //// + +//// [asyncAwaitWithCapturedBlockScopeVar.ts] +async function fn1() { + let ar = []; + for (let i = 0; i < 1; i++) { + await 1; + ar.push(() => i); + } +} + +async function fn2() { + let ar = []; + for (let i = 0; i < 1; i++) { + await 1; + ar.push(() => i); + break; + } +} + +async function fn3() { + let ar = []; + for (let i = 0; i < 1; i++) { + await 1; + ar.push(() => i); + continue; + } +} + +async function fn4(): Promise { + let ar = []; + for (let i = 0; i < 1; i++) { + await 1; + ar.push(() => i); + return 1; + } +} + + +//// [asyncAwaitWithCapturedBlockScopeVar.js] +function fn1() { + return __awaiter(this, void 0, void 0, function* () { + let ar = []; + for (let i = 0; i < 1; i++) { + yield 1; + ar.push(() => i); + } + }); +} +function fn2() { + return __awaiter(this, void 0, void 0, function* () { + let ar = []; + for (let i = 0; i < 1; i++) { + yield 1; + ar.push(() => i); + break; + } + }); +} +function fn3() { + return __awaiter(this, void 0, void 0, function* () { + let ar = []; + for (let i = 0; i < 1; i++) { + yield 1; + ar.push(() => i); + continue; + } + }); +} +function fn4() { + return __awaiter(this, void 0, void 0, function* () { + let ar = []; + for (let i = 0; i < 1; i++) { + yield 1; + ar.push(() => i); + return 1; + } + }); +} diff --git a/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.symbols b/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.symbols rename to tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar(target=es2015).symbols diff --git a/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.types b/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.types rename to tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar(target=es2015).types diff --git a/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.js b/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.js rename to tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar(target=es5).js diff --git a/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar(target=es5).symbols b/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar(target=es5).symbols new file mode 100644 index 0000000000000..ac495b0ee54e4 --- /dev/null +++ b/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar(target=es5).symbols @@ -0,0 +1,90 @@ +//// [tests/cases/compiler/asyncAwaitWithCapturedBlockScopeVar.ts] //// + +=== asyncAwaitWithCapturedBlockScopeVar.ts === +async function fn1() { +>fn1 : Symbol(fn1, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 0, 0)) + + let ar = []; +>ar : Symbol(ar, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 1, 7)) + + for (let i = 0; i < 1; i++) { +>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 2, 12)) +>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 2, 12)) +>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 2, 12)) + + await 1; + ar.push(() => i); +>ar.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) +>ar : Symbol(ar, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 1, 7)) +>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) +>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 2, 12)) + } +} + +async function fn2() { +>fn2 : Symbol(fn2, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 6, 1)) + + let ar = []; +>ar : Symbol(ar, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 9, 7)) + + for (let i = 0; i < 1; i++) { +>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 10, 12)) +>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 10, 12)) +>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 10, 12)) + + await 1; + ar.push(() => i); +>ar.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) +>ar : Symbol(ar, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 9, 7)) +>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) +>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 10, 12)) + + break; + } +} + +async function fn3() { +>fn3 : Symbol(fn3, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 15, 1)) + + let ar = []; +>ar : Symbol(ar, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 18, 7)) + + for (let i = 0; i < 1; i++) { +>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 19, 12)) +>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 19, 12)) +>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 19, 12)) + + await 1; + ar.push(() => i); +>ar.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) +>ar : Symbol(ar, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 18, 7)) +>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) +>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 19, 12)) + + continue; + } +} + +async function fn4(): Promise { +>fn4 : Symbol(fn4, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 24, 1)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + + let ar = []; +>ar : Symbol(ar, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 27, 7)) + + for (let i = 0; i < 1; i++) { +>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 28, 12)) +>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 28, 12)) +>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 28, 12)) + + await 1; + ar.push(() => i); +>ar.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) +>ar : Symbol(ar, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 27, 7)) +>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) +>i : Symbol(i, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 28, 12)) + + return 1; + } +} + diff --git a/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar(target=es5).types b/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar(target=es5).types new file mode 100644 index 0000000000000..8eb9fd04ffec4 --- /dev/null +++ b/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar(target=es5).types @@ -0,0 +1,203 @@ +//// [tests/cases/compiler/asyncAwaitWithCapturedBlockScopeVar.ts] //// + +=== asyncAwaitWithCapturedBlockScopeVar.ts === +async function fn1() { +>fn1 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + + let ar = []; +>ar : any[] +> : ^^^^^ +>[] : undefined[] +> : ^^^^^^^^^^^ + + for (let i = 0; i < 1; i++) { +>i : number +> : ^^^^^^ +>0 : 0 +> : ^ +>i < 1 : boolean +> : ^^^^^^^ +>i : number +> : ^^^^^^ +>1 : 1 +> : ^ +>i++ : number +> : ^^^^^^ +>i : number +> : ^^^^^^ + + await 1; +>await 1 : 1 +> : ^ +>1 : 1 +> : ^ + + ar.push(() => i); +>ar.push(() => i) : number +> : ^^^^^^ +>ar.push : (...items: any[]) => number +> : ^^^^ ^^^^^^^^^^^^ +>ar : any[] +> : ^^^^^ +>push : (...items: any[]) => number +> : ^^^^ ^^^^^^^^^^^^ +>() => i : () => number +> : ^^^^^^^^^^^^ +>i : number +> : ^^^^^^ + } +} + +async function fn2() { +>fn2 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + + let ar = []; +>ar : any[] +> : ^^^^^ +>[] : undefined[] +> : ^^^^^^^^^^^ + + for (let i = 0; i < 1; i++) { +>i : number +> : ^^^^^^ +>0 : 0 +> : ^ +>i < 1 : boolean +> : ^^^^^^^ +>i : number +> : ^^^^^^ +>1 : 1 +> : ^ +>i++ : number +> : ^^^^^^ +>i : number +> : ^^^^^^ + + await 1; +>await 1 : 1 +> : ^ +>1 : 1 +> : ^ + + ar.push(() => i); +>ar.push(() => i) : number +> : ^^^^^^ +>ar.push : (...items: any[]) => number +> : ^^^^ ^^^^^^^^^^^^ +>ar : any[] +> : ^^^^^ +>push : (...items: any[]) => number +> : ^^^^ ^^^^^^^^^^^^ +>() => i : () => number +> : ^^^^^^^^^^^^ +>i : number +> : ^^^^^^ + + break; + } +} + +async function fn3() { +>fn3 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + + let ar = []; +>ar : any[] +> : ^^^^^ +>[] : undefined[] +> : ^^^^^^^^^^^ + + for (let i = 0; i < 1; i++) { +>i : number +> : ^^^^^^ +>0 : 0 +> : ^ +>i < 1 : boolean +> : ^^^^^^^ +>i : number +> : ^^^^^^ +>1 : 1 +> : ^ +>i++ : number +> : ^^^^^^ +>i : number +> : ^^^^^^ + + await 1; +>await 1 : 1 +> : ^ +>1 : 1 +> : ^ + + ar.push(() => i); +>ar.push(() => i) : number +> : ^^^^^^ +>ar.push : (...items: any[]) => number +> : ^^^^ ^^^^^^^^^^^^ +>ar : any[] +> : ^^^^^ +>push : (...items: any[]) => number +> : ^^^^ ^^^^^^^^^^^^ +>() => i : () => number +> : ^^^^^^^^^^^^ +>i : number +> : ^^^^^^ + + continue; + } +} + +async function fn4(): Promise { +>fn4 : () => Promise +> : ^^^^^^ + + let ar = []; +>ar : any[] +> : ^^^^^ +>[] : undefined[] +> : ^^^^^^^^^^^ + + for (let i = 0; i < 1; i++) { +>i : number +> : ^^^^^^ +>0 : 0 +> : ^ +>i < 1 : boolean +> : ^^^^^^^ +>i : number +> : ^^^^^^ +>1 : 1 +> : ^ +>i++ : number +> : ^^^^^^ +>i : number +> : ^^^^^^ + + await 1; +>await 1 : 1 +> : ^ +>1 : 1 +> : ^ + + ar.push(() => i); +>ar.push(() => i) : number +> : ^^^^^^ +>ar.push : (...items: any[]) => number +> : ^^^^ ^^^^^^^^^^^^ +>ar : any[] +> : ^^^^^ +>push : (...items: any[]) => number +> : ^^^^ ^^^^^^^^^^^^ +>() => i : () => number +> : ^^^^^^^^^^^^ +>i : number +> : ^^^^^^ + + return 1; +>1 : 1 +> : ^ + } +} + diff --git a/tests/baselines/reference/asyncAwait_es5(target=es2015).js b/tests/baselines/reference/asyncAwait_es5(target=es2015).js new file mode 100644 index 0000000000000..b54a4c18c0fc4 --- /dev/null +++ b/tests/baselines/reference/asyncAwait_es5(target=es2015).js @@ -0,0 +1,131 @@ +//// [tests/cases/conformance/async/es5/asyncAwait_es5.ts] //// + +//// [asyncAwait_es5.ts] +type MyPromise = Promise; +declare var MyPromise: typeof Promise; +declare var p: Promise; +declare var mp: MyPromise; + +async function f0() { } +async function f1(): Promise { } +async function f3(): MyPromise { } + +let f4 = async function() { } +let f5 = async function(): Promise { } +let f6 = async function(): MyPromise { } + +let f7 = async () => { }; +let f8 = async (): Promise => { }; +let f9 = async (): MyPromise => { }; +let f10 = async () => p; +let f11 = async () => mp; +let f12 = async (): Promise => mp; +let f13 = async (): MyPromise => p; + +let o = { + async m1() { }, + async m2(): Promise { }, + async m3(): MyPromise { } +}; + +class C { + async m1() { } + async m2(): Promise { } + async m3(): MyPromise { } + static async m4() { } + static async m5(): Promise { } + static async m6(): MyPromise { } +} + +namespace M { + export async function f1() { } +} + +async function f14() { + block: { + await 1; + break block; + } +} + +//// [asyncAwait_es5.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +function f0() { + return __awaiter(this, void 0, void 0, function* () { }); +} +function f1() { + return __awaiter(this, void 0, void 0, function* () { }); +} +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* () { }); +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* () { }); + }, + m2() { + return __awaiter(this, void 0, void 0, function* () { }); + }, + m3() { + return __awaiter(this, void 0, void 0, function* () { }); + } +}; +class C { + m1() { + return __awaiter(this, void 0, void 0, function* () { }); + } + m2() { + return __awaiter(this, void 0, void 0, function* () { }); + } + m3() { + return __awaiter(this, void 0, void 0, function* () { }); + } + static m4() { + return __awaiter(this, void 0, void 0, function* () { }); + } + static m5() { + return __awaiter(this, void 0, void 0, function* () { }); + } + static m6() { + return __awaiter(this, void 0, void 0, function* () { }); + } +} +var M; +(function (M) { + function f1() { + return __awaiter(this, void 0, void 0, function* () { }); + } + M.f1 = f1; +})(M || (M = {})); +function f14() { + return __awaiter(this, void 0, void 0, function* () { + block: { + yield 1; + break block; + } + }); +} diff --git a/tests/baselines/reference/asyncAwait_es5.symbols b/tests/baselines/reference/asyncAwait_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncAwait_es5.symbols rename to tests/baselines/reference/asyncAwait_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncAwait_es5.types b/tests/baselines/reference/asyncAwait_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncAwait_es5.types rename to tests/baselines/reference/asyncAwait_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncAwait_es5.js b/tests/baselines/reference/asyncAwait_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncAwait_es5.js rename to tests/baselines/reference/asyncAwait_es5(target=es5).js diff --git a/tests/baselines/reference/asyncAwait_es5(target=es5).symbols b/tests/baselines/reference/asyncAwait_es5(target=es5).symbols new file mode 100644 index 0000000000000..7a19ce8a26fa4 --- /dev/null +++ b/tests/baselines/reference/asyncAwait_es5(target=es5).symbols @@ -0,0 +1,129 @@ +//// [tests/cases/conformance/async/es5/asyncAwait_es5.ts] //// + +=== asyncAwait_es5.ts === +type MyPromise = Promise; +>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es5.ts, 0, 0), Decl(asyncAwait_es5.ts, 1, 11)) +>T : Symbol(T, Decl(asyncAwait_es5.ts, 0, 15)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>T : Symbol(T, Decl(asyncAwait_es5.ts, 0, 15)) + +declare var MyPromise: typeof Promise; +>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es5.ts, 0, 0), Decl(asyncAwait_es5.ts, 1, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +declare var p: Promise; +>p : Symbol(p, Decl(asyncAwait_es5.ts, 2, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +declare var mp: MyPromise; +>mp : Symbol(mp, Decl(asyncAwait_es5.ts, 3, 11)) +>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es5.ts, 0, 0), Decl(asyncAwait_es5.ts, 1, 11)) + +async function f0() { } +>f0 : Symbol(f0, Decl(asyncAwait_es5.ts, 3, 34)) + +async function f1(): Promise { } +>f1 : Symbol(f1, Decl(asyncAwait_es5.ts, 5, 23)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +async function f3(): MyPromise { } +>f3 : Symbol(f3, Decl(asyncAwait_es5.ts, 6, 38)) +>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es5.ts, 0, 0), Decl(asyncAwait_es5.ts, 1, 11)) + +let f4 = async function() { } +>f4 : Symbol(f4, Decl(asyncAwait_es5.ts, 9, 3)) + +let f5 = async function(): Promise { } +>f5 : Symbol(f5, Decl(asyncAwait_es5.ts, 10, 3)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +let f6 = async function(): MyPromise { } +>f6 : Symbol(f6, Decl(asyncAwait_es5.ts, 11, 3)) +>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es5.ts, 0, 0), Decl(asyncAwait_es5.ts, 1, 11)) + +let f7 = async () => { }; +>f7 : Symbol(f7, Decl(asyncAwait_es5.ts, 13, 3)) + +let f8 = async (): Promise => { }; +>f8 : Symbol(f8, Decl(asyncAwait_es5.ts, 14, 3)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +let f9 = async (): MyPromise => { }; +>f9 : Symbol(f9, Decl(asyncAwait_es5.ts, 15, 3)) +>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es5.ts, 0, 0), Decl(asyncAwait_es5.ts, 1, 11)) + +let f10 = async () => p; +>f10 : Symbol(f10, Decl(asyncAwait_es5.ts, 16, 3)) +>p : Symbol(p, Decl(asyncAwait_es5.ts, 2, 11)) + +let f11 = async () => mp; +>f11 : Symbol(f11, Decl(asyncAwait_es5.ts, 17, 3)) +>mp : Symbol(mp, Decl(asyncAwait_es5.ts, 3, 11)) + +let f12 = async (): Promise => mp; +>f12 : Symbol(f12, Decl(asyncAwait_es5.ts, 18, 3)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>mp : Symbol(mp, Decl(asyncAwait_es5.ts, 3, 11)) + +let f13 = async (): MyPromise => p; +>f13 : Symbol(f13, Decl(asyncAwait_es5.ts, 19, 3)) +>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es5.ts, 0, 0), Decl(asyncAwait_es5.ts, 1, 11)) +>p : Symbol(p, Decl(asyncAwait_es5.ts, 2, 11)) + +let o = { +>o : Symbol(o, Decl(asyncAwait_es5.ts, 21, 3)) + + async m1() { }, +>m1 : Symbol(m1, Decl(asyncAwait_es5.ts, 21, 9)) + + async m2(): Promise { }, +>m2 : Symbol(m2, Decl(asyncAwait_es5.ts, 22, 16)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + async m3(): MyPromise { } +>m3 : Symbol(m3, Decl(asyncAwait_es5.ts, 23, 31)) +>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es5.ts, 0, 0), Decl(asyncAwait_es5.ts, 1, 11)) + +}; + +class C { +>C : Symbol(C, Decl(asyncAwait_es5.ts, 25, 2)) + + async m1() { } +>m1 : Symbol(C.m1, Decl(asyncAwait_es5.ts, 27, 9)) + + async m2(): Promise { } +>m2 : Symbol(C.m2, Decl(asyncAwait_es5.ts, 28, 15)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + async m3(): MyPromise { } +>m3 : Symbol(C.m3, Decl(asyncAwait_es5.ts, 29, 30)) +>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es5.ts, 0, 0), Decl(asyncAwait_es5.ts, 1, 11)) + + static async m4() { } +>m4 : Symbol(C.m4, Decl(asyncAwait_es5.ts, 30, 32)) + + static async m5(): Promise { } +>m5 : Symbol(C.m5, Decl(asyncAwait_es5.ts, 31, 22)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + static async m6(): MyPromise { } +>m6 : Symbol(C.m6, Decl(asyncAwait_es5.ts, 32, 37)) +>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es5.ts, 0, 0), Decl(asyncAwait_es5.ts, 1, 11)) +} + +namespace M { +>M : Symbol(M, Decl(asyncAwait_es5.ts, 34, 1)) + + export async function f1() { } +>f1 : Symbol(f1, Decl(asyncAwait_es5.ts, 36, 13)) +} + +async function f14() { +>f14 : Symbol(f14, Decl(asyncAwait_es5.ts, 38, 1)) + + block: { + await 1; + break block; + } +} diff --git a/tests/baselines/reference/asyncAwait_es5(target=es5).types b/tests/baselines/reference/asyncAwait_es5(target=es5).types new file mode 100644 index 0000000000000..36850c32fdda2 --- /dev/null +++ b/tests/baselines/reference/asyncAwait_es5(target=es5).types @@ -0,0 +1,178 @@ +//// [tests/cases/conformance/async/es5/asyncAwait_es5.ts] //// + +=== asyncAwait_es5.ts === +type MyPromise = Promise; +>MyPromise : MyPromise +> : ^^^^^^^^^^^^ + +declare var MyPromise: typeof Promise; +>MyPromise : PromiseConstructor +> : ^^^^^^^^^^^^^^^^^^ +>Promise : PromiseConstructor +> : ^^^^^^^^^^^^^^^^^^ + +declare var p: Promise; +>p : Promise +> : ^^^^^^^^^^^^^^^ + +declare var mp: MyPromise; +>mp : MyPromise +> : ^^^^^^^^^^^^^^^^^ + +async function f0() { } +>f0 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + +async function f1(): Promise { } +>f1 : () => Promise +> : ^^^^^^ + +async function f3(): MyPromise { } +>f3 : () => MyPromise +> : ^^^^^^ + +let f4 = async function() { } +>f4 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ +>async function() { } : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + +let f5 = async function(): Promise { } +>f5 : () => Promise +> : ^^^^^^ +>async function(): Promise { } : () => Promise +> : ^^^^^^ + +let f6 = async function(): MyPromise { } +>f6 : () => MyPromise +> : ^^^^^^ +>async function(): MyPromise { } : () => MyPromise +> : ^^^^^^ + +let f7 = async () => { }; +>f7 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ +>async () => { } : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + +let f8 = async (): Promise => { }; +>f8 : () => Promise +> : ^^^^^^ +>async (): Promise => { } : () => Promise +> : ^^^^^^ + +let f9 = async (): MyPromise => { }; +>f9 : () => MyPromise +> : ^^^^^^ +>async (): MyPromise => { } : () => MyPromise +> : ^^^^^^ + +let f10 = async () => p; +>f10 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^^^ +>async () => p : () => Promise +> : ^^^^^^^^^^^^^^^^^^^^^ +>p : Promise +> : ^^^^^^^^^^^^^^^ + +let f11 = async () => mp; +>f11 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^^^ +>async () => mp : () => Promise +> : ^^^^^^^^^^^^^^^^^^^^^ +>mp : MyPromise +> : ^^^^^^^^^^^^^^^^^ + +let f12 = async (): Promise => mp; +>f12 : () => Promise +> : ^^^^^^ +>async (): Promise => mp : () => Promise +> : ^^^^^^ +>mp : MyPromise +> : ^^^^^^^^^^^^^^^^^ + +let f13 = async (): MyPromise => p; +>f13 : () => MyPromise +> : ^^^^^^ +>async (): MyPromise => p : () => MyPromise +> : ^^^^^^ +>p : Promise +> : ^^^^^^^^^^^^^^^ + +let o = { +>o : { m1(): Promise; m2(): Promise; m3(): MyPromise; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^ +>{ async m1() { }, async m2(): Promise { }, async m3(): MyPromise { }} : { m1(): Promise; m2(): Promise; m3(): MyPromise; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^ + + async m1() { }, +>m1 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + + async m2(): Promise { }, +>m2 : () => Promise +> : ^^^^^^ + + async m3(): MyPromise { } +>m3 : () => MyPromise +> : ^^^^^^ + +}; + +class C { +>C : C +> : ^ + + async m1() { } +>m1 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + + async m2(): Promise { } +>m2 : () => Promise +> : ^^^^^^ + + async m3(): MyPromise { } +>m3 : () => MyPromise +> : ^^^^^^ + + static async m4() { } +>m4 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + + static async m5(): Promise { } +>m5 : () => Promise +> : ^^^^^^ + + static async m6(): MyPromise { } +>m6 : () => MyPromise +> : ^^^^^^ +} + +namespace M { +>M : typeof M +> : ^^^^^^^^ + + export async function f1() { } +>f1 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ +} + +async function f14() { +>f14 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + + block: { +>block : any +> : ^^^ + + await 1; +>await 1 : 1 +> : ^ +>1 : 1 +> : ^ + + break block; +>block : any +> : ^^^ + } +} diff --git a/tests/baselines/reference/asyncClass_es5.errors.txt b/tests/baselines/reference/asyncClass_es5(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/asyncClass_es5.errors.txt rename to tests/baselines/reference/asyncClass_es5(target=es2015).errors.txt diff --git a/tests/baselines/reference/asyncClass_es5(target=es2015).js b/tests/baselines/reference/asyncClass_es5(target=es2015).js new file mode 100644 index 0000000000000..709734d55b28f --- /dev/null +++ b/tests/baselines/reference/asyncClass_es5(target=es2015).js @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/async/es5/asyncClass_es5.ts] //// + +//// [asyncClass_es5.ts] +async class C { +} + +//// [asyncClass_es5.js] +class C { +} diff --git a/tests/baselines/reference/asyncClass_es5.symbols b/tests/baselines/reference/asyncClass_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncClass_es5.symbols rename to tests/baselines/reference/asyncClass_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncClass_es5.types b/tests/baselines/reference/asyncClass_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncClass_es5.types rename to tests/baselines/reference/asyncClass_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncClass_es5(target=es5).errors.txt b/tests/baselines/reference/asyncClass_es5(target=es5).errors.txt new file mode 100644 index 0000000000000..214f940474879 --- /dev/null +++ b/tests/baselines/reference/asyncClass_es5(target=es5).errors.txt @@ -0,0 +1,8 @@ +asyncClass_es5.ts(1,1): error TS1042: 'async' modifier cannot be used here. + + +==== asyncClass_es5.ts (1 errors) ==== + async class C { + ~~~~~ +!!! error TS1042: 'async' modifier cannot be used here. + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncClass_es5.js b/tests/baselines/reference/asyncClass_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncClass_es5.js rename to tests/baselines/reference/asyncClass_es5(target=es5).js diff --git a/tests/baselines/reference/asyncClass_es5(target=es5).symbols b/tests/baselines/reference/asyncClass_es5(target=es5).symbols new file mode 100644 index 0000000000000..544c310e0e667 --- /dev/null +++ b/tests/baselines/reference/asyncClass_es5(target=es5).symbols @@ -0,0 +1,6 @@ +//// [tests/cases/conformance/async/es5/asyncClass_es5.ts] //// + +=== asyncClass_es5.ts === +async class C { +>C : Symbol(C, Decl(asyncClass_es5.ts, 0, 0)) +} diff --git a/tests/baselines/reference/asyncClass_es5(target=es5).types b/tests/baselines/reference/asyncClass_es5(target=es5).types new file mode 100644 index 0000000000000..8864c57e7e668 --- /dev/null +++ b/tests/baselines/reference/asyncClass_es5(target=es5).types @@ -0,0 +1,7 @@ +//// [tests/cases/conformance/async/es5/asyncClass_es5.ts] //// + +=== asyncClass_es5.ts === +async class C { +>C : C +> : ^ +} diff --git a/tests/baselines/reference/asyncConstructor_es5.errors.txt b/tests/baselines/reference/asyncConstructor_es5(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/asyncConstructor_es5.errors.txt rename to tests/baselines/reference/asyncConstructor_es5(target=es2015).errors.txt diff --git a/tests/baselines/reference/asyncConstructor_es5(target=es2015).js b/tests/baselines/reference/asyncConstructor_es5(target=es2015).js new file mode 100644 index 0000000000000..369b2efb83580 --- /dev/null +++ b/tests/baselines/reference/asyncConstructor_es5(target=es2015).js @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/async/es5/asyncConstructor_es5.ts] //// + +//// [asyncConstructor_es5.ts] +class C { + async constructor() { + } +} + +//// [asyncConstructor_es5.js] +class C { + constructor() { + } +} diff --git a/tests/baselines/reference/asyncConstructor_es5.symbols b/tests/baselines/reference/asyncConstructor_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncConstructor_es5.symbols rename to tests/baselines/reference/asyncConstructor_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncConstructor_es5.types b/tests/baselines/reference/asyncConstructor_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncConstructor_es5.types rename to tests/baselines/reference/asyncConstructor_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncConstructor_es5(target=es5).errors.txt b/tests/baselines/reference/asyncConstructor_es5(target=es5).errors.txt new file mode 100644 index 0000000000000..5b56f8c1d8892 --- /dev/null +++ b/tests/baselines/reference/asyncConstructor_es5(target=es5).errors.txt @@ -0,0 +1,10 @@ +asyncConstructor_es5.ts(2,3): error TS1089: 'async' modifier cannot appear on a constructor declaration. + + +==== asyncConstructor_es5.ts (1 errors) ==== + class C { + async constructor() { + ~~~~~ +!!! error TS1089: 'async' modifier cannot appear on a constructor declaration. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncConstructor_es5.js b/tests/baselines/reference/asyncConstructor_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncConstructor_es5.js rename to tests/baselines/reference/asyncConstructor_es5(target=es5).js diff --git a/tests/baselines/reference/asyncConstructor_es5(target=es5).symbols b/tests/baselines/reference/asyncConstructor_es5(target=es5).symbols new file mode 100644 index 0000000000000..131640ebb9364 --- /dev/null +++ b/tests/baselines/reference/asyncConstructor_es5(target=es5).symbols @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/async/es5/asyncConstructor_es5.ts] //// + +=== asyncConstructor_es5.ts === +class C { +>C : Symbol(C, Decl(asyncConstructor_es5.ts, 0, 0)) + + async constructor() { + } +} diff --git a/tests/baselines/reference/asyncConstructor_es5(target=es5).types b/tests/baselines/reference/asyncConstructor_es5(target=es5).types new file mode 100644 index 0000000000000..f6fa94e680788 --- /dev/null +++ b/tests/baselines/reference/asyncConstructor_es5(target=es5).types @@ -0,0 +1,10 @@ +//// [tests/cases/conformance/async/es5/asyncConstructor_es5.ts] //// + +=== asyncConstructor_es5.ts === +class C { +>C : C +> : ^ + + async constructor() { + } +} diff --git a/tests/baselines/reference/asyncDeclare_es5.errors.txt b/tests/baselines/reference/asyncDeclare_es5(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/asyncDeclare_es5.errors.txt rename to tests/baselines/reference/asyncDeclare_es5(target=es2015).errors.txt diff --git a/tests/baselines/reference/asyncDeclare_es5.js b/tests/baselines/reference/asyncDeclare_es5(target=es2015).js similarity index 100% rename from tests/baselines/reference/asyncDeclare_es5.js rename to tests/baselines/reference/asyncDeclare_es5(target=es2015).js diff --git a/tests/baselines/reference/asyncDeclare_es5.symbols b/tests/baselines/reference/asyncDeclare_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncDeclare_es5.symbols rename to tests/baselines/reference/asyncDeclare_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncDeclare_es5.types b/tests/baselines/reference/asyncDeclare_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncDeclare_es5.types rename to tests/baselines/reference/asyncDeclare_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncDeclare_es5(target=es5).errors.txt b/tests/baselines/reference/asyncDeclare_es5(target=es5).errors.txt new file mode 100644 index 0000000000000..3aeac405b6f78 --- /dev/null +++ b/tests/baselines/reference/asyncDeclare_es5(target=es5).errors.txt @@ -0,0 +1,7 @@ +asyncDeclare_es5.ts(1,9): error TS1040: 'async' modifier cannot be used in an ambient context. + + +==== asyncDeclare_es5.ts (1 errors) ==== + declare async function foo(): Promise; + ~~~~~ +!!! error TS1040: 'async' modifier cannot be used in an ambient context. \ No newline at end of file diff --git a/tests/baselines/reference/asyncDeclare_es5(target=es5).js b/tests/baselines/reference/asyncDeclare_es5(target=es5).js new file mode 100644 index 0000000000000..ee2b01033a50f --- /dev/null +++ b/tests/baselines/reference/asyncDeclare_es5(target=es5).js @@ -0,0 +1,6 @@ +//// [tests/cases/conformance/async/es5/asyncDeclare_es5.ts] //// + +//// [asyncDeclare_es5.ts] +declare async function foo(): Promise; + +//// [asyncDeclare_es5.js] diff --git a/tests/baselines/reference/asyncDeclare_es5(target=es5).symbols b/tests/baselines/reference/asyncDeclare_es5(target=es5).symbols new file mode 100644 index 0000000000000..3b42f02b274ef --- /dev/null +++ b/tests/baselines/reference/asyncDeclare_es5(target=es5).symbols @@ -0,0 +1,7 @@ +//// [tests/cases/conformance/async/es5/asyncDeclare_es5.ts] //// + +=== asyncDeclare_es5.ts === +declare async function foo(): Promise; +>foo : Symbol(foo, Decl(asyncDeclare_es5.ts, 0, 0)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + diff --git a/tests/baselines/reference/asyncDeclare_es5(target=es5).types b/tests/baselines/reference/asyncDeclare_es5(target=es5).types new file mode 100644 index 0000000000000..4d0991f9b0c36 --- /dev/null +++ b/tests/baselines/reference/asyncDeclare_es5(target=es5).types @@ -0,0 +1,7 @@ +//// [tests/cases/conformance/async/es5/asyncDeclare_es5.ts] //// + +=== asyncDeclare_es5.ts === +declare async function foo(): Promise; +>foo : () => Promise +> : ^^^^^^ + diff --git a/tests/baselines/reference/asyncEnum_es5.errors.txt b/tests/baselines/reference/asyncEnum_es5(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/asyncEnum_es5.errors.txt rename to tests/baselines/reference/asyncEnum_es5(target=es2015).errors.txt diff --git a/tests/baselines/reference/asyncEnum_es5.js b/tests/baselines/reference/asyncEnum_es5(target=es2015).js similarity index 100% rename from tests/baselines/reference/asyncEnum_es5.js rename to tests/baselines/reference/asyncEnum_es5(target=es2015).js diff --git a/tests/baselines/reference/asyncEnum_es5.symbols b/tests/baselines/reference/asyncEnum_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncEnum_es5.symbols rename to tests/baselines/reference/asyncEnum_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncEnum_es5.types b/tests/baselines/reference/asyncEnum_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncEnum_es5.types rename to tests/baselines/reference/asyncEnum_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncEnum_es5(target=es5).errors.txt b/tests/baselines/reference/asyncEnum_es5(target=es5).errors.txt new file mode 100644 index 0000000000000..fb944a716d817 --- /dev/null +++ b/tests/baselines/reference/asyncEnum_es5(target=es5).errors.txt @@ -0,0 +1,9 @@ +asyncEnum_es5.ts(1,1): error TS1042: 'async' modifier cannot be used here. + + +==== asyncEnum_es5.ts (1 errors) ==== + async enum E { + ~~~~~ +!!! error TS1042: 'async' modifier cannot be used here. + Value + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncEnum_es5(target=es5).js b/tests/baselines/reference/asyncEnum_es5(target=es5).js new file mode 100644 index 0000000000000..abeacf3871a8c --- /dev/null +++ b/tests/baselines/reference/asyncEnum_es5(target=es5).js @@ -0,0 +1,12 @@ +//// [tests/cases/conformance/async/es5/asyncEnum_es5.ts] //// + +//// [asyncEnum_es5.ts] +async enum E { + Value +} + +//// [asyncEnum_es5.js] +var E; +(function (E) { + E[E["Value"] = 0] = "Value"; +})(E || (E = {})); diff --git a/tests/baselines/reference/asyncEnum_es5(target=es5).symbols b/tests/baselines/reference/asyncEnum_es5(target=es5).symbols new file mode 100644 index 0000000000000..82ad1fc5a9435 --- /dev/null +++ b/tests/baselines/reference/asyncEnum_es5(target=es5).symbols @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/async/es5/asyncEnum_es5.ts] //// + +=== asyncEnum_es5.ts === +async enum E { +>E : Symbol(E, Decl(asyncEnum_es5.ts, 0, 0)) + + Value +>Value : Symbol(E.Value, Decl(asyncEnum_es5.ts, 0, 14)) +} diff --git a/tests/baselines/reference/asyncEnum_es5(target=es5).types b/tests/baselines/reference/asyncEnum_es5(target=es5).types new file mode 100644 index 0000000000000..50d06585485b6 --- /dev/null +++ b/tests/baselines/reference/asyncEnum_es5(target=es5).types @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/async/es5/asyncEnum_es5.ts] //// + +=== asyncEnum_es5.ts === +async enum E { +>E : E +> : ^ + + Value +>Value : E.Value +> : ^^^^^^^ +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration10_es5.errors.txt b/tests/baselines/reference/asyncFunctionDeclaration10_es5(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration10_es5.errors.txt rename to tests/baselines/reference/asyncFunctionDeclaration10_es5(target=es2015).errors.txt diff --git a/tests/baselines/reference/asyncFunctionDeclaration10_es5(target=es2015).js b/tests/baselines/reference/asyncFunctionDeclaration10_es5(target=es2015).js new file mode 100644 index 0000000000000..040435199ce52 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration10_es5(target=es2015).js @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration10_es5.ts] //// + +//// [asyncFunctionDeclaration10_es5.ts] +async function foo(a = await => await): Promise { +} + +//// [asyncFunctionDeclaration10_es5.js] +function foo() { + return __awaiter(this, arguments, void 0, function* (a = yield , await) { + }); +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration10_es5.symbols b/tests/baselines/reference/asyncFunctionDeclaration10_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration10_es5.symbols rename to tests/baselines/reference/asyncFunctionDeclaration10_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncFunctionDeclaration10_es5.types b/tests/baselines/reference/asyncFunctionDeclaration10_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration10_es5.types rename to tests/baselines/reference/asyncFunctionDeclaration10_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncFunctionDeclaration10_es5(target=es5).errors.txt b/tests/baselines/reference/asyncFunctionDeclaration10_es5(target=es5).errors.txt new file mode 100644 index 0000000000000..6fc157649dd7c --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration10_es5(target=es5).errors.txt @@ -0,0 +1,11 @@ +asyncFunctionDeclaration10_es5.ts(1,24): error TS2524: 'await' expressions cannot be used in a parameter initializer. +asyncFunctionDeclaration10_es5.ts(1,30): error TS1109: Expression expected. + + +==== asyncFunctionDeclaration10_es5.ts (2 errors) ==== + async function foo(a = await => await): Promise { + ~~~~~ +!!! error TS2524: 'await' expressions cannot be used in a parameter initializer. + ~~ +!!! error TS1109: Expression expected. + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncFunctionDeclaration10_es5.js b/tests/baselines/reference/asyncFunctionDeclaration10_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration10_es5.js rename to tests/baselines/reference/asyncFunctionDeclaration10_es5(target=es5).js diff --git a/tests/baselines/reference/asyncFunctionDeclaration10_es5(target=es5).symbols b/tests/baselines/reference/asyncFunctionDeclaration10_es5(target=es5).symbols new file mode 100644 index 0000000000000..34bba7aeafc8b --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration10_es5(target=es5).symbols @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration10_es5.ts] //// + +=== asyncFunctionDeclaration10_es5.ts === +async function foo(a = await => await): Promise { +>foo : Symbol(foo, Decl(asyncFunctionDeclaration10_es5.ts, 0, 0)) +>a : Symbol(a, Decl(asyncFunctionDeclaration10_es5.ts, 0, 19)) +>await : Symbol(await, Decl(asyncFunctionDeclaration10_es5.ts, 0, 31)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration10_es5(target=es5).types b/tests/baselines/reference/asyncFunctionDeclaration10_es5(target=es5).types new file mode 100644 index 0000000000000..c5cbb4d24f75a --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration10_es5(target=es5).types @@ -0,0 +1,15 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration10_es5.ts] //// + +=== asyncFunctionDeclaration10_es5.ts === +async function foo(a = await => await): Promise { +>foo : (a: any, await: any) => Promise +> : ^ ^^^^^^^ ^^^^^^^^^^ +>a : any +> : ^^^ +>await : any +> : ^^^ +> : any +> : ^^^ +>await : any +> : ^^^ +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration11_es5(target=es2015).js b/tests/baselines/reference/asyncFunctionDeclaration11_es5(target=es2015).js new file mode 100644 index 0000000000000..163a34d8e32f2 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration11_es5(target=es2015).js @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration11_es5.ts] //// + +//// [asyncFunctionDeclaration11_es5.ts] +async function await(): Promise { +} + +//// [asyncFunctionDeclaration11_es5.js] +function await() { + return __awaiter(this, void 0, void 0, function* () { + }); +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration11_es5.symbols b/tests/baselines/reference/asyncFunctionDeclaration11_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration11_es5.symbols rename to tests/baselines/reference/asyncFunctionDeclaration11_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncFunctionDeclaration11_es5.types b/tests/baselines/reference/asyncFunctionDeclaration11_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration11_es5.types rename to tests/baselines/reference/asyncFunctionDeclaration11_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncFunctionDeclaration11_es5.js b/tests/baselines/reference/asyncFunctionDeclaration11_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration11_es5.js rename to tests/baselines/reference/asyncFunctionDeclaration11_es5(target=es5).js diff --git a/tests/baselines/reference/asyncFunctionDeclaration11_es5(target=es5).symbols b/tests/baselines/reference/asyncFunctionDeclaration11_es5(target=es5).symbols new file mode 100644 index 0000000000000..a10b56d0574ea --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration11_es5(target=es5).symbols @@ -0,0 +1,7 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration11_es5.ts] //// + +=== asyncFunctionDeclaration11_es5.ts === +async function await(): Promise { +>await : Symbol(await, Decl(asyncFunctionDeclaration11_es5.ts, 0, 0)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration11_es5(target=es5).types b/tests/baselines/reference/asyncFunctionDeclaration11_es5(target=es5).types new file mode 100644 index 0000000000000..1e68f080df943 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration11_es5(target=es5).types @@ -0,0 +1,7 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration11_es5.ts] //// + +=== asyncFunctionDeclaration11_es5.ts === +async function await(): Promise { +>await : () => Promise +> : ^^^^^^ +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration12_es5.errors.txt b/tests/baselines/reference/asyncFunctionDeclaration12_es5(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration12_es5.errors.txt rename to tests/baselines/reference/asyncFunctionDeclaration12_es5(target=es2015).errors.txt diff --git a/tests/baselines/reference/asyncFunctionDeclaration12_es5(target=es2015).js b/tests/baselines/reference/asyncFunctionDeclaration12_es5(target=es2015).js new file mode 100644 index 0000000000000..1eb788619a5f9 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration12_es5(target=es2015).js @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration12_es5.ts] //// + +//// [asyncFunctionDeclaration12_es5.ts] +var v = async function await(): Promise { } + +//// [asyncFunctionDeclaration12_es5.js] +var v = function await() { + return __awaiter(this, void 0, void 0, function* () { }); +}; diff --git a/tests/baselines/reference/asyncFunctionDeclaration12_es5.symbols b/tests/baselines/reference/asyncFunctionDeclaration12_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration12_es5.symbols rename to tests/baselines/reference/asyncFunctionDeclaration12_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncFunctionDeclaration12_es5.types b/tests/baselines/reference/asyncFunctionDeclaration12_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration12_es5.types rename to tests/baselines/reference/asyncFunctionDeclaration12_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncFunctionDeclaration12_es5(target=es5).errors.txt b/tests/baselines/reference/asyncFunctionDeclaration12_es5(target=es5).errors.txt new file mode 100644 index 0000000000000..f6866f5bcaf7b --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration12_es5(target=es5).errors.txt @@ -0,0 +1,7 @@ +asyncFunctionDeclaration12_es5.ts(1,24): error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. + + +==== asyncFunctionDeclaration12_es5.ts (1 errors) ==== + var v = async function await(): Promise { } + ~~~~~ +!!! error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. \ No newline at end of file diff --git a/tests/baselines/reference/asyncFunctionDeclaration12_es5.js b/tests/baselines/reference/asyncFunctionDeclaration12_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration12_es5.js rename to tests/baselines/reference/asyncFunctionDeclaration12_es5(target=es5).js diff --git a/tests/baselines/reference/asyncFunctionDeclaration12_es5(target=es5).symbols b/tests/baselines/reference/asyncFunctionDeclaration12_es5(target=es5).symbols new file mode 100644 index 0000000000000..8b27ec5f04258 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration12_es5(target=es5).symbols @@ -0,0 +1,8 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration12_es5.ts] //// + +=== asyncFunctionDeclaration12_es5.ts === +var v = async function await(): Promise { } +>v : Symbol(v, Decl(asyncFunctionDeclaration12_es5.ts, 0, 3)) +>await : Symbol(await, Decl(asyncFunctionDeclaration12_es5.ts, 0, 7)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + diff --git a/tests/baselines/reference/asyncFunctionDeclaration12_es5(target=es5).types b/tests/baselines/reference/asyncFunctionDeclaration12_es5(target=es5).types new file mode 100644 index 0000000000000..70020508824a2 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration12_es5(target=es5).types @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration12_es5.ts] //// + +=== asyncFunctionDeclaration12_es5.ts === +var v = async function await(): Promise { } +>v : () => Promise +> : ^^^^^^ +>async function await(): Promise { } : () => Promise +> : ^^^^^^ +>await : () => Promise +> : ^^^^^^ + diff --git a/tests/baselines/reference/asyncFunctionDeclaration13_es5.errors.txt b/tests/baselines/reference/asyncFunctionDeclaration13_es5(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration13_es5.errors.txt rename to tests/baselines/reference/asyncFunctionDeclaration13_es5(target=es2015).errors.txt diff --git a/tests/baselines/reference/asyncFunctionDeclaration13_es5(target=es2015).js b/tests/baselines/reference/asyncFunctionDeclaration13_es5(target=es2015).js new file mode 100644 index 0000000000000..28708c96b746d --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration13_es5(target=es2015).js @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration13_es5.ts] //// + +//// [asyncFunctionDeclaration13_es5.ts] +async function foo(): Promise { + // Legal to use 'await' in a type context. + var v: await; +} + + +//// [asyncFunctionDeclaration13_es5.js] +function foo() { + return __awaiter(this, void 0, void 0, function* () { + // Legal to use 'await' in a type context. + var v; + }); +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration13_es5.symbols b/tests/baselines/reference/asyncFunctionDeclaration13_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration13_es5.symbols rename to tests/baselines/reference/asyncFunctionDeclaration13_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncFunctionDeclaration13_es5.types b/tests/baselines/reference/asyncFunctionDeclaration13_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration13_es5.types rename to tests/baselines/reference/asyncFunctionDeclaration13_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncFunctionDeclaration13_es5(target=es5).errors.txt b/tests/baselines/reference/asyncFunctionDeclaration13_es5(target=es5).errors.txt new file mode 100644 index 0000000000000..b3138f28704d1 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration13_es5(target=es5).errors.txt @@ -0,0 +1,11 @@ +asyncFunctionDeclaration13_es5.ts(3,11): error TS2552: Cannot find name 'await'. Did you mean 'Awaited'? + + +==== asyncFunctionDeclaration13_es5.ts (1 errors) ==== + async function foo(): Promise { + // Legal to use 'await' in a type context. + var v: await; + ~~~~~ +!!! error TS2552: Cannot find name 'await'. Did you mean 'Awaited'? + } + \ No newline at end of file diff --git a/tests/baselines/reference/asyncFunctionDeclaration13_es5.js b/tests/baselines/reference/asyncFunctionDeclaration13_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration13_es5.js rename to tests/baselines/reference/asyncFunctionDeclaration13_es5(target=es5).js diff --git a/tests/baselines/reference/asyncFunctionDeclaration13_es5(target=es5).symbols b/tests/baselines/reference/asyncFunctionDeclaration13_es5(target=es5).symbols new file mode 100644 index 0000000000000..12d18fdd19b74 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration13_es5(target=es5).symbols @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration13_es5.ts] //// + +=== asyncFunctionDeclaration13_es5.ts === +async function foo(): Promise { +>foo : Symbol(foo, Decl(asyncFunctionDeclaration13_es5.ts, 0, 0)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + // Legal to use 'await' in a type context. + var v: await; +>v : Symbol(v, Decl(asyncFunctionDeclaration13_es5.ts, 2, 6)) +>await : Symbol(await) +} + diff --git a/tests/baselines/reference/asyncFunctionDeclaration13_es5(target=es5).types b/tests/baselines/reference/asyncFunctionDeclaration13_es5(target=es5).types new file mode 100644 index 0000000000000..2fac5a749b4b1 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration13_es5(target=es5).types @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration13_es5.ts] //// + +=== asyncFunctionDeclaration13_es5.ts === +async function foo(): Promise { +>foo : () => Promise +> : ^^^^^^ + + // Legal to use 'await' in a type context. + var v: await; +>v : await +> : ^^^^^ +} + diff --git a/tests/baselines/reference/asyncFunctionDeclaration14_es5(target=es2015).js b/tests/baselines/reference/asyncFunctionDeclaration14_es5(target=es2015).js new file mode 100644 index 0000000000000..226249ed9db52 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration14_es5(target=es2015).js @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration14_es5.ts] //// + +//// [asyncFunctionDeclaration14_es5.ts] +async function foo(): Promise { + return; +} + +//// [asyncFunctionDeclaration14_es5.js] +function foo() { + return __awaiter(this, void 0, void 0, function* () { + return; + }); +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration14_es5.symbols b/tests/baselines/reference/asyncFunctionDeclaration14_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration14_es5.symbols rename to tests/baselines/reference/asyncFunctionDeclaration14_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncFunctionDeclaration14_es5.types b/tests/baselines/reference/asyncFunctionDeclaration14_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration14_es5.types rename to tests/baselines/reference/asyncFunctionDeclaration14_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncFunctionDeclaration14_es5.js b/tests/baselines/reference/asyncFunctionDeclaration14_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration14_es5.js rename to tests/baselines/reference/asyncFunctionDeclaration14_es5(target=es5).js diff --git a/tests/baselines/reference/asyncFunctionDeclaration14_es5(target=es5).symbols b/tests/baselines/reference/asyncFunctionDeclaration14_es5(target=es5).symbols new file mode 100644 index 0000000000000..9b030b9e8e0ce --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration14_es5(target=es5).symbols @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration14_es5.ts] //// + +=== asyncFunctionDeclaration14_es5.ts === +async function foo(): Promise { +>foo : Symbol(foo, Decl(asyncFunctionDeclaration14_es5.ts, 0, 0)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + return; +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration14_es5(target=es5).types b/tests/baselines/reference/asyncFunctionDeclaration14_es5(target=es5).types new file mode 100644 index 0000000000000..a254b5f820b28 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration14_es5(target=es5).types @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration14_es5.ts] //// + +=== asyncFunctionDeclaration14_es5.ts === +async function foo(): Promise { +>foo : () => Promise +> : ^^^^^^ + + return; +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration15_es5(target=es2015).errors.txt b/tests/baselines/reference/asyncFunctionDeclaration15_es5(target=es2015).errors.txt new file mode 100644 index 0000000000000..f8f2d10feec68 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration15_es5(target=es2015).errors.txt @@ -0,0 +1,54 @@ +asyncFunctionDeclaration15_es5.ts(6,23): error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise<{}>'? +asyncFunctionDeclaration15_es5.ts(6,23): error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value. +asyncFunctionDeclaration15_es5.ts(7,23): error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? +asyncFunctionDeclaration15_es5.ts(8,23): error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? +asyncFunctionDeclaration15_es5.ts(8,23): error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value. +asyncFunctionDeclaration15_es5.ts(9,23): error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? +asyncFunctionDeclaration15_es5.ts(10,23): error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? +asyncFunctionDeclaration15_es5.ts(17,16): error TS1058: The return type of an async function must either be a valid promise or must not contain a callable 'then' member. +asyncFunctionDeclaration15_es5.ts(23,25): error TS1320: Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member. + + +==== asyncFunctionDeclaration15_es5.ts (9 errors) ==== + declare class Thenable { then(): void; } + declare let a: any; + declare let obj: { then: string; }; + declare let thenable: Thenable; + async function fn1() { } // valid: Promise + async function fn2(): { } { } // error + ~~~ +!!! error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise<{}>'? + ~~~ +!!! error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value. + async function fn3(): any { } // error + ~~~ +!!! error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? + async function fn4(): number { } // error + ~~~~~~ +!!! error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? + ~~~~~~ +!!! error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value. + async function fn5(): PromiseLike { } // error + ~~~~~~~~~~~~~~~~~ +!!! error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? + async function fn6(): Thenable { } // error + ~~~~~~~~ +!!! error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? + async function fn7() { return; } // valid: Promise + async function fn8() { return 1; } // valid: Promise + async function fn9() { return null; } // valid: Promise + async function fn10() { return undefined; } // valid: Promise + async function fn11() { return a; } // valid: Promise + async function fn12() { return obj; } // valid: Promise<{ then: string; }> + async function fn13() { return thenable; } // error + ~~~~ +!!! error TS1058: The return type of an async function must either be a valid promise or must not contain a callable 'then' member. + async function fn14() { await 1; } // valid: Promise + async function fn15() { await null; } // valid: Promise + async function fn16() { await undefined; } // valid: Promise + async function fn17() { await a; } // valid: Promise + async function fn18() { await obj; } // valid: Promise + async function fn19() { await thenable; } // error + ~~~~~~~~~~~~~~ +!!! error TS1320: Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member. + \ No newline at end of file diff --git a/tests/baselines/reference/asyncFunctionDeclaration15_es5(target=es2015).js b/tests/baselines/reference/asyncFunctionDeclaration15_es5(target=es2015).js new file mode 100644 index 0000000000000..9a5737d1524b0 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration15_es5(target=es2015).js @@ -0,0 +1,86 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts] //// + +//// [asyncFunctionDeclaration15_es5.ts] +declare class Thenable { then(): void; } +declare let a: any; +declare let obj: { then: string; }; +declare let thenable: Thenable; +async function fn1() { } // valid: Promise +async function fn2(): { } { } // error +async function fn3(): any { } // error +async function fn4(): number { } // error +async function fn5(): PromiseLike { } // error +async function fn6(): Thenable { } // error +async function fn7() { return; } // valid: Promise +async function fn8() { return 1; } // valid: Promise +async function fn9() { return null; } // valid: Promise +async function fn10() { return undefined; } // valid: Promise +async function fn11() { return a; } // valid: Promise +async function fn12() { return obj; } // valid: Promise<{ then: string; }> +async function fn13() { return thenable; } // error +async function fn14() { await 1; } // valid: Promise +async function fn15() { await null; } // valid: Promise +async function fn16() { await undefined; } // valid: Promise +async function fn17() { await a; } // valid: Promise +async function fn18() { await obj; } // valid: Promise +async function fn19() { await thenable; } // error + + +//// [asyncFunctionDeclaration15_es5.js] +function fn1() { + return __awaiter(this, void 0, void 0, function* () { }); +} // valid: Promise +function fn2() { + return __awaiter(this, void 0, void 0, function* () { }); +} // error +function fn3() { + return __awaiter(this, void 0, void 0, function* () { }); +} // error +function fn4() { + return __awaiter(this, void 0, void 0, function* () { }); +} // error +function fn5() { + return __awaiter(this, void 0, void 0, function* () { }); +} // error +function fn6() { + return __awaiter(this, void 0, void 0, function* () { }); +} // error +function fn7() { + return __awaiter(this, void 0, void 0, function* () { return; }); +} // valid: Promise +function fn8() { + return __awaiter(this, void 0, void 0, function* () { return 1; }); +} // valid: Promise +function fn9() { + return __awaiter(this, void 0, void 0, function* () { return null; }); +} // valid: Promise +function fn10() { + return __awaiter(this, void 0, void 0, function* () { return undefined; }); +} // valid: Promise +function fn11() { + return __awaiter(this, void 0, void 0, function* () { return a; }); +} // valid: Promise +function fn12() { + return __awaiter(this, void 0, void 0, function* () { return obj; }); +} // valid: Promise<{ then: string; }> +function fn13() { + return __awaiter(this, void 0, void 0, function* () { return thenable; }); +} // error +function fn14() { + return __awaiter(this, void 0, void 0, function* () { yield 1; }); +} // valid: Promise +function fn15() { + return __awaiter(this, void 0, void 0, function* () { yield null; }); +} // valid: Promise +function fn16() { + return __awaiter(this, void 0, void 0, function* () { yield undefined; }); +} // valid: Promise +function fn17() { + return __awaiter(this, void 0, void 0, function* () { yield a; }); +} // valid: Promise +function fn18() { + return __awaiter(this, void 0, void 0, function* () { yield obj; }); +} // valid: Promise +function fn19() { + return __awaiter(this, void 0, void 0, function* () { yield thenable; }); +} // error diff --git a/tests/baselines/reference/asyncFunctionDeclaration15_es5.symbols b/tests/baselines/reference/asyncFunctionDeclaration15_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration15_es5.symbols rename to tests/baselines/reference/asyncFunctionDeclaration15_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncFunctionDeclaration15_es5.types b/tests/baselines/reference/asyncFunctionDeclaration15_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration15_es5.types rename to tests/baselines/reference/asyncFunctionDeclaration15_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncFunctionDeclaration15_es5.errors.txt b/tests/baselines/reference/asyncFunctionDeclaration15_es5(target=es5).errors.txt similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration15_es5.errors.txt rename to tests/baselines/reference/asyncFunctionDeclaration15_es5(target=es5).errors.txt diff --git a/tests/baselines/reference/asyncFunctionDeclaration15_es5.js b/tests/baselines/reference/asyncFunctionDeclaration15_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration15_es5.js rename to tests/baselines/reference/asyncFunctionDeclaration15_es5(target=es5).js diff --git a/tests/baselines/reference/asyncFunctionDeclaration15_es5(target=es5).symbols b/tests/baselines/reference/asyncFunctionDeclaration15_es5(target=es5).symbols new file mode 100644 index 0000000000000..d36ffbddbffcf --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration15_es5(target=es5).symbols @@ -0,0 +1,85 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts] //// + +=== asyncFunctionDeclaration15_es5.ts === +declare class Thenable { then(): void; } +>Thenable : Symbol(Thenable, Decl(asyncFunctionDeclaration15_es5.ts, 0, 0)) +>then : Symbol(Thenable.then, Decl(asyncFunctionDeclaration15_es5.ts, 0, 24)) + +declare let a: any; +>a : Symbol(a, Decl(asyncFunctionDeclaration15_es5.ts, 1, 11)) + +declare let obj: { then: string; }; +>obj : Symbol(obj, Decl(asyncFunctionDeclaration15_es5.ts, 2, 11)) +>then : Symbol(then, Decl(asyncFunctionDeclaration15_es5.ts, 2, 18)) + +declare let thenable: Thenable; +>thenable : Symbol(thenable, Decl(asyncFunctionDeclaration15_es5.ts, 3, 11)) +>Thenable : Symbol(Thenable, Decl(asyncFunctionDeclaration15_es5.ts, 0, 0)) + +async function fn1() { } // valid: Promise +>fn1 : Symbol(fn1, Decl(asyncFunctionDeclaration15_es5.ts, 3, 31)) + +async function fn2(): { } { } // error +>fn2 : Symbol(fn2, Decl(asyncFunctionDeclaration15_es5.ts, 4, 24)) + +async function fn3(): any { } // error +>fn3 : Symbol(fn3, Decl(asyncFunctionDeclaration15_es5.ts, 5, 29)) + +async function fn4(): number { } // error +>fn4 : Symbol(fn4, Decl(asyncFunctionDeclaration15_es5.ts, 6, 29)) + +async function fn5(): PromiseLike { } // error +>fn5 : Symbol(fn5, Decl(asyncFunctionDeclaration15_es5.ts, 7, 32)) +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) + +async function fn6(): Thenable { } // error +>fn6 : Symbol(fn6, Decl(asyncFunctionDeclaration15_es5.ts, 8, 43)) +>Thenable : Symbol(Thenable, Decl(asyncFunctionDeclaration15_es5.ts, 0, 0)) + +async function fn7() { return; } // valid: Promise +>fn7 : Symbol(fn7, Decl(asyncFunctionDeclaration15_es5.ts, 9, 34)) + +async function fn8() { return 1; } // valid: Promise +>fn8 : Symbol(fn8, Decl(asyncFunctionDeclaration15_es5.ts, 10, 32)) + +async function fn9() { return null; } // valid: Promise +>fn9 : Symbol(fn9, Decl(asyncFunctionDeclaration15_es5.ts, 11, 34)) + +async function fn10() { return undefined; } // valid: Promise +>fn10 : Symbol(fn10, Decl(asyncFunctionDeclaration15_es5.ts, 12, 37)) +>undefined : Symbol(undefined) + +async function fn11() { return a; } // valid: Promise +>fn11 : Symbol(fn11, Decl(asyncFunctionDeclaration15_es5.ts, 13, 43)) +>a : Symbol(a, Decl(asyncFunctionDeclaration15_es5.ts, 1, 11)) + +async function fn12() { return obj; } // valid: Promise<{ then: string; }> +>fn12 : Symbol(fn12, Decl(asyncFunctionDeclaration15_es5.ts, 14, 35)) +>obj : Symbol(obj, Decl(asyncFunctionDeclaration15_es5.ts, 2, 11)) + +async function fn13() { return thenable; } // error +>fn13 : Symbol(fn13, Decl(asyncFunctionDeclaration15_es5.ts, 15, 37)) +>thenable : Symbol(thenable, Decl(asyncFunctionDeclaration15_es5.ts, 3, 11)) + +async function fn14() { await 1; } // valid: Promise +>fn14 : Symbol(fn14, Decl(asyncFunctionDeclaration15_es5.ts, 16, 42)) + +async function fn15() { await null; } // valid: Promise +>fn15 : Symbol(fn15, Decl(asyncFunctionDeclaration15_es5.ts, 17, 34)) + +async function fn16() { await undefined; } // valid: Promise +>fn16 : Symbol(fn16, Decl(asyncFunctionDeclaration15_es5.ts, 18, 37)) +>undefined : Symbol(undefined) + +async function fn17() { await a; } // valid: Promise +>fn17 : Symbol(fn17, Decl(asyncFunctionDeclaration15_es5.ts, 19, 42)) +>a : Symbol(a, Decl(asyncFunctionDeclaration15_es5.ts, 1, 11)) + +async function fn18() { await obj; } // valid: Promise +>fn18 : Symbol(fn18, Decl(asyncFunctionDeclaration15_es5.ts, 20, 34)) +>obj : Symbol(obj, Decl(asyncFunctionDeclaration15_es5.ts, 2, 11)) + +async function fn19() { await thenable; } // error +>fn19 : Symbol(fn19, Decl(asyncFunctionDeclaration15_es5.ts, 21, 36)) +>thenable : Symbol(thenable, Decl(asyncFunctionDeclaration15_es5.ts, 3, 11)) + diff --git a/tests/baselines/reference/asyncFunctionDeclaration15_es5(target=es5).types b/tests/baselines/reference/asyncFunctionDeclaration15_es5(target=es5).types new file mode 100644 index 0000000000000..41ae66714bd35 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration15_es5(target=es5).types @@ -0,0 +1,131 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts] //// + +=== asyncFunctionDeclaration15_es5.ts === +declare class Thenable { then(): void; } +>Thenable : Thenable +> : ^^^^^^^^ +>then : () => void +> : ^^^^^^ + +declare let a: any; +>a : any +> : ^^^ + +declare let obj: { then: string; }; +>obj : { then: string; } +> : ^^^^^^^^ ^^^ +>then : string +> : ^^^^^^ + +declare let thenable: Thenable; +>thenable : Thenable +> : ^^^^^^^^ + +async function fn1() { } // valid: Promise +>fn1 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + +async function fn2(): { } { } // error +>fn2 : () => {} +> : ^^^^^^ + +async function fn3(): any { } // error +>fn3 : () => any +> : ^^^^^^ + +async function fn4(): number { } // error +>fn4 : () => number +> : ^^^^^^ + +async function fn5(): PromiseLike { } // error +>fn5 : () => PromiseLike +> : ^^^^^^ + +async function fn6(): Thenable { } // error +>fn6 : () => Thenable +> : ^^^^^^ + +async function fn7() { return; } // valid: Promise +>fn7 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + +async function fn8() { return 1; } // valid: Promise +>fn8 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^^^ +>1 : 1 +> : ^ + +async function fn9() { return null; } // valid: Promise +>fn9 : () => Promise +> : ^^^^^^^^^^^^^^^^^^ + +async function fn10() { return undefined; } // valid: Promise +>fn10 : () => Promise +> : ^^^^^^^^^^^^^^^^^^ +>undefined : undefined +> : ^^^^^^^^^ + +async function fn11() { return a; } // valid: Promise +>fn11 : () => Promise +> : ^^^^^^^^^^^^^^^^^^ +>a : any +> : ^^^ + +async function fn12() { return obj; } // valid: Promise<{ then: string; }> +>fn12 : () => Promise<{ then: string; }> +> : ^^^^^^^^^^^^^^^^^^^^^^ ^^^^ +>obj : { then: string; } +> : ^^^^^^^^ ^^^ + +async function fn13() { return thenable; } // error +>fn13 : () => Promise +> : ^^^^^^^^^^^^^^^^^^ +>thenable : Thenable +> : ^^^^^^^^ + +async function fn14() { await 1; } // valid: Promise +>fn14 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ +>await 1 : 1 +> : ^ +>1 : 1 +> : ^ + +async function fn15() { await null; } // valid: Promise +>fn15 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ +>await null : null +> : ^^^^ + +async function fn16() { await undefined; } // valid: Promise +>fn16 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ +>await undefined : undefined +> : ^^^^^^^^^ +>undefined : undefined +> : ^^^^^^^^^ + +async function fn17() { await a; } // valid: Promise +>fn17 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ +>await a : any +> : ^^^ +>a : any +> : ^^^ + +async function fn18() { await obj; } // valid: Promise +>fn18 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ +>await obj : { then: string; } +> : ^^^^^^^^ ^^^ +>obj : { then: string; } +> : ^^^^^^^^ ^^^ + +async function fn19() { await thenable; } // error +>fn19 : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ +>await thenable : any +> : ^^^ +>thenable : Thenable +> : ^^^^^^^^ + diff --git a/tests/baselines/reference/asyncFunctionDeclaration16_es5(target=es2015).errors.txt b/tests/baselines/reference/asyncFunctionDeclaration16_es5(target=es2015).errors.txt new file mode 100644 index 0000000000000..1ab6e50c0837c --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration16_es5(target=es2015).errors.txt @@ -0,0 +1,66 @@ +/a.js(21,14): error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? +/a.js(27,12): error TS1065: The return type of an async function or method must be the global Promise type. +/a.js(45,12): error TS1065: The return type of an async function or method must be the global Promise type. + + +==== /types.d.ts (0 errors) ==== + declare class Thenable { then(): void; } + +==== /a.js (3 errors) ==== + /** + * @callback T1 + * @param {string} str + * @returns {string} + */ + + /** + * @callback T2 + * @param {string} str + * @returns {Promise} + */ + + /** + * @callback T3 + * @param {string} str + * @returns {Thenable} + */ + + /** + * @param {string} str + * @returns {string} + ~~~~~~ +!!! error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? + */ + const f1 = async str => { + return str; + } + + /** @type {T1} */ + ~~ +!!! error TS1065: The return type of an async function or method must be the global Promise type. +!!! related TS1064 /a.js:4:14: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? + const f2 = async str => { + return str; + } + + /** + * @param {string} str + * @returns {Promise} + */ + const f3 = async str => { + return str; + } + + /** @type {T2} */ + const f4 = async str => { + return str; + } + + /** @type {T3} */ + ~~ +!!! error TS1065: The return type of an async function or method must be the global Promise type. +!!! related TS1064 /a.js:16:14: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? + const f5 = async str => { + return str; + } + \ No newline at end of file diff --git a/tests/baselines/reference/asyncFunctionDeclaration16_es5.symbols b/tests/baselines/reference/asyncFunctionDeclaration16_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration16_es5.symbols rename to tests/baselines/reference/asyncFunctionDeclaration16_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncFunctionDeclaration16_es5.types b/tests/baselines/reference/asyncFunctionDeclaration16_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration16_es5.types rename to tests/baselines/reference/asyncFunctionDeclaration16_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncFunctionDeclaration16_es5.errors.txt b/tests/baselines/reference/asyncFunctionDeclaration16_es5(target=es5).errors.txt similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration16_es5.errors.txt rename to tests/baselines/reference/asyncFunctionDeclaration16_es5(target=es5).errors.txt diff --git a/tests/baselines/reference/asyncFunctionDeclaration16_es5(target=es5).symbols b/tests/baselines/reference/asyncFunctionDeclaration16_es5(target=es5).symbols new file mode 100644 index 0000000000000..eea51dda2a834 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration16_es5(target=es5).symbols @@ -0,0 +1,77 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration16_es5.ts] //// + +=== /types.d.ts === +declare class Thenable { then(): void; } +>Thenable : Symbol(Thenable, Decl(types.d.ts, 0, 0)) +>then : Symbol(Thenable.then, Decl(types.d.ts, 0, 24)) + +=== /a.js === +/** + * @callback T1 + * @param {string} str + * @returns {string} + */ + +/** + * @callback T2 + * @param {string} str + * @returns {Promise} + */ + +/** + * @callback T3 + * @param {string} str + * @returns {Thenable} + */ + +/** + * @param {string} str + * @returns {string} + */ +const f1 = async str => { +>f1 : Symbol(f1, Decl(a.js, 22, 5)) +>str : Symbol(str, Decl(a.js, 22, 16)) + + return str; +>str : Symbol(str, Decl(a.js, 22, 16)) +} + +/** @type {T1} */ +const f2 = async str => { +>f2 : Symbol(f2, Decl(a.js, 27, 5)) +>str : Symbol(str, Decl(a.js, 27, 16)) + + return str; +>str : Symbol(str, Decl(a.js, 27, 16)) +} + +/** + * @param {string} str + * @returns {Promise} + */ +const f3 = async str => { +>f3 : Symbol(f3, Decl(a.js, 35, 5)) +>str : Symbol(str, Decl(a.js, 35, 16)) + + return str; +>str : Symbol(str, Decl(a.js, 35, 16)) +} + +/** @type {T2} */ +const f4 = async str => { +>f4 : Symbol(f4, Decl(a.js, 40, 5)) +>str : Symbol(str, Decl(a.js, 40, 16)) + + return str; +>str : Symbol(str, Decl(a.js, 40, 16)) +} + +/** @type {T3} */ +const f5 = async str => { +>f5 : Symbol(f5, Decl(a.js, 45, 5)) +>str : Symbol(str, Decl(a.js, 45, 16)) + + return str; +>str : Symbol(str, Decl(a.js, 45, 16)) +} + diff --git a/tests/baselines/reference/asyncFunctionDeclaration16_es5(target=es5).types b/tests/baselines/reference/asyncFunctionDeclaration16_es5(target=es5).types new file mode 100644 index 0000000000000..e8fac034b7fe7 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration16_es5(target=es5).types @@ -0,0 +1,104 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration16_es5.ts] //// + +=== /types.d.ts === +declare class Thenable { then(): void; } +>Thenable : Thenable +> : ^^^^^^^^ +>then : () => void +> : ^^^^^^ + +=== /a.js === +/** + * @callback T1 + * @param {string} str + * @returns {string} + */ + +/** + * @callback T2 + * @param {string} str + * @returns {Promise} + */ + +/** + * @callback T3 + * @param {string} str + * @returns {Thenable} + */ + +/** + * @param {string} str + * @returns {string} + */ +const f1 = async str => { +>f1 : (str: string) => string +> : ^ ^^ ^^^^^ +>async str => { return str;} : (str: string) => string +> : ^ ^^ ^^^^^ +>str : string +> : ^^^^^^ + + return str; +>str : string +> : ^^^^^^ +} + +/** @type {T1} */ +const f2 = async str => { +>f2 : T1 +> : ^^ +>async str => { return str;} : (str: string) => string +> : ^ ^^^^^^^^^^^^^^^^^^^ +>str : string +> : ^^^^^^ + + return str; +>str : string +> : ^^^^^^ +} + +/** + * @param {string} str + * @returns {Promise} + */ +const f3 = async str => { +>f3 : (str: string) => Promise +> : ^ ^^ ^^^^^ +>async str => { return str;} : (str: string) => Promise +> : ^ ^^ ^^^^^ +>str : string +> : ^^^^^^ + + return str; +>str : string +> : ^^^^^^ +} + +/** @type {T2} */ +const f4 = async str => { +>f4 : T2 +> : ^^ +>async str => { return str;} : (str: string) => Promise +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>str : string +> : ^^^^^^ + + return str; +>str : string +> : ^^^^^^ +} + +/** @type {T3} */ +const f5 = async str => { +>f5 : T3 +> : ^^ +>async str => { return str;} : (str: string) => Thenable +> : ^ ^^^^^^^^^^^^^^^^^^^^^ +>str : string +> : ^^^^^^ + + return str; +>str : string +> : ^^^^^^ +} + diff --git a/tests/baselines/reference/asyncFunctionDeclaration1_es5(target=es2015).js b/tests/baselines/reference/asyncFunctionDeclaration1_es5(target=es2015).js new file mode 100644 index 0000000000000..959f4adac78ba --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration1_es5(target=es2015).js @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration1_es5.ts] //// + +//// [asyncFunctionDeclaration1_es5.ts] +async function foo(): Promise { +} + +//// [asyncFunctionDeclaration1_es5.js] +function foo() { + return __awaiter(this, void 0, void 0, function* () { + }); +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration1_es5.symbols b/tests/baselines/reference/asyncFunctionDeclaration1_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration1_es5.symbols rename to tests/baselines/reference/asyncFunctionDeclaration1_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncFunctionDeclaration1_es5.types b/tests/baselines/reference/asyncFunctionDeclaration1_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration1_es5.types rename to tests/baselines/reference/asyncFunctionDeclaration1_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncFunctionDeclaration1_es5.js b/tests/baselines/reference/asyncFunctionDeclaration1_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration1_es5.js rename to tests/baselines/reference/asyncFunctionDeclaration1_es5(target=es5).js diff --git a/tests/baselines/reference/asyncFunctionDeclaration1_es5(target=es5).symbols b/tests/baselines/reference/asyncFunctionDeclaration1_es5(target=es5).symbols new file mode 100644 index 0000000000000..08ad7c8bdc9cc --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration1_es5(target=es5).symbols @@ -0,0 +1,7 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration1_es5.ts] //// + +=== asyncFunctionDeclaration1_es5.ts === +async function foo(): Promise { +>foo : Symbol(foo, Decl(asyncFunctionDeclaration1_es5.ts, 0, 0)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration1_es5(target=es5).types b/tests/baselines/reference/asyncFunctionDeclaration1_es5(target=es5).types new file mode 100644 index 0000000000000..d288a110467a9 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration1_es5(target=es5).types @@ -0,0 +1,7 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration1_es5.ts] //// + +=== asyncFunctionDeclaration1_es5.ts === +async function foo(): Promise { +>foo : () => Promise +> : ^^^^^^ +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration2_es5.js b/tests/baselines/reference/asyncFunctionDeclaration2_es5(target=es2015).js similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration2_es5.js rename to tests/baselines/reference/asyncFunctionDeclaration2_es5(target=es2015).js diff --git a/tests/baselines/reference/asyncFunctionDeclaration2_es5.symbols b/tests/baselines/reference/asyncFunctionDeclaration2_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration2_es5.symbols rename to tests/baselines/reference/asyncFunctionDeclaration2_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncFunctionDeclaration2_es5.types b/tests/baselines/reference/asyncFunctionDeclaration2_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration2_es5.types rename to tests/baselines/reference/asyncFunctionDeclaration2_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncFunctionDeclaration2_es5(target=es5).js b/tests/baselines/reference/asyncFunctionDeclaration2_es5(target=es5).js new file mode 100644 index 0000000000000..66c4cbddb1038 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration2_es5(target=es5).js @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration2_es5.ts] //// + +//// [asyncFunctionDeclaration2_es5.ts] +function f(await) { +} + +//// [asyncFunctionDeclaration2_es5.js] +function f(await) { +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration2_es5(target=es5).symbols b/tests/baselines/reference/asyncFunctionDeclaration2_es5(target=es5).symbols new file mode 100644 index 0000000000000..389d222c8bdd1 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration2_es5(target=es5).symbols @@ -0,0 +1,7 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration2_es5.ts] //// + +=== asyncFunctionDeclaration2_es5.ts === +function f(await) { +>f : Symbol(f, Decl(asyncFunctionDeclaration2_es5.ts, 0, 0)) +>await : Symbol(await, Decl(asyncFunctionDeclaration2_es5.ts, 0, 11)) +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration2_es5(target=es5).types b/tests/baselines/reference/asyncFunctionDeclaration2_es5(target=es5).types new file mode 100644 index 0000000000000..26a780e93d7fc --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration2_es5(target=es5).types @@ -0,0 +1,8 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration2_es5.ts] //// + +=== asyncFunctionDeclaration2_es5.ts === +function f(await) { +>f : (await: any) => void +> : ^ ^^^^^^^^^^^^^^ +>await : any +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration3_es5.errors.txt b/tests/baselines/reference/asyncFunctionDeclaration3_es5(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration3_es5.errors.txt rename to tests/baselines/reference/asyncFunctionDeclaration3_es5(target=es2015).errors.txt diff --git a/tests/baselines/reference/asyncFunctionDeclaration3_es5(target=es2015).js b/tests/baselines/reference/asyncFunctionDeclaration3_es5(target=es2015).js new file mode 100644 index 0000000000000..7c74aa4b821af --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration3_es5(target=es2015).js @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration3_es5.ts] //// + +//// [asyncFunctionDeclaration3_es5.ts] +function f(await = await) { +} + +//// [asyncFunctionDeclaration3_es5.js] +function f(await = await) { +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration3_es5.symbols b/tests/baselines/reference/asyncFunctionDeclaration3_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration3_es5.symbols rename to tests/baselines/reference/asyncFunctionDeclaration3_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncFunctionDeclaration3_es5.types b/tests/baselines/reference/asyncFunctionDeclaration3_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration3_es5.types rename to tests/baselines/reference/asyncFunctionDeclaration3_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncFunctionDeclaration3_es5(target=es5).errors.txt b/tests/baselines/reference/asyncFunctionDeclaration3_es5(target=es5).errors.txt new file mode 100644 index 0000000000000..2b2507b88297c --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration3_es5(target=es5).errors.txt @@ -0,0 +1,8 @@ +asyncFunctionDeclaration3_es5.ts(1,20): error TS2372: Parameter 'await' cannot reference itself. + + +==== asyncFunctionDeclaration3_es5.ts (1 errors) ==== + function f(await = await) { + ~~~~~ +!!! error TS2372: Parameter 'await' cannot reference itself. + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncFunctionDeclaration3_es5.js b/tests/baselines/reference/asyncFunctionDeclaration3_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration3_es5.js rename to tests/baselines/reference/asyncFunctionDeclaration3_es5(target=es5).js diff --git a/tests/baselines/reference/asyncFunctionDeclaration3_es5(target=es5).symbols b/tests/baselines/reference/asyncFunctionDeclaration3_es5(target=es5).symbols new file mode 100644 index 0000000000000..5f3342458e07f --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration3_es5(target=es5).symbols @@ -0,0 +1,8 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration3_es5.ts] //// + +=== asyncFunctionDeclaration3_es5.ts === +function f(await = await) { +>f : Symbol(f, Decl(asyncFunctionDeclaration3_es5.ts, 0, 0)) +>await : Symbol(await, Decl(asyncFunctionDeclaration3_es5.ts, 0, 11)) +>await : Symbol(await, Decl(asyncFunctionDeclaration3_es5.ts, 0, 11)) +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration3_es5(target=es5).types b/tests/baselines/reference/asyncFunctionDeclaration3_es5(target=es5).types new file mode 100644 index 0000000000000..4469562a7aac0 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration3_es5(target=es5).types @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration3_es5.ts] //// + +=== asyncFunctionDeclaration3_es5.ts === +function f(await = await) { +>f : (await?: any) => void +> : ^ ^^^^^^^^^^^^^^^ +>await : any +> : ^^^ +>await : any +> : ^^^ +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration4_es5.js b/tests/baselines/reference/asyncFunctionDeclaration4_es5(target=es2015).js similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration4_es5.js rename to tests/baselines/reference/asyncFunctionDeclaration4_es5(target=es2015).js diff --git a/tests/baselines/reference/asyncFunctionDeclaration4_es5.symbols b/tests/baselines/reference/asyncFunctionDeclaration4_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration4_es5.symbols rename to tests/baselines/reference/asyncFunctionDeclaration4_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncFunctionDeclaration4_es5.types b/tests/baselines/reference/asyncFunctionDeclaration4_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration4_es5.types rename to tests/baselines/reference/asyncFunctionDeclaration4_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncFunctionDeclaration4_es5(target=es5).js b/tests/baselines/reference/asyncFunctionDeclaration4_es5(target=es5).js new file mode 100644 index 0000000000000..3a4b2beafbba5 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration4_es5(target=es5).js @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration4_es5.ts] //// + +//// [asyncFunctionDeclaration4_es5.ts] +function await() { +} + +//// [asyncFunctionDeclaration4_es5.js] +function await() { +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration4_es5(target=es5).symbols b/tests/baselines/reference/asyncFunctionDeclaration4_es5(target=es5).symbols new file mode 100644 index 0000000000000..c1c16fd7ae217 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration4_es5(target=es5).symbols @@ -0,0 +1,6 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration4_es5.ts] //// + +=== asyncFunctionDeclaration4_es5.ts === +function await() { +>await : Symbol(await, Decl(asyncFunctionDeclaration4_es5.ts, 0, 0)) +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration4_es5(target=es5).types b/tests/baselines/reference/asyncFunctionDeclaration4_es5(target=es5).types new file mode 100644 index 0000000000000..7c9435985c3ef --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration4_es5(target=es5).types @@ -0,0 +1,7 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration4_es5.ts] //// + +=== asyncFunctionDeclaration4_es5.ts === +function await() { +>await : () => void +> : ^^^^^^^^^^ +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration5_es5.errors.txt b/tests/baselines/reference/asyncFunctionDeclaration5_es5(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration5_es5.errors.txt rename to tests/baselines/reference/asyncFunctionDeclaration5_es5(target=es2015).errors.txt diff --git a/tests/baselines/reference/asyncFunctionDeclaration5_es5(target=es2015).js b/tests/baselines/reference/asyncFunctionDeclaration5_es5(target=es2015).js new file mode 100644 index 0000000000000..8c1c92f4e750b --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration5_es5(target=es2015).js @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration5_es5.ts] //// + +//// [asyncFunctionDeclaration5_es5.ts] +async function foo(await): Promise { +} + +//// [asyncFunctionDeclaration5_es5.js] +function foo(await) { + return __awaiter(this, void 0, void 0, function* () { + }); +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration5_es5.symbols b/tests/baselines/reference/asyncFunctionDeclaration5_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration5_es5.symbols rename to tests/baselines/reference/asyncFunctionDeclaration5_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncFunctionDeclaration5_es5.types b/tests/baselines/reference/asyncFunctionDeclaration5_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration5_es5.types rename to tests/baselines/reference/asyncFunctionDeclaration5_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncFunctionDeclaration5_es5(target=es5).errors.txt b/tests/baselines/reference/asyncFunctionDeclaration5_es5(target=es5).errors.txt new file mode 100644 index 0000000000000..175409258281f --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration5_es5(target=es5).errors.txt @@ -0,0 +1,8 @@ +asyncFunctionDeclaration5_es5.ts(1,20): error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. + + +==== asyncFunctionDeclaration5_es5.ts (1 errors) ==== + async function foo(await): Promise { + ~~~~~ +!!! error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncFunctionDeclaration5_es5.js b/tests/baselines/reference/asyncFunctionDeclaration5_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration5_es5.js rename to tests/baselines/reference/asyncFunctionDeclaration5_es5(target=es5).js diff --git a/tests/baselines/reference/asyncFunctionDeclaration5_es5(target=es5).symbols b/tests/baselines/reference/asyncFunctionDeclaration5_es5(target=es5).symbols new file mode 100644 index 0000000000000..55d2f2cdf0c90 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration5_es5(target=es5).symbols @@ -0,0 +1,8 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration5_es5.ts] //// + +=== asyncFunctionDeclaration5_es5.ts === +async function foo(await): Promise { +>foo : Symbol(foo, Decl(asyncFunctionDeclaration5_es5.ts, 0, 0)) +>await : Symbol(await, Decl(asyncFunctionDeclaration5_es5.ts, 0, 19)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration5_es5(target=es5).types b/tests/baselines/reference/asyncFunctionDeclaration5_es5(target=es5).types new file mode 100644 index 0000000000000..a52a4913c03f5 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration5_es5(target=es5).types @@ -0,0 +1,9 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration5_es5.ts] //// + +=== asyncFunctionDeclaration5_es5.ts === +async function foo(await): Promise { +>foo : (await: any) => Promise +> : ^ ^^^^^^^^^^ +>await : any +> : ^^^ +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration6_es5.errors.txt b/tests/baselines/reference/asyncFunctionDeclaration6_es5(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration6_es5.errors.txt rename to tests/baselines/reference/asyncFunctionDeclaration6_es5(target=es2015).errors.txt diff --git a/tests/baselines/reference/asyncFunctionDeclaration6_es5(target=es2015).js b/tests/baselines/reference/asyncFunctionDeclaration6_es5(target=es2015).js new file mode 100644 index 0000000000000..3f8ba4ab69354 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration6_es5(target=es2015).js @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration6_es5.ts] //// + +//// [asyncFunctionDeclaration6_es5.ts] +async function foo(a = await): Promise { +} + +//// [asyncFunctionDeclaration6_es5.js] +function foo() { + return __awaiter(this, arguments, void 0, function* (a = yield ) { + }); +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration6_es5.symbols b/tests/baselines/reference/asyncFunctionDeclaration6_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration6_es5.symbols rename to tests/baselines/reference/asyncFunctionDeclaration6_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncFunctionDeclaration6_es5.types b/tests/baselines/reference/asyncFunctionDeclaration6_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration6_es5.types rename to tests/baselines/reference/asyncFunctionDeclaration6_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncFunctionDeclaration6_es5(target=es5).errors.txt b/tests/baselines/reference/asyncFunctionDeclaration6_es5(target=es5).errors.txt new file mode 100644 index 0000000000000..bfe5e9017af9f --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration6_es5(target=es5).errors.txt @@ -0,0 +1,11 @@ +asyncFunctionDeclaration6_es5.ts(1,24): error TS2524: 'await' expressions cannot be used in a parameter initializer. +asyncFunctionDeclaration6_es5.ts(1,29): error TS1109: Expression expected. + + +==== asyncFunctionDeclaration6_es5.ts (2 errors) ==== + async function foo(a = await): Promise { + ~~~~~ +!!! error TS2524: 'await' expressions cannot be used in a parameter initializer. + ~ +!!! error TS1109: Expression expected. + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncFunctionDeclaration6_es5.js b/tests/baselines/reference/asyncFunctionDeclaration6_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration6_es5.js rename to tests/baselines/reference/asyncFunctionDeclaration6_es5(target=es5).js diff --git a/tests/baselines/reference/asyncFunctionDeclaration6_es5(target=es5).symbols b/tests/baselines/reference/asyncFunctionDeclaration6_es5(target=es5).symbols new file mode 100644 index 0000000000000..945428b81674c --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration6_es5(target=es5).symbols @@ -0,0 +1,8 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration6_es5.ts] //// + +=== asyncFunctionDeclaration6_es5.ts === +async function foo(a = await): Promise { +>foo : Symbol(foo, Decl(asyncFunctionDeclaration6_es5.ts, 0, 0)) +>a : Symbol(a, Decl(asyncFunctionDeclaration6_es5.ts, 0, 19)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration6_es5(target=es5).types b/tests/baselines/reference/asyncFunctionDeclaration6_es5(target=es5).types new file mode 100644 index 0000000000000..1c88ece8014b2 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration6_es5(target=es5).types @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration6_es5.ts] //// + +=== asyncFunctionDeclaration6_es5.ts === +async function foo(a = await): Promise { +>foo : (a?: any) => Promise +> : ^ ^^^^^^^^^^^ +>a : any +> : ^^^ +>await : any +> : ^^^ +> : any +> : ^^^ +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration7_es5.errors.txt b/tests/baselines/reference/asyncFunctionDeclaration7_es5(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration7_es5.errors.txt rename to tests/baselines/reference/asyncFunctionDeclaration7_es5(target=es2015).errors.txt diff --git a/tests/baselines/reference/asyncFunctionDeclaration7_es5(target=es2015).js b/tests/baselines/reference/asyncFunctionDeclaration7_es5(target=es2015).js new file mode 100644 index 0000000000000..f8cca723ab2d7 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration7_es5(target=es2015).js @@ -0,0 +1,19 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration7_es5.ts] //// + +//// [asyncFunctionDeclaration7_es5.ts] +async function bar(): Promise { + // 'await' here is an identifier, and not a yield expression. + async function foo(a = await): Promise { + } +} + +//// [asyncFunctionDeclaration7_es5.js] +function bar() { + return __awaiter(this, void 0, void 0, function* () { + // 'await' here is an identifier, and not a yield expression. + function foo() { + return __awaiter(this, arguments, void 0, function* (a = yield ) { + }); + } + }); +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration7_es5.symbols b/tests/baselines/reference/asyncFunctionDeclaration7_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration7_es5.symbols rename to tests/baselines/reference/asyncFunctionDeclaration7_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncFunctionDeclaration7_es5.types b/tests/baselines/reference/asyncFunctionDeclaration7_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration7_es5.types rename to tests/baselines/reference/asyncFunctionDeclaration7_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncFunctionDeclaration7_es5(target=es5).errors.txt b/tests/baselines/reference/asyncFunctionDeclaration7_es5(target=es5).errors.txt new file mode 100644 index 0000000000000..6c51148ae758e --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration7_es5(target=es5).errors.txt @@ -0,0 +1,14 @@ +asyncFunctionDeclaration7_es5.ts(3,26): error TS2524: 'await' expressions cannot be used in a parameter initializer. +asyncFunctionDeclaration7_es5.ts(3,31): error TS1109: Expression expected. + + +==== asyncFunctionDeclaration7_es5.ts (2 errors) ==== + async function bar(): Promise { + // 'await' here is an identifier, and not a yield expression. + async function foo(a = await): Promise { + ~~~~~ +!!! error TS2524: 'await' expressions cannot be used in a parameter initializer. + ~ +!!! error TS1109: Expression expected. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncFunctionDeclaration7_es5.js b/tests/baselines/reference/asyncFunctionDeclaration7_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration7_es5.js rename to tests/baselines/reference/asyncFunctionDeclaration7_es5(target=es5).js diff --git a/tests/baselines/reference/asyncFunctionDeclaration7_es5(target=es5).symbols b/tests/baselines/reference/asyncFunctionDeclaration7_es5(target=es5).symbols new file mode 100644 index 0000000000000..43e1d12448f06 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration7_es5(target=es5).symbols @@ -0,0 +1,14 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration7_es5.ts] //// + +=== asyncFunctionDeclaration7_es5.ts === +async function bar(): Promise { +>bar : Symbol(bar, Decl(asyncFunctionDeclaration7_es5.ts, 0, 0)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + // 'await' here is an identifier, and not a yield expression. + async function foo(a = await): Promise { +>foo : Symbol(foo, Decl(asyncFunctionDeclaration7_es5.ts, 0, 37)) +>a : Symbol(a, Decl(asyncFunctionDeclaration7_es5.ts, 2, 21)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + } +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration7_es5(target=es5).types b/tests/baselines/reference/asyncFunctionDeclaration7_es5(target=es5).types new file mode 100644 index 0000000000000..5ba91545234d6 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration7_es5(target=es5).types @@ -0,0 +1,19 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration7_es5.ts] //// + +=== asyncFunctionDeclaration7_es5.ts === +async function bar(): Promise { +>bar : () => Promise +> : ^^^^^^ + + // 'await' here is an identifier, and not a yield expression. + async function foo(a = await): Promise { +>foo : (a?: any) => Promise +> : ^ ^^^^^^^^^^^ +>a : any +> : ^^^ +>await : any +> : ^^^ +> : any +> : ^^^ + } +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration8_es5.errors.txt b/tests/baselines/reference/asyncFunctionDeclaration8_es5(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration8_es5.errors.txt rename to tests/baselines/reference/asyncFunctionDeclaration8_es5(target=es2015).errors.txt diff --git a/tests/baselines/reference/asyncFunctionDeclaration8_es5(target=es2015).js b/tests/baselines/reference/asyncFunctionDeclaration8_es5(target=es2015).js new file mode 100644 index 0000000000000..dd2cda54382f3 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration8_es5(target=es2015).js @@ -0,0 +1,7 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration8_es5.ts] //// + +//// [asyncFunctionDeclaration8_es5.ts] +var v = { [await]: foo } + +//// [asyncFunctionDeclaration8_es5.js] +var v = { [await]: foo }; diff --git a/tests/baselines/reference/asyncFunctionDeclaration8_es5.symbols b/tests/baselines/reference/asyncFunctionDeclaration8_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration8_es5.symbols rename to tests/baselines/reference/asyncFunctionDeclaration8_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncFunctionDeclaration8_es5.types b/tests/baselines/reference/asyncFunctionDeclaration8_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration8_es5.types rename to tests/baselines/reference/asyncFunctionDeclaration8_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncFunctionDeclaration8_es5(target=es5).errors.txt b/tests/baselines/reference/asyncFunctionDeclaration8_es5(target=es5).errors.txt new file mode 100644 index 0000000000000..d050d9263b74e --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration8_es5(target=es5).errors.txt @@ -0,0 +1,10 @@ +asyncFunctionDeclaration8_es5.ts(1,12): error TS2304: Cannot find name 'await'. +asyncFunctionDeclaration8_es5.ts(1,20): error TS2304: Cannot find name 'foo'. + + +==== asyncFunctionDeclaration8_es5.ts (2 errors) ==== + var v = { [await]: foo } + ~~~~~ +!!! error TS2304: Cannot find name 'await'. + ~~~ +!!! error TS2304: Cannot find name 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/asyncFunctionDeclaration8_es5.js b/tests/baselines/reference/asyncFunctionDeclaration8_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration8_es5.js rename to tests/baselines/reference/asyncFunctionDeclaration8_es5(target=es5).js diff --git a/tests/baselines/reference/asyncFunctionDeclaration8_es5(target=es5).symbols b/tests/baselines/reference/asyncFunctionDeclaration8_es5(target=es5).symbols new file mode 100644 index 0000000000000..6f5cc8e635ae5 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration8_es5(target=es5).symbols @@ -0,0 +1,7 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration8_es5.ts] //// + +=== asyncFunctionDeclaration8_es5.ts === +var v = { [await]: foo } +>v : Symbol(v, Decl(asyncFunctionDeclaration8_es5.ts, 0, 3)) +>[await] : Symbol([await], Decl(asyncFunctionDeclaration8_es5.ts, 0, 9)) + diff --git a/tests/baselines/reference/asyncFunctionDeclaration8_es5(target=es5).types b/tests/baselines/reference/asyncFunctionDeclaration8_es5(target=es5).types new file mode 100644 index 0000000000000..39a38122aabda --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration8_es5(target=es5).types @@ -0,0 +1,15 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration8_es5.ts] //// + +=== asyncFunctionDeclaration8_es5.ts === +var v = { [await]: foo } +>v : { [x: number]: any; } +> : ^^^^^^^^^^^^^^^^^^^^^ +>{ [await]: foo } : { [x: number]: any; } +> : ^^^^^^^^^^^^^^^^^^^^^ +>[await] : any +> : ^^^ +>await : any +> : ^^^ +>foo : any +> : ^^^ + diff --git a/tests/baselines/reference/asyncFunctionDeclaration9_es5.errors.txt b/tests/baselines/reference/asyncFunctionDeclaration9_es5(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration9_es5.errors.txt rename to tests/baselines/reference/asyncFunctionDeclaration9_es5(target=es2015).errors.txt diff --git a/tests/baselines/reference/asyncFunctionDeclaration9_es5(target=es2015).js b/tests/baselines/reference/asyncFunctionDeclaration9_es5(target=es2015).js new file mode 100644 index 0000000000000..3986493546e3f --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration9_es5(target=es2015).js @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration9_es5.ts] //// + +//// [asyncFunctionDeclaration9_es5.ts] +async function foo(): Promise { + var v = { [await]: foo } +} + +//// [asyncFunctionDeclaration9_es5.js] +function foo() { + return __awaiter(this, void 0, void 0, function* () { + var v = { [yield ]: foo }; + }); +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration9_es5.symbols b/tests/baselines/reference/asyncFunctionDeclaration9_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration9_es5.symbols rename to tests/baselines/reference/asyncFunctionDeclaration9_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncFunctionDeclaration9_es5.types b/tests/baselines/reference/asyncFunctionDeclaration9_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration9_es5.types rename to tests/baselines/reference/asyncFunctionDeclaration9_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncFunctionDeclaration9_es5(target=es5).errors.txt b/tests/baselines/reference/asyncFunctionDeclaration9_es5(target=es5).errors.txt new file mode 100644 index 0000000000000..878d099702c18 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration9_es5(target=es5).errors.txt @@ -0,0 +1,9 @@ +asyncFunctionDeclaration9_es5.ts(2,19): error TS1109: Expression expected. + + +==== asyncFunctionDeclaration9_es5.ts (1 errors) ==== + async function foo(): Promise { + var v = { [await]: foo } + ~ +!!! error TS1109: Expression expected. + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncFunctionDeclaration9_es5.js b/tests/baselines/reference/asyncFunctionDeclaration9_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclaration9_es5.js rename to tests/baselines/reference/asyncFunctionDeclaration9_es5(target=es5).js diff --git a/tests/baselines/reference/asyncFunctionDeclaration9_es5(target=es5).symbols b/tests/baselines/reference/asyncFunctionDeclaration9_es5(target=es5).symbols new file mode 100644 index 0000000000000..e6e3445756e7a --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration9_es5(target=es5).symbols @@ -0,0 +1,12 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration9_es5.ts] //// + +=== asyncFunctionDeclaration9_es5.ts === +async function foo(): Promise { +>foo : Symbol(foo, Decl(asyncFunctionDeclaration9_es5.ts, 0, 0)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + var v = { [await]: foo } +>v : Symbol(v, Decl(asyncFunctionDeclaration9_es5.ts, 1, 5)) +>[await] : Symbol([await], Decl(asyncFunctionDeclaration9_es5.ts, 1, 11)) +>foo : Symbol(foo, Decl(asyncFunctionDeclaration9_es5.ts, 0, 0)) +} diff --git a/tests/baselines/reference/asyncFunctionDeclaration9_es5(target=es5).types b/tests/baselines/reference/asyncFunctionDeclaration9_es5(target=es5).types new file mode 100644 index 0000000000000..305202fc546ae --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclaration9_es5(target=es5).types @@ -0,0 +1,21 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration9_es5.ts] //// + +=== asyncFunctionDeclaration9_es5.ts === +async function foo(): Promise { +>foo : () => Promise +> : ^^^^^^ + + var v = { [await]: foo } +>v : { [x: number]: () => Promise; } +> : ^^^^^^^^^^^^^^^^^^^^^ ^^^ +>{ [await]: foo } : { [x: number]: () => Promise; } +> : ^^^^^^^^^^^^^^^^^^^^^ ^^^ +>[await] : () => Promise +> : ^^^^^^ +>await : any +> : ^^^ +> : any +> : ^^^ +>foo : () => Promise +> : ^^^^^^ +} diff --git a/tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5(target=es2015).js b/tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5(target=es2015).js new file mode 100644 index 0000000000000..0f553556de390 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5(target=es2015).js @@ -0,0 +1,25 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclarationCapturesArguments_es5.ts] //// + +//// [asyncFunctionDeclarationCapturesArguments_es5.ts] +class C { + method() { + function other() {} + async function fn () { + await other.apply(this, arguments); + } + } +} + + +//// [asyncFunctionDeclarationCapturesArguments_es5.js] +class C { + method() { + function other() { } + function fn() { + var arguments_1 = arguments; + return __awaiter(this, void 0, void 0, function* () { + yield other.apply(this, arguments_1); + }); + } + } +} diff --git a/tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5.symbols b/tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5.symbols rename to tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5(target=es2015).types b/tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5(target=es2015).types new file mode 100644 index 0000000000000..c6269bd45edd9 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5(target=es2015).types @@ -0,0 +1,35 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclarationCapturesArguments_es5.ts] //// + +=== asyncFunctionDeclarationCapturesArguments_es5.ts === +class C { +>C : C +> : ^ + + method() { +>method : () => void +> : ^^^^^^^^^^ + + function other() {} +>other : () => void +> : ^^^^^^^^^^ + + async function fn () { +>fn : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + + await other.apply(this, arguments); +>await other.apply(this, arguments) : any +>other.apply(this, arguments) : any +>other.apply : (this: Function, thisArg: any, argArray?: any) => any +> : ^ ^^ ^^ ^^ ^^ ^^^ ^^^^^ +>other : () => void +> : ^^^^^^^^^^ +>apply : (this: Function, thisArg: any, argArray?: any) => any +> : ^ ^^ ^^ ^^ ^^ ^^^ ^^^^^ +>this : any +>arguments : IArguments +> : ^^^^^^^^^^ + } + } +} + diff --git a/tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5.errors.txt b/tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5(target=es5).errors.txt similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5.errors.txt rename to tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5(target=es5).errors.txt diff --git a/tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5.js b/tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5.js rename to tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5(target=es5).js diff --git a/tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5(target=es5).symbols b/tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5(target=es5).symbols new file mode 100644 index 0000000000000..ed65437339dca --- /dev/null +++ b/tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5(target=es5).symbols @@ -0,0 +1,24 @@ +//// [tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclarationCapturesArguments_es5.ts] //// + +=== asyncFunctionDeclarationCapturesArguments_es5.ts === +class C { +>C : Symbol(C, Decl(asyncFunctionDeclarationCapturesArguments_es5.ts, 0, 0)) + + method() { +>method : Symbol(C.method, Decl(asyncFunctionDeclarationCapturesArguments_es5.ts, 0, 9)) + + function other() {} +>other : Symbol(other, Decl(asyncFunctionDeclarationCapturesArguments_es5.ts, 1, 13)) + + async function fn () { +>fn : Symbol(fn, Decl(asyncFunctionDeclarationCapturesArguments_es5.ts, 2, 25)) + + await other.apply(this, arguments); +>other.apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --)) +>other : Symbol(other, Decl(asyncFunctionDeclarationCapturesArguments_es5.ts, 1, 13)) +>apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --)) +>arguments : Symbol(arguments) + } + } +} + diff --git a/tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5.types b/tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5(target=es5).types similarity index 100% rename from tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5.types rename to tests/baselines/reference/asyncFunctionDeclarationCapturesArguments_es5(target=es5).types diff --git a/tests/baselines/reference/asyncFunctionNoReturnType.js b/tests/baselines/reference/asyncFunctionNoReturnType.js index ef0a529fcc5ad..7b601649bc720 100644 --- a/tests/baselines/reference/asyncFunctionNoReturnType.js +++ b/tests/baselines/reference/asyncFunctionNoReturnType.js @@ -17,38 +17,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); - return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (g && (g = 0, op[0] && (_ = 0)), _) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } 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 }; - } -}; -var _this = this; -(function () { return __awaiter(_this, void 0, void 0, function () { - return __generator(this, function (_a) { - if (window) - return [2 /*return*/]; - return [2 /*return*/]; - }); -}); }); +() => __awaiter(this, void 0, void 0, function* () { + if (window) + return; +}); diff --git a/tests/baselines/reference/asyncFunctionReturnExpressionErrorSpans.js b/tests/baselines/reference/asyncFunctionReturnExpressionErrorSpans.js index 2863404726a47..94f02b0b38843 100644 --- a/tests/baselines/reference/asyncFunctionReturnExpressionErrorSpans.js +++ b/tests/baselines/reference/asyncFunctionReturnExpressionErrorSpans.js @@ -33,45 +33,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); - return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (g && (g = 0, op[0] && (_ = 0)), _) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } 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 asyncFoo() { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - return [2 /*return*/, { - bar: { - baz: { - inner: { - thing: 1 - } - } + return __awaiter(this, void 0, void 0, function* () { + return { + bar: { + baz: { + inner: { + thing: 1 } - }]; - }); + } + } + }; }); } diff --git a/tests/baselines/reference/asyncFunctionTempVariableScoping(target=es2015).js b/tests/baselines/reference/asyncFunctionTempVariableScoping(target=es2015).js new file mode 100644 index 0000000000000..6b2669d1b0d49 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionTempVariableScoping(target=es2015).js @@ -0,0 +1,33 @@ +//// [tests/cases/compiler/asyncFunctionTempVariableScoping.ts] //// + +//// [asyncFunctionTempVariableScoping.ts] +// https://github.com/Microsoft/TypeScript/issues/19187 + +async ({ foo, bar, ...rest }) => bar(await foo); + +//// [asyncFunctionTempVariableScoping.js] +// https://github.com/Microsoft/TypeScript/issues/19187 +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __rest = (this && this.__rest) || function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +}; +(_a) => __awaiter(this, void 0, void 0, function* () { + var { foo, bar } = _a, rest = __rest(_a, ["foo", "bar"]); + return bar(yield foo); +}); diff --git a/tests/baselines/reference/asyncFunctionTempVariableScoping.symbols b/tests/baselines/reference/asyncFunctionTempVariableScoping(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncFunctionTempVariableScoping.symbols rename to tests/baselines/reference/asyncFunctionTempVariableScoping(target=es2015).symbols diff --git a/tests/baselines/reference/asyncFunctionTempVariableScoping.types b/tests/baselines/reference/asyncFunctionTempVariableScoping(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncFunctionTempVariableScoping.types rename to tests/baselines/reference/asyncFunctionTempVariableScoping(target=es2015).types diff --git a/tests/baselines/reference/asyncFunctionTempVariableScoping.js b/tests/baselines/reference/asyncFunctionTempVariableScoping(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncFunctionTempVariableScoping.js rename to tests/baselines/reference/asyncFunctionTempVariableScoping(target=es5).js diff --git a/tests/baselines/reference/asyncFunctionTempVariableScoping(target=es5).symbols b/tests/baselines/reference/asyncFunctionTempVariableScoping(target=es5).symbols new file mode 100644 index 0000000000000..27e8ee0feb447 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionTempVariableScoping(target=es5).symbols @@ -0,0 +1,12 @@ +//// [tests/cases/compiler/asyncFunctionTempVariableScoping.ts] //// + +=== asyncFunctionTempVariableScoping.ts === +// https://github.com/Microsoft/TypeScript/issues/19187 + +async ({ foo, bar, ...rest }) => bar(await foo); +>foo : Symbol(foo, Decl(asyncFunctionTempVariableScoping.ts, 2, 8)) +>bar : Symbol(bar, Decl(asyncFunctionTempVariableScoping.ts, 2, 13)) +>rest : Symbol(rest, Decl(asyncFunctionTempVariableScoping.ts, 2, 18)) +>bar : Symbol(bar, Decl(asyncFunctionTempVariableScoping.ts, 2, 13)) +>foo : Symbol(foo, Decl(asyncFunctionTempVariableScoping.ts, 2, 8)) + diff --git a/tests/baselines/reference/asyncFunctionTempVariableScoping(target=es5).types b/tests/baselines/reference/asyncFunctionTempVariableScoping(target=es5).types new file mode 100644 index 0000000000000..f419de00d7f96 --- /dev/null +++ b/tests/baselines/reference/asyncFunctionTempVariableScoping(target=es5).types @@ -0,0 +1,19 @@ +//// [tests/cases/compiler/asyncFunctionTempVariableScoping.ts] //// + +=== asyncFunctionTempVariableScoping.ts === +// https://github.com/Microsoft/TypeScript/issues/19187 + +async ({ foo, bar, ...rest }) => bar(await foo); +>async ({ foo, bar, ...rest }) => bar(await foo) : ({ foo, bar, ...rest }: { [x: string]: any; foo: any; bar: any; }) => Promise +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>foo : any +> : ^^^ +>bar : any +> : ^^^ +>rest : { [x: string]: any; } +> : ^^^^^^^^^^^^^^^^^^^^^ +>bar(await foo) : any +>bar : any +>await foo : any +>foo : any + diff --git a/tests/baselines/reference/asyncFunctionWithForStatementNoInitializer.js b/tests/baselines/reference/asyncFunctionWithForStatementNoInitializer.js index 8ea440e35cad1..f5175c71944ce 100644 --- a/tests/baselines/reference/asyncFunctionWithForStatementNoInitializer.js +++ b/tests/baselines/reference/asyncFunctionWithForStatementNoInitializer.js @@ -36,74 +36,32 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); - return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (g && (g = 0, op[0] && (_ = 0)), _) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; function test1() { - return __awaiter(this, void 0, void 0, function () { - var i, limit; - return __generator(this, function (_a) { - i = 0; - limit = 10; - for (; i < limit; ++i) { - } - return [2 /*return*/]; - }); + return __awaiter(this, void 0, void 0, function* () { + let i = 0; + let limit = 10; + for (; i < limit; ++i) { + } }); } function test2() { - return __awaiter(this, void 0, void 0, function () { - var i, limit; - return __generator(this, function (_a) { - i = 0; - limit = 10; - for (i = 1; i < limit; ++i) { - } - return [2 /*return*/]; - }); + return __awaiter(this, void 0, void 0, function* () { + let i = 0; + let limit = 10; + for (i = 1; i < limit; ++i) { + } }); } function test3() { - return __awaiter(this, void 0, void 0, function () { - var i; - return __generator(this, function (_a) { - i = 0; - for (;; ++i) { - } - return [2 /*return*/]; - }); + return __awaiter(this, void 0, void 0, function* () { + let i = 0; + for (;; ++i) { + } }); } function test4() { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - for (;;) { - } - return [2 /*return*/]; - }); + return __awaiter(this, void 0, void 0, function* () { + for (;;) { + } }); } diff --git a/tests/baselines/reference/asyncGetter_es5.errors.txt b/tests/baselines/reference/asyncGetter_es5(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/asyncGetter_es5.errors.txt rename to tests/baselines/reference/asyncGetter_es5(target=es2015).errors.txt diff --git a/tests/baselines/reference/asyncGetter_es5(target=es2015).js b/tests/baselines/reference/asyncGetter_es5(target=es2015).js new file mode 100644 index 0000000000000..9ed14a8aa05ce --- /dev/null +++ b/tests/baselines/reference/asyncGetter_es5(target=es2015).js @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/async/es5/asyncGetter_es5.ts] //// + +//// [asyncGetter_es5.ts] +class C { + async get foo() { + } +} + +//// [asyncGetter_es5.js] +class C { + get foo() { + } +} diff --git a/tests/baselines/reference/asyncGetter_es5.symbols b/tests/baselines/reference/asyncGetter_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncGetter_es5.symbols rename to tests/baselines/reference/asyncGetter_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncGetter_es5.types b/tests/baselines/reference/asyncGetter_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncGetter_es5.types rename to tests/baselines/reference/asyncGetter_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncGetter_es5(target=es5).errors.txt b/tests/baselines/reference/asyncGetter_es5(target=es5).errors.txt new file mode 100644 index 0000000000000..8d0d28e07f394 --- /dev/null +++ b/tests/baselines/reference/asyncGetter_es5(target=es5).errors.txt @@ -0,0 +1,13 @@ +asyncGetter_es5.ts(2,3): error TS1042: 'async' modifier cannot be used here. +asyncGetter_es5.ts(2,13): error TS2378: A 'get' accessor must return a value. + + +==== asyncGetter_es5.ts (2 errors) ==== + class C { + async get foo() { + ~~~~~ +!!! error TS1042: 'async' modifier cannot be used here. + ~~~ +!!! error TS2378: A 'get' accessor must return a value. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncGetter_es5.js b/tests/baselines/reference/asyncGetter_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncGetter_es5.js rename to tests/baselines/reference/asyncGetter_es5(target=es5).js diff --git a/tests/baselines/reference/asyncGetter_es5(target=es5).symbols b/tests/baselines/reference/asyncGetter_es5(target=es5).symbols new file mode 100644 index 0000000000000..e8c3947b69dec --- /dev/null +++ b/tests/baselines/reference/asyncGetter_es5(target=es5).symbols @@ -0,0 +1,10 @@ +//// [tests/cases/conformance/async/es5/asyncGetter_es5.ts] //// + +=== asyncGetter_es5.ts === +class C { +>C : Symbol(C, Decl(asyncGetter_es5.ts, 0, 0)) + + async get foo() { +>foo : Symbol(C.foo, Decl(asyncGetter_es5.ts, 0, 9)) + } +} diff --git a/tests/baselines/reference/asyncGetter_es5(target=es5).types b/tests/baselines/reference/asyncGetter_es5(target=es5).types new file mode 100644 index 0000000000000..a369eddda3081 --- /dev/null +++ b/tests/baselines/reference/asyncGetter_es5(target=es5).types @@ -0,0 +1,12 @@ +//// [tests/cases/conformance/async/es5/asyncGetter_es5.ts] //// + +=== asyncGetter_es5.ts === +class C { +>C : C +> : ^ + + async get foo() { +>foo : void +> : ^^^^ + } +} diff --git a/tests/baselines/reference/asyncImportNestedYield.js b/tests/baselines/reference/asyncImportNestedYield.js index 81ffe76523fa8..73a55fe1ec2b8 100644 --- a/tests/baselines/reference/asyncImportNestedYield.js +++ b/tests/baselines/reference/asyncImportNestedYield.js @@ -39,33 +39,6 @@ var __importStar = (this && this.__importStar) || (function () { return result; }; })(); -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); - return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (g && (g = 0, op[0] && (_ = 0)), _) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } 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 }; - } -}; var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); @@ -80,16 +53,7 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } }; function foo() { - return __asyncGenerator(this, arguments, function foo_1() { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, __await("foo")]; - case 1: return [4 /*yield*/, _a.sent()]; - case 2: return [4 /*yield*/, __await.apply(void 0, [Promise.resolve("".concat(_a.sent())).then(function (s) { return __importStar(require(s)); })])]; - case 3: - Promise.resolve("".concat((_a.sent()).default)).then(function (s) { return __importStar(require(s)); }); - return [2 /*return*/]; - } - }); + return __asyncGenerator(this, arguments, function* foo_1() { + Promise.resolve(`${(yield __await(Promise.resolve(`${yield yield __await("foo")}`).then(s => __importStar(require(s))))).default}`).then(s => __importStar(require(s))); }); } diff --git a/tests/baselines/reference/asyncImportedPromise_es5(target=es2015).errors.txt b/tests/baselines/reference/asyncImportedPromise_es5(target=es2015).errors.txt new file mode 100644 index 0000000000000..e26e60423e201 --- /dev/null +++ b/tests/baselines/reference/asyncImportedPromise_es5(target=es2015).errors.txt @@ -0,0 +1,13 @@ +test.ts(3,25): error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? + + +==== task.ts (0 errors) ==== + export class Task extends Promise { } + +==== test.ts (1 errors) ==== + import { Task } from "./task"; + class Test { + async example(): Task { return; } + ~~~~~~~ +!!! error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncImportedPromise_es5(target=es2015).js b/tests/baselines/reference/asyncImportedPromise_es5(target=es2015).js new file mode 100644 index 0000000000000..d452e0e36761e --- /dev/null +++ b/tests/baselines/reference/asyncImportedPromise_es5(target=es2015).js @@ -0,0 +1,35 @@ +//// [tests/cases/conformance/async/es5/asyncImportedPromise_es5.ts] //// + +//// [task.ts] +export class Task extends Promise { } + +//// [test.ts] +import { Task } from "./task"; +class Test { + async example(): Task { return; } +} + +//// [task.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Task = void 0; +class Task extends Promise { +} +exports.Task = Task; +//// [test.js] +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +class Test { + example() { + return __awaiter(this, void 0, void 0, function* () { return; }); + } +} diff --git a/tests/baselines/reference/asyncImportedPromise_es5.symbols b/tests/baselines/reference/asyncImportedPromise_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncImportedPromise_es5.symbols rename to tests/baselines/reference/asyncImportedPromise_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncImportedPromise_es5.types b/tests/baselines/reference/asyncImportedPromise_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncImportedPromise_es5.types rename to tests/baselines/reference/asyncImportedPromise_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncImportedPromise_es5.js b/tests/baselines/reference/asyncImportedPromise_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncImportedPromise_es5.js rename to tests/baselines/reference/asyncImportedPromise_es5(target=es5).js diff --git a/tests/baselines/reference/asyncImportedPromise_es5(target=es5).symbols b/tests/baselines/reference/asyncImportedPromise_es5(target=es5).symbols new file mode 100644 index 0000000000000..9aa3ff0871161 --- /dev/null +++ b/tests/baselines/reference/asyncImportedPromise_es5(target=es5).symbols @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/async/es5/asyncImportedPromise_es5.ts] //// + +=== task.ts === +export class Task extends Promise { } +>Task : Symbol(Task, Decl(task.ts, 0, 0)) +>T : Symbol(T, Decl(task.ts, 0, 18)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>T : Symbol(T, Decl(task.ts, 0, 18)) + +=== test.ts === +import { Task } from "./task"; +>Task : Symbol(Task, Decl(test.ts, 0, 8)) + +class Test { +>Test : Symbol(Test, Decl(test.ts, 0, 30)) + + async example(): Task { return; } +>example : Symbol(Test.example, Decl(test.ts, 1, 12)) +>T : Symbol(T, Decl(test.ts, 2, 18)) +>Task : Symbol(Task, Decl(test.ts, 0, 8)) +>T : Symbol(T, Decl(test.ts, 2, 18)) +} diff --git a/tests/baselines/reference/asyncImportedPromise_es5(target=es5).types b/tests/baselines/reference/asyncImportedPromise_es5(target=es5).types new file mode 100644 index 0000000000000..45922f1c1475a --- /dev/null +++ b/tests/baselines/reference/asyncImportedPromise_es5(target=es5).types @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/async/es5/asyncImportedPromise_es5.ts] //// + +=== task.ts === +export class Task extends Promise { } +>Task : Task +> : ^^^^^^^ +>Promise : Promise +> : ^^^^^^^^^^ + +=== test.ts === +import { Task } from "./task"; +>Task : typeof Task +> : ^^^^^^^^^^^ + +class Test { +>Test : Test +> : ^^^^ + + async example(): Task { return; } +>example : () => Task +> : ^ ^^^^^^^ +} diff --git a/tests/baselines/reference/asyncInterface_es5.errors.txt b/tests/baselines/reference/asyncInterface_es5(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/asyncInterface_es5.errors.txt rename to tests/baselines/reference/asyncInterface_es5(target=es2015).errors.txt diff --git a/tests/baselines/reference/asyncInterface_es5.js b/tests/baselines/reference/asyncInterface_es5(target=es2015).js similarity index 100% rename from tests/baselines/reference/asyncInterface_es5.js rename to tests/baselines/reference/asyncInterface_es5(target=es2015).js diff --git a/tests/baselines/reference/asyncInterface_es5.symbols b/tests/baselines/reference/asyncInterface_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncInterface_es5.symbols rename to tests/baselines/reference/asyncInterface_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncInterface_es5.types b/tests/baselines/reference/asyncInterface_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncInterface_es5.types rename to tests/baselines/reference/asyncInterface_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncInterface_es5(target=es5).errors.txt b/tests/baselines/reference/asyncInterface_es5(target=es5).errors.txt new file mode 100644 index 0000000000000..931ebb1e21497 --- /dev/null +++ b/tests/baselines/reference/asyncInterface_es5(target=es5).errors.txt @@ -0,0 +1,8 @@ +asyncInterface_es5.ts(1,1): error TS1042: 'async' modifier cannot be used here. + + +==== asyncInterface_es5.ts (1 errors) ==== + async interface I { + ~~~~~ +!!! error TS1042: 'async' modifier cannot be used here. + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncInterface_es5(target=es5).js b/tests/baselines/reference/asyncInterface_es5(target=es5).js new file mode 100644 index 0000000000000..5931d9bb76a39 --- /dev/null +++ b/tests/baselines/reference/asyncInterface_es5(target=es5).js @@ -0,0 +1,7 @@ +//// [tests/cases/conformance/async/es5/asyncInterface_es5.ts] //// + +//// [asyncInterface_es5.ts] +async interface I { +} + +//// [asyncInterface_es5.js] diff --git a/tests/baselines/reference/asyncInterface_es5(target=es5).symbols b/tests/baselines/reference/asyncInterface_es5(target=es5).symbols new file mode 100644 index 0000000000000..95beee09f7c7d --- /dev/null +++ b/tests/baselines/reference/asyncInterface_es5(target=es5).symbols @@ -0,0 +1,6 @@ +//// [tests/cases/conformance/async/es5/asyncInterface_es5.ts] //// + +=== asyncInterface_es5.ts === +async interface I { +>I : Symbol(I, Decl(asyncInterface_es5.ts, 0, 0)) +} diff --git a/tests/baselines/reference/asyncInterface_es5(target=es5).types b/tests/baselines/reference/asyncInterface_es5(target=es5).types new file mode 100644 index 0000000000000..6cb7fa0fb0f44 --- /dev/null +++ b/tests/baselines/reference/asyncInterface_es5(target=es5).types @@ -0,0 +1,6 @@ +//// [tests/cases/conformance/async/es5/asyncInterface_es5.ts] //// + +=== asyncInterface_es5.ts === + +async interface I { +} diff --git a/tests/baselines/reference/asyncMethodWithSuper_es5(target=es2015).js b/tests/baselines/reference/asyncMethodWithSuper_es5(target=es2015).js new file mode 100644 index 0000000000000..973a66e85459e --- /dev/null +++ b/tests/baselines/reference/asyncMethodWithSuper_es5(target=es2015).js @@ -0,0 +1,117 @@ +//// [tests/cases/conformance/async/es5/asyncMethodWithSuper_es5.ts] //// + +//// [asyncMethodWithSuper_es5.ts] +class A { + x() { + } + y() { + } +} + +class B extends A { + // async method with only call/get on 'super' does not require a binding + async simple() { + // call with property access + 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 }); + } +} + + +//// [asyncMethodWithSuper_es5.js] +class A { + x() { + } + y() { + } +} +class B extends A { + // async method with only call/get on 'super' does not require a binding + simple() { + const _superIndex = name => super[name]; + const _super = Object.create(null, { + x: { get: () => super.x }, + y: { get: () => super.y } + }); + return __awaiter(this, void 0, void 0, function* () { + // call with property access + _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) { + const cache = Object.create(null); + return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } }); + })(name => super[name], (name, value) => super[name] = value); + const _super = Object.create(null, { + x: { get: () => super.x, set: v => super.x = v } + }); + 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 }); + }); + } +} diff --git a/tests/baselines/reference/asyncMethodWithSuper_es5.symbols b/tests/baselines/reference/asyncMethodWithSuper_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncMethodWithSuper_es5.symbols rename to tests/baselines/reference/asyncMethodWithSuper_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncMethodWithSuper_es5.types b/tests/baselines/reference/asyncMethodWithSuper_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncMethodWithSuper_es5.types rename to tests/baselines/reference/asyncMethodWithSuper_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncMethodWithSuper_es5.js b/tests/baselines/reference/asyncMethodWithSuper_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncMethodWithSuper_es5.js rename to tests/baselines/reference/asyncMethodWithSuper_es5(target=es5).js diff --git a/tests/baselines/reference/asyncMethodWithSuper_es5(target=es5).symbols b/tests/baselines/reference/asyncMethodWithSuper_es5(target=es5).symbols new file mode 100644 index 0000000000000..4155347523298 --- /dev/null +++ b/tests/baselines/reference/asyncMethodWithSuper_es5(target=es5).symbols @@ -0,0 +1,114 @@ +//// [tests/cases/conformance/async/es5/asyncMethodWithSuper_es5.ts] //// + +=== asyncMethodWithSuper_es5.ts === +class A { +>A : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) + + x() { +>x : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) + } + y() { +>y : Symbol(A.y, Decl(asyncMethodWithSuper_es5.ts, 2, 5)) + } +} + +class B extends A { +>B : Symbol(B, Decl(asyncMethodWithSuper_es5.ts, 5, 1)) +>A : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) + + // async method with only call/get on 'super' does not require a binding + async simple() { +>simple : Symbol(B.simple, Decl(asyncMethodWithSuper_es5.ts, 7, 19)) + + // call with property access + super.x(); +>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) +>x : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) + + // call additional property. + super.y(); +>super.y : Symbol(A.y, Decl(asyncMethodWithSuper_es5.ts, 2, 5)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) +>y : Symbol(A.y, Decl(asyncMethodWithSuper_es5.ts, 2, 5)) + + // call with element access + super["x"](); +>super : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) +>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) + + // property access (read) + const a = super.x; +>a : Symbol(a, Decl(asyncMethodWithSuper_es5.ts, 19, 13)) +>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) +>x : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) + + // element access (read) + const b = super["x"]; +>b : Symbol(b, Decl(asyncMethodWithSuper_es5.ts, 22, 13)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) +>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) + } + + // async method with assignment/destructuring on 'super' requires a binding + async advanced() { +>advanced : Symbol(B.advanced, Decl(asyncMethodWithSuper_es5.ts, 23, 5)) + + const f = () => {}; +>f : Symbol(f, Decl(asyncMethodWithSuper_es5.ts, 27, 13)) + + // call with property access + super.x(); +>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) +>x : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) + + // call with element access + super["x"](); +>super : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) +>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) + + // property access (read) + const a = super.x; +>a : Symbol(a, Decl(asyncMethodWithSuper_es5.ts, 36, 13)) +>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) +>x : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) + + // element access (read) + const b = super["x"]; +>b : Symbol(b, Decl(asyncMethodWithSuper_es5.ts, 39, 13)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) +>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) + + // property access (assign) + super.x = f; +>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) +>x : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) +>f : Symbol(f, Decl(asyncMethodWithSuper_es5.ts, 27, 13)) + + // element access (assign) + super["x"] = f; +>super : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) +>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) +>f : Symbol(f, Decl(asyncMethodWithSuper_es5.ts, 27, 13)) + + // destructuring assign with property access + ({ f: super.x } = { f }); +>f : Symbol(f, Decl(asyncMethodWithSuper_es5.ts, 48, 10)) +>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) +>x : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) +>f : Symbol(f, Decl(asyncMethodWithSuper_es5.ts, 48, 27)) + + // destructuring assign with element access + ({ f: super["x"] } = { f }); +>f : Symbol(f, Decl(asyncMethodWithSuper_es5.ts, 51, 10)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) +>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) +>f : Symbol(f, Decl(asyncMethodWithSuper_es5.ts, 51, 30)) + } +} + diff --git a/tests/baselines/reference/asyncMethodWithSuper_es5(target=es5).types b/tests/baselines/reference/asyncMethodWithSuper_es5(target=es5).types new file mode 100644 index 0000000000000..8a930be3bcbfa --- /dev/null +++ b/tests/baselines/reference/asyncMethodWithSuper_es5(target=es5).types @@ -0,0 +1,209 @@ +//// [tests/cases/conformance/async/es5/asyncMethodWithSuper_es5.ts] //// + +=== asyncMethodWithSuper_es5.ts === +class A { +>A : A +> : ^ + + x() { +>x : () => void +> : ^^^^^^^^^^ + } + y() { +>y : () => void +> : ^^^^^^^^^^ + } +} + +class B extends A { +>B : B +> : ^ +>A : A +> : ^ + + // async method with only call/get on 'super' does not require a binding + async simple() { +>simple : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + + // call with property access + super.x(); +>super.x() : void +> : ^^^^ +>super.x : () => void +> : ^^^^^^^^^^ +>super : A +> : ^ +>x : () => void +> : ^^^^^^^^^^ + + // call additional property. + super.y(); +>super.y() : void +> : ^^^^ +>super.y : () => void +> : ^^^^^^^^^^ +>super : A +> : ^ +>y : () => void +> : ^^^^^^^^^^ + + // call with element access + super["x"](); +>super["x"]() : void +> : ^^^^ +>super["x"] : () => void +> : ^^^^^^^^^^ +>super : A +> : ^ +>"x" : "x" +> : ^^^ + + // property access (read) + const a = super.x; +>a : () => void +> : ^^^^^^^^^^ +>super.x : () => void +> : ^^^^^^^^^^ +>super : A +> : ^ +>x : () => void +> : ^^^^^^^^^^ + + // element access (read) + const b = super["x"]; +>b : () => void +> : ^^^^^^^^^^ +>super["x"] : () => void +> : ^^^^^^^^^^ +>super : A +> : ^ +>"x" : "x" +> : ^^^ + } + + // async method with assignment/destructuring on 'super' requires a binding + async advanced() { +>advanced : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + + const f = () => {}; +>f : () => void +> : ^^^^^^^^^^ +>() => {} : () => void +> : ^^^^^^^^^^ + + // call with property access + super.x(); +>super.x() : void +> : ^^^^ +>super.x : () => void +> : ^^^^^^^^^^ +>super : A +> : ^ +>x : () => void +> : ^^^^^^^^^^ + + // call with element access + super["x"](); +>super["x"]() : void +> : ^^^^ +>super["x"] : () => void +> : ^^^^^^^^^^ +>super : A +> : ^ +>"x" : "x" +> : ^^^ + + // property access (read) + const a = super.x; +>a : () => void +> : ^^^^^^^^^^ +>super.x : () => void +> : ^^^^^^^^^^ +>super : A +> : ^ +>x : () => void +> : ^^^^^^^^^^ + + // element access (read) + const b = super["x"]; +>b : () => void +> : ^^^^^^^^^^ +>super["x"] : () => void +> : ^^^^^^^^^^ +>super : A +> : ^ +>"x" : "x" +> : ^^^ + + // property access (assign) + super.x = f; +>super.x = f : () => void +> : ^^^^^^^^^^ +>super.x : () => void +> : ^^^^^^^^^^ +>super : A +> : ^ +>x : () => void +> : ^^^^^^^^^^ +>f : () => void +> : ^^^^^^^^^^ + + // element access (assign) + super["x"] = f; +>super["x"] = f : () => void +> : ^^^^^^^^^^ +>super["x"] : () => void +> : ^^^^^^^^^^ +>super : A +> : ^ +>"x" : "x" +> : ^^^ +>f : () => void +> : ^^^^^^^^^^ + + // destructuring assign with property access + ({ f: super.x } = { f }); +>({ f: super.x } = { f }) : { f: () => void; } +> : ^^^^^^^^^^^^^^^^^^ +>{ f: super.x } = { f } : { f: () => void; } +> : ^^^^^^^^^^^^^^^^^^ +>{ f: super.x } : { f: () => void; } +> : ^^^^^^^^^^^^^^^^^^ +>f : () => void +> : ^^^^^^^^^^ +>super.x : () => void +> : ^^^^^^^^^^ +>super : A +> : ^ +>x : () => void +> : ^^^^^^^^^^ +>{ f } : { f: () => void; } +> : ^^^^^^^^^^^^^^^^^^ +>f : () => void +> : ^^^^^^^^^^ + + // destructuring assign with element access + ({ f: super["x"] } = { f }); +>({ f: super["x"] } = { f }) : { f: () => void; } +> : ^^^^^^^^^^^^^^^^^^ +>{ f: super["x"] } = { f } : { f: () => void; } +> : ^^^^^^^^^^^^^^^^^^ +>{ f: super["x"] } : { f: () => void; } +> : ^^^^^^^^^^^^^^^^^^ +>f : () => void +> : ^^^^^^^^^^ +>super["x"] : () => void +> : ^^^^^^^^^^ +>super : A +> : ^ +>"x" : "x" +> : ^^^ +>{ f } : { f: () => void; } +> : ^^^^^^^^^^^^^^^^^^ +>f : () => void +> : ^^^^^^^^^^ + } +} + diff --git a/tests/baselines/reference/asyncModule_es5.errors.txt b/tests/baselines/reference/asyncModule_es5(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/asyncModule_es5.errors.txt rename to tests/baselines/reference/asyncModule_es5(target=es2015).errors.txt diff --git a/tests/baselines/reference/asyncModule_es5.js b/tests/baselines/reference/asyncModule_es5(target=es2015).js similarity index 100% rename from tests/baselines/reference/asyncModule_es5.js rename to tests/baselines/reference/asyncModule_es5(target=es2015).js diff --git a/tests/baselines/reference/asyncModule_es5.symbols b/tests/baselines/reference/asyncModule_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncModule_es5.symbols rename to tests/baselines/reference/asyncModule_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncModule_es5.types b/tests/baselines/reference/asyncModule_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncModule_es5.types rename to tests/baselines/reference/asyncModule_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncModule_es5(target=es5).errors.txt b/tests/baselines/reference/asyncModule_es5(target=es5).errors.txt new file mode 100644 index 0000000000000..c381d2a74aca7 --- /dev/null +++ b/tests/baselines/reference/asyncModule_es5(target=es5).errors.txt @@ -0,0 +1,8 @@ +asyncModule_es5.ts(1,1): error TS1042: 'async' modifier cannot be used here. + + +==== asyncModule_es5.ts (1 errors) ==== + async namespace M { + ~~~~~ +!!! error TS1042: 'async' modifier cannot be used here. + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncModule_es5(target=es5).js b/tests/baselines/reference/asyncModule_es5(target=es5).js new file mode 100644 index 0000000000000..2fdf36581c62b --- /dev/null +++ b/tests/baselines/reference/asyncModule_es5(target=es5).js @@ -0,0 +1,7 @@ +//// [tests/cases/conformance/async/es5/asyncModule_es5.ts] //// + +//// [asyncModule_es5.ts] +async namespace M { +} + +//// [asyncModule_es5.js] diff --git a/tests/baselines/reference/asyncModule_es5(target=es5).symbols b/tests/baselines/reference/asyncModule_es5(target=es5).symbols new file mode 100644 index 0000000000000..1c93a6a3c6329 --- /dev/null +++ b/tests/baselines/reference/asyncModule_es5(target=es5).symbols @@ -0,0 +1,6 @@ +//// [tests/cases/conformance/async/es5/asyncModule_es5.ts] //// + +=== asyncModule_es5.ts === +async namespace M { +>M : Symbol(M, Decl(asyncModule_es5.ts, 0, 0)) +} diff --git a/tests/baselines/reference/asyncModule_es5(target=es5).types b/tests/baselines/reference/asyncModule_es5(target=es5).types new file mode 100644 index 0000000000000..efbbf941a1f1d --- /dev/null +++ b/tests/baselines/reference/asyncModule_es5(target=es5).types @@ -0,0 +1,6 @@ +//// [tests/cases/conformance/async/es5/asyncModule_es5.ts] //// + +=== asyncModule_es5.ts === + +async namespace M { +} diff --git a/tests/baselines/reference/asyncMultiFile_es5(target=es2015).js b/tests/baselines/reference/asyncMultiFile_es5(target=es2015).js new file mode 100644 index 0000000000000..fa46f1cdbd7f0 --- /dev/null +++ b/tests/baselines/reference/asyncMultiFile_es5(target=es2015).js @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/async/es5/asyncMultiFile_es5.ts] //// + +//// [a.ts] +async function f() {} +//// [b.ts] +function g() { } + +//// [a.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +function f() { + return __awaiter(this, void 0, void 0, function* () { }); +} +//// [b.js] +function g() { } diff --git a/tests/baselines/reference/asyncMultiFile_es5.symbols b/tests/baselines/reference/asyncMultiFile_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncMultiFile_es5.symbols rename to tests/baselines/reference/asyncMultiFile_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncMultiFile_es5.types b/tests/baselines/reference/asyncMultiFile_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncMultiFile_es5.types rename to tests/baselines/reference/asyncMultiFile_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncMultiFile_es5.js b/tests/baselines/reference/asyncMultiFile_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncMultiFile_es5.js rename to tests/baselines/reference/asyncMultiFile_es5(target=es5).js diff --git a/tests/baselines/reference/asyncMultiFile_es5(target=es5).symbols b/tests/baselines/reference/asyncMultiFile_es5(target=es5).symbols new file mode 100644 index 0000000000000..e614d98bb2b29 --- /dev/null +++ b/tests/baselines/reference/asyncMultiFile_es5(target=es5).symbols @@ -0,0 +1,10 @@ +//// [tests/cases/conformance/async/es5/asyncMultiFile_es5.ts] //// + +=== a.ts === +async function f() {} +>f : Symbol(f, Decl(a.ts, 0, 0)) + +=== b.ts === +function g() { } +>g : Symbol(g, Decl(b.ts, 0, 0)) + diff --git a/tests/baselines/reference/asyncMultiFile_es5(target=es5).types b/tests/baselines/reference/asyncMultiFile_es5(target=es5).types new file mode 100644 index 0000000000000..bb873420a332a --- /dev/null +++ b/tests/baselines/reference/asyncMultiFile_es5(target=es5).types @@ -0,0 +1,12 @@ +//// [tests/cases/conformance/async/es5/asyncMultiFile_es5.ts] //// + +=== a.ts === +async function f() {} +>f : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + +=== b.ts === +function g() { } +>g : () => void +> : ^^^^^^^^^^ + diff --git a/tests/baselines/reference/asyncQualifiedReturnType_es5(target=es2015).errors.txt b/tests/baselines/reference/asyncQualifiedReturnType_es5(target=es2015).errors.txt new file mode 100644 index 0000000000000..5e2ce01846052 --- /dev/null +++ b/tests/baselines/reference/asyncQualifiedReturnType_es5(target=es2015).errors.txt @@ -0,0 +1,13 @@ +asyncQualifiedReturnType_es5.ts(6,21): error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? + + +==== asyncQualifiedReturnType_es5.ts (1 errors) ==== + namespace X { + export class MyPromise extends Promise { + } + } + + async function f(): X.MyPromise { + ~~~~~~~~~~~~~~~~~ +!!! error TS1064: The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise'? + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncQualifiedReturnType_es5(target=es2015).js b/tests/baselines/reference/asyncQualifiedReturnType_es5(target=es2015).js new file mode 100644 index 0000000000000..381b121316173 --- /dev/null +++ b/tests/baselines/reference/asyncQualifiedReturnType_es5(target=es2015).js @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/async/es5/asyncQualifiedReturnType_es5.ts] //// + +//// [asyncQualifiedReturnType_es5.ts] +namespace X { + export class MyPromise extends Promise { + } +} + +async function f(): X.MyPromise { +} + +//// [asyncQualifiedReturnType_es5.js] +var X; +(function (X) { + class MyPromise extends Promise { + } + X.MyPromise = MyPromise; +})(X || (X = {})); +function f() { + return __awaiter(this, void 0, void 0, function* () { + }); +} diff --git a/tests/baselines/reference/asyncQualifiedReturnType_es5.symbols b/tests/baselines/reference/asyncQualifiedReturnType_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncQualifiedReturnType_es5.symbols rename to tests/baselines/reference/asyncQualifiedReturnType_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncQualifiedReturnType_es5.types b/tests/baselines/reference/asyncQualifiedReturnType_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncQualifiedReturnType_es5.types rename to tests/baselines/reference/asyncQualifiedReturnType_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncQualifiedReturnType_es5.js b/tests/baselines/reference/asyncQualifiedReturnType_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncQualifiedReturnType_es5.js rename to tests/baselines/reference/asyncQualifiedReturnType_es5(target=es5).js diff --git a/tests/baselines/reference/asyncQualifiedReturnType_es5(target=es5).symbols b/tests/baselines/reference/asyncQualifiedReturnType_es5(target=es5).symbols new file mode 100644 index 0000000000000..ec66e0db875d1 --- /dev/null +++ b/tests/baselines/reference/asyncQualifiedReturnType_es5(target=es5).symbols @@ -0,0 +1,19 @@ +//// [tests/cases/conformance/async/es5/asyncQualifiedReturnType_es5.ts] //// + +=== asyncQualifiedReturnType_es5.ts === +namespace X { +>X : Symbol(X, Decl(asyncQualifiedReturnType_es5.ts, 0, 0)) + + export class MyPromise extends Promise { +>MyPromise : Symbol(MyPromise, Decl(asyncQualifiedReturnType_es5.ts, 0, 13)) +>T : Symbol(T, Decl(asyncQualifiedReturnType_es5.ts, 1, 27)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>T : Symbol(T, Decl(asyncQualifiedReturnType_es5.ts, 1, 27)) + } +} + +async function f(): X.MyPromise { +>f : Symbol(f, Decl(asyncQualifiedReturnType_es5.ts, 3, 1)) +>X : Symbol(X, Decl(asyncQualifiedReturnType_es5.ts, 0, 0)) +>MyPromise : Symbol(X.MyPromise, Decl(asyncQualifiedReturnType_es5.ts, 0, 13)) +} diff --git a/tests/baselines/reference/asyncQualifiedReturnType_es5(target=es5).types b/tests/baselines/reference/asyncQualifiedReturnType_es5(target=es5).types new file mode 100644 index 0000000000000..db4e8945b121a --- /dev/null +++ b/tests/baselines/reference/asyncQualifiedReturnType_es5(target=es5).types @@ -0,0 +1,21 @@ +//// [tests/cases/conformance/async/es5/asyncQualifiedReturnType_es5.ts] //// + +=== asyncQualifiedReturnType_es5.ts === +namespace X { +>X : typeof X +> : ^^^^^^^^ + + export class MyPromise extends Promise { +>MyPromise : MyPromise +> : ^^^^^^^^^^^^ +>Promise : Promise +> : ^^^^^^^^^^ + } +} + +async function f(): X.MyPromise { +>f : () => X.MyPromise +> : ^^^^^^ +>X : any +> : ^^^ +} diff --git a/tests/baselines/reference/asyncSetter_es5.errors.txt b/tests/baselines/reference/asyncSetter_es5(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/asyncSetter_es5.errors.txt rename to tests/baselines/reference/asyncSetter_es5(target=es2015).errors.txt diff --git a/tests/baselines/reference/asyncSetter_es5(target=es2015).js b/tests/baselines/reference/asyncSetter_es5(target=es2015).js new file mode 100644 index 0000000000000..33922c0ac729e --- /dev/null +++ b/tests/baselines/reference/asyncSetter_es5(target=es2015).js @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/async/es5/asyncSetter_es5.ts] //// + +//// [asyncSetter_es5.ts] +class C { + async set foo(value) { + } +} + +//// [asyncSetter_es5.js] +class C { + set foo(value) { + } +} diff --git a/tests/baselines/reference/asyncSetter_es5.symbols b/tests/baselines/reference/asyncSetter_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncSetter_es5.symbols rename to tests/baselines/reference/asyncSetter_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncSetter_es5.types b/tests/baselines/reference/asyncSetter_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncSetter_es5.types rename to tests/baselines/reference/asyncSetter_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncSetter_es5(target=es5).errors.txt b/tests/baselines/reference/asyncSetter_es5(target=es5).errors.txt new file mode 100644 index 0000000000000..d637655d34104 --- /dev/null +++ b/tests/baselines/reference/asyncSetter_es5(target=es5).errors.txt @@ -0,0 +1,10 @@ +asyncSetter_es5.ts(2,3): error TS1042: 'async' modifier cannot be used here. + + +==== asyncSetter_es5.ts (1 errors) ==== + class C { + async set foo(value) { + ~~~~~ +!!! error TS1042: 'async' modifier cannot be used here. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncSetter_es5.js b/tests/baselines/reference/asyncSetter_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncSetter_es5.js rename to tests/baselines/reference/asyncSetter_es5(target=es5).js diff --git a/tests/baselines/reference/asyncSetter_es5(target=es5).symbols b/tests/baselines/reference/asyncSetter_es5(target=es5).symbols new file mode 100644 index 0000000000000..cc3d1923c6ccf --- /dev/null +++ b/tests/baselines/reference/asyncSetter_es5(target=es5).symbols @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/async/es5/asyncSetter_es5.ts] //// + +=== asyncSetter_es5.ts === +class C { +>C : Symbol(C, Decl(asyncSetter_es5.ts, 0, 0)) + + async set foo(value) { +>foo : Symbol(C.foo, Decl(asyncSetter_es5.ts, 0, 9)) +>value : Symbol(value, Decl(asyncSetter_es5.ts, 1, 16)) + } +} diff --git a/tests/baselines/reference/asyncSetter_es5(target=es5).types b/tests/baselines/reference/asyncSetter_es5(target=es5).types new file mode 100644 index 0000000000000..eea0fee80adb1 --- /dev/null +++ b/tests/baselines/reference/asyncSetter_es5(target=es5).types @@ -0,0 +1,14 @@ +//// [tests/cases/conformance/async/es5/asyncSetter_es5.ts] //// + +=== asyncSetter_es5.ts === +class C { +>C : C +> : ^ + + async set foo(value) { +>foo : any +> : ^^^ +>value : any +> : ^^^ + } +} diff --git a/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5(target=es2015).js b/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5(target=es2015).js new file mode 100644 index 0000000000000..391660eab9804 --- /dev/null +++ b/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5(target=es2015).js @@ -0,0 +1,10 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncUnParenthesizedArrowFunction_es5.ts] //// + +//// [asyncUnParenthesizedArrowFunction_es5.ts] +declare function someOtherFunction(i: any): Promise; +const x = async i => await someOtherFunction(i) +const x1 = async (i) => await someOtherFunction(i); + +//// [asyncUnParenthesizedArrowFunction_es5.js] +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/asyncUnParenthesizedArrowFunction_es5.symbols b/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5.symbols rename to tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5.types b/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5.types rename to tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5.js b/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5.js rename to tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5(target=es5).js diff --git a/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5(target=es5).symbols b/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5(target=es5).symbols new file mode 100644 index 0000000000000..94e87d686eed8 --- /dev/null +++ b/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5(target=es5).symbols @@ -0,0 +1,20 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncUnParenthesizedArrowFunction_es5.ts] //// + +=== asyncUnParenthesizedArrowFunction_es5.ts === +declare function someOtherFunction(i: any): Promise; +>someOtherFunction : Symbol(someOtherFunction, Decl(asyncUnParenthesizedArrowFunction_es5.ts, 0, 0)) +>i : Symbol(i, Decl(asyncUnParenthesizedArrowFunction_es5.ts, 0, 35)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const x = async i => await someOtherFunction(i) +>x : Symbol(x, Decl(asyncUnParenthesizedArrowFunction_es5.ts, 1, 5)) +>i : Symbol(i, Decl(asyncUnParenthesizedArrowFunction_es5.ts, 1, 15)) +>someOtherFunction : Symbol(someOtherFunction, Decl(asyncUnParenthesizedArrowFunction_es5.ts, 0, 0)) +>i : Symbol(i, Decl(asyncUnParenthesizedArrowFunction_es5.ts, 1, 15)) + +const x1 = async (i) => await someOtherFunction(i); +>x1 : Symbol(x1, Decl(asyncUnParenthesizedArrowFunction_es5.ts, 2, 5)) +>i : Symbol(i, Decl(asyncUnParenthesizedArrowFunction_es5.ts, 2, 18)) +>someOtherFunction : Symbol(someOtherFunction, Decl(asyncUnParenthesizedArrowFunction_es5.ts, 0, 0)) +>i : Symbol(i, Decl(asyncUnParenthesizedArrowFunction_es5.ts, 2, 18)) + diff --git a/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5(target=es5).types b/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5(target=es5).types new file mode 100644 index 0000000000000..20fcabfe2922e --- /dev/null +++ b/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es5(target=es5).types @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/async/es5/asyncArrowFunction/asyncUnParenthesizedArrowFunction_es5.ts] //// + +=== asyncUnParenthesizedArrowFunction_es5.ts === +declare function someOtherFunction(i: any): Promise; +>someOtherFunction : (i: any) => Promise +> : ^ ^^ ^^^^^ +>i : any + +const x = async i => await someOtherFunction(i) +>x : (i: any) => Promise +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^ +>async i => await someOtherFunction(i) : (i: any) => Promise +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^ +>i : any +>await someOtherFunction(i) : void +> : ^^^^ +>someOtherFunction(i) : Promise +> : ^^^^^^^^^^^^^ +>someOtherFunction : (i: any) => Promise +> : ^ ^^ ^^^^^ +>i : any + +const x1 = async (i) => await someOtherFunction(i); +>x1 : (i: any) => Promise +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^ +>async (i) => await someOtherFunction(i) : (i: any) => Promise +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^ +>i : any +>await someOtherFunction(i) : void +> : ^^^^ +>someOtherFunction(i) : Promise +> : ^^^^^^^^^^^^^ +>someOtherFunction : (i: any) => Promise +> : ^ ^^ ^^^^^ +>i : any + diff --git a/tests/baselines/reference/asyncUseStrict_es5(target=es2015).js b/tests/baselines/reference/asyncUseStrict_es5(target=es2015).js new file mode 100644 index 0000000000000..20c7eb1546119 --- /dev/null +++ b/tests/baselines/reference/asyncUseStrict_es5(target=es2015).js @@ -0,0 +1,17 @@ +//// [tests/cases/conformance/async/es5/asyncUseStrict_es5.ts] //// + +//// [asyncUseStrict_es5.ts] +declare var a: boolean; +declare var p: Promise; +async function func(): Promise { + "use strict"; + var b = await p || a; +} + +//// [asyncUseStrict_es5.js] +function func() { + return __awaiter(this, void 0, void 0, function* () { + "use strict"; + var b = (yield p) || a; + }); +} diff --git a/tests/baselines/reference/asyncUseStrict_es5.symbols b/tests/baselines/reference/asyncUseStrict_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/asyncUseStrict_es5.symbols rename to tests/baselines/reference/asyncUseStrict_es5(target=es2015).symbols diff --git a/tests/baselines/reference/asyncUseStrict_es5.types b/tests/baselines/reference/asyncUseStrict_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/asyncUseStrict_es5.types rename to tests/baselines/reference/asyncUseStrict_es5(target=es2015).types diff --git a/tests/baselines/reference/asyncUseStrict_es5.js b/tests/baselines/reference/asyncUseStrict_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/asyncUseStrict_es5.js rename to tests/baselines/reference/asyncUseStrict_es5(target=es5).js diff --git a/tests/baselines/reference/asyncUseStrict_es5(target=es5).symbols b/tests/baselines/reference/asyncUseStrict_es5(target=es5).symbols new file mode 100644 index 0000000000000..7091f0c4067a3 --- /dev/null +++ b/tests/baselines/reference/asyncUseStrict_es5(target=es5).symbols @@ -0,0 +1,20 @@ +//// [tests/cases/conformance/async/es5/asyncUseStrict_es5.ts] //// + +=== asyncUseStrict_es5.ts === +declare var a: boolean; +>a : Symbol(a, Decl(asyncUseStrict_es5.ts, 0, 11)) + +declare var p: Promise; +>p : Symbol(p, Decl(asyncUseStrict_es5.ts, 1, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +async function func(): Promise { +>func : Symbol(func, Decl(asyncUseStrict_es5.ts, 1, 32)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + "use strict"; + var b = await p || a; +>b : Symbol(b, Decl(asyncUseStrict_es5.ts, 4, 7)) +>p : Symbol(p, Decl(asyncUseStrict_es5.ts, 1, 11)) +>a : Symbol(a, Decl(asyncUseStrict_es5.ts, 0, 11)) +} diff --git a/tests/baselines/reference/asyncUseStrict_es5(target=es5).types b/tests/baselines/reference/asyncUseStrict_es5(target=es5).types new file mode 100644 index 0000000000000..d0149011abace --- /dev/null +++ b/tests/baselines/reference/asyncUseStrict_es5(target=es5).types @@ -0,0 +1,31 @@ +//// [tests/cases/conformance/async/es5/asyncUseStrict_es5.ts] //// + +=== asyncUseStrict_es5.ts === +declare var a: boolean; +>a : boolean +> : ^^^^^^^ + +declare var p: Promise; +>p : Promise +> : ^^^^^^^^^^^^^^^^ + +async function func(): Promise { +>func : () => Promise +> : ^^^^^^ + + "use strict"; +>"use strict" : "use strict" +> : ^^^^^^^^^^^^ + + var b = await p || a; +>b : boolean +> : ^^^^^^^ +>await p || a : boolean +> : ^^^^^^^ +>await p : boolean +> : ^^^^^^^ +>p : Promise +> : ^^^^^^^^^^^^^^^^ +>a : boolean +> : ^^^^^^^ +} diff --git a/tests/baselines/reference/augmentExportEquals1.js b/tests/baselines/reference/augmentExportEquals1.js index 6bc25d7e71bc1..f5d241153b75e 100644 --- a/tests/baselines/reference/augmentExportEquals1.js +++ b/tests/baselines/reference/augmentExportEquals1.js @@ -29,4 +29,4 @@ Object.defineProperty(exports, "__esModule", { value: true }); "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); require("./file2"); -var a; // should not work +let a; // should not work diff --git a/tests/baselines/reference/augmentExportEquals1_1.js b/tests/baselines/reference/augmentExportEquals1_1.js index a640a212e8f6c..9b429a6ba19d7 100644 --- a/tests/baselines/reference/augmentExportEquals1_1.js +++ b/tests/baselines/reference/augmentExportEquals1_1.js @@ -30,5 +30,5 @@ define(["require", "exports"], function (require, exports) { define(["require", "exports", "file2"], function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); - var a; // should not work + let a; // should not work }); diff --git a/tests/baselines/reference/augmentExportEquals2.js b/tests/baselines/reference/augmentExportEquals2.js index e565f18dd087a..30c796d8365ae 100644 --- a/tests/baselines/reference/augmentExportEquals2.js +++ b/tests/baselines/reference/augmentExportEquals2.js @@ -28,4 +28,4 @@ Object.defineProperty(exports, "__esModule", { value: true }); "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); require("./file2"); -var a; // should not work +let a; // should not work diff --git a/tests/baselines/reference/augmentExportEquals2_1.js b/tests/baselines/reference/augmentExportEquals2_1.js index 10bc5541bc5c1..22ab46df5d0c0 100644 --- a/tests/baselines/reference/augmentExportEquals2_1.js +++ b/tests/baselines/reference/augmentExportEquals2_1.js @@ -29,5 +29,5 @@ define(["require", "exports"], function (require, exports) { define(["require", "exports", "file2"], function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); - var a; // should not work + let a; // should not work }); diff --git a/tests/baselines/reference/augmentExportEquals3.js b/tests/baselines/reference/augmentExportEquals3.js index 7f07f319f774f..8fb564804f8af 100644 --- a/tests/baselines/reference/augmentExportEquals3.js +++ b/tests/baselines/reference/augmentExportEquals3.js @@ -33,7 +33,7 @@ module.exports = foo; //// [file2.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var x = require("./file1"); +const x = require("./file1"); x.b = 1; //// [file3.js] "use strict"; @@ -71,7 +71,7 @@ var __importStar = (this && this.__importStar) || (function () { }; })(); Object.defineProperty(exports, "__esModule", { value: true }); -var x = __importStar(require("./file1")); +const x = __importStar(require("./file1")); require("./file2"); -var a; -var b = x.b; +let a; +let b = x.b; diff --git a/tests/baselines/reference/augmentExportEquals3_1.js b/tests/baselines/reference/augmentExportEquals3_1.js index 02af1776b5216..2dfb3376fa452 100644 --- a/tests/baselines/reference/augmentExportEquals3_1.js +++ b/tests/baselines/reference/augmentExportEquals3_1.js @@ -71,6 +71,6 @@ define(["require", "exports", "file1", "file2"], function (require, exports, x) "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); x = __importStar(x); - var a; - var b = x.b; + let a; + let b = x.b; }); diff --git a/tests/baselines/reference/augmentExportEquals4.js b/tests/baselines/reference/augmentExportEquals4.js index fd55f8017fcb1..411afefd7aa74 100644 --- a/tests/baselines/reference/augmentExportEquals4.js +++ b/tests/baselines/reference/augmentExportEquals4.js @@ -25,11 +25,8 @@ let b = x.b; //// [file1.js] "use strict"; -var foo = /** @class */ (function () { - function foo() { - } - return foo; -}()); +class foo { +} (function (foo) { foo.v = 1; })(foo || (foo = {})); @@ -37,7 +34,7 @@ module.exports = foo; //// [file2.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var x = require("./file1"); +const x = require("./file1"); x.b = 1; //// [file3.js] "use strict"; @@ -75,7 +72,7 @@ var __importStar = (this && this.__importStar) || (function () { }; })(); Object.defineProperty(exports, "__esModule", { value: true }); -var x = __importStar(require("./file1")); +const x = __importStar(require("./file1")); require("./file2"); -var a; -var b = x.b; +let a; +let b = x.b; diff --git a/tests/baselines/reference/augmentExportEquals4_1.js b/tests/baselines/reference/augmentExportEquals4_1.js index f17e1ae069a6e..cdb6b86a996fb 100644 --- a/tests/baselines/reference/augmentExportEquals4_1.js +++ b/tests/baselines/reference/augmentExportEquals4_1.js @@ -71,6 +71,6 @@ define(["require", "exports", "file1", "file2"], function (require, exports, x) "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); x = __importStar(x); - var a; - var b = x.b; + let a; + let b = x.b; }); diff --git a/tests/baselines/reference/augmentExportEquals5.js b/tests/baselines/reference/augmentExportEquals5.js index 70efe35ff7f67..1a1ec6a41e996 100644 --- a/tests/baselines/reference/augmentExportEquals5.js +++ b/tests/baselines/reference/augmentExportEquals5.js @@ -87,5 +87,5 @@ Object.defineProperty(exports, "__esModule", { value: true }); "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); require("./augmentation"); -var x; -var y = x.id; +let x; +const y = x.id; diff --git a/tests/baselines/reference/augmentExportEquals6.js b/tests/baselines/reference/augmentExportEquals6.js index 5dc782ed8552e..b55de356a7773 100644 --- a/tests/baselines/reference/augmentExportEquals6.js +++ b/tests/baselines/reference/augmentExportEquals6.js @@ -29,19 +29,13 @@ let c = x.B.b; //// [file1.js] "use strict"; -var foo = /** @class */ (function () { - function foo() { - } - return foo; -}()); +class foo { +} (function (foo) { - var A = /** @class */ (function () { - function A() { - } - return A; - }()); + class A { + } foo.A = A; - var B; + let B; (function (B) { })(B = foo.B || (foo.B = {})); })(foo || (foo = {})); @@ -49,7 +43,7 @@ module.exports = foo; //// [file2.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var x = require("./file1"); +const x = require("./file1"); x.B.b = 1; //// [file3.js] "use strict"; @@ -87,8 +81,8 @@ var __importStar = (this && this.__importStar) || (function () { }; })(); Object.defineProperty(exports, "__esModule", { value: true }); -var x = __importStar(require("./file1")); +const x = __importStar(require("./file1")); require("./file2"); -var a; -var b = a.a; -var c = x.B.b; +let a; +let b = a.a; +let c = x.B.b; diff --git a/tests/baselines/reference/augmentExportEquals6_1.js b/tests/baselines/reference/augmentExportEquals6_1.js index 4a3442327afe3..8ffe7b3a33d82 100644 --- a/tests/baselines/reference/augmentExportEquals6_1.js +++ b/tests/baselines/reference/augmentExportEquals6_1.js @@ -34,6 +34,6 @@ define(["require", "exports"], function (require, exports) { define(["require", "exports", "file2"], function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); - var a; - var b = a.a; + let a; + let b = a.a; }); diff --git a/tests/baselines/reference/augmentedTypeAssignmentCompatIndexSignature.js b/tests/baselines/reference/augmentedTypeAssignmentCompatIndexSignature.js index 186a8ed20f8c5..ff2f989ff79cf 100644 --- a/tests/baselines/reference/augmentedTypeAssignmentCompatIndexSignature.js +++ b/tests/baselines/reference/augmentedTypeAssignmentCompatIndexSignature.js @@ -25,6 +25,6 @@ var v2: { //// [augmentedTypeAssignmentCompatIndexSignature.js] var o = {}; -var f = function () { }; +var f = () => { }; 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 b69be07fad64c..144065f73e53a 100644 --- a/tests/baselines/reference/augmentedTypeBracketAccessIndexSignature.js +++ b/tests/baselines/reference/augmentedTypeBracketAccessIndexSignature.js @@ -17,4 +17,4 @@ var b = (() => { })[0]; // Should be Bar //// [augmentedTypeBracketAccessIndexSignature.js] var a = {}[0]; // Should be Foo -var b = (function () { })[0]; // Should be Bar +var b = (() => { })[0]; // Should be Bar diff --git a/tests/baselines/reference/augmentedTypesClass.js b/tests/baselines/reference/augmentedTypesClass.js index 9116fe462689a..e1c7e35bf53cc 100644 --- a/tests/baselines/reference/augmentedTypesClass.js +++ b/tests/baselines/reference/augmentedTypesClass.js @@ -11,20 +11,14 @@ enum c4 { One } // error //// [augmentedTypesClass.js] //// class then var -var c1 = /** @class */ (function () { - function c1() { - } - c1.prototype.foo = function () { }; - return c1; -}()); +class c1 { + foo() { } +} var c1 = 1; // error //// class then enum -var c4 = /** @class */ (function () { - function c4() { - } - c4.prototype.foo = function () { }; - return c4; -}()); +class c4 { + foo() { } +} (function (c4) { c4[c4["One"] = 0] = "One"; })(c4 || (c4 = {})); // error diff --git a/tests/baselines/reference/augmentedTypesClass2.js b/tests/baselines/reference/augmentedTypesClass2.js index 0914b61b049f2..e90cc001fab2b 100644 --- a/tests/baselines/reference/augmentedTypesClass2.js +++ b/tests/baselines/reference/augmentedTypesClass2.js @@ -35,34 +35,25 @@ class c44 { //// [augmentedTypesClass2.js] // Checking class with other things in type space not value space // class then interface -var c11 = /** @class */ (function () { - function c11() { - } - c11.prototype.foo = function () { +class c11 { + foo() { return 1; - }; - return c11; -}()); + } +} // class then class - covered // class then enum -var c33 = /** @class */ (function () { - function c33() { - } - c33.prototype.foo = function () { +class c33 { + foo() { return 1; - }; - return c33; -}()); + } +} (function (c33) { c33[c33["One"] = 0] = "One"; })(c33 || (c33 = {})); ; // class then import -var c44 = /** @class */ (function () { - function c44() { - } - c44.prototype.foo = function () { +class c44 { + foo() { return 1; - }; - return c44; -}()); + } +} diff --git a/tests/baselines/reference/augmentedTypesClass2a.js b/tests/baselines/reference/augmentedTypesClass2a.js index 2de4ff0e052e0..79d5f848912cd 100644 --- a/tests/baselines/reference/augmentedTypesClass2a.js +++ b/tests/baselines/reference/augmentedTypesClass2a.js @@ -8,11 +8,8 @@ var c2 = () => { } //// [augmentedTypesClass2a.js] //// class then function -var c2 = /** @class */ (function () { - function c2() { - } - c2.prototype.foo = function () { }; - return c2; -}()); // error +class c2 { + foo() { } +} // error function c2() { } // error -var c2 = function () { }; +var c2 = () => { }; diff --git a/tests/baselines/reference/augmentedTypesClass3.js b/tests/baselines/reference/augmentedTypesClass3.js index 169181343a59d..262b861001567 100644 --- a/tests/baselines/reference/augmentedTypesClass3.js +++ b/tests/baselines/reference/augmentedTypesClass3.js @@ -17,35 +17,23 @@ class c5c { public foo() { } } //// [augmentedTypesClass3.js] // class then module -var c5 = /** @class */ (function () { - function c5() { - } - c5.prototype.foo = function () { }; - return c5; -}()); -var c5a = /** @class */ (function () { - function c5a() { - } - c5a.prototype.foo = function () { }; - return c5a; -}()); +class c5 { + foo() { } +} +class c5a { + foo() { } +} (function (c5a) { var y = 2; })(c5a || (c5a = {})); // should be ok -var c5b = /** @class */ (function () { - function c5b() { - } - c5b.prototype.foo = function () { }; - return c5b; -}()); +class c5b { + foo() { } +} (function (c5b) { c5b.y = 2; })(c5b || (c5b = {})); // should be ok //// class then import -var c5c = /** @class */ (function () { - function c5c() { - } - c5c.prototype.foo = function () { }; - return c5c; -}()); +class c5c { + foo() { } +} //import c5c = require(''); diff --git a/tests/baselines/reference/augmentedTypesClass4.js b/tests/baselines/reference/augmentedTypesClass4.js index bb790c245e84f..5ed89197d80e4 100644 --- a/tests/baselines/reference/augmentedTypesClass4.js +++ b/tests/baselines/reference/augmentedTypesClass4.js @@ -8,15 +8,9 @@ class c3 { public bar() { } } // error //// [augmentedTypesClass4.js] //// class then class -var c3 = /** @class */ (function () { - function c3() { - } - c3.prototype.foo = function () { }; - return c3; -}()); // error -var c3 = /** @class */ (function () { - function c3() { - } - c3.prototype.bar = function () { }; - return c3; -}()); // error +class c3 { + foo() { } +} // error +class c3 { + bar() { } +} // error diff --git a/tests/baselines/reference/augmentedTypesEnum.js b/tests/baselines/reference/augmentedTypesEnum.js index e3113ae4be800..53aca02cd2eed 100644 --- a/tests/baselines/reference/augmentedTypesEnum.js +++ b/tests/baselines/reference/augmentedTypesEnum.js @@ -54,18 +54,15 @@ var e3; (function (e3) { e3[e3["One"] = 0] = "One"; })(e3 || (e3 = {})); // error -var e3 = function () { }; // error +var e3 = () => { }; // 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 () { }; - return e4; -}()); // error +class e4 { + foo() { } +} // error // enum then enum var e5; (function (e5) { diff --git a/tests/baselines/reference/augmentedTypesEnum2.js b/tests/baselines/reference/augmentedTypesEnum2.js index bb376f71c34db..94e29b5afe1e5 100644 --- a/tests/baselines/reference/augmentedTypesEnum2.js +++ b/tests/baselines/reference/augmentedTypesEnum2.js @@ -34,13 +34,10 @@ var e2; e2[e2["One"] = 0] = "One"; })(e2 || (e2 = {})); ; // error -var e2 = /** @class */ (function () { - function e2() { - } - e2.prototype.foo = function () { +class e2 { + foo() { return 1; - }; - return e2; -}()); + } +} //enum then enum - covered //enum then import - covered diff --git a/tests/baselines/reference/augmentedTypesExternalModule1.js b/tests/baselines/reference/augmentedTypesExternalModule1.js index cb2493cdd5fa5..43bde053d3905 100644 --- a/tests/baselines/reference/augmentedTypesExternalModule1.js +++ b/tests/baselines/reference/augmentedTypesExternalModule1.js @@ -11,10 +11,7 @@ define(["require", "exports"], function (require, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.a = void 0; exports.a = 1; - var c5 = /** @class */ (function () { - function c5() { - } - c5.prototype.foo = function () { }; - return c5; - }()); + class c5 { + foo() { } + } }); diff --git a/tests/baselines/reference/augmentedTypesFunction.js b/tests/baselines/reference/augmentedTypesFunction.js index 504a24e955813..4da5627a3e481 100644 --- a/tests/baselines/reference/augmentedTypesFunction.js +++ b/tests/baselines/reference/augmentedTypesFunction.js @@ -48,21 +48,15 @@ var y1 = 1; // error function y2() { } // error function y2() { } // error function y2a() { } // error -var y2a = function () { }; // error +var y2a = () => { }; // error // function then class function y3() { } // error -var y3 = /** @class */ (function () { - function y3() { - } - return y3; -}()); // error +class y3 { +} // error function y3a() { } // error -var y3a = /** @class */ (function () { - function y3a() { - } - y3a.prototype.foo = function () { }; - return y3a; -}()); // error +class y3a { + foo() { } +} // error // function then enum function y4() { } // error (function (y4) { diff --git a/tests/baselines/reference/augmentedTypesInterface.js b/tests/baselines/reference/augmentedTypesInterface.js index c0b7abd7b5c1e..0d3698bb3908f 100644 --- a/tests/baselines/reference/augmentedTypesInterface.js +++ b/tests/baselines/reference/augmentedTypesInterface.js @@ -37,14 +37,11 @@ interface i4 { //// [augmentedTypesInterface.js] // interface then interface -var i2 = /** @class */ (function () { - function i2() { - } - i2.prototype.bar = function () { +class i2 { + bar() { return 1; - }; - return i2; -}()); + } +} var i3; (function (i3) { i3[i3["One"] = 0] = "One"; diff --git a/tests/baselines/reference/augmentedTypesModules.js b/tests/baselines/reference/augmentedTypesModules.js index ebcd8b49b9c69..1ec3070df5228 100644 --- a/tests/baselines/reference/augmentedTypesModules.js +++ b/tests/baselines/reference/augmentedTypesModules.js @@ -114,12 +114,9 @@ var m1b = 1; // error var m1c = 1; // Should be allowed var m1d; (function (m1d) { - var I = /** @class */ (function () { - function I() { - } - I.prototype.foo = function () { }; - return I; - }()); + class I { + foo() { } + } m1d.I = I; })(m1d || (m1d = {})); var m1d = 1; // error @@ -148,44 +145,29 @@ function m2f() { } function m2g() { } ; (function (m2g) { - var C = /** @class */ (function () { - function C() { - } - C.prototype.foo = function () { }; - return C; - }()); + class C { + foo() { } + } m2g.C = C; })(m2g || (m2g = {})); -var m3 = /** @class */ (function () { - function m3() { - } - return m3; -}()); // ok since the module is not instantiated +class m3 { +} // ok since the module is not instantiated var m3a; (function (m3a) { var y = 2; })(m3a || (m3a = {})); -var m3a = /** @class */ (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 () { }; - return m3b; -}()); +class m3a { + foo() { } +} // error, class isn't ambient or declared before the module +class m3b { + foo() { } +} (function (m3b) { var y = 2; })(m3b || (m3b = {})); -var m3c = /** @class */ (function () { - function m3c() { - } - m3c.prototype.foo = function () { }; - return m3c; -}()); +class m3c { + foo() { } +} (function (m3c) { m3c.y = 2; })(m3c || (m3c = {})); @@ -199,12 +181,9 @@ var m3e; })(m3e || (m3e = {})); var m3g; (function (m3g) { - var C = /** @class */ (function () { - function C() { - } - C.prototype.foo = function () { }; - return C; - }()); + class C { + foo() { } + } m3g.C = C; })(m3g || (m3g = {})); var m4; @@ -230,12 +209,9 @@ var m4c; })(m4c || (m4c = {})); var m4d; (function (m4d) { - var C = /** @class */ (function () { - function C() { - } - C.prototype.foo = function () { }; - return C; - }()); + class C { + foo() { } + } })(m4d || (m4d = {})); (function (m4d) { m4d[m4d["One"] = 0] = "One"; diff --git a/tests/baselines/reference/augmentedTypesModules2.js b/tests/baselines/reference/augmentedTypesModules2.js index 033af2984ef9e..b1ec007ab8bce 100644 --- a/tests/baselines/reference/augmentedTypesModules2.js +++ b/tests/baselines/reference/augmentedTypesModules2.js @@ -61,11 +61,8 @@ function m2f() { } function m2g() { } ; (function (m2g) { - var C = /** @class */ (function () { - function C() { - } - C.prototype.foo = function () { }; - return C; - }()); + class C { + foo() { } + } m2g.C = C; })(m2g || (m2g = {})); diff --git a/tests/baselines/reference/augmentedTypesModules3.js b/tests/baselines/reference/augmentedTypesModules3.js index 68f37176f7562..5fff2254b4848 100644 --- a/tests/baselines/reference/augmentedTypesModules3.js +++ b/tests/baselines/reference/augmentedTypesModules3.js @@ -9,18 +9,12 @@ namespace m3a { var y = 2; } class m3a { foo() { } } // error, class isn't ambient or declared before the module //// [augmentedTypesModules3.js] -var m3 = /** @class */ (function () { - function m3() { - } - return m3; -}()); // ok since the module is not instantiated +class m3 { +} // ok since the module is not instantiated var m3a; (function (m3a) { var y = 2; })(m3a || (m3a = {})); -var m3a = /** @class */ (function () { - function m3a() { - } - m3a.prototype.foo = function () { }; - return m3a; -}()); // error, class isn't ambient or declared before the module +class m3a { + foo() { } +} // 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 5ead3326ecc74..b5029a3aae155 100644 --- a/tests/baselines/reference/augmentedTypesModules3b.js +++ b/tests/baselines/reference/augmentedTypesModules3b.js @@ -21,21 +21,15 @@ namespace m3g { export class C { foo() { } } } //// [augmentedTypesModules3b.js] -var m3b = /** @class */ (function () { - function m3b() { - } - m3b.prototype.foo = function () { }; - return m3b; -}()); +class m3b { + foo() { } +} (function (m3b) { var y = 2; })(m3b || (m3b = {})); -var m3c = /** @class */ (function () { - function m3c() { - } - m3c.prototype.foo = function () { }; - return m3c; -}()); +class m3c { + foo() { } +} (function (m3c) { m3c.y = 2; })(m3c || (m3c = {})); @@ -49,11 +43,8 @@ var m3e; })(m3e || (m3e = {})); var m3g; (function (m3g) { - var C = /** @class */ (function () { - function C() { - } - C.prototype.foo = function () { }; - return C; - }()); + class C { + foo() { } + } m3g.C = C; })(m3g || (m3g = {})); diff --git a/tests/baselines/reference/augmentedTypesModules4.js b/tests/baselines/reference/augmentedTypesModules4.js index 461db76d6d809..5fb8bedfec4f1 100644 --- a/tests/baselines/reference/augmentedTypesModules4.js +++ b/tests/baselines/reference/augmentedTypesModules4.js @@ -48,12 +48,9 @@ var m4c; })(m4c || (m4c = {})); var m4d; (function (m4d) { - var C = /** @class */ (function () { - function C() { - } - C.prototype.foo = function () { }; - return C; - }()); + class C { + foo() { } + } })(m4d || (m4d = {})); (function (m4d) { m4d[m4d["One"] = 0] = "One"; diff --git a/tests/baselines/reference/augmentedTypesVar.js b/tests/baselines/reference/augmentedTypesVar.js index 1b315124bf37e..2817c4255a424 100644 --- a/tests/baselines/reference/augmentedTypesVar.js +++ b/tests/baselines/reference/augmentedTypesVar.js @@ -46,21 +46,15 @@ var x1 = 2; var x2 = 1; // error function x2() { } // error var x3 = 1; -var x3 = function () { }; // error +var x3 = () => { }; // error // var then class var x4 = 1; // error -var x4 = /** @class */ (function () { - function x4() { - } - return x4; -}()); // error +class x4 { +} // error var x4a = 1; // error -var x4a = /** @class */ (function () { - function x4a() { - } - x4a.prototype.foo = function () { }; - return x4a; -}()); // error +class x4a { + foo() { } +} // error // var then enum var x5 = 1; var x5; diff --git a/tests/baselines/reference/autoAsiForStaticsInClassDeclaration.js b/tests/baselines/reference/autoAsiForStaticsInClassDeclaration.js index 4f8c382ee555b..584e598d15964 100644 --- a/tests/baselines/reference/autoAsiForStaticsInClassDeclaration.js +++ b/tests/baselines/reference/autoAsiForStaticsInClassDeclaration.js @@ -7,8 +7,5 @@ class C { } //// [autoAsiForStaticsInClassDeclaration.js] -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { +} diff --git a/tests/baselines/reference/autoLift2.js b/tests/baselines/reference/autoLift2.js index 09e5f9f812775..bf8f1ef831e6a 100644 --- a/tests/baselines/reference/autoLift2.js +++ b/tests/baselines/reference/autoLift2.js @@ -34,21 +34,19 @@ a.baz(); //// [autoLift2.js] -var A = /** @class */ (function () { - function A() { +class A { + constructor() { this.foo; any; this.bar; any; } - A.prototype.baz = function () { - var _this = this; + baz() { this.foo = "foo"; this.bar = "bar"; - [1, 2].forEach(function (p) { return _this.foo; }); - [1, 2].forEach(function (p) { return _this.bar; }); - }; - return A; -}()); + [1, 2].forEach((p) => this.foo); + [1, 2].forEach((p) => this.bar); + } +} var a = new A(); a.baz(); diff --git a/tests/baselines/reference/autolift3.js b/tests/baselines/reference/autolift3.js index 67e174c4e3ebc..0170bd0938ebe 100644 --- a/tests/baselines/reference/autolift3.js +++ b/tests/baselines/reference/autolift3.js @@ -33,8 +33,8 @@ b.foo(); //// [autolift3.js] -var B = /** @class */ (function () { - function B() { +class B { + constructor() { function foo() { } foo(); var a = 0; @@ -50,7 +50,6 @@ var B = /** @class */ (function () { return inner; })(); } - return B; -}()); +} var b = new B(); b.foo(); diff --git a/tests/baselines/reference/autolift4.js b/tests/baselines/reference/autolift4.js index afa4a1b0aee32..f515ab0fa3951 100644 --- a/tests/baselines/reference/autolift4.js +++ b/tests/baselines/reference/autolift4.js @@ -26,41 +26,22 @@ class Point3D extends Point { //// [autolift4.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var Point = /** @class */ (function () { - function Point(x, y) { +class Point { + constructor(x, y) { this.x = x; this.y = y; } - Point.prototype.getDist = function () { + getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); - }; - Point.origin = new Point(0, 0); - return Point; -}()); -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 () { +} +Point.origin = new Point(0, 0); +class Point3D extends Point { + constructor(x, y, z, m) { + super(x, y); + this.z = z; + } + getDist() { return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.m); - }; - return Point3D; -}(Point)); + } +} diff --git a/tests/baselines/reference/avoid.js b/tests/baselines/reference/avoid.js index 0d53ad58d2a0d..e6ec91c9374d3 100644 --- a/tests/baselines/reference/avoid.js +++ b/tests/baselines/reference/avoid.js @@ -29,12 +29,9 @@ 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() { +class C { + g() { } - 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/avoidListingPropertiesForTypesWithOnlyCallOrConstructSignatures.js b/tests/baselines/reference/avoidListingPropertiesForTypesWithOnlyCallOrConstructSignatures.js index 75d61026b33b7..145a41a8c1257 100644 --- a/tests/baselines/reference/avoidListingPropertiesForTypesWithOnlyCallOrConstructSignatures.js +++ b/tests/baselines/reference/avoidListingPropertiesForTypesWithOnlyCallOrConstructSignatures.js @@ -11,8 +11,5 @@ export let x:Dog = getRover; // export let x: Dog = getRover; //// [avoidListingPropertiesForTypesWithOnlyCallOrConstructSignatures.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; -exports.x = getRover; +export let x = getRover; // export let x: Dog = getRover; diff --git a/tests/baselines/reference/awaitBinaryExpression1_es5(target=es2015).js b/tests/baselines/reference/awaitBinaryExpression1_es5(target=es2015).js new file mode 100644 index 0000000000000..8056734e3d6bc --- /dev/null +++ b/tests/baselines/reference/awaitBinaryExpression1_es5(target=es2015).js @@ -0,0 +1,21 @@ +//// [tests/cases/conformance/async/es5/awaitBinaryExpression/awaitBinaryExpression1_es5.ts] //// + +//// [awaitBinaryExpression1_es5.ts] +declare var a: boolean; +declare var p: Promise; +declare function before(): void; +declare function after(): void; +async function func(): Promise { + before(); + var b = await p || a; + after(); +} + +//// [awaitBinaryExpression1_es5.js] +function func() { + return __awaiter(this, void 0, void 0, function* () { + before(); + var b = (yield p) || a; + after(); + }); +} diff --git a/tests/baselines/reference/awaitBinaryExpression1_es5.symbols b/tests/baselines/reference/awaitBinaryExpression1_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/awaitBinaryExpression1_es5.symbols rename to tests/baselines/reference/awaitBinaryExpression1_es5(target=es2015).symbols diff --git a/tests/baselines/reference/awaitBinaryExpression1_es5.types b/tests/baselines/reference/awaitBinaryExpression1_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/awaitBinaryExpression1_es5.types rename to tests/baselines/reference/awaitBinaryExpression1_es5(target=es2015).types diff --git a/tests/baselines/reference/awaitBinaryExpression1_es5.js b/tests/baselines/reference/awaitBinaryExpression1_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/awaitBinaryExpression1_es5.js rename to tests/baselines/reference/awaitBinaryExpression1_es5(target=es5).js diff --git a/tests/baselines/reference/awaitBinaryExpression1_es5(target=es5).symbols b/tests/baselines/reference/awaitBinaryExpression1_es5(target=es5).symbols new file mode 100644 index 0000000000000..0dc858cb0d392 --- /dev/null +++ b/tests/baselines/reference/awaitBinaryExpression1_es5(target=es5).symbols @@ -0,0 +1,31 @@ +//// [tests/cases/conformance/async/es5/awaitBinaryExpression/awaitBinaryExpression1_es5.ts] //// + +=== awaitBinaryExpression1_es5.ts === +declare var a: boolean; +>a : Symbol(a, Decl(awaitBinaryExpression1_es5.ts, 0, 11)) + +declare var p: Promise; +>p : Symbol(p, Decl(awaitBinaryExpression1_es5.ts, 1, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +declare function before(): void; +>before : Symbol(before, Decl(awaitBinaryExpression1_es5.ts, 1, 32)) + +declare function after(): void; +>after : Symbol(after, Decl(awaitBinaryExpression1_es5.ts, 2, 32)) + +async function func(): Promise { +>func : Symbol(func, Decl(awaitBinaryExpression1_es5.ts, 3, 31)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + before(); +>before : Symbol(before, Decl(awaitBinaryExpression1_es5.ts, 1, 32)) + + var b = await p || a; +>b : Symbol(b, Decl(awaitBinaryExpression1_es5.ts, 6, 7)) +>p : Symbol(p, Decl(awaitBinaryExpression1_es5.ts, 1, 11)) +>a : Symbol(a, Decl(awaitBinaryExpression1_es5.ts, 0, 11)) + + after(); +>after : Symbol(after, Decl(awaitBinaryExpression1_es5.ts, 2, 32)) +} diff --git a/tests/baselines/reference/awaitBinaryExpression1_es5(target=es5).types b/tests/baselines/reference/awaitBinaryExpression1_es5(target=es5).types new file mode 100644 index 0000000000000..06536de34d39c --- /dev/null +++ b/tests/baselines/reference/awaitBinaryExpression1_es5(target=es5).types @@ -0,0 +1,47 @@ +//// [tests/cases/conformance/async/es5/awaitBinaryExpression/awaitBinaryExpression1_es5.ts] //// + +=== awaitBinaryExpression1_es5.ts === +declare var a: boolean; +>a : boolean +> : ^^^^^^^ + +declare var p: Promise; +>p : Promise +> : ^^^^^^^^^^^^^^^^ + +declare function before(): void; +>before : () => void +> : ^^^^^^ + +declare function after(): void; +>after : () => void +> : ^^^^^^ + +async function func(): Promise { +>func : () => Promise +> : ^^^^^^ + + before(); +>before() : void +> : ^^^^ +>before : () => void +> : ^^^^^^ + + var b = await p || a; +>b : boolean +> : ^^^^^^^ +>await p || a : boolean +> : ^^^^^^^ +>await p : boolean +> : ^^^^^^^ +>p : Promise +> : ^^^^^^^^^^^^^^^^ +>a : boolean +> : ^^^^^^^ + + after(); +>after() : void +> : ^^^^ +>after : () => void +> : ^^^^^^ +} diff --git a/tests/baselines/reference/awaitBinaryExpression2_es5(target=es2015).js b/tests/baselines/reference/awaitBinaryExpression2_es5(target=es2015).js new file mode 100644 index 0000000000000..f4ac728692c3f --- /dev/null +++ b/tests/baselines/reference/awaitBinaryExpression2_es5(target=es2015).js @@ -0,0 +1,21 @@ +//// [tests/cases/conformance/async/es5/awaitBinaryExpression/awaitBinaryExpression2_es5.ts] //// + +//// [awaitBinaryExpression2_es5.ts] +declare var a: boolean; +declare var p: Promise; +declare function before(): void; +declare function after(): void; +async function func(): Promise { + before(); + var b = await p && a; + after(); +} + +//// [awaitBinaryExpression2_es5.js] +function func() { + return __awaiter(this, void 0, void 0, function* () { + before(); + var b = (yield p) && a; + after(); + }); +} diff --git a/tests/baselines/reference/awaitBinaryExpression2_es5.symbols b/tests/baselines/reference/awaitBinaryExpression2_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/awaitBinaryExpression2_es5.symbols rename to tests/baselines/reference/awaitBinaryExpression2_es5(target=es2015).symbols diff --git a/tests/baselines/reference/awaitBinaryExpression2_es5.types b/tests/baselines/reference/awaitBinaryExpression2_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/awaitBinaryExpression2_es5.types rename to tests/baselines/reference/awaitBinaryExpression2_es5(target=es2015).types diff --git a/tests/baselines/reference/awaitBinaryExpression2_es5.js b/tests/baselines/reference/awaitBinaryExpression2_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/awaitBinaryExpression2_es5.js rename to tests/baselines/reference/awaitBinaryExpression2_es5(target=es5).js diff --git a/tests/baselines/reference/awaitBinaryExpression2_es5(target=es5).symbols b/tests/baselines/reference/awaitBinaryExpression2_es5(target=es5).symbols new file mode 100644 index 0000000000000..eb049b94ddeed --- /dev/null +++ b/tests/baselines/reference/awaitBinaryExpression2_es5(target=es5).symbols @@ -0,0 +1,31 @@ +//// [tests/cases/conformance/async/es5/awaitBinaryExpression/awaitBinaryExpression2_es5.ts] //// + +=== awaitBinaryExpression2_es5.ts === +declare var a: boolean; +>a : Symbol(a, Decl(awaitBinaryExpression2_es5.ts, 0, 11)) + +declare var p: Promise; +>p : Symbol(p, Decl(awaitBinaryExpression2_es5.ts, 1, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +declare function before(): void; +>before : Symbol(before, Decl(awaitBinaryExpression2_es5.ts, 1, 32)) + +declare function after(): void; +>after : Symbol(after, Decl(awaitBinaryExpression2_es5.ts, 2, 32)) + +async function func(): Promise { +>func : Symbol(func, Decl(awaitBinaryExpression2_es5.ts, 3, 31)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + before(); +>before : Symbol(before, Decl(awaitBinaryExpression2_es5.ts, 1, 32)) + + var b = await p && a; +>b : Symbol(b, Decl(awaitBinaryExpression2_es5.ts, 6, 7)) +>p : Symbol(p, Decl(awaitBinaryExpression2_es5.ts, 1, 11)) +>a : Symbol(a, Decl(awaitBinaryExpression2_es5.ts, 0, 11)) + + after(); +>after : Symbol(after, Decl(awaitBinaryExpression2_es5.ts, 2, 32)) +} diff --git a/tests/baselines/reference/awaitBinaryExpression2_es5(target=es5).types b/tests/baselines/reference/awaitBinaryExpression2_es5(target=es5).types new file mode 100644 index 0000000000000..7ed66215fec3e --- /dev/null +++ b/tests/baselines/reference/awaitBinaryExpression2_es5(target=es5).types @@ -0,0 +1,47 @@ +//// [tests/cases/conformance/async/es5/awaitBinaryExpression/awaitBinaryExpression2_es5.ts] //// + +=== awaitBinaryExpression2_es5.ts === +declare var a: boolean; +>a : boolean +> : ^^^^^^^ + +declare var p: Promise; +>p : Promise +> : ^^^^^^^^^^^^^^^^ + +declare function before(): void; +>before : () => void +> : ^^^^^^ + +declare function after(): void; +>after : () => void +> : ^^^^^^ + +async function func(): Promise { +>func : () => Promise +> : ^^^^^^ + + before(); +>before() : void +> : ^^^^ +>before : () => void +> : ^^^^^^ + + var b = await p && a; +>b : boolean +> : ^^^^^^^ +>await p && a : boolean +> : ^^^^^^^ +>await p : boolean +> : ^^^^^^^ +>p : Promise +> : ^^^^^^^^^^^^^^^^ +>a : boolean +> : ^^^^^^^ + + after(); +>after() : void +> : ^^^^ +>after : () => void +> : ^^^^^^ +} diff --git a/tests/baselines/reference/awaitBinaryExpression3_es5(target=es2015).js b/tests/baselines/reference/awaitBinaryExpression3_es5(target=es2015).js new file mode 100644 index 0000000000000..0684fdb640e8e --- /dev/null +++ b/tests/baselines/reference/awaitBinaryExpression3_es5(target=es2015).js @@ -0,0 +1,21 @@ +//// [tests/cases/conformance/async/es5/awaitBinaryExpression/awaitBinaryExpression3_es5.ts] //// + +//// [awaitBinaryExpression3_es5.ts] +declare var a: number; +declare var p: Promise; +declare function before(): void; +declare function after(): void; +async function func(): Promise { + before(); + var b = await p + a; + after(); +} + +//// [awaitBinaryExpression3_es5.js] +function func() { + return __awaiter(this, void 0, void 0, function* () { + before(); + var b = (yield p) + a; + after(); + }); +} diff --git a/tests/baselines/reference/awaitBinaryExpression3_es5.symbols b/tests/baselines/reference/awaitBinaryExpression3_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/awaitBinaryExpression3_es5.symbols rename to tests/baselines/reference/awaitBinaryExpression3_es5(target=es2015).symbols diff --git a/tests/baselines/reference/awaitBinaryExpression3_es5.types b/tests/baselines/reference/awaitBinaryExpression3_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/awaitBinaryExpression3_es5.types rename to tests/baselines/reference/awaitBinaryExpression3_es5(target=es2015).types diff --git a/tests/baselines/reference/awaitBinaryExpression3_es5.js b/tests/baselines/reference/awaitBinaryExpression3_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/awaitBinaryExpression3_es5.js rename to tests/baselines/reference/awaitBinaryExpression3_es5(target=es5).js diff --git a/tests/baselines/reference/awaitBinaryExpression3_es5(target=es5).symbols b/tests/baselines/reference/awaitBinaryExpression3_es5(target=es5).symbols new file mode 100644 index 0000000000000..c3b62990ed57f --- /dev/null +++ b/tests/baselines/reference/awaitBinaryExpression3_es5(target=es5).symbols @@ -0,0 +1,31 @@ +//// [tests/cases/conformance/async/es5/awaitBinaryExpression/awaitBinaryExpression3_es5.ts] //// + +=== awaitBinaryExpression3_es5.ts === +declare var a: number; +>a : Symbol(a, Decl(awaitBinaryExpression3_es5.ts, 0, 11)) + +declare var p: Promise; +>p : Symbol(p, Decl(awaitBinaryExpression3_es5.ts, 1, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +declare function before(): void; +>before : Symbol(before, Decl(awaitBinaryExpression3_es5.ts, 1, 31)) + +declare function after(): void; +>after : Symbol(after, Decl(awaitBinaryExpression3_es5.ts, 2, 32)) + +async function func(): Promise { +>func : Symbol(func, Decl(awaitBinaryExpression3_es5.ts, 3, 31)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + before(); +>before : Symbol(before, Decl(awaitBinaryExpression3_es5.ts, 1, 31)) + + var b = await p + a; +>b : Symbol(b, Decl(awaitBinaryExpression3_es5.ts, 6, 7)) +>p : Symbol(p, Decl(awaitBinaryExpression3_es5.ts, 1, 11)) +>a : Symbol(a, Decl(awaitBinaryExpression3_es5.ts, 0, 11)) + + after(); +>after : Symbol(after, Decl(awaitBinaryExpression3_es5.ts, 2, 32)) +} diff --git a/tests/baselines/reference/awaitBinaryExpression3_es5(target=es5).types b/tests/baselines/reference/awaitBinaryExpression3_es5(target=es5).types new file mode 100644 index 0000000000000..b43d6a23615cc --- /dev/null +++ b/tests/baselines/reference/awaitBinaryExpression3_es5(target=es5).types @@ -0,0 +1,47 @@ +//// [tests/cases/conformance/async/es5/awaitBinaryExpression/awaitBinaryExpression3_es5.ts] //// + +=== awaitBinaryExpression3_es5.ts === +declare var a: number; +>a : number +> : ^^^^^^ + +declare var p: Promise; +>p : Promise +> : ^^^^^^^^^^^^^^^ + +declare function before(): void; +>before : () => void +> : ^^^^^^ + +declare function after(): void; +>after : () => void +> : ^^^^^^ + +async function func(): Promise { +>func : () => Promise +> : ^^^^^^ + + before(); +>before() : void +> : ^^^^ +>before : () => void +> : ^^^^^^ + + var b = await p + a; +>b : number +> : ^^^^^^ +>await p + a : number +> : ^^^^^^ +>await p : number +> : ^^^^^^ +>p : Promise +> : ^^^^^^^^^^^^^^^ +>a : number +> : ^^^^^^ + + after(); +>after() : void +> : ^^^^ +>after : () => void +> : ^^^^^^ +} diff --git a/tests/baselines/reference/awaitBinaryExpression4_es5(target=es2015).js b/tests/baselines/reference/awaitBinaryExpression4_es5(target=es2015).js new file mode 100644 index 0000000000000..92209799e5dba --- /dev/null +++ b/tests/baselines/reference/awaitBinaryExpression4_es5(target=es2015).js @@ -0,0 +1,21 @@ +//// [tests/cases/conformance/async/es5/awaitBinaryExpression/awaitBinaryExpression4_es5.ts] //// + +//// [awaitBinaryExpression4_es5.ts] +declare var a: boolean; +declare var p: Promise; +declare function before(): void; +declare function after(): void; +async function func(): Promise { + before(); + var b = (await p, a); + after(); +} + +//// [awaitBinaryExpression4_es5.js] +function func() { + return __awaiter(this, void 0, void 0, function* () { + before(); + var b = (yield p, a); + after(); + }); +} diff --git a/tests/baselines/reference/awaitBinaryExpression4_es5.symbols b/tests/baselines/reference/awaitBinaryExpression4_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/awaitBinaryExpression4_es5.symbols rename to tests/baselines/reference/awaitBinaryExpression4_es5(target=es2015).symbols diff --git a/tests/baselines/reference/awaitBinaryExpression4_es5.types b/tests/baselines/reference/awaitBinaryExpression4_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/awaitBinaryExpression4_es5.types rename to tests/baselines/reference/awaitBinaryExpression4_es5(target=es2015).types diff --git a/tests/baselines/reference/awaitBinaryExpression4_es5.js b/tests/baselines/reference/awaitBinaryExpression4_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/awaitBinaryExpression4_es5.js rename to tests/baselines/reference/awaitBinaryExpression4_es5(target=es5).js diff --git a/tests/baselines/reference/awaitBinaryExpression4_es5(target=es5).symbols b/tests/baselines/reference/awaitBinaryExpression4_es5(target=es5).symbols new file mode 100644 index 0000000000000..7aa7e4f99831a --- /dev/null +++ b/tests/baselines/reference/awaitBinaryExpression4_es5(target=es5).symbols @@ -0,0 +1,31 @@ +//// [tests/cases/conformance/async/es5/awaitBinaryExpression/awaitBinaryExpression4_es5.ts] //// + +=== awaitBinaryExpression4_es5.ts === +declare var a: boolean; +>a : Symbol(a, Decl(awaitBinaryExpression4_es5.ts, 0, 11)) + +declare var p: Promise; +>p : Symbol(p, Decl(awaitBinaryExpression4_es5.ts, 1, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +declare function before(): void; +>before : Symbol(before, Decl(awaitBinaryExpression4_es5.ts, 1, 32)) + +declare function after(): void; +>after : Symbol(after, Decl(awaitBinaryExpression4_es5.ts, 2, 32)) + +async function func(): Promise { +>func : Symbol(func, Decl(awaitBinaryExpression4_es5.ts, 3, 31)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + before(); +>before : Symbol(before, Decl(awaitBinaryExpression4_es5.ts, 1, 32)) + + var b = (await p, a); +>b : Symbol(b, Decl(awaitBinaryExpression4_es5.ts, 6, 7)) +>p : Symbol(p, Decl(awaitBinaryExpression4_es5.ts, 1, 11)) +>a : Symbol(a, Decl(awaitBinaryExpression4_es5.ts, 0, 11)) + + after(); +>after : Symbol(after, Decl(awaitBinaryExpression4_es5.ts, 2, 32)) +} diff --git a/tests/baselines/reference/awaitBinaryExpression4_es5(target=es5).types b/tests/baselines/reference/awaitBinaryExpression4_es5(target=es5).types new file mode 100644 index 0000000000000..345007d5f0853 --- /dev/null +++ b/tests/baselines/reference/awaitBinaryExpression4_es5(target=es5).types @@ -0,0 +1,49 @@ +//// [tests/cases/conformance/async/es5/awaitBinaryExpression/awaitBinaryExpression4_es5.ts] //// + +=== awaitBinaryExpression4_es5.ts === +declare var a: boolean; +>a : boolean +> : ^^^^^^^ + +declare var p: Promise; +>p : Promise +> : ^^^^^^^^^^^^^^^^ + +declare function before(): void; +>before : () => void +> : ^^^^^^ + +declare function after(): void; +>after : () => void +> : ^^^^^^ + +async function func(): Promise { +>func : () => Promise +> : ^^^^^^ + + before(); +>before() : void +> : ^^^^ +>before : () => void +> : ^^^^^^ + + var b = (await p, a); +>b : boolean +> : ^^^^^^^ +>(await p, a) : boolean +> : ^^^^^^^ +>await p, a : boolean +> : ^^^^^^^ +>await p : boolean +> : ^^^^^^^ +>p : Promise +> : ^^^^^^^^^^^^^^^^ +>a : boolean +> : ^^^^^^^ + + after(); +>after() : void +> : ^^^^ +>after : () => void +> : ^^^^^^ +} diff --git a/tests/baselines/reference/awaitBinaryExpression5_es5(target=es2015).js b/tests/baselines/reference/awaitBinaryExpression5_es5(target=es2015).js new file mode 100644 index 0000000000000..5af7304de2066 --- /dev/null +++ b/tests/baselines/reference/awaitBinaryExpression5_es5(target=es2015).js @@ -0,0 +1,23 @@ +//// [tests/cases/conformance/async/es5/awaitBinaryExpression/awaitBinaryExpression5_es5.ts] //// + +//// [awaitBinaryExpression5_es5.ts] +declare var a: boolean; +declare var p: Promise; +declare function before(): void; +declare function after(): void; +async function func(): Promise { + before(); + var o: { a: boolean; }; + o.a = await p; + after(); +} + +//// [awaitBinaryExpression5_es5.js] +function func() { + return __awaiter(this, void 0, void 0, function* () { + before(); + var o; + o.a = yield p; + after(); + }); +} diff --git a/tests/baselines/reference/awaitBinaryExpression5_es5.symbols b/tests/baselines/reference/awaitBinaryExpression5_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/awaitBinaryExpression5_es5.symbols rename to tests/baselines/reference/awaitBinaryExpression5_es5(target=es2015).symbols diff --git a/tests/baselines/reference/awaitBinaryExpression5_es5.types b/tests/baselines/reference/awaitBinaryExpression5_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/awaitBinaryExpression5_es5.types rename to tests/baselines/reference/awaitBinaryExpression5_es5(target=es2015).types diff --git a/tests/baselines/reference/awaitBinaryExpression5_es5.js b/tests/baselines/reference/awaitBinaryExpression5_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/awaitBinaryExpression5_es5.js rename to tests/baselines/reference/awaitBinaryExpression5_es5(target=es5).js diff --git a/tests/baselines/reference/awaitBinaryExpression5_es5(target=es5).symbols b/tests/baselines/reference/awaitBinaryExpression5_es5(target=es5).symbols new file mode 100644 index 0000000000000..48de721f06af9 --- /dev/null +++ b/tests/baselines/reference/awaitBinaryExpression5_es5(target=es5).symbols @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/async/es5/awaitBinaryExpression/awaitBinaryExpression5_es5.ts] //// + +=== awaitBinaryExpression5_es5.ts === +declare var a: boolean; +>a : Symbol(a, Decl(awaitBinaryExpression5_es5.ts, 0, 11)) + +declare var p: Promise; +>p : Symbol(p, Decl(awaitBinaryExpression5_es5.ts, 1, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +declare function before(): void; +>before : Symbol(before, Decl(awaitBinaryExpression5_es5.ts, 1, 32)) + +declare function after(): void; +>after : Symbol(after, Decl(awaitBinaryExpression5_es5.ts, 2, 32)) + +async function func(): Promise { +>func : Symbol(func, Decl(awaitBinaryExpression5_es5.ts, 3, 31)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + before(); +>before : Symbol(before, Decl(awaitBinaryExpression5_es5.ts, 1, 32)) + + var o: { a: boolean; }; +>o : Symbol(o, Decl(awaitBinaryExpression5_es5.ts, 6, 7)) +>a : Symbol(a, Decl(awaitBinaryExpression5_es5.ts, 6, 12)) + + o.a = await p; +>o.a : Symbol(a, Decl(awaitBinaryExpression5_es5.ts, 6, 12)) +>o : Symbol(o, Decl(awaitBinaryExpression5_es5.ts, 6, 7)) +>a : Symbol(a, Decl(awaitBinaryExpression5_es5.ts, 6, 12)) +>p : Symbol(p, Decl(awaitBinaryExpression5_es5.ts, 1, 11)) + + after(); +>after : Symbol(after, Decl(awaitBinaryExpression5_es5.ts, 2, 32)) +} diff --git a/tests/baselines/reference/awaitBinaryExpression5_es5(target=es5).types b/tests/baselines/reference/awaitBinaryExpression5_es5(target=es5).types new file mode 100644 index 0000000000000..bc4a0811d3bf7 --- /dev/null +++ b/tests/baselines/reference/awaitBinaryExpression5_es5(target=es5).types @@ -0,0 +1,55 @@ +//// [tests/cases/conformance/async/es5/awaitBinaryExpression/awaitBinaryExpression5_es5.ts] //// + +=== awaitBinaryExpression5_es5.ts === +declare var a: boolean; +>a : boolean +> : ^^^^^^^ + +declare var p: Promise; +>p : Promise +> : ^^^^^^^^^^^^^^^^ + +declare function before(): void; +>before : () => void +> : ^^^^^^ + +declare function after(): void; +>after : () => void +> : ^^^^^^ + +async function func(): Promise { +>func : () => Promise +> : ^^^^^^ + + before(); +>before() : void +> : ^^^^ +>before : () => void +> : ^^^^^^ + + var o: { a: boolean; }; +>o : { a: boolean; } +> : ^^^^^ ^^^ +>a : boolean +> : ^^^^^^^ + + o.a = await p; +>o.a = await p : boolean +> : ^^^^^^^ +>o.a : boolean +> : ^^^^^^^ +>o : { a: boolean; } +> : ^^^^^ ^^^ +>a : boolean +> : ^^^^^^^ +>await p : boolean +> : ^^^^^^^ +>p : Promise +> : ^^^^^^^^^^^^^^^^ + + after(); +>after() : void +> : ^^^^ +>after : () => void +> : ^^^^^^ +} diff --git a/tests/baselines/reference/awaitCallExpression1_es5(target=es2015).js b/tests/baselines/reference/awaitCallExpression1_es5(target=es2015).js new file mode 100644 index 0000000000000..a0f1fd390756b --- /dev/null +++ b/tests/baselines/reference/awaitCallExpression1_es5(target=es2015).js @@ -0,0 +1,25 @@ +//// [tests/cases/conformance/async/es5/awaitCallExpression/awaitCallExpression1_es5.ts] //// + +//// [awaitCallExpression1_es5.ts] +declare var a: boolean; +declare var p: Promise; +declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; +declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; +declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +declare function before(): void; +declare function after(): void; +async function func(): Promise { + before(); + var b = fn(a, a, a); + after(); +} + +//// [awaitCallExpression1_es5.js] +function func() { + return __awaiter(this, void 0, void 0, function* () { + before(); + var b = fn(a, a, a); + after(); + }); +} diff --git a/tests/baselines/reference/awaitCallExpression1_es5.symbols b/tests/baselines/reference/awaitCallExpression1_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/awaitCallExpression1_es5.symbols rename to tests/baselines/reference/awaitCallExpression1_es5(target=es2015).symbols diff --git a/tests/baselines/reference/awaitCallExpression1_es5.types b/tests/baselines/reference/awaitCallExpression1_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/awaitCallExpression1_es5.types rename to tests/baselines/reference/awaitCallExpression1_es5(target=es2015).types diff --git a/tests/baselines/reference/awaitCallExpression1_es5.js b/tests/baselines/reference/awaitCallExpression1_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/awaitCallExpression1_es5.js rename to tests/baselines/reference/awaitCallExpression1_es5(target=es5).js diff --git a/tests/baselines/reference/awaitCallExpression1_es5(target=es5).symbols b/tests/baselines/reference/awaitCallExpression1_es5(target=es5).symbols new file mode 100644 index 0000000000000..d9a3bdde8fbc6 --- /dev/null +++ b/tests/baselines/reference/awaitCallExpression1_es5(target=es5).symbols @@ -0,0 +1,61 @@ +//// [tests/cases/conformance/async/es5/awaitCallExpression/awaitCallExpression1_es5.ts] //// + +=== awaitCallExpression1_es5.ts === +declare var a: boolean; +>a : Symbol(a, Decl(awaitCallExpression1_es5.ts, 0, 11)) + +declare var p: Promise; +>p : Symbol(p, Decl(awaitCallExpression1_es5.ts, 1, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; +>fn : Symbol(fn, Decl(awaitCallExpression1_es5.ts, 1, 32)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression1_es5.ts, 2, 20)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression1_es5.ts, 2, 34)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression1_es5.ts, 2, 49)) + +declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; +>o : Symbol(o, Decl(awaitCallExpression1_es5.ts, 3, 11)) +>fn : Symbol(fn, Decl(awaitCallExpression1_es5.ts, 3, 16)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression1_es5.ts, 3, 20)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression1_es5.ts, 3, 34)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression1_es5.ts, 3, 49)) + +declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>pfn : Symbol(pfn, Decl(awaitCallExpression1_es5.ts, 4, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression1_es5.ts, 4, 28)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression1_es5.ts, 4, 42)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression1_es5.ts, 4, 57)) + +declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>po : Symbol(po, Decl(awaitCallExpression1_es5.ts, 5, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>fn : Symbol(fn, Decl(awaitCallExpression1_es5.ts, 5, 25)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression1_es5.ts, 5, 29)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression1_es5.ts, 5, 43)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression1_es5.ts, 5, 58)) + +declare function before(): void; +>before : Symbol(before, Decl(awaitCallExpression1_es5.ts, 5, 84)) + +declare function after(): void; +>after : Symbol(after, Decl(awaitCallExpression1_es5.ts, 6, 32)) + +async function func(): Promise { +>func : Symbol(func, Decl(awaitCallExpression1_es5.ts, 7, 31)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + before(); +>before : Symbol(before, Decl(awaitCallExpression1_es5.ts, 5, 84)) + + var b = fn(a, a, a); +>b : Symbol(b, Decl(awaitCallExpression1_es5.ts, 10, 7)) +>fn : Symbol(fn, Decl(awaitCallExpression1_es5.ts, 1, 32)) +>a : Symbol(a, Decl(awaitCallExpression1_es5.ts, 0, 11)) +>a : Symbol(a, Decl(awaitCallExpression1_es5.ts, 0, 11)) +>a : Symbol(a, Decl(awaitCallExpression1_es5.ts, 0, 11)) + + after(); +>after : Symbol(after, Decl(awaitCallExpression1_es5.ts, 6, 32)) +} diff --git a/tests/baselines/reference/awaitCallExpression1_es5(target=es5).types b/tests/baselines/reference/awaitCallExpression1_es5(target=es5).types new file mode 100644 index 0000000000000..f9eacb8912a97 --- /dev/null +++ b/tests/baselines/reference/awaitCallExpression1_es5(target=es5).types @@ -0,0 +1,93 @@ +//// [tests/cases/conformance/async/es5/awaitCallExpression/awaitCallExpression1_es5.ts] //// + +=== awaitCallExpression1_es5.ts === +declare var a: boolean; +>a : boolean +> : ^^^^^^^ + +declare var p: Promise; +>p : Promise +> : ^^^^^^^^^^^^^^^^ + +declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; +>o : { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; } +> : ^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>pfn : Promise<(arg0: boolean, arg1: boolean, arg2: boolean) => void> +> : ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^^^ ^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>po : Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }> +> : ^^^^^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^^ +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare function before(): void; +>before : () => void +> : ^^^^^^ + +declare function after(): void; +>after : () => void +> : ^^^^^^ + +async function func(): Promise { +>func : () => Promise +> : ^^^^^^ + + before(); +>before() : void +> : ^^^^ +>before : () => void +> : ^^^^^^ + + var b = fn(a, a, a); +>b : void +> : ^^^^ +>fn(a, a, a) : void +> : ^^^^ +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>a : boolean +> : ^^^^^^^ +>a : boolean +> : ^^^^^^^ +>a : boolean +> : ^^^^^^^ + + after(); +>after() : void +> : ^^^^ +>after : () => void +> : ^^^^^^ +} diff --git a/tests/baselines/reference/awaitCallExpression2_es5(target=es2015).js b/tests/baselines/reference/awaitCallExpression2_es5(target=es2015).js new file mode 100644 index 0000000000000..9f6ac9a5033eb --- /dev/null +++ b/tests/baselines/reference/awaitCallExpression2_es5(target=es2015).js @@ -0,0 +1,25 @@ +//// [tests/cases/conformance/async/es5/awaitCallExpression/awaitCallExpression2_es5.ts] //// + +//// [awaitCallExpression2_es5.ts] +declare var a: boolean; +declare var p: Promise; +declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; +declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; +declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +declare function before(): void; +declare function after(): void; +async function func(): Promise { + before(); + var b = fn(await p, a, a); + after(); +} + +//// [awaitCallExpression2_es5.js] +function func() { + return __awaiter(this, void 0, void 0, function* () { + before(); + var b = fn(yield p, a, a); + after(); + }); +} diff --git a/tests/baselines/reference/awaitCallExpression2_es5.symbols b/tests/baselines/reference/awaitCallExpression2_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/awaitCallExpression2_es5.symbols rename to tests/baselines/reference/awaitCallExpression2_es5(target=es2015).symbols diff --git a/tests/baselines/reference/awaitCallExpression2_es5.types b/tests/baselines/reference/awaitCallExpression2_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/awaitCallExpression2_es5.types rename to tests/baselines/reference/awaitCallExpression2_es5(target=es2015).types diff --git a/tests/baselines/reference/awaitCallExpression2_es5.js b/tests/baselines/reference/awaitCallExpression2_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/awaitCallExpression2_es5.js rename to tests/baselines/reference/awaitCallExpression2_es5(target=es5).js diff --git a/tests/baselines/reference/awaitCallExpression2_es5(target=es5).symbols b/tests/baselines/reference/awaitCallExpression2_es5(target=es5).symbols new file mode 100644 index 0000000000000..606a70307ca8c --- /dev/null +++ b/tests/baselines/reference/awaitCallExpression2_es5(target=es5).symbols @@ -0,0 +1,61 @@ +//// [tests/cases/conformance/async/es5/awaitCallExpression/awaitCallExpression2_es5.ts] //// + +=== awaitCallExpression2_es5.ts === +declare var a: boolean; +>a : Symbol(a, Decl(awaitCallExpression2_es5.ts, 0, 11)) + +declare var p: Promise; +>p : Symbol(p, Decl(awaitCallExpression2_es5.ts, 1, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; +>fn : Symbol(fn, Decl(awaitCallExpression2_es5.ts, 1, 32)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression2_es5.ts, 2, 20)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression2_es5.ts, 2, 34)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression2_es5.ts, 2, 49)) + +declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; +>o : Symbol(o, Decl(awaitCallExpression2_es5.ts, 3, 11)) +>fn : Symbol(fn, Decl(awaitCallExpression2_es5.ts, 3, 16)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression2_es5.ts, 3, 20)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression2_es5.ts, 3, 34)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression2_es5.ts, 3, 49)) + +declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>pfn : Symbol(pfn, Decl(awaitCallExpression2_es5.ts, 4, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression2_es5.ts, 4, 28)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression2_es5.ts, 4, 42)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression2_es5.ts, 4, 57)) + +declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>po : Symbol(po, Decl(awaitCallExpression2_es5.ts, 5, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>fn : Symbol(fn, Decl(awaitCallExpression2_es5.ts, 5, 25)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression2_es5.ts, 5, 29)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression2_es5.ts, 5, 43)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression2_es5.ts, 5, 58)) + +declare function before(): void; +>before : Symbol(before, Decl(awaitCallExpression2_es5.ts, 5, 84)) + +declare function after(): void; +>after : Symbol(after, Decl(awaitCallExpression2_es5.ts, 6, 32)) + +async function func(): Promise { +>func : Symbol(func, Decl(awaitCallExpression2_es5.ts, 7, 31)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + before(); +>before : Symbol(before, Decl(awaitCallExpression2_es5.ts, 5, 84)) + + var b = fn(await p, a, a); +>b : Symbol(b, Decl(awaitCallExpression2_es5.ts, 10, 7)) +>fn : Symbol(fn, Decl(awaitCallExpression2_es5.ts, 1, 32)) +>p : Symbol(p, Decl(awaitCallExpression2_es5.ts, 1, 11)) +>a : Symbol(a, Decl(awaitCallExpression2_es5.ts, 0, 11)) +>a : Symbol(a, Decl(awaitCallExpression2_es5.ts, 0, 11)) + + after(); +>after : Symbol(after, Decl(awaitCallExpression2_es5.ts, 6, 32)) +} diff --git a/tests/baselines/reference/awaitCallExpression2_es5(target=es5).types b/tests/baselines/reference/awaitCallExpression2_es5(target=es5).types new file mode 100644 index 0000000000000..c70ea8ac6c812 --- /dev/null +++ b/tests/baselines/reference/awaitCallExpression2_es5(target=es5).types @@ -0,0 +1,95 @@ +//// [tests/cases/conformance/async/es5/awaitCallExpression/awaitCallExpression2_es5.ts] //// + +=== awaitCallExpression2_es5.ts === +declare var a: boolean; +>a : boolean +> : ^^^^^^^ + +declare var p: Promise; +>p : Promise +> : ^^^^^^^^^^^^^^^^ + +declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; +>o : { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; } +> : ^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>pfn : Promise<(arg0: boolean, arg1: boolean, arg2: boolean) => void> +> : ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^^^ ^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>po : Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }> +> : ^^^^^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^^ +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare function before(): void; +>before : () => void +> : ^^^^^^ + +declare function after(): void; +>after : () => void +> : ^^^^^^ + +async function func(): Promise { +>func : () => Promise +> : ^^^^^^ + + before(); +>before() : void +> : ^^^^ +>before : () => void +> : ^^^^^^ + + var b = fn(await p, a, a); +>b : void +> : ^^^^ +>fn(await p, a, a) : void +> : ^^^^ +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>await p : boolean +> : ^^^^^^^ +>p : Promise +> : ^^^^^^^^^^^^^^^^ +>a : boolean +> : ^^^^^^^ +>a : boolean +> : ^^^^^^^ + + after(); +>after() : void +> : ^^^^ +>after : () => void +> : ^^^^^^ +} diff --git a/tests/baselines/reference/awaitCallExpression3_es5(target=es2015).js b/tests/baselines/reference/awaitCallExpression3_es5(target=es2015).js new file mode 100644 index 0000000000000..29559e01282ca --- /dev/null +++ b/tests/baselines/reference/awaitCallExpression3_es5(target=es2015).js @@ -0,0 +1,25 @@ +//// [tests/cases/conformance/async/es5/awaitCallExpression/awaitCallExpression3_es5.ts] //// + +//// [awaitCallExpression3_es5.ts] +declare var a: boolean; +declare var p: Promise; +declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; +declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; +declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +declare function before(): void; +declare function after(): void; +async function func(): Promise { + before(); + var b = fn(a, await p, a); + after(); +} + +//// [awaitCallExpression3_es5.js] +function func() { + return __awaiter(this, void 0, void 0, function* () { + before(); + var b = fn(a, yield p, a); + after(); + }); +} diff --git a/tests/baselines/reference/awaitCallExpression3_es5.symbols b/tests/baselines/reference/awaitCallExpression3_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/awaitCallExpression3_es5.symbols rename to tests/baselines/reference/awaitCallExpression3_es5(target=es2015).symbols diff --git a/tests/baselines/reference/awaitCallExpression3_es5.types b/tests/baselines/reference/awaitCallExpression3_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/awaitCallExpression3_es5.types rename to tests/baselines/reference/awaitCallExpression3_es5(target=es2015).types diff --git a/tests/baselines/reference/awaitCallExpression3_es5.js b/tests/baselines/reference/awaitCallExpression3_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/awaitCallExpression3_es5.js rename to tests/baselines/reference/awaitCallExpression3_es5(target=es5).js diff --git a/tests/baselines/reference/awaitCallExpression3_es5(target=es5).symbols b/tests/baselines/reference/awaitCallExpression3_es5(target=es5).symbols new file mode 100644 index 0000000000000..720f10eb2fbbf --- /dev/null +++ b/tests/baselines/reference/awaitCallExpression3_es5(target=es5).symbols @@ -0,0 +1,61 @@ +//// [tests/cases/conformance/async/es5/awaitCallExpression/awaitCallExpression3_es5.ts] //// + +=== awaitCallExpression3_es5.ts === +declare var a: boolean; +>a : Symbol(a, Decl(awaitCallExpression3_es5.ts, 0, 11)) + +declare var p: Promise; +>p : Symbol(p, Decl(awaitCallExpression3_es5.ts, 1, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; +>fn : Symbol(fn, Decl(awaitCallExpression3_es5.ts, 1, 32)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression3_es5.ts, 2, 20)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression3_es5.ts, 2, 34)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression3_es5.ts, 2, 49)) + +declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; +>o : Symbol(o, Decl(awaitCallExpression3_es5.ts, 3, 11)) +>fn : Symbol(fn, Decl(awaitCallExpression3_es5.ts, 3, 16)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression3_es5.ts, 3, 20)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression3_es5.ts, 3, 34)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression3_es5.ts, 3, 49)) + +declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>pfn : Symbol(pfn, Decl(awaitCallExpression3_es5.ts, 4, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression3_es5.ts, 4, 28)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression3_es5.ts, 4, 42)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression3_es5.ts, 4, 57)) + +declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>po : Symbol(po, Decl(awaitCallExpression3_es5.ts, 5, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>fn : Symbol(fn, Decl(awaitCallExpression3_es5.ts, 5, 25)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression3_es5.ts, 5, 29)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression3_es5.ts, 5, 43)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression3_es5.ts, 5, 58)) + +declare function before(): void; +>before : Symbol(before, Decl(awaitCallExpression3_es5.ts, 5, 84)) + +declare function after(): void; +>after : Symbol(after, Decl(awaitCallExpression3_es5.ts, 6, 32)) + +async function func(): Promise { +>func : Symbol(func, Decl(awaitCallExpression3_es5.ts, 7, 31)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + before(); +>before : Symbol(before, Decl(awaitCallExpression3_es5.ts, 5, 84)) + + var b = fn(a, await p, a); +>b : Symbol(b, Decl(awaitCallExpression3_es5.ts, 10, 7)) +>fn : Symbol(fn, Decl(awaitCallExpression3_es5.ts, 1, 32)) +>a : Symbol(a, Decl(awaitCallExpression3_es5.ts, 0, 11)) +>p : Symbol(p, Decl(awaitCallExpression3_es5.ts, 1, 11)) +>a : Symbol(a, Decl(awaitCallExpression3_es5.ts, 0, 11)) + + after(); +>after : Symbol(after, Decl(awaitCallExpression3_es5.ts, 6, 32)) +} diff --git a/tests/baselines/reference/awaitCallExpression3_es5(target=es5).types b/tests/baselines/reference/awaitCallExpression3_es5(target=es5).types new file mode 100644 index 0000000000000..a0ea7ec7ff5f5 --- /dev/null +++ b/tests/baselines/reference/awaitCallExpression3_es5(target=es5).types @@ -0,0 +1,95 @@ +//// [tests/cases/conformance/async/es5/awaitCallExpression/awaitCallExpression3_es5.ts] //// + +=== awaitCallExpression3_es5.ts === +declare var a: boolean; +>a : boolean +> : ^^^^^^^ + +declare var p: Promise; +>p : Promise +> : ^^^^^^^^^^^^^^^^ + +declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; +>o : { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; } +> : ^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>pfn : Promise<(arg0: boolean, arg1: boolean, arg2: boolean) => void> +> : ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^^^ ^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>po : Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }> +> : ^^^^^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^^ +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare function before(): void; +>before : () => void +> : ^^^^^^ + +declare function after(): void; +>after : () => void +> : ^^^^^^ + +async function func(): Promise { +>func : () => Promise +> : ^^^^^^ + + before(); +>before() : void +> : ^^^^ +>before : () => void +> : ^^^^^^ + + var b = fn(a, await p, a); +>b : void +> : ^^^^ +>fn(a, await p, a) : void +> : ^^^^ +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>a : boolean +> : ^^^^^^^ +>await p : boolean +> : ^^^^^^^ +>p : Promise +> : ^^^^^^^^^^^^^^^^ +>a : boolean +> : ^^^^^^^ + + after(); +>after() : void +> : ^^^^ +>after : () => void +> : ^^^^^^ +} diff --git a/tests/baselines/reference/awaitCallExpression4_es5(target=es2015).js b/tests/baselines/reference/awaitCallExpression4_es5(target=es2015).js new file mode 100644 index 0000000000000..7eb335f8bf597 --- /dev/null +++ b/tests/baselines/reference/awaitCallExpression4_es5(target=es2015).js @@ -0,0 +1,25 @@ +//// [tests/cases/conformance/async/es5/awaitCallExpression/awaitCallExpression4_es5.ts] //// + +//// [awaitCallExpression4_es5.ts] +declare var a: boolean; +declare var p: Promise; +declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; +declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; +declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +declare function before(): void; +declare function after(): void; +async function func(): Promise { + before(); + var b = (await pfn)(a, a, a); + after(); +} + +//// [awaitCallExpression4_es5.js] +function func() { + return __awaiter(this, void 0, void 0, function* () { + before(); + var b = (yield pfn)(a, a, a); + after(); + }); +} diff --git a/tests/baselines/reference/awaitCallExpression4_es5.symbols b/tests/baselines/reference/awaitCallExpression4_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/awaitCallExpression4_es5.symbols rename to tests/baselines/reference/awaitCallExpression4_es5(target=es2015).symbols diff --git a/tests/baselines/reference/awaitCallExpression4_es5.types b/tests/baselines/reference/awaitCallExpression4_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/awaitCallExpression4_es5.types rename to tests/baselines/reference/awaitCallExpression4_es5(target=es2015).types diff --git a/tests/baselines/reference/awaitCallExpression4_es5.js b/tests/baselines/reference/awaitCallExpression4_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/awaitCallExpression4_es5.js rename to tests/baselines/reference/awaitCallExpression4_es5(target=es5).js diff --git a/tests/baselines/reference/awaitCallExpression4_es5(target=es5).symbols b/tests/baselines/reference/awaitCallExpression4_es5(target=es5).symbols new file mode 100644 index 0000000000000..5c27056a0d3d5 --- /dev/null +++ b/tests/baselines/reference/awaitCallExpression4_es5(target=es5).symbols @@ -0,0 +1,61 @@ +//// [tests/cases/conformance/async/es5/awaitCallExpression/awaitCallExpression4_es5.ts] //// + +=== awaitCallExpression4_es5.ts === +declare var a: boolean; +>a : Symbol(a, Decl(awaitCallExpression4_es5.ts, 0, 11)) + +declare var p: Promise; +>p : Symbol(p, Decl(awaitCallExpression4_es5.ts, 1, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; +>fn : Symbol(fn, Decl(awaitCallExpression4_es5.ts, 1, 32)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression4_es5.ts, 2, 20)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression4_es5.ts, 2, 34)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression4_es5.ts, 2, 49)) + +declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; +>o : Symbol(o, Decl(awaitCallExpression4_es5.ts, 3, 11)) +>fn : Symbol(fn, Decl(awaitCallExpression4_es5.ts, 3, 16)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression4_es5.ts, 3, 20)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression4_es5.ts, 3, 34)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression4_es5.ts, 3, 49)) + +declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>pfn : Symbol(pfn, Decl(awaitCallExpression4_es5.ts, 4, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression4_es5.ts, 4, 28)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression4_es5.ts, 4, 42)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression4_es5.ts, 4, 57)) + +declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>po : Symbol(po, Decl(awaitCallExpression4_es5.ts, 5, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>fn : Symbol(fn, Decl(awaitCallExpression4_es5.ts, 5, 25)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression4_es5.ts, 5, 29)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression4_es5.ts, 5, 43)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression4_es5.ts, 5, 58)) + +declare function before(): void; +>before : Symbol(before, Decl(awaitCallExpression4_es5.ts, 5, 84)) + +declare function after(): void; +>after : Symbol(after, Decl(awaitCallExpression4_es5.ts, 6, 32)) + +async function func(): Promise { +>func : Symbol(func, Decl(awaitCallExpression4_es5.ts, 7, 31)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + before(); +>before : Symbol(before, Decl(awaitCallExpression4_es5.ts, 5, 84)) + + var b = (await pfn)(a, a, a); +>b : Symbol(b, Decl(awaitCallExpression4_es5.ts, 10, 7)) +>pfn : Symbol(pfn, Decl(awaitCallExpression4_es5.ts, 4, 11)) +>a : Symbol(a, Decl(awaitCallExpression4_es5.ts, 0, 11)) +>a : Symbol(a, Decl(awaitCallExpression4_es5.ts, 0, 11)) +>a : Symbol(a, Decl(awaitCallExpression4_es5.ts, 0, 11)) + + after(); +>after : Symbol(after, Decl(awaitCallExpression4_es5.ts, 6, 32)) +} diff --git a/tests/baselines/reference/awaitCallExpression4_es5(target=es5).types b/tests/baselines/reference/awaitCallExpression4_es5(target=es5).types new file mode 100644 index 0000000000000..b6850d8835b5d --- /dev/null +++ b/tests/baselines/reference/awaitCallExpression4_es5(target=es5).types @@ -0,0 +1,97 @@ +//// [tests/cases/conformance/async/es5/awaitCallExpression/awaitCallExpression4_es5.ts] //// + +=== awaitCallExpression4_es5.ts === +declare var a: boolean; +>a : boolean +> : ^^^^^^^ + +declare var p: Promise; +>p : Promise +> : ^^^^^^^^^^^^^^^^ + +declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; +>o : { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; } +> : ^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>pfn : Promise<(arg0: boolean, arg1: boolean, arg2: boolean) => void> +> : ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^^^ ^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>po : Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }> +> : ^^^^^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^^ +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare function before(): void; +>before : () => void +> : ^^^^^^ + +declare function after(): void; +>after : () => void +> : ^^^^^^ + +async function func(): Promise { +>func : () => Promise +> : ^^^^^^ + + before(); +>before() : void +> : ^^^^ +>before : () => void +> : ^^^^^^ + + var b = (await pfn)(a, a, a); +>b : void +> : ^^^^ +>(await pfn)(a, a, a) : void +> : ^^^^ +>(await pfn) : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>await pfn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>pfn : Promise<(arg0: boolean, arg1: boolean, arg2: boolean) => void> +> : ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^^^ ^ +>a : boolean +> : ^^^^^^^ +>a : boolean +> : ^^^^^^^ +>a : boolean +> : ^^^^^^^ + + after(); +>after() : void +> : ^^^^ +>after : () => void +> : ^^^^^^ +} diff --git a/tests/baselines/reference/awaitCallExpression5_es5(target=es2015).js b/tests/baselines/reference/awaitCallExpression5_es5(target=es2015).js new file mode 100644 index 0000000000000..bdd3e092eba12 --- /dev/null +++ b/tests/baselines/reference/awaitCallExpression5_es5(target=es2015).js @@ -0,0 +1,25 @@ +//// [tests/cases/conformance/async/es5/awaitCallExpression/awaitCallExpression5_es5.ts] //// + +//// [awaitCallExpression5_es5.ts] +declare var a: boolean; +declare var p: Promise; +declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; +declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; +declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +declare function before(): void; +declare function after(): void; +async function func(): Promise { + before(); + var b = o.fn(a, a, a); + after(); +} + +//// [awaitCallExpression5_es5.js] +function func() { + return __awaiter(this, void 0, void 0, function* () { + before(); + var b = o.fn(a, a, a); + after(); + }); +} diff --git a/tests/baselines/reference/awaitCallExpression5_es5.symbols b/tests/baselines/reference/awaitCallExpression5_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/awaitCallExpression5_es5.symbols rename to tests/baselines/reference/awaitCallExpression5_es5(target=es2015).symbols diff --git a/tests/baselines/reference/awaitCallExpression5_es5.types b/tests/baselines/reference/awaitCallExpression5_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/awaitCallExpression5_es5.types rename to tests/baselines/reference/awaitCallExpression5_es5(target=es2015).types diff --git a/tests/baselines/reference/awaitCallExpression5_es5.js b/tests/baselines/reference/awaitCallExpression5_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/awaitCallExpression5_es5.js rename to tests/baselines/reference/awaitCallExpression5_es5(target=es5).js diff --git a/tests/baselines/reference/awaitCallExpression5_es5(target=es5).symbols b/tests/baselines/reference/awaitCallExpression5_es5(target=es5).symbols new file mode 100644 index 0000000000000..8e3a1ff17f2f0 --- /dev/null +++ b/tests/baselines/reference/awaitCallExpression5_es5(target=es5).symbols @@ -0,0 +1,63 @@ +//// [tests/cases/conformance/async/es5/awaitCallExpression/awaitCallExpression5_es5.ts] //// + +=== awaitCallExpression5_es5.ts === +declare var a: boolean; +>a : Symbol(a, Decl(awaitCallExpression5_es5.ts, 0, 11)) + +declare var p: Promise; +>p : Symbol(p, Decl(awaitCallExpression5_es5.ts, 1, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; +>fn : Symbol(fn, Decl(awaitCallExpression5_es5.ts, 1, 32)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression5_es5.ts, 2, 20)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression5_es5.ts, 2, 34)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression5_es5.ts, 2, 49)) + +declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; +>o : Symbol(o, Decl(awaitCallExpression5_es5.ts, 3, 11)) +>fn : Symbol(fn, Decl(awaitCallExpression5_es5.ts, 3, 16)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression5_es5.ts, 3, 20)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression5_es5.ts, 3, 34)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression5_es5.ts, 3, 49)) + +declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>pfn : Symbol(pfn, Decl(awaitCallExpression5_es5.ts, 4, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression5_es5.ts, 4, 28)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression5_es5.ts, 4, 42)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression5_es5.ts, 4, 57)) + +declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>po : Symbol(po, Decl(awaitCallExpression5_es5.ts, 5, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>fn : Symbol(fn, Decl(awaitCallExpression5_es5.ts, 5, 25)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression5_es5.ts, 5, 29)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression5_es5.ts, 5, 43)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression5_es5.ts, 5, 58)) + +declare function before(): void; +>before : Symbol(before, Decl(awaitCallExpression5_es5.ts, 5, 84)) + +declare function after(): void; +>after : Symbol(after, Decl(awaitCallExpression5_es5.ts, 6, 32)) + +async function func(): Promise { +>func : Symbol(func, Decl(awaitCallExpression5_es5.ts, 7, 31)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + before(); +>before : Symbol(before, Decl(awaitCallExpression5_es5.ts, 5, 84)) + + var b = o.fn(a, a, a); +>b : Symbol(b, Decl(awaitCallExpression5_es5.ts, 10, 7)) +>o.fn : Symbol(fn, Decl(awaitCallExpression5_es5.ts, 3, 16)) +>o : Symbol(o, Decl(awaitCallExpression5_es5.ts, 3, 11)) +>fn : Symbol(fn, Decl(awaitCallExpression5_es5.ts, 3, 16)) +>a : Symbol(a, Decl(awaitCallExpression5_es5.ts, 0, 11)) +>a : Symbol(a, Decl(awaitCallExpression5_es5.ts, 0, 11)) +>a : Symbol(a, Decl(awaitCallExpression5_es5.ts, 0, 11)) + + after(); +>after : Symbol(after, Decl(awaitCallExpression5_es5.ts, 6, 32)) +} diff --git a/tests/baselines/reference/awaitCallExpression5_es5(target=es5).types b/tests/baselines/reference/awaitCallExpression5_es5(target=es5).types new file mode 100644 index 0000000000000..dda4a22b7b389 --- /dev/null +++ b/tests/baselines/reference/awaitCallExpression5_es5(target=es5).types @@ -0,0 +1,97 @@ +//// [tests/cases/conformance/async/es5/awaitCallExpression/awaitCallExpression5_es5.ts] //// + +=== awaitCallExpression5_es5.ts === +declare var a: boolean; +>a : boolean +> : ^^^^^^^ + +declare var p: Promise; +>p : Promise +> : ^^^^^^^^^^^^^^^^ + +declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; +>o : { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; } +> : ^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>pfn : Promise<(arg0: boolean, arg1: boolean, arg2: boolean) => void> +> : ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^^^ ^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>po : Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }> +> : ^^^^^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^^ +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare function before(): void; +>before : () => void +> : ^^^^^^ + +declare function after(): void; +>after : () => void +> : ^^^^^^ + +async function func(): Promise { +>func : () => Promise +> : ^^^^^^ + + before(); +>before() : void +> : ^^^^ +>before : () => void +> : ^^^^^^ + + var b = o.fn(a, a, a); +>b : void +> : ^^^^ +>o.fn(a, a, a) : void +> : ^^^^ +>o.fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>o : { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; } +> : ^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>a : boolean +> : ^^^^^^^ +>a : boolean +> : ^^^^^^^ +>a : boolean +> : ^^^^^^^ + + after(); +>after() : void +> : ^^^^ +>after : () => void +> : ^^^^^^ +} diff --git a/tests/baselines/reference/awaitCallExpression6_es5(target=es2015).js b/tests/baselines/reference/awaitCallExpression6_es5(target=es2015).js new file mode 100644 index 0000000000000..2100541098075 --- /dev/null +++ b/tests/baselines/reference/awaitCallExpression6_es5(target=es2015).js @@ -0,0 +1,25 @@ +//// [tests/cases/conformance/async/es5/awaitCallExpression/awaitCallExpression6_es5.ts] //// + +//// [awaitCallExpression6_es5.ts] +declare var a: boolean; +declare var p: Promise; +declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; +declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; +declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +declare function before(): void; +declare function after(): void; +async function func(): Promise { + before(); + var b = o.fn(await p, a, a); + after(); +} + +//// [awaitCallExpression6_es5.js] +function func() { + return __awaiter(this, void 0, void 0, function* () { + before(); + var b = o.fn(yield p, a, a); + after(); + }); +} diff --git a/tests/baselines/reference/awaitCallExpression6_es5.symbols b/tests/baselines/reference/awaitCallExpression6_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/awaitCallExpression6_es5.symbols rename to tests/baselines/reference/awaitCallExpression6_es5(target=es2015).symbols diff --git a/tests/baselines/reference/awaitCallExpression6_es5.types b/tests/baselines/reference/awaitCallExpression6_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/awaitCallExpression6_es5.types rename to tests/baselines/reference/awaitCallExpression6_es5(target=es2015).types diff --git a/tests/baselines/reference/awaitCallExpression6_es5.js b/tests/baselines/reference/awaitCallExpression6_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/awaitCallExpression6_es5.js rename to tests/baselines/reference/awaitCallExpression6_es5(target=es5).js diff --git a/tests/baselines/reference/awaitCallExpression6_es5(target=es5).symbols b/tests/baselines/reference/awaitCallExpression6_es5(target=es5).symbols new file mode 100644 index 0000000000000..cee460dc1e7a4 --- /dev/null +++ b/tests/baselines/reference/awaitCallExpression6_es5(target=es5).symbols @@ -0,0 +1,63 @@ +//// [tests/cases/conformance/async/es5/awaitCallExpression/awaitCallExpression6_es5.ts] //// + +=== awaitCallExpression6_es5.ts === +declare var a: boolean; +>a : Symbol(a, Decl(awaitCallExpression6_es5.ts, 0, 11)) + +declare var p: Promise; +>p : Symbol(p, Decl(awaitCallExpression6_es5.ts, 1, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; +>fn : Symbol(fn, Decl(awaitCallExpression6_es5.ts, 1, 32)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression6_es5.ts, 2, 20)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression6_es5.ts, 2, 34)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression6_es5.ts, 2, 49)) + +declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; +>o : Symbol(o, Decl(awaitCallExpression6_es5.ts, 3, 11)) +>fn : Symbol(fn, Decl(awaitCallExpression6_es5.ts, 3, 16)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression6_es5.ts, 3, 20)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression6_es5.ts, 3, 34)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression6_es5.ts, 3, 49)) + +declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>pfn : Symbol(pfn, Decl(awaitCallExpression6_es5.ts, 4, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression6_es5.ts, 4, 28)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression6_es5.ts, 4, 42)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression6_es5.ts, 4, 57)) + +declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>po : Symbol(po, Decl(awaitCallExpression6_es5.ts, 5, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>fn : Symbol(fn, Decl(awaitCallExpression6_es5.ts, 5, 25)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression6_es5.ts, 5, 29)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression6_es5.ts, 5, 43)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression6_es5.ts, 5, 58)) + +declare function before(): void; +>before : Symbol(before, Decl(awaitCallExpression6_es5.ts, 5, 84)) + +declare function after(): void; +>after : Symbol(after, Decl(awaitCallExpression6_es5.ts, 6, 32)) + +async function func(): Promise { +>func : Symbol(func, Decl(awaitCallExpression6_es5.ts, 7, 31)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + before(); +>before : Symbol(before, Decl(awaitCallExpression6_es5.ts, 5, 84)) + + var b = o.fn(await p, a, a); +>b : Symbol(b, Decl(awaitCallExpression6_es5.ts, 10, 7)) +>o.fn : Symbol(fn, Decl(awaitCallExpression6_es5.ts, 3, 16)) +>o : Symbol(o, Decl(awaitCallExpression6_es5.ts, 3, 11)) +>fn : Symbol(fn, Decl(awaitCallExpression6_es5.ts, 3, 16)) +>p : Symbol(p, Decl(awaitCallExpression6_es5.ts, 1, 11)) +>a : Symbol(a, Decl(awaitCallExpression6_es5.ts, 0, 11)) +>a : Symbol(a, Decl(awaitCallExpression6_es5.ts, 0, 11)) + + after(); +>after : Symbol(after, Decl(awaitCallExpression6_es5.ts, 6, 32)) +} diff --git a/tests/baselines/reference/awaitCallExpression6_es5(target=es5).types b/tests/baselines/reference/awaitCallExpression6_es5(target=es5).types new file mode 100644 index 0000000000000..baa9dc9f23f5d --- /dev/null +++ b/tests/baselines/reference/awaitCallExpression6_es5(target=es5).types @@ -0,0 +1,99 @@ +//// [tests/cases/conformance/async/es5/awaitCallExpression/awaitCallExpression6_es5.ts] //// + +=== awaitCallExpression6_es5.ts === +declare var a: boolean; +>a : boolean +> : ^^^^^^^ + +declare var p: Promise; +>p : Promise +> : ^^^^^^^^^^^^^^^^ + +declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; +>o : { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; } +> : ^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>pfn : Promise<(arg0: boolean, arg1: boolean, arg2: boolean) => void> +> : ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^^^ ^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>po : Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }> +> : ^^^^^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^^ +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare function before(): void; +>before : () => void +> : ^^^^^^ + +declare function after(): void; +>after : () => void +> : ^^^^^^ + +async function func(): Promise { +>func : () => Promise +> : ^^^^^^ + + before(); +>before() : void +> : ^^^^ +>before : () => void +> : ^^^^^^ + + var b = o.fn(await p, a, a); +>b : void +> : ^^^^ +>o.fn(await p, a, a) : void +> : ^^^^ +>o.fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>o : { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; } +> : ^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>await p : boolean +> : ^^^^^^^ +>p : Promise +> : ^^^^^^^^^^^^^^^^ +>a : boolean +> : ^^^^^^^ +>a : boolean +> : ^^^^^^^ + + after(); +>after() : void +> : ^^^^ +>after : () => void +> : ^^^^^^ +} diff --git a/tests/baselines/reference/awaitCallExpression7_es5(target=es2015).js b/tests/baselines/reference/awaitCallExpression7_es5(target=es2015).js new file mode 100644 index 0000000000000..64f2fca441a45 --- /dev/null +++ b/tests/baselines/reference/awaitCallExpression7_es5(target=es2015).js @@ -0,0 +1,25 @@ +//// [tests/cases/conformance/async/es5/awaitCallExpression/awaitCallExpression7_es5.ts] //// + +//// [awaitCallExpression7_es5.ts] +declare var a: boolean; +declare var p: Promise; +declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; +declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; +declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +declare function before(): void; +declare function after(): void; +async function func(): Promise { + before(); + var b = o.fn(a, await p, a); + after(); +} + +//// [awaitCallExpression7_es5.js] +function func() { + return __awaiter(this, void 0, void 0, function* () { + before(); + var b = o.fn(a, yield p, a); + after(); + }); +} diff --git a/tests/baselines/reference/awaitCallExpression7_es5.symbols b/tests/baselines/reference/awaitCallExpression7_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/awaitCallExpression7_es5.symbols rename to tests/baselines/reference/awaitCallExpression7_es5(target=es2015).symbols diff --git a/tests/baselines/reference/awaitCallExpression7_es5.types b/tests/baselines/reference/awaitCallExpression7_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/awaitCallExpression7_es5.types rename to tests/baselines/reference/awaitCallExpression7_es5(target=es2015).types diff --git a/tests/baselines/reference/awaitCallExpression7_es5.js b/tests/baselines/reference/awaitCallExpression7_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/awaitCallExpression7_es5.js rename to tests/baselines/reference/awaitCallExpression7_es5(target=es5).js diff --git a/tests/baselines/reference/awaitCallExpression7_es5(target=es5).symbols b/tests/baselines/reference/awaitCallExpression7_es5(target=es5).symbols new file mode 100644 index 0000000000000..7f48849b27f8d --- /dev/null +++ b/tests/baselines/reference/awaitCallExpression7_es5(target=es5).symbols @@ -0,0 +1,63 @@ +//// [tests/cases/conformance/async/es5/awaitCallExpression/awaitCallExpression7_es5.ts] //// + +=== awaitCallExpression7_es5.ts === +declare var a: boolean; +>a : Symbol(a, Decl(awaitCallExpression7_es5.ts, 0, 11)) + +declare var p: Promise; +>p : Symbol(p, Decl(awaitCallExpression7_es5.ts, 1, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; +>fn : Symbol(fn, Decl(awaitCallExpression7_es5.ts, 1, 32)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression7_es5.ts, 2, 20)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression7_es5.ts, 2, 34)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression7_es5.ts, 2, 49)) + +declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; +>o : Symbol(o, Decl(awaitCallExpression7_es5.ts, 3, 11)) +>fn : Symbol(fn, Decl(awaitCallExpression7_es5.ts, 3, 16)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression7_es5.ts, 3, 20)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression7_es5.ts, 3, 34)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression7_es5.ts, 3, 49)) + +declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>pfn : Symbol(pfn, Decl(awaitCallExpression7_es5.ts, 4, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression7_es5.ts, 4, 28)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression7_es5.ts, 4, 42)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression7_es5.ts, 4, 57)) + +declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>po : Symbol(po, Decl(awaitCallExpression7_es5.ts, 5, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>fn : Symbol(fn, Decl(awaitCallExpression7_es5.ts, 5, 25)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression7_es5.ts, 5, 29)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression7_es5.ts, 5, 43)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression7_es5.ts, 5, 58)) + +declare function before(): void; +>before : Symbol(before, Decl(awaitCallExpression7_es5.ts, 5, 84)) + +declare function after(): void; +>after : Symbol(after, Decl(awaitCallExpression7_es5.ts, 6, 32)) + +async function func(): Promise { +>func : Symbol(func, Decl(awaitCallExpression7_es5.ts, 7, 31)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + before(); +>before : Symbol(before, Decl(awaitCallExpression7_es5.ts, 5, 84)) + + var b = o.fn(a, await p, a); +>b : Symbol(b, Decl(awaitCallExpression7_es5.ts, 10, 7)) +>o.fn : Symbol(fn, Decl(awaitCallExpression7_es5.ts, 3, 16)) +>o : Symbol(o, Decl(awaitCallExpression7_es5.ts, 3, 11)) +>fn : Symbol(fn, Decl(awaitCallExpression7_es5.ts, 3, 16)) +>a : Symbol(a, Decl(awaitCallExpression7_es5.ts, 0, 11)) +>p : Symbol(p, Decl(awaitCallExpression7_es5.ts, 1, 11)) +>a : Symbol(a, Decl(awaitCallExpression7_es5.ts, 0, 11)) + + after(); +>after : Symbol(after, Decl(awaitCallExpression7_es5.ts, 6, 32)) +} diff --git a/tests/baselines/reference/awaitCallExpression7_es5(target=es5).types b/tests/baselines/reference/awaitCallExpression7_es5(target=es5).types new file mode 100644 index 0000000000000..0b7d51ad2e972 --- /dev/null +++ b/tests/baselines/reference/awaitCallExpression7_es5(target=es5).types @@ -0,0 +1,99 @@ +//// [tests/cases/conformance/async/es5/awaitCallExpression/awaitCallExpression7_es5.ts] //// + +=== awaitCallExpression7_es5.ts === +declare var a: boolean; +>a : boolean +> : ^^^^^^^ + +declare var p: Promise; +>p : Promise +> : ^^^^^^^^^^^^^^^^ + +declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; +>o : { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; } +> : ^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>pfn : Promise<(arg0: boolean, arg1: boolean, arg2: boolean) => void> +> : ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^^^ ^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>po : Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }> +> : ^^^^^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^^ +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare function before(): void; +>before : () => void +> : ^^^^^^ + +declare function after(): void; +>after : () => void +> : ^^^^^^ + +async function func(): Promise { +>func : () => Promise +> : ^^^^^^ + + before(); +>before() : void +> : ^^^^ +>before : () => void +> : ^^^^^^ + + var b = o.fn(a, await p, a); +>b : void +> : ^^^^ +>o.fn(a, await p, a) : void +> : ^^^^ +>o.fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>o : { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; } +> : ^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>a : boolean +> : ^^^^^^^ +>await p : boolean +> : ^^^^^^^ +>p : Promise +> : ^^^^^^^^^^^^^^^^ +>a : boolean +> : ^^^^^^^ + + after(); +>after() : void +> : ^^^^ +>after : () => void +> : ^^^^^^ +} diff --git a/tests/baselines/reference/awaitCallExpression8_es5(target=es2015).js b/tests/baselines/reference/awaitCallExpression8_es5(target=es2015).js new file mode 100644 index 0000000000000..8a98db54084e0 --- /dev/null +++ b/tests/baselines/reference/awaitCallExpression8_es5(target=es2015).js @@ -0,0 +1,25 @@ +//// [tests/cases/conformance/async/es5/awaitCallExpression/awaitCallExpression8_es5.ts] //// + +//// [awaitCallExpression8_es5.ts] +declare var a: boolean; +declare var p: Promise; +declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; +declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; +declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +declare function before(): void; +declare function after(): void; +async function func(): Promise { + before(); + var b = (await po).fn(a, a, a); + after(); +} + +//// [awaitCallExpression8_es5.js] +function func() { + return __awaiter(this, void 0, void 0, function* () { + before(); + var b = (yield po).fn(a, a, a); + after(); + }); +} diff --git a/tests/baselines/reference/awaitCallExpression8_es5.symbols b/tests/baselines/reference/awaitCallExpression8_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/awaitCallExpression8_es5.symbols rename to tests/baselines/reference/awaitCallExpression8_es5(target=es2015).symbols diff --git a/tests/baselines/reference/awaitCallExpression8_es5.types b/tests/baselines/reference/awaitCallExpression8_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/awaitCallExpression8_es5.types rename to tests/baselines/reference/awaitCallExpression8_es5(target=es2015).types diff --git a/tests/baselines/reference/awaitCallExpression8_es5.js b/tests/baselines/reference/awaitCallExpression8_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/awaitCallExpression8_es5.js rename to tests/baselines/reference/awaitCallExpression8_es5(target=es5).js diff --git a/tests/baselines/reference/awaitCallExpression8_es5(target=es5).symbols b/tests/baselines/reference/awaitCallExpression8_es5(target=es5).symbols new file mode 100644 index 0000000000000..1cc9dde97ba72 --- /dev/null +++ b/tests/baselines/reference/awaitCallExpression8_es5(target=es5).symbols @@ -0,0 +1,63 @@ +//// [tests/cases/conformance/async/es5/awaitCallExpression/awaitCallExpression8_es5.ts] //// + +=== awaitCallExpression8_es5.ts === +declare var a: boolean; +>a : Symbol(a, Decl(awaitCallExpression8_es5.ts, 0, 11)) + +declare var p: Promise; +>p : Symbol(p, Decl(awaitCallExpression8_es5.ts, 1, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; +>fn : Symbol(fn, Decl(awaitCallExpression8_es5.ts, 1, 32)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression8_es5.ts, 2, 20)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression8_es5.ts, 2, 34)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression8_es5.ts, 2, 49)) + +declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; +>o : Symbol(o, Decl(awaitCallExpression8_es5.ts, 3, 11)) +>fn : Symbol(fn, Decl(awaitCallExpression8_es5.ts, 3, 16)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression8_es5.ts, 3, 20)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression8_es5.ts, 3, 34)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression8_es5.ts, 3, 49)) + +declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>pfn : Symbol(pfn, Decl(awaitCallExpression8_es5.ts, 4, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression8_es5.ts, 4, 28)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression8_es5.ts, 4, 42)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression8_es5.ts, 4, 57)) + +declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>po : Symbol(po, Decl(awaitCallExpression8_es5.ts, 5, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>fn : Symbol(fn, Decl(awaitCallExpression8_es5.ts, 5, 25)) +>arg0 : Symbol(arg0, Decl(awaitCallExpression8_es5.ts, 5, 29)) +>arg1 : Symbol(arg1, Decl(awaitCallExpression8_es5.ts, 5, 43)) +>arg2 : Symbol(arg2, Decl(awaitCallExpression8_es5.ts, 5, 58)) + +declare function before(): void; +>before : Symbol(before, Decl(awaitCallExpression8_es5.ts, 5, 84)) + +declare function after(): void; +>after : Symbol(after, Decl(awaitCallExpression8_es5.ts, 6, 32)) + +async function func(): Promise { +>func : Symbol(func, Decl(awaitCallExpression8_es5.ts, 7, 31)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + before(); +>before : Symbol(before, Decl(awaitCallExpression8_es5.ts, 5, 84)) + + var b = (await po).fn(a, a, a); +>b : Symbol(b, Decl(awaitCallExpression8_es5.ts, 10, 7)) +>(await po).fn : Symbol(fn, Decl(awaitCallExpression8_es5.ts, 5, 25)) +>po : Symbol(po, Decl(awaitCallExpression8_es5.ts, 5, 11)) +>fn : Symbol(fn, Decl(awaitCallExpression8_es5.ts, 5, 25)) +>a : Symbol(a, Decl(awaitCallExpression8_es5.ts, 0, 11)) +>a : Symbol(a, Decl(awaitCallExpression8_es5.ts, 0, 11)) +>a : Symbol(a, Decl(awaitCallExpression8_es5.ts, 0, 11)) + + after(); +>after : Symbol(after, Decl(awaitCallExpression8_es5.ts, 6, 32)) +} diff --git a/tests/baselines/reference/awaitCallExpression8_es5(target=es5).types b/tests/baselines/reference/awaitCallExpression8_es5(target=es5).types new file mode 100644 index 0000000000000..1a2563d628ce4 --- /dev/null +++ b/tests/baselines/reference/awaitCallExpression8_es5(target=es5).types @@ -0,0 +1,101 @@ +//// [tests/cases/conformance/async/es5/awaitCallExpression/awaitCallExpression8_es5.ts] //// + +=== awaitCallExpression8_es5.ts === +declare var a: boolean; +>a : boolean +> : ^^^^^^^ + +declare var p: Promise; +>p : Promise +> : ^^^^^^^^^^^^^^^^ + +declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; +>o : { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; } +> : ^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>pfn : Promise<(arg0: boolean, arg1: boolean, arg2: boolean) => void> +> : ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^^^ ^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; +>po : Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }> +> : ^^^^^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^^ +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>arg0 : boolean +> : ^^^^^^^ +>arg1 : boolean +> : ^^^^^^^ +>arg2 : boolean +> : ^^^^^^^ + +declare function before(): void; +>before : () => void +> : ^^^^^^ + +declare function after(): void; +>after : () => void +> : ^^^^^^ + +async function func(): Promise { +>func : () => Promise +> : ^^^^^^ + + before(); +>before() : void +> : ^^^^ +>before : () => void +> : ^^^^^^ + + var b = (await po).fn(a, a, a); +>b : void +> : ^^^^ +>(await po).fn(a, a, a) : void +> : ^^^^ +>(await po).fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>(await po) : { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; } +> : ^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ +>await po : { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; } +> : ^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ +>po : Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }> +> : ^^^^^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^^ +>fn : (arg0: boolean, arg1: boolean, arg2: boolean) => void +> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ +>a : boolean +> : ^^^^^^^ +>a : boolean +> : ^^^^^^^ +>a : boolean +> : ^^^^^^^ + + after(); +>after() : void +> : ^^^^ +>after : () => void +> : ^^^^^^ +} diff --git a/tests/baselines/reference/awaitClassExpression_es5(target=es2015).js b/tests/baselines/reference/awaitClassExpression_es5(target=es2015).js new file mode 100644 index 0000000000000..92cba5b02ed81 --- /dev/null +++ b/tests/baselines/reference/awaitClassExpression_es5(target=es2015).js @@ -0,0 +1,18 @@ +//// [tests/cases/conformance/async/es5/awaitClassExpression_es5.ts] //// + +//// [awaitClassExpression_es5.ts] +declare class C { } +declare var p: Promise; + +async function func(): Promise { + class D extends (await p) { + } +} + +//// [awaitClassExpression_es5.js] +function func() { + return __awaiter(this, void 0, void 0, function* () { + class D extends (yield p) { + } + }); +} diff --git a/tests/baselines/reference/awaitClassExpression_es5.symbols b/tests/baselines/reference/awaitClassExpression_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/awaitClassExpression_es5.symbols rename to tests/baselines/reference/awaitClassExpression_es5(target=es2015).symbols diff --git a/tests/baselines/reference/awaitClassExpression_es5.types b/tests/baselines/reference/awaitClassExpression_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/awaitClassExpression_es5.types rename to tests/baselines/reference/awaitClassExpression_es5(target=es2015).types diff --git a/tests/baselines/reference/awaitClassExpression_es5.js b/tests/baselines/reference/awaitClassExpression_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/awaitClassExpression_es5.js rename to tests/baselines/reference/awaitClassExpression_es5(target=es5).js diff --git a/tests/baselines/reference/awaitClassExpression_es5(target=es5).symbols b/tests/baselines/reference/awaitClassExpression_es5(target=es5).symbols new file mode 100644 index 0000000000000..313741564dcb9 --- /dev/null +++ b/tests/baselines/reference/awaitClassExpression_es5(target=es5).symbols @@ -0,0 +1,20 @@ +//// [tests/cases/conformance/async/es5/awaitClassExpression_es5.ts] //// + +=== awaitClassExpression_es5.ts === +declare class C { } +>C : Symbol(C, Decl(awaitClassExpression_es5.ts, 0, 0)) + +declare var p: Promise; +>p : Symbol(p, Decl(awaitClassExpression_es5.ts, 1, 11)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>C : Symbol(C, Decl(awaitClassExpression_es5.ts, 0, 0)) + +async function func(): Promise { +>func : Symbol(func, Decl(awaitClassExpression_es5.ts, 1, 33)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + class D extends (await p) { +>D : Symbol(D, Decl(awaitClassExpression_es5.ts, 3, 38)) +>p : Symbol(p, Decl(awaitClassExpression_es5.ts, 1, 11)) + } +} diff --git a/tests/baselines/reference/awaitClassExpression_es5(target=es5).types b/tests/baselines/reference/awaitClassExpression_es5(target=es5).types new file mode 100644 index 0000000000000..9bbaf975c0dd3 --- /dev/null +++ b/tests/baselines/reference/awaitClassExpression_es5(target=es5).types @@ -0,0 +1,28 @@ +//// [tests/cases/conformance/async/es5/awaitClassExpression_es5.ts] //// + +=== awaitClassExpression_es5.ts === +declare class C { } +>C : C +> : ^ + +declare var p: Promise; +>p : Promise +> : ^^^^^^^^^^^^^^^^^ +>C : typeof C +> : ^^^^^^^^ + +async function func(): Promise { +>func : () => Promise +> : ^^^^^^ + + class D extends (await p) { +>D : D +> : ^ +>(await p) : C +> : ^ +>await p : typeof C +> : ^^^^^^^^ +>p : Promise +> : ^^^^^^^^^^^^^^^^^ + } +} diff --git a/tests/baselines/reference/awaitUnion_es5(target=es2015).js b/tests/baselines/reference/awaitUnion_es5(target=es2015).js new file mode 100644 index 0000000000000..6cd45129e480e --- /dev/null +++ b/tests/baselines/reference/awaitUnion_es5(target=es2015).js @@ -0,0 +1,26 @@ +//// [tests/cases/conformance/async/es5/awaitUnion_es5.ts] //// + +//// [awaitUnion_es5.ts] +declare let a: number | string; +declare let b: PromiseLike | PromiseLike; +declare let c: PromiseLike; +declare let d: number | PromiseLike; +declare let e: number | PromiseLike; +async function f() { + let await_a = await a; + let await_b = await b; + let await_c = await c; + let await_d = await d; + let await_e = await e; +} + +//// [awaitUnion_es5.js] +function f() { + return __awaiter(this, void 0, void 0, function* () { + let await_a = yield a; + let await_b = yield b; + let await_c = yield c; + let await_d = yield d; + let await_e = yield e; + }); +} diff --git a/tests/baselines/reference/awaitUnion_es5.symbols b/tests/baselines/reference/awaitUnion_es5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/awaitUnion_es5.symbols rename to tests/baselines/reference/awaitUnion_es5(target=es2015).symbols diff --git a/tests/baselines/reference/awaitUnion_es5.types b/tests/baselines/reference/awaitUnion_es5(target=es2015).types similarity index 100% rename from tests/baselines/reference/awaitUnion_es5.types rename to tests/baselines/reference/awaitUnion_es5(target=es2015).types diff --git a/tests/baselines/reference/awaitUnion_es5.js b/tests/baselines/reference/awaitUnion_es5(target=es5).js similarity index 100% rename from tests/baselines/reference/awaitUnion_es5.js rename to tests/baselines/reference/awaitUnion_es5(target=es5).js diff --git a/tests/baselines/reference/awaitUnion_es5(target=es5).symbols b/tests/baselines/reference/awaitUnion_es5(target=es5).symbols new file mode 100644 index 0000000000000..56817ad81c7f3 --- /dev/null +++ b/tests/baselines/reference/awaitUnion_es5(target=es5).symbols @@ -0,0 +1,46 @@ +//// [tests/cases/conformance/async/es5/awaitUnion_es5.ts] //// + +=== awaitUnion_es5.ts === +declare let a: number | string; +>a : Symbol(a, Decl(awaitUnion_es5.ts, 0, 11)) + +declare let b: PromiseLike | PromiseLike; +>b : Symbol(b, Decl(awaitUnion_es5.ts, 1, 11)) +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) + +declare let c: PromiseLike; +>c : Symbol(c, Decl(awaitUnion_es5.ts, 2, 11)) +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) + +declare let d: number | PromiseLike; +>d : Symbol(d, Decl(awaitUnion_es5.ts, 3, 11)) +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) + +declare let e: number | PromiseLike; +>e : Symbol(e, Decl(awaitUnion_es5.ts, 4, 11)) +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) + +async function f() { +>f : Symbol(f, Decl(awaitUnion_es5.ts, 4, 53)) + + let await_a = await a; +>await_a : Symbol(await_a, Decl(awaitUnion_es5.ts, 6, 4)) +>a : Symbol(a, Decl(awaitUnion_es5.ts, 0, 11)) + + let await_b = await b; +>await_b : Symbol(await_b, Decl(awaitUnion_es5.ts, 7, 4)) +>b : Symbol(b, Decl(awaitUnion_es5.ts, 1, 11)) + + let await_c = await c; +>await_c : Symbol(await_c, Decl(awaitUnion_es5.ts, 8, 4)) +>c : Symbol(c, Decl(awaitUnion_es5.ts, 2, 11)) + + let await_d = await d; +>await_d : Symbol(await_d, Decl(awaitUnion_es5.ts, 9, 4)) +>d : Symbol(d, Decl(awaitUnion_es5.ts, 3, 11)) + + let await_e = await e; +>await_e : Symbol(await_e, Decl(awaitUnion_es5.ts, 10, 4)) +>e : Symbol(e, Decl(awaitUnion_es5.ts, 4, 11)) +} diff --git a/tests/baselines/reference/awaitUnion_es5(target=es5).types b/tests/baselines/reference/awaitUnion_es5(target=es5).types new file mode 100644 index 0000000000000..3a2e25736983f --- /dev/null +++ b/tests/baselines/reference/awaitUnion_es5(target=es5).types @@ -0,0 +1,67 @@ +//// [tests/cases/conformance/async/es5/awaitUnion_es5.ts] //// + +=== awaitUnion_es5.ts === +declare let a: number | string; +>a : string | number +> : ^^^^^^^^^^^^^^^ + +declare let b: PromiseLike | PromiseLike; +>b : PromiseLike | PromiseLike +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +declare let c: PromiseLike; +>c : PromiseLike +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +declare let d: number | PromiseLike; +>d : number | PromiseLike +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +declare let e: number | PromiseLike; +>e : number | PromiseLike +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +async function f() { +>f : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + + let await_a = await a; +>await_a : string | number +> : ^^^^^^^^^^^^^^^ +>await a : string | number +> : ^^^^^^^^^^^^^^^ +>a : string | number +> : ^^^^^^^^^^^^^^^ + + let await_b = await b; +>await_b : string | number +> : ^^^^^^^^^^^^^^^ +>await b : string | number +> : ^^^^^^^^^^^^^^^ +>b : PromiseLike | PromiseLike +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + let await_c = await c; +>await_c : string | number +> : ^^^^^^^^^^^^^^^ +>await c : string | number +> : ^^^^^^^^^^^^^^^ +>c : PromiseLike +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + let await_d = await d; +>await_d : string | number +> : ^^^^^^^^^^^^^^^ +>await d : string | number +> : ^^^^^^^^^^^^^^^ +>d : number | PromiseLike +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + let await_e = await e; +>await_e : string | number +> : ^^^^^^^^^^^^^^^ +>await e : string | number +> : ^^^^^^^^^^^^^^^ +>e : number | PromiseLike +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +} diff --git a/tests/baselines/reference/awaitedTypeNoLib.js b/tests/baselines/reference/awaitedTypeNoLib.js index 6a80032cd56da..7dfda44e80b23 100644 --- a/tests/baselines/reference/awaitedTypeNoLib.js +++ b/tests/baselines/reference/awaitedTypeNoLib.js @@ -29,16 +29,13 @@ class Thenable { } //// [awaitedTypeNoLib.js] -var Thenable = /** @class */ (function () { - function Thenable() { - } - Thenable.prototype.then = function (a) { }; - Thenable.prototype.handleResolve = function (result, resolve) { +class Thenable { + then(a) { } + handleResolve(result, resolve) { if (result instanceof Thenable) { // #58547 This previously was a Debug Failure. False expression: type provided should not be a non-generic 'promise'-like. this.resolvePromise(result, resolve); } - }; - Thenable.prototype.resolvePromise = function (result, resolve) { }; - return Thenable; -}()); + } + resolvePromise(result, resolve) { } +} diff --git a/tests/baselines/reference/badArraySyntax.js b/tests/baselines/reference/badArraySyntax.js index 41fac3d3d40ef..ccc5b6cca0660 100644 --- a/tests/baselines/reference/badArraySyntax.js +++ b/tests/baselines/reference/badArraySyntax.js @@ -14,12 +14,11 @@ var a6: Z[][] = new Z [ ] [ ]; //// [badArraySyntax.js] -var Z = /** @class */ (function () { - function Z() { +class Z { + constructor() { this.x = ""; } - return Z; -}()); +} var a1 = []; var a2 = new Z[]; var a3 = new Z[](); diff --git a/tests/baselines/reference/badInferenceLowerPriorityThanGoodInference.js b/tests/baselines/reference/badInferenceLowerPriorityThanGoodInference.js index 483914e932d5b..ef3170d82af99 100644 --- a/tests/baselines/reference/badInferenceLowerPriorityThanGoodInference.js +++ b/tests/baselines/reference/badInferenceLowerPriorityThanGoodInference.js @@ -27,12 +27,12 @@ goofus((a: string) => ({ dog: function() { return a; } })); //// [badInferenceLowerPriorityThanGoodInference.js] // Repro from #13118 -var result = canYouInferThis(function () { return ({ +const result = canYouInferThis(() => ({ a: { BLAH: 33 }, - b: function (x) { } -}); }); + b: 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; } }); }); +goofus((a) => ({ dog() { return a; } })); +goofus((a) => ({ dog: function () { return a; } })); diff --git a/tests/baselines/reference/badThisBinding.js b/tests/baselines/reference/badThisBinding.js index 1f7dcb83bf6a9..f0beced472622 100644 --- a/tests/baselines/reference/badThisBinding.js +++ b/tests/baselines/reference/badThisBinding.js @@ -16,14 +16,12 @@ class Greeter { } //// [badThisBinding.js] -var Greeter = /** @class */ (function () { - function Greeter() { - var _this = this; - foo(function () { - bar(function () { - var x = _this; +class Greeter { + constructor() { + foo(() => { + bar(() => { + var x = this; }); }); } - return Greeter; -}()); +} diff --git a/tests/baselines/reference/baseCheck.js b/tests/baselines/reference/baseCheck.js index 5299d685971d5..0dd2617e636eb 100644 --- a/tests/baselines/reference/baseCheck.js +++ b/tests/baselines/reference/baseCheck.js @@ -32,70 +32,40 @@ function f() { //// [baseCheck.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var C = /** @class */ (function () { - function C(x, y) { - } - return C; -}()); -var ELoc = /** @class */ (function (_super) { - __extends(ELoc, _super); - function ELoc(x) { - return _super.call(this, 0, x) || this; +class C { + constructor(x, y) { } +} +class ELoc extends C { + constructor(x) { + super(0, x); } - return ELoc; -}(C)); -var ELocVar = /** @class */ (function (_super) { - __extends(ELocVar, _super); - function ELocVar(x) { - return _super.call(this, 0, loc) || this; +} +class ELocVar extends C { + constructor(x) { + super(0, loc); } - ELocVar.prototype.m = function () { + m() { var loc = 10; - }; - return ELocVar; -}(C)); -var D = /** @class */ (function (_super) { - __extends(D, _super); - function D(z) { - var _this = _super.call(this, _this.z) || this; - _this.z = z; - return _this; } - return D; -}(C)); // too few params -var E = /** @class */ (function (_super) { - __extends(E, _super); - function E(z) { - var _this = _super.call(this, 0, _this.z) || this; - _this.z = z; - return _this; +} +class D extends C { + constructor(z) { + super(this.z); + this.z = z; + } +} // too few params +class E extends C { + constructor(z) { + super(0, this.z); + this.z = z; } - return E; -}(C)); -var F = /** @class */ (function (_super) { - __extends(F, _super); - function F(z) { - var _this = _super.call(this, "hello", _this.z) || this; - _this.z = z; - return _this; +} +class F extends C { + constructor(z) { + super("hello", this.z); + this.z = z; } - return F; -}(C)); // first param type +} // first param type function f() { if (x < 10) { x = 11; diff --git a/tests/baselines/reference/baseClassImprovedMismatchErrors.js b/tests/baselines/reference/baseClassImprovedMismatchErrors.js index 6ce02320797a8..1515b02488de4 100644 --- a/tests/baselines/reference/baseClassImprovedMismatchErrors.js +++ b/tests/baselines/reference/baseClassImprovedMismatchErrors.js @@ -21,44 +21,18 @@ class DerivedInterface implements Base { } //// [baseClassImprovedMismatchErrors.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var Base = /** @class */ (function () { - function Base() { - } - Base.prototype.fn = function () { +class Base { + fn() { return 10; - }; - return Base; -}()); -var Derived = /** @class */ (function (_super) { - __extends(Derived, _super); - function Derived() { - return _super !== null && _super.apply(this, arguments) || this; } - Derived.prototype.fn = function () { +} +class Derived extends Base { + fn() { return 10; - }; - return Derived; -}(Base)); -var DerivedInterface = /** @class */ (function () { - function DerivedInterface() { } - DerivedInterface.prototype.fn = function () { +} +class DerivedInterface { + fn() { return 10; - }; - return DerivedInterface; -}()); + } +} diff --git a/tests/baselines/reference/baseConstraintOfDecorator.js b/tests/baselines/reference/baseConstraintOfDecorator.js index 48a2eec64ff83..499398a9f14bc 100644 --- a/tests/baselines/reference/baseConstraintOfDecorator.js +++ b/tests/baselines/reference/baseConstraintOfDecorator.js @@ -22,57 +22,21 @@ export function classExtender2 MyCl //// [baseConstraintOfDecorator.js] -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.classExtender = classExtender; -exports.classExtender2 = classExtender2; -function classExtender(superClass, _instanceModifier) { - return /** @class */ (function (_super) { - __extends(decoratorFunc, _super); - function decoratorFunc() { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - var _this = _super.apply(this, args) || this; - _instanceModifier(_this, args); - return _this; +export function classExtender(superClass, _instanceModifier) { + return class decoratorFunc extends superClass { + constructor(...args) { + super(...args); + _instanceModifier(this, args); } - return decoratorFunc; - }(superClass)); + }; } -var MyClass = /** @class */ (function () { - function MyClass() { - } - return MyClass; -}()); -function classExtender2(superClass, _instanceModifier) { - return /** @class */ (function (_super) { - __extends(decoratorFunc, _super); - function decoratorFunc() { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - var _this = _super.apply(this, args) || this; - _instanceModifier(_this, args); - return _this; +class MyClass { +} +export function classExtender2(superClass, _instanceModifier) { + return class decoratorFunc extends superClass { + constructor(...args) { + super(...args); + _instanceModifier(this, args); } - return decoratorFunc; - }(superClass)); + }; } diff --git a/tests/baselines/reference/baseExpressionTypeParameters.js b/tests/baselines/reference/baseExpressionTypeParameters.js index f8959445f1c2d..8fd5a020125f0 100644 --- a/tests/baselines/reference/baseExpressionTypeParameters.js +++ b/tests/baselines/reference/baseExpressionTypeParameters.js @@ -17,41 +17,13 @@ class Spec extends Gen {} //// [baseExpressionTypeParameters.js] // Repro from #17829 -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); function base() { - var Base = /** @class */ (function () { - function Base() { - } - return Base; - }()); + class Base { + } return Base; } -var Gen = /** @class */ (function (_super) { - __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); - function Spec() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Spec; -}(Gen)); +class Gen extends base() { +} // Error, T not in scope +class Spec extends Gen { +} Spec.prop; diff --git a/tests/baselines/reference/baseIndexSignatureResolution.js b/tests/baselines/reference/baseIndexSignatureResolution.js index a03ad13610d3a..998c578d75e39 100644 --- a/tests/baselines/reference/baseIndexSignatureResolution.js +++ b/tests/baselines/reference/baseIndexSignatureResolution.js @@ -27,33 +27,10 @@ var z: Derived = b.foo(); */ //// [baseIndexSignatureResolution.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var Base = /** @class */ (function () { - function Base() { - } - return Base; -}()); -var Derived = /** @class */ (function (_super) { - __extends(Derived, _super); - function Derived() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Derived; -}(Base)); +class Base { +} +class Derived extends Base { +} var x = null; var y = x[0]; /* diff --git a/tests/baselines/reference/baseTypeAfterDerivedType.js b/tests/baselines/reference/baseTypeAfterDerivedType.js index 133fd2596abf5..90af33747af66 100644 --- a/tests/baselines/reference/baseTypeAfterDerivedType.js +++ b/tests/baselines/reference/baseTypeAfterDerivedType.js @@ -19,14 +19,6 @@ interface Base2 { //// [baseTypeAfterDerivedType.js] -var Derived2 = /** @class */ (function () { - function Derived2() { - } - Derived2.prototype.method = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - }; - return Derived2; -}()); +class Derived2 { + method(...args) { } +} diff --git a/tests/baselines/reference/baseTypeOrderChecking.js b/tests/baselines/reference/baseTypeOrderChecking.js index 00abe8514d64b..b70e156b434b0 100644 --- a/tests/baselines/reference/baseTypeOrderChecking.js +++ b/tests/baselines/reference/baseTypeOrderChecking.js @@ -39,43 +39,12 @@ class Class4 extends Class3 //// [baseTypeOrderChecking.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); var someVariable; -var Class1 = /** @class */ (function () { - function Class1() { - } - return Class1; -}()); -var Class2 = /** @class */ (function (_super) { - __extends(Class2, _super); - function Class2() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Class2; -}(Class1)); -var Class3 = /** @class */ (function () { - function Class3() { - } - return Class3; -}()); -var Class4 = /** @class */ (function (_super) { - __extends(Class4, _super); - function Class4() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Class4; -}(Class3)); +class Class1 { +} +class Class2 extends Class1 { +} +class Class3 { +} +class Class4 extends Class3 { +} diff --git a/tests/baselines/reference/baseTypePrivateMemberClash.js b/tests/baselines/reference/baseTypePrivateMemberClash.js index b2f1be7840f3b..a0b86f1ee94fd 100644 --- a/tests/baselines/reference/baseTypePrivateMemberClash.js +++ b/tests/baselines/reference/baseTypePrivateMemberClash.js @@ -11,13 +11,7 @@ class Y { interface Z extends X, Y { } //// [baseTypePrivateMemberClash.js] -var X = /** @class */ (function () { - function X() { - } - return X; -}()); -var Y = /** @class */ (function () { - function Y() { - } - return Y; -}()); +class X { +} +class Y { +} diff --git a/tests/baselines/reference/baseTypeWrappingInstantiationChain.js b/tests/baselines/reference/baseTypeWrappingInstantiationChain.js index b891dadaa8dc5..6dfb6b7bba3bb 100644 --- a/tests/baselines/reference/baseTypeWrappingInstantiationChain.js +++ b/tests/baselines/reference/baseTypeWrappingInstantiationChain.js @@ -30,55 +30,22 @@ class C extends CBase { //// [baseTypeWrappingInstantiationChain.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var CBaseBase = /** @class */ (function () { - function CBaseBase(x) { - } - return CBaseBase; -}()); -var CBase = /** @class */ (function (_super) { - __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) { }; - return Parameter; -}()); -var Wrapper = /** @class */ (function () { - function Wrapper() { - } - return Wrapper; -}()); -var C = /** @class */ (function (_super) { - __extends(C, _super); - function C() { - return _super !== null && _super.apply(this, arguments) || this; - } - C.prototype.works = function () { +class CBaseBase { + constructor(x) { } +} +class CBase extends CBaseBase { +} +class Parameter { + method(t) { } +} +class Wrapper { +} +class C extends CBase { + works() { new CBaseBase(this); - }; - C.prototype.alsoWorks = function () { + } + alsoWorks() { new CBase(this); // Should not error, parameter is of type Parameter> - }; - C.prototype.method = function (t) { }; - return C; -}(CBase)); + } + method(t) { } +} diff --git a/tests/baselines/reference/bases.js b/tests/baselines/reference/bases.js index 96f8aaca36b55..d3719591b70df 100644 --- a/tests/baselines/reference/bases.js +++ b/tests/baselines/reference/bases.js @@ -23,37 +23,17 @@ new C().y; //// [bases.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var B = /** @class */ (function () { - function B() { +class B { + constructor() { this.y; any; } - return B; -}()); -var C = /** @class */ (function (_super) { - __extends(C, _super); - function C() { - var _this = this; - _this.x; +} +class C extends B { + constructor() { + this.x; any; - return _this; } - return C; -}(B)); +} new C().x; new C().y; diff --git a/tests/baselines/reference/bestChoiceType.js b/tests/baselines/reference/bestChoiceType.js index 39ec75f58309b..1547706c7d8ed 100644 --- a/tests/baselines/reference/bestChoiceType.js +++ b/tests/baselines/reference/bestChoiceType.js @@ -22,15 +22,15 @@ function f2() { //// [bestChoiceType.js] // Repro from #10041 -(''.match(/ /) || []).map(function (s) { return s.toLowerCase(); }); +(''.match(/ /) || []).map(s => s.toLowerCase()); // Similar cases function f1() { - var x = ''.match(/ /); - var y = x || []; - var z = y.map(function (s) { return s.toLowerCase(); }); + let x = ''.match(/ /); + let y = x || []; + let z = y.map(s => s.toLowerCase()); } function f2() { - var x = ''.match(/ /); - var y = x ? x : []; - var z = y.map(function (s) { return s.toLowerCase(); }); + let x = ''.match(/ /); + let y = x ? x : []; + let z = y.map(s => s.toLowerCase()); } diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js index d62c0769bfb25..dc8466a6e93fa 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js @@ -31,42 +31,14 @@ function foo5(t: T, u: U): Object { //// [bestCommonTypeOfConditionalExpressions.js] // conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist) // no errors expected here -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); var a; var b; -var Base = /** @class */ (function () { - function Base() { - } - return Base; -}()); -var Derived = /** @class */ (function (_super) { - __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() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Derived2; -}(Base)); +class Base { +} +class Derived extends Base { +} +class Derived2 extends Base { +} var base; var derived; var derived2; @@ -74,9 +46,9 @@ var r = true ? 1 : 2; var r3 = true ? 1 : {}; var r4 = true ? a : b; // typeof a var r5 = true ? b : a; // typeof b -var r6 = true ? function (x) { } : function (x) { }; // returns number => void -var r7 = true ? function (x) { } : function (x) { }; -var r8 = true ? function (x) { } : function (x) { }; // returns Object => void +var r6 = true ? (x) => { } : (x) => { }; // returns number => void +var r7 = true ? (x) => { } : (x) => { }; +var r8 = true ? (x) => { } : (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) { diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js index f25d2bb5d6f2f..b3e4c8f21fd4d 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js @@ -29,40 +29,12 @@ function foo3(t: T, u: U) { //// [bestCommonTypeOfConditionalExpressions2.js] // conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist) // these are errors -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var Base = /** @class */ (function () { - function Base() { - } - return Base; -}()); -var Derived = /** @class */ (function (_super) { - __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() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Derived2; -}(Base)); +class Base { +} +class Derived extends Base { +} +class Derived2 extends Base { +} var base; var derived; var derived2; diff --git a/tests/baselines/reference/bestCommonTypeOfTuple2.js b/tests/baselines/reference/bestCommonTypeOfTuple2.js index 2c4fa73218404..754939a8aedd9 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple2.js +++ b/tests/baselines/reference/bestCommonTypeOfTuple2.js @@ -25,58 +25,25 @@ var e51 = t5[2]; // {} //// [bestCommonTypeOfTuple2.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var C = /** @class */ (function () { - function C() { - } - return C; -}()); -var D = /** @class */ (function () { - function D() { - } - return D; -}()); -var E = /** @class */ (function () { - function E() { - } - return E; -}()); -var F = /** @class */ (function (_super) { - __extends(F, _super); - function F() { - return _super !== null && _super.apply(this, arguments) || this; - } - return F; -}(C)); -var C1 = /** @class */ (function () { - function C1() { +class C { +} +class D { +} +class E { +} +class F extends C { +} +class C1 { + constructor() { this.i = "foo"; } - return C1; -}()); -var D1 = /** @class */ (function (_super) { - __extends(D1, _super); - function D1() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.i = "bar"; - return _this; +} +class D1 extends C1 { + constructor() { + super(...arguments); + this.i = "bar"; } - return D1; -}(C1)); +} var e11 = t1[4]; // base var e21 = t2[4]; // {} var e31 = t3[4]; // C1 diff --git a/tests/baselines/reference/bigintAmbientMinimal.errors.txt b/tests/baselines/reference/bigintAmbientMinimal(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/bigintAmbientMinimal.errors.txt rename to tests/baselines/reference/bigintAmbientMinimal(target=es2015).errors.txt diff --git a/tests/baselines/reference/bigintAmbientMinimal(target=es2015).js b/tests/baselines/reference/bigintAmbientMinimal(target=es2015).js new file mode 100644 index 0000000000000..a6d12b6f3c193 --- /dev/null +++ b/tests/baselines/reference/bigintAmbientMinimal(target=es2015).js @@ -0,0 +1,18 @@ +//// [tests/cases/compiler/bigintAmbientMinimal.ts] //// + +//// [ambient.d.ts] +declare const fromDts = 789n; +declare namespace Lib { + const value = 999n; +} + +//// [main.ts] +// Minimal repro from issue +declare const n = 123n; + +// Non-ambient for comparison +const regular = 456n; + +//// [main.js] +// Non-ambient for comparison +const regular = 456n; diff --git a/tests/baselines/reference/bigintAmbientMinimal.symbols b/tests/baselines/reference/bigintAmbientMinimal(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/bigintAmbientMinimal.symbols rename to tests/baselines/reference/bigintAmbientMinimal(target=es2015).symbols diff --git a/tests/baselines/reference/bigintAmbientMinimal.types b/tests/baselines/reference/bigintAmbientMinimal(target=es2015).types similarity index 100% rename from tests/baselines/reference/bigintAmbientMinimal.types rename to tests/baselines/reference/bigintAmbientMinimal(target=es2015).types diff --git a/tests/baselines/reference/bigintAmbientMinimal(target=es5).errors.txt b/tests/baselines/reference/bigintAmbientMinimal(target=es5).errors.txt new file mode 100644 index 0000000000000..e95b511da01dd --- /dev/null +++ b/tests/baselines/reference/bigintAmbientMinimal(target=es5).errors.txt @@ -0,0 +1,17 @@ +/main.ts(5,17): error TS2737: BigInt literals are not available when targeting lower than ES2020. + + +==== /ambient.d.ts (0 errors) ==== + declare const fromDts = 789n; + declare namespace Lib { + const value = 999n; + } + +==== /main.ts (1 errors) ==== + // Minimal repro from issue + declare const n = 123n; + + // Non-ambient for comparison + const regular = 456n; + ~~~~ +!!! error TS2737: BigInt literals are not available when targeting lower than ES2020. \ No newline at end of file diff --git a/tests/baselines/reference/bigintAmbientMinimal.js b/tests/baselines/reference/bigintAmbientMinimal(target=es5).js similarity index 100% rename from tests/baselines/reference/bigintAmbientMinimal.js rename to tests/baselines/reference/bigintAmbientMinimal(target=es5).js diff --git a/tests/baselines/reference/bigintAmbientMinimal(target=es5).symbols b/tests/baselines/reference/bigintAmbientMinimal(target=es5).symbols new file mode 100644 index 0000000000000..d438ba1235958 --- /dev/null +++ b/tests/baselines/reference/bigintAmbientMinimal(target=es5).symbols @@ -0,0 +1,22 @@ +//// [tests/cases/compiler/bigintAmbientMinimal.ts] //// + +=== /ambient.d.ts === +declare const fromDts = 789n; +>fromDts : Symbol(fromDts, Decl(ambient.d.ts, 0, 13)) + +declare namespace Lib { +>Lib : Symbol(Lib, Decl(ambient.d.ts, 0, 29)) + + const value = 999n; +>value : Symbol(value, Decl(ambient.d.ts, 2, 9)) +} + +=== /main.ts === +// Minimal repro from issue +declare const n = 123n; +>n : Symbol(n, Decl(main.ts, 1, 13)) + +// Non-ambient for comparison +const regular = 456n; +>regular : Symbol(regular, Decl(main.ts, 4, 5)) + diff --git a/tests/baselines/reference/bigintAmbientMinimal(target=es5).types b/tests/baselines/reference/bigintAmbientMinimal(target=es5).types new file mode 100644 index 0000000000000..086ac1d5676be --- /dev/null +++ b/tests/baselines/reference/bigintAmbientMinimal(target=es5).types @@ -0,0 +1,35 @@ +//// [tests/cases/compiler/bigintAmbientMinimal.ts] //// + +=== /ambient.d.ts === +declare const fromDts = 789n; +>fromDts : 789n +> : ^^^^ +>789n : 789n +> : ^^^^ + +declare namespace Lib { +>Lib : typeof Lib +> : ^^^^^^^^^^ + + const value = 999n; +>value : 999n +> : ^^^^ +>999n : 999n +> : ^^^^ +} + +=== /main.ts === +// Minimal repro from issue +declare const n = 123n; +>n : 123n +> : ^^^^ +>123n : 123n +> : ^^^^ + +// Non-ambient for comparison +const regular = 456n; +>regular : 456n +> : ^^^^ +>456n : 456n +> : ^^^^ + diff --git a/tests/baselines/reference/bigintWithoutLib.errors.txt b/tests/baselines/reference/bigintWithoutLib(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/bigintWithoutLib.errors.txt rename to tests/baselines/reference/bigintWithoutLib(target=es2015).errors.txt diff --git a/tests/baselines/reference/bigintWithoutLib(target=es2015).js b/tests/baselines/reference/bigintWithoutLib(target=es2015).js new file mode 100644 index 0000000000000..26275b255769f --- /dev/null +++ b/tests/baselines/reference/bigintWithoutLib(target=es2015).js @@ -0,0 +1,113 @@ +//// [tests/cases/compiler/bigintWithoutLib.ts] //// + +//// [bigintWithoutLib.ts] +// Every line should error because these builtins are not declared + +// Test BigInt functions +let bigintVal: bigint = BigInt(123); +bigintVal = BigInt("456"); +new BigInt(123); +bigintVal = BigInt.asIntN(8, 0xFFFFn); +bigintVal = BigInt.asUintN(8, 0xFFFFn); +bigintVal = bigintVal.valueOf(); // should error - bigintVal inferred as {} +let stringVal: string = bigintVal.toString(); // should not error - bigintVal inferred as {} +stringVal = bigintVal.toString(2); // should error - bigintVal inferred as {} +stringVal = bigintVal.toLocaleString(); // should not error - bigintVal inferred as {} +stringVal = bigintVal.toLocaleString('de-DE'); // should not error - bigintVal inferred as {} +stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should not error - bigintVal inferred as {} +stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) // should not error - bigintVal inferred as {} + +// Test BigInt64Array +let bigIntArray: BigInt64Array = new BigInt64Array(); +bigIntArray = new BigInt64Array(10); +bigIntArray = new BigInt64Array([1n, 2n, 3n]); +bigIntArray = new BigInt64Array([1, 2, 3]); +bigIntArray = new BigInt64Array(new ArrayBuffer(80)); +bigIntArray = new BigInt64Array(new ArrayBuffer(80), 8); +bigIntArray = new BigInt64Array(new ArrayBuffer(80), 8, 3); +let len: number = bigIntArray.length; +bigIntArray.length = 10; +let arrayBufferLike: ArrayBufferView = bigIntArray; + +// Test BigUint64Array +let bigUintArray: BigUint64Array = new BigUint64Array(); +bigUintArray = new BigUint64Array(10); +bigUintArray = new BigUint64Array([1n, 2n, 3n]); +bigUintArray = new BigUint64Array([1, 2, 3]); +bigUintArray = new BigUint64Array(new ArrayBuffer(80)); +bigUintArray = new BigUint64Array(new ArrayBuffer(80), 8); +bigUintArray = new BigUint64Array(new ArrayBuffer(80), 8, 3); +len = bigIntArray.length; +bigIntArray.length = 10; +arrayBufferLike = bigIntArray; + +// Test added DataView methods +const dataView = new DataView(new ArrayBuffer(80)); +dataView.setBigInt64(1, -1n); +dataView.setBigInt64(1, -1n, true); +dataView.setBigInt64(1, -1); +dataView.setBigUint64(2, 123n); +dataView.setBigUint64(2, 123n, true); +dataView.setBigUint64(2, 123); +bigintVal = dataView.getBigInt64(1); +bigintVal = dataView.getBigInt64(1, true); +bigintVal = dataView.getBigUint64(2); +bigintVal = dataView.getBigUint64(2, true); + +// Test Intl methods with new parameter type +new Intl.NumberFormat("fr").format(3000n); +new Intl.NumberFormat("fr").format(bigintVal); + + +//// [bigintWithoutLib.js] +// Every line should error because these builtins are not declared +// Test BigInt functions +let bigintVal = BigInt(123); +bigintVal = BigInt("456"); +new BigInt(123); +bigintVal = BigInt.asIntN(8, 0xffffn); +bigintVal = BigInt.asUintN(8, 0xffffn); +bigintVal = bigintVal.valueOf(); // should error - bigintVal inferred as {} +let stringVal = bigintVal.toString(); // should not error - bigintVal inferred as {} +stringVal = bigintVal.toString(2); // should error - bigintVal inferred as {} +stringVal = bigintVal.toLocaleString(); // should not error - bigintVal inferred as {} +stringVal = bigintVal.toLocaleString('de-DE'); // should not error - bigintVal inferred as {} +stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should not error - bigintVal inferred as {} +stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }); // should not error - bigintVal inferred as {} +// Test BigInt64Array +let bigIntArray = new BigInt64Array(); +bigIntArray = new BigInt64Array(10); +bigIntArray = new BigInt64Array([1n, 2n, 3n]); +bigIntArray = new BigInt64Array([1, 2, 3]); +bigIntArray = new BigInt64Array(new ArrayBuffer(80)); +bigIntArray = new BigInt64Array(new ArrayBuffer(80), 8); +bigIntArray = new BigInt64Array(new ArrayBuffer(80), 8, 3); +let len = bigIntArray.length; +bigIntArray.length = 10; +let arrayBufferLike = bigIntArray; +// Test BigUint64Array +let bigUintArray = new BigUint64Array(); +bigUintArray = new BigUint64Array(10); +bigUintArray = new BigUint64Array([1n, 2n, 3n]); +bigUintArray = new BigUint64Array([1, 2, 3]); +bigUintArray = new BigUint64Array(new ArrayBuffer(80)); +bigUintArray = new BigUint64Array(new ArrayBuffer(80), 8); +bigUintArray = new BigUint64Array(new ArrayBuffer(80), 8, 3); +len = bigIntArray.length; +bigIntArray.length = 10; +arrayBufferLike = bigIntArray; +// Test added DataView methods +const dataView = new DataView(new ArrayBuffer(80)); +dataView.setBigInt64(1, -1n); +dataView.setBigInt64(1, -1n, true); +dataView.setBigInt64(1, -1); +dataView.setBigUint64(2, 123n); +dataView.setBigUint64(2, 123n, true); +dataView.setBigUint64(2, 123); +bigintVal = dataView.getBigInt64(1); +bigintVal = dataView.getBigInt64(1, true); +bigintVal = dataView.getBigUint64(2); +bigintVal = dataView.getBigUint64(2, true); +// Test Intl methods with new parameter type +new Intl.NumberFormat("fr").format(3000n); +new Intl.NumberFormat("fr").format(bigintVal); diff --git a/tests/baselines/reference/bigintWithoutLib.symbols b/tests/baselines/reference/bigintWithoutLib(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/bigintWithoutLib.symbols rename to tests/baselines/reference/bigintWithoutLib(target=es2015).symbols diff --git a/tests/baselines/reference/bigintWithoutLib.types b/tests/baselines/reference/bigintWithoutLib(target=es2015).types similarity index 100% rename from tests/baselines/reference/bigintWithoutLib.types rename to tests/baselines/reference/bigintWithoutLib(target=es2015).types diff --git a/tests/baselines/reference/bigintWithoutLib(target=es5).errors.txt b/tests/baselines/reference/bigintWithoutLib(target=es5).errors.txt new file mode 100644 index 0000000000000..cb1d1688127e9 --- /dev/null +++ b/tests/baselines/reference/bigintWithoutLib(target=es5).errors.txt @@ -0,0 +1,213 @@ +bigintWithoutLib.ts(4,25): error TS2583: Cannot find name 'BigInt'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(5,13): error TS2583: Cannot find name 'BigInt'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(6,5): error TS2583: Cannot find name 'BigInt'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(7,13): error TS2583: Cannot find name 'BigInt'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(7,30): error TS2737: BigInt literals are not available when targeting lower than ES2020. +bigintWithoutLib.ts(8,13): error TS2583: Cannot find name 'BigInt'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(8,31): error TS2737: BigInt literals are not available when targeting lower than ES2020. +bigintWithoutLib.ts(9,1): error TS2322: Type 'Object' is not assignable to type 'bigint'. +bigintWithoutLib.ts(11,32): error TS2554: Expected 0 arguments, but got 1. +bigintWithoutLib.ts(13,38): error TS2554: Expected 0 arguments, but got 1. +bigintWithoutLib.ts(14,38): error TS2554: Expected 0 arguments, but got 2. +bigintWithoutLib.ts(15,38): error TS2554: Expected 0 arguments, but got 2. +bigintWithoutLib.ts(18,18): error TS2583: Cannot find name 'BigInt64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(18,38): error TS2583: Cannot find name 'BigInt64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(19,19): error TS2583: Cannot find name 'BigInt64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(20,19): error TS2583: Cannot find name 'BigInt64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(20,34): error TS2737: BigInt literals are not available when targeting lower than ES2020. +bigintWithoutLib.ts(20,38): error TS2737: BigInt literals are not available when targeting lower than ES2020. +bigintWithoutLib.ts(20,42): error TS2737: BigInt literals are not available when targeting lower than ES2020. +bigintWithoutLib.ts(21,19): error TS2583: Cannot find name 'BigInt64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(22,19): error TS2583: Cannot find name 'BigInt64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(23,19): error TS2583: Cannot find name 'BigInt64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(24,19): error TS2583: Cannot find name 'BigInt64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(30,19): error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(30,40): error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(31,20): error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(32,20): error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(32,36): error TS2737: BigInt literals are not available when targeting lower than ES2020. +bigintWithoutLib.ts(32,40): error TS2737: BigInt literals are not available when targeting lower than ES2020. +bigintWithoutLib.ts(32,44): error TS2737: BigInt literals are not available when targeting lower than ES2020. +bigintWithoutLib.ts(33,20): error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(34,20): error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(35,20): error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(36,20): error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(43,10): error TS2550: Property 'setBigInt64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(43,26): error TS2737: BigInt literals are not available when targeting lower than ES2020. +bigintWithoutLib.ts(44,10): error TS2550: Property 'setBigInt64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(44,26): error TS2737: BigInt literals are not available when targeting lower than ES2020. +bigintWithoutLib.ts(45,10): error TS2550: Property 'setBigInt64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(46,10): error TS2550: Property 'setBigUint64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(46,26): error TS2737: BigInt literals are not available when targeting lower than ES2020. +bigintWithoutLib.ts(47,10): error TS2550: Property 'setBigUint64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(47,26): error TS2737: BigInt literals are not available when targeting lower than ES2020. +bigintWithoutLib.ts(48,10): error TS2550: Property 'setBigUint64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(49,22): error TS2550: Property 'getBigInt64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(50,22): error TS2550: Property 'getBigInt64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(51,22): error TS2550: Property 'getBigUint64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(52,22): error TS2550: Property 'getBigUint64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +bigintWithoutLib.ts(55,36): error TS2345: Argument of type 'bigint' is not assignable to parameter of type 'number'. +bigintWithoutLib.ts(55,36): error TS2737: BigInt literals are not available when targeting lower than ES2020. +bigintWithoutLib.ts(56,36): error TS2345: Argument of type 'bigint' is not assignable to parameter of type 'number'. + + +==== bigintWithoutLib.ts (51 errors) ==== + // Every line should error because these builtins are not declared + + // Test BigInt functions + let bigintVal: bigint = BigInt(123); + ~~~~~~ +!!! error TS2583: Cannot find name 'BigInt'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + bigintVal = BigInt("456"); + ~~~~~~ +!!! error TS2583: Cannot find name 'BigInt'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + new BigInt(123); + ~~~~~~ +!!! error TS2583: Cannot find name 'BigInt'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + bigintVal = BigInt.asIntN(8, 0xFFFFn); + ~~~~~~ +!!! error TS2583: Cannot find name 'BigInt'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + ~~~~~~~ +!!! error TS2737: BigInt literals are not available when targeting lower than ES2020. + bigintVal = BigInt.asUintN(8, 0xFFFFn); + ~~~~~~ +!!! error TS2583: Cannot find name 'BigInt'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + ~~~~~~~ +!!! error TS2737: BigInt literals are not available when targeting lower than ES2020. + bigintVal = bigintVal.valueOf(); // should error - bigintVal inferred as {} + ~~~~~~~~~ +!!! error TS2322: Type 'Object' is not assignable to type 'bigint'. + let stringVal: string = bigintVal.toString(); // should not error - bigintVal inferred as {} + stringVal = bigintVal.toString(2); // should error - bigintVal inferred as {} + ~ +!!! error TS2554: Expected 0 arguments, but got 1. + stringVal = bigintVal.toLocaleString(); // should not error - bigintVal inferred as {} + stringVal = bigintVal.toLocaleString('de-DE'); // should not error - bigintVal inferred as {} + ~~~~~~~ +!!! error TS2554: Expected 0 arguments, but got 1. + stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should not error - bigintVal inferred as {} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2554: Expected 0 arguments, but got 2. + stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) // should not error - bigintVal inferred as {} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2554: Expected 0 arguments, but got 2. + + // Test BigInt64Array + let bigIntArray: BigInt64Array = new BigInt64Array(); + ~~~~~~~~~~~~~ +!!! error TS2583: Cannot find name 'BigInt64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + ~~~~~~~~~~~~~ +!!! error TS2583: Cannot find name 'BigInt64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + bigIntArray = new BigInt64Array(10); + ~~~~~~~~~~~~~ +!!! error TS2583: Cannot find name 'BigInt64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + bigIntArray = new BigInt64Array([1n, 2n, 3n]); + ~~~~~~~~~~~~~ +!!! error TS2583: Cannot find name 'BigInt64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + ~~ +!!! error TS2737: BigInt literals are not available when targeting lower than ES2020. + ~~ +!!! error TS2737: BigInt literals are not available when targeting lower than ES2020. + ~~ +!!! error TS2737: BigInt literals are not available when targeting lower than ES2020. + bigIntArray = new BigInt64Array([1, 2, 3]); + ~~~~~~~~~~~~~ +!!! error TS2583: Cannot find name 'BigInt64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + bigIntArray = new BigInt64Array(new ArrayBuffer(80)); + ~~~~~~~~~~~~~ +!!! error TS2583: Cannot find name 'BigInt64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + bigIntArray = new BigInt64Array(new ArrayBuffer(80), 8); + ~~~~~~~~~~~~~ +!!! error TS2583: Cannot find name 'BigInt64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + bigIntArray = new BigInt64Array(new ArrayBuffer(80), 8, 3); + ~~~~~~~~~~~~~ +!!! error TS2583: Cannot find name 'BigInt64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + let len: number = bigIntArray.length; + bigIntArray.length = 10; + let arrayBufferLike: ArrayBufferView = bigIntArray; + + // Test BigUint64Array + let bigUintArray: BigUint64Array = new BigUint64Array(); + ~~~~~~~~~~~~~~ +!!! error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + ~~~~~~~~~~~~~~ +!!! error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + bigUintArray = new BigUint64Array(10); + ~~~~~~~~~~~~~~ +!!! error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + bigUintArray = new BigUint64Array([1n, 2n, 3n]); + ~~~~~~~~~~~~~~ +!!! error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + ~~ +!!! error TS2737: BigInt literals are not available when targeting lower than ES2020. + ~~ +!!! error TS2737: BigInt literals are not available when targeting lower than ES2020. + ~~ +!!! error TS2737: BigInt literals are not available when targeting lower than ES2020. + bigUintArray = new BigUint64Array([1, 2, 3]); + ~~~~~~~~~~~~~~ +!!! error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + bigUintArray = new BigUint64Array(new ArrayBuffer(80)); + ~~~~~~~~~~~~~~ +!!! error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + bigUintArray = new BigUint64Array(new ArrayBuffer(80), 8); + ~~~~~~~~~~~~~~ +!!! error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + bigUintArray = new BigUint64Array(new ArrayBuffer(80), 8, 3); + ~~~~~~~~~~~~~~ +!!! error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + len = bigIntArray.length; + bigIntArray.length = 10; + arrayBufferLike = bigIntArray; + + // Test added DataView methods + const dataView = new DataView(new ArrayBuffer(80)); + dataView.setBigInt64(1, -1n); + ~~~~~~~~~~~ +!!! error TS2550: Property 'setBigInt64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + ~~ +!!! error TS2737: BigInt literals are not available when targeting lower than ES2020. + dataView.setBigInt64(1, -1n, true); + ~~~~~~~~~~~ +!!! error TS2550: Property 'setBigInt64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + ~~ +!!! error TS2737: BigInt literals are not available when targeting lower than ES2020. + dataView.setBigInt64(1, -1); + ~~~~~~~~~~~ +!!! error TS2550: Property 'setBigInt64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + dataView.setBigUint64(2, 123n); + ~~~~~~~~~~~~ +!!! error TS2550: Property 'setBigUint64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + ~~~~ +!!! error TS2737: BigInt literals are not available when targeting lower than ES2020. + dataView.setBigUint64(2, 123n, true); + ~~~~~~~~~~~~ +!!! error TS2550: Property 'setBigUint64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + ~~~~ +!!! error TS2737: BigInt literals are not available when targeting lower than ES2020. + dataView.setBigUint64(2, 123); + ~~~~~~~~~~~~ +!!! error TS2550: Property 'setBigUint64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + bigintVal = dataView.getBigInt64(1); + ~~~~~~~~~~~ +!!! error TS2550: Property 'getBigInt64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + bigintVal = dataView.getBigInt64(1, true); + ~~~~~~~~~~~ +!!! error TS2550: Property 'getBigInt64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + bigintVal = dataView.getBigUint64(2); + ~~~~~~~~~~~~ +!!! error TS2550: Property 'getBigUint64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + bigintVal = dataView.getBigUint64(2, true); + ~~~~~~~~~~~~ +!!! error TS2550: Property 'getBigUint64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. + + // Test Intl methods with new parameter type + new Intl.NumberFormat("fr").format(3000n); + ~~~~~ +!!! error TS2345: Argument of type 'bigint' is not assignable to parameter of type 'number'. + ~~~~~ +!!! error TS2737: BigInt literals are not available when targeting lower than ES2020. + new Intl.NumberFormat("fr").format(bigintVal); + ~~~~~~~~~ +!!! error TS2345: Argument of type 'bigint' is not assignable to parameter of type 'number'. + \ No newline at end of file diff --git a/tests/baselines/reference/bigintWithoutLib.js b/tests/baselines/reference/bigintWithoutLib(target=es5).js similarity index 100% rename from tests/baselines/reference/bigintWithoutLib.js rename to tests/baselines/reference/bigintWithoutLib(target=es5).js diff --git a/tests/baselines/reference/bigintWithoutLib(target=es5).symbols b/tests/baselines/reference/bigintWithoutLib(target=es5).symbols new file mode 100644 index 0000000000000..2eb233dc8328a --- /dev/null +++ b/tests/baselines/reference/bigintWithoutLib(target=es5).symbols @@ -0,0 +1,195 @@ +//// [tests/cases/compiler/bigintWithoutLib.ts] //// + +=== bigintWithoutLib.ts === +// Every line should error because these builtins are not declared + +// Test BigInt functions +let bigintVal: bigint = BigInt(123); +>bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3)) + +bigintVal = BigInt("456"); +>bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3)) + +new BigInt(123); +bigintVal = BigInt.asIntN(8, 0xFFFFn); +>bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3)) + +bigintVal = BigInt.asUintN(8, 0xFFFFn); +>bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3)) + +bigintVal = bigintVal.valueOf(); // should error - bigintVal inferred as {} +>bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3)) +>bigintVal.valueOf : Symbol(Object.valueOf, Decl(lib.es5.d.ts, --, --)) +>bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3)) +>valueOf : Symbol(Object.valueOf, Decl(lib.es5.d.ts, --, --)) + +let stringVal: string = bigintVal.toString(); // should not error - bigintVal inferred as {} +>stringVal : Symbol(stringVal, Decl(bigintWithoutLib.ts, 9, 3)) +>bigintVal.toString : Symbol(Object.toString, Decl(lib.es5.d.ts, --, --)) +>bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3)) +>toString : Symbol(Object.toString, Decl(lib.es5.d.ts, --, --)) + +stringVal = bigintVal.toString(2); // should error - bigintVal inferred as {} +>stringVal : Symbol(stringVal, Decl(bigintWithoutLib.ts, 9, 3)) +>bigintVal.toString : Symbol(Object.toString, Decl(lib.es5.d.ts, --, --)) +>bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3)) +>toString : Symbol(Object.toString, Decl(lib.es5.d.ts, --, --)) + +stringVal = bigintVal.toLocaleString(); // should not error - bigintVal inferred as {} +>stringVal : Symbol(stringVal, Decl(bigintWithoutLib.ts, 9, 3)) +>bigintVal.toLocaleString : Symbol(Object.toLocaleString, Decl(lib.es5.d.ts, --, --)) +>bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3)) +>toLocaleString : Symbol(Object.toLocaleString, Decl(lib.es5.d.ts, --, --)) + +stringVal = bigintVal.toLocaleString('de-DE'); // should not error - bigintVal inferred as {} +>stringVal : Symbol(stringVal, Decl(bigintWithoutLib.ts, 9, 3)) +>bigintVal.toLocaleString : Symbol(Object.toLocaleString, Decl(lib.es5.d.ts, --, --)) +>bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3)) +>toLocaleString : Symbol(Object.toLocaleString, Decl(lib.es5.d.ts, --, --)) + +stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should not error - bigintVal inferred as {} +>stringVal : Symbol(stringVal, Decl(bigintWithoutLib.ts, 9, 3)) +>bigintVal.toLocaleString : Symbol(Object.toLocaleString, Decl(lib.es5.d.ts, --, --)) +>bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3)) +>toLocaleString : Symbol(Object.toLocaleString, Decl(lib.es5.d.ts, --, --)) +>style : Symbol(style, Decl(bigintWithoutLib.ts, 13, 47)) + +stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) // should not error - bigintVal inferred as {} +>stringVal : Symbol(stringVal, Decl(bigintWithoutLib.ts, 9, 3)) +>bigintVal.toLocaleString : Symbol(Object.toLocaleString, Decl(lib.es5.d.ts, --, --)) +>bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3)) +>toLocaleString : Symbol(Object.toLocaleString, Decl(lib.es5.d.ts, --, --)) +>style : Symbol(style, Decl(bigintWithoutLib.ts, 14, 47)) +>currency : Symbol(currency, Decl(bigintWithoutLib.ts, 14, 66)) + +// Test BigInt64Array +let bigIntArray: BigInt64Array = new BigInt64Array(); +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3)) +>BigInt64Array : Symbol(BigInt64Array) + +bigIntArray = new BigInt64Array(10); +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3)) + +bigIntArray = new BigInt64Array([1n, 2n, 3n]); +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3)) + +bigIntArray = new BigInt64Array([1, 2, 3]); +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3)) + +bigIntArray = new BigInt64Array(new ArrayBuffer(80)); +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3)) +>ArrayBuffer : Symbol(ArrayBuffer, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +bigIntArray = new BigInt64Array(new ArrayBuffer(80), 8); +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3)) +>ArrayBuffer : Symbol(ArrayBuffer, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +bigIntArray = new BigInt64Array(new ArrayBuffer(80), 8, 3); +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3)) +>ArrayBuffer : Symbol(ArrayBuffer, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +let len: number = bigIntArray.length; +>len : Symbol(len, Decl(bigintWithoutLib.ts, 24, 3)) +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3)) + +bigIntArray.length = 10; +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3)) + +let arrayBufferLike: ArrayBufferView = bigIntArray; +>arrayBufferLike : Symbol(arrayBufferLike, Decl(bigintWithoutLib.ts, 26, 3)) +>ArrayBufferView : Symbol(ArrayBufferView, Decl(lib.es5.d.ts, --, --)) +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3)) + +// Test BigUint64Array +let bigUintArray: BigUint64Array = new BigUint64Array(); +>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 29, 3)) +>BigUint64Array : Symbol(BigUint64Array) + +bigUintArray = new BigUint64Array(10); +>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 29, 3)) + +bigUintArray = new BigUint64Array([1n, 2n, 3n]); +>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 29, 3)) + +bigUintArray = new BigUint64Array([1, 2, 3]); +>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 29, 3)) + +bigUintArray = new BigUint64Array(new ArrayBuffer(80)); +>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 29, 3)) +>ArrayBuffer : Symbol(ArrayBuffer, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +bigUintArray = new BigUint64Array(new ArrayBuffer(80), 8); +>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 29, 3)) +>ArrayBuffer : Symbol(ArrayBuffer, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +bigUintArray = new BigUint64Array(new ArrayBuffer(80), 8, 3); +>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 29, 3)) +>ArrayBuffer : Symbol(ArrayBuffer, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +len = bigIntArray.length; +>len : Symbol(len, Decl(bigintWithoutLib.ts, 24, 3)) +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3)) + +bigIntArray.length = 10; +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3)) + +arrayBufferLike = bigIntArray; +>arrayBufferLike : Symbol(arrayBufferLike, Decl(bigintWithoutLib.ts, 26, 3)) +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3)) + +// Test added DataView methods +const dataView = new DataView(new ArrayBuffer(80)); +>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5)) +>DataView : Symbol(DataView, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>ArrayBuffer : Symbol(ArrayBuffer, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +dataView.setBigInt64(1, -1n); +>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5)) + +dataView.setBigInt64(1, -1n, true); +>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5)) + +dataView.setBigInt64(1, -1); +>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5)) + +dataView.setBigUint64(2, 123n); +>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5)) + +dataView.setBigUint64(2, 123n, true); +>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5)) + +dataView.setBigUint64(2, 123); +>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5)) + +bigintVal = dataView.getBigInt64(1); +>bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3)) +>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5)) + +bigintVal = dataView.getBigInt64(1, true); +>bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3)) +>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5)) + +bigintVal = dataView.getBigUint64(2); +>bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3)) +>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5)) + +bigintVal = dataView.getBigUint64(2, true); +>bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3)) +>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5)) + +// Test Intl methods with new parameter type +new Intl.NumberFormat("fr").format(3000n); +>new Intl.NumberFormat("fr").format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.d.ts, --, --)) +>Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --)) +>NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.d.ts, --, --)) + +new Intl.NumberFormat("fr").format(bigintVal); +>new Intl.NumberFormat("fr").format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.d.ts, --, --)) +>Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --)) +>NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.d.ts, --, --)) +>bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3)) + diff --git a/tests/baselines/reference/bigintWithoutLib(target=es5).types b/tests/baselines/reference/bigintWithoutLib(target=es5).types new file mode 100644 index 0000000000000..4f37108f5d4eb --- /dev/null +++ b/tests/baselines/reference/bigintWithoutLib(target=es5).types @@ -0,0 +1,692 @@ +//// [tests/cases/compiler/bigintWithoutLib.ts] //// + +=== bigintWithoutLib.ts === +// Every line should error because these builtins are not declared + +// Test BigInt functions +let bigintVal: bigint = BigInt(123); +>bigintVal : bigint +> : ^^^^^^ +>BigInt(123) : any +> : ^^^ +>BigInt : any +> : ^^^ +>123 : 123 +> : ^^^ + +bigintVal = BigInt("456"); +>bigintVal = BigInt("456") : any +> : ^^^ +>bigintVal : bigint +> : ^^^^^^ +>BigInt("456") : any +> : ^^^ +>BigInt : any +> : ^^^ +>"456" : "456" +> : ^^^^^ + +new BigInt(123); +>new BigInt(123) : any +> : ^^^ +>BigInt : any +> : ^^^ +>123 : 123 +> : ^^^ + +bigintVal = BigInt.asIntN(8, 0xFFFFn); +>bigintVal = BigInt.asIntN(8, 0xFFFFn) : any +> : ^^^ +>bigintVal : bigint +> : ^^^^^^ +>BigInt.asIntN(8, 0xFFFFn) : any +> : ^^^ +>BigInt.asIntN : any +> : ^^^ +>BigInt : any +> : ^^^ +>asIntN : any +> : ^^^ +>8 : 8 +> : ^ +>0xFFFFn : 65535n +> : ^^^^^^ + +bigintVal = BigInt.asUintN(8, 0xFFFFn); +>bigintVal = BigInt.asUintN(8, 0xFFFFn) : any +> : ^^^ +>bigintVal : bigint +> : ^^^^^^ +>BigInt.asUintN(8, 0xFFFFn) : any +> : ^^^ +>BigInt.asUintN : any +> : ^^^ +>BigInt : any +> : ^^^ +>asUintN : any +> : ^^^ +>8 : 8 +> : ^ +>0xFFFFn : 65535n +> : ^^^^^^ + +bigintVal = bigintVal.valueOf(); // should error - bigintVal inferred as {} +>bigintVal = bigintVal.valueOf() : Object +> : ^^^^^^ +>bigintVal : bigint +> : ^^^^^^ +>bigintVal.valueOf() : Object +> : ^^^^^^ +>bigintVal.valueOf : () => Object +> : ^^^^^^ +>bigintVal : bigint +> : ^^^^^^ +>valueOf : () => Object +> : ^^^^^^ + +let stringVal: string = bigintVal.toString(); // should not error - bigintVal inferred as {} +>stringVal : string +> : ^^^^^^ +>bigintVal.toString() : string +> : ^^^^^^ +>bigintVal.toString : () => string +> : ^^^^^^ +>bigintVal : bigint +> : ^^^^^^ +>toString : () => string +> : ^^^^^^ + +stringVal = bigintVal.toString(2); // should error - bigintVal inferred as {} +>stringVal = bigintVal.toString(2) : string +> : ^^^^^^ +>stringVal : string +> : ^^^^^^ +>bigintVal.toString(2) : string +> : ^^^^^^ +>bigintVal.toString : () => string +> : ^^^^^^ +>bigintVal : bigint +> : ^^^^^^ +>toString : () => string +> : ^^^^^^ +>2 : 2 +> : ^ + +stringVal = bigintVal.toLocaleString(); // should not error - bigintVal inferred as {} +>stringVal = bigintVal.toLocaleString() : string +> : ^^^^^^ +>stringVal : string +> : ^^^^^^ +>bigintVal.toLocaleString() : string +> : ^^^^^^ +>bigintVal.toLocaleString : () => string +> : ^^^^^^ +>bigintVal : bigint +> : ^^^^^^ +>toLocaleString : () => string +> : ^^^^^^ + +stringVal = bigintVal.toLocaleString('de-DE'); // should not error - bigintVal inferred as {} +>stringVal = bigintVal.toLocaleString('de-DE') : string +> : ^^^^^^ +>stringVal : string +> : ^^^^^^ +>bigintVal.toLocaleString('de-DE') : string +> : ^^^^^^ +>bigintVal.toLocaleString : () => string +> : ^^^^^^ +>bigintVal : bigint +> : ^^^^^^ +>toLocaleString : () => string +> : ^^^^^^ +>'de-DE' : "de-DE" +> : ^^^^^^^ + +stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should not error - bigintVal inferred as {} +>stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }) : string +> : ^^^^^^ +>stringVal : string +> : ^^^^^^ +>bigintVal.toLocaleString('de-DE', { style: 'currency' }) : string +> : ^^^^^^ +>bigintVal.toLocaleString : () => string +> : ^^^^^^ +>bigintVal : bigint +> : ^^^^^^ +>toLocaleString : () => string +> : ^^^^^^ +>'de-DE' : "de-DE" +> : ^^^^^^^ +>{ style: 'currency' } : { style: string; } +> : ^^^^^^^^^^^^^^^^^^ +>style : string +> : ^^^^^^ +>'currency' : "currency" +> : ^^^^^^^^^^ + +stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) // should not error - bigintVal inferred as {} +>stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) : string +> : ^^^^^^ +>stringVal : string +> : ^^^^^^ +>bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) : string +> : ^^^^^^ +>bigintVal.toLocaleString : () => string +> : ^^^^^^ +>bigintVal : bigint +> : ^^^^^^ +>toLocaleString : () => string +> : ^^^^^^ +>'de-DE' : "de-DE" +> : ^^^^^^^ +>{ style: 'currency', currency: 'EUR' } : { style: string; currency: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>style : string +> : ^^^^^^ +>'currency' : "currency" +> : ^^^^^^^^^^ +>currency : string +> : ^^^^^^ +>'EUR' : "EUR" +> : ^^^^^ + +// Test BigInt64Array +let bigIntArray: BigInt64Array = new BigInt64Array(); +>bigIntArray : BigInt64Array +> : ^^^^^^^^^^^^^ +>new BigInt64Array() : any +> : ^^^ +>BigInt64Array : any +> : ^^^ + +bigIntArray = new BigInt64Array(10); +>bigIntArray = new BigInt64Array(10) : any +> : ^^^ +>bigIntArray : BigInt64Array +> : ^^^^^^^^^^^^^ +>new BigInt64Array(10) : any +> : ^^^ +>BigInt64Array : any +> : ^^^ +>10 : 10 +> : ^^ + +bigIntArray = new BigInt64Array([1n, 2n, 3n]); +>bigIntArray = new BigInt64Array([1n, 2n, 3n]) : any +> : ^^^ +>bigIntArray : BigInt64Array +> : ^^^^^^^^^^^^^ +>new BigInt64Array([1n, 2n, 3n]) : any +> : ^^^ +>BigInt64Array : any +> : ^^^ +>[1n, 2n, 3n] : bigint[] +> : ^^^^^^^^ +>1n : 1n +> : ^^ +>2n : 2n +> : ^^ +>3n : 3n +> : ^^ + +bigIntArray = new BigInt64Array([1, 2, 3]); +>bigIntArray = new BigInt64Array([1, 2, 3]) : any +> : ^^^ +>bigIntArray : BigInt64Array +> : ^^^^^^^^^^^^^ +>new BigInt64Array([1, 2, 3]) : any +> : ^^^ +>BigInt64Array : any +> : ^^^ +>[1, 2, 3] : number[] +> : ^^^^^^^^ +>1 : 1 +> : ^ +>2 : 2 +> : ^ +>3 : 3 +> : ^ + +bigIntArray = new BigInt64Array(new ArrayBuffer(80)); +>bigIntArray = new BigInt64Array(new ArrayBuffer(80)) : any +> : ^^^ +>bigIntArray : BigInt64Array +> : ^^^^^^^^^^^^^ +>new BigInt64Array(new ArrayBuffer(80)) : any +> : ^^^ +>BigInt64Array : any +> : ^^^ +>new ArrayBuffer(80) : ArrayBuffer +> : ^^^^^^^^^^^ +>ArrayBuffer : ArrayBufferConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^ +>80 : 80 +> : ^^ + +bigIntArray = new BigInt64Array(new ArrayBuffer(80), 8); +>bigIntArray = new BigInt64Array(new ArrayBuffer(80), 8) : any +> : ^^^ +>bigIntArray : BigInt64Array +> : ^^^^^^^^^^^^^ +>new BigInt64Array(new ArrayBuffer(80), 8) : any +> : ^^^ +>BigInt64Array : any +> : ^^^ +>new ArrayBuffer(80) : ArrayBuffer +> : ^^^^^^^^^^^ +>ArrayBuffer : ArrayBufferConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^ +>80 : 80 +> : ^^ +>8 : 8 +> : ^ + +bigIntArray = new BigInt64Array(new ArrayBuffer(80), 8, 3); +>bigIntArray = new BigInt64Array(new ArrayBuffer(80), 8, 3) : any +> : ^^^ +>bigIntArray : BigInt64Array +> : ^^^^^^^^^^^^^ +>new BigInt64Array(new ArrayBuffer(80), 8, 3) : any +> : ^^^ +>BigInt64Array : any +> : ^^^ +>new ArrayBuffer(80) : ArrayBuffer +> : ^^^^^^^^^^^ +>ArrayBuffer : ArrayBufferConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^ +>80 : 80 +> : ^^ +>8 : 8 +> : ^ +>3 : 3 +> : ^ + +let len: number = bigIntArray.length; +>len : number +> : ^^^^^^ +>bigIntArray.length : any +> : ^^^ +>bigIntArray : BigInt64Array +> : ^^^^^^^^^^^^^ +>length : any +> : ^^^ + +bigIntArray.length = 10; +>bigIntArray.length = 10 : 10 +> : ^^ +>bigIntArray.length : any +> : ^^^ +>bigIntArray : BigInt64Array +> : ^^^^^^^^^^^^^ +>length : any +> : ^^^ +>10 : 10 +> : ^^ + +let arrayBufferLike: ArrayBufferView = bigIntArray; +>arrayBufferLike : ArrayBufferView +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>bigIntArray : BigInt64Array +> : ^^^^^^^^^^^^^ + +// Test BigUint64Array +let bigUintArray: BigUint64Array = new BigUint64Array(); +>bigUintArray : BigUint64Array +> : ^^^^^^^^^^^^^^ +>new BigUint64Array() : any +> : ^^^ +>BigUint64Array : any +> : ^^^ + +bigUintArray = new BigUint64Array(10); +>bigUintArray = new BigUint64Array(10) : any +> : ^^^ +>bigUintArray : BigUint64Array +> : ^^^^^^^^^^^^^^ +>new BigUint64Array(10) : any +> : ^^^ +>BigUint64Array : any +> : ^^^ +>10 : 10 +> : ^^ + +bigUintArray = new BigUint64Array([1n, 2n, 3n]); +>bigUintArray = new BigUint64Array([1n, 2n, 3n]) : any +> : ^^^ +>bigUintArray : BigUint64Array +> : ^^^^^^^^^^^^^^ +>new BigUint64Array([1n, 2n, 3n]) : any +> : ^^^ +>BigUint64Array : any +> : ^^^ +>[1n, 2n, 3n] : bigint[] +> : ^^^^^^^^ +>1n : 1n +> : ^^ +>2n : 2n +> : ^^ +>3n : 3n +> : ^^ + +bigUintArray = new BigUint64Array([1, 2, 3]); +>bigUintArray = new BigUint64Array([1, 2, 3]) : any +> : ^^^ +>bigUintArray : BigUint64Array +> : ^^^^^^^^^^^^^^ +>new BigUint64Array([1, 2, 3]) : any +> : ^^^ +>BigUint64Array : any +> : ^^^ +>[1, 2, 3] : number[] +> : ^^^^^^^^ +>1 : 1 +> : ^ +>2 : 2 +> : ^ +>3 : 3 +> : ^ + +bigUintArray = new BigUint64Array(new ArrayBuffer(80)); +>bigUintArray = new BigUint64Array(new ArrayBuffer(80)) : any +> : ^^^ +>bigUintArray : BigUint64Array +> : ^^^^^^^^^^^^^^ +>new BigUint64Array(new ArrayBuffer(80)) : any +> : ^^^ +>BigUint64Array : any +> : ^^^ +>new ArrayBuffer(80) : ArrayBuffer +> : ^^^^^^^^^^^ +>ArrayBuffer : ArrayBufferConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^ +>80 : 80 +> : ^^ + +bigUintArray = new BigUint64Array(new ArrayBuffer(80), 8); +>bigUintArray = new BigUint64Array(new ArrayBuffer(80), 8) : any +> : ^^^ +>bigUintArray : BigUint64Array +> : ^^^^^^^^^^^^^^ +>new BigUint64Array(new ArrayBuffer(80), 8) : any +> : ^^^ +>BigUint64Array : any +> : ^^^ +>new ArrayBuffer(80) : ArrayBuffer +> : ^^^^^^^^^^^ +>ArrayBuffer : ArrayBufferConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^ +>80 : 80 +> : ^^ +>8 : 8 +> : ^ + +bigUintArray = new BigUint64Array(new ArrayBuffer(80), 8, 3); +>bigUintArray = new BigUint64Array(new ArrayBuffer(80), 8, 3) : any +> : ^^^ +>bigUintArray : BigUint64Array +> : ^^^^^^^^^^^^^^ +>new BigUint64Array(new ArrayBuffer(80), 8, 3) : any +> : ^^^ +>BigUint64Array : any +> : ^^^ +>new ArrayBuffer(80) : ArrayBuffer +> : ^^^^^^^^^^^ +>ArrayBuffer : ArrayBufferConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^ +>80 : 80 +> : ^^ +>8 : 8 +> : ^ +>3 : 3 +> : ^ + +len = bigIntArray.length; +>len = bigIntArray.length : any +> : ^^^ +>len : number +> : ^^^^^^ +>bigIntArray.length : any +> : ^^^ +>bigIntArray : BigInt64Array +> : ^^^^^^^^^^^^^ +>length : any +> : ^^^ + +bigIntArray.length = 10; +>bigIntArray.length = 10 : 10 +> : ^^ +>bigIntArray.length : any +> : ^^^ +>bigIntArray : BigInt64Array +> : ^^^^^^^^^^^^^ +>length : any +> : ^^^ +>10 : 10 +> : ^^ + +arrayBufferLike = bigIntArray; +>arrayBufferLike = bigIntArray : BigInt64Array +> : ^^^^^^^^^^^^^ +>arrayBufferLike : ArrayBufferView +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>bigIntArray : BigInt64Array +> : ^^^^^^^^^^^^^ + +// Test added DataView methods +const dataView = new DataView(new ArrayBuffer(80)); +>dataView : DataView +> : ^^^^^^^^^^^^^^^^^^^^^ +>new DataView(new ArrayBuffer(80)) : DataView +> : ^^^^^^^^^^^^^^^^^^^^^ +>DataView : DataViewConstructor +> : ^^^^^^^^^^^^^^^^^^^ +>new ArrayBuffer(80) : ArrayBuffer +> : ^^^^^^^^^^^ +>ArrayBuffer : ArrayBufferConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^ +>80 : 80 +> : ^^ + +dataView.setBigInt64(1, -1n); +>dataView.setBigInt64(1, -1n) : any +> : ^^^ +>dataView.setBigInt64 : any +> : ^^^ +>dataView : DataView +> : ^^^^^^^^^^^^^^^^^^^^^ +>setBigInt64 : any +> : ^^^ +>1 : 1 +> : ^ +>-1n : -1n +> : ^^^ +>1n : 1n +> : ^^ + +dataView.setBigInt64(1, -1n, true); +>dataView.setBigInt64(1, -1n, true) : any +> : ^^^ +>dataView.setBigInt64 : any +> : ^^^ +>dataView : DataView +> : ^^^^^^^^^^^^^^^^^^^^^ +>setBigInt64 : any +> : ^^^ +>1 : 1 +> : ^ +>-1n : -1n +> : ^^^ +>1n : 1n +> : ^^ +>true : true +> : ^^^^ + +dataView.setBigInt64(1, -1); +>dataView.setBigInt64(1, -1) : any +> : ^^^ +>dataView.setBigInt64 : any +> : ^^^ +>dataView : DataView +> : ^^^^^^^^^^^^^^^^^^^^^ +>setBigInt64 : any +> : ^^^ +>1 : 1 +> : ^ +>-1 : -1 +> : ^^ +>1 : 1 +> : ^ + +dataView.setBigUint64(2, 123n); +>dataView.setBigUint64(2, 123n) : any +> : ^^^ +>dataView.setBigUint64 : any +> : ^^^ +>dataView : DataView +> : ^^^^^^^^^^^^^^^^^^^^^ +>setBigUint64 : any +> : ^^^ +>2 : 2 +> : ^ +>123n : 123n +> : ^^^^ + +dataView.setBigUint64(2, 123n, true); +>dataView.setBigUint64(2, 123n, true) : any +> : ^^^ +>dataView.setBigUint64 : any +> : ^^^ +>dataView : DataView +> : ^^^^^^^^^^^^^^^^^^^^^ +>setBigUint64 : any +> : ^^^ +>2 : 2 +> : ^ +>123n : 123n +> : ^^^^ +>true : true +> : ^^^^ + +dataView.setBigUint64(2, 123); +>dataView.setBigUint64(2, 123) : any +> : ^^^ +>dataView.setBigUint64 : any +> : ^^^ +>dataView : DataView +> : ^^^^^^^^^^^^^^^^^^^^^ +>setBigUint64 : any +> : ^^^ +>2 : 2 +> : ^ +>123 : 123 +> : ^^^ + +bigintVal = dataView.getBigInt64(1); +>bigintVal = dataView.getBigInt64(1) : any +> : ^^^ +>bigintVal : bigint +> : ^^^^^^ +>dataView.getBigInt64(1) : any +> : ^^^ +>dataView.getBigInt64 : any +> : ^^^ +>dataView : DataView +> : ^^^^^^^^^^^^^^^^^^^^^ +>getBigInt64 : any +> : ^^^ +>1 : 1 +> : ^ + +bigintVal = dataView.getBigInt64(1, true); +>bigintVal = dataView.getBigInt64(1, true) : any +> : ^^^ +>bigintVal : bigint +> : ^^^^^^ +>dataView.getBigInt64(1, true) : any +> : ^^^ +>dataView.getBigInt64 : any +> : ^^^ +>dataView : DataView +> : ^^^^^^^^^^^^^^^^^^^^^ +>getBigInt64 : any +> : ^^^ +>1 : 1 +> : ^ +>true : true +> : ^^^^ + +bigintVal = dataView.getBigUint64(2); +>bigintVal = dataView.getBigUint64(2) : any +> : ^^^ +>bigintVal : bigint +> : ^^^^^^ +>dataView.getBigUint64(2) : any +> : ^^^ +>dataView.getBigUint64 : any +> : ^^^ +>dataView : DataView +> : ^^^^^^^^^^^^^^^^^^^^^ +>getBigUint64 : any +> : ^^^ +>2 : 2 +> : ^ + +bigintVal = dataView.getBigUint64(2, true); +>bigintVal = dataView.getBigUint64(2, true) : any +> : ^^^ +>bigintVal : bigint +> : ^^^^^^ +>dataView.getBigUint64(2, true) : any +> : ^^^ +>dataView.getBigUint64 : any +> : ^^^ +>dataView : DataView +> : ^^^^^^^^^^^^^^^^^^^^^ +>getBigUint64 : any +> : ^^^ +>2 : 2 +> : ^ +>true : true +> : ^^^^ + +// Test Intl methods with new parameter type +new Intl.NumberFormat("fr").format(3000n); +>new Intl.NumberFormat("fr").format(3000n) : string +> : ^^^^^^ +>new Intl.NumberFormat("fr").format : (value: number) => string +> : ^ ^^ ^^^^^ +>new Intl.NumberFormat("fr") : Intl.NumberFormat +> : ^^^^^^^^^^^^^^^^^ +>Intl.NumberFormat : Intl.NumberFormatConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>Intl : typeof Intl +> : ^^^^^^^^^^^ +>NumberFormat : Intl.NumberFormatConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>"fr" : "fr" +> : ^^^^ +>format : (value: number) => string +> : ^ ^^ ^^^^^ +>3000n : 3000n +> : ^^^^^ + +new Intl.NumberFormat("fr").format(bigintVal); +>new Intl.NumberFormat("fr").format(bigintVal) : string +> : ^^^^^^ +>new Intl.NumberFormat("fr").format : (value: number) => string +> : ^ ^^ ^^^^^ +>new Intl.NumberFormat("fr") : Intl.NumberFormat +> : ^^^^^^^^^^^^^^^^^ +>Intl.NumberFormat : Intl.NumberFormatConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>Intl : typeof Intl +> : ^^^^^^^^^^^ +>NumberFormat : Intl.NumberFormatConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>"fr" : "fr" +> : ^^^^ +>format : (value: number) => string +> : ^ ^^ ^^^^^ +>bigintVal : bigint +> : ^^^^^^ + diff --git a/tests/baselines/reference/binaryArithmeticControlFlowGraphNotTooLarge.js b/tests/baselines/reference/binaryArithmeticControlFlowGraphNotTooLarge.js index 4a56b0a264f1b..0b625e5da5c1b 100644 --- a/tests/baselines/reference/binaryArithmeticControlFlowGraphNotTooLarge.js +++ b/tests/baselines/reference/binaryArithmeticControlFlowGraphNotTooLarge.js @@ -1301,7 +1301,7 @@ const foo = function (this: any) { //// [binaryArithmeticControlFlowGraphNotTooLarge.js] "use strict"; // Repro from #29926 (expanded 10x for good measure) -var foo = function () { +const foo = function () { var a, b, c, d, ab, bc, cd, da, blocks = this.blocks; if (this.first) { a = blocks[0] - 1; diff --git a/tests/baselines/reference/binaryIntegerLiteral(target=es2015).js b/tests/baselines/reference/binaryIntegerLiteral(target=es2015).js new file mode 100644 index 0000000000000..b94113e58af3a --- /dev/null +++ b/tests/baselines/reference/binaryIntegerLiteral(target=es2015).js @@ -0,0 +1,83 @@ +//// [tests/cases/conformance/es6/binaryAndOctalIntegerLiteral/binaryIntegerLiteral.ts] //// + +//// [binaryIntegerLiteral.ts] +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 +obj1["0b11010"]; // any +obj1["a"]; // number +obj1["b"]; // number +obj1["bin1"]; // number +obj1["Infinity"]; // boolean + +obj2[0B11010]; // string +obj2[26]; // string +obj2["26"]; // string +obj2["0B11010"]; // any +obj2["a"]; // number +obj2["b"]; // number +obj2["bin2"]; // number +obj2[9.671406556917009e+24]; // boolean +obj2["9.671406556917009e+24"]; // boolean +obj2["Infinity"]; // any + + + +//// [binaryIntegerLiteral.js] +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 +obj1["0b11010"]; // any +obj1["a"]; // number +obj1["b"]; // number +obj1["bin1"]; // number +obj1["Infinity"]; // boolean +obj2[0B11010]; // string +obj2[26]; // string +obj2["26"]; // string +obj2["0B11010"]; // any +obj2["a"]; // number +obj2["b"]; // number +obj2["bin2"]; // number +obj2[9.671406556917009e+24]; // boolean +obj2["9.671406556917009e+24"]; // boolean +obj2["Infinity"]; // any diff --git a/tests/baselines/reference/binaryIntegerLiteral.symbols b/tests/baselines/reference/binaryIntegerLiteral(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/binaryIntegerLiteral.symbols rename to tests/baselines/reference/binaryIntegerLiteral(target=es2015).symbols diff --git a/tests/baselines/reference/binaryIntegerLiteral.types b/tests/baselines/reference/binaryIntegerLiteral(target=es2015).types similarity index 100% rename from tests/baselines/reference/binaryIntegerLiteral.types rename to tests/baselines/reference/binaryIntegerLiteral(target=es2015).types diff --git a/tests/baselines/reference/binaryIntegerLiteral.js b/tests/baselines/reference/binaryIntegerLiteral(target=es5).js similarity index 100% rename from tests/baselines/reference/binaryIntegerLiteral.js rename to tests/baselines/reference/binaryIntegerLiteral(target=es5).js diff --git a/tests/baselines/reference/binaryIntegerLiteral(target=es5).symbols b/tests/baselines/reference/binaryIntegerLiteral(target=es5).symbols new file mode 100644 index 0000000000000..9fdb1885439d6 --- /dev/null +++ b/tests/baselines/reference/binaryIntegerLiteral(target=es5).symbols @@ -0,0 +1,125 @@ +//// [tests/cases/conformance/es6/binaryAndOctalIntegerLiteral/binaryIntegerLiteral.ts] //// + +=== binaryIntegerLiteral.ts === +var bin1 = 0b11010; +>bin1 : Symbol(bin1, Decl(binaryIntegerLiteral.ts, 0, 3)) + +var bin2 = 0B11010; +>bin2 : Symbol(bin2, Decl(binaryIntegerLiteral.ts, 1, 3)) + +var bin3 = 0B11111111111111111111111111111111111111111111111101001010100000010111110001111111111; +>bin3 : Symbol(bin3, Decl(binaryIntegerLiteral.ts, 2, 3)) + +var bin4 = 0B111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101001010100000010111110001111111111; +>bin4 : Symbol(bin4, Decl(binaryIntegerLiteral.ts, 3, 3)) + +var obj1 = { +>obj1 : Symbol(obj1, Decl(binaryIntegerLiteral.ts, 5, 3)) + + 0b11010: "Hello", +>0b11010 : Symbol(0b11010, Decl(binaryIntegerLiteral.ts, 5, 12)) + + a: bin1, +>a : Symbol(a, Decl(binaryIntegerLiteral.ts, 6, 21)) +>bin1 : Symbol(bin1, Decl(binaryIntegerLiteral.ts, 0, 3)) + + bin1, +>bin1 : Symbol(bin1, Decl(binaryIntegerLiteral.ts, 7, 12)) + + b: 0b11010, +>b : Symbol(b, Decl(binaryIntegerLiteral.ts, 8, 9)) + + 0B111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101001010100000010111110001111111111: true, +>0B111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101001010100000010111110001111111111 : Symbol(0B111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101001010100000010111110001111111111, Decl(binaryIntegerLiteral.ts, 9, 15)) +} + +var obj2 = { +>obj2 : Symbol(obj2, Decl(binaryIntegerLiteral.ts, 13, 3)) + + 0B11010: "World", +>0B11010 : Symbol(0B11010, Decl(binaryIntegerLiteral.ts, 13, 12)) + + a: bin2, +>a : Symbol(a, Decl(binaryIntegerLiteral.ts, 14, 21)) +>bin2 : Symbol(bin2, Decl(binaryIntegerLiteral.ts, 1, 3)) + + bin2, +>bin2 : Symbol(bin2, Decl(binaryIntegerLiteral.ts, 15, 12)) + + b: 0B11010, +>b : Symbol(b, Decl(binaryIntegerLiteral.ts, 16, 9)) + + 0B11111111111111111111111111111111111111111111111101001010100000010111110001111111111: false, +>0B11111111111111111111111111111111111111111111111101001010100000010111110001111111111 : Symbol(0B11111111111111111111111111111111111111111111111101001010100000010111110001111111111, Decl(binaryIntegerLiteral.ts, 17, 15)) +} + +obj1[0b11010]; // string +>obj1 : Symbol(obj1, Decl(binaryIntegerLiteral.ts, 5, 3)) +>0b11010 : Symbol(0b11010, Decl(binaryIntegerLiteral.ts, 5, 12)) + +obj1[26]; // string +>obj1 : Symbol(obj1, Decl(binaryIntegerLiteral.ts, 5, 3)) +>26 : Symbol(0b11010, Decl(binaryIntegerLiteral.ts, 5, 12)) + +obj1["26"]; // string +>obj1 : Symbol(obj1, Decl(binaryIntegerLiteral.ts, 5, 3)) +>"26" : Symbol(0b11010, Decl(binaryIntegerLiteral.ts, 5, 12)) + +obj1["0b11010"]; // any +>obj1 : Symbol(obj1, Decl(binaryIntegerLiteral.ts, 5, 3)) + +obj1["a"]; // number +>obj1 : Symbol(obj1, Decl(binaryIntegerLiteral.ts, 5, 3)) +>"a" : Symbol(a, Decl(binaryIntegerLiteral.ts, 6, 21)) + +obj1["b"]; // number +>obj1 : Symbol(obj1, Decl(binaryIntegerLiteral.ts, 5, 3)) +>"b" : Symbol(b, Decl(binaryIntegerLiteral.ts, 8, 9)) + +obj1["bin1"]; // number +>obj1 : Symbol(obj1, Decl(binaryIntegerLiteral.ts, 5, 3)) +>"bin1" : Symbol(bin1, Decl(binaryIntegerLiteral.ts, 7, 12)) + +obj1["Infinity"]; // boolean +>obj1 : Symbol(obj1, Decl(binaryIntegerLiteral.ts, 5, 3)) +>"Infinity" : Symbol(0B111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101001010100000010111110001111111111, Decl(binaryIntegerLiteral.ts, 9, 15)) + +obj2[0B11010]; // string +>obj2 : Symbol(obj2, Decl(binaryIntegerLiteral.ts, 13, 3)) +>0B11010 : Symbol(0B11010, Decl(binaryIntegerLiteral.ts, 13, 12)) + +obj2[26]; // string +>obj2 : Symbol(obj2, Decl(binaryIntegerLiteral.ts, 13, 3)) +>26 : Symbol(0B11010, Decl(binaryIntegerLiteral.ts, 13, 12)) + +obj2["26"]; // string +>obj2 : Symbol(obj2, Decl(binaryIntegerLiteral.ts, 13, 3)) +>"26" : Symbol(0B11010, Decl(binaryIntegerLiteral.ts, 13, 12)) + +obj2["0B11010"]; // any +>obj2 : Symbol(obj2, Decl(binaryIntegerLiteral.ts, 13, 3)) + +obj2["a"]; // number +>obj2 : Symbol(obj2, Decl(binaryIntegerLiteral.ts, 13, 3)) +>"a" : Symbol(a, Decl(binaryIntegerLiteral.ts, 14, 21)) + +obj2["b"]; // number +>obj2 : Symbol(obj2, Decl(binaryIntegerLiteral.ts, 13, 3)) +>"b" : Symbol(b, Decl(binaryIntegerLiteral.ts, 16, 9)) + +obj2["bin2"]; // number +>obj2 : Symbol(obj2, Decl(binaryIntegerLiteral.ts, 13, 3)) +>"bin2" : Symbol(bin2, Decl(binaryIntegerLiteral.ts, 15, 12)) + +obj2[9.671406556917009e+24]; // boolean +>obj2 : Symbol(obj2, Decl(binaryIntegerLiteral.ts, 13, 3)) +>9.671406556917009e+24 : Symbol(0B11111111111111111111111111111111111111111111111101001010100000010111110001111111111, Decl(binaryIntegerLiteral.ts, 17, 15)) + +obj2["9.671406556917009e+24"]; // boolean +>obj2 : Symbol(obj2, Decl(binaryIntegerLiteral.ts, 13, 3)) +>"9.671406556917009e+24" : Symbol(0B11111111111111111111111111111111111111111111111101001010100000010111110001111111111, Decl(binaryIntegerLiteral.ts, 17, 15)) + +obj2["Infinity"]; // any +>obj2 : Symbol(obj2, Decl(binaryIntegerLiteral.ts, 13, 3)) + + diff --git a/tests/baselines/reference/binaryIntegerLiteral(target=es5).types b/tests/baselines/reference/binaryIntegerLiteral(target=es5).types new file mode 100644 index 0000000000000..9bb5101b0e371 --- /dev/null +++ b/tests/baselines/reference/binaryIntegerLiteral(target=es5).types @@ -0,0 +1,239 @@ +//// [tests/cases/conformance/es6/binaryAndOctalIntegerLiteral/binaryIntegerLiteral.ts] //// + +=== binaryIntegerLiteral.ts === +var bin1 = 0b11010; +>bin1 : number +> : ^^^^^^ +>0b11010 : 26 +> : ^^ + +var bin2 = 0B11010; +>bin2 : number +> : ^^^^^^ +>0B11010 : 26 +> : ^^ + +var bin3 = 0B11111111111111111111111111111111111111111111111101001010100000010111110001111111111; +>bin3 : number +> : ^^^^^^ +>0B11111111111111111111111111111111111111111111111101001010100000010111110001111111111 : 9.671406556917009e+24 +> : ^^^^^^^^^^^^^^^^^^^^^ + +var bin4 = 0B111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101001010100000010111110001111111111; +>bin4 : number +> : ^^^^^^ +>0B111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101001010100000010111110001111111111 : Infinity +> : ^^^^^^^^ + +var obj1 = { +>obj1 : { 26: string; a: number; bin1: number; b: number; Infinity: boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>{ 0b11010: "Hello", a: bin1, bin1, b: 0b11010, 0B111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101001010100000010111110001111111111: true,} : { 26: string; a: number; bin1: number; b: number; Infinity: boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + 0b11010: "Hello", +>0b11010 : string +> : ^^^^^^ +>"Hello" : "Hello" +> : ^^^^^^^ + + a: bin1, +>a : number +> : ^^^^^^ +>bin1 : number +> : ^^^^^^ + + bin1, +>bin1 : number +> : ^^^^^^ + + b: 0b11010, +>b : number +> : ^^^^^^ +>0b11010 : 26 +> : ^^ + + 0B111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101001010100000010111110001111111111: true, +>0B111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101001010100000010111110001111111111 : boolean +> : ^^^^^^^ +>true : true +> : ^^^^ +} + +var obj2 = { +>obj2 : { 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>{ 0B11010: "World", a: bin2, bin2, b: 0B11010, 0B11111111111111111111111111111111111111111111111101001010100000010111110001111111111: false,} : { 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + 0B11010: "World", +>0B11010 : string +> : ^^^^^^ +>"World" : "World" +> : ^^^^^^^ + + a: bin2, +>a : number +> : ^^^^^^ +>bin2 : number +> : ^^^^^^ + + bin2, +>bin2 : number +> : ^^^^^^ + + b: 0B11010, +>b : number +> : ^^^^^^ +>0B11010 : 26 +> : ^^ + + 0B11111111111111111111111111111111111111111111111101001010100000010111110001111111111: false, +>0B11111111111111111111111111111111111111111111111101001010100000010111110001111111111 : boolean +> : ^^^^^^^ +>false : false +> : ^^^^^ +} + +obj1[0b11010]; // string +>obj1[0b11010] : string +> : ^^^^^^ +>obj1 : { 26: string; a: number; bin1: number; b: number; Infinity: boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>0b11010 : 26 +> : ^^ + +obj1[26]; // string +>obj1[26] : string +> : ^^^^^^ +>obj1 : { 26: string; a: number; bin1: number; b: number; Infinity: boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>26 : 26 +> : ^^ + +obj1["26"]; // string +>obj1["26"] : string +> : ^^^^^^ +>obj1 : { 26: string; a: number; bin1: number; b: number; Infinity: boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>"26" : "26" +> : ^^^^ + +obj1["0b11010"]; // any +>obj1["0b11010"] : error +>obj1 : { 26: string; a: number; bin1: number; b: number; Infinity: boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>"0b11010" : "0b11010" +> : ^^^^^^^^^ + +obj1["a"]; // number +>obj1["a"] : number +> : ^^^^^^ +>obj1 : { 26: string; a: number; bin1: number; b: number; Infinity: boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>"a" : "a" +> : ^^^ + +obj1["b"]; // number +>obj1["b"] : number +> : ^^^^^^ +>obj1 : { 26: string; a: number; bin1: number; b: number; Infinity: boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>"b" : "b" +> : ^^^ + +obj1["bin1"]; // number +>obj1["bin1"] : number +> : ^^^^^^ +>obj1 : { 26: string; a: number; bin1: number; b: number; Infinity: boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>"bin1" : "bin1" +> : ^^^^^^ + +obj1["Infinity"]; // boolean +>obj1["Infinity"] : boolean +> : ^^^^^^^ +>obj1 : { 26: string; a: number; bin1: number; b: number; Infinity: boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>"Infinity" : "Infinity" +> : ^^^^^^^^^^ + +obj2[0B11010]; // string +>obj2[0B11010] : string +> : ^^^^^^ +>obj2 : { 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>0B11010 : 26 +> : ^^ + +obj2[26]; // string +>obj2[26] : string +> : ^^^^^^ +>obj2 : { 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>26 : 26 +> : ^^ + +obj2["26"]; // string +>obj2["26"] : string +> : ^^^^^^ +>obj2 : { 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>"26" : "26" +> : ^^^^ + +obj2["0B11010"]; // any +>obj2["0B11010"] : error +>obj2 : { 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>"0B11010" : "0B11010" +> : ^^^^^^^^^ + +obj2["a"]; // number +>obj2["a"] : number +> : ^^^^^^ +>obj2 : { 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>"a" : "a" +> : ^^^ + +obj2["b"]; // number +>obj2["b"] : number +> : ^^^^^^ +>obj2 : { 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>"b" : "b" +> : ^^^ + +obj2["bin2"]; // number +>obj2["bin2"] : number +> : ^^^^^^ +>obj2 : { 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>"bin2" : "bin2" +> : ^^^^^^ + +obj2[9.671406556917009e+24]; // boolean +>obj2[9.671406556917009e+24] : boolean +> : ^^^^^^^ +>obj2 : { 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>9.671406556917009e+24 : 9.671406556917009e+24 +> : ^^^^^^^^^^^^^^^^^^^^^ + +obj2["9.671406556917009e+24"]; // boolean +>obj2["9.671406556917009e+24"] : boolean +> : ^^^^^^^ +>obj2 : { 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>"9.671406556917009e+24" : "9.671406556917009e+24" +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +obj2["Infinity"]; // any +>obj2["Infinity"] : error +>obj2 : { 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>"Infinity" : "Infinity" +> : ^^^^^^^^^^ + + diff --git a/tests/baselines/reference/binaryIntegerLiteralError.js b/tests/baselines/reference/binaryIntegerLiteralError.js index b46f6a1216748..dacb4a2a29b83 100644 --- a/tests/baselines/reference/binaryIntegerLiteralError.js +++ b/tests/baselines/reference/binaryIntegerLiteralError.js @@ -14,12 +14,12 @@ var obj1 = { //// [binaryIntegerLiteralError.js] // error -var bin1 = 6; +var bin1 = 0B110; 2110; -var bin1 = 6; +var bin1 = 0b110; 23410; var obj1 = { - 26: "hi", + 0b11010: "hi", 26: "Hello", "26": "world", }; diff --git a/tests/baselines/reference/bind1.js b/tests/baselines/reference/bind1.js index 0bbd6f903283b..d1bcb2ce3a16d 100644 --- a/tests/baselines/reference/bind1.js +++ b/tests/baselines/reference/bind1.js @@ -10,10 +10,7 @@ namespace M { //// [bind1.js] var M; (function (M) { - var C = /** @class */ (function () { - function C() { - } - return C; - }()); // this should be an unresolved symbol I error + class C { + } // this should be an unresolved symbol I error M.C = C; })(M || (M = {})); diff --git a/tests/baselines/reference/bindingPatternCannotBeOnlyInferenceSource.errors.txt b/tests/baselines/reference/bindingPatternCannotBeOnlyInferenceSource.errors.txt index b4237742ac51d..c5f979027174c 100644 --- a/tests/baselines/reference/bindingPatternCannotBeOnlyInferenceSource.errors.txt +++ b/tests/baselines/reference/bindingPatternCannotBeOnlyInferenceSource.errors.txt @@ -1,8 +1,8 @@ bindingPatternCannotBeOnlyInferenceSource.ts(2,7): error TS2571: Object is of type 'unknown'. bindingPatternCannotBeOnlyInferenceSource.ts(3,9): error TS2339: Property 'p1' does not exist on type 'unknown'. -bindingPatternCannotBeOnlyInferenceSource.ts(4,7): error TS2461: Type 'unknown' is not an array type. +bindingPatternCannotBeOnlyInferenceSource.ts(4,7): error TS2488: Type 'unknown' must have a '[Symbol.iterator]()' method that returns an iterator. bindingPatternCannotBeOnlyInferenceSource.ts(4,7): error TS2571: Object is of type 'unknown'. -bindingPatternCannotBeOnlyInferenceSource.ts(5,7): error TS2461: Type 'unknown' is not an array type. +bindingPatternCannotBeOnlyInferenceSource.ts(5,7): error TS2488: Type 'unknown' must have a '[Symbol.iterator]()' method that returns an iterator. ==== bindingPatternCannotBeOnlyInferenceSource.ts (5 errors) ==== @@ -15,12 +15,12 @@ bindingPatternCannotBeOnlyInferenceSource.ts(5,7): error TS2461: Type 'unknown' !!! error TS2339: Property 'p1' does not exist on type 'unknown'. const [] = f(); // error ~~ -!!! error TS2461: Type 'unknown' is not an array type. +!!! error TS2488: Type 'unknown' must have a '[Symbol.iterator]()' method that returns an iterator. ~~ !!! error TS2571: Object is of type 'unknown'. const [e1, e2] = f(); // error ~~~~~~~~ -!!! error TS2461: Type 'unknown' is not an array type. +!!! error TS2488: Type 'unknown' must have a '[Symbol.iterator]()' method that returns an iterator. // Repro from #43605 type Dispatch = { (action: T): T }; diff --git a/tests/baselines/reference/bindingPatternCannotBeOnlyInferenceSource.js b/tests/baselines/reference/bindingPatternCannotBeOnlyInferenceSource.js index a1f2c641c8fe1..ea3edd6054ee5 100644 --- a/tests/baselines/reference/bindingPatternCannotBeOnlyInferenceSource.js +++ b/tests/baselines/reference/bindingPatternCannotBeOnlyInferenceSource.js @@ -29,35 +29,17 @@ const {} = useReduxDispatch1( //// [bindingPatternCannotBeOnlyInferenceSource.js] -var _a = f(); // error (only in strictNullChecks) -var p1 = f().p1; // error -var _b = f(); // error -var _c = f(), e1 = _c[0], e2 = _c[1]; // error -var funcs1 = { - funcA: function (a) { }, - funcB: function (b, bb) { }, - funcC: function (c, cc, ccc) { }, +const {} = f(); // error (only in strictNullChecks) +const { p1 } = f(); // error +const [] = f(); // error +const [e1, e2] = f(); // error +const funcs1 = { + funcA: (a) => { }, + funcB: (b, bb) => { }, + funcC: (c, cc, ccc) => { }, }; -var _d = useReduxDispatch1(function (d, f) { return ({ - funcA: function () { - var p = []; - for (var _i = 0; _i < arguments.length; _i++) { - p[_i] = arguments[_i]; - } - return d(f.funcA.apply(f, p)); - }, // p should be inferrable - funcB: function () { - var p = []; - for (var _i = 0; _i < arguments.length; _i++) { - p[_i] = arguments[_i]; - } - return d(f.funcB.apply(f, p)); - }, - funcC: function () { - var p = []; - for (var _i = 0; _i < arguments.length; _i++) { - p[_i] = arguments[_i]; - } - return d(f.funcC.apply(f, p)); - }, -}); }); +const {} = useReduxDispatch1((d, f) => ({ + funcA: (...p) => d(f.funcA(...p)), // p should be inferrable + funcB: (...p) => d(f.funcB(...p)), + funcC: (...p) => d(f.funcC(...p)), +})); diff --git a/tests/baselines/reference/bindingPatternContextualTypeDoesNotCauseWidening.js b/tests/baselines/reference/bindingPatternContextualTypeDoesNotCauseWidening.js index 8ae5cb7067453..7c2e4739dce52 100644 --- a/tests/baselines/reference/bindingPatternContextualTypeDoesNotCauseWidening.js +++ b/tests/baselines/reference/bindingPatternContextualTypeDoesNotCauseWidening.js @@ -7,5 +7,5 @@ const { } = pick(['b'], { a: 'a', b: 'b' }); // T: "b" | "a" ??? (before fix) //// [bindingPatternContextualTypeDoesNotCauseWidening.js] -var _ = pick(['b'], { a: 'a', b: 'b' }); // T: "b" -var _a = pick(['b'], { a: 'a', b: 'b' }); // T: "b" | "a" ??? (before fix) +const _ = pick(['b'], { a: 'a', b: 'b' }); // T: "b" +const {} = pick(['b'], { a: 'a', b: 'b' }); // T: "b" | "a" ??? (before fix) diff --git a/tests/baselines/reference/bindingPatternInParameter01.js b/tests/baselines/reference/bindingPatternInParameter01.js index 5143313b5a720..87797a0a4b723 100644 --- a/tests/baselines/reference/bindingPatternInParameter01.js +++ b/tests/baselines/reference/bindingPatternInParameter01.js @@ -9,8 +9,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]; +const nestedArray = [[[1, 2]], [[3, 4]]]; +nestedArray.forEach(([[a, b]]) => { console.log(a, b); }); diff --git a/tests/baselines/reference/bindingPatternOmittedExpressionNesting.js b/tests/baselines/reference/bindingPatternOmittedExpressionNesting.js index 51e38bc699815..9bf335fc3a54e 100644 --- a/tests/baselines/reference/bindingPatternOmittedExpressionNesting.js +++ b/tests/baselines/reference/bindingPatternOmittedExpressionNesting.js @@ -7,7 +7,7 @@ export let [,,[,[],,[],]] = undefined as any; "use strict"; var _a, _b, _c, _d; Object.defineProperty(exports, "__esModule", { value: true }); -exports._e = (_a = undefined, _b = _a[2], _c = _b[1], _d = _b[3]); +_a = undefined, _b = _a[2], _c = _b[1], _d = _b[3]; //// [bindingPatternOmittedExpressionNesting.d.ts] diff --git a/tests/baselines/reference/binopAssignmentShouldHaveType.js b/tests/baselines/reference/binopAssignmentShouldHaveType.js index 73224a81cc64e..9d7b76f32b667 100644 --- a/tests/baselines/reference/binopAssignmentShouldHaveType.js +++ b/tests/baselines/reference/binopAssignmentShouldHaveType.js @@ -25,19 +25,16 @@ namespace Test { "use strict"; var Test; (function (Test) { - var Bug = /** @class */ (function () { - function Bug() { - } - Bug.prototype.getName = function () { + class Bug { + getName() { return "name"; - }; - Bug.prototype.bug = function () { + } + bug() { var name = null; if ((name = this.getName()).length > 0) { console.log(name); } - }; - return Bug; - }()); + } + } Test.Bug = Bug; })(Test || (Test = {})); diff --git a/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.js b/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.js index eb97d7dfa838a..0025e9e20f321 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.js @@ -70,15 +70,12 @@ function foo() { var a; return a; } -var A = /** @class */ (function () { - function A() { - } - A.foo = function () { +class A { + static foo() { var a; return a; - }; - return A; -}()); + } +} var M; (function (M) { })(M || (M = {})); diff --git a/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js b/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js index cdf0804256f5f..01d2335dbcb49 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js @@ -44,12 +44,9 @@ var ResultIsNumber8 = ~~BOOLEAN; // ~ operator on boolean type var BOOLEAN; function foo() { return true; } -var A = /** @class */ (function () { - function A() { - } - A.foo = function () { return false; }; - return A; -}()); +class A { + static foo() { return false; } +} var M; (function (M) { })(M || (M = {})); diff --git a/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js b/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js index 9a2e3c4944ab9..75b8f45e866dc 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js @@ -51,12 +51,9 @@ var ResultIsNumber13 = ~~~(NUMBER + NUMBER); var NUMBER; var NUMBER1 = [1, 2]; function foo() { return 1; } -var A = /** @class */ (function () { - function A() { - } - A.foo = function () { return 1; }; - return A; -}()); +class A { + static foo() { return 1; } +} var M; (function (M) { })(M || (M = {})); @@ -67,7 +64,7 @@ var ResultIsNumber2 = ~NUMBER1; // number type literal var ResultIsNumber3 = ~1; var ResultIsNumber4 = ~{ x: 1, y: 2 }; -var ResultIsNumber5 = ~{ x: 1, y: function (n) { return n; } }; +var ResultIsNumber5 = ~{ x: 1, y: (n) => { return n; } }; // number type expressions var ResultIsNumber6 = ~objA.a; var ResultIsNumber7 = ~M.n; diff --git a/tests/baselines/reference/bitwiseNotOperatorWithStringType.js b/tests/baselines/reference/bitwiseNotOperatorWithStringType.js index 2beff97a1527d..dbf70c514214e 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithStringType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithStringType.js @@ -50,12 +50,9 @@ var ResultIsNumber14 = ~~~(STRING + STRING); var STRING; var STRING1 = ["", "abc"]; function foo() { return "abc"; } -var A = /** @class */ (function () { - function A() { - } - A.foo = function () { return ""; }; - return A; -}()); +class A { + static foo() { return ""; } +} var M; (function (M) { })(M || (M = {})); @@ -66,7 +63,7 @@ var ResultIsNumber2 = ~STRING1; // string type literal var ResultIsNumber3 = ~""; var ResultIsNumber4 = ~{ x: "", y: "" }; -var ResultIsNumber5 = ~{ x: "", y: function (s) { return s; } }; +var ResultIsNumber5 = ~{ x: "", y: (s) => { return s; } }; // string type expressions var ResultIsNumber6 = ~objA.a; var ResultIsNumber7 = ~M.n; diff --git a/tests/baselines/reference/bivariantInferences.js b/tests/baselines/reference/bivariantInferences.js index efc3bdb6d0613..bfee4ecc6b47e 100644 --- a/tests/baselines/reference/bivariantInferences.js +++ b/tests/baselines/reference/bivariantInferences.js @@ -16,4 +16,4 @@ let x = a.equalsShallow(b); //// [bivariantInferences.js] "use strict"; // Repro from #27337 -var x = a.equalsShallow(b); +let x = a.equalsShallow(b); diff --git a/tests/baselines/reference/blockScopedBindingCaptureThisInFunction.js b/tests/baselines/reference/blockScopedBindingCaptureThisInFunction.js index fe81e6e7e09b0..4661f68d1892b 100644 --- a/tests/baselines/reference/blockScopedBindingCaptureThisInFunction.js +++ b/tests/baselines/reference/blockScopedBindingCaptureThisInFunction.js @@ -11,13 +11,9 @@ //// [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 () { + for (let someKey in {}) { + this.helloWorld(); + () => someKey; } -}; }); +}; diff --git a/tests/baselines/reference/blockScopedBindingUsedBeforeDef.js b/tests/baselines/reference/blockScopedBindingUsedBeforeDef.js index 07650b4e9b4aa..12cffa7411c9c 100644 --- a/tests/baselines/reference/blockScopedBindingUsedBeforeDef.js +++ b/tests/baselines/reference/blockScopedBindingUsedBeforeDef.js @@ -12,12 +12,10 @@ let {[b]: b} = { }; //// [blockScopedBindingUsedBeforeDef.js] // 1: -for (var _i = 0, _a = [{}]; _i < _a.length; _i++) { - var _b = a, a = _a[_i][_b]; +for (let { [a]: a } of [{}]) continue; -} // 2: -for (var _c = {}, _d = a, a = _c[_d]; false;) +for (let { [a]: a } = {}; false;) continue; // 3: -var _e = {}, _f = b, b = _e[_f]; +let { [b]: b } = {}; diff --git a/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator(target=es2015).js b/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator(target=es2015).js new file mode 100644 index 0000000000000..4e21b13090159 --- /dev/null +++ b/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator(target=es2015).js @@ -0,0 +1,17 @@ +//// [tests/cases/compiler/blockScopedBindingsInDownlevelGenerator.ts] //// + +//// [blockScopedBindingsInDownlevelGenerator.ts] +function* a() { + for (const i of [1,2,3]) { + (() => i)() + yield i + } +} + +//// [blockScopedBindingsInDownlevelGenerator.js] +function* a() { + for (const i of [1, 2, 3]) { + (() => i)(); + yield i; + } +} diff --git a/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.symbols b/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.symbols rename to tests/baselines/reference/blockScopedBindingsInDownlevelGenerator(target=es2015).symbols diff --git a/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.types b/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator(target=es2015).types similarity index 100% rename from tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.types rename to tests/baselines/reference/blockScopedBindingsInDownlevelGenerator(target=es2015).types diff --git a/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.js b/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator(target=es5).js similarity index 100% rename from tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.js rename to tests/baselines/reference/blockScopedBindingsInDownlevelGenerator(target=es5).js diff --git a/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator(target=es5).symbols b/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator(target=es5).symbols new file mode 100644 index 0000000000000..8b906350c4f2f --- /dev/null +++ b/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator(target=es5).symbols @@ -0,0 +1,16 @@ +//// [tests/cases/compiler/blockScopedBindingsInDownlevelGenerator.ts] //// + +=== blockScopedBindingsInDownlevelGenerator.ts === +function* a() { +>a : Symbol(a, Decl(blockScopedBindingsInDownlevelGenerator.ts, 0, 0)) + + for (const i of [1,2,3]) { +>i : Symbol(i, Decl(blockScopedBindingsInDownlevelGenerator.ts, 1, 12)) + + (() => i)() +>i : Symbol(i, Decl(blockScopedBindingsInDownlevelGenerator.ts, 1, 12)) + + yield i +>i : Symbol(i, Decl(blockScopedBindingsInDownlevelGenerator.ts, 1, 12)) + } +} diff --git a/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator(target=es5).types b/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator(target=es5).types new file mode 100644 index 0000000000000..957f447f8e574 --- /dev/null +++ b/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator(target=es5).types @@ -0,0 +1,35 @@ +//// [tests/cases/compiler/blockScopedBindingsInDownlevelGenerator.ts] //// + +=== blockScopedBindingsInDownlevelGenerator.ts === +function* a() { +>a : () => Generator +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + for (const i of [1,2,3]) { +>i : number +> : ^^^^^^ +>[1,2,3] : number[] +> : ^^^^^^^^ +>1 : 1 +> : ^ +>2 : 2 +> : ^ +>3 : 3 +> : ^ + + (() => i)() +>(() => i)() : number +> : ^^^^^^ +>(() => i) : () => number +> : ^^^^^^^^^^^^ +>() => i : () => number +> : ^^^^^^^^^^^^ +>i : number +> : ^^^^^^ + + yield i +>yield i : any +>i : number +> : ^^^^^^ + } +} diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop1.js b/tests/baselines/reference/blockScopedBindingsReassignedInLoop1.js index c7176a5e729b3..11519f936a5c0 100644 --- a/tests/baselines/reference/blockScopedBindingsReassignedInLoop1.js +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop1.js @@ -12,13 +12,7 @@ declare function use(n: number): void; //// [blockScopedBindingsReassignedInLoop1.js] (function () { 'use strict'; - var _loop_1 = function (i) { - (function () { return use(++i); })(); - out_i_1 = i; - }; - var out_i_1; - for (var i = 0; i < 9; ++i) { - _loop_1(i); - i = out_i_1; + for (let i = 0; i < 9; ++i) { + (() => use(++i))(); } })(); diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop2.js b/tests/baselines/reference/blockScopedBindingsReassignedInLoop2.js index 06e143d98c62f..f746972a964f5 100644 --- a/tests/baselines/reference/blockScopedBindingsReassignedInLoop2.js +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop2.js @@ -44,79 +44,39 @@ for (let x = 1, y = 2; x < y; ++x, --y) { } //// [blockScopedBindingsReassignedInLoop2.js] -var _loop_1 = function (x, y) { - var a = function () { return x++ + y++; }; +for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; if (x == 1) { - return out_x_1 = x, out_y_1 = y, "break"; + break; } else { y = 5; } - out_x_1 = x; - out_y_1 = y; -}; -var out_x_1, out_y_1; -for (var x = 1, y = 2; x < y; ++x, --y) { - var state_1 = _loop_1(x, y); - x = out_x_1; - y = out_y_1; - if (state_1 === "break") - break; } -var _loop_2 = function (x, y) { - var a = function () { return x++ + y++; }; +for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; if (x == 1) { - return out_x_2 = x, out_y_2 = y, "continue"; + continue; } else { y = 5; } - out_x_2 = x; - out_y_2 = y; -}; -var out_x_2, out_y_2; -for (var x = 1, y = 2; x < y; ++x, --y) { - _loop_2(x, y); - x = out_x_2; - y = out_y_2; } -var _loop_3 = function (x, y) { - var a = function () { return x++ + y++; }; +loop: for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; if (x == 1) { - return out_x_3 = x, out_y_3 = y, "break-loop"; + break loop; } else { y = 5; } - out_x_3 = x; - out_y_3 = y; -}; -var out_x_3, out_y_3; -loop: for (var x = 1, y = 2; x < y; ++x, --y) { - var state_2 = _loop_3(x, y); - x = out_x_3; - y = out_y_3; - switch (state_2) { - case "break-loop": break loop; - } } -var _loop_4 = function (x, y) { - var a = function () { return x++ + y++; }; +loop: for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; if (x == 1) { - return out_x_4 = x, out_y_4 = y, "continue-loop"; + continue loop; } else { y = 5; } - out_x_4 = x; - out_y_4 = y; -}; -var out_x_4, out_y_4; -loop: for (var x = 1, y = 2; x < y; ++x, --y) { - var state_3 = _loop_4(x, y); - x = out_x_4; - y = out_y_4; - switch (state_3) { - case "continue-loop": continue loop; - } } diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop3.js b/tests/baselines/reference/blockScopedBindingsReassignedInLoop3.js index 047f6b23382ff..ad3c931bb3af4 100644 --- a/tests/baselines/reference/blockScopedBindingsReassignedInLoop3.js +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop3.js @@ -94,155 +94,81 @@ for (let x = 1, y = 2; x < y; ++x, --y) { //// [blockScopedBindingsReassignedInLoop3.js] -var _loop_1 = function (x, y) { - var a = function () { return x++ + y++; }; +for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; if (x == 1) { - return out_x_1 = x, out_y_1 = y, "break"; + break; } else { - var _loop_5 = function (a_1) { - var f = function () { return a_1; }; - if (a_1) { - a_1 = x; - return out_a_1 = a_1, "break"; + for (let a = 1; a < 5; --a) { + let f = () => a; + if (a) { + a = x; + break; } else { y++; } - out_a_1 = a_1; - }; - var out_a_1; - for (var a_1 = 1; a_1 < 5; --a_1) { - var state_4 = _loop_5(a_1); - a_1 = out_a_1; - if (state_4 === "break") - break; } y = 5; } - out_x_1 = x; - out_y_1 = y; -}; -var out_x_1, out_y_1; -for (var x = 1, y = 2; x < y; ++x, --y) { - var state_1 = _loop_1(x, y); - x = out_x_1; - y = out_y_1; - if (state_1 === "break") - break; } -var _loop_2 = function (x, y) { - var a = function () { return x++ + y++; }; +for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; if (x == 1) { - return out_x_2 = x, out_y_2 = y, "continue"; + continue; } else { - var _loop_6 = function (a_2) { - var f = function () { return a_2; }; - if (a_2) { - a_2 = x; - return out_a_2 = a_2, "continue"; + for (let a = 1; a < 5; --a) { + let f = () => a; + if (a) { + a = x; + continue; } else { y++; } - out_a_2 = a_2; - }; - var out_a_2; - for (var a_2 = 1; a_2 < 5; --a_2) { - _loop_6(a_2); - a_2 = out_a_2; } y = 5; } - out_x_2 = x; - out_y_2 = y; -}; -var out_x_2, out_y_2; -for (var x = 1, y = 2; x < y; ++x, --y) { - _loop_2(x, y); - x = out_x_2; - y = out_y_2; } -var _loop_3 = function (x, y) { - var a = function () { return x++ + y++; }; +loop2: for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; if (x == 1) { - return out_x_3 = x, out_y_3 = y, "break-loop2"; + break loop2; } else { - var _loop_7 = function (a_3) { - var f = function () { return a_3; }; - if (a_3) { - a_3 = x; - return out_a_3 = a_3, "break-loop1"; + loop1: for (let a = 1; a < 5; --a) { + let f = () => a; + if (a) { + a = x; + break loop1; } else { y++; - return out_a_3 = a_3, "break-loop2"; - } - out_a_3 = a_3; - }; - var out_a_3; - loop1: for (var a_3 = 1; a_3 < 5; --a_3) { - var state_5 = _loop_7(a_3); - a_3 = out_a_3; - switch (state_5) { - case "break-loop1": break loop1; - case "break-loop2": return state_5; + break loop2; } } y = 5; } - out_x_3 = x; - out_y_3 = y; -}; -var out_x_3, out_y_3; -loop2: for (var x = 1, y = 2; x < y; ++x, --y) { - var state_2 = _loop_3(x, y); - x = out_x_3; - y = out_y_3; - switch (state_2) { - case "break-loop2": break loop2; - } } -var _loop_4 = function (x, y) { - var a = function () { return x++ + y++; }; +loop2: for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; if (x == 1) { - return out_x_4 = x, out_y_4 = y, "continue-loop2"; + continue loop2; } else { - var _loop_8 = function (a_4) { - var f = function () { return a_4; }; - if (a_4) { - a_4 = x; - return out_a_4 = a_4, "continue-loop1"; + loop1: for (let a = 1; a < 5; --a) { + let f = () => a; + if (a) { + a = x; + continue loop1; } else { y++; - return out_a_4 = a_4, "continue-loop2"; - } - out_a_4 = a_4; - }; - var out_a_4; - loop1: for (var a_4 = 1; a_4 < 5; --a_4) { - var state_6 = _loop_8(a_4); - a_4 = out_a_4; - switch (state_6) { - case "continue-loop1": continue loop1; - case "continue-loop2": return state_6; + continue loop2; } } y = 5; } - out_x_4 = x; - out_y_4 = y; -}; -var out_x_4, out_y_4; -loop2: for (var x = 1, y = 2; x < y; ++x, --y) { - var state_3 = _loop_4(x, y); - x = out_x_4; - y = out_y_4; - switch (state_3) { - case "continue-loop2": continue loop2; - } } diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop4.js b/tests/baselines/reference/blockScopedBindingsReassignedInLoop4.js index d120cfd020c34..50ee906529c16 100644 --- a/tests/baselines/reference/blockScopedBindingsReassignedInLoop4.js +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop4.js @@ -15,23 +15,13 @@ function f1() { //// [blockScopedBindingsReassignedInLoop4.js] function f1() { - var _loop_1 = function (x, y) { - var a = function () { return x++ + y++; }; + for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; if (x == 1) { - return { value: 1 }; + return 1; } else { y = 5; } - out_x_1 = x; - out_y_1 = y; - }; - var out_x_1, out_y_1; - for (var x = 1, y = 2; x < y; ++x, --y) { - var state_1 = _loop_1(x, y); - x = out_x_1; - y = out_y_1; - if (typeof state_1 === "object") - return state_1.value; } } diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop5.js b/tests/baselines/reference/blockScopedBindingsReassignedInLoop5.js index 997ae3518c087..d1ac139c4f9fe 100644 --- a/tests/baselines/reference/blockScopedBindingsReassignedInLoop5.js +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop5.js @@ -11,20 +11,10 @@ for (let x = 1, y = 2; x < y; ++x, --y) { //// [blockScopedBindingsReassignedInLoop5.js] -var _loop_1 = function (x, y) { - var a = function () { return x++ + y++; }; +for (let x = 1, y = 2; x < y; ++x, --y) { + let a = () => x++ + y++; if (x == 1) - return out_x_1 = x, out_y_1 = y, "break"; + break; else y = 5; - out_x_1 = x; - out_y_1 = y; -}; -var out_x_1, out_y_1; -for (var x = 1, y = 2; x < y; ++x, --y) { - var state_1 = _loop_1(x, y); - x = out_x_1; - y = out_y_1; - if (state_1 === "break") - break; } diff --git a/tests/baselines/reference/blockScopedBindingsReassignedInLoop6.js b/tests/baselines/reference/blockScopedBindingsReassignedInLoop6.js index fbf0fda7da598..c8df362616bef 100644 --- a/tests/baselines/reference/blockScopedBindingsReassignedInLoop6.js +++ b/tests/baselines/reference/blockScopedBindingsReassignedInLoop6.js @@ -33,48 +33,24 @@ function f2() { //// [blockScopedBindingsReassignedInLoop6.js] function f1() { - var _loop_1 = function (x, y) { - var a = function () { return x++ + y++; }; + for (let [x, y] = [1, 2]; x < y; ++x, --y) { + let a = () => x++ + y++; if (x == 1) - return out_x_1 = x, out_y_1 = y, "break"; + break; else if (y == 2) y = 5; else - return { value: void 0 }; - out_x_1 = x; - out_y_1 = y; - }; - var out_x_1, out_y_1; - for (var _a = [1, 2], x = _a[0], y = _a[1]; x < y; ++x, --y) { - var state_1 = _loop_1(x, y); - x = out_x_1; - y = out_y_1; - if (typeof state_1 === "object") - return state_1.value; - if (state_1 === "break") - break; + return; } } function f2() { - var _loop_2 = function (x, y) { - var a = function () { return x++ + y++; }; + for (let [{ a: x, b: { c: y } }] = [{ a: 1, b: { c: 2 } }]; x < y; ++x, --y) { + let a = () => x++ + y++; if (x == 1) - return out_x_2 = x, out_y_2 = y, "break"; + break; else if (y == 2) y = 5; else - return { value: void 0 }; - out_x_2 = x; - out_y_2 = y; - }; - var out_x_2, out_y_2; - for (var _a = [{ a: 1, b: { c: 2 } }][0], x = _a.a, y = _a.b.c; x < y; ++x, --y) { - var state_2 = _loop_2(x, y); - x = out_x_2; - y = out_y_2; - if (typeof state_2 === "object") - return state_2.value; - if (state_2 === "break") - break; + return; } } diff --git a/tests/baselines/reference/blockScopedClassDeclarationAcrossFiles.js b/tests/baselines/reference/blockScopedClassDeclarationAcrossFiles.js index 6559548ddff28..199d4cc08d6c5 100644 --- a/tests/baselines/reference/blockScopedClassDeclarationAcrossFiles.js +++ b/tests/baselines/reference/blockScopedClassDeclarationAcrossFiles.js @@ -7,9 +7,6 @@ class C { } //// [foo.js] -var foo; -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +let foo; +class C { +} diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef.errors.txt b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef.errors.txt rename to tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef(target=es2015).errors.txt diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef(target=es2015).js b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef(target=es2015).js new file mode 100644 index 0000000000000..1ce3d754926d0 --- /dev/null +++ b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef(target=es2015).js @@ -0,0 +1,36 @@ +//// [tests/cases/compiler/blockScopedEnumVariablesUseBeforeDef.ts] //// + +//// [blockScopedEnumVariablesUseBeforeDef.ts] +function foo1() { + return E.A + enum E { A } +} + +function foo2() { + return E.A + const enum E { A } +} + +const config = { + a: AfterObject.A, +}; + +const enum AfterObject { + A = 2, +} + + +//// [blockScopedEnumVariablesUseBeforeDef.js] +function foo1() { + return E.A; + let E; + (function (E) { + E[E["A"] = 0] = "A"; + })(E || (E = {})); +} +function foo2() { + return 0 /* E.A */; +} +const config = { + a: 2 /* AfterObject.A */, +}; diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef.symbols b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef.symbols rename to tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef(target=es2015).symbols diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef.types b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef(target=es2015).types similarity index 100% rename from tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef.types rename to tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef(target=es2015).types diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef(target=es5).errors.txt b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef(target=es5).errors.txt new file mode 100644 index 0000000000000..1b67e080e243f --- /dev/null +++ b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef(target=es5).errors.txt @@ -0,0 +1,25 @@ +blockScopedEnumVariablesUseBeforeDef.ts(2,12): error TS2450: Enum 'E' used before its declaration. + + +==== blockScopedEnumVariablesUseBeforeDef.ts (1 errors) ==== + function foo1() { + return E.A + ~ +!!! error TS2450: Enum 'E' used before its declaration. +!!! related TS2728 blockScopedEnumVariablesUseBeforeDef.ts:3:10: 'E' is declared here. + enum E { A } + } + + function foo2() { + return E.A + const enum E { A } + } + + const config = { + a: AfterObject.A, + }; + + const enum AfterObject { + A = 2, + } + \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef.js b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef(target=es5).js similarity index 100% rename from tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef.js rename to tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef(target=es5).js diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef(target=es5).symbols b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef(target=es5).symbols new file mode 100644 index 0000000000000..6542daff85e3a --- /dev/null +++ b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef(target=es5).symbols @@ -0,0 +1,47 @@ +//// [tests/cases/compiler/blockScopedEnumVariablesUseBeforeDef.ts] //// + +=== blockScopedEnumVariablesUseBeforeDef.ts === +function foo1() { +>foo1 : Symbol(foo1, Decl(blockScopedEnumVariablesUseBeforeDef.ts, 0, 0)) + + return E.A +>E.A : Symbol(E.A, Decl(blockScopedEnumVariablesUseBeforeDef.ts, 2, 12)) +>E : Symbol(E, Decl(blockScopedEnumVariablesUseBeforeDef.ts, 1, 14)) +>A : Symbol(E.A, Decl(blockScopedEnumVariablesUseBeforeDef.ts, 2, 12)) + + enum E { A } +>E : Symbol(E, Decl(blockScopedEnumVariablesUseBeforeDef.ts, 1, 14)) +>A : Symbol(E.A, Decl(blockScopedEnumVariablesUseBeforeDef.ts, 2, 12)) +} + +function foo2() { +>foo2 : Symbol(foo2, Decl(blockScopedEnumVariablesUseBeforeDef.ts, 3, 1)) + + return E.A +>E.A : Symbol(E.A, Decl(blockScopedEnumVariablesUseBeforeDef.ts, 7, 18)) +>E : Symbol(E, Decl(blockScopedEnumVariablesUseBeforeDef.ts, 6, 14)) +>A : Symbol(E.A, Decl(blockScopedEnumVariablesUseBeforeDef.ts, 7, 18)) + + const enum E { A } +>E : Symbol(E, Decl(blockScopedEnumVariablesUseBeforeDef.ts, 6, 14)) +>A : Symbol(E.A, Decl(blockScopedEnumVariablesUseBeforeDef.ts, 7, 18)) +} + +const config = { +>config : Symbol(config, Decl(blockScopedEnumVariablesUseBeforeDef.ts, 10, 5)) + + a: AfterObject.A, +>a : Symbol(a, Decl(blockScopedEnumVariablesUseBeforeDef.ts, 10, 16)) +>AfterObject.A : Symbol(AfterObject.A, Decl(blockScopedEnumVariablesUseBeforeDef.ts, 14, 24)) +>AfterObject : Symbol(AfterObject, Decl(blockScopedEnumVariablesUseBeforeDef.ts, 12, 2)) +>A : Symbol(AfterObject.A, Decl(blockScopedEnumVariablesUseBeforeDef.ts, 14, 24)) + +}; + +const enum AfterObject { +>AfterObject : Symbol(AfterObject, Decl(blockScopedEnumVariablesUseBeforeDef.ts, 12, 2)) + + A = 2, +>A : Symbol(AfterObject.A, Decl(blockScopedEnumVariablesUseBeforeDef.ts, 14, 24)) +} + diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef(target=es5).types b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef(target=es5).types new file mode 100644 index 0000000000000..9babd7acd70f4 --- /dev/null +++ b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef(target=es5).types @@ -0,0 +1,70 @@ +//// [tests/cases/compiler/blockScopedEnumVariablesUseBeforeDef.ts] //// + +=== blockScopedEnumVariablesUseBeforeDef.ts === +function foo1() { +>foo1 : () => E +> : ^^^^^^^ + + return E.A +>E.A : E +> : ^ +>E : typeof E +> : ^^^^^^^^ +>A : E +> : ^ + + enum E { A } +>E : E +> : ^ +>A : E.A +> : ^^^ +} + +function foo2() { +>foo2 : () => E +> : ^^^^^^^ + + return E.A +>E.A : E +> : ^ +>E : typeof E +> : ^^^^^^^^ +>A : E +> : ^ + + const enum E { A } +>E : E +> : ^ +>A : E.A +> : ^^^ +} + +const config = { +>config : { a: AfterObject; } +> : ^^^^^^^^^^^^^^^^^^^ +>{ a: AfterObject.A,} : { a: AfterObject; } +> : ^^^^^^^^^^^^^^^^^^^ + + a: AfterObject.A, +>a : AfterObject +> : ^^^^^^^^^^^ +>AfterObject.A : AfterObject +> : ^^^^^^^^^^^ +>AfterObject : typeof AfterObject +> : ^^^^^^^^^^^^^^^^^^ +>A : AfterObject +> : ^^^^^^^^^^^ + +}; + +const enum AfterObject { +>AfterObject : AfterObject +> : ^^^^^^^^^^^ + + A = 2, +>A : AfterObject.A +> : ^^^^^^^^^^^^^ +>2 : 2 +> : ^ +} + diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules.errors.txt b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules.errors.txt rename to tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules(target=es2015).errors.txt diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules(target=es2015).js b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules(target=es2015).js new file mode 100644 index 0000000000000..1602bbaa6f156 --- /dev/null +++ b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules(target=es2015).js @@ -0,0 +1,44 @@ +//// [tests/cases/compiler/blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts] //// + +//// [blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts] +function foo1() { + return E.A + enum E { A } +} + +function foo2() { + return E.A + const enum E { A } +} + +const config = { + a: AfterObject.A, +}; + +const enum AfterObject { + A = 2, +} + + +//// [blockScopedEnumVariablesUseBeforeDef_isolatedModules.js] +function foo1() { + return E.A; + let E; + (function (E) { + E[E["A"] = 0] = "A"; + })(E || (E = {})); +} +function foo2() { + return E.A; + let E; + (function (E) { + E[E["A"] = 0] = "A"; + })(E || (E = {})); +} +const config = { + a: AfterObject.A, +}; +var AfterObject; +(function (AfterObject) { + AfterObject[AfterObject["A"] = 2] = "A"; +})(AfterObject || (AfterObject = {})); diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules.symbols b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules.symbols rename to tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules(target=es2015).symbols diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules.types b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules(target=es2015).types similarity index 100% rename from tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules.types rename to tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules(target=es2015).types diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules(target=es5).errors.txt b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules(target=es5).errors.txt new file mode 100644 index 0000000000000..99a0a42f86099 --- /dev/null +++ b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules(target=es5).errors.txt @@ -0,0 +1,33 @@ +blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts(2,12): error TS2450: Enum 'E' used before its declaration. +blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts(7,12): error TS2450: Enum 'E' used before its declaration. +blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts(12,8): error TS2450: Enum 'AfterObject' used before its declaration. + + +==== blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts (3 errors) ==== + function foo1() { + return E.A + ~ +!!! error TS2450: Enum 'E' used before its declaration. +!!! related TS2728 blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts:3:10: 'E' is declared here. + enum E { A } + } + + function foo2() { + return E.A + ~ +!!! error TS2450: Enum 'E' used before its declaration. +!!! related TS2728 blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts:8:16: 'E' is declared here. + const enum E { A } + } + + const config = { + a: AfterObject.A, + ~~~~~~~~~~~ +!!! error TS2450: Enum 'AfterObject' used before its declaration. +!!! related TS2728 blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts:15:12: 'AfterObject' is declared here. + }; + + const enum AfterObject { + A = 2, + } + \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules.js b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules(target=es5).js similarity index 100% rename from tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules.js rename to tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules(target=es5).js diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules(target=es5).symbols b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules(target=es5).symbols new file mode 100644 index 0000000000000..2269e82f4fc8f --- /dev/null +++ b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules(target=es5).symbols @@ -0,0 +1,47 @@ +//// [tests/cases/compiler/blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts] //// + +=== blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts === +function foo1() { +>foo1 : Symbol(foo1, Decl(blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts, 0, 0)) + + return E.A +>E.A : Symbol(E.A, Decl(blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts, 2, 12)) +>E : Symbol(E, Decl(blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts, 1, 14)) +>A : Symbol(E.A, Decl(blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts, 2, 12)) + + enum E { A } +>E : Symbol(E, Decl(blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts, 1, 14)) +>A : Symbol(E.A, Decl(blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts, 2, 12)) +} + +function foo2() { +>foo2 : Symbol(foo2, Decl(blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts, 3, 1)) + + return E.A +>E.A : Symbol(E.A, Decl(blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts, 7, 18)) +>E : Symbol(E, Decl(blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts, 6, 14)) +>A : Symbol(E.A, Decl(blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts, 7, 18)) + + const enum E { A } +>E : Symbol(E, Decl(blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts, 6, 14)) +>A : Symbol(E.A, Decl(blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts, 7, 18)) +} + +const config = { +>config : Symbol(config, Decl(blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts, 10, 5)) + + a: AfterObject.A, +>a : Symbol(a, Decl(blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts, 10, 16)) +>AfterObject.A : Symbol(AfterObject.A, Decl(blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts, 14, 24)) +>AfterObject : Symbol(AfterObject, Decl(blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts, 12, 2)) +>A : Symbol(AfterObject.A, Decl(blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts, 14, 24)) + +}; + +const enum AfterObject { +>AfterObject : Symbol(AfterObject, Decl(blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts, 12, 2)) + + A = 2, +>A : Symbol(AfterObject.A, Decl(blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts, 14, 24)) +} + diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules(target=es5).types b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules(target=es5).types new file mode 100644 index 0000000000000..f0716c8c34fc4 --- /dev/null +++ b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_isolatedModules(target=es5).types @@ -0,0 +1,70 @@ +//// [tests/cases/compiler/blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts] //// + +=== blockScopedEnumVariablesUseBeforeDef_isolatedModules.ts === +function foo1() { +>foo1 : () => E +> : ^^^^^^^ + + return E.A +>E.A : E +> : ^ +>E : typeof E +> : ^^^^^^^^ +>A : E +> : ^ + + enum E { A } +>E : E +> : ^ +>A : E.A +> : ^^^ +} + +function foo2() { +>foo2 : () => E +> : ^^^^^^^ + + return E.A +>E.A : E +> : ^ +>E : typeof E +> : ^^^^^^^^ +>A : E +> : ^ + + const enum E { A } +>E : E +> : ^ +>A : E.A +> : ^^^ +} + +const config = { +>config : { a: AfterObject; } +> : ^^^^^^^^^^^^^^^^^^^ +>{ a: AfterObject.A,} : { a: AfterObject; } +> : ^^^^^^^^^^^^^^^^^^^ + + a: AfterObject.A, +>a : AfterObject +> : ^^^^^^^^^^^ +>AfterObject.A : AfterObject +> : ^^^^^^^^^^^ +>AfterObject : typeof AfterObject +> : ^^^^^^^^^^^^^^^^^^ +>A : AfterObject +> : ^^^^^^^^^^^ + +}; + +const enum AfterObject { +>AfterObject : AfterObject +> : ^^^^^^^^^^^ + + A = 2, +>A : AfterObject.A +> : ^^^^^^^^^^^^^ +>2 : 2 +> : ^ +} + diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve.errors.txt b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve.errors.txt rename to tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve(target=es2015).errors.txt diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve(target=es2015).js b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve(target=es2015).js new file mode 100644 index 0000000000000..232102d52d865 --- /dev/null +++ b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve(target=es2015).js @@ -0,0 +1,44 @@ +//// [tests/cases/compiler/blockScopedEnumVariablesUseBeforeDef_preserve.ts] //// + +//// [blockScopedEnumVariablesUseBeforeDef_preserve.ts] +function foo1() { + return E.A + enum E { A } +} + +function foo2() { + return E.A + const enum E { A } +} + +const config = { + a: AfterObject.A, +}; + +const enum AfterObject { + A = 2, +} + + +//// [blockScopedEnumVariablesUseBeforeDef_preserve.js] +function foo1() { + return E.A; + let E; + (function (E) { + E[E["A"] = 0] = "A"; + })(E || (E = {})); +} +function foo2() { + return 0 /* E.A */; + let E; + (function (E) { + E[E["A"] = 0] = "A"; + })(E || (E = {})); +} +const config = { + a: 2 /* AfterObject.A */, +}; +var AfterObject; +(function (AfterObject) { + AfterObject[AfterObject["A"] = 2] = "A"; +})(AfterObject || (AfterObject = {})); diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve.symbols b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve.symbols rename to tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve(target=es2015).symbols diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve.types b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve(target=es2015).types similarity index 100% rename from tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve.types rename to tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve(target=es2015).types diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve(target=es5).errors.txt b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve(target=es5).errors.txt new file mode 100644 index 0000000000000..f5d55337e5395 --- /dev/null +++ b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve(target=es5).errors.txt @@ -0,0 +1,25 @@ +blockScopedEnumVariablesUseBeforeDef_preserve.ts(2,12): error TS2450: Enum 'E' used before its declaration. + + +==== blockScopedEnumVariablesUseBeforeDef_preserve.ts (1 errors) ==== + function foo1() { + return E.A + ~ +!!! error TS2450: Enum 'E' used before its declaration. +!!! related TS2728 blockScopedEnumVariablesUseBeforeDef_preserve.ts:3:10: 'E' is declared here. + enum E { A } + } + + function foo2() { + return E.A + const enum E { A } + } + + const config = { + a: AfterObject.A, + }; + + const enum AfterObject { + A = 2, + } + \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve.js b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve(target=es5).js similarity index 100% rename from tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve.js rename to tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve(target=es5).js diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve(target=es5).symbols b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve(target=es5).symbols new file mode 100644 index 0000000000000..d90149cf7b8a0 --- /dev/null +++ b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve(target=es5).symbols @@ -0,0 +1,47 @@ +//// [tests/cases/compiler/blockScopedEnumVariablesUseBeforeDef_preserve.ts] //// + +=== blockScopedEnumVariablesUseBeforeDef_preserve.ts === +function foo1() { +>foo1 : Symbol(foo1, Decl(blockScopedEnumVariablesUseBeforeDef_preserve.ts, 0, 0)) + + return E.A +>E.A : Symbol(E.A, Decl(blockScopedEnumVariablesUseBeforeDef_preserve.ts, 2, 12)) +>E : Symbol(E, Decl(blockScopedEnumVariablesUseBeforeDef_preserve.ts, 1, 14)) +>A : Symbol(E.A, Decl(blockScopedEnumVariablesUseBeforeDef_preserve.ts, 2, 12)) + + enum E { A } +>E : Symbol(E, Decl(blockScopedEnumVariablesUseBeforeDef_preserve.ts, 1, 14)) +>A : Symbol(E.A, Decl(blockScopedEnumVariablesUseBeforeDef_preserve.ts, 2, 12)) +} + +function foo2() { +>foo2 : Symbol(foo2, Decl(blockScopedEnumVariablesUseBeforeDef_preserve.ts, 3, 1)) + + return E.A +>E.A : Symbol(E.A, Decl(blockScopedEnumVariablesUseBeforeDef_preserve.ts, 7, 18)) +>E : Symbol(E, Decl(blockScopedEnumVariablesUseBeforeDef_preserve.ts, 6, 14)) +>A : Symbol(E.A, Decl(blockScopedEnumVariablesUseBeforeDef_preserve.ts, 7, 18)) + + const enum E { A } +>E : Symbol(E, Decl(blockScopedEnumVariablesUseBeforeDef_preserve.ts, 6, 14)) +>A : Symbol(E.A, Decl(blockScopedEnumVariablesUseBeforeDef_preserve.ts, 7, 18)) +} + +const config = { +>config : Symbol(config, Decl(blockScopedEnumVariablesUseBeforeDef_preserve.ts, 10, 5)) + + a: AfterObject.A, +>a : Symbol(a, Decl(blockScopedEnumVariablesUseBeforeDef_preserve.ts, 10, 16)) +>AfterObject.A : Symbol(AfterObject.A, Decl(blockScopedEnumVariablesUseBeforeDef_preserve.ts, 14, 24)) +>AfterObject : Symbol(AfterObject, Decl(blockScopedEnumVariablesUseBeforeDef_preserve.ts, 12, 2)) +>A : Symbol(AfterObject.A, Decl(blockScopedEnumVariablesUseBeforeDef_preserve.ts, 14, 24)) + +}; + +const enum AfterObject { +>AfterObject : Symbol(AfterObject, Decl(blockScopedEnumVariablesUseBeforeDef_preserve.ts, 12, 2)) + + A = 2, +>A : Symbol(AfterObject.A, Decl(blockScopedEnumVariablesUseBeforeDef_preserve.ts, 14, 24)) +} + diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve(target=es5).types b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve(target=es5).types new file mode 100644 index 0000000000000..ad540e031d0bd --- /dev/null +++ b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_preserve(target=es5).types @@ -0,0 +1,70 @@ +//// [tests/cases/compiler/blockScopedEnumVariablesUseBeforeDef_preserve.ts] //// + +=== blockScopedEnumVariablesUseBeforeDef_preserve.ts === +function foo1() { +>foo1 : () => E +> : ^^^^^^^ + + return E.A +>E.A : E +> : ^ +>E : typeof E +> : ^^^^^^^^ +>A : E +> : ^ + + enum E { A } +>E : E +> : ^ +>A : E.A +> : ^^^ +} + +function foo2() { +>foo2 : () => E +> : ^^^^^^^ + + return E.A +>E.A : E +> : ^ +>E : typeof E +> : ^^^^^^^^ +>A : E +> : ^ + + const enum E { A } +>E : E +> : ^ +>A : E.A +> : ^^^ +} + +const config = { +>config : { a: AfterObject; } +> : ^^^^^^^^^^^^^^^^^^^ +>{ a: AfterObject.A,} : { a: AfterObject; } +> : ^^^^^^^^^^^^^^^^^^^ + + a: AfterObject.A, +>a : AfterObject +> : ^^^^^^^^^^^ +>AfterObject.A : AfterObject +> : ^^^^^^^^^^^ +>AfterObject : typeof AfterObject +> : ^^^^^^^^^^^^^^^^^^ +>A : AfterObject +> : ^^^^^^^^^^^ + +}; + +const enum AfterObject { +>AfterObject : AfterObject +> : ^^^^^^^^^^^ + + A = 2, +>A : AfterObject.A +> : ^^^^^^^^^^^^^ +>2 : 2 +> : ^ +} + diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.errors.txt b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.errors.txt rename to tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax(target=es2015).errors.txt diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax(target=es2015).js b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax(target=es2015).js new file mode 100644 index 0000000000000..508dc616c145b --- /dev/null +++ b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax(target=es2015).js @@ -0,0 +1,44 @@ +//// [tests/cases/compiler/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts] //// + +//// [blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts] +function foo1() { + return E.A + enum E { A } +} + +function foo2() { + return E.A + const enum E { A } +} + +const config = { + a: AfterObject.A, +}; + +const enum AfterObject { + A = 2, +} + + +//// [blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.js] +function foo1() { + return E.A; + let E; + (function (E) { + E[E["A"] = 0] = "A"; + })(E || (E = {})); +} +function foo2() { + return E.A; + let E; + (function (E) { + E[E["A"] = 0] = "A"; + })(E || (E = {})); +} +const config = { + a: AfterObject.A, +}; +var AfterObject; +(function (AfterObject) { + AfterObject[AfterObject["A"] = 2] = "A"; +})(AfterObject || (AfterObject = {})); diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.symbols b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.symbols rename to tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax(target=es2015).symbols diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.types b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax(target=es2015).types similarity index 100% rename from tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.types rename to tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax(target=es2015).types diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax(target=es5).errors.txt b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax(target=es5).errors.txt new file mode 100644 index 0000000000000..d3059e8840ae4 --- /dev/null +++ b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax(target=es5).errors.txt @@ -0,0 +1,33 @@ +blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts(2,12): error TS2450: Enum 'E' used before its declaration. +blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts(7,12): error TS2450: Enum 'E' used before its declaration. +blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts(12,8): error TS2450: Enum 'AfterObject' used before its declaration. + + +==== blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts (3 errors) ==== + function foo1() { + return E.A + ~ +!!! error TS2450: Enum 'E' used before its declaration. +!!! related TS2728 blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts:3:10: 'E' is declared here. + enum E { A } + } + + function foo2() { + return E.A + ~ +!!! error TS2450: Enum 'E' used before its declaration. +!!! related TS2728 blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts:8:16: 'E' is declared here. + const enum E { A } + } + + const config = { + a: AfterObject.A, + ~~~~~~~~~~~ +!!! error TS2450: Enum 'AfterObject' used before its declaration. +!!! related TS2728 blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts:15:12: 'AfterObject' is declared here. + }; + + const enum AfterObject { + A = 2, + } + \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.js b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax(target=es5).js similarity index 100% rename from tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.js rename to tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax(target=es5).js diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax(target=es5).symbols b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax(target=es5).symbols new file mode 100644 index 0000000000000..967db9a58c3ee --- /dev/null +++ b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax(target=es5).symbols @@ -0,0 +1,47 @@ +//// [tests/cases/compiler/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts] //// + +=== blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts === +function foo1() { +>foo1 : Symbol(foo1, Decl(blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts, 0, 0)) + + return E.A +>E.A : Symbol(E.A, Decl(blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts, 2, 12)) +>E : Symbol(E, Decl(blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts, 1, 14)) +>A : Symbol(E.A, Decl(blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts, 2, 12)) + + enum E { A } +>E : Symbol(E, Decl(blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts, 1, 14)) +>A : Symbol(E.A, Decl(blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts, 2, 12)) +} + +function foo2() { +>foo2 : Symbol(foo2, Decl(blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts, 3, 1)) + + return E.A +>E.A : Symbol(E.A, Decl(blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts, 7, 18)) +>E : Symbol(E, Decl(blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts, 6, 14)) +>A : Symbol(E.A, Decl(blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts, 7, 18)) + + const enum E { A } +>E : Symbol(E, Decl(blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts, 6, 14)) +>A : Symbol(E.A, Decl(blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts, 7, 18)) +} + +const config = { +>config : Symbol(config, Decl(blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts, 10, 5)) + + a: AfterObject.A, +>a : Symbol(a, Decl(blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts, 10, 16)) +>AfterObject.A : Symbol(AfterObject.A, Decl(blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts, 14, 24)) +>AfterObject : Symbol(AfterObject, Decl(blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts, 12, 2)) +>A : Symbol(AfterObject.A, Decl(blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts, 14, 24)) + +}; + +const enum AfterObject { +>AfterObject : Symbol(AfterObject, Decl(blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts, 12, 2)) + + A = 2, +>A : Symbol(AfterObject.A, Decl(blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts, 14, 24)) +} + diff --git a/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax(target=es5).types b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax(target=es5).types new file mode 100644 index 0000000000000..b367406abb223 --- /dev/null +++ b/tests/baselines/reference/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax(target=es5).types @@ -0,0 +1,70 @@ +//// [tests/cases/compiler/blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts] //// + +=== blockScopedEnumVariablesUseBeforeDef_verbatimModuleSyntax.ts === +function foo1() { +>foo1 : () => E +> : ^^^^^^^ + + return E.A +>E.A : E +> : ^ +>E : typeof E +> : ^^^^^^^^ +>A : E +> : ^ + + enum E { A } +>E : E +> : ^ +>A : E.A +> : ^^^ +} + +function foo2() { +>foo2 : () => E +> : ^^^^^^^ + + return E.A +>E.A : E +> : ^ +>E : typeof E +> : ^^^^^^^^ +>A : E +> : ^ + + const enum E { A } +>E : E +> : ^ +>A : E.A +> : ^^^ +} + +const config = { +>config : { a: AfterObject; } +> : ^^^^^^^^^^^^^^^^^^^ +>{ a: AfterObject.A,} : { a: AfterObject; } +> : ^^^^^^^^^^^^^^^^^^^ + + a: AfterObject.A, +>a : AfterObject +> : ^^^^^^^^^^^ +>AfterObject.A : AfterObject +> : ^^^^^^^^^^^ +>AfterObject : typeof AfterObject +> : ^^^^^^^^^^^^^^^^^^ +>A : AfterObject +> : ^^^^^^^^^^^ + +}; + +const enum AfterObject { +>AfterObject : AfterObject +> : ^^^^^^^^^^^ + + A = 2, +>A : AfterObject.A +> : ^^^^^^^^^^^^^ +>2 : 2 +> : ^ +} + diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationES5.js b/tests/baselines/reference/blockScopedFunctionDeclarationES5(target=es2015).js similarity index 100% rename from tests/baselines/reference/blockScopedFunctionDeclarationES5.js rename to tests/baselines/reference/blockScopedFunctionDeclarationES5(target=es2015).js diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationES5.symbols b/tests/baselines/reference/blockScopedFunctionDeclarationES5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/blockScopedFunctionDeclarationES5.symbols rename to tests/baselines/reference/blockScopedFunctionDeclarationES5(target=es2015).symbols diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationES5.types b/tests/baselines/reference/blockScopedFunctionDeclarationES5(target=es2015).types similarity index 100% rename from tests/baselines/reference/blockScopedFunctionDeclarationES5.types rename to tests/baselines/reference/blockScopedFunctionDeclarationES5(target=es2015).types diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationES5(target=es5).js b/tests/baselines/reference/blockScopedFunctionDeclarationES5(target=es5).js new file mode 100644 index 0000000000000..4c0498586ae03 --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationES5(target=es5).js @@ -0,0 +1,15 @@ +//// [tests/cases/compiler/blockScopedFunctionDeclarationES5.ts] //// + +//// [blockScopedFunctionDeclarationES5.ts] +if (true) { + function foo() { } + foo(); +} +foo(); + +//// [blockScopedFunctionDeclarationES5.js] +if (true) { + function foo() { } + foo(); +} +foo(); diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationES5(target=es5).symbols b/tests/baselines/reference/blockScopedFunctionDeclarationES5(target=es5).symbols new file mode 100644 index 0000000000000..7a4653165a1e3 --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationES5(target=es5).symbols @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/blockScopedFunctionDeclarationES5.ts] //// + +=== blockScopedFunctionDeclarationES5.ts === +if (true) { + function foo() { } +>foo : Symbol(foo, Decl(blockScopedFunctionDeclarationES5.ts, 0, 11)) + + foo(); +>foo : Symbol(foo, Decl(blockScopedFunctionDeclarationES5.ts, 0, 11)) +} +foo(); +>foo : Symbol(foo, Decl(blockScopedFunctionDeclarationES5.ts, 0, 11)) + diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationES5(target=es5).types b/tests/baselines/reference/blockScopedFunctionDeclarationES5(target=es5).types new file mode 100644 index 0000000000000..5edf7f7fdf725 --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationES5(target=es5).types @@ -0,0 +1,23 @@ +//// [tests/cases/compiler/blockScopedFunctionDeclarationES5.ts] //// + +=== blockScopedFunctionDeclarationES5.ts === +if (true) { +>true : true +> : ^^^^ + + function foo() { } +>foo : () => void +> : ^^^^^^^^^^ + + foo(); +>foo() : void +> : ^^^^ +>foo : () => void +> : ^^^^^^^^^^ +} +foo(); +>foo() : void +> : ^^^^ +>foo : () => void +> : ^^^^^^^^^^ + diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass(target=es2015).errors.txt b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass(target=es2015).errors.txt new file mode 100644 index 0000000000000..0fcc185589055 --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass(target=es2015).errors.txt @@ -0,0 +1,15 @@ +blockScopedFunctionDeclarationInStrictClass.ts(7,9): error TS2304: Cannot find name 'foo'. + + +==== blockScopedFunctionDeclarationInStrictClass.ts (1 errors) ==== + class c { + method() { + if (true) { + function foo() { } + foo(); // ok + } + foo(); // not ok + ~~~ +!!! error TS2304: Cannot find name 'foo'. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass(target=es2015).js b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass(target=es2015).js new file mode 100644 index 0000000000000..48753edde7b2c --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass(target=es2015).js @@ -0,0 +1,23 @@ +//// [tests/cases/compiler/blockScopedFunctionDeclarationInStrictClass.ts] //// + +//// [blockScopedFunctionDeclarationInStrictClass.ts] +class c { + method() { + if (true) { + function foo() { } + foo(); // ok + } + foo(); // not ok + } +} + +//// [blockScopedFunctionDeclarationInStrictClass.js] +class c { + method() { + if (true) { + function foo() { } + foo(); // ok + } + foo(); // not ok + } +} diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass.symbols b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass.symbols rename to tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass(target=es2015).symbols diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass.types b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass(target=es2015).types similarity index 100% rename from tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass.types rename to tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass(target=es2015).types diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass.errors.txt b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass(target=es5).errors.txt similarity index 100% rename from tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass.errors.txt rename to tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass(target=es5).errors.txt diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass.js b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass(target=es5).js similarity index 100% rename from tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass.js rename to tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass(target=es5).js diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass(target=es5).symbols b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass(target=es5).symbols new file mode 100644 index 0000000000000..efec13245ab81 --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass(target=es5).symbols @@ -0,0 +1,19 @@ +//// [tests/cases/compiler/blockScopedFunctionDeclarationInStrictClass.ts] //// + +=== blockScopedFunctionDeclarationInStrictClass.ts === +class c { +>c : Symbol(c, Decl(blockScopedFunctionDeclarationInStrictClass.ts, 0, 0)) + + method() { +>method : Symbol(c.method, Decl(blockScopedFunctionDeclarationInStrictClass.ts, 0, 9)) + + if (true) { + function foo() { } +>foo : Symbol(foo, Decl(blockScopedFunctionDeclarationInStrictClass.ts, 2, 19)) + + foo(); // ok +>foo : Symbol(foo, Decl(blockScopedFunctionDeclarationInStrictClass.ts, 2, 19)) + } + foo(); // not ok + } +} diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass(target=es5).types b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass(target=es5).types new file mode 100644 index 0000000000000..eef16d46a4ba3 --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass(target=es5).types @@ -0,0 +1,32 @@ +//// [tests/cases/compiler/blockScopedFunctionDeclarationInStrictClass.ts] //// + +=== blockScopedFunctionDeclarationInStrictClass.ts === +class c { +>c : c +> : ^ + + method() { +>method : () => void +> : ^^^^^^^^^^ + + if (true) { +>true : true +> : ^^^^ + + function foo() { } +>foo : () => void +> : ^^^^^^^^^^ + + foo(); // ok +>foo() : void +> : ^^^^ +>foo : () => void +> : ^^^^^^^^^^ + } + foo(); // not ok +>foo() : any +> : ^^^ +>foo : any +> : ^^^ + } +} diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5(target=es2015).errors.txt b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5(target=es2015).errors.txt new file mode 100644 index 0000000000000..120e1f45d585f --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5(target=es2015).errors.txt @@ -0,0 +1,12 @@ +blockScopedFunctionDeclarationStrictES5.ts(6,1): error TS2304: Cannot find name 'foo'. + + +==== blockScopedFunctionDeclarationStrictES5.ts (1 errors) ==== + "use strict"; + if (true) { + function foo() { } // Error to declare function in block scope + foo(); // This call should be ok + } + foo(); // Error to find name foo + ~~~ +!!! error TS2304: Cannot find name 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5.js b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5(target=es2015).js similarity index 100% rename from tests/baselines/reference/blockScopedFunctionDeclarationStrictES5.js rename to tests/baselines/reference/blockScopedFunctionDeclarationStrictES5(target=es2015).js diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5.symbols b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/blockScopedFunctionDeclarationStrictES5.symbols rename to tests/baselines/reference/blockScopedFunctionDeclarationStrictES5(target=es2015).symbols diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5.types b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5(target=es2015).types similarity index 100% rename from tests/baselines/reference/blockScopedFunctionDeclarationStrictES5.types rename to tests/baselines/reference/blockScopedFunctionDeclarationStrictES5(target=es2015).types diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5.errors.txt b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5(target=es5).errors.txt similarity index 100% rename from tests/baselines/reference/blockScopedFunctionDeclarationStrictES5.errors.txt rename to tests/baselines/reference/blockScopedFunctionDeclarationStrictES5(target=es5).errors.txt diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5(target=es5).js b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5(target=es5).js new file mode 100644 index 0000000000000..c36a70c019bde --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5(target=es5).js @@ -0,0 +1,17 @@ +//// [tests/cases/compiler/blockScopedFunctionDeclarationStrictES5.ts] //// + +//// [blockScopedFunctionDeclarationStrictES5.ts] +"use strict"; +if (true) { + function foo() { } // Error to declare function in block scope + foo(); // This call should be ok +} +foo(); // Error to find name foo + +//// [blockScopedFunctionDeclarationStrictES5.js] +"use strict"; +if (true) { + function foo() { } // Error to declare function in block scope + foo(); // This call should be ok +} +foo(); // Error to find name foo diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5(target=es5).symbols b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5(target=es5).symbols new file mode 100644 index 0000000000000..9522429650b43 --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5(target=es5).symbols @@ -0,0 +1,12 @@ +//// [tests/cases/compiler/blockScopedFunctionDeclarationStrictES5.ts] //// + +=== blockScopedFunctionDeclarationStrictES5.ts === +"use strict"; +if (true) { + function foo() { } // Error to declare function in block scope +>foo : Symbol(foo, Decl(blockScopedFunctionDeclarationStrictES5.ts, 1, 11)) + + foo(); // This call should be ok +>foo : Symbol(foo, Decl(blockScopedFunctionDeclarationStrictES5.ts, 1, 11)) +} +foo(); // Error to find name foo diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5(target=es5).types b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5(target=es5).types new file mode 100644 index 0000000000000..9bb01aad3ef21 --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5(target=es5).types @@ -0,0 +1,27 @@ +//// [tests/cases/compiler/blockScopedFunctionDeclarationStrictES5.ts] //// + +=== blockScopedFunctionDeclarationStrictES5.ts === +"use strict"; +>"use strict" : "use strict" +> : ^^^^^^^^^^^^ + +if (true) { +>true : true +> : ^^^^ + + function foo() { } // Error to declare function in block scope +>foo : () => void +> : ^^^^^^^^^^ + + foo(); // This call should be ok +>foo() : void +> : ^^^^ +>foo : () => void +> : ^^^^^^^^^^ +} +foo(); // Error to find name foo +>foo() : any +> : ^^^ +>foo : any +> : ^^^ + diff --git a/tests/baselines/reference/blockScopedNamespaceDifferentFile.errors.txt b/tests/baselines/reference/blockScopedNamespaceDifferentFile(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/blockScopedNamespaceDifferentFile.errors.txt rename to tests/baselines/reference/blockScopedNamespaceDifferentFile(target=es2015).errors.txt diff --git a/tests/baselines/reference/blockScopedNamespaceDifferentFile(target=es2015).js b/tests/baselines/reference/blockScopedNamespaceDifferentFile(target=es2015).js new file mode 100644 index 0000000000000..f1ff6ca37c8f2 --- /dev/null +++ b/tests/baselines/reference/blockScopedNamespaceDifferentFile(target=es2015).js @@ -0,0 +1,31 @@ +//// [tests/cases/compiler/blockScopedNamespaceDifferentFile.ts] //// + +//// [test.ts] +namespace C { + export class Name { + static funcData = A.AA.func(); + static someConst = A.AA.foo; + + constructor(parameters) {} + } +} + +//// [typings.d.ts] +declare namespace A { + namespace AA { + function func(): number; + const foo = ""; + } +} + + +//// [out.js] +var C; +(function (C) { + class Name { + constructor(parameters) { } + } + Name.funcData = A.AA.func(); + Name.someConst = A.AA.foo; + C.Name = Name; +})(C || (C = {})); diff --git a/tests/baselines/reference/blockScopedNamespaceDifferentFile.symbols b/tests/baselines/reference/blockScopedNamespaceDifferentFile(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/blockScopedNamespaceDifferentFile.symbols rename to tests/baselines/reference/blockScopedNamespaceDifferentFile(target=es2015).symbols diff --git a/tests/baselines/reference/blockScopedNamespaceDifferentFile.types b/tests/baselines/reference/blockScopedNamespaceDifferentFile(target=es2015).types similarity index 100% rename from tests/baselines/reference/blockScopedNamespaceDifferentFile.types rename to tests/baselines/reference/blockScopedNamespaceDifferentFile(target=es2015).types diff --git a/tests/baselines/reference/blockScopedNamespaceDifferentFile(target=es5).errors.txt b/tests/baselines/reference/blockScopedNamespaceDifferentFile(target=es5).errors.txt new file mode 100644 index 0000000000000..dc3f899b5a225 --- /dev/null +++ b/tests/baselines/reference/blockScopedNamespaceDifferentFile(target=es5).errors.txt @@ -0,0 +1,24 @@ +error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +error TS5107: Option 'module=AMD' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. + + +!!! error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +!!! error TS5107: Option 'module=AMD' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +==== test.ts (0 errors) ==== + namespace C { + export class Name { + static funcData = A.AA.func(); + static someConst = A.AA.foo; + + constructor(parameters) {} + } + } + +==== typings.d.ts (0 errors) ==== + declare namespace A { + namespace AA { + function func(): number; + const foo = ""; + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedNamespaceDifferentFile.js b/tests/baselines/reference/blockScopedNamespaceDifferentFile(target=es5).js similarity index 100% rename from tests/baselines/reference/blockScopedNamespaceDifferentFile.js rename to tests/baselines/reference/blockScopedNamespaceDifferentFile(target=es5).js diff --git a/tests/baselines/reference/blockScopedNamespaceDifferentFile(target=es5).symbols b/tests/baselines/reference/blockScopedNamespaceDifferentFile(target=es5).symbols new file mode 100644 index 0000000000000..565eb550cddd2 --- /dev/null +++ b/tests/baselines/reference/blockScopedNamespaceDifferentFile(target=es5).symbols @@ -0,0 +1,45 @@ +//// [tests/cases/compiler/blockScopedNamespaceDifferentFile.ts] //// + +=== test.ts === +namespace C { +>C : Symbol(C, Decl(test.ts, 0, 0)) + + export class Name { +>Name : Symbol(Name, Decl(test.ts, 0, 13)) + + static funcData = A.AA.func(); +>funcData : Symbol(Name.funcData, Decl(test.ts, 1, 23)) +>A.AA.func : Symbol(A.AA.func, Decl(typings.d.ts, 1, 18)) +>A.AA : Symbol(A.AA, Decl(typings.d.ts, 0, 21)) +>A : Symbol(A, Decl(typings.d.ts, 0, 0)) +>AA : Symbol(A.AA, Decl(typings.d.ts, 0, 21)) +>func : Symbol(A.AA.func, Decl(typings.d.ts, 1, 18)) + + static someConst = A.AA.foo; +>someConst : Symbol(Name.someConst, Decl(test.ts, 2, 38)) +>A.AA.foo : Symbol(A.AA.foo, Decl(typings.d.ts, 3, 13)) +>A.AA : Symbol(A.AA, Decl(typings.d.ts, 0, 21)) +>A : Symbol(A, Decl(typings.d.ts, 0, 0)) +>AA : Symbol(A.AA, Decl(typings.d.ts, 0, 21)) +>foo : Symbol(A.AA.foo, Decl(typings.d.ts, 3, 13)) + + constructor(parameters) {} +>parameters : Symbol(parameters, Decl(test.ts, 5, 20)) + } +} + +=== typings.d.ts === +declare namespace A { +>A : Symbol(A, Decl(typings.d.ts, 0, 0)) + + namespace AA { +>AA : Symbol(AA, Decl(typings.d.ts, 0, 21)) + + function func(): number; +>func : Symbol(func, Decl(typings.d.ts, 1, 18)) + + const foo = ""; +>foo : Symbol(foo, Decl(typings.d.ts, 3, 13)) + } +} + diff --git a/tests/baselines/reference/blockScopedNamespaceDifferentFile(target=es5).types b/tests/baselines/reference/blockScopedNamespaceDifferentFile(target=es5).types new file mode 100644 index 0000000000000..e64b0e174c0e6 --- /dev/null +++ b/tests/baselines/reference/blockScopedNamespaceDifferentFile(target=es5).types @@ -0,0 +1,68 @@ +//// [tests/cases/compiler/blockScopedNamespaceDifferentFile.ts] //// + +=== test.ts === +namespace C { +>C : typeof C +> : ^^^^^^^^ + + export class Name { +>Name : Name +> : ^^^^ + + static funcData = A.AA.func(); +>funcData : number +> : ^^^^^^ +>A.AA.func() : number +> : ^^^^^^ +>A.AA.func : () => number +> : ^^^^^^ +>A.AA : typeof A.AA +> : ^^^^^^^^^^^ +>A : typeof A +> : ^^^^^^^^ +>AA : typeof A.AA +> : ^^^^^^^^^^^ +>func : () => number +> : ^^^^^^ + + static someConst = A.AA.foo; +>someConst : string +> : ^^^^^^ +>A.AA.foo : "" +> : ^^ +>A.AA : typeof A.AA +> : ^^^^^^^^^^^ +>A : typeof A +> : ^^^^^^^^ +>AA : typeof A.AA +> : ^^^^^^^^^^^ +>foo : "" +> : ^^ + + constructor(parameters) {} +>parameters : any +> : ^^^ + } +} + +=== typings.d.ts === +declare namespace A { +>A : typeof A +> : ^^^^^^^^ + + namespace AA { +>AA : typeof AA +> : ^^^^^^^^^ + + function func(): number; +>func : () => number +> : ^^^^^^ + + const foo = ""; +>foo : "" +> : ^^ +>"" : "" +> : ^^ + } +} + diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.errors.txt b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.errors.txt rename to tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5(target=es2015).errors.txt diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.js b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5(target=es2015).js similarity index 100% rename from tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.js rename to tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5(target=es2015).js diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.symbols b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.symbols rename to tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5(target=es2015).symbols diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.types b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5(target=es2015).types similarity index 100% rename from tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.types rename to tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5(target=es2015).types diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5(target=es5).errors.txt b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5(target=es5).errors.txt new file mode 100644 index 0000000000000..47b4cf9a063cf --- /dev/null +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5(target=es5).errors.txt @@ -0,0 +1,38 @@ +blockScopedSameNameFunctionDeclarationES5.ts(3,18): error TS2393: Duplicate function implementation. +blockScopedSameNameFunctionDeclarationES5.ts(5,13): error TS2554: Expected 0 arguments, but got 1. +blockScopedSameNameFunctionDeclarationES5.ts(8,18): error TS2393: Duplicate function implementation. +blockScopedSameNameFunctionDeclarationES5.ts(10,13): error TS2554: Expected 0 arguments, but got 1. +blockScopedSameNameFunctionDeclarationES5.ts(12,9): error TS2554: Expected 0 arguments, but got 1. +blockScopedSameNameFunctionDeclarationES5.ts(16,1): error TS2554: Expected 1 arguments, but got 0. + + +==== blockScopedSameNameFunctionDeclarationES5.ts (6 errors) ==== + function foo(a: number) { + if (a === 1) { + function foo() { } // duplicate function + ~~~ +!!! error TS2393: Duplicate function implementation. + foo(); + foo(10); // not ok + ~~ +!!! error TS2554: Expected 0 arguments, but got 1. + } + else { + function foo() { } // duplicate function + ~~~ +!!! error TS2393: Duplicate function implementation. + foo(); + foo(10); // not ok + ~~ +!!! error TS2554: Expected 0 arguments, but got 1. + } + foo(10); // not ok + ~~ +!!! error TS2554: Expected 0 arguments, but got 1. + foo(); + } + foo(10); + foo(); // not ok - needs number + ~~~ +!!! error TS2554: Expected 1 arguments, but got 0. +!!! related TS6210 blockScopedSameNameFunctionDeclarationES5.ts:1:14: An argument for 'a' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5(target=es5).js b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5(target=es5).js new file mode 100644 index 0000000000000..00efc973004c0 --- /dev/null +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5(target=es5).js @@ -0,0 +1,37 @@ +//// [tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts] //// + +//// [blockScopedSameNameFunctionDeclarationES5.ts] +function foo(a: number) { + if (a === 1) { + function foo() { } // duplicate function + foo(); + foo(10); // not ok + } + else { + function foo() { } // duplicate function + foo(); + foo(10); // not ok + } + foo(10); // not ok + foo(); +} +foo(10); +foo(); // not ok - needs number + +//// [blockScopedSameNameFunctionDeclarationES5.js] +function foo(a) { + if (a === 1) { + function foo() { } // duplicate function + foo(); + foo(10); // not ok + } + else { + function foo() { } // duplicate function + foo(); + foo(10); // not ok + } + foo(10); // not ok + foo(); +} +foo(10); +foo(); // not ok - needs number diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5(target=es5).symbols b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5(target=es5).symbols new file mode 100644 index 0000000000000..9059c98982ce8 --- /dev/null +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5(target=es5).symbols @@ -0,0 +1,41 @@ +//// [tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts] //// + +=== blockScopedSameNameFunctionDeclarationES5.ts === +function foo(a: number) { +>foo : Symbol(foo, Decl(blockScopedSameNameFunctionDeclarationES5.ts, 0, 0)) +>a : Symbol(a, Decl(blockScopedSameNameFunctionDeclarationES5.ts, 0, 13)) + + if (a === 1) { +>a : Symbol(a, Decl(blockScopedSameNameFunctionDeclarationES5.ts, 0, 13)) + + function foo() { } // duplicate function +>foo : Symbol(foo, Decl(blockScopedSameNameFunctionDeclarationES5.ts, 1, 18), Decl(blockScopedSameNameFunctionDeclarationES5.ts, 6, 10)) + + foo(); +>foo : Symbol(foo, Decl(blockScopedSameNameFunctionDeclarationES5.ts, 1, 18), Decl(blockScopedSameNameFunctionDeclarationES5.ts, 6, 10)) + + foo(10); // not ok +>foo : Symbol(foo, Decl(blockScopedSameNameFunctionDeclarationES5.ts, 1, 18), Decl(blockScopedSameNameFunctionDeclarationES5.ts, 6, 10)) + } + else { + function foo() { } // duplicate function +>foo : Symbol(foo, Decl(blockScopedSameNameFunctionDeclarationES5.ts, 1, 18), Decl(blockScopedSameNameFunctionDeclarationES5.ts, 6, 10)) + + foo(); +>foo : Symbol(foo, Decl(blockScopedSameNameFunctionDeclarationES5.ts, 1, 18), Decl(blockScopedSameNameFunctionDeclarationES5.ts, 6, 10)) + + foo(10); // not ok +>foo : Symbol(foo, Decl(blockScopedSameNameFunctionDeclarationES5.ts, 1, 18), Decl(blockScopedSameNameFunctionDeclarationES5.ts, 6, 10)) + } + foo(10); // not ok +>foo : Symbol(foo, Decl(blockScopedSameNameFunctionDeclarationES5.ts, 1, 18), Decl(blockScopedSameNameFunctionDeclarationES5.ts, 6, 10)) + + foo(); +>foo : Symbol(foo, Decl(blockScopedSameNameFunctionDeclarationES5.ts, 1, 18), Decl(blockScopedSameNameFunctionDeclarationES5.ts, 6, 10)) +} +foo(10); +>foo : Symbol(foo, Decl(blockScopedSameNameFunctionDeclarationES5.ts, 0, 0)) + +foo(); // not ok - needs number +>foo : Symbol(foo, Decl(blockScopedSameNameFunctionDeclarationES5.ts, 0, 0)) + diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5(target=es5).types b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5(target=es5).types new file mode 100644 index 0000000000000..33989fec6734f --- /dev/null +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5(target=es5).types @@ -0,0 +1,82 @@ +//// [tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts] //// + +=== blockScopedSameNameFunctionDeclarationES5.ts === +function foo(a: number) { +>foo : (a: number) => void +> : ^ ^^ ^^^^^^^^^ +>a : number +> : ^^^^^^ + + if (a === 1) { +>a === 1 : boolean +> : ^^^^^^^ +>a : number +> : ^^^^^^ +>1 : 1 +> : ^ + + function foo() { } // duplicate function +>foo : { (): void; (): void; } +> : ^^^^^^^^^^^^^^^^^^^^^^^ + + foo(); +>foo() : void +> : ^^^^ +>foo : { (): void; (): void; } +> : ^^^^^^^^^^^^^^^^^^^^^^^ + + foo(10); // not ok +>foo(10) : void +> : ^^^^ +>foo : { (): void; (): void; } +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>10 : 10 +> : ^^ + } + else { + function foo() { } // duplicate function +>foo : { (): void; (): void; } +> : ^^^^^^^^^^^^^^^^^^^^^^^ + + foo(); +>foo() : void +> : ^^^^ +>foo : { (): void; (): void; } +> : ^^^^^^^^^^^^^^^^^^^^^^^ + + foo(10); // not ok +>foo(10) : void +> : ^^^^ +>foo : { (): void; (): void; } +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>10 : 10 +> : ^^ + } + foo(10); // not ok +>foo(10) : void +> : ^^^^ +>foo : { (): void; (): void; } +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>10 : 10 +> : ^^ + + foo(); +>foo() : void +> : ^^^^ +>foo : { (): void; (): void; } +> : ^^^^^^^^^^^^^^^^^^^^^^^ +} +foo(10); +>foo(10) : void +> : ^^^^ +>foo : (a: number) => void +> : ^ ^^ ^^^^^^^^^ +>10 : 10 +> : ^^ + +foo(); // not ok - needs number +>foo() : void +> : ^^^^ +>foo : (a: number) => void +> : ^ ^^ ^^^^^^^^^ + diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5(target=es2015).errors.txt b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5(target=es2015).errors.txt new file mode 100644 index 0000000000000..2d70db4f6cf15 --- /dev/null +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5(target=es2015).errors.txt @@ -0,0 +1,34 @@ +blockScopedSameNameFunctionDeclarationStrictES5.ts(6,13): error TS2554: Expected 0 arguments, but got 1. +blockScopedSameNameFunctionDeclarationStrictES5.ts(11,13): error TS2554: Expected 0 arguments, but got 1. +blockScopedSameNameFunctionDeclarationStrictES5.ts(14,5): error TS2554: Expected 1 arguments, but got 0. +blockScopedSameNameFunctionDeclarationStrictES5.ts(17,1): error TS2554: Expected 1 arguments, but got 0. + + +==== blockScopedSameNameFunctionDeclarationStrictES5.ts (4 errors) ==== + "use strict"; + function foo(a: number) { + if (a === 1) { + function foo() { } // Error to declare function in block scope + foo(); + foo(10); // not ok + ~~ +!!! error TS2554: Expected 0 arguments, but got 1. + } + else { + function foo() { } // Error to declare function in block scope + foo(); + foo(10); // not ok + ~~ +!!! error TS2554: Expected 0 arguments, but got 1. + } + foo(10); + foo(); // not ok - needs number + ~~~ +!!! error TS2554: Expected 1 arguments, but got 0. +!!! related TS6210 blockScopedSameNameFunctionDeclarationStrictES5.ts:2:14: An argument for 'a' was not provided. + } + foo(10); + foo(); // not ok - needs number + ~~~ +!!! error TS2554: Expected 1 arguments, but got 0. +!!! related TS6210 blockScopedSameNameFunctionDeclarationStrictES5.ts:2:14: An argument for 'a' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.js b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5(target=es2015).js similarity index 100% rename from tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.js rename to tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5(target=es2015).js diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.symbols b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.symbols rename to tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5(target=es2015).symbols diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.types b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5(target=es2015).types similarity index 100% rename from tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.types rename to tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5(target=es2015).types diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5(target=es5).errors.txt similarity index 100% rename from tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt rename to tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5(target=es5).errors.txt diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5(target=es5).js b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5(target=es5).js new file mode 100644 index 0000000000000..dbc8dec17b573 --- /dev/null +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5(target=es5).js @@ -0,0 +1,39 @@ +//// [tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts] //// + +//// [blockScopedSameNameFunctionDeclarationStrictES5.ts] +"use strict"; +function foo(a: number) { + if (a === 1) { + function foo() { } // Error to declare function in block scope + foo(); + foo(10); // not ok + } + else { + function foo() { } // Error to declare function in block scope + foo(); + foo(10); // not ok + } + foo(10); + foo(); // not ok - needs number +} +foo(10); +foo(); // not ok - needs number + +//// [blockScopedSameNameFunctionDeclarationStrictES5.js] +"use strict"; +function foo(a) { + if (a === 1) { + function foo() { } // Error to declare function in block scope + foo(); + foo(10); // not ok + } + else { + function foo() { } // Error to declare function in block scope + foo(); + foo(10); // not ok + } + foo(10); + foo(); // not ok - needs number +} +foo(10); +foo(); // not ok - needs number diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5(target=es5).symbols b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5(target=es5).symbols new file mode 100644 index 0000000000000..985f629b1fa70 --- /dev/null +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5(target=es5).symbols @@ -0,0 +1,42 @@ +//// [tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts] //// + +=== blockScopedSameNameFunctionDeclarationStrictES5.ts === +"use strict"; +function foo(a: number) { +>foo : Symbol(foo, Decl(blockScopedSameNameFunctionDeclarationStrictES5.ts, 0, 13)) +>a : Symbol(a, Decl(blockScopedSameNameFunctionDeclarationStrictES5.ts, 1, 13)) + + if (a === 1) { +>a : Symbol(a, Decl(blockScopedSameNameFunctionDeclarationStrictES5.ts, 1, 13)) + + function foo() { } // Error to declare function in block scope +>foo : Symbol(foo, Decl(blockScopedSameNameFunctionDeclarationStrictES5.ts, 2, 18)) + + foo(); +>foo : Symbol(foo, Decl(blockScopedSameNameFunctionDeclarationStrictES5.ts, 2, 18)) + + foo(10); // not ok +>foo : Symbol(foo, Decl(blockScopedSameNameFunctionDeclarationStrictES5.ts, 2, 18)) + } + else { + function foo() { } // Error to declare function in block scope +>foo : Symbol(foo, Decl(blockScopedSameNameFunctionDeclarationStrictES5.ts, 7, 10)) + + foo(); +>foo : Symbol(foo, Decl(blockScopedSameNameFunctionDeclarationStrictES5.ts, 7, 10)) + + foo(10); // not ok +>foo : Symbol(foo, Decl(blockScopedSameNameFunctionDeclarationStrictES5.ts, 7, 10)) + } + foo(10); +>foo : Symbol(foo, Decl(blockScopedSameNameFunctionDeclarationStrictES5.ts, 0, 13)) + + foo(); // not ok - needs number +>foo : Symbol(foo, Decl(blockScopedSameNameFunctionDeclarationStrictES5.ts, 0, 13)) +} +foo(10); +>foo : Symbol(foo, Decl(blockScopedSameNameFunctionDeclarationStrictES5.ts, 0, 13)) + +foo(); // not ok - needs number +>foo : Symbol(foo, Decl(blockScopedSameNameFunctionDeclarationStrictES5.ts, 0, 13)) + diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5(target=es5).types b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5(target=es5).types new file mode 100644 index 0000000000000..940f990526e45 --- /dev/null +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5(target=es5).types @@ -0,0 +1,86 @@ +//// [tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts] //// + +=== blockScopedSameNameFunctionDeclarationStrictES5.ts === +"use strict"; +>"use strict" : "use strict" +> : ^^^^^^^^^^^^ + +function foo(a: number) { +>foo : (a: number) => void +> : ^ ^^ ^^^^^^^^^ +>a : number +> : ^^^^^^ + + if (a === 1) { +>a === 1 : boolean +> : ^^^^^^^ +>a : number +> : ^^^^^^ +>1 : 1 +> : ^ + + function foo() { } // Error to declare function in block scope +>foo : () => void +> : ^^^^^^^^^^ + + foo(); +>foo() : void +> : ^^^^ +>foo : () => void +> : ^^^^^^^^^^ + + foo(10); // not ok +>foo(10) : void +> : ^^^^ +>foo : () => void +> : ^^^^^^^^^^ +>10 : 10 +> : ^^ + } + else { + function foo() { } // Error to declare function in block scope +>foo : () => void +> : ^^^^^^^^^^ + + foo(); +>foo() : void +> : ^^^^ +>foo : () => void +> : ^^^^^^^^^^ + + foo(10); // not ok +>foo(10) : void +> : ^^^^ +>foo : () => void +> : ^^^^^^^^^^ +>10 : 10 +> : ^^ + } + foo(10); +>foo(10) : void +> : ^^^^ +>foo : (a: number) => void +> : ^ ^^ ^^^^^^^^^ +>10 : 10 +> : ^^ + + foo(); // not ok - needs number +>foo() : void +> : ^^^^ +>foo : (a: number) => void +> : ^ ^^ ^^^^^^^^^ +} +foo(10); +>foo(10) : void +> : ^^^^ +>foo : (a: number) => void +> : ^ ^^ ^^^^^^^^^ +>10 : 10 +> : ^^ + +foo(); // not ok - needs number +>foo() : void +> : ^^^^ +>foo : (a: number) => void +> : ^ ^^ ^^^^^^^^^ + diff --git a/tests/baselines/reference/blockScopedVariablesUseBeforeDef.errors.txt b/tests/baselines/reference/blockScopedVariablesUseBeforeDef(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/blockScopedVariablesUseBeforeDef.errors.txt rename to tests/baselines/reference/blockScopedVariablesUseBeforeDef(target=es2015).errors.txt diff --git a/tests/baselines/reference/blockScopedVariablesUseBeforeDef(target=es2015).js b/tests/baselines/reference/blockScopedVariablesUseBeforeDef(target=es2015).js new file mode 100644 index 0000000000000..c1cfdc27774af --- /dev/null +++ b/tests/baselines/reference/blockScopedVariablesUseBeforeDef(target=es2015).js @@ -0,0 +1,336 @@ +//// [tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts] //// + +//// [blockScopedVariablesUseBeforeDef.ts] +function foo0() { + let a = x; + let x; +} + +function foo1() { + let a = () => x; + let x; +} + +function foo2() { + let a = function () { return x; } + let x; +} + +function foo3() { + class X { + m() { return x;} + } + let x; +} + +function foo4() { + let y = class { + m() { return x; } + }; + let x; +} + +function foo5() { + let x = () => y; + let y = () => x; +} + +function foo6() { + function f() { + return x; + } + let x; +} + +function foo7() { + class A { + a = x; + } + let x; +} + +function foo8() { + let y = class { + a = x; + } + let x; +} + +function foo9() { + let y = class { + static a = x; + } + let x; +} + +function foo10() { + class A { + static a = x; + } + let x; +} + +function foo11() { + function f () { + let y = class { + static a = x; + } + } + let x; +} + +function foo12() { + function f () { + let y = class { + a; + constructor() { + this.a = x; + } + } + } + let x; +} + +function foo13() { + let a = { + get a() { return x } + } + let x +} + +function foo14() { + let a = { + a: x + } + let x +} + +function foo15() { + // https://github.com/microsoft/TypeScript/issues/42678 + const [ + a, + b, + ] = ((): [number, number] => { + (() => console.log(a))(); // should error + console.log(a); // should error + const b = () => a; // should be ok + return [ + 0, + 0, + ]; + })(); +} + +function foo16() { + let [a] = (() => a)(); +} + +function foo17() { + const promise = (async () => { + promise + foo + await null + promise + foo + })() + + const foo = 1; +} + +// #30907 +function wrapI1() { + const iter = (function* foo() { + iter; + yield 1; + })(); +} + +function wrapI2() { + const iter = (async function* foo() { + iter; + yield 1; + })(); +} + +function foo18() { + let a = (() => Enum.Yes)(); + enum Enum { + No = 0, + Yes = 1, + } +} + + +//// [blockScopedVariablesUseBeforeDef.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); +}; +var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } +var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; + function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } + function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + 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 foo0() { + let a = x; + let x; +} +function foo1() { + let a = () => x; + let x; +} +function foo2() { + let a = function () { return x; }; + let x; +} +function foo3() { + class X { + m() { return x; } + } + let x; +} +function foo4() { + let y = class { + m() { return x; } + }; + let x; +} +function foo5() { + let x = () => y; + let y = () => x; +} +function foo6() { + function f() { + return x; + } + let x; +} +function foo7() { + class A { + constructor() { + this.a = x; + } + } + let x; +} +function foo8() { + let y = class { + constructor() { + this.a = x; + } + }; + let x; +} +function foo9() { + var _a; + let y = (_a = class { + }, + __setFunctionName(_a, "y"), + _a.a = x, + _a); + let x; +} +function foo10() { + class A { + } + A.a = x; + let x; +} +function foo11() { + function f() { + var _a; + let y = (_a = class { + }, + __setFunctionName(_a, "y"), + _a.a = x, + _a); + } + let x; +} +function foo12() { + function f() { + let y = class { + constructor() { + this.a = x; + } + }; + } + let x; +} +function foo13() { + let a = { + get a() { return x; } + }; + let x; +} +function foo14() { + let a = { + a: x + }; + let x; +} +function foo15() { + // https://github.com/microsoft/TypeScript/issues/42678 + const [a, b,] = (() => { + (() => console.log(a))(); // should error + console.log(a); // should error + const b = () => a; // should be ok + return [ + 0, + 0, + ]; + })(); +} +function foo16() { + let [a] = (() => a)(); +} +function foo17() { + const promise = (() => __awaiter(this, void 0, void 0, function* () { + promise; + foo; + yield null; + promise; + foo; + }))(); + const foo = 1; +} +// #30907 +function wrapI1() { + const iter = (function* foo() { + iter; + yield 1; + })(); +} +function wrapI2() { + const iter = (function foo() { + return __asyncGenerator(this, arguments, function* foo_1() { + iter; + yield yield __await(1); + }); + })(); +} +function foo18() { + let a = (() => Enum.Yes)(); + let Enum; + (function (Enum) { + Enum[Enum["No"] = 0] = "No"; + Enum[Enum["Yes"] = 1] = "Yes"; + })(Enum || (Enum = {})); +} diff --git a/tests/baselines/reference/blockScopedVariablesUseBeforeDef.symbols b/tests/baselines/reference/blockScopedVariablesUseBeforeDef(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/blockScopedVariablesUseBeforeDef.symbols rename to tests/baselines/reference/blockScopedVariablesUseBeforeDef(target=es2015).symbols diff --git a/tests/baselines/reference/blockScopedVariablesUseBeforeDef.types b/tests/baselines/reference/blockScopedVariablesUseBeforeDef(target=es2015).types similarity index 100% rename from tests/baselines/reference/blockScopedVariablesUseBeforeDef.types rename to tests/baselines/reference/blockScopedVariablesUseBeforeDef(target=es2015).types diff --git a/tests/baselines/reference/blockScopedVariablesUseBeforeDef(target=es5).errors.txt b/tests/baselines/reference/blockScopedVariablesUseBeforeDef(target=es5).errors.txt new file mode 100644 index 0000000000000..7beb2b37b9389 --- /dev/null +++ b/tests/baselines/reference/blockScopedVariablesUseBeforeDef(target=es5).errors.txt @@ -0,0 +1,202 @@ +blockScopedVariablesUseBeforeDef.ts(2,13): error TS2448: Block-scoped variable 'x' used before its declaration. +blockScopedVariablesUseBeforeDef.ts(58,20): error TS2448: Block-scoped variable 'x' used before its declaration. +blockScopedVariablesUseBeforeDef.ts(65,20): error TS2448: Block-scoped variable 'x' used before its declaration. +blockScopedVariablesUseBeforeDef.ts(100,12): error TS2448: Block-scoped variable 'x' used before its declaration. +blockScopedVariablesUseBeforeDef.ts(111,28): error TS2448: Block-scoped variable 'a' used before its declaration. +blockScopedVariablesUseBeforeDef.ts(112,21): error TS2448: Block-scoped variable 'a' used before its declaration. +blockScopedVariablesUseBeforeDef.ts(122,22): error TS2448: Block-scoped variable 'a' used before its declaration. +blockScopedVariablesUseBeforeDef.ts(128,9): error TS2448: Block-scoped variable 'foo' used before its declaration. +blockScopedVariablesUseBeforeDef.ts(131,9): error TS2448: Block-scoped variable 'foo' used before its declaration. +blockScopedVariablesUseBeforeDef.ts(153,20): error TS2450: Enum 'Enum' used before its declaration. + + +==== blockScopedVariablesUseBeforeDef.ts (10 errors) ==== + function foo0() { + let a = x; + ~ +!!! error TS2448: Block-scoped variable 'x' used before its declaration. +!!! related TS2728 blockScopedVariablesUseBeforeDef.ts:3:9: 'x' is declared here. + let x; + } + + function foo1() { + let a = () => x; + let x; + } + + function foo2() { + let a = function () { return x; } + let x; + } + + function foo3() { + class X { + m() { return x;} + } + let x; + } + + function foo4() { + let y = class { + m() { return x; } + }; + let x; + } + + function foo5() { + let x = () => y; + let y = () => x; + } + + function foo6() { + function f() { + return x; + } + let x; + } + + function foo7() { + class A { + a = x; + } + let x; + } + + function foo8() { + let y = class { + a = x; + } + let x; + } + + function foo9() { + let y = class { + static a = x; + ~ +!!! error TS2448: Block-scoped variable 'x' used before its declaration. +!!! related TS2728 blockScopedVariablesUseBeforeDef.ts:60:9: 'x' is declared here. + } + let x; + } + + function foo10() { + class A { + static a = x; + ~ +!!! error TS2448: Block-scoped variable 'x' used before its declaration. +!!! related TS2728 blockScopedVariablesUseBeforeDef.ts:67:9: 'x' is declared here. + } + let x; + } + + function foo11() { + function f () { + let y = class { + static a = x; + } + } + let x; + } + + function foo12() { + function f () { + let y = class { + a; + constructor() { + this.a = x; + } + } + } + let x; + } + + function foo13() { + let a = { + get a() { return x } + } + let x + } + + function foo14() { + let a = { + a: x + ~ +!!! error TS2448: Block-scoped variable 'x' used before its declaration. +!!! related TS2728 blockScopedVariablesUseBeforeDef.ts:102:9: 'x' is declared here. + } + let x + } + + function foo15() { + // https://github.com/microsoft/TypeScript/issues/42678 + const [ + a, + b, + ] = ((): [number, number] => { + (() => console.log(a))(); // should error + ~ +!!! error TS2448: Block-scoped variable 'a' used before its declaration. +!!! related TS2728 blockScopedVariablesUseBeforeDef.ts:108:9: 'a' is declared here. + console.log(a); // should error + ~ +!!! error TS2448: Block-scoped variable 'a' used before its declaration. +!!! related TS2728 blockScopedVariablesUseBeforeDef.ts:108:9: 'a' is declared here. + const b = () => a; // should be ok + return [ + 0, + 0, + ]; + })(); + } + + function foo16() { + let [a] = (() => a)(); + ~ +!!! error TS2448: Block-scoped variable 'a' used before its declaration. +!!! related TS2728 blockScopedVariablesUseBeforeDef.ts:122:10: 'a' is declared here. + } + + function foo17() { + const promise = (async () => { + promise + foo + ~~~ +!!! error TS2448: Block-scoped variable 'foo' used before its declaration. +!!! related TS2728 blockScopedVariablesUseBeforeDef.ts:134:11: 'foo' is declared here. + await null + promise + foo + ~~~ +!!! error TS2448: Block-scoped variable 'foo' used before its declaration. +!!! related TS2728 blockScopedVariablesUseBeforeDef.ts:134:11: 'foo' is declared here. + })() + + const foo = 1; + } + + // #30907 + function wrapI1() { + const iter = (function* foo() { + iter; + yield 1; + })(); + } + + function wrapI2() { + const iter = (async function* foo() { + iter; + yield 1; + })(); + } + + function foo18() { + let a = (() => Enum.Yes)(); + ~~~~ +!!! error TS2450: Enum 'Enum' used before its declaration. +!!! related TS2728 blockScopedVariablesUseBeforeDef.ts:154:10: 'Enum' is declared here. + enum Enum { + No = 0, + Yes = 1, + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedVariablesUseBeforeDef.js b/tests/baselines/reference/blockScopedVariablesUseBeforeDef(target=es5).js similarity index 100% rename from tests/baselines/reference/blockScopedVariablesUseBeforeDef.js rename to tests/baselines/reference/blockScopedVariablesUseBeforeDef(target=es5).js diff --git a/tests/baselines/reference/blockScopedVariablesUseBeforeDef(target=es5).symbols b/tests/baselines/reference/blockScopedVariablesUseBeforeDef(target=es5).symbols new file mode 100644 index 0000000000000..eae9d3323df3c --- /dev/null +++ b/tests/baselines/reference/blockScopedVariablesUseBeforeDef(target=es5).symbols @@ -0,0 +1,334 @@ +//// [tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts] //// + +=== blockScopedVariablesUseBeforeDef.ts === +function foo0() { +>foo0 : Symbol(foo0, Decl(blockScopedVariablesUseBeforeDef.ts, 0, 0)) + + let a = x; +>a : Symbol(a, Decl(blockScopedVariablesUseBeforeDef.ts, 1, 7)) +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 2, 7)) + + let x; +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 2, 7)) +} + +function foo1() { +>foo1 : Symbol(foo1, Decl(blockScopedVariablesUseBeforeDef.ts, 3, 1)) + + let a = () => x; +>a : Symbol(a, Decl(blockScopedVariablesUseBeforeDef.ts, 6, 7)) +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 7, 7)) + + let x; +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 7, 7)) +} + +function foo2() { +>foo2 : Symbol(foo2, Decl(blockScopedVariablesUseBeforeDef.ts, 8, 1)) + + let a = function () { return x; } +>a : Symbol(a, Decl(blockScopedVariablesUseBeforeDef.ts, 11, 7)) +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 12, 7)) + + let x; +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 12, 7)) +} + +function foo3() { +>foo3 : Symbol(foo3, Decl(blockScopedVariablesUseBeforeDef.ts, 13, 1)) + + class X { +>X : Symbol(X, Decl(blockScopedVariablesUseBeforeDef.ts, 15, 17)) + + m() { return x;} +>m : Symbol(X.m, Decl(blockScopedVariablesUseBeforeDef.ts, 16, 13)) +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 19, 7)) + } + let x; +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 19, 7)) +} + +function foo4() { +>foo4 : Symbol(foo4, Decl(blockScopedVariablesUseBeforeDef.ts, 20, 1)) + + let y = class { +>y : Symbol(y, Decl(blockScopedVariablesUseBeforeDef.ts, 23, 7)) + + m() { return x; } +>m : Symbol(y.m, Decl(blockScopedVariablesUseBeforeDef.ts, 23, 19)) +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 26, 7)) + + }; + let x; +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 26, 7)) +} + +function foo5() { +>foo5 : Symbol(foo5, Decl(blockScopedVariablesUseBeforeDef.ts, 27, 1)) + + let x = () => y; +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 30, 7)) +>y : Symbol(y, Decl(blockScopedVariablesUseBeforeDef.ts, 31, 7)) + + let y = () => x; +>y : Symbol(y, Decl(blockScopedVariablesUseBeforeDef.ts, 31, 7)) +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 30, 7)) +} + +function foo6() { +>foo6 : Symbol(foo6, Decl(blockScopedVariablesUseBeforeDef.ts, 32, 1)) + + function f() { +>f : Symbol(f, Decl(blockScopedVariablesUseBeforeDef.ts, 34, 17)) + + return x; +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 38, 7)) + } + let x; +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 38, 7)) +} + +function foo7() { +>foo7 : Symbol(foo7, Decl(blockScopedVariablesUseBeforeDef.ts, 39, 1)) + + class A { +>A : Symbol(A, Decl(blockScopedVariablesUseBeforeDef.ts, 41, 17)) + + a = x; +>a : Symbol(A.a, Decl(blockScopedVariablesUseBeforeDef.ts, 42, 13)) +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 45, 7)) + } + let x; +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 45, 7)) +} + +function foo8() { +>foo8 : Symbol(foo8, Decl(blockScopedVariablesUseBeforeDef.ts, 46, 1)) + + let y = class { +>y : Symbol(y, Decl(blockScopedVariablesUseBeforeDef.ts, 49, 7)) + + a = x; +>a : Symbol(y.a, Decl(blockScopedVariablesUseBeforeDef.ts, 49, 19)) +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 52, 7)) + } + let x; +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 52, 7)) +} + +function foo9() { +>foo9 : Symbol(foo9, Decl(blockScopedVariablesUseBeforeDef.ts, 53, 1)) + + let y = class { +>y : Symbol(y, Decl(blockScopedVariablesUseBeforeDef.ts, 56, 7)) + + static a = x; +>a : Symbol(y.a, Decl(blockScopedVariablesUseBeforeDef.ts, 56, 19)) +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 59, 7)) + } + let x; +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 59, 7)) +} + +function foo10() { +>foo10 : Symbol(foo10, Decl(blockScopedVariablesUseBeforeDef.ts, 60, 1)) + + class A { +>A : Symbol(A, Decl(blockScopedVariablesUseBeforeDef.ts, 62, 18)) + + static a = x; +>a : Symbol(A.a, Decl(blockScopedVariablesUseBeforeDef.ts, 63, 13)) +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 66, 7)) + } + let x; +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 66, 7)) +} + +function foo11() { +>foo11 : Symbol(foo11, Decl(blockScopedVariablesUseBeforeDef.ts, 67, 1)) + + function f () { +>f : Symbol(f, Decl(blockScopedVariablesUseBeforeDef.ts, 69, 18)) + + let y = class { +>y : Symbol(y, Decl(blockScopedVariablesUseBeforeDef.ts, 71, 11)) + + static a = x; +>a : Symbol(y.a, Decl(blockScopedVariablesUseBeforeDef.ts, 71, 23)) +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 75, 7)) + } + } + let x; +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 75, 7)) +} + +function foo12() { +>foo12 : Symbol(foo12, Decl(blockScopedVariablesUseBeforeDef.ts, 76, 1)) + + function f () { +>f : Symbol(f, Decl(blockScopedVariablesUseBeforeDef.ts, 78, 18)) + + let y = class { +>y : Symbol(y, Decl(blockScopedVariablesUseBeforeDef.ts, 80, 11)) + + a; +>a : Symbol(y.a, Decl(blockScopedVariablesUseBeforeDef.ts, 80, 23)) + + constructor() { + this.a = x; +>this.a : Symbol(y.a, Decl(blockScopedVariablesUseBeforeDef.ts, 80, 23)) +>this : Symbol(y, Decl(blockScopedVariablesUseBeforeDef.ts, 80, 15)) +>a : Symbol(y.a, Decl(blockScopedVariablesUseBeforeDef.ts, 80, 23)) +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 87, 7)) + } + } + } + let x; +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 87, 7)) +} + +function foo13() { +>foo13 : Symbol(foo13, Decl(blockScopedVariablesUseBeforeDef.ts, 88, 1)) + + let a = { +>a : Symbol(a, Decl(blockScopedVariablesUseBeforeDef.ts, 91, 7)) + + get a() { return x } +>a : Symbol(a, Decl(blockScopedVariablesUseBeforeDef.ts, 91, 13)) +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 94, 7)) + } + let x +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 94, 7)) +} + +function foo14() { +>foo14 : Symbol(foo14, Decl(blockScopedVariablesUseBeforeDef.ts, 95, 1)) + + let a = { +>a : Symbol(a, Decl(blockScopedVariablesUseBeforeDef.ts, 98, 7)) + + a: x +>a : Symbol(a, Decl(blockScopedVariablesUseBeforeDef.ts, 98, 13)) +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 101, 7)) + } + let x +>x : Symbol(x, Decl(blockScopedVariablesUseBeforeDef.ts, 101, 7)) +} + +function foo15() { +>foo15 : Symbol(foo15, Decl(blockScopedVariablesUseBeforeDef.ts, 102, 1)) + + // https://github.com/microsoft/TypeScript/issues/42678 + const [ + a, +>a : Symbol(a, Decl(blockScopedVariablesUseBeforeDef.ts, 106, 11)) + + b, +>b : Symbol(b, Decl(blockScopedVariablesUseBeforeDef.ts, 107, 10)) + + ] = ((): [number, number] => { + (() => console.log(a))(); // should error +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>a : Symbol(a, Decl(blockScopedVariablesUseBeforeDef.ts, 106, 11)) + + console.log(a); // should error +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>a : Symbol(a, Decl(blockScopedVariablesUseBeforeDef.ts, 106, 11)) + + const b = () => a; // should be ok +>b : Symbol(b, Decl(blockScopedVariablesUseBeforeDef.ts, 112, 13)) +>a : Symbol(a, Decl(blockScopedVariablesUseBeforeDef.ts, 106, 11)) + + return [ + 0, + 0, + ]; + })(); +} + +function foo16() { +>foo16 : Symbol(foo16, Decl(blockScopedVariablesUseBeforeDef.ts, 118, 1)) + + let [a] = (() => a)(); +>a : Symbol(a, Decl(blockScopedVariablesUseBeforeDef.ts, 121, 9)) +>a : Symbol(a, Decl(blockScopedVariablesUseBeforeDef.ts, 121, 9)) +} + +function foo17() { +>foo17 : Symbol(foo17, Decl(blockScopedVariablesUseBeforeDef.ts, 122, 1)) + + const promise = (async () => { +>promise : Symbol(promise, Decl(blockScopedVariablesUseBeforeDef.ts, 125, 9)) + + promise +>promise : Symbol(promise, Decl(blockScopedVariablesUseBeforeDef.ts, 125, 9)) + + foo +>foo : Symbol(foo, Decl(blockScopedVariablesUseBeforeDef.ts, 133, 9)) + + await null + promise +>promise : Symbol(promise, Decl(blockScopedVariablesUseBeforeDef.ts, 125, 9)) + + foo +>foo : Symbol(foo, Decl(blockScopedVariablesUseBeforeDef.ts, 133, 9)) + + })() + + const foo = 1; +>foo : Symbol(foo, Decl(blockScopedVariablesUseBeforeDef.ts, 133, 9)) +} + +// #30907 +function wrapI1() { +>wrapI1 : Symbol(wrapI1, Decl(blockScopedVariablesUseBeforeDef.ts, 134, 1)) + + const iter = (function* foo() { +>iter : Symbol(iter, Decl(blockScopedVariablesUseBeforeDef.ts, 138, 9)) +>foo : Symbol(foo, Decl(blockScopedVariablesUseBeforeDef.ts, 138, 18)) + + iter; +>iter : Symbol(iter, Decl(blockScopedVariablesUseBeforeDef.ts, 138, 9)) + + yield 1; + })(); +} + +function wrapI2() { +>wrapI2 : Symbol(wrapI2, Decl(blockScopedVariablesUseBeforeDef.ts, 142, 1)) + + const iter = (async function* foo() { +>iter : Symbol(iter, Decl(blockScopedVariablesUseBeforeDef.ts, 145, 9)) +>foo : Symbol(foo, Decl(blockScopedVariablesUseBeforeDef.ts, 145, 18)) + + iter; +>iter : Symbol(iter, Decl(blockScopedVariablesUseBeforeDef.ts, 145, 9)) + + yield 1; + })(); +} + +function foo18() { +>foo18 : Symbol(foo18, Decl(blockScopedVariablesUseBeforeDef.ts, 149, 1)) + + let a = (() => Enum.Yes)(); +>a : Symbol(a, Decl(blockScopedVariablesUseBeforeDef.ts, 152, 7)) +>Enum.Yes : Symbol(Enum.Yes, Decl(blockScopedVariablesUseBeforeDef.ts, 154, 15)) +>Enum : Symbol(Enum, Decl(blockScopedVariablesUseBeforeDef.ts, 152, 31)) +>Yes : Symbol(Enum.Yes, Decl(blockScopedVariablesUseBeforeDef.ts, 154, 15)) + + enum Enum { +>Enum : Symbol(Enum, Decl(blockScopedVariablesUseBeforeDef.ts, 152, 31)) + + No = 0, +>No : Symbol(Enum.No, Decl(blockScopedVariablesUseBeforeDef.ts, 153, 15)) + + Yes = 1, +>Yes : Symbol(Enum.Yes, Decl(blockScopedVariablesUseBeforeDef.ts, 154, 15)) + } +} + diff --git a/tests/baselines/reference/blockScopedVariablesUseBeforeDef(target=es5).types b/tests/baselines/reference/blockScopedVariablesUseBeforeDef(target=es5).types new file mode 100644 index 0000000000000..a3d7f08e0dc73 --- /dev/null +++ b/tests/baselines/reference/blockScopedVariablesUseBeforeDef(target=es5).types @@ -0,0 +1,550 @@ +//// [tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts] //// + +=== blockScopedVariablesUseBeforeDef.ts === +function foo0() { +>foo0 : () => void +> : ^^^^^^^^^^ + + let a = x; +>a : any +> : ^^^ +>x : any +> : ^^^ + + let x; +>x : any +> : ^^^ +} + +function foo1() { +>foo1 : () => void +> : ^^^^^^^^^^ + + let a = () => x; +>a : () => any +> : ^^^^^^^^^ +>() => x : () => any +> : ^^^^^^^^^ +>x : any +> : ^^^ + + let x; +>x : any +> : ^^^ +} + +function foo2() { +>foo2 : () => void +> : ^^^^^^^^^^ + + let a = function () { return x; } +>a : () => any +> : ^^^^^^^^^ +>function () { return x; } : () => any +> : ^^^^^^^^^ +>x : any +> : ^^^ + + let x; +>x : any +> : ^^^ +} + +function foo3() { +>foo3 : () => void +> : ^^^^^^^^^^ + + class X { +>X : X +> : ^ + + m() { return x;} +>m : () => any +> : ^^^^^^^^^ +>x : any +> : ^^^ + } + let x; +>x : any +> : ^^^ +} + +function foo4() { +>foo4 : () => void +> : ^^^^^^^^^^ + + let y = class { +>y : typeof y +> : ^^^^^^^^ +>class { m() { return x; } } : typeof y +> : ^^^^^^^^ + + m() { return x; } +>m : () => any +> : ^^^^^^^^^ +>x : any +> : ^^^ + + }; + let x; +>x : any +> : ^^^ +} + +function foo5() { +>foo5 : () => void +> : ^^^^^^^^^^ + + let x = () => y; +>x : () => () => any +> : ^^^^^^^^^^^^^^^ +>() => y : () => () => any +> : ^^^^^^^^^^^^^^^ +>y : () => () => any +> : ^^^^^^^^^^^^^^^ + + let y = () => x; +>y : () => () => any +> : ^^^^^^^^^^^^^^^ +>() => x : () => () => any +> : ^^^^^^^^^^^^^^^ +>x : () => () => any +> : ^^^^^^^^^^^^^^^ +} + +function foo6() { +>foo6 : () => void +> : ^^^^^^^^^^ + + function f() { +>f : () => any +> : ^^^^^^^^^ + + return x; +>x : any +> : ^^^ + } + let x; +>x : any +> : ^^^ +} + +function foo7() { +>foo7 : () => void +> : ^^^^^^^^^^ + + class A { +>A : A +> : ^ + + a = x; +>a : any +> : ^^^ +>x : any +> : ^^^ + } + let x; +>x : any +> : ^^^ +} + +function foo8() { +>foo8 : () => void +> : ^^^^^^^^^^ + + let y = class { +>y : typeof y +> : ^^^^^^^^ +>class { a = x; } : typeof y +> : ^^^^^^^^ + + a = x; +>a : any +> : ^^^ +>x : any +> : ^^^ + } + let x; +>x : any +> : ^^^ +} + +function foo9() { +>foo9 : () => void +> : ^^^^^^^^^^ + + let y = class { +>y : typeof y +> : ^^^^^^^^ +>class { static a = x; } : typeof y +> : ^^^^^^^^ + + static a = x; +>a : any +> : ^^^ +>x : any +> : ^^^ + } + let x; +>x : any +> : ^^^ +} + +function foo10() { +>foo10 : () => void +> : ^^^^^^^^^^ + + class A { +>A : A +> : ^ + + static a = x; +>a : any +> : ^^^ +>x : any +> : ^^^ + } + let x; +>x : any +> : ^^^ +} + +function foo11() { +>foo11 : () => void +> : ^^^^^^^^^^ + + function f () { +>f : () => void +> : ^^^^^^^^^^ + + let y = class { +>y : typeof y +> : ^^^^^^^^ +>class { static a = x; } : typeof y +> : ^^^^^^^^ + + static a = x; +>a : any +> : ^^^ +>x : any +> : ^^^ + } + } + let x; +>x : any +> : ^^^ +} + +function foo12() { +>foo12 : () => void +> : ^^^^^^^^^^ + + function f () { +>f : () => void +> : ^^^^^^^^^^ + + let y = class { +>y : typeof y +> : ^^^^^^^^ +>class { a; constructor() { this.a = x; } } : typeof y +> : ^^^^^^^^ + + a; +>a : any +> : ^^^ + + constructor() { + this.a = x; +>this.a = x : any +> : ^^^ +>this.a : any +> : ^^^ +>this : this +> : ^^^^ +>a : any +> : ^^^ +>x : any +> : ^^^ + } + } + } + let x; +>x : any +> : ^^^ +} + +function foo13() { +>foo13 : () => void +> : ^^^^^^^^^^ + + let a = { +>a : { readonly a: any; } +> : ^^^^^^^^^^^^^^^^^^^^ +>{ get a() { return x } } : { readonly a: any; } +> : ^^^^^^^^^^^^^^^^^^^^ + + get a() { return x } +>a : any +> : ^^^ +>x : any +> : ^^^ + } + let x +>x : any +> : ^^^ +} + +function foo14() { +>foo14 : () => void +> : ^^^^^^^^^^ + + let a = { +>a : { a: any; } +> : ^^^^^^^^^^^ +>{ a: x } : { a: any; } +> : ^^^^^^^^^^^ + + a: x +>a : any +> : ^^^ +>x : any +> : ^^^ + } + let x +>x : any +> : ^^^ +} + +function foo15() { +>foo15 : () => void +> : ^^^^^^^^^^ + + // https://github.com/microsoft/TypeScript/issues/42678 + const [ + a, +>a : number +> : ^^^^^^ + + b, +>b : number +> : ^^^^^^ + + ] = ((): [number, number] => { +>((): [number, number] => { (() => console.log(a))(); // should error console.log(a); // should error const b = () => a; // should be ok return [ 0, 0, ]; })() : [number, number] +> : ^^^^^^^^^^^^^^^^ +>((): [number, number] => { (() => console.log(a))(); // should error console.log(a); // should error const b = () => a; // should be ok return [ 0, 0, ]; }) : () => [number, number] +> : ^^^^^^ +>(): [number, number] => { (() => console.log(a))(); // should error console.log(a); // should error const b = () => a; // should be ok return [ 0, 0, ]; } : () => [number, number] +> : ^^^^^^ + + (() => console.log(a))(); // should error +>(() => console.log(a))() : void +> : ^^^^ +>(() => console.log(a)) : () => void +> : ^^^^^^^^^^ +>() => console.log(a) : () => void +> : ^^^^^^^^^^ +>console.log(a) : void +> : ^^^^ +>console.log : (...data: any[]) => void +> : ^^^^ ^^ ^^^^^ +>console : Console +> : ^^^^^^^ +>log : (...data: any[]) => void +> : ^^^^ ^^ ^^^^^ +>a : number +> : ^^^^^^ + + console.log(a); // should error +>console.log(a) : void +> : ^^^^ +>console.log : (...data: any[]) => void +> : ^^^^ ^^ ^^^^^ +>console : Console +> : ^^^^^^^ +>log : (...data: any[]) => void +> : ^^^^ ^^ ^^^^^ +>a : number +> : ^^^^^^ + + const b = () => a; // should be ok +>b : () => number +> : ^^^^^^^^^^^^ +>() => a : () => number +> : ^^^^^^^^^^^^ +>a : number +> : ^^^^^^ + + return [ +>[ 0, 0, ] : [number, number] +> : ^^^^^^^^^^^^^^^^ + + 0, +>0 : 0 +> : ^ + + 0, +>0 : 0 +> : ^ + + ]; + })(); +} + +function foo16() { +>foo16 : () => void +> : ^^^^^^^^^^ + + let [a] = (() => a)(); +>a : any +> : ^^^ +>(() => a)() : any +> : ^^^ +>(() => a) : () => any +> : ^^^^^^^^^ +>() => a : () => any +> : ^^^^^^^^^ +>a : any +> : ^^^ +} + +function foo17() { +>foo17 : () => void +> : ^^^^^^^^^^ + + const promise = (async () => { +>promise : Promise +> : ^^^^^^^^^^^^^ +>(async () => { promise foo await null promise foo })() : Promise +> : ^^^^^^^^^^^^^ +>(async () => { promise foo await null promise foo }) : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ +>async () => { promise foo await null promise foo } : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + + promise +>promise : Promise +> : ^^^^^^^^^^^^^ + + foo +>foo : 1 +> : ^ + + await null +>await null : null +> : ^^^^ + + promise +>promise : Promise +> : ^^^^^^^^^^^^^ + + foo +>foo : 1 +> : ^ + + })() + + const foo = 1; +>foo : 1 +> : ^ +>1 : 1 +> : ^ +} + +// #30907 +function wrapI1() { +>wrapI1 : () => void +> : ^^^^^^^^^^ + + const iter = (function* foo() { +>iter : Generator +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>(function* foo() { iter; yield 1; })() : Generator +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>(function* foo() { iter; yield 1; }) : () => Generator +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>function* foo() { iter; yield 1; } : () => Generator +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>foo : () => Generator +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + iter; +>iter : Generator +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + yield 1; +>yield 1 : any +> : ^^^ +>1 : 1 +> : ^ + + })(); +} + +function wrapI2() { +>wrapI2 : () => void +> : ^^^^^^^^^^ + + const iter = (async function* foo() { +>iter : AsyncGenerator +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>(async function* foo() { iter; yield 1; })() : AsyncGenerator +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>(async function* foo() { iter; yield 1; }) : () => AsyncGenerator +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>async function* foo() { iter; yield 1; } : () => AsyncGenerator +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>foo : () => AsyncGenerator +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + iter; +>iter : AsyncGenerator +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + yield 1; +>yield 1 : any +> : ^^^ +>1 : 1 +> : ^ + + })(); +} + +function foo18() { +>foo18 : () => void +> : ^^^^^^^^^^ + + let a = (() => Enum.Yes)(); +>a : Enum +> : ^^^^ +>(() => Enum.Yes)() : Enum +> : ^^^^ +>(() => Enum.Yes) : () => Enum +> : ^^^^^^^^^^ +>() => Enum.Yes : () => Enum +> : ^^^^^^^^^^ +>Enum.Yes : Enum.Yes +> : ^^^^^^^^ +>Enum : typeof Enum +> : ^^^^^^^^^^^ +>Yes : Enum.Yes +> : ^^^^^^^^ + + enum Enum { +>Enum : Enum +> : ^^^^ + + No = 0, +>No : Enum.No +> : ^^^^^^^ +>0 : 0 +> : ^ + + Yes = 1, +>Yes : Enum.Yes +> : ^^^^^^^^ +>1 : 1 +> : ^ + } +} + diff --git a/tests/baselines/reference/bluebirdStaticThis.js b/tests/baselines/reference/bluebirdStaticThis.js index 4424200e47596..23a9018c9b464 100644 --- a/tests/baselines/reference/bluebirdStaticThis.js +++ b/tests/baselines/reference/bluebirdStaticThis.js @@ -141,14 +141,13 @@ fooProm = Promise.try(Promise, () => { }, arr, x); //// [bluebirdStaticThis.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -fooProm = Promise.try(Promise, function () { +fooProm = Promise.try(Promise, () => { return foo; }); -fooProm = Promise.try(Promise, function () { +fooProm = Promise.try(Promise, () => { return foo; }, arr); -fooProm = Promise.try(Promise, function () { +fooProm = Promise.try(Promise, () => { return foo; }, arr, x); +export {}; diff --git a/tests/baselines/reference/booleanFilterAnyArray.js b/tests/baselines/reference/booleanFilterAnyArray.js index 40c2cc5e91c70..9da91fc0d3f02 100644 --- a/tests/baselines/reference/booleanFilterAnyArray.js +++ b/tests/baselines/reference/booleanFilterAnyArray.js @@ -34,6 +34,6 @@ var ys; var ys = realanys.filter(Boolean); var foo = [{ name: 'x' }]; var foor; -var foor = foo.filter(function (x) { return x.name; }); +var foor = foo.filter(x => x.name); var foos; -var foos = [true, true, false, null].filter(function (thing) { return thing !== null; }); +var foos = [true, true, false, null].filter((thing) => thing !== null); diff --git a/tests/baselines/reference/booleanLiteralsContextuallyTypedFromUnion.js b/tests/baselines/reference/booleanLiteralsContextuallyTypedFromUnion.js index 36f1719bd640d..257679005292c 100644 --- a/tests/baselines/reference/booleanLiteralsContextuallyTypedFromUnion.js +++ b/tests/baselines/reference/booleanLiteralsContextuallyTypedFromUnion.js @@ -30,13 +30,13 @@ let Success = () => //// [booleanLiteralsContextuallyTypedFromUnion.jsx] "use strict"; /// -var isIt = Math.random() > 0.5; -var c = isIt ? { isIt: isIt, text: 'hey' } : { isIt: isIt, value: 123 }; -var cc = isIt ? { isIt: isIt, text: 'hey' } : { isIt: isIt, value: 123 }; -var Funk = function (_props) { return
Hello
; }; -var Fail1 = function () { return ; }; -var Fail2 = function () { return ; }; -var True = true; -var Fail3 = function () { return ; }; -var attrs2 = { optionalBool: true, mandatoryFn: function () { } }; -var Success = function () { return ; }; +const isIt = Math.random() > 0.5; +const c = isIt ? { isIt, text: 'hey' } : { isIt, value: 123 }; +const cc = isIt ? { isIt: isIt, text: 'hey' } : { isIt: isIt, value: 123 }; +let Funk = (_props) =>
Hello
; +let Fail1 = () => { }} optionalBool={true}/>; +let Fail2 = () => { }} optionalBool={true}/>; +let True = true; +let Fail3 = () => { }} optionalBool={True}/>; +let attrs2 = { optionalBool: true, mandatoryFn: () => { } }; +let Success = () => ; diff --git a/tests/baselines/reference/bundlerCommonJS.js b/tests/baselines/reference/bundlerCommonJS.js index 0d8c4c13d3c90..6d419cecbcbb5 100644 --- a/tests/baselines/reference/bundlerCommonJS.js +++ b/tests/baselines/reference/bundlerCommonJS.js @@ -34,12 +34,12 @@ import { x } from "pkg"; // Error //// [requires.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var pkg = require("pkg"); +const pkg = require("pkg"); pkg.x; //// [imports.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var pkg_1 = require("pkg"); +const pkg_1 = require("pkg"); pkg_1.x; //// [real-imports.mjs] export {}; diff --git a/tests/baselines/reference/bundlerDirectoryModule(module=node20,moduleresolution=nodenext).trace.json b/tests/baselines/reference/bundlerDirectoryModule(module=node20,moduleresolution=nodenext).trace.json index 33c07284c47aa..c43192c63c7b8 100644 --- a/tests/baselines/reference/bundlerDirectoryModule(module=node20,moduleresolution=nodenext).trace.json +++ b/tests/baselines/reference/bundlerDirectoryModule(module=node20,moduleresolution=nodenext).trace.json @@ -147,13 +147,5 @@ "File '/.ts/package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups.", "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups." ] \ No newline at end of file diff --git a/tests/baselines/reference/bundlerDirectoryModule(module=nodenext,moduleresolution=nodenext).trace.json b/tests/baselines/reference/bundlerDirectoryModule(module=nodenext,moduleresolution=nodenext).trace.json index 461c1a41b3285..c43192c63c7b8 100644 --- a/tests/baselines/reference/bundlerDirectoryModule(module=nodenext,moduleresolution=nodenext).trace.json +++ b/tests/baselines/reference/bundlerDirectoryModule(module=nodenext,moduleresolution=nodenext).trace.json @@ -147,53 +147,5 @@ "File '/.ts/package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups.", "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", - "File '/package.json' does not exist according to earlier cached lookups.", - "File '/.ts/package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups." ] \ No newline at end of file diff --git a/tests/baselines/reference/bundlerImportESM(module=esnext).js b/tests/baselines/reference/bundlerImportESM(module=esnext).js index 54887aeaed8f9..b594b0de06866 100644 --- a/tests/baselines/reference/bundlerImportESM(module=esnext).js +++ b/tests/baselines/reference/bundlerImportESM(module=esnext).js @@ -14,7 +14,7 @@ import { esm } from "./esm.mjs"; //// [esm.mjs] -export var esm = 0; +export const esm = 0; //// [not-actually-cjs.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/tests/baselines/reference/bundlerImportESM(module=preserve).js b/tests/baselines/reference/bundlerImportESM(module=preserve).js index ed877b14da7f0..ca4147bf3dee4 100644 --- a/tests/baselines/reference/bundlerImportESM(module=preserve).js +++ b/tests/baselines/reference/bundlerImportESM(module=preserve).js @@ -14,6 +14,6 @@ import { esm } from "./esm.mjs"; //// [esm.mjs] -export var esm = 0; +export const esm = 0; //// [not-actually-cjs.cjs] //// [still-not-cjs.js] diff --git a/tests/baselines/reference/bundlerRelative1(module=esnext).js b/tests/baselines/reference/bundlerRelative1(module=esnext).js index ffc4d34643a30..4d299af2bb186 100644 --- a/tests/baselines/reference/bundlerRelative1(module=esnext).js +++ b/tests/baselines/reference/bundlerRelative1(module=esnext).js @@ -33,8 +33,8 @@ import * as cjs from "./types/cjs"; //// [index.js] -export var x = 0; +export const x = 0; //// [index.js] -export var y = 0; +export const y = 0; //// [main.js] export {}; diff --git a/tests/baselines/reference/bundlerRelative1(module=preserve).js b/tests/baselines/reference/bundlerRelative1(module=preserve).js index 28c5ac26a7df3..f5cf9e60b23d7 100644 --- a/tests/baselines/reference/bundlerRelative1(module=preserve).js +++ b/tests/baselines/reference/bundlerRelative1(module=preserve).js @@ -33,7 +33,7 @@ import * as cjs from "./types/cjs"; //// [index.js] -export var x = 0; +export const x = 0; //// [index.js] -export var y = 0; +export const y = 0; //// [main.js] diff --git a/tests/baselines/reference/bundlerSyntaxRestrictions(module=esnext).js b/tests/baselines/reference/bundlerSyntaxRestrictions(module=esnext).js index ab856841dba85..b13365b4cffad 100644 --- a/tests/baselines/reference/bundlerSyntaxRestrictions(module=esnext).js +++ b/tests/baselines/reference/bundlerSyntaxRestrictions(module=esnext).js @@ -32,10 +32,10 @@ export const a = "a"; //// [a.js] -export var a = "a"; +export const a = "a"; //// [mainJs.js] import("./a"); -var _ = require("./a"); +const _ = require("./a"); _.a; // any export {}; //// [main.js] diff --git a/tests/baselines/reference/bundlerSyntaxRestrictions(module=preserve).js b/tests/baselines/reference/bundlerSyntaxRestrictions(module=preserve).js index 9a8cd79f58eec..00dc0a7eec443 100644 --- a/tests/baselines/reference/bundlerSyntaxRestrictions(module=preserve).js +++ b/tests/baselines/reference/bundlerSyntaxRestrictions(module=preserve).js @@ -32,10 +32,10 @@ export const a = "a"; //// [a.js] -export var a = "a"; +export const a = "a"; //// [mainJs.js] import("./a"); -var _ = require("./a"); +const _ = require("./a"); _.a; // any //// [main.js] module.exports = {}; diff --git a/tests/baselines/reference/cachedContextualTypes.js b/tests/baselines/reference/cachedContextualTypes.js index 760a82a1fad93..d70f7edcb4640 100644 --- a/tests/baselines/reference/cachedContextualTypes.js +++ b/tests/baselines/reference/cachedContextualTypes.js @@ -25,16 +25,13 @@ createInstance(MenuWorkbenchToolBar, { //// [cachedContextualTypes.js] -"use strict"; // Repro from #52198 -Object.defineProperty(exports, "__esModule", { value: true }); -var MenuWorkbenchToolBar = /** @class */ (function () { - function MenuWorkbenchToolBar(options) { - } - return MenuWorkbenchToolBar; -}()); +class MenuWorkbenchToolBar { + constructor(options) { } +} createInstance(MenuWorkbenchToolBar, { toolbarOptions: { - foo: function (bar) { return bar; } + foo(bar) { return bar; } } }); +export {}; diff --git a/tests/baselines/reference/cachedModuleResolution1.js b/tests/baselines/reference/cachedModuleResolution1.js index 14081ac41923a..1a8547c628e42 100644 --- a/tests/baselines/reference/cachedModuleResolution1.js +++ b/tests/baselines/reference/cachedModuleResolution1.js @@ -11,8 +11,6 @@ import {x} from "foo"; //// [app.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [lib.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/tests/baselines/reference/cachedModuleResolution1.trace.json b/tests/baselines/reference/cachedModuleResolution1.trace.json index b12537243d472..46a74ceac93dc 100644 --- a/tests/baselines/reference/cachedModuleResolution1.trace.json +++ b/tests/baselines/reference/cachedModuleResolution1.trace.json @@ -5,7 +5,7 @@ "File '/package.json' does not exist.", "======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========", "Explicitly specified module resolution kind: 'Bundler'.", - "Resolving in CJS mode with conditions 'require', 'types'.", + "Resolving in CJS mode with conditions 'import', 'types'.", "File '/a/b/c/d/e/package.json' does not exist.", "File '/a/b/c/d/package.json' does not exist.", "File '/a/b/c/package.json' does not exist.", @@ -24,7 +24,7 @@ "======== Module name 'foo' was successfully resolved to '/a/b/node_modules/foo.d.ts'. ========", "======== Resolving module 'foo' from '/a/b/c/lib.ts'. ========", "Explicitly specified module resolution kind: 'Bundler'.", - "Resolving in CJS mode with conditions 'require', 'types'.", + "Resolving in CJS mode with conditions 'import', 'types'.", "File '/a/b/c/package.json' does not exist according to earlier cached lookups.", "File '/a/b/package.json' does not exist according to earlier cached lookups.", "File '/a/package.json' does not exist according to earlier cached lookups.", diff --git a/tests/baselines/reference/cachedModuleResolution2.js b/tests/baselines/reference/cachedModuleResolution2.js index d649b3c53ee37..df13017b2e145 100644 --- a/tests/baselines/reference/cachedModuleResolution2.js +++ b/tests/baselines/reference/cachedModuleResolution2.js @@ -11,8 +11,6 @@ import {x} from "foo"; //// [lib.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [app.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/tests/baselines/reference/cachedModuleResolution2.trace.json b/tests/baselines/reference/cachedModuleResolution2.trace.json index 089dd964ad9dc..869ddc8a29b4e 100644 --- a/tests/baselines/reference/cachedModuleResolution2.trace.json +++ b/tests/baselines/reference/cachedModuleResolution2.trace.json @@ -5,7 +5,7 @@ "File '/package.json' does not exist.", "======== Resolving module 'foo' from '/a/b/c/lib.ts'. ========", "Explicitly specified module resolution kind: 'Bundler'.", - "Resolving in CJS mode with conditions 'require', 'types'.", + "Resolving in CJS mode with conditions 'import', 'types'.", "File '/a/b/c/package.json' does not exist.", "File '/a/b/package.json' does not exist according to earlier cached lookups.", "File '/a/package.json' does not exist according to earlier cached lookups.", @@ -20,7 +20,7 @@ "======== Module name 'foo' was successfully resolved to '/a/b/node_modules/foo.d.ts'. ========", "======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========", "Explicitly specified module resolution kind: 'Bundler'.", - "Resolving in CJS mode with conditions 'require', 'types'.", + "Resolving in CJS mode with conditions 'import', 'types'.", "File '/a/b/c/d/e/package.json' does not exist.", "File '/a/b/c/d/package.json' does not exist.", "File '/a/b/c/package.json' does not exist according to earlier cached lookups.", diff --git a/tests/baselines/reference/cachedModuleResolution3.js b/tests/baselines/reference/cachedModuleResolution3.js index 3fce23e3f228c..90568ad5195d4 100644 --- a/tests/baselines/reference/cachedModuleResolution3.js +++ b/tests/baselines/reference/cachedModuleResolution3.js @@ -10,8 +10,6 @@ import {x} from "foo"; import {x} from "foo"; //// [app.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [lib.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/tests/baselines/reference/cachedModuleResolution4.js b/tests/baselines/reference/cachedModuleResolution4.js index 2236fdf34ce4c..68313ebeda224 100644 --- a/tests/baselines/reference/cachedModuleResolution4.js +++ b/tests/baselines/reference/cachedModuleResolution4.js @@ -11,8 +11,6 @@ import {x} from "foo"; //// [lib.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [app.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/tests/baselines/reference/cachedModuleResolution5.js b/tests/baselines/reference/cachedModuleResolution5.js index dfabec484bd12..9656521e13e6d 100644 --- a/tests/baselines/reference/cachedModuleResolution5.js +++ b/tests/baselines/reference/cachedModuleResolution5.js @@ -11,8 +11,6 @@ import {x} from "foo"; //// [app.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [lib.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/tests/baselines/reference/cachedModuleResolution5.trace.json b/tests/baselines/reference/cachedModuleResolution5.trace.json index 223ee2bb3939f..aa71058ef86d5 100644 --- a/tests/baselines/reference/cachedModuleResolution5.trace.json +++ b/tests/baselines/reference/cachedModuleResolution5.trace.json @@ -5,7 +5,7 @@ "File '/package.json' does not exist.", "======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========", "Explicitly specified module resolution kind: 'Bundler'.", - "Resolving in CJS mode with conditions 'require', 'types'.", + "Resolving in CJS mode with conditions 'import', 'types'.", "File '/a/b/c/d/e/package.json' does not exist.", "File '/a/b/c/d/package.json' does not exist.", "File '/a/b/c/package.json' does not exist.", @@ -24,7 +24,7 @@ "======== Module name 'foo' was successfully resolved to '/a/b/node_modules/foo.d.ts'. ========", "======== Resolving module 'foo' from '/a/b/lib.ts'. ========", "Explicitly specified module resolution kind: 'Bundler'.", - "Resolving in CJS mode with conditions 'require', 'types'.", + "Resolving in CJS mode with conditions 'import', 'types'.", "File '/a/b/package.json' does not exist according to earlier cached lookups.", "File '/a/package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups.", diff --git a/tests/baselines/reference/cachedModuleResolution6.js b/tests/baselines/reference/cachedModuleResolution6.js index 8a19b1465bc61..047489af86238 100644 --- a/tests/baselines/reference/cachedModuleResolution6.js +++ b/tests/baselines/reference/cachedModuleResolution6.js @@ -7,8 +7,6 @@ import {x} from "foo"; import {x} from "foo"; //// [app.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [lib.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/tests/baselines/reference/cachedModuleResolution6.trace.json b/tests/baselines/reference/cachedModuleResolution6.trace.json index 07f830dabe7d0..609886d8d4528 100644 --- a/tests/baselines/reference/cachedModuleResolution6.trace.json +++ b/tests/baselines/reference/cachedModuleResolution6.trace.json @@ -1,7 +1,7 @@ [ "======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========", "Explicitly specified module resolution kind: 'Bundler'.", - "Resolving in CJS mode with conditions 'require', 'types'.", + "Resolving in CJS mode with conditions 'import', 'types'.", "File '/a/b/c/d/e/package.json' does not exist.", "File '/a/b/c/d/package.json' does not exist.", "File '/a/b/c/package.json' does not exist.", @@ -26,7 +26,7 @@ "======== Module name 'foo' was not resolved. ========", "======== Resolving module 'foo' from '/a/b/c/lib.ts'. ========", "Explicitly specified module resolution kind: 'Bundler'.", - "Resolving in CJS mode with conditions 'require', 'types'.", + "Resolving in CJS mode with conditions 'import', 'types'.", "File '/a/b/c/package.json' does not exist according to earlier cached lookups.", "File '/a/b/package.json' does not exist according to earlier cached lookups.", "File '/a/package.json' does not exist according to earlier cached lookups.", diff --git a/tests/baselines/reference/cachedModuleResolution7.js b/tests/baselines/reference/cachedModuleResolution7.js index 8c9855b143520..f6ed19d6e2b03 100644 --- a/tests/baselines/reference/cachedModuleResolution7.js +++ b/tests/baselines/reference/cachedModuleResolution7.js @@ -8,8 +8,6 @@ import {x} from "foo"; //// [lib.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [app.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/tests/baselines/reference/cachedModuleResolution7.trace.json b/tests/baselines/reference/cachedModuleResolution7.trace.json index 129b46839332d..da6a0bd836159 100644 --- a/tests/baselines/reference/cachedModuleResolution7.trace.json +++ b/tests/baselines/reference/cachedModuleResolution7.trace.json @@ -1,7 +1,7 @@ [ "======== Resolving module 'foo' from '/a/b/c/lib.ts'. ========", "Explicitly specified module resolution kind: 'Bundler'.", - "Resolving in CJS mode with conditions 'require', 'types'.", + "Resolving in CJS mode with conditions 'import', 'types'.", "File '/a/b/c/package.json' does not exist.", "File '/a/b/package.json' does not exist.", "File '/a/package.json' does not exist.", @@ -20,7 +20,7 @@ "======== Module name 'foo' was not resolved. ========", "======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========", "Explicitly specified module resolution kind: 'Bundler'.", - "Resolving in CJS mode with conditions 'require', 'types'.", + "Resolving in CJS mode with conditions 'import', 'types'.", "File '/a/b/c/d/e/package.json' does not exist.", "File '/a/b/c/d/package.json' does not exist.", "File '/a/b/c/package.json' does not exist according to earlier cached lookups.", diff --git a/tests/baselines/reference/cachedModuleResolution8.js b/tests/baselines/reference/cachedModuleResolution8.js index c071c1dbf94ec..8a9c03e899bd8 100644 --- a/tests/baselines/reference/cachedModuleResolution8.js +++ b/tests/baselines/reference/cachedModuleResolution8.js @@ -7,8 +7,6 @@ import {x} from "foo"; import {x} from "foo"; //// [app.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [lib.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/tests/baselines/reference/cachedModuleResolution9.js b/tests/baselines/reference/cachedModuleResolution9.js index 17ef035df3a8c..06830b43964f9 100644 --- a/tests/baselines/reference/cachedModuleResolution9.js +++ b/tests/baselines/reference/cachedModuleResolution9.js @@ -9,8 +9,6 @@ import {x} from "foo"; //// [lib.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [app.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/tests/baselines/reference/callChain.3.js b/tests/baselines/reference/callChain.3.js index 38f02912a2dfe..f97b833b64182 100644 --- a/tests/baselines/reference/callChain.3.js +++ b/tests/baselines/reference/callChain.3.js @@ -15,10 +15,10 @@ t1 = a!.m!({x: 12}); //// [callChain.3.js] "use strict"; var _a, _b, _c, _d, _e; -var n1 = (_a = a === null || a === void 0 ? void 0 : a.m) === null || _a === void 0 ? void 0 : _a.call(a, { x: 12 }); // should be an error (`undefined` is not assignable to `number`) -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 +const n1 = (_a = a === null || a === void 0 ? void 0 : a.m) === null || _a === void 0 ? void 0 : _a.call(a, { x: 12 }); // should be an error (`undefined` is not assignable to `number`) +const n2 = (_b = a === null || a === void 0 ? void 0 : a.m) === null || _b === void 0 ? void 0 : _b.call(a, { x: absorb() }); // likewise +const 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 +const 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 }); +let 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 1fca98bc97818..a8a8806923709 100644 --- a/tests/baselines/reference/callChain.js +++ b/tests/baselines/reference/callChain.js @@ -45,41 +45,32 @@ o2?.b()!.toString!; //// [callChain.js] "use strict"; -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o; o1 === null || o1 === void 0 ? void 0 : o1(); o1 === null || o1 === void 0 ? void 0 : o1(1); -o1 === null || o1 === void 0 ? void 0 : o1.apply(void 0, [1, 2]); -o1 === null || o1 === void 0 ? void 0 : o1.apply(void 0, __spreadArray(__spreadArray([1], [2, 3], false), [4], false)); +o1 === null || o1 === void 0 ? void 0 : o1(...[1, 2]); +o1 === null || o1 === void 0 ? void 0 : o1(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]); -o2 === null || o2 === void 0 ? void 0 : o2.b.apply(o2, __spreadArray(__spreadArray([1], [2, 3], false), [4], false)); +o2 === null || o2 === void 0 ? void 0 : o2.b(...[1, 2]); +o2 === null || o2 === void 0 ? void 0 : o2.b(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]); -o2 === null || o2 === void 0 ? void 0 : o2["b"].apply(o2, __spreadArray(__spreadArray([1], [2, 3], false), [4], false)); +o2 === null || o2 === void 0 ? void 0 : o2["b"](...[1, 2]); +o2 === null || o2 === void 0 ? void 0 : o2["b"](1, ...[2, 3], 4); (_a = o3.b) === null || _a === void 0 ? void 0 : _a.call(o3).c; (_b = o3.b) === null || _b === void 0 ? void 0 : _b.call(o3, 1).c; -(_c = o3.b) === null || _c === void 0 ? void 0 : _c.call.apply(_c, __spreadArray([o3], [1, 2], false)).c; -(_d = o3.b) === null || _d === void 0 ? void 0 : _d.call.apply(_d, __spreadArray(__spreadArray([o3, 1], [2, 3], false), [4], false)).c; +(_c = o3.b) === null || _c === void 0 ? void 0 : _c.call(o3, ...[1, 2]).c; +(_d = o3.b) === null || _d === void 0 ? void 0 : _d.call(o3, 1, ...[2, 3], 4).c; (_e = o3.b) === null || _e === void 0 ? void 0 : _e.call(o3)["c"]; (_f = o3.b) === null || _f === void 0 ? void 0 : _f.call(o3, 1)["c"]; -(_g = o3.b) === null || _g === void 0 ? void 0 : _g.call.apply(_g, __spreadArray([o3], [1, 2], false))["c"]; -(_h = o3.b) === null || _h === void 0 ? void 0 : _h.call.apply(_h, __spreadArray(__spreadArray([o3, 1], [2, 3], false), [4], false))["c"]; +(_g = o3.b) === null || _g === void 0 ? void 0 : _g.call(o3, ...[1, 2])["c"]; +(_h = o3.b) === null || _h === void 0 ? void 0 : _h.call(o3, 1, ...[2, 3], 4)["c"]; (_j = o3["b"]) === null || _j === void 0 ? void 0 : _j.call(o3).c; (_k = o3["b"]) === null || _k === void 0 ? void 0 : _k.call(o3, 1).c; -(_l = o3["b"]) === null || _l === void 0 ? void 0 : _l.call.apply(_l, __spreadArray([o3], [1, 2], false)).c; -(_m = o3["b"]) === null || _m === void 0 ? void 0 : _m.call.apply(_m, __spreadArray(__spreadArray([o3, 1], [2, 3], false), [4], false)).c; -var v = o4 === null || o4 === void 0 ? void 0 : o4(incr); +(_l = o3["b"]) === null || _l === void 0 ? void 0 : _l.call(o3, ...[1, 2]).c; +(_m = o3["b"]) === null || _m === void 0 ? void 0 : _m.call(o3, 1, ...[2, 3], 4).c; +const 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; diff --git a/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.js b/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.js index 956611581c8d2..293ff621cbbc2 100644 --- a/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.js +++ b/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.js @@ -52,31 +52,25 @@ var r7b = i2.f(1, ''); function f(x, y) { return null; } var r1 = f(1, ''); var r1b = f(1, ''); -var f2 = function (x, y) { return null; }; +var f2 = (x, y) => { return null; }; var r2 = f2(1, ''); var r2b = f2(1, ''); var r3 = f3(1, ''); var r3b = f3(1, ''); -var C = /** @class */ (function () { - function C() { - } - C.prototype.f = function (x, y) { +class C { + f(x, y) { return null; - }; - return C; -}()); + } +} var r4 = (new C()).f(1, ''); var r4b = (new C()).f(1, ''); var r5 = i.f(1, ''); var r5b = i.f(1, ''); -var C2 = /** @class */ (function () { - function C2() { - } - C2.prototype.f = function (x, y) { +class C2 { + f(x, y) { return null; - }; - return C2; -}()); + } +} var r6 = (new C2()).f(1, ''); var r6b = (new C2()).f(1, ''); var r7 = i2.f(1, ''); diff --git a/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.js b/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.js index 5bcb94f0d1860..c3551a68add46 100644 --- a/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.js +++ b/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.js @@ -42,29 +42,23 @@ var r7 = i2.f(1); // 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 = (x) => { return null; }; var r2 = f2(1); var f3; var r3 = f3(1); -var C = /** @class */ (function () { - function C() { - } - C.prototype.f = function (x) { +class C { + f(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) { +class C2 { + f(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 3ed8d92d72537..9940f580d956c 100644 --- a/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.js +++ b/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.js @@ -50,27 +50,21 @@ var r8 = a2(); // all invocations here are illegal function f(x) { return null; } var r = f(1); -var f2 = function (x) { return null; }; +var f2 = (x) => { return null; }; var r2 = f2(1); var r3 = f3(1); -var C = /** @class */ (function () { - function C() { - } - C.prototype.f = function (x) { +class C { + f(x) { return null; - }; - return C; -}()); + } +} var r4 = (new C()).f(1); var r5 = i.f(1); -var C2 = /** @class */ (function () { - function C2() { - } - C2.prototype.f = function (x) { +class C2 { + f(x) { return null; - }; - return C2; -}()); + } +} var r6 = (new C2()).f(1); var r7 = i2.f(1); var r8 = a(); diff --git a/tests/baselines/reference/callOfConditionalTypeWithConcreteBranches.js b/tests/baselines/reference/callOfConditionalTypeWithConcreteBranches.js index 22dde43604091..257c144596c5c 100644 --- a/tests/baselines/reference/callOfConditionalTypeWithConcreteBranches.js +++ b/tests/baselines/reference/callOfConditionalTypeWithConcreteBranches.js @@ -44,21 +44,20 @@ export type AddFirstParameterToFunctions = { }; //// [callOfConditionalTypeWithConcreteBranches.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); function fn(arg) { // Expected: OK // Actual: Cannot convert 10 to number & T arg(10); } // Legal invocations are not problematic -fn(function (m) { return m.toFixed(); }); -fn(function (m) { return m.toFixed(); }); +fn(m => m.toFixed()); +fn(m => m.toFixed()); function fn2(arg) { function useT(_arg) { } // Expected: OK - arg(function (arg) { return useT(arg); }); + arg(arg => useT(arg)); } // Legal invocations are not problematic -fn2(function (m) { return m(42); }); -fn2(function (m) { return m(42); }); +fn2(m => m(42)); +fn2(m => m(42)); +export {}; diff --git a/tests/baselines/reference/callOnClass.js b/tests/baselines/reference/callOnClass.js index f2695596d1dbe..f4236139f71fe 100644 --- a/tests/baselines/reference/callOnClass.js +++ b/tests/baselines/reference/callOnClass.js @@ -7,9 +7,6 @@ var c = C(); //// [callOnClass.js] -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { +} var c = C(); diff --git a/tests/baselines/reference/callOverload.js b/tests/baselines/reference/callOverload.js index e1e4377119ca8..5d56f5a9d966f 100644 --- a/tests/baselines/reference/callOverload.js +++ b/tests/baselines/reference/callOverload.js @@ -14,18 +14,9 @@ withRest(); withRest(...n); //// [callOverload.js] -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; fn(1); // no error fn(1, 2, 3, 4); takeTwo(1, 2, 3, 4); -withRest.apply(void 0, __spreadArray(['a'], n, false)); // no error +withRest('a', ...n); // no error withRest(); -withRest.apply(void 0, n); +withRest(...n); diff --git a/tests/baselines/reference/callOverloadViaElementAccessExpression.js b/tests/baselines/reference/callOverloadViaElementAccessExpression.js index 4d00a18a4e900..a0286e6614b78 100644 --- a/tests/baselines/reference/callOverloadViaElementAccessExpression.js +++ b/tests/baselines/reference/callOverloadViaElementAccessExpression.js @@ -14,14 +14,11 @@ var r: string = c['foo'](1); var r2: number = c['foo'](''); //// [callOverloadViaElementAccessExpression.js] -var C = /** @class */ (function () { - function C() { - } - C.prototype.foo = function (x) { +class C { + foo(x) { return null; - }; - return C; -}()); + } +} var c = new C(); var r = c['foo'](1); var r2 = c['foo'](''); diff --git a/tests/baselines/reference/callOverloads1.js b/tests/baselines/reference/callOverloads1.js index 1a24c858e1f3b..695f5d5d7ab6b 100644 --- a/tests/baselines/reference/callOverloads1.js +++ b/tests/baselines/reference/callOverloads1.js @@ -20,13 +20,12 @@ f1.bar1(); Foo(); //// [callOverloads1.js] -var Foo = /** @class */ (function () { - function Foo(x) { +class Foo { + bar1() { } + constructor(x) { // WScript.Echo("Constructor function has executed"); } - Foo.prototype.bar1 = function () { }; - return Foo; -}()); +} function F1(a) { return a; } var f1 = new Foo("hey"); f1.bar1(); diff --git a/tests/baselines/reference/callOverloads2.js b/tests/baselines/reference/callOverloads2.js index 366a42fa82197..0f51e6ccf4d35 100644 --- a/tests/baselines/reference/callOverloads2.js +++ b/tests/baselines/reference/callOverloads2.js @@ -26,13 +26,12 @@ Foo(); //// [callOverloads2.js] -var Foo = /** @class */ (function () { - function Foo(x) { +class Foo { + bar1() { } + constructor(x) { // WScript.Echo("Constructor function has executed"); } - Foo.prototype.bar1 = function () { }; - return Foo; -}()); +} function F1(s) { return s; } // error function F1(a) { return a; } // error var f1 = new Foo("hey"); diff --git a/tests/baselines/reference/callOverloads3.js b/tests/baselines/reference/callOverloads3.js index 51bb69f48fbd5..46091313c45c0 100644 --- a/tests/baselines/reference/callOverloads3.js +++ b/tests/baselines/reference/callOverloads3.js @@ -20,13 +20,12 @@ Foo("s"); //// [callOverloads3.js] -var Foo = /** @class */ (function () { - function Foo(x) { +class Foo { + bar1() { } + constructor(x) { // WScript.Echo("Constructor function has executed"); } - Foo.prototype.bar1 = function () { }; - return Foo; -}()); +} //class Foo(s: String); var f1 = new Foo("hey"); f1.bar1(); diff --git a/tests/baselines/reference/callOverloads4.js b/tests/baselines/reference/callOverloads4.js index 96d8662c1027d..92e3c99f096a7 100644 --- a/tests/baselines/reference/callOverloads4.js +++ b/tests/baselines/reference/callOverloads4.js @@ -20,13 +20,12 @@ Foo("s"); //// [callOverloads4.js] -var Foo = /** @class */ (function () { - function Foo(x) { +class Foo { + bar1() { } + constructor(x) { // WScript.Echo("Constructor function has executed"); } - Foo.prototype.bar1 = function () { }; - return Foo; -}()); +} var f1 = new Foo("hey"); f1.bar1(); Foo(); diff --git a/tests/baselines/reference/callOverloads5.js b/tests/baselines/reference/callOverloads5.js index 9fd1462f0ffaa..f424aa5461677 100644 --- a/tests/baselines/reference/callOverloads5.js +++ b/tests/baselines/reference/callOverloads5.js @@ -22,13 +22,12 @@ Foo("s"); //// [callOverloads5.js] -var Foo = /** @class */ (function () { - function Foo(x) { +class Foo { + bar1(a) { } + constructor(x) { // WScript.Echo("Constructor function has executed"); } - Foo.prototype.bar1 = function (a) { }; - return Foo; -}()); +} //class Foo(s: String); var f1 = new Foo("hey"); f1.bar1("a"); diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js index dbd499c336ce0..50366ac744ec6 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js @@ -73,44 +73,11 @@ interface I extends A { //// [callSignatureAssignabilityInInheritance2.js] // checking subtype relations for function types as it relates to contextual signature instantiation -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var Base = /** @class */ (function () { - function Base() { - } - return Base; -}()); -var Derived = /** @class */ (function (_super) { - __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() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Derived2; -}(Derived)); -var OtherDerived = /** @class */ (function (_super) { - __extends(OtherDerived, _super); - function OtherDerived() { - return _super !== null && _super.apply(this, arguments) || this; - } - return OtherDerived; -}(Base)); +class Base { +} +class Derived extends Base { +} +class Derived2 extends Derived { +} +class OtherDerived extends Base { +} diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js index c7dc8466274e6..3b13c93beac64 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js @@ -118,47 +118,14 @@ namespace Errors { //// [callSignatureAssignabilityInInheritance3.js] // checking subtype relations for function types as it relates to contextual signature instantiation // error cases -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); var Errors; (function (Errors) { - var Base = /** @class */ (function () { - function Base() { - } - return Base; - }()); - var Derived = /** @class */ (function (_super) { - __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() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Derived2; - }(Derived)); - var OtherDerived = /** @class */ (function (_super) { - __extends(OtherDerived, _super); - function OtherDerived() { - return _super !== null && _super.apply(this, arguments) || this; - } - return OtherDerived; - }(Base)); + class Base { + } + class Derived extends Base { + } + class Derived2 extends Derived { + } + class OtherDerived extends Base { + } })(Errors || (Errors = {})); diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js index b805ebb772785..3b491277243d2 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js @@ -53,44 +53,11 @@ interface I extends A { //// [callSignatureAssignabilityInInheritance4.js] // checking subtype relations for function types as it relates to contextual signature instantiation -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var Base = /** @class */ (function () { - function Base() { - } - return Base; -}()); -var Derived = /** @class */ (function (_super) { - __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() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Derived2; -}(Derived)); -var OtherDerived = /** @class */ (function (_super) { - __extends(OtherDerived, _super); - function OtherDerived() { - return _super !== null && _super.apply(this, arguments) || this; - } - return OtherDerived; -}(Base)); +class Base { +} +class Derived extends Base { +} +class Derived2 extends Derived { +} +class OtherDerived extends Base { +} diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js index c26f4527fb190..fa7e58542ce9b 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js @@ -53,44 +53,11 @@ interface I extends B { //// [callSignatureAssignabilityInInheritance5.js] // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithCallSignatures2 just with an extra level of indirection in the inheritance chain -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var Base = /** @class */ (function () { - function Base() { - } - return Base; -}()); -var Derived = /** @class */ (function (_super) { - __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() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Derived2; -}(Derived)); -var OtherDerived = /** @class */ (function (_super) { - __extends(OtherDerived, _super); - function OtherDerived() { - return _super !== null && _super.apply(this, arguments) || this; - } - return OtherDerived; -}(Base)); +class Base { +} +class Derived extends Base { +} +class Derived2 extends Derived { +} +class OtherDerived extends Base { +} diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js index 2f57fcebd5396..46a6bd0d20b46 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js @@ -56,44 +56,11 @@ interface I9 extends A { // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithCallSignatures4 but using class type parameters instead of generic signatures // all are errors -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var Base = /** @class */ (function () { - function Base() { - } - return Base; -}()); -var Derived = /** @class */ (function (_super) { - __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() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Derived2; -}(Derived)); -var OtherDerived = /** @class */ (function (_super) { - __extends(OtherDerived, _super); - function OtherDerived() { - return _super !== null && _super.apply(this, arguments) || this; - } - return OtherDerived; -}(Base)); +class Base { +} +class Derived extends Base { +} +class Derived2 extends Derived { +} +class OtherDerived extends Base { +} diff --git a/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.js b/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.js index e64df78dfad5f..e8b84d9870327 100644 --- a/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.js +++ b/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.js @@ -59,29 +59,18 @@ 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 = 1) { } +var f = function foo(x = 1) { }; +var f2 = (x, y = 1) => { }; foo(1); foo(); f(1); f(); f2(1); f2(1, 2); -var C = /** @class */ (function () { - function C() { - } - C.prototype.foo = function (x) { - if (x === void 0) { x = 1; } - }; - return C; -}()); +class C { + foo(x = 1) { } +} c.foo(); c.foo(1); i(); @@ -93,15 +82,9 @@ a(1); a.foo(); a.foo(1); var b = { - foo: function (x) { - if (x === void 0) { x = 1; } - }, - a: function foo(x, y) { - if (y === void 0) { y = ''; } - }, - b: function (x) { - if (x === void 0) { x = ''; } - } + foo(x = 1) { }, + a: function foo(x, y = '') { }, + b: (x = '') => { } }; b.foo(); b.foo(1); diff --git a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js index 07f6382f2a82a..9624e33d1bb22 100644 --- a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js +++ b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js @@ -175,11 +175,8 @@ function foo9(x) { return i; } var r9 = foo9(1); -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { +} function foo10(x) { var c; return c; @@ -188,11 +185,8 @@ var r10 = foo10(1); var M; (function (M) { M.x = 1; - var C = /** @class */ (function () { - function C() { - } - return C; - }()); + class C { + } M.C = C; })(M || (M = {})); function foo11() { @@ -212,11 +206,9 @@ function foo13() { return m1; } var r13 = foo13(); -var c1 = /** @class */ (function () { - function c1(x) { - } - return c1; -}()); +class c1 { + constructor(x) { } +} (function (c1) { c1.x = 1; })(c1 || (c1 = {})); diff --git a/tests/baselines/reference/callSignaturesWithAccessibilityModifiersOnParameters.js b/tests/baselines/reference/callSignaturesWithAccessibilityModifiersOnParameters.js index 19a4182705ccc..6fbb336bb8b6f 100644 --- a/tests/baselines/reference/callSignaturesWithAccessibilityModifiersOnParameters.js +++ b/tests/baselines/reference/callSignaturesWithAccessibilityModifiersOnParameters.js @@ -45,24 +45,21 @@ var b = { 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 f3 = (x, y) => { }; +var f4 = (x, y) => { }; function foo2(x, y) { } var f5 = function foo(x, y) { }; var f6 = function (x, y) { }; -var f7 = function (x, y) { }; -var f8 = function (x, y) { }; -var C = /** @class */ (function () { - function C() { - } - C.prototype.foo = function (x, y) { }; - C.prototype.foo2 = function (x, y) { }; - C.prototype.foo3 = function (x, y) { }; - return C; -}()); +var f7 = (x, y) => { }; +var f8 = (x, y) => { }; +class C { + foo(x, y) { } + foo2(x, y) { } + foo3(x, y) { } +} var a; var b = { - foo: function (x, y) { }, + foo(x, y) { }, a: function foo(x, y) { }, - b: function (x, y) { } + b: (x, y) => { } }; diff --git a/tests/baselines/reference/callSignaturesWithDuplicateParameters.js b/tests/baselines/reference/callSignaturesWithDuplicateParameters.js index dcbb509d3eedc..62498a8500fe6 100644 --- a/tests/baselines/reference/callSignaturesWithDuplicateParameters.js +++ b/tests/baselines/reference/callSignaturesWithDuplicateParameters.js @@ -45,24 +45,21 @@ 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 = (x, x) => { }; +var f4 = (x, x) => { }; function foo2(x, x) { } var f5 = function foo(x, x) { }; var f6 = function (x, x) { }; -var f7 = function (x, x) { }; -var f8 = function (x, y) { }; -var C = /** @class */ (function () { - function C() { - } - C.prototype.foo = function (x, x) { }; - C.prototype.foo2 = function (x, x) { }; - C.prototype.foo3 = function (x, x) { }; - return C; -}()); +var f7 = (x, x) => { }; +var f8 = (x, y) => { }; +class C { + foo(x, x) { } + foo2(x, x) { } + foo3(x, x) { } +} var a; var b = { - foo: function (x, x) { }, + foo(x, x) { }, a: function foo(x, x) { }, - b: function (x, x) { } + b: (x, x) => { } }; diff --git a/tests/baselines/reference/callSignaturesWithOptionalParameters.js b/tests/baselines/reference/callSignaturesWithOptionalParameters.js index 33702b35d8e5d..1ace9470e703c 100644 --- a/tests/baselines/reference/callSignaturesWithOptionalParameters.js +++ b/tests/baselines/reference/callSignaturesWithOptionalParameters.js @@ -61,19 +61,16 @@ b.b(1); // Optional parameters should be valid in all the below casts function foo(x) { } var f = function foo(x) { }; -var f2 = function (x, y) { }; +var f2 = (x, y) => { }; foo(1); foo(); f(1); f(); f2(1); f2(1, 2); -var C = /** @class */ (function () { - function C() { - } - C.prototype.foo = function (x) { }; - return C; -}()); +class C { + foo(x) { } +} var c; c.foo(); c.foo(1); @@ -88,9 +85,9 @@ a(1); a.foo(); a.foo(1); var b = { - foo: function (x) { }, + foo(x) { }, a: function foo(x, y) { }, - b: function (x) { } + b: (x) => { } }; b.foo(); b.foo(1); diff --git a/tests/baselines/reference/callSignaturesWithOptionalParameters2.js b/tests/baselines/reference/callSignaturesWithOptionalParameters2.js index fa6b9432e0c5b..5849798188b21 100644 --- a/tests/baselines/reference/callSignaturesWithOptionalParameters2.js +++ b/tests/baselines/reference/callSignaturesWithOptionalParameters2.js @@ -69,13 +69,10 @@ foo(); function foo2(x, y) { } foo2(1); foo2(1, 2); -var C = /** @class */ (function () { - function C() { - } - C.prototype.foo = function (x) { }; - C.prototype.foo2 = function (x, y) { }; - return C; -}()); +class C { + foo(x) { } + foo2(x, y) { } +} var c; c.foo(); c.foo(1); diff --git a/tests/baselines/reference/callSignaturesWithParameterInitializers.js b/tests/baselines/reference/callSignaturesWithParameterInitializers.js index faf3182173d53..fe85cd11cd4d0 100644 --- a/tests/baselines/reference/callSignaturesWithParameterInitializers.js +++ b/tests/baselines/reference/callSignaturesWithParameterInitializers.js @@ -61,29 +61,18 @@ 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 = 1) { } +var f = function foo(x = 1) { }; +var f2 = (x, y = 1) => { }; foo(1); foo(); f(1); f(); f2(1); f2(1, 2); -var C = /** @class */ (function () { - function C() { - } - C.prototype.foo = function (x) { - if (x === void 0) { x = 1; } - }; - return C; -}()); +class C { + foo(x = 1) { } +} c.foo(); c.foo(1); i(); @@ -95,15 +84,9 @@ a(1); a.foo(); a.foo(1); var b = { - foo: function (x) { - if (x === void 0) { x = 1; } - }, - a: function foo(x, y) { - if (y === void 0) { y = 1; } - }, - b: function (x) { - if (x === void 0) { x = 1; } - } + foo(x = 1) { }, + a: function foo(x, y = 1) { }, + b: (x = 1) => { } }; b.foo(); b.foo(1); diff --git a/tests/baselines/reference/callSignaturesWithParameterInitializers2.js b/tests/baselines/reference/callSignaturesWithParameterInitializers2.js index 0818e4b97e0e0..278c39d54c53c 100644 --- a/tests/baselines/reference/callSignaturesWithParameterInitializers2.js +++ b/tests/baselines/reference/callSignaturesWithParameterInitializers2.js @@ -30,28 +30,17 @@ 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 = 1) { } foo(1); foo(); -var C = /** @class */ (function () { - function C() { - } - C.prototype.foo = function (x) { - if (x === void 0) { x = 1; } - }; - return C; -}()); +class C { + foo(x = 1) { } +} c.foo(); c.foo(1); var b = { - foo: function (x) { - if (x === void 0) { x = 1; } - }, // error - foo: function (x) { - if (x === void 0) { x = 1; } - }, + foo(x = 1) { }, // error + foo(x = 1) { }, // error }; b.foo(); b.foo(1); diff --git a/tests/baselines/reference/callWithMissingVoid.js b/tests/baselines/reference/callWithMissingVoid.js index 72a0bca07b59b..51a8f709709a2 100644 --- a/tests/baselines/reference/callWithMissingVoid.js +++ b/tests/baselines/reference/callWithMissingVoid.js @@ -89,14 +89,11 @@ call((x: number | void, y: number | void) => 42, 4, 2) // ok //// [callWithMissingVoid.js] "use strict"; // From #4260 -var X = /** @class */ (function () { - function X() { - } - X.prototype.f = function (t) { +class X { + f(t) { return { a: t }; - }; - return X; -}()); + } +} x.f(); // no error because f expects void xUnion.f(42); // no error because f accepts number xUnion.f(); // no error because f accepts void @@ -104,16 +101,15 @@ xAny.f(); // error, any still expects an argument xUnknown.f(); // error, unknown still expects an argument xNever.f(); // error, never still expects an argument // Promise has previously been updated to work without arguments, but to show this fixes the issue too. -var MyPromise = /** @class */ (function () { - function MyPromise(executor) { +class MyPromise { + constructor(executor) { } - return MyPromise; -}()); -new MyPromise(function (resolve) { return resolve(); }); // no error -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 +} +new MyPromise(resolve => resolve()); // no error +new MyPromise(resolve => resolve()); // no error +new MyPromise(resolve => resolve()); // error, `any` arguments cannot be omitted +new MyPromise(resolve => resolve()); // error, `unknown` arguments cannot be omitted +new MyPromise(resolve => resolve()); // error, `never` arguments cannot be omitted // Multiple parameters function a(x, y, z) { } @@ -132,11 +128,11 @@ 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 -call(function (x, y) { return 42; }); // ok -call(function (x, y) { return 42; }, 4); // ok -call(function (x, y) { return 42; }, 4, 2); // ok +call((x, y) => x + y); // error +call((x, y) => x + y, 4, 2); // ok +call((x, y) => x, 4, void 0); // ok +call((x, y) => x, 4); // ok +call((x, y) => 42); // ok +call((x, y) => 42); // ok +call((x, y) => 42, 4); // ok +call((x, y) => 42, 4, 2); // ok diff --git a/tests/baselines/reference/callWithSpread.js b/tests/baselines/reference/callWithSpread.js index 6bf603161d25c..decc82fdeeb7b 100644 --- a/tests/baselines/reference/callWithSpread.js +++ b/tests/baselines/reference/callWithSpread.js @@ -61,86 +61,46 @@ class D extends C { //// [callWithSpread.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; -var _a, _b, _c, _d, _e, _f, _g; -function foo(x, y) { - var z = []; - for (var _i = 2; _i < arguments.length; _i++) { - z[_i - 2] = arguments[_i]; - } +function foo(x, y, ...z) { } var a; var z; var obj; var xa; foo(1, 2, "abc"); -foo.apply(void 0, __spreadArray([1, 2], a, false)); -foo.apply(void 0, __spreadArray(__spreadArray([1, 2], a, false), ["abc"], false)); +foo(1, 2, ...a); +foo(1, 2, ...a, "abc"); obj.foo(1, 2, "abc"); -obj.foo.apply(obj, __spreadArray([1, 2], a, false)); -obj.foo.apply(obj, __spreadArray(__spreadArray([1, 2], a, false), ["abc"], false)); -obj.foo.apply(obj, __spreadArray([1, 2], a, false)).foo(1, 2, "abc"); -(_a = obj.foo.apply(obj, __spreadArray([1, 2], a, false))).foo.apply(_a, __spreadArray([1, 2], a, false)); -(_b = obj.foo.apply(obj, __spreadArray([1, 2], a, false))).foo.apply(_b, __spreadArray(__spreadArray([1, 2], a, false), ["abc"], false)); +obj.foo(1, 2, ...a); +obj.foo(1, 2, ...a, "abc"); +obj.foo(1, 2, ...a).foo(1, 2, "abc"); +obj.foo(1, 2, ...a).foo(1, 2, ...a); +obj.foo(1, 2, ...a).foo(1, 2, ...a, "abc"); (obj.foo)(1, 2, "abc"); -obj.foo.apply(obj, __spreadArray([1, 2], a, false)); -obj.foo.apply(obj, __spreadArray(__spreadArray([1, 2], a, false), ["abc"], false)); -(obj.foo.apply(obj, __spreadArray([1, 2], a, false)).foo)(1, 2, "abc"); -(_c = obj.foo.apply(obj, __spreadArray([1, 2], a, false))).foo.apply(_c, __spreadArray([1, 2], a, false)); -(_d = obj.foo.apply(obj, __spreadArray([1, 2], a, false))).foo.apply(_d, __spreadArray(__spreadArray([1, 2], a, false), ["abc"], false)); +(obj.foo)(1, 2, ...a); +(obj.foo)(1, 2, ...a, "abc"); +((obj.foo)(1, 2, ...a).foo)(1, 2, "abc"); +((obj.foo)(1, 2, ...a).foo)(1, 2, ...a); +((obj.foo)(1, 2, ...a).foo)(1, 2, ...a, "abc"); xa[1].foo(1, 2, "abc"); -(_e = xa[1]).foo.apply(_e, __spreadArray([1, 2], a, false)); -(_f = xa[1]).foo.apply(_f, __spreadArray(__spreadArray([1, 2], a, false), ["abc"], false)); -(_g = xa[1]).foo.apply(_g, [1, 2, "abc"]); -var C = /** @class */ (function () { - function C(x, y) { - var z = []; - for (var _i = 2; _i < arguments.length; _i++) { - z[_i - 2] = arguments[_i]; - } +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); - this.foo.apply(this, __spreadArray([x, y], z, false)); + this.foo(x, y, ...z); + } + foo(x, y, ...z) { } - C.prototype.foo = function (x, y) { - var z = []; - for (var _i = 2; _i < arguments.length; _i++) { - z[_i - 2] = arguments[_i]; - } - }; - return C; -}()); -var D = /** @class */ (function (_super) { - __extends(D, _super); - function D() { - var _this = _super.call(this, 1, 2) || this; - return _super.apply(this, __spreadArray([1, 2], a, false)) || this; +} +class D extends C { + constructor() { + super(1, 2); + super(1, 2, ...a); + } + foo() { + super.foo(1, 2); + super.foo(1, 2, ...a); } - D.prototype.foo = function () { - _super.prototype.foo.call(this, 1, 2); - _super.prototype.foo.apply(this, __spreadArray([1, 2], a, false)); - }; - return D; -}(C)); +} diff --git a/tests/baselines/reference/callWithSpread2.js b/tests/baselines/reference/callWithSpread2.js index ca7a2346c1fed..dc74992a43c76 100644 --- a/tests/baselines/reference/callWithSpread2.js +++ b/tests/baselines/reference/callWithSpread2.js @@ -40,33 +40,24 @@ prefix2("g", ...ns); //// [callWithSpread2.js] -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; // good -all.apply(void 0, ns); -weird.apply(void 0, ns); -weird.apply(void 0, mixed); -weird.apply(void 0, tuple); -prefix.apply(void 0, __spreadArray(["a"], ns, false)); -rest.apply(void 0, __spreadArray(["d"], ns, false)); +all(...ns); +weird(...ns); +weird(...mixed); +weird(...tuple); +prefix("a", ...ns); +rest("d", ...ns); // extra arguments -normal.apply(void 0, __spreadArray(["g"], ns, false)); -thunk.apply(void 0, ns); +normal("g", ...ns); +thunk(...ns); // bad -all.apply(void 0, mixed); -all.apply(void 0, tuple); -prefix.apply(void 0, __spreadArray(["b"], mixed, false)); -prefix.apply(void 0, __spreadArray(["c"], tuple, false)); -rest.apply(void 0, __spreadArray(["e"], mixed, false)); -rest.apply(void 0, __spreadArray(["f"], tuple, false)); -prefix.apply(void 0, ns); // required parameters are required -prefix.apply(void 0, mixed); -prefix.apply(void 0, tuple); -prefix2.apply(void 0, __spreadArray(["g"], ns, false)); +all(...mixed); +all(...tuple); +prefix("b", ...mixed); +prefix("c", ...tuple); +rest("e", ...mixed); +rest("f", ...tuple); +prefix(...ns); // required parameters are required +prefix(...mixed); +prefix(...tuple); +prefix2("g", ...ns); diff --git a/tests/baselines/reference/callWithSpread3.js b/tests/baselines/reference/callWithSpread3.js index 5d725cf67926b..38eba460de814 100644 --- a/tests/baselines/reference/callWithSpread3.js +++ b/tests/baselines/reference/callWithSpread3.js @@ -39,34 +39,25 @@ fs5(...s2, "foo", ...s2); //// [callWithSpread3.js] -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; // error -fs2.apply(void 0, __spreadArray(['a'], s2, false)); // error on ...s2 -fs2.apply(void 0, __spreadArray(['a', 'b', 'c'], s2, false)); // error on 'c' and ...s2 -fs2.apply(void 0, __spreadArray(__spreadArray(['a', 'b'], s2, false), ['c'], false)); // error on ...s2 and 'c' -fs2.apply(void 0, __spreadArray(__spreadArray(['a', 'b', 'c'], s2, false), ['d'], false)); // error on 'c', ...s2 and 'd' -fs2.apply(void 0, __spreadArray(__spreadArray([], s2, false), ['a'], false)); // error on 'a' -fs2.apply(void 0, s3); // error on ...s3 -fs2_.apply(void 0, s_); // error on ...s_ -fs2_.apply(void 0, s2n_); // error on ...s2n_ -fs2_.apply(void 0, __spreadArray(__spreadArray([], s_, false), s_, false)); // error on ...s_ -fs2_.apply(void 0, __spreadArray(__spreadArray(__spreadArray([], s_, false), s_, false), s_, false)); // error on ...s_ +fs2('a', ...s2); // error on ...s2 +fs2('a', 'b', 'c', ...s2); // error on 'c' and ...s2 +fs2('a', 'b', ...s2, 'c'); // error on ...s2 and 'c' +fs2('a', 'b', 'c', ...s2, 'd'); // error on 'c', ...s2 and 'd' +fs2(...s2, 'a'); // error on 'a' +fs2(...s3); // error on ...s3 +fs2_(...s_); // error on ...s_ +fs2_(...s2n_); // error on ...s2n_ +fs2_(...s_, ...s_); // error on ...s_ +fs2_(...s_, ...s_, ...s_); // error on ...s_ // fs2n_(...s2, ...s_); // FIXME: should be a type error -fs2n_.apply(void 0, s2_); // error on ...s2_ +fs2n_(...s2_); // error on ...s2_ // ok -fs2_.apply(void 0, s2_); -fs2_.apply(void 0, __spreadArray(__spreadArray([], s2_, false), s_, false)); -fs2_.apply(void 0, __spreadArray(__spreadArray([], s2_, false), s2_, false)); -fs2_.apply(void 0, __spreadArray(__spreadArray([], s_, false), s2_, false)); -fs2n_.apply(void 0, s2n_); -fs2n_.apply(void 0, s2); +fs2_(...s2_); +fs2_(...s2_, ...s_); +fs2_(...s2_, ...s2_); +fs2_(...s_, ...s2_); +fs2n_(...s2n_); +fs2n_(...s2); // fs2n_(...s2, ...n_); // FIXME: should compile -fs5.apply(void 0, __spreadArray(__spreadArray(__spreadArray([], s2, false), ["foo"], false), s2, false)); +fs5(...s2, "foo", ...s2); diff --git a/tests/baselines/reference/callWithSpread5.js b/tests/baselines/reference/callWithSpread5.js index 5938fe6e25d3f..9b29d0b577f0f 100644 --- a/tests/baselines/reference/callWithSpread5.js +++ b/tests/baselines/reference/callWithSpread5.js @@ -11,14 +11,5 @@ fn(...nntnnnt, x) //// [callWithSpread5.js] -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; -fn.apply(void 0, __spreadArray(__spreadArray([], nnnu, false), [x], false)); -fn.apply(void 0, __spreadArray(__spreadArray([], nntnnnt, false), [x], false)); +fn(...nnnu, x); +fn(...nntnnnt, x); diff --git a/tests/baselines/reference/callbackOnConstructor.js b/tests/baselines/reference/callbackOnConstructor.js index ff7779e0476fd..4114d2a7a3b8d 100644 --- a/tests/baselines/reference/callbackOnConstructor.js +++ b/tests/baselines/reference/callbackOnConstructor.js @@ -17,23 +17,18 @@ var ooscope2 = s => s.length > 0 //// [callbackOnConstructor.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Preferences = void 0; -var Preferences = /** @class */ (function () { +export class Preferences { /** * @callback ValueGetter_2 * @param {string} name * @returns {boolean|number|string|undefined} */ - function Preferences() { + constructor() { this.assignability = "no"; } - return Preferences; -}()); -exports.Preferences = Preferences; +} /** @type {ValueGetter_2} */ -var ooscope2 = function (s) { return s.length > 0; }; +var ooscope2 = s => s.length > 0; //// [callbackOnConstructor.d.ts] diff --git a/tests/baselines/reference/callbackTagVariadicType.js b/tests/baselines/reference/callbackTagVariadicType.js index da31a9e954549..82569d07704e7 100644 --- a/tests/baselines/reference/callbackTagVariadicType.js +++ b/tests/baselines/reference/callbackTagVariadicType.js @@ -13,18 +13,14 @@ var res = x('a', 'b') //// [callbackTagVariadicType.js] -"use strict"; /** * @callback Foo * @param {...string} args * @returns {number} */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; /** @type {Foo} */ -var x = function () { return 1; }; -exports.x = x; -var res = (0, exports.x)('a', 'b'); +export const x = () => 1; +var res = x('a', 'b'); //// [callbackTagVariadicType.d.ts] diff --git a/tests/baselines/reference/callbacksDontShareTypes.js b/tests/baselines/reference/callbacksDontShareTypes.js index 7816d509af389..fc28cef9199d6 100644 --- a/tests/baselines/reference/callbacksDontShareTypes.js +++ b/tests/baselines/reference/callbacksDontShareTypes.js @@ -23,8 +23,8 @@ 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 rf1 = (x) => { return x.toFixed(); }; +var r1a = _.map(c2, (x) => { return x.toFixed(); }); var r1b = _.map(c2, rf1); // this line should not cause the following 2 to have errors -var r5a = _.map(c2, function (x) { return x.toFixed(); }); +var r5a = _.map(c2, (x) => { return x.toFixed(); }); var r5b = _.map(c2, rf1); diff --git a/tests/baselines/reference/callsOnComplexSignatures.js b/tests/baselines/reference/callsOnComplexSignatures.js index 25feef129359c..f2cfcdf739591 100644 --- a/tests/baselines/reference/callsOnComplexSignatures.js +++ b/tests/baselines/reference/callsOnComplexSignatures.js @@ -107,30 +107,23 @@ function test5() { //// [callsOnComplexSignatures.js] -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); /// -var react_1 = __importDefault(require("react")); +import React from "react"; // Simple calls from real usecases function test1() { function test(t) { - var z = t.getValue("bar"); // Should be fine + const 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 }); + const messages = { + foo: (options) => "Foo", + bar: (options) => "Bar", }; + const test1 = (type) => messages[type]({ a: "A", b: 0 }); } function test3(items) { - items.forEach(function (item) { return console.log(item); }); + items.forEach(item => console.log(item)); } function test4(arg1, arg2, arg3, arg4, arg5, arg6) { arg1(); @@ -155,17 +148,17 @@ function test4(arg1, arg2, arg3, arg4, arg5, arg6) { function test5() { // Pair of non-like intrinsics function render(url) { - var Tag = url ? 'a' : 'button'; - return react_1.default.createElement(Tag, null, "test"); + const Tag = url ? 'a' : 'button'; + return React.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)); + const Comp = props.component; + return (React.createElement(Comp, null)); } // custom components with non-subset props function render2() { var C = null; - var a = react_1.default.createElement(C, { p: true }); + const a = React.createElement(C, { p: true }); } } diff --git a/tests/baselines/reference/canFollowGetSetKeyword.js b/tests/baselines/reference/canFollowGetSetKeyword.js index 261125fc938b0..c43276eba0d59 100644 --- a/tests/baselines/reference/canFollowGetSetKeyword.js +++ b/tests/baselines/reference/canFollowGetSetKeyword.js @@ -19,58 +19,17 @@ const d = { }; //// [canFollowGetSetKeyword.js] -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); - return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (g && (g = 0, op[0] && (_ = 0)), _) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } 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 }; - } +class A { + *x() { } +} +class B { + *x() { } +} +const c = { + get, + *x() { } }; -var A = /** @class */ (function () { - function A() { - } - A.prototype.x = function () { return __generator(this, function (_a) { - return [2 /*return*/]; - }); }; - return A; -}()); -var B = /** @class */ (function () { - function B() { - } - B.prototype.x = function () { return __generator(this, function (_a) { - return [2 /*return*/]; - }); }; - return B; -}()); -var c = { - get: get, - x: function () { return __generator(this, function (_a) { - return [2 /*return*/]; - }); } -}; -var d = { - set: set, - x: function () { return __generator(this, function (_a) { - return [2 /*return*/]; - }); } +const d = { + set, + *x() { } }; diff --git a/tests/baselines/reference/cannotInvokeNewOnErrorExpression.js b/tests/baselines/reference/cannotInvokeNewOnErrorExpression.js index 4b5346fbfad02..ec60ce0518769 100644 --- a/tests/baselines/reference/cannotInvokeNewOnErrorExpression.js +++ b/tests/baselines/reference/cannotInvokeNewOnErrorExpression.js @@ -10,10 +10,7 @@ var t = new M.ClassA[]; //// [cannotInvokeNewOnErrorExpression.js] var M; (function (M) { - var ClassA = /** @class */ (function () { - function ClassA() { - } - return ClassA; - }()); + class ClassA { + } })(M || (M = {})); var t = new M.ClassA[]; diff --git a/tests/baselines/reference/captureSuperPropertyAccessInSuperCall01.js b/tests/baselines/reference/captureSuperPropertyAccessInSuperCall01.js index 36ec9c63d53a0..425de1975c6f4 100644 --- a/tests/baselines/reference/captureSuperPropertyAccessInSuperCall01.js +++ b/tests/baselines/reference/captureSuperPropertyAccessInSuperCall01.js @@ -14,32 +14,13 @@ class B extends A { } //// [captureSuperPropertyAccessInSuperCall01.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var A = /** @class */ (function () { - function A(f) { +class A { + constructor(f) { } - A.prototype.blah = function () { return ""; }; - return A; -}()); -var B = /** @class */ (function (_super) { - __extends(B, _super); - function B() { - var _this = _super.call(this, function () { return _super.prototype.blah.call(_this); }) || this; - return _this; + blah() { return ""; } +} +class B extends A { + constructor() { + super(() => { return super.blah(); }); } - return B; -}(A)); +} diff --git a/tests/baselines/reference/captureThisInSuperCall.js b/tests/baselines/reference/captureThisInSuperCall.js index 7846e9e93a6e6..ff89e3f4deb78 100644 --- a/tests/baselines/reference/captureThisInSuperCall.js +++ b/tests/baselines/reference/captureThisInSuperCall.js @@ -11,32 +11,10 @@ class B extends A { } //// [captureThisInSuperCall.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var A = /** @class */ (function () { - function A(p) { - } - return A; -}()); -var B = /** @class */ (function (_super) { - __extends(B, _super); - function B() { - var _this = _super.call(this, { test: function () { return _this.someMethod(); } }) || this; - return _this; - } - B.prototype.someMethod = function () { }; - return B; -}(A)); +class A { + constructor(p) { } +} +class B extends A { + constructor() { super({ test: () => this.someMethod() }); } + someMethod() { } +} diff --git a/tests/baselines/reference/capturedLetConstInLoop1.js b/tests/baselines/reference/capturedLetConstInLoop1.js index 9927c7a787ce0..4f0fc409ef77e 100644 --- a/tests/baselines/reference/capturedLetConstInLoop1.js +++ b/tests/baselines/reference/capturedLetConstInLoop1.js @@ -141,229 +141,112 @@ for (let ix in iobj) { } //// [capturedLetConstInLoop1.js] -var _loop_1 = function (x) { - (function () { return x; }); - (function () { return x; }); -}; //==== let -for (var x in {}) { - _loop_1(x); -} -var _loop_2 = function (x) { +for (let x in {}) { (function () { return x; }); - (function () { return x; }); -}; -for (var _i = 0, _a = []; _i < _a.length; _i++) { - var x = _a[_i]; - _loop_2(x); + (() => x); } -var _loop_3 = function (x) { - (function () { return x; }); +for (let x of []) { (function () { return x; }); -}; -for (var x = 0; x < 1; ++x) { - _loop_3(x); + (() => x); } -var _loop_4 = function () { - var x; +for (let x = 0; x < 1; ++x) { (function () { return x; }); - (function () { return x; }); -}; -while (1 === 1) { - _loop_4(); + (() => x); } -var _loop_5 = function () { - var x; - (function () { return x; }); +while (1 === 1) { + let x; (function () { return x; }); -}; + (() => x); +} do { - _loop_5(); -} while (1 === 1); -var _loop_6 = function (y) { - var x = 1; + let x; (function () { return x; }); + (() => x); +} while (1 === 1); +for (let y = 0; y < 1; ++y) { + let x = 1; (function () { return x; }); -}; -for (var y = 0; y < 1; ++y) { - _loop_6(y); + (() => x); } -var _loop_7 = function (x, y) { - (function () { return x + y; }); +for (let x = 0, y = 1; x < 1; ++x) { (function () { return x + y; }); -}; -for (var x = 0, y = 1; x < 1; ++x) { - _loop_7(x, y); + (() => x + y); } -var _loop_8 = function () { - var x, y; - (function () { return x + y; }); - (function () { return x + y; }); -}; while (1 === 1) { - _loop_8(); -} -var _loop_9 = function () { - var x, y; - (function () { return x + y; }); + let x, y; (function () { return x + y; }); -}; + (() => x + y); +} do { - _loop_9(); -} while (1 === 1); -var _loop_10 = function (y) { - var x = 1; + 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; }); -}; -for (var y = 0; y < 1; ++y) { - _loop_10(y); + (() => x + y); } -var _loop_init_1 = function () { - var y = (use(function () { return y; }), 0); - out_y_1 = y; -}; -var out_y_1; -_loop_init_1(); -for (var y = out_y_1; y < 1; ++y) { +for (let y = (use(() => y), 0); y < 1; ++y) { } -var _loop_11 = function (y) { - if (inc_1) - ++y; - else - inc_1 = true; - if (!(use(function () { return y; }), y < 1)) - return out_y_2 = y, "break"; - out_y_2 = y; -}; -var out_y_2, inc_1 = false; -for (var y = 0;;) { - var state_1 = _loop_11(y); - y = out_y_2; - if (state_1 === "break") - break; +for (let y = 0; use(() => y), y < 1; ++y) { } -var _loop_12 = function (y) { - if (inc_2) - use(function () { return y; }), ++y; - else - inc_2 = true; - out_y_3 = y; -}; -var out_y_3, inc_2 = false; -for (var y = 0; y < 1;) { - _loop_12(y); - y = out_y_3; +for (let y = 0; y < 1; use(() => y), ++y) { } -var _loop_init_2 = function () { - var y = (use(function () { return y; }), 0); - out_y_4 = y; -}; -var _loop_13 = function (y) { - if (inc_3) - use(function () { return y; }), ++y; - else - inc_3 = true; - if (!(use(function () { return y; }), y < 1)) - return out_y_4 = y, "break"; - use(function () { return y; }); - out_y_4 = y; -}; -var out_y_4, inc_3 = false; -_loop_init_2(); -for (var y = out_y_4;;) { - var state_2 = _loop_13(y); - y = out_y_4; - if (state_2 === "break") - break; +for (let y = (use(() => y), 0); use(() => y), y < 1; use(() => y), ++y) { + use(() => y); } -var _loop_14 = function (x) { - (function () { return x; }); - (function () { return x; }); -}; //=========const -for (var x in {}) { - _loop_14(x); -} -var _loop_15 = function (x) { +for (const x in {}) { (function () { return x; }); - (function () { return x; }); -}; -for (var _b = 0, _c = []; _b < _c.length; _b++) { - var x = _c[_b]; - _loop_15(x); + (() => x); } -var _loop_16 = function (x) { - (function () { return x; }); +for (const x of []) { (function () { return x; }); -}; -for (var x = 0; x < 1;) { - _loop_16(x); + (() => x); } -var _loop_17 = function () { - var x = 1; +for (const x = 0; x < 1;) { (function () { return x; }); - (function () { return x; }); -}; -while (1 === 1) { - _loop_17(); + (() => x); } -var _loop_18 = function () { - var x = 1; - (function () { return x; }); +while (1 === 1) { + const x = 1; (function () { return x; }); -}; + (() => x); +} do { - _loop_18(); -} while (1 === 1); -var _loop_19 = function (y) { - var x = 1; + const x = 1; (function () { return x; }); + (() => x); +} while (1 === 1); +for (const y = 0; y < 1;) { + const x = 1; (function () { return x; }); -}; -for (var y = 0; y < 1;) { - _loop_19(y); + (() => x); } -var _loop_20 = function (x, y) { - (function () { return x + y; }); +for (const x = 0, y = 1; x < 1;) { (function () { return x + y; }); -}; -for (var x = 0, y = 1; x < 1;) { - _loop_20(x, y); + (() => x + y); } -var _loop_21 = function () { - var x = 1, y = 1; - (function () { return x + y; }); - (function () { return x + y; }); -}; while (1 === 1) { - _loop_21(); -} -var _loop_22 = function () { - var x = 1, y = 1; - (function () { return x + y; }); + const x = 1, y = 1; (function () { return x + y; }); -}; + (() => x + y); +} do { - _loop_22(); -} while (1 === 1); -var _loop_23 = function (y) { - var x = 1; + 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; }); -}; -for (var y = 0; y < 1;) { - _loop_23(y); + (() => x + y); } -var _loop_24 = function (sx) { - (function () { return sobj[sx]; }); -}; -for (var sx in sobj) { - _loop_24(sx); +for (let sx in sobj) { + (() => sobj[sx]); } -var _loop_25 = function (ix) { - (function () { return iobj[ix]; }); -}; -for (var ix in iobj) { - _loop_25(ix); +for (let ix in iobj) { + (() => iobj[ix]); } diff --git a/tests/baselines/reference/capturedLetConstInLoop10.js b/tests/baselines/reference/capturedLetConstInLoop10.js index 18b3a118a440b..e5c79901db394 100644 --- a/tests/baselines/reference/capturedLetConstInLoop10.js +++ b/tests/baselines/reference/capturedLetConstInLoop10.js @@ -48,79 +48,45 @@ class B { } //// [capturedLetConstInLoop10.js] -var A = /** @class */ (function () { - function A() { - } - A.prototype.foo = function () { - var _loop_1 = function (x) { - var f = function () { return x; }; - this_1.bar(f()); - }; - var this_1 = this; - for (var _i = 0, _a = [0]; _i < _a.length; _i++) { - var x = _a[_i]; - _loop_1(x); +class A { + foo() { + for (let x of [0]) { + let f = function () { return x; }; + this.bar(f()); } - }; - A.prototype.bar = function (a) { - }; - A.prototype.baz = function () { - var _loop_2 = function (x) { - var a = function () { return x; }; - var _loop_3 = function (y) { - var b = function () { return y; }; - this_2.bar(b()); - }; - for (var _b = 0, _c = [1]; _b < _c.length; _b++) { - var y = _c[_b]; - _loop_3(y); + } + bar(a) { + } + baz() { + for (let x of [1]) { + let a = function () { return x; }; + for (let y of [1]) { + let b = function () { return y; }; + this.bar(b()); } - this_2.bar(a()); - }; - var this_2 = this; - for (var _i = 0, _a = [1]; _i < _a.length; _i++) { - var x = _a[_i]; - _loop_2(x); + this.bar(a()); } - }; - A.prototype.baz2 = function () { - var _loop_4 = function (x) { - var a = function () { return x; }; - this_3.bar(a()); - var _loop_5 = function (y) { - var b = function () { return y; }; - this_3.bar(b()); - }; - for (var _b = 0, _c = [1]; _b < _c.length; _b++) { - var y = _c[_b]; - _loop_5(y); + } + baz2() { + for (let x of [1]) { + let a = function () { return x; }; + this.bar(a()); + for (let y of [1]) { + let b = function () { return y; }; + this.bar(b()); } - }; - var this_3 = this; - for (var _i = 0, _a = [1]; _i < _a.length; _i++) { - var x = _a[_i]; - _loop_4(x); } - }; - return A; -}()); -var B = /** @class */ (function () { - function B() { } - B.prototype.foo = function () { - var _this = this; - var a = function () { - var _loop_6 = function (x) { - var f = function () { return x; }; - _this.bar(f()); - }; - for (var _i = 0, _a = [0]; _i < _a.length; _i++) { - var x = _a[_i]; - _loop_6(x); +} +class B { + foo() { + let a = () => { + for (let x of [0]) { + let f = () => x; + this.bar(f()); } }; - }; - B.prototype.bar = function (a) { - }; - return B; -}()); + } + bar(a) { + } +} diff --git a/tests/baselines/reference/capturedLetConstInLoop11.js b/tests/baselines/reference/capturedLetConstInLoop11.js index 067e4575cabd1..ec0adca7b137d 100644 --- a/tests/baselines/reference/capturedLetConstInLoop11.js +++ b/tests/baselines/reference/capturedLetConstInLoop11.js @@ -16,23 +16,15 @@ function foo() { } //// [capturedLetConstInLoop11.js] -var _loop_1 = function () { - var x = 1; - (function () { return x; }); -}; for (;;) { - _loop_1(); + let x = 1; + () => x; } function foo() { - var _loop_2 = function () { - var a = 0; + for (;;) { + const a = 0; switch (a) { - case 0: return { value: function () { return a; } }; + case 0: return () => a; } - }; - for (;;) { - var state_1 = _loop_2(); - if (typeof state_1 === "object") - return state_1.value; } } diff --git a/tests/baselines/reference/capturedLetConstInLoop12.js b/tests/baselines/reference/capturedLetConstInLoop12.js index 1fbc3fdb6cab8..92d4504710370 100644 --- a/tests/baselines/reference/capturedLetConstInLoop12.js +++ b/tests/baselines/reference/capturedLetConstInLoop12.js @@ -20,31 +20,13 @@ //// [capturedLetConstInLoop12.js] (function () { "use strict"; - var _loop_1 = function (i) { - (function () { - var _a; - return _a = [i + 1], i = _a[0], _a; - })(); - out_i_1 = i; - }; - var out_i_1; - for (var i = 0; i < 4; i++) { - _loop_1(i); - i = out_i_1; + for (let i = 0; i < 4; i++) { + (() => [i] = [i + 1])(); } })(); (function () { "use strict"; - var _loop_2 = function (i) { - (function () { - var _a; - return (_a = { a: i + 1 }, i = _a.a, _a); - })(); - out_i_2 = i; - }; - var out_i_2; - for (var i = 0; i < 4; i++) { - _loop_2(i); - i = out_i_2; + for (let i = 0; i < 4; i++) { + (() => ({ a: i } = { a: i + 1 }))(); } })(); diff --git a/tests/baselines/reference/capturedLetConstInLoop13.js b/tests/baselines/reference/capturedLetConstInLoop13.js index 791cf1448763a..ec893691dce57 100644 --- a/tests/baselines/reference/capturedLetConstInLoop13.js +++ b/tests/baselines/reference/capturedLetConstInLoop13.js @@ -25,30 +25,18 @@ class Main { new Main(); //// [capturedLetConstInLoop13.js] -var Main = /** @class */ (function () { - function Main() { +class Main { + constructor() { this.register("a", "b", "c"); } - Main.prototype.register = function () { - var _this = this; - var names = []; - for (var _i = 0; _i < arguments.length; _i++) { - names[_i] = arguments[_i]; + register(...names) { + for (let name of names) { + this.bar({ + [name + ".a"]: () => { this.foo(name); }, + }); } - var _loop_1 = function (name_1) { - var _b; - this_1.bar((_b = {}, - _b[name_1 + ".a"] = function () { _this.foo(name_1); }, - _b)); - }; - var this_1 = this; - for (var _a = 0, names_1 = names; _a < names_1.length; _a++) { - var name_1 = names_1[_a]; - _loop_1(name_1); - } - }; - Main.prototype.bar = function (a) { }; - Main.prototype.foo = function (name) { }; - return Main; -}()); + } + bar(a) { } + foo(name) { } +} new Main(); diff --git a/tests/baselines/reference/capturedLetConstInLoop14.errors.txt b/tests/baselines/reference/capturedLetConstInLoop14(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/capturedLetConstInLoop14.errors.txt rename to tests/baselines/reference/capturedLetConstInLoop14(target=es2015).errors.txt diff --git a/tests/baselines/reference/capturedLetConstInLoop14(target=es2015).js b/tests/baselines/reference/capturedLetConstInLoop14(target=es2015).js new file mode 100644 index 0000000000000..58e2471fa9540 --- /dev/null +++ b/tests/baselines/reference/capturedLetConstInLoop14(target=es2015).js @@ -0,0 +1,31 @@ +//// [tests/cases/compiler/capturedLetConstInLoop14.ts] //// + +//// [capturedLetConstInLoop14.ts] +function use(v: number) {} + +function foo(x: number) { + var v = 1; + do { + let x = v; + var v; + var v = 2; + () => x + v; + } while (false); + + use(v); +} + + +//// [capturedLetConstInLoop14.js] +"use strict"; +function use(v) { } +function foo(x) { + var v = 1; + do { + let x = v; + var v; + var v = 2; + () => x + v; + } while (false); + use(v); +} diff --git a/tests/baselines/reference/capturedLetConstInLoop14(target=es5).errors.txt b/tests/baselines/reference/capturedLetConstInLoop14(target=es5).errors.txt new file mode 100644 index 0000000000000..ab5b98288acb1 --- /dev/null +++ b/tests/baselines/reference/capturedLetConstInLoop14(target=es5).errors.txt @@ -0,0 +1,21 @@ +capturedLetConstInLoop14.ts(7,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'v' must be of type 'number', but here has type 'any'. + + +==== capturedLetConstInLoop14.ts (1 errors) ==== + function use(v: number) {} + + function foo(x: number) { + var v = 1; + do { + let x = v; + var v; + ~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'v' must be of type 'number', but here has type 'any'. +!!! related TS6203 capturedLetConstInLoop14.ts:4:7: 'v' was also declared here. + var v = 2; + () => x + v; + } while (false); + + use(v); + } + \ No newline at end of file diff --git a/tests/baselines/reference/capturedLetConstInLoop14.js b/tests/baselines/reference/capturedLetConstInLoop14(target=es5).js similarity index 100% rename from tests/baselines/reference/capturedLetConstInLoop14.js rename to tests/baselines/reference/capturedLetConstInLoop14(target=es5).js diff --git a/tests/baselines/reference/capturedLetConstInLoop2.js b/tests/baselines/reference/capturedLetConstInLoop2.js index a5c5e21a5127d..2a6e0e472385e 100644 --- a/tests/baselines/reference/capturedLetConstInLoop2.js +++ b/tests/baselines/reference/capturedLetConstInLoop2.js @@ -179,235 +179,153 @@ function foo8_c(x) { //// [capturedLetConstInLoop2.js] // ========let function foo0(x) { - var _loop_1 = function (x_1) { - var a = arguments_1.length; - (function () { return x_1 + a; }); - (function () { return x_1 + a; }); - }; - var arguments_1 = arguments; - for (var _i = 0, _a = []; _i < _a.length; _i++) { - var x_1 = _a[_i]; - _loop_1(x_1); + for (let x of []) { + let a = arguments.length; + (function () { return x + a; }); + (() => x + a); } } function foo0_1(x) { - var _loop_2 = function (x_2) { - var a = arguments_2.length; - (function () { return x_2 + a; }); - (function () { return x_2 + a; }); - }; - var arguments_2 = arguments; - for (var x_2 in []) { - _loop_2(x_2); + for (let x in []) { + let a = arguments.length; + (function () { return x + a; }); + (() => x + a); } } function foo1(x) { - var _loop_3 = function (x_3) { - var a = arguments_3.length; - (function () { return x_3 + a; }); - (function () { return x_3 + a; }); - }; - var arguments_3 = arguments; - for (var x_3 = 0; x_3 < 1; ++x_3) { - _loop_3(x_3); + for (let x = 0; x < 1; ++x) { + let a = arguments.length; + (function () { return x + a; }); + (() => x + a); } } function foo2(x) { - var _loop_4 = function () { - var a = arguments_4.length; - (function () { return x + a; }); - (function () { return x + a; }); - }; - var arguments_4 = arguments; while (1 === 1) { - _loop_4(); + let a = arguments.length; + (function () { return x + a; }); + (() => x + a); } } function foo3(x) { - var _loop_5 = function () { - var x_4; - var a = arguments_5.length; - (function () { return x_4 + a; }); - (function () { return x_4 + a; }); - }; - var arguments_5 = arguments; do { - _loop_5(); + let x; + let a = arguments.length; + (function () { return x + a; }); + (() => x + a); } while (1 === 1); } function foo4(x) { - var _loop_6 = function (y) { - var a = arguments_6.length; - var x_5 = 1; - (function () { return x_5 + a; }); - (function () { return x_5 + a; }); - }; - var arguments_6 = arguments; - for (var y = 0; y < 1; ++y) { - _loop_6(y); + for (let y = 0; y < 1; ++y) { + let a = arguments.length; + let x = 1; + (function () { return x + a; }); + (() => x + a); } } function foo5(x) { - var _loop_7 = function (x_6, y) { - var a = arguments_7.length; - (function () { return x_6 + y + a; }); - (function () { return x_6 + y + a; }); - }; - var arguments_7 = arguments; - for (var x_6 = 0, y = 1; x_6 < 1; ++x_6) { - _loop_7(x_6, y); + for (let x = 0, y = 1; x < 1; ++x) { + let a = arguments.length; + (function () { return x + y + a; }); + (() => x + y + a); } } function foo6(x) { - var _loop_8 = function () { - var x_7, y; - var a = arguments_8.length; - (function () { return x_7 + y + a; }); - (function () { return x_7 + y + a; }); - }; - var arguments_8 = arguments; while (1 === 1) { - _loop_8(); + let x, y; + let a = arguments.length; + (function () { return x + y + a; }); + (() => x + y + a); } } function foo7(x) { - var _loop_9 = function () { - var x_8, y; - var a = arguments_9.length; - (function () { return x_8 + y + a; }); - (function () { return x_8 + y + a; }); - }; - var arguments_9 = arguments; do { - _loop_9(); + let x, y; + let a = arguments.length; + (function () { return x + y + a; }); + (() => x + y + a); } while (1 === 1); } function foo8(x) { - var _loop_10 = function (y) { - var x_9 = 1; - var a = arguments_10.length; - (function () { return x_9 + y + a; }); - (function () { return x_9 + y + a; }); - }; - var arguments_10 = arguments; - for (var y = 0; y < 1; ++y) { - _loop_10(y); + for (let y = 0; y < 1; ++y) { + let x = 1; + let a = arguments.length; + (function () { return x + y + a; }); + (() => x + y + a); } } ///=======const function foo0_c(x) { - var _loop_11 = function (x_10) { - var a = arguments_11.length; - (function () { return x_10 + a; }); - (function () { return x_10 + a; }); - }; - var arguments_11 = arguments; - for (var _i = 0, _a = []; _i < _a.length; _i++) { - var x_10 = _a[_i]; - _loop_11(x_10); + for (const x of []) { + const a = arguments.length; + (function () { return x + a; }); + (() => x + a); } } function foo0_1_c(x) { - var _loop_12 = function (x_11) { - var a = arguments_12.length; - (function () { return x_11 + a; }); - (function () { return x_11 + a; }); - }; - var arguments_12 = arguments; - for (var x_11 in []) { - _loop_12(x_11); + for (const x in []) { + const a = arguments.length; + (function () { return x + a; }); + (() => x + a); } } function foo1_c(x) { - var _loop_13 = function (x_12) { - var a = arguments_13.length; - (function () { return x_12 + a; }); - (function () { return x_12 + a; }); - }; - var arguments_13 = arguments; - for (var x_12 = 0; x_12 < 1;) { - _loop_13(x_12); + for (const x = 0; x < 1;) { + const a = arguments.length; + (function () { return x + a; }); + (() => x + a); } } function foo2_c(x) { - var _loop_14 = function () { - var a = arguments_14.length; - (function () { return x + a; }); - (function () { return x + a; }); - }; - var arguments_14 = arguments; while (1 === 1) { - _loop_14(); + const a = arguments.length; + (function () { return x + a; }); + (() => x + a); } } function foo3_c(x) { - var _loop_15 = function () { - var x_13 = 1; - var a = arguments_15.length; - (function () { return x_13 + a; }); - (function () { return x_13 + a; }); - }; - var arguments_15 = arguments; do { - _loop_15(); + const x = 1; + const a = arguments.length; + (function () { return x + a; }); + (() => x + a); } while (1 === 1); } function foo4_c(x) { - var _loop_16 = function (y) { - var a = arguments_16.length; - var x_14 = 1; - (function () { return x_14 + a; }); - (function () { return x_14 + a; }); - }; - var arguments_16 = arguments; - for (var y = 0; y < 1;) { - _loop_16(y); + for (const y = 0; y < 1;) { + const a = arguments.length; + const x = 1; + (function () { return x + a; }); + (() => x + a); } } function foo5_c(x) { - var _loop_17 = function (x_15, y) { - var a = arguments_17.length; - (function () { return x_15 + y + a; }); - (function () { return x_15 + y + a; }); - }; - var arguments_17 = arguments; - for (var x_15 = 0, y = 1; x_15 < 1;) { - _loop_17(x_15, y); + for (const x = 0, y = 1; x < 1;) { + const a = arguments.length; + (function () { return x + y + a; }); + (() => x + y + a); } } function foo6_c(x) { - var _loop_18 = function () { - var x_16 = 1, y = 1; - var a = arguments_18.length; - (function () { return x_16 + y + a; }); - (function () { return x_16 + y + a; }); - }; - var arguments_18 = arguments; while (1 === 1) { - _loop_18(); + const x = 1, y = 1; + const a = arguments.length; + (function () { return x + y + a; }); + (() => x + y + a); } } function foo7_c(x) { - var _loop_19 = function () { - var x_17 = 1, y = 1; - var a = arguments_19.length; - (function () { return x_17 + y + a; }); - (function () { return x_17 + y + a; }); - }; - var arguments_19 = arguments; do { - _loop_19(); + const x = 1, y = 1; + const a = arguments.length; + (function () { return x + y + a; }); + (() => x + y + a); } while (1 === 1); } function foo8_c(x) { - var _loop_20 = function (y) { - var x_18 = 1; - var a = arguments_20.length; - (function () { return x_18 + y + a; }); - (function () { return x_18 + y + a; }); - }; - var arguments_20 = arguments; - for (var y = 0; y < 1;) { - _loop_20(y); + for (const y = 0; y < 1;) { + const x = 1; + const a = arguments.length; + (function () { return x + y + a; }); + (() => x + y + a); } } diff --git a/tests/baselines/reference/capturedLetConstInLoop3.js b/tests/baselines/reference/capturedLetConstInLoop3.js index be6a01db29d7c..6baacd54b9c21 100644 --- a/tests/baselines/reference/capturedLetConstInLoop3.js +++ b/tests/baselines/reference/capturedLetConstInLoop3.js @@ -221,255 +221,175 @@ function foo8_c(x) { //// [capturedLetConstInLoop3.js] function foo0(x) { - var _loop_1 = function (x_1) { - v = x_1; - (function () { return x_1 + v; }); - (function () { return x_1 + v; }); - }; - var v; - for (var _i = 0, _a = []; _i < _a.length; _i++) { - var x_1 = _a[_i]; - _loop_1(x_1); + for (let x of []) { + var v = x; + (function () { return x + v; }); + (() => x + v); } use(v); } function foo0_1(x) { - var _loop_2 = function (x_2) { - v = x_2; - (function () { return x_2 + v; }); - (function () { return x_2 + v; }); - }; - var v; - for (var x_2 in []) { - _loop_2(x_2); + for (let x in []) { + var v = x; + (function () { return x + v; }); + (() => x + v); } use(v); } function foo1(x) { - var _loop_3 = function (x_3) { - v = x_3; - (function () { return x_3 + v; }); - (function () { return x_3 + v; }); - }; - var v; - for (var x_3 = 0; x_3 < 1; ++x_3) { - _loop_3(x_3); + for (let x = 0; x < 1; ++x) { + var v = x; + (function () { return x + v; }); + (() => x + v); } use(v); } function foo2(x) { - var _loop_4 = function () { - var x_4 = 1; - v = x_4; - (function () { return x_4 + v; }); - (function () { return x_4 + v; }); - }; - var v; while (1 === 1) { - _loop_4(); + let x = 1; + var v = x; + (function () { return x + v; }); + (() => x + v); } use(v); } function foo3(x) { - var _loop_5 = function () { - var x_5; - (function () { return x_5 + v; }); - (function () { return x_5 + v; }); - }; - var v; do { - _loop_5(); + let x; + var v; + (function () { return x + v; }); + (() => x + v); } while (1 === 1); use(v); } function foo4(x) { - var _loop_6 = function (y) { - v = y; - var x_6 = 1; - (function () { return x_6 + v; }); - (function () { return x_6 + v; }); - }; - var v; - for (var y = 0; y < 1; ++y) { - _loop_6(y); + for (let y = 0; y < 1; ++y) { + var v = y; + let x = 1; + (function () { return x + v; }); + (() => x + v); } use(v); } function foo5(x) { - var _loop_7 = function (x_7, y) { - v = x_7; - (function () { return x_7 + y + v; }); - (function () { return x_7 + y + v; }); - }; - var v; - for (var x_7 = 0, y = 1; x_7 < 1; ++x_7) { - _loop_7(x_7, y); + 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) { - var _loop_8 = function () { - var x_8, y; - v = x_8; - (function () { return x_8 + y + v; }); - (function () { return x_8 + y + v; }); - }; - var v; while (1 === 1) { - _loop_8(); + let x, y; + var v = x; + (function () { return x + y + v; }); + (() => x + y + v); } use(v); } function foo7(x) { - var _loop_9 = function () { - var x_9, y; - v = x_9; - (function () { return x_9 + y + v; }); - (function () { return x_9 + y + v; }); - }; - var v; do { - _loop_9(); + let x, y; + var v = x; + (function () { return x + y + v; }); + (() => x + y + v); } while (1 === 1); use(v); } function foo8(x) { - var _loop_10 = function (y) { - var x_10 = 1; - v = x_10; - (function () { return x_10 + y + v; }); - (function () { return x_10 + y + v; }); - }; - var v; - for (var y = 0; y < 1; ++y) { - _loop_10(y); + for (let y = 0; y < 1; ++y) { + let x = 1; + var v = x; + (function () { return x + y + v; }); + (() => x + y + v); } use(v); } //===const function foo0_c(x) { - var _loop_11 = function (x_11) { - v = x_11; - (function () { return x_11 + v; }); - (function () { return x_11 + v; }); - }; - var v; - for (var _i = 0, _a = []; _i < _a.length; _i++) { - var x_11 = _a[_i]; - _loop_11(x_11); + for (const x of []) { + var v = x; + (function () { return x + v; }); + (() => x + v); } use(v); } function foo0_1_c(x) { - var _loop_12 = function (x_12) { - v = x_12; - (function () { return x_12 + v; }); - (function () { return x_12 + v; }); - }; - var v; - for (var x_12 in []) { - _loop_12(x_12); + for (const x in []) { + var v = x; + (function () { return x + v; }); + (() => x + v); } use(v); } function foo1_c(x) { - var _loop_13 = function (x_13) { - v = x_13; - (function () { return x_13 + v; }); - (function () { return x_13 + v; }); - }; - var v; - for (var x_13 = 0; x_13 < 1;) { - _loop_13(x_13); + for (const x = 0; x < 1;) { + var v = x; + (function () { return x + v; }); + (() => x + v); } use(v); } function foo2_c(x) { - var _loop_14 = function () { - var x_14 = 1; - v = x_14; - (function () { return x_14 + v; }); - (function () { return x_14 + v; }); - }; - var v; while (1 === 1) { - _loop_14(); + const x = 1; + var v = x; + (function () { return x + v; }); + (() => x + v); } use(v); } function foo3_c(x) { - var _loop_15 = function () { - var x_15 = 1; - (function () { return x_15 + v; }); - (function () { return x_15 + v; }); - }; - var v; do { - _loop_15(); + const x = 1; + var v; + (function () { return x + v; }); + (() => x + v); } while (1 === 1); use(v); } function foo4_c(x) { - var _loop_16 = function (y) { - v = y; - var x_16 = 1; - (function () { return x_16 + v; }); - (function () { return x_16 + v; }); - }; - var v; - for (var y = 0; y < 1;) { - _loop_16(y); + for (const y = 0; y < 1;) { + var v = y; + const x = 1; + (function () { return x + v; }); + (() => x + v); } use(v); } function foo5_c(x) { - var _loop_17 = function (x_17, y) { - v = x_17; - (function () { return x_17 + y + v; }); - (function () { return x_17 + y + v; }); - }; - var v; - for (var x_17 = 0, y = 1; x_17 < 1;) { - _loop_17(x_17, y); + 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) { - var _loop_18 = function () { - var x_18 = 1, y = 1; - v = x_18; - (function () { return x_18 + y + v; }); - (function () { return x_18 + y + v; }); - }; - var v; while (1 === 1) { - _loop_18(); + const x = 1, y = 1; + var v = x; + (function () { return x + y + v; }); + (() => x + y + v); } use(v); } function foo7_c(x) { - var _loop_19 = function () { - var x_19 = 1, y = 1; - v = x_19; - (function () { return x_19 + y + v; }); - (function () { return x_19 + y + v; }); - }; - var v; do { - _loop_19(); + const x = 1, y = 1; + var v = x; + (function () { return x + y + v; }); + (() => x + y + v); } while (1 === 1); use(v); } function foo8_c(x) { - var _loop_20 = function (y) { - var x_20 = 1; - v = x_20; - (function () { return x_20 + y + v; }); - (function () { return x_20 + y + v; }); - }; - var v; - for (var y = 0; y < 1;) { - _loop_20(y); + for (const y = 0; y < 1;) { + const x = 1; + var v = x; + (function () { return x + y + v; }); + (() => x + y + v); } use(v); } diff --git a/tests/baselines/reference/capturedLetConstInLoop4.js b/tests/baselines/reference/capturedLetConstInLoop4.js index 3cb952e524f65..0df51c43f314e 100644 --- a/tests/baselines/reference/capturedLetConstInLoop4.js +++ b/tests/baselines/reference/capturedLetConstInLoop4.js @@ -162,179 +162,117 @@ System.register([], function (exports_1, context_1) { return { setters: [], execute: function () { - var _loop_1 = function (x) { + for (let x of []) { v0 = x; (function () { return x + v0; }); - (function () { return x; }); - }; - for (var _i = 0, _a = []; _i < _a.length; _i++) { - var x = _a[_i]; - _loop_1(x); + (() => x); } - var _loop_2 = function (x) { + for (let x in []) { v00 = x; (function () { return x + v00; }); - (function () { return x; }); - }; - for (var x in []) { - _loop_2(x); + (() => x); } - var _loop_3 = function (x) { + for (let x = 0; x < 1; ++x) { v1 = x; (function () { return x + v1; }); - (function () { return x; }); - }; - for (var x = 0; x < 1; ++x) { - _loop_3(x); + (() => x); } - var _loop_4 = function () { - var x; + while (1 === 1) { + let x; v2 = x; (function () { return x + v2; }); - (function () { return x; }); - }; - while (1 === 1) { - _loop_4(); + (() => x); } - var _loop_5 = function () { - var x; + do { + let x; v3 = x; (function () { return x + v3; }); - (function () { return x; }); - }; - do { - _loop_5(); + (() => x); } while (1 === 1); - var _loop_6 = function (y) { - var x = 1; + for (let y = 0; y < 1; ++y) { + let x = 1; v4 = x; (function () { return x + v4; }); - (function () { return x; }); - }; - for (var y = 0; y < 1; ++y) { - _loop_6(y); + (() => x); } - var _loop_7 = function (x, y) { + for (let x = 0, y = 1; x < 1; ++x) { v5 = x; (function () { return x + y + v5; }); - (function () { return x + y; }); - }; - for (var x = 0, y = 1; x < 1; ++x) { - _loop_7(x, y); + (() => x + y); } - var _loop_8 = function () { - var x, y; + while (1 === 1) { + let x, y; v6 = x; (function () { return x + y + v6; }); - (function () { return x + y; }); - }; - while (1 === 1) { - _loop_8(); + (() => x + y); } - var _loop_9 = function () { - var x, y; + do { + let x, y; v7 = x; (function () { return x + y + v7; }); - (function () { return x + y; }); - }; - do { - _loop_9(); + (() => x + y); } while (1 === 1); - var _loop_10 = function (y) { - var x = 1; + for (let y = 0; y < 1; ++y) { + let x = 1; v8 = x; (function () { return x + y + v8; }); - (function () { return x + y; }); - }; - for (var y = 0; y < 1; ++y) { - _loop_10(y); + (() => x + y); } - var _loop_11 = function (x) { + for (const x of []) { v0_c = x; (function () { return x + v0_c; }); - (function () { return x; }); - }; - for (var _b = 0, _c = []; _b < _c.length; _b++) { - var x = _c[_b]; - _loop_11(x); + (() => x); } - var _loop_12 = function (x) { + for (const x in []) { v00_c = x; (function () { return x + v00; }); - (function () { return x; }); - }; - for (var x in []) { - _loop_12(x); + (() => x); } - var _loop_13 = function (x) { + for (const x = 0; x < 1;) { v1_c = x; (function () { return x + v1_c; }); - (function () { return x; }); - }; - for (var x = 0; x < 1;) { - _loop_13(x); + (() => x); } - var _loop_14 = function () { - var x = 1; + while (1 === 1) { + const x = 1; v2_c = x; (function () { return x + v2_c; }); - (function () { return x; }); - }; - while (1 === 1) { - _loop_14(); + (() => x); } - var _loop_15 = function () { - var x = 1; + do { + const x = 1; v3_c = x; (function () { return x + v3_c; }); - (function () { return x; }); - }; - do { - _loop_15(); + (() => x); } while (1 === 1); - var _loop_16 = function (y) { - var x = 1; + for (const y = 0; y < 1;) { + const x = 1; v4_c = x; (function () { return x + v4_c; }); - (function () { return x; }); - }; - for (var y = 0; y < 1;) { - _loop_16(y); + (() => x); } - var _loop_17 = function (x, y) { + for (const x = 0, y = 1; x < 1;) { v5_c = x; (function () { return x + y + v5_c; }); - (function () { return x + y; }); - }; - for (var x = 0, y = 1; x < 1;) { - _loop_17(x, y); + (() => x + y); } - var _loop_18 = function () { - var x = 1, y = 1; + while (1 === 1) { + const x = 1, y = 1; v6_c = x; (function () { return x + y + v6_c; }); - (function () { return x + y; }); - }; - while (1 === 1) { - _loop_18(); + (() => x + y); } - var _loop_19 = function () { - var x = 1, y = 1; + do { + const x = 1, y = 1; v7_c = x; (function () { return x + y + v7_c; }); - (function () { return x + y; }); - }; - do { - _loop_19(); + (() => x + y); } while (1 === 1); - var _loop_20 = function (y) { - var x = 1; + for (const y = 0; y < 1;) { + const x = 1; v8_c = x; (function () { return x + y + v8_c; }); - (function () { return x + y; }); - }; - for (var y = 0; y < 1;) { - _loop_20(y); + (() => x + y); } } }; diff --git a/tests/baselines/reference/capturedLetConstInLoop5.js b/tests/baselines/reference/capturedLetConstInLoop5.js index 3310e159ca77d..becbf24cb8657 100644 --- a/tests/baselines/reference/capturedLetConstInLoop5.js +++ b/tests/baselines/reference/capturedLetConstInLoop5.js @@ -284,356 +284,236 @@ function foo8_c(x) { //// [capturedLetConstInLoop5.js] //====let function foo0(x) { - var _loop_1 = function (x_1) { - v = x_1; - (function () { return x_1 + v; }); - (function () { return x_1 + v; }); - if (x_1 == 1) { - return { value: void 0 }; + for (let x of []) { + var v = x; + (function () { return x + v; }); + (() => x + v); + if (x == 1) { + return; } - }; - var v; - for (var _i = 0, _a = []; _i < _a.length; _i++) { - var x_1 = _a[_i]; - var state_1 = _loop_1(x_1); - if (typeof state_1 === "object") - return state_1.value; } use(v); } function foo00(x) { - var _loop_2 = function (x_2) { - v = x_2; - (function () { return x_2 + v; }); - (function () { return x_2 + v; }); - if (x_2 == "1") { - return { value: void 0 }; + for (let x in []) { + var v = x; + (function () { return x + v; }); + (() => x + v); + if (x == "1") { + return; } - }; - var v; - for (var x_2 in []) { - var state_2 = _loop_2(x_2); - if (typeof state_2 === "object") - return state_2.value; } use(v); } function foo1(x) { - var _loop_3 = function (x_3) { - v = x_3; - (function () { return x_3 + v; }); - (function () { return x_3 + v; }); - if (x_3 == 1) { - return { value: void 0 }; + for (let x = 0; x < 1; ++x) { + var v = x; + (function () { return x + v; }); + (() => x + v); + if (x == 1) { + return; } - }; - var v; - for (var x_3 = 0; x_3 < 1; ++x_3) { - var state_3 = _loop_3(x_3); - if (typeof state_3 === "object") - return state_3.value; } use(v); } function foo2(x) { - var _loop_4 = function () { - var x_4 = 1; - v = x_4; - (function () { return x_4 + v; }); - (function () { return x_4 + v; }); - if (x_4 == 1) { - return { value: void 0 }; - } - }; - var v; while (1 === 1) { - var state_4 = _loop_4(); - if (typeof state_4 === "object") - return state_4.value; + let x = 1; + var v = x; + (function () { return x + v; }); + (() => x + v); + if (x == 1) { + return; + } } use(v); } function foo3(x) { - var _loop_5 = function () { - var x_5; - (function () { return x_5 + v; }); - (function () { return x_5 + v; }); - if (x_5 == 1) { - return { value: void 0 }; - } - }; - var v; do { - var state_5 = _loop_5(); - if (typeof state_5 === "object") - return state_5.value; + let x; + var v; + (function () { return x + v; }); + (() => x + v); + if (x == 1) { + return; + } } while (1 === 1); use(v); } function foo4(x) { - var _loop_6 = function (y) { - v = y; - var x_6 = 1; - (function () { return x_6 + v; }); - (function () { return x_6 + v; }); - if (x_6 == 1) { - return { value: void 0 }; + for (let y = 0; y < 1; ++y) { + var v = y; + let x = 1; + (function () { return x + v; }); + (() => x + v); + if (x == 1) { + return; } - }; - var v; - for (var y = 0; y < 1; ++y) { - var state_6 = _loop_6(y); - if (typeof state_6 === "object") - return state_6.value; } use(v); } function foo5(x) { - var _loop_7 = function (x_7, y) { - v = x_7; - (function () { return x_7 + y + v; }); - (function () { return x_7 + y + v; }); - if (x_7 == 1) { - return { value: void 0 }; + for (let x = 0, y = 1; x < 1; ++x) { + var v = x; + (function () { return x + y + v; }); + (() => x + y + v); + if (x == 1) { + return; } - }; - var v; - for (var x_7 = 0, y = 1; x_7 < 1; ++x_7) { - var state_7 = _loop_7(x_7, y); - if (typeof state_7 === "object") - return state_7.value; } use(v); } function foo6(x) { - var _loop_8 = function () { - var x_8, y; - v = x_8; - (function () { return x_8 + y + v; }); - (function () { return x_8 + y + v; }); - if (x_8 == 1) { - return { value: void 0 }; - } - }; - var v; while (1 === 1) { - var state_8 = _loop_8(); - if (typeof state_8 === "object") - return state_8.value; + let x, y; + var v = x; + (function () { return x + y + v; }); + (() => x + y + v); + if (x == 1) { + return; + } } ; use(v); } function foo7(x) { - var _loop_9 = function () { - var x_9, y; - v = x_9; - (function () { return x_9 + y + v; }); - (function () { return x_9 + y + v; }); - if (x_9 == 1) { - return { value: void 0 }; - } - }; - var v; do { - var state_9 = _loop_9(); - if (typeof state_9 === "object") - return state_9.value; + let x, y; + var v = x; + (function () { return x + y + v; }); + (() => x + y + v); + if (x == 1) { + return; + } } while (1 === 1); use(v); } function foo8(x) { - var _loop_10 = function (y) { - var x_10 = 1; - v = x_10; - (function () { return x_10 + y + v; }); - (function () { return x_10 + y + v; }); - if (x_10 == 1) { - return { value: void 0 }; + for (let y = 0; y < 1; ++y) { + let x = 1; + var v = x; + (function () { return x + y + v; }); + (() => x + y + v); + if (x == 1) { + return; } - }; - var v; - for (var y = 0; y < 1; ++y) { - var state_10 = _loop_10(y); - if (typeof state_10 === "object") - return state_10.value; } use(v); } //====const function foo0_c(x) { - var _loop_11 = function (x_11) { - v = x_11; - (function () { return x_11 + v; }); - (function () { return x_11 + v; }); - if (x_11 == 1) { - return { value: void 0 }; + for (const x of []) { + var v = x; + (function () { return x + v; }); + (() => x + v); + if (x == 1) { + return; } - }; - var v; - for (var _i = 0, _a = []; _i < _a.length; _i++) { - var x_11 = _a[_i]; - var state_11 = _loop_11(x_11); - if (typeof state_11 === "object") - return state_11.value; } use(v); } function foo00_c(x) { - var _loop_12 = function (x_12) { - v = x_12; - (function () { return x_12 + v; }); - (function () { return x_12 + v; }); - if (x_12 == "1") { - return { value: void 0 }; + for (const x in []) { + var v = x; + (function () { return x + v; }); + (() => x + v); + if (x == "1") { + return; } - }; - var v; - for (var x_12 in []) { - var state_12 = _loop_12(x_12); - if (typeof state_12 === "object") - return state_12.value; } use(v); } function foo1_c(x) { - var _loop_13 = function (x_13) { - v = x_13; - (function () { return x_13 + v; }); - (function () { return x_13 + v; }); - if (x_13 == 1) { - return { value: void 0 }; + for (const x = 0; x < 1;) { + var v = x; + (function () { return x + v; }); + (() => x + v); + if (x == 1) { + return; } - }; - var v; - for (var x_13 = 0; x_13 < 1;) { - var state_13 = _loop_13(x_13); - if (typeof state_13 === "object") - return state_13.value; } use(v); } function foo2_c(x) { - var _loop_14 = function () { - var x_14 = 1; - v = x_14; - (function () { return x_14 + v; }); - (function () { return x_14 + v; }); - if (x_14 == 1) { - return { value: void 0 }; - } - }; - var v; while (1 === 1) { - var state_14 = _loop_14(); - if (typeof state_14 === "object") - return state_14.value; + const x = 1; + var v = x; + (function () { return x + v; }); + (() => x + v); + if (x == 1) { + return; + } } use(v); } function foo3_c(x) { - var _loop_15 = function () { - var x_15 = 1; - (function () { return x_15 + v; }); - (function () { return x_15 + v; }); - if (x_15 == 1) { - return { value: void 0 }; - } - }; - var v; do { - var state_15 = _loop_15(); - if (typeof state_15 === "object") - return state_15.value; + const x = 1; + var v; + (function () { return x + v; }); + (() => x + v); + if (x == 1) { + return; + } } while (1 === 1); use(v); } function foo4_c(x) { - var _loop_16 = function (y) { - v = y; - var x_16 = 1; - (function () { return x_16 + v; }); - (function () { return x_16 + v; }); - if (x_16 == 1) { - return { value: void 0 }; + for (const y = 0; y < 1;) { + var v = y; + let x = 1; + (function () { return x + v; }); + (() => x + v); + if (x == 1) { + return; } - }; - var v; - for (var y = 0; y < 1;) { - var state_16 = _loop_16(y); - if (typeof state_16 === "object") - return state_16.value; } use(v); } function foo5_c(x) { - var _loop_17 = function (x_17, y) { - v = x_17; - (function () { return x_17 + y + v; }); - (function () { return x_17 + y + v; }); - if (x_17 == 1) { - return { value: void 0 }; + for (const x = 0, y = 1; x < 1;) { + var v = x; + (function () { return x + y + v; }); + (() => x + y + v); + if (x == 1) { + return; } - }; - var v; - for (var x_17 = 0, y = 1; x_17 < 1;) { - var state_17 = _loop_17(x_17, y); - if (typeof state_17 === "object") - return state_17.value; } use(v); } function foo6_c(x) { - var _loop_18 = function () { - var x_18 = 1, y = 1; - v = x_18; - (function () { return x_18 + y + v; }); - (function () { return x_18 + y + v; }); - if (x_18 == 1) { - return { value: void 0 }; - } - }; - var v; while (1 === 1) { - var state_18 = _loop_18(); - if (typeof state_18 === "object") - return state_18.value; + const x = 1, y = 1; + var v = x; + (function () { return x + y + v; }); + (() => x + y + v); + if (x == 1) { + return; + } } use(v); } function foo7_c(x) { - var _loop_19 = function () { - var x_19 = 1, y = 1; - v = x_19; - (function () { return x_19 + y + v; }); - (function () { return x_19 + y + v; }); - if (x_19 == 1) { - return { value: void 0 }; - } - }; - var v; do { - var state_19 = _loop_19(); - if (typeof state_19 === "object") - return state_19.value; + const x = 1, y = 1; + var v = x; + (function () { return x + y + v; }); + (() => x + y + v); + if (x == 1) { + return; + } } while (1 === 1); use(v); } function foo8_c(x) { - var _loop_20 = function (y) { - var x_20 = 1; - v = x_20; - (function () { return x_20 + y + v; }); - (function () { return x_20 + y + v; }); - if (x_20 == 1) { - return { value: void 0 }; + for (const y = 0; y < 1;) { + const x = 1; + var v = x; + (function () { return x + y + v; }); + (() => x + y + v); + if (x == 1) { + return; } - }; - var v; - for (var y = 0; y < 1;) { - var state_20 = _loop_20(y); - if (typeof state_20 === "object") - return state_20.value; } use(v); } diff --git a/tests/baselines/reference/capturedLetConstInLoop6.js b/tests/baselines/reference/capturedLetConstInLoop6.js index a336075d031ec..8151166ab21a3 100644 --- a/tests/baselines/reference/capturedLetConstInLoop6.js +++ b/tests/baselines/reference/capturedLetConstInLoop6.js @@ -241,319 +241,217 @@ for (const y = 0; y < 1;) { //// [capturedLetConstInLoop6.js] -var _loop_1 = function (x) { - (function () { return x; }); +// ====let +for (let x of []) { (function () { return x; }); + (() => x); if (x == 1) { - return "break"; + break; } if (x == 2) { - return "continue"; + continue; } -}; -// ====let -for (var _i = 0, _a = []; _i < _a.length; _i++) { - var x = _a[_i]; - var state_1 = _loop_1(x); - if (state_1 === "break") - break; } -var _loop_2 = function (x) { - (function () { return x; }); +for (let x in []) { (function () { return x; }); + (() => x); if (x == "1") { - return "break"; + break; } if (x == "2") { - return "continue"; + continue; } -}; -for (var x in []) { - var state_2 = _loop_2(x); - if (state_2 === "break") - break; } -var _loop_3 = function (x) { - (function () { return x; }); +for (let x = 0; x < 1; ++x) { (function () { return x; }); + (() => x); if (x == 1) { - return "break"; + break; } if (x == 2) { - return "continue"; + continue; } -}; -for (var x = 0; x < 1; ++x) { - var state_3 = _loop_3(x); - if (state_3 === "break") - break; } -var _loop_4 = function () { - var x; - (function () { return x; }); +while (1 === 1) { + let x; (function () { return x; }); + (() => x); if (x == 1) { - return "break"; + break; } if (x == 2) { - return "continue"; + continue; } -}; -while (1 === 1) { - var state_4 = _loop_4(); - if (state_4 === "break") - break; } -var _loop_5 = function () { - var x; - (function () { return x; }); +do { + let x; (function () { return x; }); + (() => x); if (x == 1) { - return "break"; + break; } if (x == 2) { - return "continue"; + continue; } -}; -do { - var state_5 = _loop_5(); - if (state_5 === "break") - break; } while (1 === 1); -var _loop_6 = function (y) { - var x = 1; - (function () { return x; }); +for (let y = 0; y < 1; ++y) { + let x = 1; (function () { return x; }); + (() => x); if (x == 1) { - return "break"; + break; } if (x == 2) { - return "continue"; + continue; } -}; -for (var y = 0; y < 1; ++y) { - var state_6 = _loop_6(y); - if (state_6 === "break") - break; } -var _loop_7 = function (x, y) { - (function () { return x + y; }); +for (let x = 0, y = 1; x < 1; ++x) { (function () { return x + y; }); + (() => x + y); if (x == 1) { - return "break"; + break; } if (x == 2) { - return "continue"; + continue; } -}; -for (var x = 0, y = 1; x < 1; ++x) { - var state_7 = _loop_7(x, y); - if (state_7 === "break") - break; } -var _loop_8 = function () { - var x, y; - (function () { return x + y; }); +while (1 === 1) { + let x, y; (function () { return x + y; }); + (() => x + y); if (x == 1) { - return "break"; + break; } if (x == 2) { - return "continue"; + continue; } -}; -while (1 === 1) { - var state_8 = _loop_8(); - if (state_8 === "break") - break; } -var _loop_9 = function () { - var x, y; - (function () { return x + y; }); +do { + let x, y; (function () { return x + y; }); + (() => x + y); if (x == 1) { - return "break"; + break; } if (x == 2) { - return "continue"; + continue; } -}; -do { - var state_9 = _loop_9(); - if (state_9 === "break") - break; } while (1 === 1); -var _loop_10 = function (y) { - var x = 1; - (function () { return x + y; }); +for (let y = 0; y < 1; ++y) { + let x = 1; (function () { return x + y; }); + (() => x + y); if (x == 1) { - return "break"; + break; } if (x == 2) { - return "continue"; + continue; } -}; -for (var y = 0; y < 1; ++y) { - var state_10 = _loop_10(y); - if (state_10 === "break") - break; } -var _loop_11 = function (x) { - (function () { return x; }); +// ====const +for (const x of []) { (function () { return x; }); + (() => x); if (x == 1) { - return "break"; + break; } if (x == 2) { - return "continue"; + continue; } -}; -// ====const -for (var _b = 0, _c = []; _b < _c.length; _b++) { - var x = _c[_b]; - var state_11 = _loop_11(x); - if (state_11 === "break") - break; } -var _loop_12 = function (x) { - (function () { return x; }); +for (const x in []) { (function () { return x; }); + (() => x); if (x == "1") { - return "break"; + break; } if (x == "2") { - return "continue"; + continue; } -}; -for (var x in []) { - var state_12 = _loop_12(x); - if (state_12 === "break") - break; } -var _loop_13 = function (x) { - (function () { return x; }); +for (const x = 0; x < 1;) { (function () { return x; }); + (() => x); if (x == 1) { - return "break"; + break; } if (x == 2) { - return "continue"; + continue; } -}; -for (var x = 0; x < 1;) { - var state_13 = _loop_13(x); - if (state_13 === "break") - break; } -var _loop_14 = function () { - var x = 1; - (function () { return x; }); +while (1 === 1) { + const x = 1; (function () { return x; }); + (() => x); if (x == 1) { - return "break"; + break; } if (x == 2) { - return "continue"; + continue; } -}; -while (1 === 1) { - var state_14 = _loop_14(); - if (state_14 === "break") - break; } -var _loop_15 = function () { - var x = 1; - (function () { return x; }); +do { + const x = 1; (function () { return x; }); + (() => x); if (x == 1) { - return "break"; + break; } if (x == 2) { - return "continue"; + continue; } -}; -do { - var state_15 = _loop_15(); - if (state_15 === "break") - break; } while (1 === 1); -var _loop_16 = function (y) { - var x = 1; - (function () { return x; }); +for (const y = 0; y < 1;) { + const x = 1; (function () { return x; }); + (() => x); if (x == 1) { - return "break"; + break; } if (x == 2) { - return "continue"; + continue; } -}; -for (var y = 0; y < 1;) { - var state_16 = _loop_16(y); - if (state_16 === "break") - break; } -var _loop_17 = function (x, y) { - (function () { return x + y; }); +for (const x = 0, y = 1; x < 1;) { (function () { return x + y; }); + (() => x + y); if (x == 1) { - return "break"; + break; } if (x == 2) { - return "continue"; + continue; } -}; -for (var x = 0, y = 1; x < 1;) { - var state_17 = _loop_17(x, y); - if (state_17 === "break") - break; } -var _loop_18 = function () { - var x = 1, y = 1; - (function () { return x + y; }); +while (1 === 1) { + const x = 1, y = 1; (function () { return x + y; }); + (() => x + y); if (x == 1) { - return "break"; + break; } if (x == 2) { - return "continue"; + continue; } -}; -while (1 === 1) { - var state_18 = _loop_18(); - if (state_18 === "break") - break; } -var _loop_19 = function () { - var x = 1, y = 1; - (function () { return x + y; }); +do { + const x = 1, y = 1; (function () { return x + y; }); + (() => x + y); if (x == 1) { - return "break"; + break; } if (x == 2) { - return "continue"; + continue; } -}; -do { - var state_19 = _loop_19(); - if (state_19 === "break") - break; } while (1 === 1); -var _loop_20 = function (y) { - var x = 1; - (function () { return x + y; }); +for (const y = 0; y < 1;) { + const x = 1; (function () { return x + y; }); + (() => x + y); if (x == 1) { - return "break"; + break; } if (x == 2) { - return "continue"; + continue; } -}; -for (var y = 0; y < 1;) { - var state_20 = _loop_20(y); - if (state_20 === "break") - break; } diff --git a/tests/baselines/reference/capturedLetConstInLoop7.js b/tests/baselines/reference/capturedLetConstInLoop7.js index 9b1d205f53e36..6229ee443abbf 100644 --- a/tests/baselines/reference/capturedLetConstInLoop7.js +++ b/tests/baselines/reference/capturedLetConstInLoop7.js @@ -378,519 +378,337 @@ for (const y = 0; y < 1;) { } //// [capturedLetConstInLoop7.js] -var _loop_1 = function (x) { - (function () { return x; }); +//===let +l0: for (let x of []) { (function () { return x; }); + (() => x); if (x == 1) { - return "break"; + break; } if (x == 1) { - return "break-l0"; + break l0; } if (x == 2) { - return "continue"; + continue; } if (x == 2) { - return "continue-l0"; - } -}; -//===let -l0: for (var _i = 0, _a = []; _i < _a.length; _i++) { - var x = _a[_i]; - var state_1 = _loop_1(x); - if (state_1 === "break") - break; - switch (state_1) { - case "break-l0": break l0; - case "continue-l0": continue l0; + continue l0; } } -var _loop_2 = function (x) { - (function () { return x; }); +l00: for (let x in []) { (function () { return x; }); + (() => x); if (x == "1") { - return "break"; + break; } if (x == "1") { - return "break-l00"; + break l00; } if (x == "2") { - return "continue"; + continue; } if (x == "2") { - return "continue-l00"; - } -}; -l00: for (var x in []) { - var state_2 = _loop_2(x); - if (state_2 === "break") - break; - switch (state_2) { - case "break-l00": break l00; - case "continue-l00": continue l00; + continue l00; } } -var _loop_3 = function (x) { - (function () { return x; }); +l1: for (let x = 0; x < 1; ++x) { (function () { return x; }); + (() => x); if (x == 1) { - return "break"; + break; } if (x == 1) { - return "break-l1"; + break l1; } if (x == 2) { - return "continue"; + continue; } if (x == 2) { - return "continue-l1"; - } -}; -l1: for (var x = 0; x < 1; ++x) { - var state_3 = _loop_3(x); - if (state_3 === "break") - break; - switch (state_3) { - case "break-l1": break l1; - case "continue-l1": continue l1; + continue l1; } } -var _loop_4 = function () { - var x; - (function () { return x; }); +l2: while (1 === 1) { + let x; (function () { return x; }); + (() => x); if (x == 1) { - return "break"; + break; } if (x == 1) { - return "break-l2"; + break l2; } if (x == 2) { - return "continue"; + continue; } if (x == 2) { - return "continue-l2"; - } -}; -l2: while (1 === 1) { - var state_4 = _loop_4(); - if (state_4 === "break") - break; - switch (state_4) { - case "break-l2": break l2; - case "continue-l2": continue l2; + continue l2; } } -var _loop_5 = function () { - var x; - (function () { return x; }); +l3: do { + let x; (function () { return x; }); + (() => x); if (x == 1) { - return "break"; + break; } if (x == 1) { - return "break-l3"; + break l3; } if (x == 2) { - return "continue"; + continue; } if (x == 2) { - return "continue-l3"; - } -}; -l3: do { - var state_5 = _loop_5(); - if (state_5 === "break") - break; - switch (state_5) { - case "break-l3": break l3; - case "continue-l3": continue l3; + continue l3; } } while (1 === 1); -var _loop_6 = function (y) { - var x = 1; - (function () { return x; }); +l4: for (let y = 0; y < 1; ++y) { + let x = 1; (function () { return x; }); + (() => x); if (x == 1) { - return "break"; + break; } if (x == 1) { - return "break-l4"; + break l4; } if (x == 2) { - return "continue"; + continue; } if (x == 2) { - return "continue-l4"; - } -}; -l4: for (var y = 0; y < 1; ++y) { - var state_6 = _loop_6(y); - if (state_6 === "break") - break; - switch (state_6) { - case "break-l4": break l4; - case "continue-l4": continue l4; + continue l4; } } -var _loop_7 = function (x, y) { - (function () { return x + y; }); +l5: for (let x = 0, y = 1; x < 1; ++x) { (function () { return x + y; }); + (() => x + y); if (x == 1) { - return "break"; + break; } if (x == 1) { - return "break-l5"; + break l5; } if (x == 2) { - return "continue"; + continue; } if (x == 2) { - return "continue-l5"; - } -}; -l5: for (var x = 0, y = 1; x < 1; ++x) { - var state_7 = _loop_7(x, y); - if (state_7 === "break") - break; - switch (state_7) { - case "break-l5": break l5; - case "continue-l5": continue l5; + continue l5; } } -var _loop_8 = function () { - var x, y; - (function () { return x + y; }); +l6: while (1 === 1) { + let x, y; (function () { return x + y; }); + (() => x + y); if (x == 1) { - return "break"; + break; } if (x == 1) { - return "break-l6"; + break l6; } if (x == 2) { - return "continue"; + continue; } if (x == 2) { - return "continue-l6"; - } -}; -l6: while (1 === 1) { - var state_8 = _loop_8(); - if (state_8 === "break") - break; - switch (state_8) { - case "break-l6": break l6; - case "continue-l6": continue l6; + continue l6; } } -var _loop_9 = function () { - var x, y; - (function () { return x + y; }); +l7: do { + let x, y; (function () { return x + y; }); + (() => x + y); if (x == 1) { - return "break"; + break; } if (x == 1) { - return "break-l7"; + break l7; } if (x == 2) { - return "continue"; + continue; } if (x == 2) { - return "continue-l7"; - } -}; -l7: do { - var state_9 = _loop_9(); - if (state_9 === "break") - break; - switch (state_9) { - case "break-l7": break l7; - case "continue-l7": continue l7; + continue l7; } } while (1 === 1); -var _loop_10 = function (y) { - var x = 1; - (function () { return x + y; }); +l8: for (let y = 0; y < 1; ++y) { + let x = 1; (function () { return x + y; }); + (() => x + y); if (x == 1) { - return "break"; + break; } if (x == 1) { - return "break-l8"; + break l8; } if (x == 2) { - return "continue"; + continue; } if (x == 2) { - return "continue-l8"; - } -}; -l8: for (var y = 0; y < 1; ++y) { - var state_10 = _loop_10(y); - if (state_10 === "break") - break; - switch (state_10) { - case "break-l8": break l8; - case "continue-l8": continue l8; + continue l8; } } -var _loop_11 = function (x) { - (function () { return x; }); +//===const +l0_c: for (const x of []) { (function () { return x; }); + (() => x); if (x == 1) { - return "break"; + break; } if (x == 1) { - return "break-l0_c"; + break l0_c; } if (x == 2) { - return "continue"; + continue; } if (x == 2) { - return "continue-l0_c"; - } -}; -//===const -l0_c: for (var _b = 0, _c = []; _b < _c.length; _b++) { - var x = _c[_b]; - var state_11 = _loop_11(x); - if (state_11 === "break") - break; - switch (state_11) { - case "break-l0_c": break l0_c; - case "continue-l0_c": continue l0_c; + continue l0_c; } } -var _loop_12 = function (x) { - (function () { return x; }); +l00_c: for (const x in []) { (function () { return x; }); + (() => x); if (x == "1") { - return "break"; + break; } if (x == "1") { - return "break-l00_c"; + break l00_c; } if (x == "2") { - return "continue"; + continue; } if (x == "2") { - return "continue-l00_c"; - } -}; -l00_c: for (var x in []) { - var state_12 = _loop_12(x); - if (state_12 === "break") - break; - switch (state_12) { - case "break-l00_c": break l00_c; - case "continue-l00_c": continue l00_c; + continue l00_c; } } -var _loop_13 = function (x) { - (function () { return x; }); +l1_c: for (const x = 0; x < 1;) { (function () { return x; }); + (() => x); if (x == 1) { - return "break"; + break; } if (x == 1) { - return "break-l1_c"; + break l1_c; } if (x == 2) { - return "continue"; + continue; } if (x == 2) { - return "continue-l1_c"; - } -}; -l1_c: for (var x = 0; x < 1;) { - var state_13 = _loop_13(x); - if (state_13 === "break") - break; - switch (state_13) { - case "break-l1_c": break l1_c; - case "continue-l1_c": continue l1_c; + continue l1_c; } } -var _loop_14 = function () { - var x = 1; - (function () { return x; }); +l2_c: while (1 === 1) { + const x = 1; (function () { return x; }); + (() => x); if (x == 1) { - return "break"; + break; } if (x == 1) { - return "break-l2_c"; + break l2_c; } if (x == 2) { - return "continue"; + continue; } if (x == 2) { - return "continue-l2_c"; - } -}; -l2_c: while (1 === 1) { - var state_14 = _loop_14(); - if (state_14 === "break") - break; - switch (state_14) { - case "break-l2_c": break l2_c; - case "continue-l2_c": continue l2_c; + continue l2_c; } } -var _loop_15 = function () { - var x = 1; - (function () { return x; }); +l3_c: do { + const x = 1; (function () { return x; }); + (() => x); if (x == 1) { - return "break"; + break; } if (x == 1) { - return "break-l3_c"; + break l3_c; } if (x == 2) { - return "continue"; + continue; } if (x == 2) { - return "continue-l3_c"; - } -}; -l3_c: do { - var state_15 = _loop_15(); - if (state_15 === "break") - break; - switch (state_15) { - case "break-l3_c": break l3_c; - case "continue-l3_c": continue l3_c; + continue l3_c; } } while (1 === 1); -var _loop_16 = function (y) { - var x = 1; - (function () { return x; }); +l4_c: for (const y = 0; y < 1;) { + const x = 1; (function () { return x; }); + (() => x); if (x == 1) { - return "break"; + break; } if (x == 1) { - return "break-l4_c"; + break l4_c; } if (x == 2) { - return "continue"; + continue; } if (x == 2) { - return "continue-l4_c"; - } -}; -l4_c: for (var y = 0; y < 1;) { - var state_16 = _loop_16(y); - if (state_16 === "break") - break; - switch (state_16) { - case "break-l4_c": break l4_c; - case "continue-l4_c": continue l4_c; + continue l4_c; } } -var _loop_17 = function (x, y) { - (function () { return x + y; }); +l5_c: for (const x = 0, y = 1; x < 1;) { (function () { return x + y; }); + (() => x + y); if (x == 1) { - return "break"; + break; } if (x == 1) { - return "break-l5_c"; + break l5_c; } if (x == 2) { - return "continue"; + continue; } if (x == 2) { - return "continue-l5_c"; - } -}; -l5_c: for (var x = 0, y = 1; x < 1;) { - var state_17 = _loop_17(x, y); - if (state_17 === "break") - break; - switch (state_17) { - case "break-l5_c": break l5_c; - case "continue-l5_c": continue l5_c; + continue l5_c; } } -var _loop_18 = function () { - var x = 1, y = 1; - (function () { return x + y; }); +l6_c: while (1 === 1) { + const x = 1, y = 1; (function () { return x + y; }); + (() => x + y); if (x == 1) { - return "break"; + break; } if (x == 1) { - return "break-l6_c"; + break l6_c; } if (x == 2) { - return "continue"; + continue; } if (x == 2) { - return "continue-l6_c"; - } -}; -l6_c: while (1 === 1) { - var state_18 = _loop_18(); - if (state_18 === "break") - break; - switch (state_18) { - case "break-l6_c": break l6_c; - case "continue-l6_c": continue l6_c; + continue l6_c; } } -var _loop_19 = function () { - var x = 1, y = 1; - (function () { return x + y; }); +l7_c: do { + const x = 1, y = 1; (function () { return x + y; }); + (() => x + y); if (x == 1) { - return "break"; + break; } if (x == 1) { - return "break-l7_c"; + break l7_c; } if (x == 2) { - return "continue"; + continue; } if (x == 2) { - return "continue-l7_c"; - } -}; -l7_c: do { - var state_19 = _loop_19(); - if (state_19 === "break") - break; - switch (state_19) { - case "break-l7_c": break l7_c; - case "continue-l7_c": continue l7_c; + continue l7_c; } } while (1 === 1); -var _loop_20 = function (y) { - var x = 1; - (function () { return x + y; }); +l8_c: for (const y = 0; y < 1;) { + const x = 1; (function () { return x + y; }); + (() => x + y); if (x == 1) { - return "break"; + break; } if (x == 1) { - return "break-l8_c"; + break l8_c; } if (x == 2) { - return "continue"; + continue; } if (x == 2) { - return "continue-l8_c"; - } -}; -l8_c: for (var y = 0; y < 1;) { - var state_20 = _loop_20(y); - if (state_20 === "break") - break; - switch (state_20) { - case "break-l8_c": break l8_c; - case "continue-l8_c": continue l8_c; + continue l8_c; } } diff --git a/tests/baselines/reference/capturedLetConstInLoop8.js b/tests/baselines/reference/capturedLetConstInLoop8.js index 147fe3447eb2a..5e7576d838256 100644 --- a/tests/baselines/reference/capturedLetConstInLoop8.js +++ b/tests/baselines/reference/capturedLetConstInLoop8.js @@ -130,169 +130,117 @@ function foo_c() { //// [capturedLetConstInLoop8.js] function foo() { - l0: for (var z = 0; z < 1; ++z) { - var _loop_1 = function (x) { - var _loop_2 = function (y) { - (function () { return x + y; }); + l0: for (let z = 0; z < 1; ++z) { + l1: for (let x = 0; x < 1; ++x) { + ll1: for (let y = 0; y < 1; ++y) { (function () { return x + y; }); + (() => x + y); if (y == 1) { - return "break"; + break; } if (y == 1) { - return "break-l1"; + break l1; } if (y == 1) { - return "break-ll1"; + break ll1; } if (y == 1) { - return "continue-l0"; + continue l0; } if (x == 2) { - return "continue"; + continue; } if (x == 2) { - return "continue-l1"; + continue l1; } if (x == 2) { - return "continue-ll1"; + continue ll1; } if (x == 2) { - return { value: "123" }; + return "123"; } if (x == 3) { - return { value: void 0 }; - } - }; - ll1: for (var y = 0; y < 1; ++y) { - var state_2 = _loop_2(y); - if (typeof state_2 === "object") - return state_2; - if (state_2 === "break") - break; - switch (state_2) { - case "break-l1": return state_2; - case "break-ll1": break ll1; - case "continue-l0": return state_2; - case "continue-l1": return state_2; - case "continue-ll1": continue ll1; + return; } } if (x == 1) { - return "break"; + break; } if (x == 1) { - return "break-l1"; + break l1; } if (x == 2) { - return "continue"; + continue; } if (x == 2) { - return "continue-l1"; + continue l1; } if (x == 2) { - return "continue-l0"; + continue l0; } if (x == 2) { - return { value: "456" }; + return "456"; } if (x == 3) { - return { value: void 0 }; - } - }; - l1: for (var x = 0; x < 1; ++x) { - var state_1 = _loop_1(x); - if (typeof state_1 === "object") - return state_1.value; - if (state_1 === "break") - break; - switch (state_1) { - case "break-l1": break l1; - case "continue-l0": continue l0; - case "continue-l1": continue l1; + return; } } } } function foo_c() { - l0: for (var z = 0; z < 1;) { - var _loop_3 = function (x) { - var _loop_4 = function (y) { - (function () { return x + y; }); + l0: for (const z = 0; z < 1;) { + l1: for (const x = 0; x < 1;) { + ll1: for (const y = 0; y < 1;) { (function () { return x + y; }); + (() => x + y); if (y == 1) { - return "break"; + break; } if (y == 1) { - return "break-l1"; + break l1; } if (y == 1) { - return "break-ll1"; + break ll1; } if (y == 1) { - return "continue-l0"; + continue l0; } if (x == 2) { - return "continue"; + continue; } if (x == 2) { - return "continue-l1"; + continue l1; } if (x == 2) { - return "continue-ll1"; + continue ll1; } if (x == 2) { - return { value: "123" }; + return "123"; } if (x == 3) { - return { value: void 0 }; - } - }; - ll1: for (var y = 0; y < 1;) { - var state_4 = _loop_4(y); - if (typeof state_4 === "object") - return state_4; - if (state_4 === "break") - break; - switch (state_4) { - case "break-l1": return state_4; - case "break-ll1": break ll1; - case "continue-l0": return state_4; - case "continue-l1": return state_4; - case "continue-ll1": continue ll1; + return; } } if (x == 1) { - return "break"; + break; } if (x == 1) { - return "break-l1"; + break l1; } if (x == 2) { - return "continue"; + continue; } if (x == 2) { - return "continue-l1"; + continue l1; } if (x == 2) { - return "continue-l0"; + continue l0; } if (x == 2) { - return { value: "456" }; + return "456"; } if (x == 3) { - return { value: void 0 }; - } - }; - l1: for (var x = 0; x < 1;) { - var state_3 = _loop_3(x); - if (typeof state_3 === "object") - return state_3.value; - if (state_3 === "break") - break; - switch (state_3) { - case "break-l1": break l1; - case "continue-l0": continue l0; - case "continue-l1": continue l1; + return; } } } diff --git a/tests/baselines/reference/capturedLetConstInLoop9.js b/tests/baselines/reference/capturedLetConstInLoop9.js index be7d4bb85e6d8..2e33b22271438 100644 --- a/tests/baselines/reference/capturedLetConstInLoop9.js +++ b/tests/baselines/reference/capturedLetConstInLoop9.js @@ -141,102 +141,67 @@ function foo3 () { } //// [capturedLetConstInLoop9.js] -var _loop_1 = function (x) { - var x_1; - (function () { return x_1; }); +for (let x = 0; x < 1; ++x) { + let x; + (function () { return x; }); { - var x_2; - (function () { return x_2; }); + let x; + (function () { return x; }); } try { } catch (e) { - var x_3; - (function () { return x_3; }); + let x; + (function () { return x; }); } - switch (x_1) { + switch (x) { case 1: - var x_4; - (function () { return x_4; }); + let x; + (function () { return x; }); break; } - var _loop_2 = function () { - var x_5; - (function () { return x_5; }); - }; while (1 == 1) { - _loop_2(); + let x; + (function () { return x; }); } - var A = /** @class */ (function () { - function A() { + class A { + m() { + return x + 1; } - A.prototype.m = function () { - return x_1 + 1; - }; - return A; - }()); -}; -for (var x = 0; x < 1; ++x) { - _loop_1(x); + } } function foo() { - var _loop_3 = function (a) { - var _b; + l0: for (let a of []) { if (a === 1) { - return "break"; + break; } if (a === 2) { - return "break-l0"; + break l0; } - for (var _c = 0, _d = []; _c < _d.length; _c++) { - var b = _d[_c]; - _b = [{ x: 1, y: 2 }][0], x = _b.x, z = _b.y; + for (let b of []) { + var [{ x, y: z }] = [{ x: 1, y: 2 }]; if (b === 1) { break; } if (b === 2) { - return "break-l0"; + break l0; } l1: if (b === 3) { break l1; } - return { value: 50 }; + return 50; } - var _loop_4 = function (b) { - var _g; - _g = [{ x1: 1, y: arguments_1.length }][0], x1 = _g.x1, z1 = _g.y; + for (let b of []) { + var [{ x1, y: z1 }] = [{ x1: 1, y: arguments.length }]; if (b === 1) { - return "break"; + break; } if (b === 2) { - return "break-l0"; - } - (function () { return b; }); - return { value: 100 }; - }; - for (var _e = 0, _f = []; _e < _f.length; _e++) { - var b = _f[_e]; - var state_2 = _loop_4(b); - if (typeof state_2 === "object") - return state_2; - if (state_2 === "break") - break; - switch (state_2) { - case "break-l0": return state_2; + break l0; } + () => b; + return 100; } - (function () { return a; }); - }; - var arguments_1 = arguments, x, z, x1, z1; - l0: for (var _i = 0, _a = []; _i < _a.length; _i++) { - var a = _a[_i]; - var state_1 = _loop_3(a); - if (typeof state_1 === "object") - return state_1.value; - if (state_1 === "break") - break; - switch (state_1) { - case "break-l0": break l0; - } + () => a; } use(x); use(z); @@ -244,8 +209,7 @@ function foo() { use(z1); } function foo2() { - for (var _i = 0, _a = []; _i < _a.length; _i++) { - var x = _a[_i]; + for (let x of []) { if (x === 1) { break; } @@ -264,8 +228,7 @@ function foo2() { case 1: break; case 2: continue; } - for (var _b = 0, _c = []; _b < _c.length; _b++) { - var y = _c[_b]; + for (let y of []) { switch (y) { case 1: break; case 2: continue; @@ -273,30 +236,20 @@ function foo2() { } } } -var C = /** @class */ (function () { - function C(N) { +class C { + constructor(N) { this.N = N; } - C.prototype.foo = function () { - var _this = this; - var _loop_5 = function (i) { - var f = function () { return _this.N * i; }; - }; - for (var i = 0; i < 100; i++) { - _loop_5(i); + foo() { + for (let i = 0; i < 100; i++) { + let f = () => this.N * i; } - }; - return C; -}()); + } +} function foo3() { - var x = arguments.length; - var _loop_6 = function (y) { - var z = arguments_2.length; + let x = arguments.length; + for (let y of []) { + let z = arguments.length; (function () { return y + z + arguments.length; }); - }; - var arguments_2 = arguments; - for (var _i = 0, _a = []; _i < _a.length; _i++) { - var y = _a[_i]; - _loop_6(y); } } diff --git a/tests/baselines/reference/capturedParametersInInitializers2.errors.txt b/tests/baselines/reference/capturedParametersInInitializers2(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/capturedParametersInInitializers2.errors.txt rename to tests/baselines/reference/capturedParametersInInitializers2(target=es2015).errors.txt diff --git a/tests/baselines/reference/capturedParametersInInitializers2(target=es2015).js b/tests/baselines/reference/capturedParametersInInitializers2(target=es2015).js new file mode 100644 index 0000000000000..ae2a81645d949 --- /dev/null +++ b/tests/baselines/reference/capturedParametersInInitializers2(target=es2015).js @@ -0,0 +1,48 @@ +//// [tests/cases/compiler/capturedParametersInInitializers2.ts] //// + +//// [capturedParametersInInitializers2.ts] +function foo( + y = class { + static c = x; + get [x]() {return x;} + constructor() { x; } + [z]() { return z; } + }, + x = 1, + z = 2 +) { + y.c +} +function foo2(y = class {[x] = x}, x = 1) { +} + +//// [capturedParametersInInitializers2.js] +var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); +}; +function foo(y, x, z) { + var _a; + if (y === void 0) { y = (_a = class { + get [x]() { return x; } + constructor() { x; } + [z]() { return z; } + }, + __setFunctionName(_a, "y"), + _a.c = x, + _a); } + if (x === void 0) { x = 1; } + if (z === void 0) { z = 2; } + y.c; +} +function foo2(y, x) { + var _a, _b; + if (y === void 0) { y = (_b = class { + constructor() { + this[_a] = x; + } + }, + _a = x, + _b); } + if (x === void 0) { x = 1; } +} diff --git a/tests/baselines/reference/capturedParametersInInitializers2.symbols b/tests/baselines/reference/capturedParametersInInitializers2(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/capturedParametersInInitializers2.symbols rename to tests/baselines/reference/capturedParametersInInitializers2(target=es2015).symbols diff --git a/tests/baselines/reference/capturedParametersInInitializers2.types b/tests/baselines/reference/capturedParametersInInitializers2(target=es2015).types similarity index 100% rename from tests/baselines/reference/capturedParametersInInitializers2.types rename to tests/baselines/reference/capturedParametersInInitializers2(target=es2015).types diff --git a/tests/baselines/reference/capturedParametersInInitializers2(target=es5).errors.txt b/tests/baselines/reference/capturedParametersInInitializers2(target=es5).errors.txt new file mode 100644 index 0000000000000..0576ba7b95af3 --- /dev/null +++ b/tests/baselines/reference/capturedParametersInInitializers2(target=es5).errors.txt @@ -0,0 +1,29 @@ +capturedParametersInInitializers2.ts(3,20): error TS2373: Parameter 'y' cannot reference identifier 'x' declared after it. +capturedParametersInInitializers2.ts(4,14): error TS2373: Parameter 'y' cannot reference identifier 'x' declared after it. +capturedParametersInInitializers2.ts(6,10): error TS2373: Parameter 'y' cannot reference identifier 'z' declared after it. +capturedParametersInInitializers2.ts(13,27): error TS2373: Parameter 'y' cannot reference identifier 'x' declared after it. + + +==== capturedParametersInInitializers2.ts (4 errors) ==== + function foo( + y = class { + static c = x; + ~ +!!! error TS2373: Parameter 'y' cannot reference identifier 'x' declared after it. + get [x]() {return x;} + ~ +!!! error TS2373: Parameter 'y' cannot reference identifier 'x' declared after it. + constructor() { x; } + [z]() { return z; } + ~ +!!! error TS2373: Parameter 'y' cannot reference identifier 'z' declared after it. + }, + x = 1, + z = 2 + ) { + y.c + } + function foo2(y = class {[x] = x}, x = 1) { + ~ +!!! error TS2373: Parameter 'y' cannot reference identifier 'x' declared after it. + } \ No newline at end of file diff --git a/tests/baselines/reference/capturedParametersInInitializers2.js b/tests/baselines/reference/capturedParametersInInitializers2(target=es5).js similarity index 100% rename from tests/baselines/reference/capturedParametersInInitializers2.js rename to tests/baselines/reference/capturedParametersInInitializers2(target=es5).js diff --git a/tests/baselines/reference/capturedParametersInInitializers2(target=es5).symbols b/tests/baselines/reference/capturedParametersInInitializers2(target=es5).symbols new file mode 100644 index 0000000000000..e89b7cbbd793a --- /dev/null +++ b/tests/baselines/reference/capturedParametersInInitializers2(target=es5).symbols @@ -0,0 +1,47 @@ +//// [tests/cases/compiler/capturedParametersInInitializers2.ts] //// + +=== capturedParametersInInitializers2.ts === +function foo( +>foo : Symbol(foo, Decl(capturedParametersInInitializers2.ts, 0, 0)) + + y = class { +>y : Symbol(y, Decl(capturedParametersInInitializers2.ts, 0, 13)) + + static c = x; +>c : Symbol((Anonymous class).c, Decl(capturedParametersInInitializers2.ts, 1, 15)) +>x : Symbol(x, Decl(capturedParametersInInitializers2.ts, 6, 6)) + + get [x]() {return x;} +>[x] : Symbol((Anonymous class)[x], Decl(capturedParametersInInitializers2.ts, 2, 21)) +>x : Symbol(x, Decl(capturedParametersInInitializers2.ts, 6, 6)) +>x : Symbol(x, Decl(capturedParametersInInitializers2.ts, 6, 6)) + + constructor() { x; } +>x : Symbol(x, Decl(capturedParametersInInitializers2.ts, 6, 6)) + + [z]() { return z; } +>[z] : Symbol((Anonymous class)[z], Decl(capturedParametersInInitializers2.ts, 4, 28)) +>z : Symbol(z, Decl(capturedParametersInInitializers2.ts, 7, 10)) +>z : Symbol(z, Decl(capturedParametersInInitializers2.ts, 7, 10)) + + }, + x = 1, +>x : Symbol(x, Decl(capturedParametersInInitializers2.ts, 6, 6)) + + z = 2 +>z : Symbol(z, Decl(capturedParametersInInitializers2.ts, 7, 10)) + +) { + y.c +>y.c : Symbol((Anonymous class).c, Decl(capturedParametersInInitializers2.ts, 1, 15)) +>y : Symbol(y, Decl(capturedParametersInInitializers2.ts, 0, 13)) +>c : Symbol((Anonymous class).c, Decl(capturedParametersInInitializers2.ts, 1, 15)) +} +function foo2(y = class {[x] = x}, x = 1) { +>foo2 : Symbol(foo2, Decl(capturedParametersInInitializers2.ts, 11, 1)) +>y : Symbol(y, Decl(capturedParametersInInitializers2.ts, 12, 14)) +>[x] : Symbol((Anonymous class)[x], Decl(capturedParametersInInitializers2.ts, 12, 25)) +>x : Symbol(x, Decl(capturedParametersInInitializers2.ts, 12, 34)) +>x : Symbol(x, Decl(capturedParametersInInitializers2.ts, 12, 34)) +>x : Symbol(x, Decl(capturedParametersInInitializers2.ts, 12, 34)) +} diff --git a/tests/baselines/reference/capturedParametersInInitializers2(target=es5).types b/tests/baselines/reference/capturedParametersInInitializers2(target=es5).types new file mode 100644 index 0000000000000..200b36a739e25 --- /dev/null +++ b/tests/baselines/reference/capturedParametersInInitializers2(target=es5).types @@ -0,0 +1,79 @@ +//// [tests/cases/compiler/capturedParametersInInitializers2.ts] //// + +=== capturedParametersInInitializers2.ts === +function foo( +>foo : (y?: typeof (Anonymous class), x?: number, z?: number) => void +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ + + y = class { +>y : typeof (Anonymous class) +> : ^^^^^^^^^^^^^^^^^^^^^^^^ +>class { static c = x; get [x]() {return x;} constructor() { x; } [z]() { return z; } } : typeof (Anonymous class) +> : ^^^^^^^^^^^^^^^^^^^^^^^^ + + static c = x; +>c : number +> : ^^^^^^ +>x : number +> : ^^^^^^ + + get [x]() {return x;} +>[x] : number +> : ^^^^^^ +>x : number +> : ^^^^^^ +>x : number +> : ^^^^^^ + + constructor() { x; } +>x : number +> : ^^^^^^ + + [z]() { return z; } +>[z] : () => number +> : ^^^^^^^^^^^^ +>z : number +> : ^^^^^^ +>z : number +> : ^^^^^^ + + }, + x = 1, +>x : number +> : ^^^^^^ +>1 : 1 +> : ^ + + z = 2 +>z : number +> : ^^^^^^ +>2 : 2 +> : ^ + +) { + y.c +>y.c : number +> : ^^^^^^ +>y : typeof (Anonymous class) +> : ^^^^^^^^^^^^^^^^^^^^^^^^ +>c : number +> : ^^^^^^ +} +function foo2(y = class {[x] = x}, x = 1) { +>foo2 : (y?: typeof (Anonymous class), x?: number) => void +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ +>y : typeof (Anonymous class) +> : ^^^^^^^^^^^^^^^^^^^^^^^^ +>class {[x] = x} : typeof (Anonymous class) +> : ^^^^^^^^^^^^^^^^^^^^^^^^ +>[x] : number +> : ^^^^^^ +>x : number +> : ^^^^^^ +>x : number +> : ^^^^^^ +>x : number +> : ^^^^^^ +>1 : 1 +> : ^ +} diff --git a/tests/baselines/reference/capturedShorthandPropertyAssignmentNoCheck(target=es2015).js b/tests/baselines/reference/capturedShorthandPropertyAssignmentNoCheck(target=es2015).js new file mode 100644 index 0000000000000..d33ec6a3eb0e3 --- /dev/null +++ b/tests/baselines/reference/capturedShorthandPropertyAssignmentNoCheck(target=es2015).js @@ -0,0 +1,18 @@ +//// [tests/cases/compiler/capturedShorthandPropertyAssignmentNoCheck.ts] //// + +//// [capturedShorthandPropertyAssignmentNoCheck.ts] +const fns = []; +for (const value of [1, 2, 3]) { + fns.push(() => ({ value })); +} +const result = fns.map(fn => fn()); +console.log(result) + + +//// [capturedShorthandPropertyAssignmentNoCheck.js] +const fns = []; +for (const value of [1, 2, 3]) { + fns.push(() => ({ value })); +} +const result = fns.map(fn => fn()); +console.log(result); diff --git a/tests/baselines/reference/capturedShorthandPropertyAssignmentNoCheck.symbols b/tests/baselines/reference/capturedShorthandPropertyAssignmentNoCheck(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/capturedShorthandPropertyAssignmentNoCheck.symbols rename to tests/baselines/reference/capturedShorthandPropertyAssignmentNoCheck(target=es2015).symbols diff --git a/tests/baselines/reference/capturedShorthandPropertyAssignmentNoCheck.types b/tests/baselines/reference/capturedShorthandPropertyAssignmentNoCheck(target=es2015).types similarity index 100% rename from tests/baselines/reference/capturedShorthandPropertyAssignmentNoCheck.types rename to tests/baselines/reference/capturedShorthandPropertyAssignmentNoCheck(target=es2015).types diff --git a/tests/baselines/reference/capturedShorthandPropertyAssignmentNoCheck.js b/tests/baselines/reference/capturedShorthandPropertyAssignmentNoCheck(target=es5).js similarity index 100% rename from tests/baselines/reference/capturedShorthandPropertyAssignmentNoCheck.js rename to tests/baselines/reference/capturedShorthandPropertyAssignmentNoCheck(target=es5).js diff --git a/tests/baselines/reference/capturedShorthandPropertyAssignmentNoCheck(target=es5).symbols b/tests/baselines/reference/capturedShorthandPropertyAssignmentNoCheck(target=es5).symbols new file mode 100644 index 0000000000000..0955090e6712f --- /dev/null +++ b/tests/baselines/reference/capturedShorthandPropertyAssignmentNoCheck(target=es5).symbols @@ -0,0 +1,29 @@ +//// [tests/cases/compiler/capturedShorthandPropertyAssignmentNoCheck.ts] //// + +=== capturedShorthandPropertyAssignmentNoCheck.ts === +const fns = []; +>fns : Symbol(fns, Decl(capturedShorthandPropertyAssignmentNoCheck.ts, 0, 5)) + +for (const value of [1, 2, 3]) { +>value : Symbol(value, Decl(capturedShorthandPropertyAssignmentNoCheck.ts, 1, 10)) + + fns.push(() => ({ value })); +>fns.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) +>fns : Symbol(fns, Decl(capturedShorthandPropertyAssignmentNoCheck.ts, 0, 5)) +>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) +>value : Symbol(value, Decl(capturedShorthandPropertyAssignmentNoCheck.ts, 2, 21)) +} +const result = fns.map(fn => fn()); +>result : Symbol(result, Decl(capturedShorthandPropertyAssignmentNoCheck.ts, 4, 5)) +>fns.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>fns : Symbol(fns, Decl(capturedShorthandPropertyAssignmentNoCheck.ts, 0, 5)) +>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>fn : Symbol(fn, Decl(capturedShorthandPropertyAssignmentNoCheck.ts, 4, 23)) +>fn : Symbol(fn, Decl(capturedShorthandPropertyAssignmentNoCheck.ts, 4, 23)) + +console.log(result) +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>result : Symbol(result, Decl(capturedShorthandPropertyAssignmentNoCheck.ts, 4, 5)) + diff --git a/tests/baselines/reference/capturedShorthandPropertyAssignmentNoCheck(target=es5).types b/tests/baselines/reference/capturedShorthandPropertyAssignmentNoCheck(target=es5).types new file mode 100644 index 0000000000000..ff153e104aa65 --- /dev/null +++ b/tests/baselines/reference/capturedShorthandPropertyAssignmentNoCheck(target=es5).types @@ -0,0 +1,68 @@ +//// [tests/cases/compiler/capturedShorthandPropertyAssignmentNoCheck.ts] //// + +=== capturedShorthandPropertyAssignmentNoCheck.ts === +const fns = []; +>fns : any[] +> : ^^^^^ +>[] : undefined[] +> : ^^^^^^^^^^^ + +for (const value of [1, 2, 3]) { +>value : number +> : ^^^^^^ +>[1, 2, 3] : number[] +> : ^^^^^^^^ +>1 : 1 +> : ^ +>2 : 2 +> : ^ +>3 : 3 +> : ^ + + fns.push(() => ({ value })); +>fns.push(() => ({ value })) : number +> : ^^^^^^ +>fns.push : (...items: any[]) => number +> : ^^^^ ^^^^^^^^^^^^ +>fns : any[] +> : ^^^^^ +>push : (...items: any[]) => number +> : ^^^^ ^^^^^^^^^^^^ +>() => ({ value }) : () => { value: number; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^ +>({ value }) : { value: number; } +> : ^^^^^^^^^^^^^^^^^^ +>{ value } : { value: number; } +> : ^^^^^^^^^^^^^^^^^^ +>value : number +> : ^^^^^^ +} +const result = fns.map(fn => fn()); +>result : any[] +> : ^^^^^ +>fns.map(fn => fn()) : any[] +> : ^^^^^ +>fns.map : (callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[] +> : ^ ^^ ^^^ ^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ +>fns : any[] +> : ^^^^^ +>map : (callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[] +> : ^ ^^ ^^^ ^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ +>fn => fn() : (fn: any) => any +> : ^ ^^^^^^^^^^^^^ +>fn : any +>fn() : any +>fn : any + +console.log(result) +>console.log(result) : void +> : ^^^^ +>console.log : (...data: any[]) => void +> : ^^^^ ^^ ^^^^^ +>console : Console +> : ^^^^^^^ +>log : (...data: any[]) => void +> : ^^^^ ^^ ^^^^^ +>result : any[] +> : ^^^^^ + diff --git a/tests/baselines/reference/capturedVarInLoop(target=es2015).js b/tests/baselines/reference/capturedVarInLoop(target=es2015).js new file mode 100644 index 0000000000000..bfa6a576a7252 --- /dev/null +++ b/tests/baselines/reference/capturedVarInLoop(target=es2015).js @@ -0,0 +1,15 @@ +//// [tests/cases/compiler/capturedVarInLoop.ts] //// + +//// [capturedVarInLoop.ts] +for (var i = 0; i < 10; i++) { + var str = 'x', len = str.length; + let lambda1 = (y) => { }; + let lambda2 = () => lambda1(len); +} + +//// [capturedVarInLoop.js] +for (var i = 0; i < 10; i++) { + var str = 'x', len = str.length; + let lambda1 = (y) => { }; + let lambda2 = () => lambda1(len); +} diff --git a/tests/baselines/reference/capturedVarInLoop.symbols b/tests/baselines/reference/capturedVarInLoop(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/capturedVarInLoop.symbols rename to tests/baselines/reference/capturedVarInLoop(target=es2015).symbols diff --git a/tests/baselines/reference/capturedVarInLoop.types b/tests/baselines/reference/capturedVarInLoop(target=es2015).types similarity index 100% rename from tests/baselines/reference/capturedVarInLoop.types rename to tests/baselines/reference/capturedVarInLoop(target=es2015).types diff --git a/tests/baselines/reference/capturedVarInLoop.js b/tests/baselines/reference/capturedVarInLoop(target=es5).js similarity index 100% rename from tests/baselines/reference/capturedVarInLoop.js rename to tests/baselines/reference/capturedVarInLoop(target=es5).js diff --git a/tests/baselines/reference/capturedVarInLoop(target=es5).symbols b/tests/baselines/reference/capturedVarInLoop(target=es5).symbols new file mode 100644 index 0000000000000..9f60a638ae8b8 --- /dev/null +++ b/tests/baselines/reference/capturedVarInLoop(target=es5).symbols @@ -0,0 +1,24 @@ +//// [tests/cases/compiler/capturedVarInLoop.ts] //// + +=== capturedVarInLoop.ts === +for (var i = 0; i < 10; i++) { +>i : Symbol(i, Decl(capturedVarInLoop.ts, 0, 8)) +>i : Symbol(i, Decl(capturedVarInLoop.ts, 0, 8)) +>i : Symbol(i, Decl(capturedVarInLoop.ts, 0, 8)) + + var str = 'x', len = str.length; +>str : Symbol(str, Decl(capturedVarInLoop.ts, 1, 7)) +>len : Symbol(len, Decl(capturedVarInLoop.ts, 1, 18)) +>str.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) +>str : Symbol(str, Decl(capturedVarInLoop.ts, 1, 7)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) + + let lambda1 = (y) => { }; +>lambda1 : Symbol(lambda1, Decl(capturedVarInLoop.ts, 2, 7)) +>y : Symbol(y, Decl(capturedVarInLoop.ts, 2, 19)) + + let lambda2 = () => lambda1(len); +>lambda2 : Symbol(lambda2, Decl(capturedVarInLoop.ts, 3, 7)) +>lambda1 : Symbol(lambda1, Decl(capturedVarInLoop.ts, 2, 7)) +>len : Symbol(len, Decl(capturedVarInLoop.ts, 1, 18)) +} diff --git a/tests/baselines/reference/capturedVarInLoop(target=es5).types b/tests/baselines/reference/capturedVarInLoop(target=es5).types new file mode 100644 index 0000000000000..5a19b847e7921 --- /dev/null +++ b/tests/baselines/reference/capturedVarInLoop(target=es5).types @@ -0,0 +1,52 @@ +//// [tests/cases/compiler/capturedVarInLoop.ts] //// + +=== capturedVarInLoop.ts === +for (var i = 0; i < 10; i++) { +>i : number +> : ^^^^^^ +>0 : 0 +> : ^ +>i < 10 : boolean +> : ^^^^^^^ +>i : number +> : ^^^^^^ +>10 : 10 +> : ^^ +>i++ : number +> : ^^^^^^ +>i : number +> : ^^^^^^ + + var str = 'x', len = str.length; +>str : string +> : ^^^^^^ +>'x' : "x" +> : ^^^ +>len : number +> : ^^^^^^ +>str.length : number +> : ^^^^^^ +>str : string +> : ^^^^^^ +>length : number +> : ^^^^^^ + + let lambda1 = (y) => { }; +>lambda1 : (y: any) => void +> : ^ ^^^^^^^^^^^^^^ +>(y) => { } : (y: any) => void +> : ^ ^^^^^^^^^^^^^^ +>y : any + + let lambda2 = () => lambda1(len); +>lambda2 : () => void +> : ^^^^^^^^^^ +>() => lambda1(len) : () => void +> : ^^^^^^^^^^ +>lambda1(len) : void +> : ^^^^ +>lambda1 : (y: any) => void +> : ^ ^^^^^^^^^^^^^^ +>len : number +> : ^^^^^^ +} diff --git a/tests/baselines/reference/caseInsensitiveFileSystemWithCapsImportTypeDeclarations.js b/tests/baselines/reference/caseInsensitiveFileSystemWithCapsImportTypeDeclarations.js index 811c418a15105..3b726939b49fb 100644 --- a/tests/baselines/reference/caseInsensitiveFileSystemWithCapsImportTypeDeclarations.js +++ b/tests/baselines/reference/caseInsensitiveFileSystemWithCapsImportTypeDeclarations.js @@ -36,14 +36,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Broken = void 0; -var Broken = /** @class */ (function () { - function Broken() { - } - Broken.prototype.method = function () { +class Broken { + method() { return {}; - }; - return Broken; -}()); + } +} exports.Broken = Broken; diff --git a/tests/baselines/reference/castExpressionParentheses.js b/tests/baselines/reference/castExpressionParentheses.js index 8d2f0a15ddf98..f547a2ec92424 100644 --- a/tests/baselines/reference/castExpressionParentheses.js +++ b/tests/baselines/reference/castExpressionParentheses.js @@ -87,7 +87,7 @@ a().x; (typeof A).x; (-A).x; new (A()); -(function () { })(); +(() => { })(); (function foo() { })(); (-A).x; // nested cast, should keep one pair of parenthese diff --git a/tests/baselines/reference/castOfYield.js b/tests/baselines/reference/castOfYield.js index 94de9e5dddfdd..fa808f1570a4e 100644 --- a/tests/baselines/reference/castOfYield.js +++ b/tests/baselines/reference/castOfYield.js @@ -9,45 +9,9 @@ function* f() { //// [castOfYield.js] -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); - return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (g && (g = 0, op[0] && (_ = 0)), _) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -function f() { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, 0]; - case 1: - (_a.sent()); - // Unlike await, yield is not allowed to appear in a simple unary expression. - ; - return [4 /*yield*/, 0]; - case 2: - _a.sent(); - return [2 /*return*/]; - } - }); +function* f() { + (yield 0); + // Unlike await, yield is not allowed to appear in a simple unary expression. + ; + yield 0; } diff --git a/tests/baselines/reference/castParentheses.js b/tests/baselines/reference/castParentheses.js index a00bfbb65f62e..f0f44ba04a252 100644 --- a/tests/baselines/reference/castParentheses.js +++ b/tests/baselines/reference/castParentheses.js @@ -14,11 +14,8 @@ var b = (new a.b); var b = (new a).b //// [castParentheses.js] -var a = /** @class */ (function () { - function a() { - } - return a; -}()); +class a { +} var b = a; var b = a.b; var b = a.b.c; diff --git a/tests/baselines/reference/castingTuple.js b/tests/baselines/reference/castingTuple.js index 247bfff81bfdd..11b1a369deac5 100644 --- a/tests/baselines/reference/castingTuple.js +++ b/tests/baselines/reference/castingTuple.js @@ -37,54 +37,22 @@ t4[2] = 10; //// [castingTuple.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var A = /** @class */ (function () { - function A() { +class A { + constructor() { this.a = 10; } - return A; -}()); -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +} +class C { +} ; -var D = /** @class */ (function () { - function D() { - } - return D; -}()); +class D { +} ; -var E = /** @class */ (function (_super) { - __extends(E, _super); - function E() { - return _super !== null && _super.apply(this, arguments) || this; - } - return E; -}(A)); +class E extends A { +} ; -var F = /** @class */ (function (_super) { - __extends(F, _super); - function F() { - return _super !== null && _super.apply(this, arguments) || this; - } - return F; -}(A)); +class F extends A { +} ; var E1; (function (E1) { diff --git a/tests/baselines/reference/catchClauseWithTypeAnnotation.js b/tests/baselines/reference/catchClauseWithTypeAnnotation.js index f93af26df239e..a600f13719561 100644 --- a/tests/baselines/reference/catchClauseWithTypeAnnotation.js +++ b/tests/baselines/reference/catchClauseWithTypeAnnotation.js @@ -98,7 +98,7 @@ function fn(x) { // minor bug: shows that the `catch` argument is skipped when checking scope try { } catch (x) { - var x_1; + let x; } try { } catch (x) { @@ -109,35 +109,25 @@ function fn(x) { var x; } try { } - catch (_a) { - var x_2 = _a.x; - } // should be OK + catch ({ x }) { } // should be OK try { } - catch (_b) { - var x_3 = _b.x; - x_3.foo; + catch ({ x }) { + x.foo; } // should be OK try { } - catch (_c) { - var x_4 = _c.x; - x_4.foo; + catch ({ x }) { + x.foo; } // should be OK try { } - catch (_d) { - var x_5 = _d.x; - console.log(x_5); + catch ({ x }) { + console.log(x); } // error in the destructure try { } - catch (_e) { - var x_6 = _e.x; - console.log(x_6); + catch ({ x }) { + console.log(x); } // error in the destructure try { } - catch (_f) { - var x_7 = _f.x; - } // error in the type + catch ({ x }) { } // error in the type try { } - catch (_g) { - var x_8 = _g.x; - } // error in the type + catch ({ x }) { } // error in the type } diff --git a/tests/baselines/reference/chained.js b/tests/baselines/reference/chained.js index d9aca8740213d..adba5b3197fdc 100644 --- a/tests/baselines/reference/chained.js +++ b/tests/baselines/reference/chained.js @@ -22,11 +22,8 @@ const d: D = {}; //// [a.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var A = /** @class */ (function () { - function A() { - } - return A; -}()); +class A { +} //// [b.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -37,4 +34,4 @@ Object.defineProperty(exports, "__esModule", { value: true }); "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); new D(); -var d = {}; +const d = {}; diff --git a/tests/baselines/reference/chained2.js b/tests/baselines/reference/chained2.js index 9398f6c6840ff..29273919d1339 100644 --- a/tests/baselines/reference/chained2.js +++ b/tests/baselines/reference/chained2.js @@ -24,11 +24,8 @@ const b: types.B = {}; //// [a.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var A = /** @class */ (function () { - function A() { - } - return A; -}()); +class A { +} //// [b.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -69,7 +66,7 @@ var __importStar = (this && this.__importStar) || (function () { })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; -var types = __importStar(require("./b")); +const types = __importStar(require("./b")); exports.default = types; //// [d.js] "use strict"; @@ -77,8 +74,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -var c_1 = __importDefault(require("./c")); +const c_1 = __importDefault(require("./c")); new c_1.default.A(); new c_1.default.B(); -var a = {}; -var b = {}; +const a = {}; +const b = {}; diff --git a/tests/baselines/reference/chainedAssignment1.js b/tests/baselines/reference/chainedAssignment1.js index 1b45fda503a94..c89e3356f8f6c 100644 --- a/tests/baselines/reference/chainedAssignment1.js +++ b/tests/baselines/reference/chainedAssignment1.js @@ -25,23 +25,18 @@ c1 = c2 = c3; // a bug made this not report the same error as below c2 = c3; // Error TS111: Cannot convert Z to Y //// [chainedAssignment1.js] -var X = /** @class */ (function () { - function X(z) { +class X { + constructor(z) { this.z = z; } - return X; -}()); -var Y = /** @class */ (function () { - function Y(z) { +} +class Y { + constructor(z) { this.z = z; } - return Y; -}()); -var Z = /** @class */ (function () { - function Z() { - } - return Z; -}()); +} +class Z { +} var c1 = new X(3); var c2 = new Y(5); var c3 = new Z(); diff --git a/tests/baselines/reference/chainedAssignment3.js b/tests/baselines/reference/chainedAssignment3.js index d08a5426f492f..43e5729f5622f 100644 --- a/tests/baselines/reference/chainedAssignment3.js +++ b/tests/baselines/reference/chainedAssignment3.js @@ -25,33 +25,10 @@ a = b = new A(); //// [chainedAssignment3.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var A = /** @class */ (function () { - function A() { - } - return A; -}()); -var B = /** @class */ (function (_super) { - __extends(B, _super); - function B() { - return _super !== null && _super.apply(this, arguments) || this; - } - return B; -}(A)); +class A { +} +class B extends A { +} var a; var b; a = b = null; diff --git a/tests/baselines/reference/chainedAssignmentChecking.js b/tests/baselines/reference/chainedAssignmentChecking.js index f5334ad6bcae8..f7dd29154fe25 100644 --- a/tests/baselines/reference/chainedAssignmentChecking.js +++ b/tests/baselines/reference/chainedAssignmentChecking.js @@ -25,23 +25,18 @@ c1 = c2 = c3; // Should be error //// [chainedAssignmentChecking.js] -var X = /** @class */ (function () { - function X(z) { +class X { + constructor(z) { this.z = z; } - return X; -}()); -var Y = /** @class */ (function () { - function Y(z) { +} +class Y { + constructor(z) { this.z = z; } - return Y; -}()); -var Z = /** @class */ (function () { - function Z() { - } - return Z; -}()); +} +class Z { +} var c1 = new X(3); var c2 = new Y(5); var c3 = new Z(); diff --git a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js index 76497857f99a0..b4db0fe8242eb 100644 --- a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js +++ b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js @@ -22,48 +22,19 @@ class C extends B { (new Chain(new A)).then(a => new B).then(b => new C).then(c => new B).then(b => new A); //// [chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var Chain = /** @class */ (function () { - function Chain(value) { +class Chain { + constructor(value) { this.value = value; } - Chain.prototype.then = function (cb) { + then(cb) { return null; - }; - return Chain; -}()); -var A = /** @class */ (function () { - function A() { } - return A; -}()); -var B = /** @class */ (function (_super) { - __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() { - return _super !== null && _super.apply(this, arguments) || this; - } - return C; -}(B)); +} +class A { +} +class B extends A { +} +class C extends B { +} // Ok to go down the chain, but error to try to climb back up -(new Chain(new A)).then(function (a) { return new B; }).then(function (b) { return new C; }).then(function (c) { return new B; }).then(function (b) { return new A; }); +(new Chain(new A)).then(a => new B).then(b => new C).then(c => new B).then(b => new A); diff --git a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.js b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.js index ba4ad714336d8..29c0b9d7bc118 100644 --- a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.js +++ b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.js @@ -44,40 +44,38 @@ class Chain2 { } //// [chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.js] -var Chain = /** @class */ (function () { - function Chain(value) { +class Chain { + constructor(value) { this.value = value; } - Chain.prototype.then = function (cb) { + then(cb) { var t; 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; }); + (new Chain(t)).then(tt => s).then(ss => t); // But error to try to climb up the chain - (new Chain(s)).then(function (ss) { return t; }); + (new Chain(s)).then(ss => 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; }); + (new Chain(t)).then(tt => t).then(tt => t).then(tt => t); + (new Chain(s)).then(ss => s).then(ss => s).then(ss => s); return null; - }; - return Chain; -}()); -var Chain2 = /** @class */ (function () { - function Chain2(value) { + } +} +class Chain2 { + constructor(value) { this.value = value; } - Chain2.prototype.then = function (cb) { + then(cb) { var i; var t; var s; // 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 = ""; + (new Chain2(i)).then(ii => t).then(tt => 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 = ""; - (new Chain2(i)).then(function (ii) { return s; }).then(function (ss) { return s; }).then(function (ss) { return s; }).then(function (ss) { return s; }).value.x = ""; + (new Chain2(i)).then(ii => t).then(tt => t).then(tt => t).then(tt => t).value.x = ""; + (new Chain2(i)).then(ii => s).then(ss => s).then(ss => s).then(ss => s).value.x = ""; return null; - }; - return Chain2; -}()); + } +} diff --git a/tests/baselines/reference/chainedImportAlias.js b/tests/baselines/reference/chainedImportAlias.js index 2183285e8d8e3..10febd782716e 100644 --- a/tests/baselines/reference/chainedImportAlias.js +++ b/tests/baselines/reference/chainedImportAlias.js @@ -23,6 +23,6 @@ var m; //// [chainedImportAlias_file1.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var x = require("./chainedImportAlias_file0"); +const x = require("./chainedImportAlias_file0"); var y = x; y.m.foo(); diff --git a/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.js b/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.js index dda6c2b79b367..91db4982ff52b 100644 --- a/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.js +++ b/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.js @@ -15,5 +15,5 @@ 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 */ }); +var s2 = s.groupBy(s => s.length); +var s3 = s2.each(x => { x.key; /* Type is K, should be number */ }); diff --git a/tests/baselines/reference/checkForObjectTooStrict.errors.txt b/tests/baselines/reference/checkForObjectTooStrict(target=es2015).errors.txt similarity index 100% rename from tests/baselines/reference/checkForObjectTooStrict.errors.txt rename to tests/baselines/reference/checkForObjectTooStrict(target=es2015).errors.txt diff --git a/tests/baselines/reference/checkForObjectTooStrict(target=es2015).js b/tests/baselines/reference/checkForObjectTooStrict(target=es2015).js new file mode 100644 index 0000000000000..a06c49b4ed5f2 --- /dev/null +++ b/tests/baselines/reference/checkForObjectTooStrict(target=es2015).js @@ -0,0 +1,52 @@ +//// [tests/cases/compiler/checkForObjectTooStrict.ts] //// + +//// [checkForObjectTooStrict.ts] +namespace Foo { + + export class Object { + + } + +} + + + +class Bar extends Foo.Object { // should work + + constructor () { + + super(); + + } + +} + + +class Baz extends Object { + + constructor () { // ERROR, as expected + + super(); + + } + +} + + +//// [checkForObjectTooStrict.js] +var Foo; +(function (Foo) { + class Object { + } + Foo.Object = Object; +})(Foo || (Foo = {})); +class Bar extends Foo.Object { + constructor() { + super(); + } +} +class Baz extends Object { + constructor() { + super(); + } +} diff --git a/tests/baselines/reference/checkForObjectTooStrict.symbols b/tests/baselines/reference/checkForObjectTooStrict(target=es2015).symbols similarity index 100% rename from tests/baselines/reference/checkForObjectTooStrict.symbols rename to tests/baselines/reference/checkForObjectTooStrict(target=es2015).symbols diff --git a/tests/baselines/reference/checkForObjectTooStrict.types b/tests/baselines/reference/checkForObjectTooStrict(target=es2015).types similarity index 100% rename from tests/baselines/reference/checkForObjectTooStrict.types rename to tests/baselines/reference/checkForObjectTooStrict(target=es2015).types diff --git a/tests/baselines/reference/checkForObjectTooStrict(target=es5).errors.txt b/tests/baselines/reference/checkForObjectTooStrict(target=es5).errors.txt new file mode 100644 index 0000000000000..f917241422777 --- /dev/null +++ b/tests/baselines/reference/checkForObjectTooStrict(target=es5).errors.txt @@ -0,0 +1,37 @@ +checkForObjectTooStrict.ts(3,18): error TS2725: Class name cannot be 'Object' when targeting ES5 and above with module CommonJS. + + +==== checkForObjectTooStrict.ts (1 errors) ==== + namespace Foo { + + export class Object { + ~~~~~~ +!!! error TS2725: Class name cannot be 'Object' when targeting ES5 and above with module CommonJS. + + } + + } + + + + class Bar extends Foo.Object { // should work + + constructor () { + + super(); + + } + + } + + + class Baz extends Object { + + constructor () { // ERROR, as expected + + super(); + + } + + } + \ No newline at end of file diff --git a/tests/baselines/reference/checkForObjectTooStrict.js b/tests/baselines/reference/checkForObjectTooStrict(target=es5).js similarity index 100% rename from tests/baselines/reference/checkForObjectTooStrict.js rename to tests/baselines/reference/checkForObjectTooStrict(target=es5).js diff --git a/tests/baselines/reference/checkForObjectTooStrict(target=es5).symbols b/tests/baselines/reference/checkForObjectTooStrict(target=es5).symbols new file mode 100644 index 0000000000000..a7b87a2d37a76 --- /dev/null +++ b/tests/baselines/reference/checkForObjectTooStrict(target=es5).symbols @@ -0,0 +1,44 @@ +//// [tests/cases/compiler/checkForObjectTooStrict.ts] //// + +=== checkForObjectTooStrict.ts === +namespace Foo { +>Foo : Symbol(Foo, Decl(checkForObjectTooStrict.ts, 0, 0)) + + export class Object { +>Object : Symbol(Object, Decl(checkForObjectTooStrict.ts, 0, 15)) + + } + +} + + + +class Bar extends Foo.Object { // should work +>Bar : Symbol(Bar, Decl(checkForObjectTooStrict.ts, 6, 1)) +>Foo.Object : Symbol(Foo.Object, Decl(checkForObjectTooStrict.ts, 0, 15)) +>Foo : Symbol(Foo, Decl(checkForObjectTooStrict.ts, 0, 0)) +>Object : Symbol(Foo.Object, Decl(checkForObjectTooStrict.ts, 0, 15)) + + constructor () { + + super(); +>super : Symbol(Foo.Object, Decl(checkForObjectTooStrict.ts, 0, 15)) + + } + +} + + +class Baz extends Object { +>Baz : Symbol(Baz, Decl(checkForObjectTooStrict.ts, 18, 1)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + + constructor () { // ERROR, as expected + + super(); +>super : Symbol(ObjectConstructor, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) + + } + +} + diff --git a/tests/baselines/reference/checkForObjectTooStrict(target=es5).types b/tests/baselines/reference/checkForObjectTooStrict(target=es5).types new file mode 100644 index 0000000000000..e1d103697bb39 --- /dev/null +++ b/tests/baselines/reference/checkForObjectTooStrict(target=es5).types @@ -0,0 +1,58 @@ +//// [tests/cases/compiler/checkForObjectTooStrict.ts] //// + +=== checkForObjectTooStrict.ts === +namespace Foo { +>Foo : typeof Foo +> : ^^^^^^^^^^ + + export class Object { +>Object : Object +> : ^^^^^^ + + } + +} + + + +class Bar extends Foo.Object { // should work +>Bar : Bar +> : ^^^ +>Foo.Object : Foo.Object +> : ^^^^^^^^^^ +>Foo : typeof Foo +> : ^^^^^^^^^^ +>Object : typeof Foo.Object +> : ^^^^^^^^^^^^^^^^^ + + constructor () { + + super(); +>super() : void +> : ^^^^ +>super : typeof Foo.Object +> : ^^^^^^^^^^^^^^^^^ + + } + +} + + +class Baz extends Object { +>Baz : Baz +> : ^^^ +>Object : Object +> : ^^^^^^ + + constructor () { // ERROR, as expected + + super(); +>super() : void +> : ^^^^ +>super : ObjectConstructor +> : ^^^^^^^^^^^^^^^^^ + + } + +} + diff --git a/tests/baselines/reference/checkJsObjectLiteralHasCheckedKeyof.js b/tests/baselines/reference/checkJsObjectLiteralHasCheckedKeyof.js index c8513a0fdc65c..19cd46fb0d40b 100644 --- a/tests/baselines/reference/checkJsObjectLiteralHasCheckedKeyof.js +++ b/tests/baselines/reference/checkJsObjectLiteralHasCheckedKeyof.js @@ -16,12 +16,12 @@ selected = "z"; // should fail //// [file.js] // @ts-check -var obj = { +const obj = { x: 1, y: 2 }; /** * @type {keyof typeof obj} */ -var selected = "x"; +let selected = "x"; selected = "z"; // should fail diff --git a/tests/baselines/reference/checkJsObjectLiteralIndexSignatures.js b/tests/baselines/reference/checkJsObjectLiteralIndexSignatures.js index 2ed6da1651593..1cb5b280d0484 100644 --- a/tests/baselines/reference/checkJsObjectLiteralIndexSignatures.js +++ b/tests/baselines/reference/checkJsObjectLiteralIndexSignatures.js @@ -16,10 +16,9 @@ stringIndex[s].toFixed(); //// [file.js] // @ts-check -var _a, _b; -var n = Math.random(); -var s = "".concat(n); -var numericIndex = (_a = {}, _a[n] = 1, _a); +let n = Math.random(); +let s = `${n}`; +const numericIndex = { [n]: 1 }; numericIndex[n].toFixed(); -var stringIndex = (_b = {}, _b[s] = 1, _b); +const stringIndex = { [s]: 1 }; stringIndex[s].toFixed(); diff --git a/tests/baselines/reference/checkJsdocSatisfiesTag15.js b/tests/baselines/reference/checkJsdocSatisfiesTag15.js index 9bf48fb0c473b..57005fd7befbf 100644 --- a/tests/baselines/reference/checkJsdocSatisfiesTag15.js +++ b/tests/baselines/reference/checkJsdocSatisfiesTag15.js @@ -46,50 +46,40 @@ export function fn7(uuid) {} //// [a.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.fn6 = exports.fn5 = exports.fn4 = exports.fn3 = exports.fn2 = exports.v2 = exports.v1 = exports.fn1 = void 0; -exports.fn7 = fn7; /** @satisfies {(uuid: string) => void} */ -var fn1 = function (uuid) { }; -exports.fn1 = fn1; +export const fn1 = uuid => { }; /** @typedef {Parameters} Foo */ /** @type Foo */ -exports.v1 = ['abc']; +export const v1 = ['abc']; /** @type Foo */ -exports.v2 = [123]; // error +export const v2 = [123]; // error /** @satisfies {(a: string, ...args: never) => void} */ -var fn2 = function (a, b) { }; -exports.fn2 = fn2; +export const fn2 = (a, b) => { }; /** * @satisfies {(a: string, ...args: never) => void} * @param {string} a */ -var fn3 = function (a, b) { }; -exports.fn3 = fn3; +export const fn3 = (a, b) => { }; /** * @satisfies {(a: string, ...args: never) => void} * @param {string} a * @param {number} b */ -var fn4 = function (a, b) { }; -exports.fn4 = fn4; +export const fn4 = (a, b) => { }; /** * @satisfies {(a: string, ...args: number[]) => void} * @param {string} a * @param {string} b */ -var fn5 = function (a, b) { }; -exports.fn5 = fn5; +export const fn5 = (a, b) => { }; /** * @satisfies {(a: string, ...args: number[]) => void} * @param {string} a * @param {string | number} b */ -var fn6 = function (a, b) { }; -exports.fn6 = fn6; +export const fn6 = (a, b) => { }; /** @satisfies {(uuid: string) => void} */ -function fn7(uuid) { } +export function fn7(uuid) { } //// [a.d.ts] diff --git a/tests/baselines/reference/checkJsdocTypeTag1.js b/tests/baselines/reference/checkJsdocTypeTag1.js index e605dfc187b34..a154f9d89a479 100644 --- a/tests/baselines/reference/checkJsdocTypeTag1.js +++ b/tests/baselines/reference/checkJsdocTypeTag1.js @@ -56,16 +56,16 @@ anyT = "hello"; var anyT1 = 2; anyT1 = "hi"; /** @type {Function} */ -var x = function (a) { return a + 1; }; +const x = (a) => a + 1; x(1); /** @type {function} */ -var y = function (a) { return a + 1; }; +const y = (a) => a + 1; y(1); /** @type {function (number)} */ -var x1 = function (a) { return a + 1; }; +const x1 = (a) => a + 1; x1(0); /** @type {function (number): number} */ -var x2 = function (a) { return a + 1; }; +const x2 = (a) => a + 1; x2(0); /** * @type {object} diff --git a/tests/baselines/reference/checkJsdocTypeTag2.js b/tests/baselines/reference/checkJsdocTypeTag2.js index 1e7db9aa49c82..ee542d60a97e7 100644 --- a/tests/baselines/reference/checkJsdocTypeTag2.js +++ b/tests/baselines/reference/checkJsdocTypeTag2.js @@ -34,16 +34,16 @@ var S = true; /** @type {number} */ var n = "hello"; /** @type {function (number)} */ -var x1 = function (a) { return a + 1; }; +const x1 = (a) => a + 1; x1("string"); /** @type {function (number): number} */ -var x2 = function (a) { return a + 1; }; +const x2 = (a) => a + 1; /** @type {string} */ var a; a = x2(0); /** @type {function (number): number} */ -var x3 = function (a) { return a.concat("hi"); }; +const x3 = (a) => a.concat("hi"); x3(0); /** @type {function (number): string} */ -var x4 = function (a) { return a + 1; }; +const x4 = (a) => a + 1; x4(0); diff --git a/tests/baselines/reference/checkJsdocTypeTagOnExportAssignment1.js b/tests/baselines/reference/checkJsdocTypeTagOnExportAssignment1.js index 4ba0cb44b7a7e..ad2d034a27f9a 100644 --- a/tests/baselines/reference/checkJsdocTypeTagOnExportAssignment1.js +++ b/tests/baselines/reference/checkJsdocTypeTagOnExportAssignment1.js @@ -34,5 +34,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -var a_1 = __importDefault(require("./a")); +const a_1 = __importDefault(require("./a")); a_1.default; diff --git a/tests/baselines/reference/checkJsdocTypeTagOnExportAssignment2.js b/tests/baselines/reference/checkJsdocTypeTagOnExportAssignment2.js index 309fb75ad8700..cb7d1e31eeabf 100644 --- a/tests/baselines/reference/checkJsdocTypeTagOnExportAssignment2.js +++ b/tests/baselines/reference/checkJsdocTypeTagOnExportAssignment2.js @@ -32,5 +32,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -var b_1 = __importDefault(require("./b")); +const b_1 = __importDefault(require("./b")); b_1.default; diff --git a/tests/baselines/reference/checkJsdocTypeTagOnExportAssignment3.js b/tests/baselines/reference/checkJsdocTypeTagOnExportAssignment3.js index a73cf1deae4a4..f97a3ac134f9e 100644 --- a/tests/baselines/reference/checkJsdocTypeTagOnExportAssignment3.js +++ b/tests/baselines/reference/checkJsdocTypeTagOnExportAssignment3.js @@ -28,7 +28,7 @@ a; * @property {boolean} b */ Object.defineProperty(exports, "__esModule", { value: true }); -var bar = { c: 1 }; +const bar = { c: 1 }; /** @type {Foo} */ exports.default = bar; //// [b.js] @@ -37,5 +37,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -var a_1 = __importDefault(require("./a")); +const a_1 = __importDefault(require("./a")); a_1.default; diff --git a/tests/baselines/reference/checkJsdocTypeTagOnExportAssignment5.js b/tests/baselines/reference/checkJsdocTypeTagOnExportAssignment5.js index 0934b84307c40..88badb94e9166 100644 --- a/tests/baselines/reference/checkJsdocTypeTagOnExportAssignment5.js +++ b/tests/baselines/reference/checkJsdocTypeTagOnExportAssignment5.js @@ -34,5 +34,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -var a_1 = __importDefault(require("./a")); +const a_1 = __importDefault(require("./a")); a_1.default; diff --git a/tests/baselines/reference/checkJsdocTypeTagOnExportAssignment6.js b/tests/baselines/reference/checkJsdocTypeTagOnExportAssignment6.js index 592d06b04074d..dbdd725c30c6f 100644 --- a/tests/baselines/reference/checkJsdocTypeTagOnExportAssignment6.js +++ b/tests/baselines/reference/checkJsdocTypeTagOnExportAssignment6.js @@ -34,5 +34,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -var a_1 = __importDefault(require("./a")); +const a_1 = __importDefault(require("./a")); a_1.default; diff --git a/tests/baselines/reference/checkJsdocTypeTagOnExportAssignment7.js b/tests/baselines/reference/checkJsdocTypeTagOnExportAssignment7.js index 217c55ad5e904..c77ce904d2fa2 100644 --- a/tests/baselines/reference/checkJsdocTypeTagOnExportAssignment7.js +++ b/tests/baselines/reference/checkJsdocTypeTagOnExportAssignment7.js @@ -28,7 +28,7 @@ a; * @property {number} b */ Object.defineProperty(exports, "__esModule", { value: true }); -var abc = { a: 1, b: 1, c: 1 }; +const abc = { a: 1, b: 1, c: 1 }; /** @type {Foo} */ exports.default = abc; //// [b.js] @@ -37,5 +37,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -var a_1 = __importDefault(require("./a")); +const a_1 = __importDefault(require("./a")); a_1.default; diff --git a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.js b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.js index 1c5c61fcbf5f2..015c24d006fe3 100644 --- a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.js +++ b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.js @@ -27,26 +27,24 @@ obj.bar1 = "42"; obj.arrowFunc(0); //// [0.js] -var _a; // @ts-check var lol = "hello Lol"; -var obj = (_a = { - /** @type {string|undefined} */ - foo: undefined, - /** @type {string|undefined} */ - bar: "42", - /** @type {function(number): number} */ - method1: function (n1) { - return n1 + 42; - }, - /** @type {string} */ - lol: lol +const obj = { + /** @type {string|undefined} */ + foo: undefined, + /** @type {string|undefined} */ + bar: "42", + /** @type {function(number): number} */ + method1(n1) { + return n1 + 42; }, + /** @type {string} */ + lol, /** @type {number} */ - _a['b' + 'ar1'] = 42, + ['b' + 'ar1']: 42, /** @type {function(number): number} */ - _a.arrowFunc = function (num) { return num + 42; }, - _a); + arrowFunc: (num) => num + 42 +}; obj.foo = 'string'; obj.lol; obj.bar = undefined; diff --git a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.js b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.js index 62fe33e8b2675..a2333e6b998b2 100644 --- a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.js +++ b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.js @@ -27,22 +27,19 @@ var s1 = obj.method2("0"); //// [0.js] // @ts-check var lol; -var obj = { +const obj = { /** @type {string|undefined} */ bar: 42, /** @type {function(number): number} */ - method1: function (n1) { + method1(n1) { return "42"; }, /** @type {function(number): number} */ - method2: function (n1) { return "lol"; }, + method2: (n1) => "lol", /** @type {function(number): number} */ - arrowFunc: function (num) { - if (num === void 0) { num = "0"; } - return num + 42; - }, + arrowFunc: (num = "0") => num + 42, /** @type {string} */ - lol: lol + lol }; lol = "string"; /** @type {string} */ diff --git a/tests/baselines/reference/checkJsdocTypedefOnlySourceFile.js b/tests/baselines/reference/checkJsdocTypedefOnlySourceFile.js index 5289265970499..76a2b24725d0b 100644 --- a/tests/baselines/reference/checkJsdocTypedefOnlySourceFile.js +++ b/tests/baselines/reference/checkJsdocTypedefOnlySourceFile.js @@ -22,4 +22,4 @@ var exports = {}; */ exports.SomeName; /** @type {exports.SomeName} */ -var myString = 'str'; +const myString = 'str'; diff --git a/tests/baselines/reference/checkJsxChildrenCanBeTupleType.js b/tests/baselines/reference/checkJsxChildrenCanBeTupleType.js index 1294b6c45080f..382e94ed12618 100644 --- a/tests/baselines/reference/checkJsxChildrenCanBeTupleType.js +++ b/tests/baselines/reference/checkJsxChildrenCanBeTupleType.js @@ -24,39 +24,14 @@ const testErr = //// [checkJsxChildrenCanBeTupleType.js] -"use strict"; /// -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var react_1 = __importDefault(require("react")); -var ResizablePanel = /** @class */ (function (_super) { - __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, - 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)); +import React from 'react'; +class ResizablePanel extends React.Component { +} +const test = React.createElement(ResizablePanel, null, + React.createElement("div", null), + React.createElement("div", null)); +const testErr = React.createElement(ResizablePanel, null, + React.createElement("div", null), + React.createElement("div", null), + React.createElement("div", null)); diff --git a/tests/baselines/reference/checkJsxChildrenProperty1.js b/tests/baselines/reference/checkJsxChildrenProperty1.js index ff4d1a8084bc1..3f405c3cf92a2 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty1.js +++ b/tests/baselines/reference/checkJsxChildrenProperty1.js @@ -30,15 +30,15 @@ let k2 = "use strict"; /// Object.defineProperty(exports, "__esModule", { value: true }); -var React = require("react"); +const React = require("react"); function Comp(p) { return
{p.b}
; } // OK -var k = ; -var k1 = +let k = ; +let k1 = hi hi hi! ; -var k2 = +let k2 =
hi hi hi!
; diff --git a/tests/baselines/reference/checkJsxChildrenProperty10.js b/tests/baselines/reference/checkJsxChildrenProperty10.js index e6a7b590603bb..71f47b108f1b7 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty10.js +++ b/tests/baselines/reference/checkJsxChildrenProperty10.js @@ -25,16 +25,13 @@ let k3 =
{1} {"That is a number"}
; let k4 = ; //// [file.jsx] -var Button = /** @class */ (function () { - function Button() { - } - Button.prototype.render = function () { +class Button { + render() { return (
My Button
); - }; - return Button; -}()); + } +} // OK -var k1 =

Hello

world

; -var k2 =

Hello

{function (user) { return

{user.name}

; }}
; -var k3 =
{1} {"That is a number"}
; -var k4 = ; +let k1 =

Hello

world

; +let k2 =

Hello

{(user) =>

{user.name}

}
; +let k3 =
{1} {"That is a number"}
; +let k4 = ; diff --git a/tests/baselines/reference/checkJsxChildrenProperty11.js b/tests/baselines/reference/checkJsxChildrenProperty11.js index 32370da04024b..d56ee32096b51 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty11.js +++ b/tests/baselines/reference/checkJsxChildrenProperty11.js @@ -25,16 +25,13 @@ let k3 =
{1} {"That is a number"}
; let k4 = ; //// [file.jsx] -var Button = /** @class */ (function () { - function Button() { - } - Button.prototype.render = function () { +class Button { + render() { return (
My Button
); - }; - return Button; -}()); + } +} // OK -var k1 =

Hello

world

; -var k2 =

Hello

{function (user) { return

{user.name}

; }}
; -var k3 =
{1} {"That is a number"}
; -var k4 = ; +let k1 =

Hello

world

; +let k2 =

Hello

{(user) =>

{user.name}

}
; +let k3 =
{1} {"That is a number"}
; +let k4 = ; diff --git a/tests/baselines/reference/checkJsxChildrenProperty12.js b/tests/baselines/reference/checkJsxChildrenProperty12.js index eb3bfc8c63eef..65056447f0592 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty12.js +++ b/tests/baselines/reference/checkJsxChildrenProperty12.js @@ -39,30 +39,11 @@ class InnerButton extends React.Component { //// [file.jsx] "use strict"; /// -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", { value: true }); -var React = require("react"); -var Button = /** @class */ (function (_super) { - __extends(Button, _super); - function Button() { - return _super !== null && _super.apply(this, arguments) || this; - } - Button.prototype.render = function () { - var condition; +const React = require("react"); +class Button extends React.Component { + render() { + let condition; if (condition) { return ; } @@ -71,16 +52,10 @@ var Button = /** @class */ (function (_super) {
Hello World
); } - }; - return Button; -}(React.Component)); -var InnerButton = /** @class */ (function (_super) { - __extends(InnerButton, _super); - function InnerButton() { - return _super !== null && _super.apply(this, arguments) || this; } - InnerButton.prototype.render = function () { +} +class InnerButton extends React.Component { + render() { return (); - }; - return InnerButton; -}(React.Component)); + } +} diff --git a/tests/baselines/reference/checkJsxChildrenProperty13.js b/tests/baselines/reference/checkJsxChildrenProperty13.js index 477461b0a55ac..4ab4e6c4ad2b4 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty13.js +++ b/tests/baselines/reference/checkJsxChildrenProperty13.js @@ -34,43 +34,18 @@ class InnerButton extends React.Component { //// [file.jsx] "use strict"; /// -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", { value: true }); -var React = require("react"); -var Button = /** @class */ (function (_super) { - __extends(Button, _super); - function Button() { - return _super !== null && _super.apply(this, arguments) || this; - } - Button.prototype.render = function () { +const React = require("react"); +class Button extends React.Component { + render() { // Error children are specified twice return (
Hello World
); - }; - return Button; -}(React.Component)); -var InnerButton = /** @class */ (function (_super) { - __extends(InnerButton, _super); - function InnerButton() { - return _super !== null && _super.apply(this, arguments) || this; } - InnerButton.prototype.render = function () { +} +class InnerButton extends React.Component { + render() { return (); - }; - return InnerButton; -}(React.Component)); + } +} diff --git a/tests/baselines/reference/checkJsxChildrenProperty14.js b/tests/baselines/reference/checkJsxChildrenProperty14.js index d02609fbaf266..e4572a60c152c 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty14.js +++ b/tests/baselines/reference/checkJsxChildrenProperty14.js @@ -49,33 +49,13 @@ let k5 = <>